Skip to main content

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 gaxi;
23extern crate google_cloud_gax;
24extern crate google_cloud_iam_v1;
25extern crate google_cloud_longrunning;
26extern crate google_cloud_lro;
27extern crate google_cloud_rpc;
28extern crate serde;
29extern crate serde_json;
30extern crate serde_with;
31extern crate std;
32extern crate tracing;
33extern crate wkt;
34
35mod debug;
36mod deserialize;
37mod serialize;
38
39/// A backup of a Cloud Spanner database.
40#[derive(Clone, Default, PartialEq)]
41#[non_exhaustive]
42pub struct Backup {
43    /// Required for the
44    /// [CreateBackup][google.spanner.admin.database.v1.DatabaseAdmin.CreateBackup]
45    /// operation. Name of the database from which this backup was created. This
46    /// needs to be in the same instance as the backup. Values are of the form
47    /// `projects/<project>/instances/<instance>/databases/<database>`.
48    ///
49    /// [google.spanner.admin.database.v1.DatabaseAdmin.CreateBackup]: crate::client::DatabaseAdmin::create_backup
50    pub database: std::string::String,
51
52    /// The backup will contain an externally consistent copy of the database at
53    /// the timestamp specified by `version_time`. If `version_time` is not
54    /// specified, the system will set `version_time` to the `create_time` of the
55    /// backup.
56    pub version_time: std::option::Option<wkt::Timestamp>,
57
58    /// Required for the
59    /// [CreateBackup][google.spanner.admin.database.v1.DatabaseAdmin.CreateBackup]
60    /// operation. The expiration time of the backup, with microseconds
61    /// granularity that must be at least 6 hours and at most 366 days
62    /// from the time the CreateBackup request is processed. Once the `expire_time`
63    /// has passed, the backup is eligible to be automatically deleted by Cloud
64    /// Spanner to free the resources used by the backup.
65    ///
66    /// [google.spanner.admin.database.v1.DatabaseAdmin.CreateBackup]: crate::client::DatabaseAdmin::create_backup
67    pub expire_time: std::option::Option<wkt::Timestamp>,
68
69    /// Output only for the
70    /// [CreateBackup][google.spanner.admin.database.v1.DatabaseAdmin.CreateBackup]
71    /// operation. Required for the
72    /// [UpdateBackup][google.spanner.admin.database.v1.DatabaseAdmin.UpdateBackup]
73    /// operation.
74    ///
75    /// A globally unique identifier for the backup which cannot be
76    /// changed. Values are of the form
77    /// `projects/<project>/instances/<instance>/backups/[a-z][a-z0-9_\-]*[a-z0-9]`
78    /// The final segment of the name must be between 2 and 60 characters
79    /// in length.
80    ///
81    /// The backup is stored in the location(s) specified in the instance
82    /// configuration of the instance containing the backup, identified
83    /// by the prefix of the backup name of the form
84    /// `projects/<project>/instances/<instance>`.
85    ///
86    /// [google.spanner.admin.database.v1.DatabaseAdmin.CreateBackup]: crate::client::DatabaseAdmin::create_backup
87    /// [google.spanner.admin.database.v1.DatabaseAdmin.UpdateBackup]: crate::client::DatabaseAdmin::update_backup
88    pub name: std::string::String,
89
90    /// Output only. The time the
91    /// [CreateBackup][google.spanner.admin.database.v1.DatabaseAdmin.CreateBackup]
92    /// request is received. If the request does not specify `version_time`, the
93    /// `version_time` of the backup will be equivalent to the `create_time`.
94    ///
95    /// [google.spanner.admin.database.v1.DatabaseAdmin.CreateBackup]: crate::client::DatabaseAdmin::create_backup
96    pub create_time: std::option::Option<wkt::Timestamp>,
97
98    /// Output only. Size of the backup in bytes.
99    pub size_bytes: i64,
100
101    /// Output only. The number of bytes that will be freed by deleting this
102    /// backup. This value will be zero if, for example, this backup is part of an
103    /// incremental backup chain and younger backups in the chain require that we
104    /// keep its data. For backups not in an incremental backup chain, this is
105    /// always the size of the backup. This value may change if backups on the same
106    /// chain get created, deleted or expired.
107    pub freeable_size_bytes: i64,
108
109    /// Output only. For a backup in an incremental backup chain, this is the
110    /// storage space needed to keep the data that has changed since the previous
111    /// backup. For all other backups, this is always the size of the backup. This
112    /// value may change if backups on the same chain get deleted or expired.
113    ///
114    /// This field can be used to calculate the total storage space used by a set
115    /// of backups. For example, the total space used by all backups of a database
116    /// can be computed by summing up this field.
117    pub exclusive_size_bytes: i64,
118
119    /// Output only. The current state of the backup.
120    pub state: crate::model::backup::State,
121
122    /// Output only. The names of the restored databases that reference the backup.
123    /// The database names are of
124    /// the form `projects/<project>/instances/<instance>/databases/<database>`.
125    /// Referencing databases may exist in different instances. The existence of
126    /// any referencing database prevents the backup from being deleted. When a
127    /// restored database from the backup enters the `READY` state, the reference
128    /// to the backup is removed.
129    pub referencing_databases: std::vec::Vec<std::string::String>,
130
131    /// Output only. The encryption information for the backup.
132    pub encryption_info: std::option::Option<crate::model::EncryptionInfo>,
133
134    /// Output only. The encryption information for the backup, whether it is
135    /// protected by one or more KMS keys. The information includes all Cloud
136    /// KMS key versions used to encrypt the backup. The `encryption_status' field
137    /// inside of each `EncryptionInfo` is not populated. At least one of the key
138    /// versions must be available for the backup to be restored. If a key version
139    /// is revoked in the middle of a restore, the restore behavior is undefined.
140    pub encryption_information: std::vec::Vec<crate::model::EncryptionInfo>,
141
142    /// Output only. The database dialect information for the backup.
143    pub database_dialect: crate::model::DatabaseDialect,
144
145    /// Output only. The names of the destination backups being created by copying
146    /// this source backup. The backup names are of the form
147    /// `projects/<project>/instances/<instance>/backups/<backup>`.
148    /// Referencing backups may exist in different instances. The existence of
149    /// any referencing backup prevents the backup from being deleted. When the
150    /// copy operation is done (either successfully completed or cancelled or the
151    /// destination backup is deleted), the reference to the backup is removed.
152    pub referencing_backups: std::vec::Vec<std::string::String>,
153
154    /// Output only. The max allowed expiration time of the backup, with
155    /// microseconds granularity. A backup's expiration time can be configured in
156    /// multiple APIs: CreateBackup, UpdateBackup, CopyBackup. When updating or
157    /// copying an existing backup, the expiration time specified must be
158    /// less than `Backup.max_expire_time`.
159    pub max_expire_time: std::option::Option<wkt::Timestamp>,
160
161    /// Output only. List of backup schedule URIs that are associated with
162    /// creating this backup. This is only applicable for scheduled backups, and
163    /// is empty for on-demand backups.
164    ///
165    /// To optimize for storage, whenever possible, multiple schedules are
166    /// collapsed together to create one backup. In such cases, this field captures
167    /// the list of all backup schedule URIs that are associated with creating
168    /// this backup. If collapsing is not done, then this field captures the
169    /// single backup schedule URI associated with creating this backup.
170    pub backup_schedules: std::vec::Vec<std::string::String>,
171
172    /// Output only. Populated only for backups in an incremental backup chain.
173    /// Backups share the same chain id if and only if they belong to the same
174    /// incremental backup chain. Use this field to determine which backups are
175    /// part of the same incremental backup chain. The ordering of backups in the
176    /// chain can be determined by ordering the backup `version_time`.
177    pub incremental_backup_chain_id: std::string::String,
178
179    /// Output only. Data deleted at a time older than this is guaranteed not to be
180    /// retained in order to support this backup. For a backup in an incremental
181    /// backup chain, this is the version time of the oldest backup that exists or
182    /// ever existed in the chain. For all other backups, this is the version time
183    /// of the backup. This field can be used to understand what data is being
184    /// retained by the backup system.
185    pub oldest_version_time: std::option::Option<wkt::Timestamp>,
186
187    /// Output only. The instance partition(s) storing the backup.
188    ///
189    /// This is the same as the list of the instance partition(s) that the database
190    /// had footprint in at the backup's `version_time`.
191    pub instance_partitions: std::vec::Vec<crate::model::BackupInstancePartition>,
192
193    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
194}
195
196impl Backup {
197    /// Creates a new default instance.
198    pub fn new() -> Self {
199        std::default::Default::default()
200    }
201
202    /// Sets the value of [database][crate::model::Backup::database].
203    ///
204    /// # Example
205    /// ```ignore,no_run
206    /// # use google_cloud_spanner_admin_database_v1::model::Backup;
207    /// # let project_id = "project_id";
208    /// # let instance_id = "instance_id";
209    /// # let database_id = "database_id";
210    /// let x = Backup::new().set_database(format!("projects/{project_id}/instances/{instance_id}/databases/{database_id}"));
211    /// ```
212    pub fn set_database<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
213        self.database = v.into();
214        self
215    }
216
217    /// Sets the value of [version_time][crate::model::Backup::version_time].
218    ///
219    /// # Example
220    /// ```ignore,no_run
221    /// # use google_cloud_spanner_admin_database_v1::model::Backup;
222    /// use wkt::Timestamp;
223    /// let x = Backup::new().set_version_time(Timestamp::default()/* use setters */);
224    /// ```
225    pub fn set_version_time<T>(mut self, v: T) -> Self
226    where
227        T: std::convert::Into<wkt::Timestamp>,
228    {
229        self.version_time = std::option::Option::Some(v.into());
230        self
231    }
232
233    /// Sets or clears the value of [version_time][crate::model::Backup::version_time].
234    ///
235    /// # Example
236    /// ```ignore,no_run
237    /// # use google_cloud_spanner_admin_database_v1::model::Backup;
238    /// use wkt::Timestamp;
239    /// let x = Backup::new().set_or_clear_version_time(Some(Timestamp::default()/* use setters */));
240    /// let x = Backup::new().set_or_clear_version_time(None::<Timestamp>);
241    /// ```
242    pub fn set_or_clear_version_time<T>(mut self, v: std::option::Option<T>) -> Self
243    where
244        T: std::convert::Into<wkt::Timestamp>,
245    {
246        self.version_time = v.map(|x| x.into());
247        self
248    }
249
250    /// Sets the value of [expire_time][crate::model::Backup::expire_time].
251    ///
252    /// # Example
253    /// ```ignore,no_run
254    /// # use google_cloud_spanner_admin_database_v1::model::Backup;
255    /// use wkt::Timestamp;
256    /// let x = Backup::new().set_expire_time(Timestamp::default()/* use setters */);
257    /// ```
258    pub fn set_expire_time<T>(mut self, v: T) -> Self
259    where
260        T: std::convert::Into<wkt::Timestamp>,
261    {
262        self.expire_time = std::option::Option::Some(v.into());
263        self
264    }
265
266    /// Sets or clears the value of [expire_time][crate::model::Backup::expire_time].
267    ///
268    /// # Example
269    /// ```ignore,no_run
270    /// # use google_cloud_spanner_admin_database_v1::model::Backup;
271    /// use wkt::Timestamp;
272    /// let x = Backup::new().set_or_clear_expire_time(Some(Timestamp::default()/* use setters */));
273    /// let x = Backup::new().set_or_clear_expire_time(None::<Timestamp>);
274    /// ```
275    pub fn set_or_clear_expire_time<T>(mut self, v: std::option::Option<T>) -> Self
276    where
277        T: std::convert::Into<wkt::Timestamp>,
278    {
279        self.expire_time = v.map(|x| x.into());
280        self
281    }
282
283    /// Sets the value of [name][crate::model::Backup::name].
284    ///
285    /// # Example
286    /// ```ignore,no_run
287    /// # use google_cloud_spanner_admin_database_v1::model::Backup;
288    /// # let project_id = "project_id";
289    /// # let instance_id = "instance_id";
290    /// # let backup_id = "backup_id";
291    /// let x = Backup::new().set_name(format!("projects/{project_id}/instances/{instance_id}/backups/{backup_id}"));
292    /// ```
293    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
294        self.name = v.into();
295        self
296    }
297
298    /// Sets the value of [create_time][crate::model::Backup::create_time].
299    ///
300    /// # Example
301    /// ```ignore,no_run
302    /// # use google_cloud_spanner_admin_database_v1::model::Backup;
303    /// use wkt::Timestamp;
304    /// let x = Backup::new().set_create_time(Timestamp::default()/* use setters */);
305    /// ```
306    pub fn set_create_time<T>(mut self, v: T) -> Self
307    where
308        T: std::convert::Into<wkt::Timestamp>,
309    {
310        self.create_time = std::option::Option::Some(v.into());
311        self
312    }
313
314    /// Sets or clears the value of [create_time][crate::model::Backup::create_time].
315    ///
316    /// # Example
317    /// ```ignore,no_run
318    /// # use google_cloud_spanner_admin_database_v1::model::Backup;
319    /// use wkt::Timestamp;
320    /// let x = Backup::new().set_or_clear_create_time(Some(Timestamp::default()/* use setters */));
321    /// let x = Backup::new().set_or_clear_create_time(None::<Timestamp>);
322    /// ```
323    pub fn set_or_clear_create_time<T>(mut self, v: std::option::Option<T>) -> Self
324    where
325        T: std::convert::Into<wkt::Timestamp>,
326    {
327        self.create_time = v.map(|x| x.into());
328        self
329    }
330
331    /// Sets the value of [size_bytes][crate::model::Backup::size_bytes].
332    ///
333    /// # Example
334    /// ```ignore,no_run
335    /// # use google_cloud_spanner_admin_database_v1::model::Backup;
336    /// let x = Backup::new().set_size_bytes(42);
337    /// ```
338    pub fn set_size_bytes<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
339        self.size_bytes = v.into();
340        self
341    }
342
343    /// Sets the value of [freeable_size_bytes][crate::model::Backup::freeable_size_bytes].
344    ///
345    /// # Example
346    /// ```ignore,no_run
347    /// # use google_cloud_spanner_admin_database_v1::model::Backup;
348    /// let x = Backup::new().set_freeable_size_bytes(42);
349    /// ```
350    pub fn set_freeable_size_bytes<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
351        self.freeable_size_bytes = v.into();
352        self
353    }
354
355    /// Sets the value of [exclusive_size_bytes][crate::model::Backup::exclusive_size_bytes].
356    ///
357    /// # Example
358    /// ```ignore,no_run
359    /// # use google_cloud_spanner_admin_database_v1::model::Backup;
360    /// let x = Backup::new().set_exclusive_size_bytes(42);
361    /// ```
362    pub fn set_exclusive_size_bytes<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
363        self.exclusive_size_bytes = v.into();
364        self
365    }
366
367    /// Sets the value of [state][crate::model::Backup::state].
368    ///
369    /// # Example
370    /// ```ignore,no_run
371    /// # use google_cloud_spanner_admin_database_v1::model::Backup;
372    /// use google_cloud_spanner_admin_database_v1::model::backup::State;
373    /// let x0 = Backup::new().set_state(State::Creating);
374    /// let x1 = Backup::new().set_state(State::Ready);
375    /// ```
376    pub fn set_state<T: std::convert::Into<crate::model::backup::State>>(mut self, v: T) -> Self {
377        self.state = v.into();
378        self
379    }
380
381    /// Sets the value of [referencing_databases][crate::model::Backup::referencing_databases].
382    ///
383    /// # Example
384    /// ```ignore,no_run
385    /// # use google_cloud_spanner_admin_database_v1::model::Backup;
386    /// let x = Backup::new().set_referencing_databases(["a", "b", "c"]);
387    /// ```
388    pub fn set_referencing_databases<T, V>(mut self, v: T) -> Self
389    where
390        T: std::iter::IntoIterator<Item = V>,
391        V: std::convert::Into<std::string::String>,
392    {
393        use std::iter::Iterator;
394        self.referencing_databases = v.into_iter().map(|i| i.into()).collect();
395        self
396    }
397
398    /// Sets the value of [encryption_info][crate::model::Backup::encryption_info].
399    ///
400    /// # Example
401    /// ```ignore,no_run
402    /// # use google_cloud_spanner_admin_database_v1::model::Backup;
403    /// use google_cloud_spanner_admin_database_v1::model::EncryptionInfo;
404    /// let x = Backup::new().set_encryption_info(EncryptionInfo::default()/* use setters */);
405    /// ```
406    pub fn set_encryption_info<T>(mut self, v: T) -> Self
407    where
408        T: std::convert::Into<crate::model::EncryptionInfo>,
409    {
410        self.encryption_info = std::option::Option::Some(v.into());
411        self
412    }
413
414    /// Sets or clears the value of [encryption_info][crate::model::Backup::encryption_info].
415    ///
416    /// # Example
417    /// ```ignore,no_run
418    /// # use google_cloud_spanner_admin_database_v1::model::Backup;
419    /// use google_cloud_spanner_admin_database_v1::model::EncryptionInfo;
420    /// let x = Backup::new().set_or_clear_encryption_info(Some(EncryptionInfo::default()/* use setters */));
421    /// let x = Backup::new().set_or_clear_encryption_info(None::<EncryptionInfo>);
422    /// ```
423    pub fn set_or_clear_encryption_info<T>(mut self, v: std::option::Option<T>) -> Self
424    where
425        T: std::convert::Into<crate::model::EncryptionInfo>,
426    {
427        self.encryption_info = v.map(|x| x.into());
428        self
429    }
430
431    /// Sets the value of [encryption_information][crate::model::Backup::encryption_information].
432    ///
433    /// # Example
434    /// ```ignore,no_run
435    /// # use google_cloud_spanner_admin_database_v1::model::Backup;
436    /// use google_cloud_spanner_admin_database_v1::model::EncryptionInfo;
437    /// let x = Backup::new()
438    ///     .set_encryption_information([
439    ///         EncryptionInfo::default()/* use setters */,
440    ///         EncryptionInfo::default()/* use (different) setters */,
441    ///     ]);
442    /// ```
443    pub fn set_encryption_information<T, V>(mut self, v: T) -> Self
444    where
445        T: std::iter::IntoIterator<Item = V>,
446        V: std::convert::Into<crate::model::EncryptionInfo>,
447    {
448        use std::iter::Iterator;
449        self.encryption_information = v.into_iter().map(|i| i.into()).collect();
450        self
451    }
452
453    /// Sets the value of [database_dialect][crate::model::Backup::database_dialect].
454    ///
455    /// # Example
456    /// ```ignore,no_run
457    /// # use google_cloud_spanner_admin_database_v1::model::Backup;
458    /// use google_cloud_spanner_admin_database_v1::model::DatabaseDialect;
459    /// let x0 = Backup::new().set_database_dialect(DatabaseDialect::GoogleStandardSql);
460    /// let x1 = Backup::new().set_database_dialect(DatabaseDialect::Postgresql);
461    /// ```
462    pub fn set_database_dialect<T: std::convert::Into<crate::model::DatabaseDialect>>(
463        mut self,
464        v: T,
465    ) -> Self {
466        self.database_dialect = v.into();
467        self
468    }
469
470    /// Sets the value of [referencing_backups][crate::model::Backup::referencing_backups].
471    ///
472    /// # Example
473    /// ```ignore,no_run
474    /// # use google_cloud_spanner_admin_database_v1::model::Backup;
475    /// let x = Backup::new().set_referencing_backups(["a", "b", "c"]);
476    /// ```
477    pub fn set_referencing_backups<T, V>(mut self, v: T) -> Self
478    where
479        T: std::iter::IntoIterator<Item = V>,
480        V: std::convert::Into<std::string::String>,
481    {
482        use std::iter::Iterator;
483        self.referencing_backups = v.into_iter().map(|i| i.into()).collect();
484        self
485    }
486
487    /// Sets the value of [max_expire_time][crate::model::Backup::max_expire_time].
488    ///
489    /// # Example
490    /// ```ignore,no_run
491    /// # use google_cloud_spanner_admin_database_v1::model::Backup;
492    /// use wkt::Timestamp;
493    /// let x = Backup::new().set_max_expire_time(Timestamp::default()/* use setters */);
494    /// ```
495    pub fn set_max_expire_time<T>(mut self, v: T) -> Self
496    where
497        T: std::convert::Into<wkt::Timestamp>,
498    {
499        self.max_expire_time = std::option::Option::Some(v.into());
500        self
501    }
502
503    /// Sets or clears the value of [max_expire_time][crate::model::Backup::max_expire_time].
504    ///
505    /// # Example
506    /// ```ignore,no_run
507    /// # use google_cloud_spanner_admin_database_v1::model::Backup;
508    /// use wkt::Timestamp;
509    /// let x = Backup::new().set_or_clear_max_expire_time(Some(Timestamp::default()/* use setters */));
510    /// let x = Backup::new().set_or_clear_max_expire_time(None::<Timestamp>);
511    /// ```
512    pub fn set_or_clear_max_expire_time<T>(mut self, v: std::option::Option<T>) -> Self
513    where
514        T: std::convert::Into<wkt::Timestamp>,
515    {
516        self.max_expire_time = v.map(|x| x.into());
517        self
518    }
519
520    /// Sets the value of [backup_schedules][crate::model::Backup::backup_schedules].
521    ///
522    /// # Example
523    /// ```ignore,no_run
524    /// # use google_cloud_spanner_admin_database_v1::model::Backup;
525    /// let x = Backup::new().set_backup_schedules(["a", "b", "c"]);
526    /// ```
527    pub fn set_backup_schedules<T, V>(mut self, v: T) -> Self
528    where
529        T: std::iter::IntoIterator<Item = V>,
530        V: std::convert::Into<std::string::String>,
531    {
532        use std::iter::Iterator;
533        self.backup_schedules = v.into_iter().map(|i| i.into()).collect();
534        self
535    }
536
537    /// Sets the value of [incremental_backup_chain_id][crate::model::Backup::incremental_backup_chain_id].
538    ///
539    /// # Example
540    /// ```ignore,no_run
541    /// # use google_cloud_spanner_admin_database_v1::model::Backup;
542    /// let x = Backup::new().set_incremental_backup_chain_id("example");
543    /// ```
544    pub fn set_incremental_backup_chain_id<T: std::convert::Into<std::string::String>>(
545        mut self,
546        v: T,
547    ) -> Self {
548        self.incremental_backup_chain_id = v.into();
549        self
550    }
551
552    /// Sets the value of [oldest_version_time][crate::model::Backup::oldest_version_time].
553    ///
554    /// # Example
555    /// ```ignore,no_run
556    /// # use google_cloud_spanner_admin_database_v1::model::Backup;
557    /// use wkt::Timestamp;
558    /// let x = Backup::new().set_oldest_version_time(Timestamp::default()/* use setters */);
559    /// ```
560    pub fn set_oldest_version_time<T>(mut self, v: T) -> Self
561    where
562        T: std::convert::Into<wkt::Timestamp>,
563    {
564        self.oldest_version_time = std::option::Option::Some(v.into());
565        self
566    }
567
568    /// Sets or clears the value of [oldest_version_time][crate::model::Backup::oldest_version_time].
569    ///
570    /// # Example
571    /// ```ignore,no_run
572    /// # use google_cloud_spanner_admin_database_v1::model::Backup;
573    /// use wkt::Timestamp;
574    /// let x = Backup::new().set_or_clear_oldest_version_time(Some(Timestamp::default()/* use setters */));
575    /// let x = Backup::new().set_or_clear_oldest_version_time(None::<Timestamp>);
576    /// ```
577    pub fn set_or_clear_oldest_version_time<T>(mut self, v: std::option::Option<T>) -> Self
578    where
579        T: std::convert::Into<wkt::Timestamp>,
580    {
581        self.oldest_version_time = v.map(|x| x.into());
582        self
583    }
584
585    /// Sets the value of [instance_partitions][crate::model::Backup::instance_partitions].
586    ///
587    /// # Example
588    /// ```ignore,no_run
589    /// # use google_cloud_spanner_admin_database_v1::model::Backup;
590    /// use google_cloud_spanner_admin_database_v1::model::BackupInstancePartition;
591    /// let x = Backup::new()
592    ///     .set_instance_partitions([
593    ///         BackupInstancePartition::default()/* use setters */,
594    ///         BackupInstancePartition::default()/* use (different) setters */,
595    ///     ]);
596    /// ```
597    pub fn set_instance_partitions<T, V>(mut self, v: T) -> Self
598    where
599        T: std::iter::IntoIterator<Item = V>,
600        V: std::convert::Into<crate::model::BackupInstancePartition>,
601    {
602        use std::iter::Iterator;
603        self.instance_partitions = v.into_iter().map(|i| i.into()).collect();
604        self
605    }
606}
607
608impl wkt::message::Message for Backup {
609    fn typename() -> &'static str {
610        "type.googleapis.com/google.spanner.admin.database.v1.Backup"
611    }
612}
613
614/// Defines additional types related to [Backup].
615pub mod backup {
616    #[allow(unused_imports)]
617    use super::*;
618
619    /// Indicates the current state of the backup.
620    ///
621    /// # Working with unknown values
622    ///
623    /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
624    /// additional enum variants at any time. Adding new variants is not considered
625    /// a breaking change. Applications should write their code in anticipation of:
626    ///
627    /// - New values appearing in future releases of the client library, **and**
628    /// - New values received dynamically, without application changes.
629    ///
630    /// Please consult the [Working with enums] section in the user guide for some
631    /// guidelines.
632    ///
633    /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
634    #[derive(Clone, Debug, PartialEq)]
635    #[non_exhaustive]
636    pub enum State {
637        /// Not specified.
638        Unspecified,
639        /// The pending backup is still being created. Operations on the
640        /// backup may fail with `FAILED_PRECONDITION` in this state.
641        Creating,
642        /// The backup is complete and ready for use.
643        Ready,
644        /// If set, the enum was initialized with an unknown value.
645        ///
646        /// Applications can examine the value using [State::value] or
647        /// [State::name].
648        UnknownValue(state::UnknownValue),
649    }
650
651    #[doc(hidden)]
652    pub mod state {
653        #[allow(unused_imports)]
654        use super::*;
655        #[derive(Clone, Debug, PartialEq)]
656        pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
657    }
658
659    impl State {
660        /// Gets the enum value.
661        ///
662        /// Returns `None` if the enum contains an unknown value deserialized from
663        /// the string representation of enums.
664        pub fn value(&self) -> std::option::Option<i32> {
665            match self {
666                Self::Unspecified => std::option::Option::Some(0),
667                Self::Creating => std::option::Option::Some(1),
668                Self::Ready => std::option::Option::Some(2),
669                Self::UnknownValue(u) => u.0.value(),
670            }
671        }
672
673        /// Gets the enum value as a string.
674        ///
675        /// Returns `None` if the enum contains an unknown value deserialized from
676        /// the integer representation of enums.
677        pub fn name(&self) -> std::option::Option<&str> {
678            match self {
679                Self::Unspecified => std::option::Option::Some("STATE_UNSPECIFIED"),
680                Self::Creating => std::option::Option::Some("CREATING"),
681                Self::Ready => std::option::Option::Some("READY"),
682                Self::UnknownValue(u) => u.0.name(),
683            }
684        }
685    }
686
687    impl std::default::Default for State {
688        fn default() -> Self {
689            use std::convert::From;
690            Self::from(0)
691        }
692    }
693
694    impl std::fmt::Display for State {
695        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
696            wkt::internal::display_enum(f, self.name(), self.value())
697        }
698    }
699
700    impl std::convert::From<i32> for State {
701        fn from(value: i32) -> Self {
702            match value {
703                0 => Self::Unspecified,
704                1 => Self::Creating,
705                2 => Self::Ready,
706                _ => Self::UnknownValue(state::UnknownValue(
707                    wkt::internal::UnknownEnumValue::Integer(value),
708                )),
709            }
710        }
711    }
712
713    impl std::convert::From<&str> for State {
714        fn from(value: &str) -> Self {
715            use std::string::ToString;
716            match value {
717                "STATE_UNSPECIFIED" => Self::Unspecified,
718                "CREATING" => Self::Creating,
719                "READY" => Self::Ready,
720                _ => Self::UnknownValue(state::UnknownValue(
721                    wkt::internal::UnknownEnumValue::String(value.to_string()),
722                )),
723            }
724        }
725    }
726
727    impl serde::ser::Serialize for State {
728        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
729        where
730            S: serde::Serializer,
731        {
732            match self {
733                Self::Unspecified => serializer.serialize_i32(0),
734                Self::Creating => serializer.serialize_i32(1),
735                Self::Ready => serializer.serialize_i32(2),
736                Self::UnknownValue(u) => u.0.serialize(serializer),
737            }
738        }
739    }
740
741    impl<'de> serde::de::Deserialize<'de> for State {
742        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
743        where
744            D: serde::Deserializer<'de>,
745        {
746            deserializer.deserialize_any(wkt::internal::EnumVisitor::<State>::new(
747                ".google.spanner.admin.database.v1.Backup.State",
748            ))
749        }
750    }
751}
752
753/// The request for
754/// [CreateBackup][google.spanner.admin.database.v1.DatabaseAdmin.CreateBackup].
755///
756/// [google.spanner.admin.database.v1.DatabaseAdmin.CreateBackup]: crate::client::DatabaseAdmin::create_backup
757#[derive(Clone, Default, PartialEq)]
758#[non_exhaustive]
759pub struct CreateBackupRequest {
760    /// Required. The name of the instance in which the backup will be
761    /// created. This must be the same instance that contains the database the
762    /// backup will be created from. The backup will be stored in the
763    /// location(s) specified in the instance configuration of this
764    /// instance. Values are of the form
765    /// `projects/<project>/instances/<instance>`.
766    pub parent: std::string::String,
767
768    /// Required. The id of the backup to be created. The `backup_id` appended to
769    /// `parent` forms the full backup name of the form
770    /// `projects/<project>/instances/<instance>/backups/<backup_id>`.
771    pub backup_id: std::string::String,
772
773    /// Required. The backup to create.
774    pub backup: std::option::Option<crate::model::Backup>,
775
776    /// Optional. The encryption configuration used to encrypt the backup. If this
777    /// field is not specified, the backup will use the same encryption
778    /// configuration as the database by default, namely
779    /// [encryption_type][google.spanner.admin.database.v1.CreateBackupEncryptionConfig.encryption_type]
780    /// = `USE_DATABASE_ENCRYPTION`.
781    ///
782    /// [google.spanner.admin.database.v1.CreateBackupEncryptionConfig.encryption_type]: crate::model::CreateBackupEncryptionConfig::encryption_type
783    pub encryption_config: std::option::Option<crate::model::CreateBackupEncryptionConfig>,
784
785    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
786}
787
788impl CreateBackupRequest {
789    /// Creates a new default instance.
790    pub fn new() -> Self {
791        std::default::Default::default()
792    }
793
794    /// Sets the value of [parent][crate::model::CreateBackupRequest::parent].
795    ///
796    /// # Example
797    /// ```ignore,no_run
798    /// # use google_cloud_spanner_admin_database_v1::model::CreateBackupRequest;
799    /// let x = CreateBackupRequest::new().set_parent("example");
800    /// ```
801    pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
802        self.parent = v.into();
803        self
804    }
805
806    /// Sets the value of [backup_id][crate::model::CreateBackupRequest::backup_id].
807    ///
808    /// # Example
809    /// ```ignore,no_run
810    /// # use google_cloud_spanner_admin_database_v1::model::CreateBackupRequest;
811    /// let x = CreateBackupRequest::new().set_backup_id("example");
812    /// ```
813    pub fn set_backup_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
814        self.backup_id = v.into();
815        self
816    }
817
818    /// Sets the value of [backup][crate::model::CreateBackupRequest::backup].
819    ///
820    /// # Example
821    /// ```ignore,no_run
822    /// # use google_cloud_spanner_admin_database_v1::model::CreateBackupRequest;
823    /// use google_cloud_spanner_admin_database_v1::model::Backup;
824    /// let x = CreateBackupRequest::new().set_backup(Backup::default()/* use setters */);
825    /// ```
826    pub fn set_backup<T>(mut self, v: T) -> Self
827    where
828        T: std::convert::Into<crate::model::Backup>,
829    {
830        self.backup = std::option::Option::Some(v.into());
831        self
832    }
833
834    /// Sets or clears the value of [backup][crate::model::CreateBackupRequest::backup].
835    ///
836    /// # Example
837    /// ```ignore,no_run
838    /// # use google_cloud_spanner_admin_database_v1::model::CreateBackupRequest;
839    /// use google_cloud_spanner_admin_database_v1::model::Backup;
840    /// let x = CreateBackupRequest::new().set_or_clear_backup(Some(Backup::default()/* use setters */));
841    /// let x = CreateBackupRequest::new().set_or_clear_backup(None::<Backup>);
842    /// ```
843    pub fn set_or_clear_backup<T>(mut self, v: std::option::Option<T>) -> Self
844    where
845        T: std::convert::Into<crate::model::Backup>,
846    {
847        self.backup = v.map(|x| x.into());
848        self
849    }
850
851    /// Sets the value of [encryption_config][crate::model::CreateBackupRequest::encryption_config].
852    ///
853    /// # Example
854    /// ```ignore,no_run
855    /// # use google_cloud_spanner_admin_database_v1::model::CreateBackupRequest;
856    /// use google_cloud_spanner_admin_database_v1::model::CreateBackupEncryptionConfig;
857    /// let x = CreateBackupRequest::new().set_encryption_config(CreateBackupEncryptionConfig::default()/* use setters */);
858    /// ```
859    pub fn set_encryption_config<T>(mut self, v: T) -> Self
860    where
861        T: std::convert::Into<crate::model::CreateBackupEncryptionConfig>,
862    {
863        self.encryption_config = std::option::Option::Some(v.into());
864        self
865    }
866
867    /// Sets or clears the value of [encryption_config][crate::model::CreateBackupRequest::encryption_config].
868    ///
869    /// # Example
870    /// ```ignore,no_run
871    /// # use google_cloud_spanner_admin_database_v1::model::CreateBackupRequest;
872    /// use google_cloud_spanner_admin_database_v1::model::CreateBackupEncryptionConfig;
873    /// let x = CreateBackupRequest::new().set_or_clear_encryption_config(Some(CreateBackupEncryptionConfig::default()/* use setters */));
874    /// let x = CreateBackupRequest::new().set_or_clear_encryption_config(None::<CreateBackupEncryptionConfig>);
875    /// ```
876    pub fn set_or_clear_encryption_config<T>(mut self, v: std::option::Option<T>) -> Self
877    where
878        T: std::convert::Into<crate::model::CreateBackupEncryptionConfig>,
879    {
880        self.encryption_config = v.map(|x| x.into());
881        self
882    }
883}
884
885impl wkt::message::Message for CreateBackupRequest {
886    fn typename() -> &'static str {
887        "type.googleapis.com/google.spanner.admin.database.v1.CreateBackupRequest"
888    }
889}
890
891/// Metadata type for the operation returned by
892/// [CreateBackup][google.spanner.admin.database.v1.DatabaseAdmin.CreateBackup].
893///
894/// [google.spanner.admin.database.v1.DatabaseAdmin.CreateBackup]: crate::client::DatabaseAdmin::create_backup
895#[derive(Clone, Default, PartialEq)]
896#[non_exhaustive]
897pub struct CreateBackupMetadata {
898    /// The name of the backup being created.
899    pub name: std::string::String,
900
901    /// The name of the database the backup is created from.
902    pub database: std::string::String,
903
904    /// The progress of the
905    /// [CreateBackup][google.spanner.admin.database.v1.DatabaseAdmin.CreateBackup]
906    /// operation.
907    ///
908    /// [google.spanner.admin.database.v1.DatabaseAdmin.CreateBackup]: crate::client::DatabaseAdmin::create_backup
909    pub progress: std::option::Option<crate::model::OperationProgress>,
910
911    /// The time at which cancellation of this operation was received.
912    /// [Operations.CancelOperation][google.longrunning.Operations.CancelOperation]
913    /// starts asynchronous cancellation on a long-running operation. The server
914    /// makes a best effort to cancel the operation, but success is not guaranteed.
915    /// Clients can use
916    /// [Operations.GetOperation][google.longrunning.Operations.GetOperation] or
917    /// other methods to check whether the cancellation succeeded or whether the
918    /// operation completed despite cancellation. On successful cancellation,
919    /// the operation is not deleted; instead, it becomes an operation with
920    /// an [Operation.error][google.longrunning.Operation.error] value with a
921    /// [google.rpc.Status.code][google.rpc.Status.code] of 1,
922    /// corresponding to `Code.CANCELLED`.
923    ///
924    /// [google.longrunning.Operation.error]: google_cloud_longrunning::model::Operation::result
925    /// [google.rpc.Status.code]: google_cloud_rpc::model::Status::code
926    pub cancel_time: std::option::Option<wkt::Timestamp>,
927
928    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
929}
930
931impl CreateBackupMetadata {
932    /// Creates a new default instance.
933    pub fn new() -> Self {
934        std::default::Default::default()
935    }
936
937    /// Sets the value of [name][crate::model::CreateBackupMetadata::name].
938    ///
939    /// # Example
940    /// ```ignore,no_run
941    /// # use google_cloud_spanner_admin_database_v1::model::CreateBackupMetadata;
942    /// # let project_id = "project_id";
943    /// # let instance_id = "instance_id";
944    /// # let backup_id = "backup_id";
945    /// let x = CreateBackupMetadata::new().set_name(format!("projects/{project_id}/instances/{instance_id}/backups/{backup_id}"));
946    /// ```
947    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
948        self.name = v.into();
949        self
950    }
951
952    /// Sets the value of [database][crate::model::CreateBackupMetadata::database].
953    ///
954    /// # Example
955    /// ```ignore,no_run
956    /// # use google_cloud_spanner_admin_database_v1::model::CreateBackupMetadata;
957    /// # let project_id = "project_id";
958    /// # let instance_id = "instance_id";
959    /// # let database_id = "database_id";
960    /// let x = CreateBackupMetadata::new().set_database(format!("projects/{project_id}/instances/{instance_id}/databases/{database_id}"));
961    /// ```
962    pub fn set_database<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
963        self.database = v.into();
964        self
965    }
966
967    /// Sets the value of [progress][crate::model::CreateBackupMetadata::progress].
968    ///
969    /// # Example
970    /// ```ignore,no_run
971    /// # use google_cloud_spanner_admin_database_v1::model::CreateBackupMetadata;
972    /// use google_cloud_spanner_admin_database_v1::model::OperationProgress;
973    /// let x = CreateBackupMetadata::new().set_progress(OperationProgress::default()/* use setters */);
974    /// ```
975    pub fn set_progress<T>(mut self, v: T) -> Self
976    where
977        T: std::convert::Into<crate::model::OperationProgress>,
978    {
979        self.progress = std::option::Option::Some(v.into());
980        self
981    }
982
983    /// Sets or clears the value of [progress][crate::model::CreateBackupMetadata::progress].
984    ///
985    /// # Example
986    /// ```ignore,no_run
987    /// # use google_cloud_spanner_admin_database_v1::model::CreateBackupMetadata;
988    /// use google_cloud_spanner_admin_database_v1::model::OperationProgress;
989    /// let x = CreateBackupMetadata::new().set_or_clear_progress(Some(OperationProgress::default()/* use setters */));
990    /// let x = CreateBackupMetadata::new().set_or_clear_progress(None::<OperationProgress>);
991    /// ```
992    pub fn set_or_clear_progress<T>(mut self, v: std::option::Option<T>) -> Self
993    where
994        T: std::convert::Into<crate::model::OperationProgress>,
995    {
996        self.progress = v.map(|x| x.into());
997        self
998    }
999
1000    /// Sets the value of [cancel_time][crate::model::CreateBackupMetadata::cancel_time].
1001    ///
1002    /// # Example
1003    /// ```ignore,no_run
1004    /// # use google_cloud_spanner_admin_database_v1::model::CreateBackupMetadata;
1005    /// use wkt::Timestamp;
1006    /// let x = CreateBackupMetadata::new().set_cancel_time(Timestamp::default()/* use setters */);
1007    /// ```
1008    pub fn set_cancel_time<T>(mut self, v: T) -> Self
1009    where
1010        T: std::convert::Into<wkt::Timestamp>,
1011    {
1012        self.cancel_time = std::option::Option::Some(v.into());
1013        self
1014    }
1015
1016    /// Sets or clears the value of [cancel_time][crate::model::CreateBackupMetadata::cancel_time].
1017    ///
1018    /// # Example
1019    /// ```ignore,no_run
1020    /// # use google_cloud_spanner_admin_database_v1::model::CreateBackupMetadata;
1021    /// use wkt::Timestamp;
1022    /// let x = CreateBackupMetadata::new().set_or_clear_cancel_time(Some(Timestamp::default()/* use setters */));
1023    /// let x = CreateBackupMetadata::new().set_or_clear_cancel_time(None::<Timestamp>);
1024    /// ```
1025    pub fn set_or_clear_cancel_time<T>(mut self, v: std::option::Option<T>) -> Self
1026    where
1027        T: std::convert::Into<wkt::Timestamp>,
1028    {
1029        self.cancel_time = v.map(|x| x.into());
1030        self
1031    }
1032}
1033
1034impl wkt::message::Message for CreateBackupMetadata {
1035    fn typename() -> &'static str {
1036        "type.googleapis.com/google.spanner.admin.database.v1.CreateBackupMetadata"
1037    }
1038}
1039
1040/// The request for
1041/// [CopyBackup][google.spanner.admin.database.v1.DatabaseAdmin.CopyBackup].
1042///
1043/// [google.spanner.admin.database.v1.DatabaseAdmin.CopyBackup]: crate::client::DatabaseAdmin::copy_backup
1044#[derive(Clone, Default, PartialEq)]
1045#[non_exhaustive]
1046pub struct CopyBackupRequest {
1047    /// Required. The name of the destination instance that will contain the backup
1048    /// copy. Values are of the form: `projects/<project>/instances/<instance>`.
1049    pub parent: std::string::String,
1050
1051    /// Required. The id of the backup copy.
1052    /// The `backup_id` appended to `parent` forms the full backup_uri of the form
1053    /// `projects/<project>/instances/<instance>/backups/<backup>`.
1054    pub backup_id: std::string::String,
1055
1056    /// Required. The source backup to be copied.
1057    /// The source backup needs to be in READY state for it to be copied.
1058    /// Once CopyBackup is in progress, the source backup cannot be deleted or
1059    /// cleaned up on expiration until CopyBackup is finished.
1060    /// Values are of the form:
1061    /// `projects/<project>/instances/<instance>/backups/<backup>`.
1062    pub source_backup: std::string::String,
1063
1064    /// Required. The expiration time of the backup in microsecond granularity.
1065    /// The expiration time must be at least 6 hours and at most 366 days
1066    /// from the `create_time` of the source backup. Once the `expire_time` has
1067    /// passed, the backup is eligible to be automatically deleted by Cloud Spanner
1068    /// to free the resources used by the backup.
1069    pub expire_time: std::option::Option<wkt::Timestamp>,
1070
1071    /// Optional. The encryption configuration used to encrypt the backup. If this
1072    /// field is not specified, the backup will use the same encryption
1073    /// configuration as the source backup by default, namely
1074    /// [encryption_type][google.spanner.admin.database.v1.CopyBackupEncryptionConfig.encryption_type]
1075    /// = `USE_CONFIG_DEFAULT_OR_BACKUP_ENCRYPTION`.
1076    ///
1077    /// [google.spanner.admin.database.v1.CopyBackupEncryptionConfig.encryption_type]: crate::model::CopyBackupEncryptionConfig::encryption_type
1078    pub encryption_config: std::option::Option<crate::model::CopyBackupEncryptionConfig>,
1079
1080    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1081}
1082
1083impl CopyBackupRequest {
1084    /// Creates a new default instance.
1085    pub fn new() -> Self {
1086        std::default::Default::default()
1087    }
1088
1089    /// Sets the value of [parent][crate::model::CopyBackupRequest::parent].
1090    ///
1091    /// # Example
1092    /// ```ignore,no_run
1093    /// # use google_cloud_spanner_admin_database_v1::model::CopyBackupRequest;
1094    /// let x = CopyBackupRequest::new().set_parent("example");
1095    /// ```
1096    pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1097        self.parent = v.into();
1098        self
1099    }
1100
1101    /// Sets the value of [backup_id][crate::model::CopyBackupRequest::backup_id].
1102    ///
1103    /// # Example
1104    /// ```ignore,no_run
1105    /// # use google_cloud_spanner_admin_database_v1::model::CopyBackupRequest;
1106    /// let x = CopyBackupRequest::new().set_backup_id("example");
1107    /// ```
1108    pub fn set_backup_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1109        self.backup_id = v.into();
1110        self
1111    }
1112
1113    /// Sets the value of [source_backup][crate::model::CopyBackupRequest::source_backup].
1114    ///
1115    /// # Example
1116    /// ```ignore,no_run
1117    /// # use google_cloud_spanner_admin_database_v1::model::CopyBackupRequest;
1118    /// # let project_id = "project_id";
1119    /// # let instance_id = "instance_id";
1120    /// # let backup_id = "backup_id";
1121    /// let x = CopyBackupRequest::new().set_source_backup(format!("projects/{project_id}/instances/{instance_id}/backups/{backup_id}"));
1122    /// ```
1123    pub fn set_source_backup<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1124        self.source_backup = v.into();
1125        self
1126    }
1127
1128    /// Sets the value of [expire_time][crate::model::CopyBackupRequest::expire_time].
1129    ///
1130    /// # Example
1131    /// ```ignore,no_run
1132    /// # use google_cloud_spanner_admin_database_v1::model::CopyBackupRequest;
1133    /// use wkt::Timestamp;
1134    /// let x = CopyBackupRequest::new().set_expire_time(Timestamp::default()/* use setters */);
1135    /// ```
1136    pub fn set_expire_time<T>(mut self, v: T) -> Self
1137    where
1138        T: std::convert::Into<wkt::Timestamp>,
1139    {
1140        self.expire_time = std::option::Option::Some(v.into());
1141        self
1142    }
1143
1144    /// Sets or clears the value of [expire_time][crate::model::CopyBackupRequest::expire_time].
1145    ///
1146    /// # Example
1147    /// ```ignore,no_run
1148    /// # use google_cloud_spanner_admin_database_v1::model::CopyBackupRequest;
1149    /// use wkt::Timestamp;
1150    /// let x = CopyBackupRequest::new().set_or_clear_expire_time(Some(Timestamp::default()/* use setters */));
1151    /// let x = CopyBackupRequest::new().set_or_clear_expire_time(None::<Timestamp>);
1152    /// ```
1153    pub fn set_or_clear_expire_time<T>(mut self, v: std::option::Option<T>) -> Self
1154    where
1155        T: std::convert::Into<wkt::Timestamp>,
1156    {
1157        self.expire_time = v.map(|x| x.into());
1158        self
1159    }
1160
1161    /// Sets the value of [encryption_config][crate::model::CopyBackupRequest::encryption_config].
1162    ///
1163    /// # Example
1164    /// ```ignore,no_run
1165    /// # use google_cloud_spanner_admin_database_v1::model::CopyBackupRequest;
1166    /// use google_cloud_spanner_admin_database_v1::model::CopyBackupEncryptionConfig;
1167    /// let x = CopyBackupRequest::new().set_encryption_config(CopyBackupEncryptionConfig::default()/* use setters */);
1168    /// ```
1169    pub fn set_encryption_config<T>(mut self, v: T) -> Self
1170    where
1171        T: std::convert::Into<crate::model::CopyBackupEncryptionConfig>,
1172    {
1173        self.encryption_config = std::option::Option::Some(v.into());
1174        self
1175    }
1176
1177    /// Sets or clears the value of [encryption_config][crate::model::CopyBackupRequest::encryption_config].
1178    ///
1179    /// # Example
1180    /// ```ignore,no_run
1181    /// # use google_cloud_spanner_admin_database_v1::model::CopyBackupRequest;
1182    /// use google_cloud_spanner_admin_database_v1::model::CopyBackupEncryptionConfig;
1183    /// let x = CopyBackupRequest::new().set_or_clear_encryption_config(Some(CopyBackupEncryptionConfig::default()/* use setters */));
1184    /// let x = CopyBackupRequest::new().set_or_clear_encryption_config(None::<CopyBackupEncryptionConfig>);
1185    /// ```
1186    pub fn set_or_clear_encryption_config<T>(mut self, v: std::option::Option<T>) -> Self
1187    where
1188        T: std::convert::Into<crate::model::CopyBackupEncryptionConfig>,
1189    {
1190        self.encryption_config = v.map(|x| x.into());
1191        self
1192    }
1193}
1194
1195impl wkt::message::Message for CopyBackupRequest {
1196    fn typename() -> &'static str {
1197        "type.googleapis.com/google.spanner.admin.database.v1.CopyBackupRequest"
1198    }
1199}
1200
1201/// Metadata type for the operation returned by
1202/// [CopyBackup][google.spanner.admin.database.v1.DatabaseAdmin.CopyBackup].
1203///
1204/// [google.spanner.admin.database.v1.DatabaseAdmin.CopyBackup]: crate::client::DatabaseAdmin::copy_backup
1205#[derive(Clone, Default, PartialEq)]
1206#[non_exhaustive]
1207pub struct CopyBackupMetadata {
1208    /// The name of the backup being created through the copy operation.
1209    /// Values are of the form
1210    /// `projects/<project>/instances/<instance>/backups/<backup>`.
1211    pub name: std::string::String,
1212
1213    /// The name of the source backup that is being copied.
1214    /// Values are of the form
1215    /// `projects/<project>/instances/<instance>/backups/<backup>`.
1216    pub source_backup: std::string::String,
1217
1218    /// The progress of the
1219    /// [CopyBackup][google.spanner.admin.database.v1.DatabaseAdmin.CopyBackup]
1220    /// operation.
1221    ///
1222    /// [google.spanner.admin.database.v1.DatabaseAdmin.CopyBackup]: crate::client::DatabaseAdmin::copy_backup
1223    pub progress: std::option::Option<crate::model::OperationProgress>,
1224
1225    /// The time at which cancellation of CopyBackup operation was received.
1226    /// [Operations.CancelOperation][google.longrunning.Operations.CancelOperation]
1227    /// starts asynchronous cancellation on a long-running operation. The server
1228    /// makes a best effort to cancel the operation, but success is not guaranteed.
1229    /// Clients can use
1230    /// [Operations.GetOperation][google.longrunning.Operations.GetOperation] or
1231    /// other methods to check whether the cancellation succeeded or whether the
1232    /// operation completed despite cancellation. On successful cancellation,
1233    /// the operation is not deleted; instead, it becomes an operation with
1234    /// an [Operation.error][google.longrunning.Operation.error] value with a
1235    /// [google.rpc.Status.code][google.rpc.Status.code] of 1,
1236    /// corresponding to `Code.CANCELLED`.
1237    ///
1238    /// [google.longrunning.Operation.error]: google_cloud_longrunning::model::Operation::result
1239    /// [google.rpc.Status.code]: google_cloud_rpc::model::Status::code
1240    pub cancel_time: std::option::Option<wkt::Timestamp>,
1241
1242    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1243}
1244
1245impl CopyBackupMetadata {
1246    /// Creates a new default instance.
1247    pub fn new() -> Self {
1248        std::default::Default::default()
1249    }
1250
1251    /// Sets the value of [name][crate::model::CopyBackupMetadata::name].
1252    ///
1253    /// # Example
1254    /// ```ignore,no_run
1255    /// # use google_cloud_spanner_admin_database_v1::model::CopyBackupMetadata;
1256    /// # let project_id = "project_id";
1257    /// # let instance_id = "instance_id";
1258    /// # let backup_id = "backup_id";
1259    /// let x = CopyBackupMetadata::new().set_name(format!("projects/{project_id}/instances/{instance_id}/backups/{backup_id}"));
1260    /// ```
1261    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1262        self.name = v.into();
1263        self
1264    }
1265
1266    /// Sets the value of [source_backup][crate::model::CopyBackupMetadata::source_backup].
1267    ///
1268    /// # Example
1269    /// ```ignore,no_run
1270    /// # use google_cloud_spanner_admin_database_v1::model::CopyBackupMetadata;
1271    /// # let project_id = "project_id";
1272    /// # let instance_id = "instance_id";
1273    /// # let backup_id = "backup_id";
1274    /// let x = CopyBackupMetadata::new().set_source_backup(format!("projects/{project_id}/instances/{instance_id}/backups/{backup_id}"));
1275    /// ```
1276    pub fn set_source_backup<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1277        self.source_backup = v.into();
1278        self
1279    }
1280
1281    /// Sets the value of [progress][crate::model::CopyBackupMetadata::progress].
1282    ///
1283    /// # Example
1284    /// ```ignore,no_run
1285    /// # use google_cloud_spanner_admin_database_v1::model::CopyBackupMetadata;
1286    /// use google_cloud_spanner_admin_database_v1::model::OperationProgress;
1287    /// let x = CopyBackupMetadata::new().set_progress(OperationProgress::default()/* use setters */);
1288    /// ```
1289    pub fn set_progress<T>(mut self, v: T) -> Self
1290    where
1291        T: std::convert::Into<crate::model::OperationProgress>,
1292    {
1293        self.progress = std::option::Option::Some(v.into());
1294        self
1295    }
1296
1297    /// Sets or clears the value of [progress][crate::model::CopyBackupMetadata::progress].
1298    ///
1299    /// # Example
1300    /// ```ignore,no_run
1301    /// # use google_cloud_spanner_admin_database_v1::model::CopyBackupMetadata;
1302    /// use google_cloud_spanner_admin_database_v1::model::OperationProgress;
1303    /// let x = CopyBackupMetadata::new().set_or_clear_progress(Some(OperationProgress::default()/* use setters */));
1304    /// let x = CopyBackupMetadata::new().set_or_clear_progress(None::<OperationProgress>);
1305    /// ```
1306    pub fn set_or_clear_progress<T>(mut self, v: std::option::Option<T>) -> Self
1307    where
1308        T: std::convert::Into<crate::model::OperationProgress>,
1309    {
1310        self.progress = v.map(|x| x.into());
1311        self
1312    }
1313
1314    /// Sets the value of [cancel_time][crate::model::CopyBackupMetadata::cancel_time].
1315    ///
1316    /// # Example
1317    /// ```ignore,no_run
1318    /// # use google_cloud_spanner_admin_database_v1::model::CopyBackupMetadata;
1319    /// use wkt::Timestamp;
1320    /// let x = CopyBackupMetadata::new().set_cancel_time(Timestamp::default()/* use setters */);
1321    /// ```
1322    pub fn set_cancel_time<T>(mut self, v: T) -> Self
1323    where
1324        T: std::convert::Into<wkt::Timestamp>,
1325    {
1326        self.cancel_time = std::option::Option::Some(v.into());
1327        self
1328    }
1329
1330    /// Sets or clears the value of [cancel_time][crate::model::CopyBackupMetadata::cancel_time].
1331    ///
1332    /// # Example
1333    /// ```ignore,no_run
1334    /// # use google_cloud_spanner_admin_database_v1::model::CopyBackupMetadata;
1335    /// use wkt::Timestamp;
1336    /// let x = CopyBackupMetadata::new().set_or_clear_cancel_time(Some(Timestamp::default()/* use setters */));
1337    /// let x = CopyBackupMetadata::new().set_or_clear_cancel_time(None::<Timestamp>);
1338    /// ```
1339    pub fn set_or_clear_cancel_time<T>(mut self, v: std::option::Option<T>) -> Self
1340    where
1341        T: std::convert::Into<wkt::Timestamp>,
1342    {
1343        self.cancel_time = v.map(|x| x.into());
1344        self
1345    }
1346}
1347
1348impl wkt::message::Message for CopyBackupMetadata {
1349    fn typename() -> &'static str {
1350        "type.googleapis.com/google.spanner.admin.database.v1.CopyBackupMetadata"
1351    }
1352}
1353
1354/// The request for
1355/// [UpdateBackup][google.spanner.admin.database.v1.DatabaseAdmin.UpdateBackup].
1356///
1357/// [google.spanner.admin.database.v1.DatabaseAdmin.UpdateBackup]: crate::client::DatabaseAdmin::update_backup
1358#[derive(Clone, Default, PartialEq)]
1359#[non_exhaustive]
1360pub struct UpdateBackupRequest {
1361    /// Required. The backup to update. `backup.name`, and the fields to be updated
1362    /// as specified by `update_mask` are required. Other fields are ignored.
1363    /// Update is only supported for the following fields:
1364    ///
1365    /// * `backup.expire_time`.
1366    pub backup: std::option::Option<crate::model::Backup>,
1367
1368    /// Required. A mask specifying which fields (e.g. `expire_time`) in the
1369    /// Backup resource should be updated. This mask is relative to the Backup
1370    /// resource, not to the request message. The field mask must always be
1371    /// specified; this prevents any future fields from being erased accidentally
1372    /// by clients that do not know about them.
1373    pub update_mask: std::option::Option<wkt::FieldMask>,
1374
1375    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1376}
1377
1378impl UpdateBackupRequest {
1379    /// Creates a new default instance.
1380    pub fn new() -> Self {
1381        std::default::Default::default()
1382    }
1383
1384    /// Sets the value of [backup][crate::model::UpdateBackupRequest::backup].
1385    ///
1386    /// # Example
1387    /// ```ignore,no_run
1388    /// # use google_cloud_spanner_admin_database_v1::model::UpdateBackupRequest;
1389    /// use google_cloud_spanner_admin_database_v1::model::Backup;
1390    /// let x = UpdateBackupRequest::new().set_backup(Backup::default()/* use setters */);
1391    /// ```
1392    pub fn set_backup<T>(mut self, v: T) -> Self
1393    where
1394        T: std::convert::Into<crate::model::Backup>,
1395    {
1396        self.backup = std::option::Option::Some(v.into());
1397        self
1398    }
1399
1400    /// Sets or clears the value of [backup][crate::model::UpdateBackupRequest::backup].
1401    ///
1402    /// # Example
1403    /// ```ignore,no_run
1404    /// # use google_cloud_spanner_admin_database_v1::model::UpdateBackupRequest;
1405    /// use google_cloud_spanner_admin_database_v1::model::Backup;
1406    /// let x = UpdateBackupRequest::new().set_or_clear_backup(Some(Backup::default()/* use setters */));
1407    /// let x = UpdateBackupRequest::new().set_or_clear_backup(None::<Backup>);
1408    /// ```
1409    pub fn set_or_clear_backup<T>(mut self, v: std::option::Option<T>) -> Self
1410    where
1411        T: std::convert::Into<crate::model::Backup>,
1412    {
1413        self.backup = v.map(|x| x.into());
1414        self
1415    }
1416
1417    /// Sets the value of [update_mask][crate::model::UpdateBackupRequest::update_mask].
1418    ///
1419    /// # Example
1420    /// ```ignore,no_run
1421    /// # use google_cloud_spanner_admin_database_v1::model::UpdateBackupRequest;
1422    /// use wkt::FieldMask;
1423    /// let x = UpdateBackupRequest::new().set_update_mask(FieldMask::default()/* use setters */);
1424    /// ```
1425    pub fn set_update_mask<T>(mut self, v: T) -> Self
1426    where
1427        T: std::convert::Into<wkt::FieldMask>,
1428    {
1429        self.update_mask = std::option::Option::Some(v.into());
1430        self
1431    }
1432
1433    /// Sets or clears the value of [update_mask][crate::model::UpdateBackupRequest::update_mask].
1434    ///
1435    /// # Example
1436    /// ```ignore,no_run
1437    /// # use google_cloud_spanner_admin_database_v1::model::UpdateBackupRequest;
1438    /// use wkt::FieldMask;
1439    /// let x = UpdateBackupRequest::new().set_or_clear_update_mask(Some(FieldMask::default()/* use setters */));
1440    /// let x = UpdateBackupRequest::new().set_or_clear_update_mask(None::<FieldMask>);
1441    /// ```
1442    pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
1443    where
1444        T: std::convert::Into<wkt::FieldMask>,
1445    {
1446        self.update_mask = v.map(|x| x.into());
1447        self
1448    }
1449}
1450
1451impl wkt::message::Message for UpdateBackupRequest {
1452    fn typename() -> &'static str {
1453        "type.googleapis.com/google.spanner.admin.database.v1.UpdateBackupRequest"
1454    }
1455}
1456
1457/// The request for
1458/// [GetBackup][google.spanner.admin.database.v1.DatabaseAdmin.GetBackup].
1459///
1460/// [google.spanner.admin.database.v1.DatabaseAdmin.GetBackup]: crate::client::DatabaseAdmin::get_backup
1461#[derive(Clone, Default, PartialEq)]
1462#[non_exhaustive]
1463pub struct GetBackupRequest {
1464    /// Required. Name of the backup.
1465    /// Values are of the form
1466    /// `projects/<project>/instances/<instance>/backups/<backup>`.
1467    pub name: std::string::String,
1468
1469    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1470}
1471
1472impl GetBackupRequest {
1473    /// Creates a new default instance.
1474    pub fn new() -> Self {
1475        std::default::Default::default()
1476    }
1477
1478    /// Sets the value of [name][crate::model::GetBackupRequest::name].
1479    ///
1480    /// # Example
1481    /// ```ignore,no_run
1482    /// # use google_cloud_spanner_admin_database_v1::model::GetBackupRequest;
1483    /// # let project_id = "project_id";
1484    /// # let instance_id = "instance_id";
1485    /// # let backup_id = "backup_id";
1486    /// let x = GetBackupRequest::new().set_name(format!("projects/{project_id}/instances/{instance_id}/backups/{backup_id}"));
1487    /// ```
1488    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1489        self.name = v.into();
1490        self
1491    }
1492}
1493
1494impl wkt::message::Message for GetBackupRequest {
1495    fn typename() -> &'static str {
1496        "type.googleapis.com/google.spanner.admin.database.v1.GetBackupRequest"
1497    }
1498}
1499
1500/// The request for
1501/// [DeleteBackup][google.spanner.admin.database.v1.DatabaseAdmin.DeleteBackup].
1502///
1503/// [google.spanner.admin.database.v1.DatabaseAdmin.DeleteBackup]: crate::client::DatabaseAdmin::delete_backup
1504#[derive(Clone, Default, PartialEq)]
1505#[non_exhaustive]
1506pub struct DeleteBackupRequest {
1507    /// Required. Name of the backup to delete.
1508    /// Values are of the form
1509    /// `projects/<project>/instances/<instance>/backups/<backup>`.
1510    pub name: std::string::String,
1511
1512    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1513}
1514
1515impl DeleteBackupRequest {
1516    /// Creates a new default instance.
1517    pub fn new() -> Self {
1518        std::default::Default::default()
1519    }
1520
1521    /// Sets the value of [name][crate::model::DeleteBackupRequest::name].
1522    ///
1523    /// # Example
1524    /// ```ignore,no_run
1525    /// # use google_cloud_spanner_admin_database_v1::model::DeleteBackupRequest;
1526    /// # let project_id = "project_id";
1527    /// # let instance_id = "instance_id";
1528    /// # let backup_id = "backup_id";
1529    /// let x = DeleteBackupRequest::new().set_name(format!("projects/{project_id}/instances/{instance_id}/backups/{backup_id}"));
1530    /// ```
1531    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1532        self.name = v.into();
1533        self
1534    }
1535}
1536
1537impl wkt::message::Message for DeleteBackupRequest {
1538    fn typename() -> &'static str {
1539        "type.googleapis.com/google.spanner.admin.database.v1.DeleteBackupRequest"
1540    }
1541}
1542
1543/// The request for
1544/// [ListBackups][google.spanner.admin.database.v1.DatabaseAdmin.ListBackups].
1545///
1546/// [google.spanner.admin.database.v1.DatabaseAdmin.ListBackups]: crate::client::DatabaseAdmin::list_backups
1547#[derive(Clone, Default, PartialEq)]
1548#[non_exhaustive]
1549pub struct ListBackupsRequest {
1550    /// Required. The instance to list backups from.  Values are of the
1551    /// form `projects/<project>/instances/<instance>`.
1552    pub parent: std::string::String,
1553
1554    /// An expression that filters the list of returned backups.
1555    ///
1556    /// A filter expression consists of a field name, a comparison operator, and a
1557    /// value for filtering.
1558    /// The value must be a string, a number, or a boolean. The comparison operator
1559    /// must be one of: `<`, `>`, `<=`, `>=`, `!=`, `=`, or `:`.
1560    /// Colon `:` is the contains operator. Filter rules are not case sensitive.
1561    ///
1562    /// The following fields in the
1563    /// [Backup][google.spanner.admin.database.v1.Backup] are eligible for
1564    /// filtering:
1565    ///
1566    /// * `name`
1567    /// * `database`
1568    /// * `state`
1569    /// * `create_time`  (and values are of the format YYYY-MM-DDTHH:MM:SSZ)
1570    /// * `expire_time`  (and values are of the format YYYY-MM-DDTHH:MM:SSZ)
1571    /// * `version_time` (and values are of the format YYYY-MM-DDTHH:MM:SSZ)
1572    /// * `size_bytes`
1573    /// * `backup_schedules`
1574    ///
1575    /// You can combine multiple expressions by enclosing each expression in
1576    /// parentheses. By default, expressions are combined with AND logic, but
1577    /// you can specify AND, OR, and NOT logic explicitly.
1578    ///
1579    /// Here are a few examples:
1580    ///
1581    /// * `name:Howl` - The backup's name contains the string "howl".
1582    /// * `database:prod` - The database's name contains the string "prod".
1583    /// * `state:CREATING` - The backup is pending creation.
1584    /// * `state:READY` - The backup is fully created and ready for use.
1585    /// * `(name:howl) AND (create_time < \"2018-03-28T14:50:00Z\")` - The backup
1586    ///   name contains the string "howl" and `create_time` of the backup is before
1587    ///   2018-03-28T14:50:00Z.
1588    /// * `expire_time < \"2018-03-28T14:50:00Z\"` - The backup `expire_time` is
1589    ///   before 2018-03-28T14:50:00Z.
1590    /// * `size_bytes > 10000000000` - The backup's size is greater than 10GB
1591    /// * `backup_schedules:daily` - The backup is created from a schedule with
1592    ///   "daily" in its name.
1593    ///
1594    /// [google.spanner.admin.database.v1.Backup]: crate::model::Backup
1595    pub filter: std::string::String,
1596
1597    /// Number of backups to be returned in the response. If 0 or
1598    /// less, defaults to the server's maximum allowed page size.
1599    pub page_size: i32,
1600
1601    /// If non-empty, `page_token` should contain a
1602    /// [next_page_token][google.spanner.admin.database.v1.ListBackupsResponse.next_page_token]
1603    /// from a previous
1604    /// [ListBackupsResponse][google.spanner.admin.database.v1.ListBackupsResponse]
1605    /// to the same `parent` and with the same `filter`.
1606    ///
1607    /// [google.spanner.admin.database.v1.ListBackupsResponse]: crate::model::ListBackupsResponse
1608    /// [google.spanner.admin.database.v1.ListBackupsResponse.next_page_token]: crate::model::ListBackupsResponse::next_page_token
1609    pub page_token: std::string::String,
1610
1611    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1612}
1613
1614impl ListBackupsRequest {
1615    /// Creates a new default instance.
1616    pub fn new() -> Self {
1617        std::default::Default::default()
1618    }
1619
1620    /// Sets the value of [parent][crate::model::ListBackupsRequest::parent].
1621    ///
1622    /// # Example
1623    /// ```ignore,no_run
1624    /// # use google_cloud_spanner_admin_database_v1::model::ListBackupsRequest;
1625    /// let x = ListBackupsRequest::new().set_parent("example");
1626    /// ```
1627    pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1628        self.parent = v.into();
1629        self
1630    }
1631
1632    /// Sets the value of [filter][crate::model::ListBackupsRequest::filter].
1633    ///
1634    /// # Example
1635    /// ```ignore,no_run
1636    /// # use google_cloud_spanner_admin_database_v1::model::ListBackupsRequest;
1637    /// let x = ListBackupsRequest::new().set_filter("example");
1638    /// ```
1639    pub fn set_filter<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1640        self.filter = v.into();
1641        self
1642    }
1643
1644    /// Sets the value of [page_size][crate::model::ListBackupsRequest::page_size].
1645    ///
1646    /// # Example
1647    /// ```ignore,no_run
1648    /// # use google_cloud_spanner_admin_database_v1::model::ListBackupsRequest;
1649    /// let x = ListBackupsRequest::new().set_page_size(42);
1650    /// ```
1651    pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
1652        self.page_size = v.into();
1653        self
1654    }
1655
1656    /// Sets the value of [page_token][crate::model::ListBackupsRequest::page_token].
1657    ///
1658    /// # Example
1659    /// ```ignore,no_run
1660    /// # use google_cloud_spanner_admin_database_v1::model::ListBackupsRequest;
1661    /// let x = ListBackupsRequest::new().set_page_token("example");
1662    /// ```
1663    pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1664        self.page_token = v.into();
1665        self
1666    }
1667}
1668
1669impl wkt::message::Message for ListBackupsRequest {
1670    fn typename() -> &'static str {
1671        "type.googleapis.com/google.spanner.admin.database.v1.ListBackupsRequest"
1672    }
1673}
1674
1675/// The response for
1676/// [ListBackups][google.spanner.admin.database.v1.DatabaseAdmin.ListBackups].
1677///
1678/// [google.spanner.admin.database.v1.DatabaseAdmin.ListBackups]: crate::client::DatabaseAdmin::list_backups
1679#[derive(Clone, Default, PartialEq)]
1680#[non_exhaustive]
1681pub struct ListBackupsResponse {
1682    /// The list of matching backups. Backups returned are ordered by `create_time`
1683    /// in descending order, starting from the most recent `create_time`.
1684    pub backups: std::vec::Vec<crate::model::Backup>,
1685
1686    /// `next_page_token` can be sent in a subsequent
1687    /// [ListBackups][google.spanner.admin.database.v1.DatabaseAdmin.ListBackups]
1688    /// call to fetch more of the matching backups.
1689    ///
1690    /// [google.spanner.admin.database.v1.DatabaseAdmin.ListBackups]: crate::client::DatabaseAdmin::list_backups
1691    pub next_page_token: std::string::String,
1692
1693    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1694}
1695
1696impl ListBackupsResponse {
1697    /// Creates a new default instance.
1698    pub fn new() -> Self {
1699        std::default::Default::default()
1700    }
1701
1702    /// Sets the value of [backups][crate::model::ListBackupsResponse::backups].
1703    ///
1704    /// # Example
1705    /// ```ignore,no_run
1706    /// # use google_cloud_spanner_admin_database_v1::model::ListBackupsResponse;
1707    /// use google_cloud_spanner_admin_database_v1::model::Backup;
1708    /// let x = ListBackupsResponse::new()
1709    ///     .set_backups([
1710    ///         Backup::default()/* use setters */,
1711    ///         Backup::default()/* use (different) setters */,
1712    ///     ]);
1713    /// ```
1714    pub fn set_backups<T, V>(mut self, v: T) -> Self
1715    where
1716        T: std::iter::IntoIterator<Item = V>,
1717        V: std::convert::Into<crate::model::Backup>,
1718    {
1719        use std::iter::Iterator;
1720        self.backups = v.into_iter().map(|i| i.into()).collect();
1721        self
1722    }
1723
1724    /// Sets the value of [next_page_token][crate::model::ListBackupsResponse::next_page_token].
1725    ///
1726    /// # Example
1727    /// ```ignore,no_run
1728    /// # use google_cloud_spanner_admin_database_v1::model::ListBackupsResponse;
1729    /// let x = ListBackupsResponse::new().set_next_page_token("example");
1730    /// ```
1731    pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1732        self.next_page_token = v.into();
1733        self
1734    }
1735}
1736
1737impl wkt::message::Message for ListBackupsResponse {
1738    fn typename() -> &'static str {
1739        "type.googleapis.com/google.spanner.admin.database.v1.ListBackupsResponse"
1740    }
1741}
1742
1743#[doc(hidden)]
1744impl google_cloud_gax::paginator::internal::PageableResponse for ListBackupsResponse {
1745    type PageItem = crate::model::Backup;
1746
1747    fn items(self) -> std::vec::Vec<Self::PageItem> {
1748        self.backups
1749    }
1750
1751    fn next_page_token(&self) -> std::string::String {
1752        use std::clone::Clone;
1753        self.next_page_token.clone()
1754    }
1755}
1756
1757/// The request for
1758/// [ListBackupOperations][google.spanner.admin.database.v1.DatabaseAdmin.ListBackupOperations].
1759///
1760/// [google.spanner.admin.database.v1.DatabaseAdmin.ListBackupOperations]: crate::client::DatabaseAdmin::list_backup_operations
1761#[derive(Clone, Default, PartialEq)]
1762#[non_exhaustive]
1763pub struct ListBackupOperationsRequest {
1764    /// Required. The instance of the backup operations. Values are of
1765    /// the form `projects/<project>/instances/<instance>`.
1766    pub parent: std::string::String,
1767
1768    /// An expression that filters the list of returned backup operations.
1769    ///
1770    /// A filter expression consists of a field name, a
1771    /// comparison operator, and a value for filtering.
1772    /// The value must be a string, a number, or a boolean. The comparison operator
1773    /// must be one of: `<`, `>`, `<=`, `>=`, `!=`, `=`, or `:`.
1774    /// Colon `:` is the contains operator. Filter rules are not case sensitive.
1775    ///
1776    /// The following fields in the [operation][google.longrunning.Operation]
1777    /// are eligible for filtering:
1778    ///
1779    /// * `name` - The name of the long-running operation
1780    /// * `done` - False if the operation is in progress, else true.
1781    /// * `metadata.@type` - the type of metadata. For example, the type string
1782    ///   for
1783    ///   [CreateBackupMetadata][google.spanner.admin.database.v1.CreateBackupMetadata]
1784    ///   is
1785    ///   `type.googleapis.com/google.spanner.admin.database.v1.CreateBackupMetadata`.
1786    /// * `metadata.<field_name>` - any field in metadata.value.
1787    ///   `metadata.@type` must be specified first if filtering on metadata
1788    ///   fields.
1789    /// * `error` - Error associated with the long-running operation.
1790    /// * `response.@type` - the type of response.
1791    /// * `response.<field_name>` - any field in response.value.
1792    ///
1793    /// You can combine multiple expressions by enclosing each expression in
1794    /// parentheses. By default, expressions are combined with AND logic, but
1795    /// you can specify AND, OR, and NOT logic explicitly.
1796    ///
1797    /// Here are a few examples:
1798    ///
1799    /// * `done:true` - The operation is complete.
1800    /// * `(metadata.@type=type.googleapis.com/google.spanner.admin.database.v1.CreateBackupMetadata) AND` \
1801    ///   `metadata.database:prod` - Returns operations where:
1802    ///   * The operation's metadata type is
1803    ///     [CreateBackupMetadata][google.spanner.admin.database.v1.CreateBackupMetadata].
1804    ///   * The source database name of backup contains the string "prod".
1805    /// * `(metadata.@type=type.googleapis.com/google.spanner.admin.database.v1.CreateBackupMetadata) AND` \
1806    ///   `(metadata.name:howl) AND` \
1807    ///   `(metadata.progress.start_time < \"2018-03-28T14:50:00Z\") AND` \
1808    ///   `(error:*)` - Returns operations where:
1809    ///   * The operation's metadata type is
1810    ///     [CreateBackupMetadata][google.spanner.admin.database.v1.CreateBackupMetadata].
1811    ///   * The backup name contains the string "howl".
1812    ///   * The operation started before 2018-03-28T14:50:00Z.
1813    ///   * The operation resulted in an error.
1814    /// * `(metadata.@type=type.googleapis.com/google.spanner.admin.database.v1.CopyBackupMetadata) AND` \
1815    ///   `(metadata.source_backup:test) AND` \
1816    ///   `(metadata.progress.start_time < \"2022-01-18T14:50:00Z\") AND` \
1817    ///   `(error:*)` - Returns operations where:
1818    ///   * The operation's metadata type is
1819    ///     [CopyBackupMetadata][google.spanner.admin.database.v1.CopyBackupMetadata].
1820    ///   * The source backup name contains the string "test".
1821    ///   * The operation started before 2022-01-18T14:50:00Z.
1822    ///   * The operation resulted in an error.
1823    /// * `((metadata.@type=type.googleapis.com/google.spanner.admin.database.v1.CreateBackupMetadata) AND` \
1824    ///   `(metadata.database:test_db)) OR` \
1825    ///   `((metadata.@type=type.googleapis.com/google.spanner.admin.database.v1.CopyBackupMetadata)
1826    ///   AND` \
1827    ///   `(metadata.source_backup:test_bkp)) AND` \
1828    ///   `(error:*)` - Returns operations where:
1829    ///   * The operation's metadata matches either of criteria:
1830    ///     * The operation's metadata type is
1831    ///       [CreateBackupMetadata][google.spanner.admin.database.v1.CreateBackupMetadata]
1832    ///       AND the source database name of the backup contains the string
1833    ///       "test_db"
1834    ///     * The operation's metadata type is
1835    ///       [CopyBackupMetadata][google.spanner.admin.database.v1.CopyBackupMetadata]
1836    ///       AND the source backup name contains the string "test_bkp"
1837    ///   * The operation resulted in an error.
1838    ///
1839    /// [google.longrunning.Operation]: google_cloud_longrunning::model::Operation
1840    /// [google.spanner.admin.database.v1.CopyBackupMetadata]: crate::model::CopyBackupMetadata
1841    /// [google.spanner.admin.database.v1.CreateBackupMetadata]: crate::model::CreateBackupMetadata
1842    pub filter: std::string::String,
1843
1844    /// Number of operations to be returned in the response. If 0 or
1845    /// less, defaults to the server's maximum allowed page size.
1846    pub page_size: i32,
1847
1848    /// If non-empty, `page_token` should contain a
1849    /// [next_page_token][google.spanner.admin.database.v1.ListBackupOperationsResponse.next_page_token]
1850    /// from a previous
1851    /// [ListBackupOperationsResponse][google.spanner.admin.database.v1.ListBackupOperationsResponse]
1852    /// to the same `parent` and with the same `filter`.
1853    ///
1854    /// [google.spanner.admin.database.v1.ListBackupOperationsResponse]: crate::model::ListBackupOperationsResponse
1855    /// [google.spanner.admin.database.v1.ListBackupOperationsResponse.next_page_token]: crate::model::ListBackupOperationsResponse::next_page_token
1856    pub page_token: std::string::String,
1857
1858    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1859}
1860
1861impl ListBackupOperationsRequest {
1862    /// Creates a new default instance.
1863    pub fn new() -> Self {
1864        std::default::Default::default()
1865    }
1866
1867    /// Sets the value of [parent][crate::model::ListBackupOperationsRequest::parent].
1868    ///
1869    /// # Example
1870    /// ```ignore,no_run
1871    /// # use google_cloud_spanner_admin_database_v1::model::ListBackupOperationsRequest;
1872    /// let x = ListBackupOperationsRequest::new().set_parent("example");
1873    /// ```
1874    pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1875        self.parent = v.into();
1876        self
1877    }
1878
1879    /// Sets the value of [filter][crate::model::ListBackupOperationsRequest::filter].
1880    ///
1881    /// # Example
1882    /// ```ignore,no_run
1883    /// # use google_cloud_spanner_admin_database_v1::model::ListBackupOperationsRequest;
1884    /// let x = ListBackupOperationsRequest::new().set_filter("example");
1885    /// ```
1886    pub fn set_filter<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1887        self.filter = v.into();
1888        self
1889    }
1890
1891    /// Sets the value of [page_size][crate::model::ListBackupOperationsRequest::page_size].
1892    ///
1893    /// # Example
1894    /// ```ignore,no_run
1895    /// # use google_cloud_spanner_admin_database_v1::model::ListBackupOperationsRequest;
1896    /// let x = ListBackupOperationsRequest::new().set_page_size(42);
1897    /// ```
1898    pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
1899        self.page_size = v.into();
1900        self
1901    }
1902
1903    /// Sets the value of [page_token][crate::model::ListBackupOperationsRequest::page_token].
1904    ///
1905    /// # Example
1906    /// ```ignore,no_run
1907    /// # use google_cloud_spanner_admin_database_v1::model::ListBackupOperationsRequest;
1908    /// let x = ListBackupOperationsRequest::new().set_page_token("example");
1909    /// ```
1910    pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1911        self.page_token = v.into();
1912        self
1913    }
1914}
1915
1916impl wkt::message::Message for ListBackupOperationsRequest {
1917    fn typename() -> &'static str {
1918        "type.googleapis.com/google.spanner.admin.database.v1.ListBackupOperationsRequest"
1919    }
1920}
1921
1922/// The response for
1923/// [ListBackupOperations][google.spanner.admin.database.v1.DatabaseAdmin.ListBackupOperations].
1924///
1925/// [google.spanner.admin.database.v1.DatabaseAdmin.ListBackupOperations]: crate::client::DatabaseAdmin::list_backup_operations
1926#[derive(Clone, Default, PartialEq)]
1927#[non_exhaustive]
1928pub struct ListBackupOperationsResponse {
1929    /// The list of matching backup [long-running
1930    /// operations][google.longrunning.Operation]. Each operation's name will be
1931    /// prefixed by the backup's name. The operation's
1932    /// [metadata][google.longrunning.Operation.metadata] field type
1933    /// `metadata.type_url` describes the type of the metadata. Operations returned
1934    /// include those that are pending or have completed/failed/canceled within the
1935    /// last 7 days. Operations returned are ordered by
1936    /// `operation.metadata.value.progress.start_time` in descending order starting
1937    /// from the most recently started operation.
1938    ///
1939    /// [google.longrunning.Operation]: google_cloud_longrunning::model::Operation
1940    /// [google.longrunning.Operation.metadata]: google_cloud_longrunning::model::Operation::metadata
1941    pub operations: std::vec::Vec<google_cloud_longrunning::model::Operation>,
1942
1943    /// `next_page_token` can be sent in a subsequent
1944    /// [ListBackupOperations][google.spanner.admin.database.v1.DatabaseAdmin.ListBackupOperations]
1945    /// call to fetch more of the matching metadata.
1946    ///
1947    /// [google.spanner.admin.database.v1.DatabaseAdmin.ListBackupOperations]: crate::client::DatabaseAdmin::list_backup_operations
1948    pub next_page_token: std::string::String,
1949
1950    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1951}
1952
1953impl ListBackupOperationsResponse {
1954    /// Creates a new default instance.
1955    pub fn new() -> Self {
1956        std::default::Default::default()
1957    }
1958
1959    /// Sets the value of [operations][crate::model::ListBackupOperationsResponse::operations].
1960    ///
1961    /// # Example
1962    /// ```ignore,no_run
1963    /// # use google_cloud_spanner_admin_database_v1::model::ListBackupOperationsResponse;
1964    /// use google_cloud_longrunning::model::Operation;
1965    /// let x = ListBackupOperationsResponse::new()
1966    ///     .set_operations([
1967    ///         Operation::default()/* use setters */,
1968    ///         Operation::default()/* use (different) setters */,
1969    ///     ]);
1970    /// ```
1971    pub fn set_operations<T, V>(mut self, v: T) -> Self
1972    where
1973        T: std::iter::IntoIterator<Item = V>,
1974        V: std::convert::Into<google_cloud_longrunning::model::Operation>,
1975    {
1976        use std::iter::Iterator;
1977        self.operations = v.into_iter().map(|i| i.into()).collect();
1978        self
1979    }
1980
1981    /// Sets the value of [next_page_token][crate::model::ListBackupOperationsResponse::next_page_token].
1982    ///
1983    /// # Example
1984    /// ```ignore,no_run
1985    /// # use google_cloud_spanner_admin_database_v1::model::ListBackupOperationsResponse;
1986    /// let x = ListBackupOperationsResponse::new().set_next_page_token("example");
1987    /// ```
1988    pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1989        self.next_page_token = v.into();
1990        self
1991    }
1992}
1993
1994impl wkt::message::Message for ListBackupOperationsResponse {
1995    fn typename() -> &'static str {
1996        "type.googleapis.com/google.spanner.admin.database.v1.ListBackupOperationsResponse"
1997    }
1998}
1999
2000#[doc(hidden)]
2001impl google_cloud_gax::paginator::internal::PageableResponse for ListBackupOperationsResponse {
2002    type PageItem = google_cloud_longrunning::model::Operation;
2003
2004    fn items(self) -> std::vec::Vec<Self::PageItem> {
2005        self.operations
2006    }
2007
2008    fn next_page_token(&self) -> std::string::String {
2009        use std::clone::Clone;
2010        self.next_page_token.clone()
2011    }
2012}
2013
2014/// Information about a backup.
2015#[derive(Clone, Default, PartialEq)]
2016#[non_exhaustive]
2017pub struct BackupInfo {
2018    /// Name of the backup.
2019    pub backup: std::string::String,
2020
2021    /// The backup contains an externally consistent copy of `source_database` at
2022    /// the timestamp specified by `version_time`. If the
2023    /// [CreateBackup][google.spanner.admin.database.v1.DatabaseAdmin.CreateBackup]
2024    /// request did not specify `version_time`, the `version_time` of the backup is
2025    /// equivalent to the `create_time`.
2026    ///
2027    /// [google.spanner.admin.database.v1.DatabaseAdmin.CreateBackup]: crate::client::DatabaseAdmin::create_backup
2028    pub version_time: std::option::Option<wkt::Timestamp>,
2029
2030    /// The time the
2031    /// [CreateBackup][google.spanner.admin.database.v1.DatabaseAdmin.CreateBackup]
2032    /// request was received.
2033    ///
2034    /// [google.spanner.admin.database.v1.DatabaseAdmin.CreateBackup]: crate::client::DatabaseAdmin::create_backup
2035    pub create_time: std::option::Option<wkt::Timestamp>,
2036
2037    /// Name of the database the backup was created from.
2038    pub source_database: std::string::String,
2039
2040    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2041}
2042
2043impl BackupInfo {
2044    /// Creates a new default instance.
2045    pub fn new() -> Self {
2046        std::default::Default::default()
2047    }
2048
2049    /// Sets the value of [backup][crate::model::BackupInfo::backup].
2050    ///
2051    /// # Example
2052    /// ```ignore,no_run
2053    /// # use google_cloud_spanner_admin_database_v1::model::BackupInfo;
2054    /// # let project_id = "project_id";
2055    /// # let instance_id = "instance_id";
2056    /// # let backup_id = "backup_id";
2057    /// let x = BackupInfo::new().set_backup(format!("projects/{project_id}/instances/{instance_id}/backups/{backup_id}"));
2058    /// ```
2059    pub fn set_backup<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2060        self.backup = v.into();
2061        self
2062    }
2063
2064    /// Sets the value of [version_time][crate::model::BackupInfo::version_time].
2065    ///
2066    /// # Example
2067    /// ```ignore,no_run
2068    /// # use google_cloud_spanner_admin_database_v1::model::BackupInfo;
2069    /// use wkt::Timestamp;
2070    /// let x = BackupInfo::new().set_version_time(Timestamp::default()/* use setters */);
2071    /// ```
2072    pub fn set_version_time<T>(mut self, v: T) -> Self
2073    where
2074        T: std::convert::Into<wkt::Timestamp>,
2075    {
2076        self.version_time = std::option::Option::Some(v.into());
2077        self
2078    }
2079
2080    /// Sets or clears the value of [version_time][crate::model::BackupInfo::version_time].
2081    ///
2082    /// # Example
2083    /// ```ignore,no_run
2084    /// # use google_cloud_spanner_admin_database_v1::model::BackupInfo;
2085    /// use wkt::Timestamp;
2086    /// let x = BackupInfo::new().set_or_clear_version_time(Some(Timestamp::default()/* use setters */));
2087    /// let x = BackupInfo::new().set_or_clear_version_time(None::<Timestamp>);
2088    /// ```
2089    pub fn set_or_clear_version_time<T>(mut self, v: std::option::Option<T>) -> Self
2090    where
2091        T: std::convert::Into<wkt::Timestamp>,
2092    {
2093        self.version_time = v.map(|x| x.into());
2094        self
2095    }
2096
2097    /// Sets the value of [create_time][crate::model::BackupInfo::create_time].
2098    ///
2099    /// # Example
2100    /// ```ignore,no_run
2101    /// # use google_cloud_spanner_admin_database_v1::model::BackupInfo;
2102    /// use wkt::Timestamp;
2103    /// let x = BackupInfo::new().set_create_time(Timestamp::default()/* use setters */);
2104    /// ```
2105    pub fn set_create_time<T>(mut self, v: T) -> Self
2106    where
2107        T: std::convert::Into<wkt::Timestamp>,
2108    {
2109        self.create_time = std::option::Option::Some(v.into());
2110        self
2111    }
2112
2113    /// Sets or clears the value of [create_time][crate::model::BackupInfo::create_time].
2114    ///
2115    /// # Example
2116    /// ```ignore,no_run
2117    /// # use google_cloud_spanner_admin_database_v1::model::BackupInfo;
2118    /// use wkt::Timestamp;
2119    /// let x = BackupInfo::new().set_or_clear_create_time(Some(Timestamp::default()/* use setters */));
2120    /// let x = BackupInfo::new().set_or_clear_create_time(None::<Timestamp>);
2121    /// ```
2122    pub fn set_or_clear_create_time<T>(mut self, v: std::option::Option<T>) -> Self
2123    where
2124        T: std::convert::Into<wkt::Timestamp>,
2125    {
2126        self.create_time = v.map(|x| x.into());
2127        self
2128    }
2129
2130    /// Sets the value of [source_database][crate::model::BackupInfo::source_database].
2131    ///
2132    /// # Example
2133    /// ```ignore,no_run
2134    /// # use google_cloud_spanner_admin_database_v1::model::BackupInfo;
2135    /// # let project_id = "project_id";
2136    /// # let instance_id = "instance_id";
2137    /// # let database_id = "database_id";
2138    /// let x = BackupInfo::new().set_source_database(format!("projects/{project_id}/instances/{instance_id}/databases/{database_id}"));
2139    /// ```
2140    pub fn set_source_database<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2141        self.source_database = v.into();
2142        self
2143    }
2144}
2145
2146impl wkt::message::Message for BackupInfo {
2147    fn typename() -> &'static str {
2148        "type.googleapis.com/google.spanner.admin.database.v1.BackupInfo"
2149    }
2150}
2151
2152/// Encryption configuration for the backup to create.
2153#[derive(Clone, Default, PartialEq)]
2154#[non_exhaustive]
2155pub struct CreateBackupEncryptionConfig {
2156    /// Required. The encryption type of the backup.
2157    pub encryption_type: crate::model::create_backup_encryption_config::EncryptionType,
2158
2159    /// Optional. The Cloud KMS key that will be used to protect the backup.
2160    /// This field should be set only when
2161    /// [encryption_type][google.spanner.admin.database.v1.CreateBackupEncryptionConfig.encryption_type]
2162    /// is `CUSTOMER_MANAGED_ENCRYPTION`. Values are of the form
2163    /// `projects/<project>/locations/<location>/keyRings/<key_ring>/cryptoKeys/<kms_key_name>`.
2164    ///
2165    /// [google.spanner.admin.database.v1.CreateBackupEncryptionConfig.encryption_type]: crate::model::CreateBackupEncryptionConfig::encryption_type
2166    pub kms_key_name: std::string::String,
2167
2168    /// Optional. Specifies the KMS configuration for the one or more keys used to
2169    /// protect the backup. Values are of the form
2170    /// `projects/<project>/locations/<location>/keyRings/<key_ring>/cryptoKeys/<kms_key_name>`.
2171    ///
2172    /// The keys referenced by kms_key_names must fully cover all
2173    /// regions of the backup's instance configuration. Some examples:
2174    ///
2175    /// * For single region instance configs, specify a single regional
2176    ///   location KMS key.
2177    /// * For multi-regional instance configs of type GOOGLE_MANAGED,
2178    ///   either specify a multi-regional location KMS key or multiple regional
2179    ///   location KMS keys that cover all regions in the instance config.
2180    /// * For an instance config of type USER_MANAGED, please specify only
2181    ///   regional location KMS keys to cover each region in the instance config.
2182    ///   Multi-regional location KMS keys are not supported for USER_MANAGED
2183    ///   instance configs.
2184    pub kms_key_names: std::vec::Vec<std::string::String>,
2185
2186    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2187}
2188
2189impl CreateBackupEncryptionConfig {
2190    /// Creates a new default instance.
2191    pub fn new() -> Self {
2192        std::default::Default::default()
2193    }
2194
2195    /// Sets the value of [encryption_type][crate::model::CreateBackupEncryptionConfig::encryption_type].
2196    ///
2197    /// # Example
2198    /// ```ignore,no_run
2199    /// # use google_cloud_spanner_admin_database_v1::model::CreateBackupEncryptionConfig;
2200    /// use google_cloud_spanner_admin_database_v1::model::create_backup_encryption_config::EncryptionType;
2201    /// let x0 = CreateBackupEncryptionConfig::new().set_encryption_type(EncryptionType::UseDatabaseEncryption);
2202    /// let x1 = CreateBackupEncryptionConfig::new().set_encryption_type(EncryptionType::GoogleDefaultEncryption);
2203    /// let x2 = CreateBackupEncryptionConfig::new().set_encryption_type(EncryptionType::CustomerManagedEncryption);
2204    /// ```
2205    pub fn set_encryption_type<
2206        T: std::convert::Into<crate::model::create_backup_encryption_config::EncryptionType>,
2207    >(
2208        mut self,
2209        v: T,
2210    ) -> Self {
2211        self.encryption_type = v.into();
2212        self
2213    }
2214
2215    /// Sets the value of [kms_key_name][crate::model::CreateBackupEncryptionConfig::kms_key_name].
2216    ///
2217    /// # Example
2218    /// ```ignore,no_run
2219    /// # use google_cloud_spanner_admin_database_v1::model::CreateBackupEncryptionConfig;
2220    /// let x = CreateBackupEncryptionConfig::new().set_kms_key_name("example");
2221    /// ```
2222    pub fn set_kms_key_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2223        self.kms_key_name = v.into();
2224        self
2225    }
2226
2227    /// Sets the value of [kms_key_names][crate::model::CreateBackupEncryptionConfig::kms_key_names].
2228    ///
2229    /// # Example
2230    /// ```ignore,no_run
2231    /// # use google_cloud_spanner_admin_database_v1::model::CreateBackupEncryptionConfig;
2232    /// let x = CreateBackupEncryptionConfig::new().set_kms_key_names(["a", "b", "c"]);
2233    /// ```
2234    pub fn set_kms_key_names<T, V>(mut self, v: T) -> Self
2235    where
2236        T: std::iter::IntoIterator<Item = V>,
2237        V: std::convert::Into<std::string::String>,
2238    {
2239        use std::iter::Iterator;
2240        self.kms_key_names = v.into_iter().map(|i| i.into()).collect();
2241        self
2242    }
2243}
2244
2245impl wkt::message::Message for CreateBackupEncryptionConfig {
2246    fn typename() -> &'static str {
2247        "type.googleapis.com/google.spanner.admin.database.v1.CreateBackupEncryptionConfig"
2248    }
2249}
2250
2251/// Defines additional types related to [CreateBackupEncryptionConfig].
2252pub mod create_backup_encryption_config {
2253    #[allow(unused_imports)]
2254    use super::*;
2255
2256    /// Encryption types for the backup.
2257    ///
2258    /// # Working with unknown values
2259    ///
2260    /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
2261    /// additional enum variants at any time. Adding new variants is not considered
2262    /// a breaking change. Applications should write their code in anticipation of:
2263    ///
2264    /// - New values appearing in future releases of the client library, **and**
2265    /// - New values received dynamically, without application changes.
2266    ///
2267    /// Please consult the [Working with enums] section in the user guide for some
2268    /// guidelines.
2269    ///
2270    /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
2271    #[derive(Clone, Debug, PartialEq)]
2272    #[non_exhaustive]
2273    pub enum EncryptionType {
2274        /// Unspecified. Do not use.
2275        Unspecified,
2276        /// Use the same encryption configuration as the database. This is the
2277        /// default option when
2278        /// [encryption_config][google.spanner.admin.database.v1.CreateBackupEncryptionConfig]
2279        /// is empty. For example, if the database is using
2280        /// `Customer_Managed_Encryption`, the backup will be using the same Cloud
2281        /// KMS key as the database.
2282        ///
2283        /// [google.spanner.admin.database.v1.CreateBackupEncryptionConfig]: crate::model::CreateBackupEncryptionConfig
2284        UseDatabaseEncryption,
2285        /// Use Google default encryption.
2286        GoogleDefaultEncryption,
2287        /// Use customer managed encryption. If specified, `kms_key_name`
2288        /// must contain a valid Cloud KMS key.
2289        CustomerManagedEncryption,
2290        /// If set, the enum was initialized with an unknown value.
2291        ///
2292        /// Applications can examine the value using [EncryptionType::value] or
2293        /// [EncryptionType::name].
2294        UnknownValue(encryption_type::UnknownValue),
2295    }
2296
2297    #[doc(hidden)]
2298    pub mod encryption_type {
2299        #[allow(unused_imports)]
2300        use super::*;
2301        #[derive(Clone, Debug, PartialEq)]
2302        pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
2303    }
2304
2305    impl EncryptionType {
2306        /// Gets the enum value.
2307        ///
2308        /// Returns `None` if the enum contains an unknown value deserialized from
2309        /// the string representation of enums.
2310        pub fn value(&self) -> std::option::Option<i32> {
2311            match self {
2312                Self::Unspecified => std::option::Option::Some(0),
2313                Self::UseDatabaseEncryption => std::option::Option::Some(1),
2314                Self::GoogleDefaultEncryption => std::option::Option::Some(2),
2315                Self::CustomerManagedEncryption => std::option::Option::Some(3),
2316                Self::UnknownValue(u) => u.0.value(),
2317            }
2318        }
2319
2320        /// Gets the enum value as a string.
2321        ///
2322        /// Returns `None` if the enum contains an unknown value deserialized from
2323        /// the integer representation of enums.
2324        pub fn name(&self) -> std::option::Option<&str> {
2325            match self {
2326                Self::Unspecified => std::option::Option::Some("ENCRYPTION_TYPE_UNSPECIFIED"),
2327                Self::UseDatabaseEncryption => std::option::Option::Some("USE_DATABASE_ENCRYPTION"),
2328                Self::GoogleDefaultEncryption => {
2329                    std::option::Option::Some("GOOGLE_DEFAULT_ENCRYPTION")
2330                }
2331                Self::CustomerManagedEncryption => {
2332                    std::option::Option::Some("CUSTOMER_MANAGED_ENCRYPTION")
2333                }
2334                Self::UnknownValue(u) => u.0.name(),
2335            }
2336        }
2337    }
2338
2339    impl std::default::Default for EncryptionType {
2340        fn default() -> Self {
2341            use std::convert::From;
2342            Self::from(0)
2343        }
2344    }
2345
2346    impl std::fmt::Display for EncryptionType {
2347        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
2348            wkt::internal::display_enum(f, self.name(), self.value())
2349        }
2350    }
2351
2352    impl std::convert::From<i32> for EncryptionType {
2353        fn from(value: i32) -> Self {
2354            match value {
2355                0 => Self::Unspecified,
2356                1 => Self::UseDatabaseEncryption,
2357                2 => Self::GoogleDefaultEncryption,
2358                3 => Self::CustomerManagedEncryption,
2359                _ => Self::UnknownValue(encryption_type::UnknownValue(
2360                    wkt::internal::UnknownEnumValue::Integer(value),
2361                )),
2362            }
2363        }
2364    }
2365
2366    impl std::convert::From<&str> for EncryptionType {
2367        fn from(value: &str) -> Self {
2368            use std::string::ToString;
2369            match value {
2370                "ENCRYPTION_TYPE_UNSPECIFIED" => Self::Unspecified,
2371                "USE_DATABASE_ENCRYPTION" => Self::UseDatabaseEncryption,
2372                "GOOGLE_DEFAULT_ENCRYPTION" => Self::GoogleDefaultEncryption,
2373                "CUSTOMER_MANAGED_ENCRYPTION" => Self::CustomerManagedEncryption,
2374                _ => Self::UnknownValue(encryption_type::UnknownValue(
2375                    wkt::internal::UnknownEnumValue::String(value.to_string()),
2376                )),
2377            }
2378        }
2379    }
2380
2381    impl serde::ser::Serialize for EncryptionType {
2382        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
2383        where
2384            S: serde::Serializer,
2385        {
2386            match self {
2387                Self::Unspecified => serializer.serialize_i32(0),
2388                Self::UseDatabaseEncryption => serializer.serialize_i32(1),
2389                Self::GoogleDefaultEncryption => serializer.serialize_i32(2),
2390                Self::CustomerManagedEncryption => serializer.serialize_i32(3),
2391                Self::UnknownValue(u) => u.0.serialize(serializer),
2392            }
2393        }
2394    }
2395
2396    impl<'de> serde::de::Deserialize<'de> for EncryptionType {
2397        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
2398        where
2399            D: serde::Deserializer<'de>,
2400        {
2401            deserializer.deserialize_any(wkt::internal::EnumVisitor::<EncryptionType>::new(
2402                ".google.spanner.admin.database.v1.CreateBackupEncryptionConfig.EncryptionType",
2403            ))
2404        }
2405    }
2406}
2407
2408/// Encryption configuration for the copied backup.
2409#[derive(Clone, Default, PartialEq)]
2410#[non_exhaustive]
2411pub struct CopyBackupEncryptionConfig {
2412    /// Required. The encryption type of the backup.
2413    pub encryption_type: crate::model::copy_backup_encryption_config::EncryptionType,
2414
2415    /// Optional. The Cloud KMS key that will be used to protect the backup.
2416    /// This field should be set only when
2417    /// [encryption_type][google.spanner.admin.database.v1.CopyBackupEncryptionConfig.encryption_type]
2418    /// is `CUSTOMER_MANAGED_ENCRYPTION`. Values are of the form
2419    /// `projects/<project>/locations/<location>/keyRings/<key_ring>/cryptoKeys/<kms_key_name>`.
2420    ///
2421    /// [google.spanner.admin.database.v1.CopyBackupEncryptionConfig.encryption_type]: crate::model::CopyBackupEncryptionConfig::encryption_type
2422    pub kms_key_name: std::string::String,
2423
2424    /// Optional. Specifies the KMS configuration for the one or more keys used to
2425    /// protect the backup. Values are of the form
2426    /// `projects/<project>/locations/<location>/keyRings/<key_ring>/cryptoKeys/<kms_key_name>`.
2427    /// Kms keys specified can be in any order.
2428    ///
2429    /// The keys referenced by kms_key_names must fully cover all
2430    /// regions of the backup's instance configuration. Some examples:
2431    ///
2432    /// * For single region instance configs, specify a single regional
2433    ///   location KMS key.
2434    /// * For multi-regional instance configs of type GOOGLE_MANAGED,
2435    ///   either specify a multi-regional location KMS key or multiple regional
2436    ///   location KMS keys that cover all regions in the instance config.
2437    /// * For an instance config of type USER_MANAGED, please specify only
2438    ///   regional location KMS keys to cover each region in the instance config.
2439    ///   Multi-regional location KMS keys are not supported for USER_MANAGED
2440    ///   instance configs.
2441    pub kms_key_names: std::vec::Vec<std::string::String>,
2442
2443    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2444}
2445
2446impl CopyBackupEncryptionConfig {
2447    /// Creates a new default instance.
2448    pub fn new() -> Self {
2449        std::default::Default::default()
2450    }
2451
2452    /// Sets the value of [encryption_type][crate::model::CopyBackupEncryptionConfig::encryption_type].
2453    ///
2454    /// # Example
2455    /// ```ignore,no_run
2456    /// # use google_cloud_spanner_admin_database_v1::model::CopyBackupEncryptionConfig;
2457    /// use google_cloud_spanner_admin_database_v1::model::copy_backup_encryption_config::EncryptionType;
2458    /// let x0 = CopyBackupEncryptionConfig::new().set_encryption_type(EncryptionType::UseConfigDefaultOrBackupEncryption);
2459    /// let x1 = CopyBackupEncryptionConfig::new().set_encryption_type(EncryptionType::GoogleDefaultEncryption);
2460    /// let x2 = CopyBackupEncryptionConfig::new().set_encryption_type(EncryptionType::CustomerManagedEncryption);
2461    /// ```
2462    pub fn set_encryption_type<
2463        T: std::convert::Into<crate::model::copy_backup_encryption_config::EncryptionType>,
2464    >(
2465        mut self,
2466        v: T,
2467    ) -> Self {
2468        self.encryption_type = v.into();
2469        self
2470    }
2471
2472    /// Sets the value of [kms_key_name][crate::model::CopyBackupEncryptionConfig::kms_key_name].
2473    ///
2474    /// # Example
2475    /// ```ignore,no_run
2476    /// # use google_cloud_spanner_admin_database_v1::model::CopyBackupEncryptionConfig;
2477    /// let x = CopyBackupEncryptionConfig::new().set_kms_key_name("example");
2478    /// ```
2479    pub fn set_kms_key_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2480        self.kms_key_name = v.into();
2481        self
2482    }
2483
2484    /// Sets the value of [kms_key_names][crate::model::CopyBackupEncryptionConfig::kms_key_names].
2485    ///
2486    /// # Example
2487    /// ```ignore,no_run
2488    /// # use google_cloud_spanner_admin_database_v1::model::CopyBackupEncryptionConfig;
2489    /// let x = CopyBackupEncryptionConfig::new().set_kms_key_names(["a", "b", "c"]);
2490    /// ```
2491    pub fn set_kms_key_names<T, V>(mut self, v: T) -> Self
2492    where
2493        T: std::iter::IntoIterator<Item = V>,
2494        V: std::convert::Into<std::string::String>,
2495    {
2496        use std::iter::Iterator;
2497        self.kms_key_names = v.into_iter().map(|i| i.into()).collect();
2498        self
2499    }
2500}
2501
2502impl wkt::message::Message for CopyBackupEncryptionConfig {
2503    fn typename() -> &'static str {
2504        "type.googleapis.com/google.spanner.admin.database.v1.CopyBackupEncryptionConfig"
2505    }
2506}
2507
2508/// Defines additional types related to [CopyBackupEncryptionConfig].
2509pub mod copy_backup_encryption_config {
2510    #[allow(unused_imports)]
2511    use super::*;
2512
2513    /// Encryption types for the backup.
2514    ///
2515    /// # Working with unknown values
2516    ///
2517    /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
2518    /// additional enum variants at any time. Adding new variants is not considered
2519    /// a breaking change. Applications should write their code in anticipation of:
2520    ///
2521    /// - New values appearing in future releases of the client library, **and**
2522    /// - New values received dynamically, without application changes.
2523    ///
2524    /// Please consult the [Working with enums] section in the user guide for some
2525    /// guidelines.
2526    ///
2527    /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
2528    #[derive(Clone, Debug, PartialEq)]
2529    #[non_exhaustive]
2530    pub enum EncryptionType {
2531        /// Unspecified. Do not use.
2532        Unspecified,
2533        /// This is the default option for
2534        /// [CopyBackup][google.spanner.admin.database.v1.DatabaseAdmin.CopyBackup]
2535        /// when
2536        /// [encryption_config][google.spanner.admin.database.v1.CopyBackupEncryptionConfig]
2537        /// is not specified. For example, if the source backup is using
2538        /// `Customer_Managed_Encryption`, the backup will be using the same Cloud
2539        /// KMS key as the source backup.
2540        ///
2541        /// [google.spanner.admin.database.v1.CopyBackupEncryptionConfig]: crate::model::CopyBackupEncryptionConfig
2542        /// [google.spanner.admin.database.v1.DatabaseAdmin.CopyBackup]: crate::client::DatabaseAdmin::copy_backup
2543        UseConfigDefaultOrBackupEncryption,
2544        /// Use Google default encryption.
2545        GoogleDefaultEncryption,
2546        /// Use customer managed encryption. If specified, either `kms_key_name` or
2547        /// `kms_key_names` must contain valid Cloud KMS key(s).
2548        CustomerManagedEncryption,
2549        /// If set, the enum was initialized with an unknown value.
2550        ///
2551        /// Applications can examine the value using [EncryptionType::value] or
2552        /// [EncryptionType::name].
2553        UnknownValue(encryption_type::UnknownValue),
2554    }
2555
2556    #[doc(hidden)]
2557    pub mod encryption_type {
2558        #[allow(unused_imports)]
2559        use super::*;
2560        #[derive(Clone, Debug, PartialEq)]
2561        pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
2562    }
2563
2564    impl EncryptionType {
2565        /// Gets the enum value.
2566        ///
2567        /// Returns `None` if the enum contains an unknown value deserialized from
2568        /// the string representation of enums.
2569        pub fn value(&self) -> std::option::Option<i32> {
2570            match self {
2571                Self::Unspecified => std::option::Option::Some(0),
2572                Self::UseConfigDefaultOrBackupEncryption => std::option::Option::Some(1),
2573                Self::GoogleDefaultEncryption => std::option::Option::Some(2),
2574                Self::CustomerManagedEncryption => std::option::Option::Some(3),
2575                Self::UnknownValue(u) => u.0.value(),
2576            }
2577        }
2578
2579        /// Gets the enum value as a string.
2580        ///
2581        /// Returns `None` if the enum contains an unknown value deserialized from
2582        /// the integer representation of enums.
2583        pub fn name(&self) -> std::option::Option<&str> {
2584            match self {
2585                Self::Unspecified => std::option::Option::Some("ENCRYPTION_TYPE_UNSPECIFIED"),
2586                Self::UseConfigDefaultOrBackupEncryption => {
2587                    std::option::Option::Some("USE_CONFIG_DEFAULT_OR_BACKUP_ENCRYPTION")
2588                }
2589                Self::GoogleDefaultEncryption => {
2590                    std::option::Option::Some("GOOGLE_DEFAULT_ENCRYPTION")
2591                }
2592                Self::CustomerManagedEncryption => {
2593                    std::option::Option::Some("CUSTOMER_MANAGED_ENCRYPTION")
2594                }
2595                Self::UnknownValue(u) => u.0.name(),
2596            }
2597        }
2598    }
2599
2600    impl std::default::Default for EncryptionType {
2601        fn default() -> Self {
2602            use std::convert::From;
2603            Self::from(0)
2604        }
2605    }
2606
2607    impl std::fmt::Display for EncryptionType {
2608        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
2609            wkt::internal::display_enum(f, self.name(), self.value())
2610        }
2611    }
2612
2613    impl std::convert::From<i32> for EncryptionType {
2614        fn from(value: i32) -> Self {
2615            match value {
2616                0 => Self::Unspecified,
2617                1 => Self::UseConfigDefaultOrBackupEncryption,
2618                2 => Self::GoogleDefaultEncryption,
2619                3 => Self::CustomerManagedEncryption,
2620                _ => Self::UnknownValue(encryption_type::UnknownValue(
2621                    wkt::internal::UnknownEnumValue::Integer(value),
2622                )),
2623            }
2624        }
2625    }
2626
2627    impl std::convert::From<&str> for EncryptionType {
2628        fn from(value: &str) -> Self {
2629            use std::string::ToString;
2630            match value {
2631                "ENCRYPTION_TYPE_UNSPECIFIED" => Self::Unspecified,
2632                "USE_CONFIG_DEFAULT_OR_BACKUP_ENCRYPTION" => {
2633                    Self::UseConfigDefaultOrBackupEncryption
2634                }
2635                "GOOGLE_DEFAULT_ENCRYPTION" => Self::GoogleDefaultEncryption,
2636                "CUSTOMER_MANAGED_ENCRYPTION" => Self::CustomerManagedEncryption,
2637                _ => Self::UnknownValue(encryption_type::UnknownValue(
2638                    wkt::internal::UnknownEnumValue::String(value.to_string()),
2639                )),
2640            }
2641        }
2642    }
2643
2644    impl serde::ser::Serialize for EncryptionType {
2645        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
2646        where
2647            S: serde::Serializer,
2648        {
2649            match self {
2650                Self::Unspecified => serializer.serialize_i32(0),
2651                Self::UseConfigDefaultOrBackupEncryption => serializer.serialize_i32(1),
2652                Self::GoogleDefaultEncryption => serializer.serialize_i32(2),
2653                Self::CustomerManagedEncryption => serializer.serialize_i32(3),
2654                Self::UnknownValue(u) => u.0.serialize(serializer),
2655            }
2656        }
2657    }
2658
2659    impl<'de> serde::de::Deserialize<'de> for EncryptionType {
2660        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
2661        where
2662            D: serde::Deserializer<'de>,
2663        {
2664            deserializer.deserialize_any(wkt::internal::EnumVisitor::<EncryptionType>::new(
2665                ".google.spanner.admin.database.v1.CopyBackupEncryptionConfig.EncryptionType",
2666            ))
2667        }
2668    }
2669}
2670
2671/// The specification for full backups.
2672/// A full backup stores the entire contents of the database at a given
2673/// version time.
2674#[derive(Clone, Default, PartialEq)]
2675#[non_exhaustive]
2676pub struct FullBackupSpec {
2677    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2678}
2679
2680impl FullBackupSpec {
2681    /// Creates a new default instance.
2682    pub fn new() -> Self {
2683        std::default::Default::default()
2684    }
2685}
2686
2687impl wkt::message::Message for FullBackupSpec {
2688    fn typename() -> &'static str {
2689        "type.googleapis.com/google.spanner.admin.database.v1.FullBackupSpec"
2690    }
2691}
2692
2693/// The specification for incremental backup chains.
2694/// An incremental backup stores the delta of changes between a previous
2695/// backup and the database contents at a given version time. An
2696/// incremental backup chain consists of a full backup and zero or more
2697/// successive incremental backups. The first backup created for an
2698/// incremental backup chain is always a full backup.
2699#[derive(Clone, Default, PartialEq)]
2700#[non_exhaustive]
2701pub struct IncrementalBackupSpec {
2702    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2703}
2704
2705impl IncrementalBackupSpec {
2706    /// Creates a new default instance.
2707    pub fn new() -> Self {
2708        std::default::Default::default()
2709    }
2710}
2711
2712impl wkt::message::Message for IncrementalBackupSpec {
2713    fn typename() -> &'static str {
2714        "type.googleapis.com/google.spanner.admin.database.v1.IncrementalBackupSpec"
2715    }
2716}
2717
2718/// Instance partition information for the backup.
2719#[derive(Clone, Default, PartialEq)]
2720#[non_exhaustive]
2721pub struct BackupInstancePartition {
2722    /// A unique identifier for the instance partition. Values are of the form
2723    /// `projects/<project>/instances/<instance>/instancePartitions/<instance_partition_id>`
2724    pub instance_partition: std::string::String,
2725
2726    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2727}
2728
2729impl BackupInstancePartition {
2730    /// Creates a new default instance.
2731    pub fn new() -> Self {
2732        std::default::Default::default()
2733    }
2734
2735    /// Sets the value of [instance_partition][crate::model::BackupInstancePartition::instance_partition].
2736    ///
2737    /// # Example
2738    /// ```ignore,no_run
2739    /// # use google_cloud_spanner_admin_database_v1::model::BackupInstancePartition;
2740    /// let x = BackupInstancePartition::new().set_instance_partition("example");
2741    /// ```
2742    pub fn set_instance_partition<T: std::convert::Into<std::string::String>>(
2743        mut self,
2744        v: T,
2745    ) -> Self {
2746        self.instance_partition = v.into();
2747        self
2748    }
2749}
2750
2751impl wkt::message::Message for BackupInstancePartition {
2752    fn typename() -> &'static str {
2753        "type.googleapis.com/google.spanner.admin.database.v1.BackupInstancePartition"
2754    }
2755}
2756
2757/// Defines specifications of the backup schedule.
2758#[derive(Clone, Default, PartialEq)]
2759#[non_exhaustive]
2760pub struct BackupScheduleSpec {
2761    /// Required.
2762    pub schedule_spec: std::option::Option<crate::model::backup_schedule_spec::ScheduleSpec>,
2763
2764    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2765}
2766
2767impl BackupScheduleSpec {
2768    /// Creates a new default instance.
2769    pub fn new() -> Self {
2770        std::default::Default::default()
2771    }
2772
2773    /// Sets the value of [schedule_spec][crate::model::BackupScheduleSpec::schedule_spec].
2774    ///
2775    /// Note that all the setters affecting `schedule_spec` are mutually
2776    /// exclusive.
2777    ///
2778    /// # Example
2779    /// ```ignore,no_run
2780    /// # use google_cloud_spanner_admin_database_v1::model::BackupScheduleSpec;
2781    /// use google_cloud_spanner_admin_database_v1::model::CrontabSpec;
2782    /// let x = BackupScheduleSpec::new().set_schedule_spec(Some(
2783    ///     google_cloud_spanner_admin_database_v1::model::backup_schedule_spec::ScheduleSpec::CronSpec(CrontabSpec::default().into())));
2784    /// ```
2785    pub fn set_schedule_spec<
2786        T: std::convert::Into<std::option::Option<crate::model::backup_schedule_spec::ScheduleSpec>>,
2787    >(
2788        mut self,
2789        v: T,
2790    ) -> Self {
2791        self.schedule_spec = v.into();
2792        self
2793    }
2794
2795    /// The value of [schedule_spec][crate::model::BackupScheduleSpec::schedule_spec]
2796    /// if it holds a `CronSpec`, `None` if the field is not set or
2797    /// holds a different branch.
2798    pub fn cron_spec(&self) -> std::option::Option<&std::boxed::Box<crate::model::CrontabSpec>> {
2799        #[allow(unreachable_patterns)]
2800        self.schedule_spec.as_ref().and_then(|v| match v {
2801            crate::model::backup_schedule_spec::ScheduleSpec::CronSpec(v) => {
2802                std::option::Option::Some(v)
2803            }
2804            _ => std::option::Option::None,
2805        })
2806    }
2807
2808    /// Sets the value of [schedule_spec][crate::model::BackupScheduleSpec::schedule_spec]
2809    /// to hold a `CronSpec`.
2810    ///
2811    /// Note that all the setters affecting `schedule_spec` are
2812    /// mutually exclusive.
2813    ///
2814    /// # Example
2815    /// ```ignore,no_run
2816    /// # use google_cloud_spanner_admin_database_v1::model::BackupScheduleSpec;
2817    /// use google_cloud_spanner_admin_database_v1::model::CrontabSpec;
2818    /// let x = BackupScheduleSpec::new().set_cron_spec(CrontabSpec::default()/* use setters */);
2819    /// assert!(x.cron_spec().is_some());
2820    /// ```
2821    pub fn set_cron_spec<T: std::convert::Into<std::boxed::Box<crate::model::CrontabSpec>>>(
2822        mut self,
2823        v: T,
2824    ) -> Self {
2825        self.schedule_spec = std::option::Option::Some(
2826            crate::model::backup_schedule_spec::ScheduleSpec::CronSpec(v.into()),
2827        );
2828        self
2829    }
2830}
2831
2832impl wkt::message::Message for BackupScheduleSpec {
2833    fn typename() -> &'static str {
2834        "type.googleapis.com/google.spanner.admin.database.v1.BackupScheduleSpec"
2835    }
2836}
2837
2838/// Defines additional types related to [BackupScheduleSpec].
2839pub mod backup_schedule_spec {
2840    #[allow(unused_imports)]
2841    use super::*;
2842
2843    /// Required.
2844    #[derive(Clone, Debug, PartialEq)]
2845    #[non_exhaustive]
2846    pub enum ScheduleSpec {
2847        /// Cron style schedule specification.
2848        CronSpec(std::boxed::Box<crate::model::CrontabSpec>),
2849    }
2850}
2851
2852/// BackupSchedule expresses the automated backup creation specification for a
2853/// Spanner database.
2854/// Next ID: 10
2855#[derive(Clone, Default, PartialEq)]
2856#[non_exhaustive]
2857pub struct BackupSchedule {
2858    /// Identifier. Output only for the
2859    /// [CreateBackupSchedule][DatabaseAdmin.CreateBackupSchededule] operation.
2860    /// Required for the
2861    /// [UpdateBackupSchedule][google.spanner.admin.database.v1.DatabaseAdmin.UpdateBackupSchedule]
2862    /// operation. A globally unique identifier for the backup schedule which
2863    /// cannot be changed. Values are of the form
2864    /// `projects/<project>/instances/<instance>/databases/<database>/backupSchedules/[a-z][a-z0-9_\-]*[a-z0-9]`
2865    /// The final segment of the name must be between 2 and 60 characters in
2866    /// length.
2867    ///
2868    /// [google.spanner.admin.database.v1.DatabaseAdmin.UpdateBackupSchedule]: crate::client::DatabaseAdmin::update_backup_schedule
2869    pub name: std::string::String,
2870
2871    /// Optional. The schedule specification based on which the backup creations
2872    /// are triggered.
2873    pub spec: std::option::Option<crate::model::BackupScheduleSpec>,
2874
2875    /// Optional. The retention duration of a backup that must be at least 6 hours
2876    /// and at most 366 days. The backup is eligible to be automatically deleted
2877    /// once the retention period has elapsed.
2878    pub retention_duration: std::option::Option<wkt::Duration>,
2879
2880    /// Optional. The encryption configuration that will be used to encrypt the
2881    /// backup. If this field is not specified, the backup will use the same
2882    /// encryption configuration as the database.
2883    pub encryption_config: std::option::Option<crate::model::CreateBackupEncryptionConfig>,
2884
2885    /// Output only. The timestamp at which the schedule was last updated.
2886    /// If the schedule has never been updated, this field contains the timestamp
2887    /// when the schedule was first created.
2888    pub update_time: std::option::Option<wkt::Timestamp>,
2889
2890    /// Required. Backup type spec determines the type of backup that is created by
2891    /// the backup schedule. Currently, only full backups are supported.
2892    pub backup_type_spec: std::option::Option<crate::model::backup_schedule::BackupTypeSpec>,
2893
2894    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2895}
2896
2897impl BackupSchedule {
2898    /// Creates a new default instance.
2899    pub fn new() -> Self {
2900        std::default::Default::default()
2901    }
2902
2903    /// Sets the value of [name][crate::model::BackupSchedule::name].
2904    ///
2905    /// # Example
2906    /// ```ignore,no_run
2907    /// # use google_cloud_spanner_admin_database_v1::model::BackupSchedule;
2908    /// # let project_id = "project_id";
2909    /// # let instance_id = "instance_id";
2910    /// # let database_id = "database_id";
2911    /// # let schedule_id = "schedule_id";
2912    /// let x = BackupSchedule::new().set_name(format!("projects/{project_id}/instances/{instance_id}/databases/{database_id}/backupSchedules/{schedule_id}"));
2913    /// ```
2914    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2915        self.name = v.into();
2916        self
2917    }
2918
2919    /// Sets the value of [spec][crate::model::BackupSchedule::spec].
2920    ///
2921    /// # Example
2922    /// ```ignore,no_run
2923    /// # use google_cloud_spanner_admin_database_v1::model::BackupSchedule;
2924    /// use google_cloud_spanner_admin_database_v1::model::BackupScheduleSpec;
2925    /// let x = BackupSchedule::new().set_spec(BackupScheduleSpec::default()/* use setters */);
2926    /// ```
2927    pub fn set_spec<T>(mut self, v: T) -> Self
2928    where
2929        T: std::convert::Into<crate::model::BackupScheduleSpec>,
2930    {
2931        self.spec = std::option::Option::Some(v.into());
2932        self
2933    }
2934
2935    /// Sets or clears the value of [spec][crate::model::BackupSchedule::spec].
2936    ///
2937    /// # Example
2938    /// ```ignore,no_run
2939    /// # use google_cloud_spanner_admin_database_v1::model::BackupSchedule;
2940    /// use google_cloud_spanner_admin_database_v1::model::BackupScheduleSpec;
2941    /// let x = BackupSchedule::new().set_or_clear_spec(Some(BackupScheduleSpec::default()/* use setters */));
2942    /// let x = BackupSchedule::new().set_or_clear_spec(None::<BackupScheduleSpec>);
2943    /// ```
2944    pub fn set_or_clear_spec<T>(mut self, v: std::option::Option<T>) -> Self
2945    where
2946        T: std::convert::Into<crate::model::BackupScheduleSpec>,
2947    {
2948        self.spec = v.map(|x| x.into());
2949        self
2950    }
2951
2952    /// Sets the value of [retention_duration][crate::model::BackupSchedule::retention_duration].
2953    ///
2954    /// # Example
2955    /// ```ignore,no_run
2956    /// # use google_cloud_spanner_admin_database_v1::model::BackupSchedule;
2957    /// use wkt::Duration;
2958    /// let x = BackupSchedule::new().set_retention_duration(Duration::default()/* use setters */);
2959    /// ```
2960    pub fn set_retention_duration<T>(mut self, v: T) -> Self
2961    where
2962        T: std::convert::Into<wkt::Duration>,
2963    {
2964        self.retention_duration = std::option::Option::Some(v.into());
2965        self
2966    }
2967
2968    /// Sets or clears the value of [retention_duration][crate::model::BackupSchedule::retention_duration].
2969    ///
2970    /// # Example
2971    /// ```ignore,no_run
2972    /// # use google_cloud_spanner_admin_database_v1::model::BackupSchedule;
2973    /// use wkt::Duration;
2974    /// let x = BackupSchedule::new().set_or_clear_retention_duration(Some(Duration::default()/* use setters */));
2975    /// let x = BackupSchedule::new().set_or_clear_retention_duration(None::<Duration>);
2976    /// ```
2977    pub fn set_or_clear_retention_duration<T>(mut self, v: std::option::Option<T>) -> Self
2978    where
2979        T: std::convert::Into<wkt::Duration>,
2980    {
2981        self.retention_duration = v.map(|x| x.into());
2982        self
2983    }
2984
2985    /// Sets the value of [encryption_config][crate::model::BackupSchedule::encryption_config].
2986    ///
2987    /// # Example
2988    /// ```ignore,no_run
2989    /// # use google_cloud_spanner_admin_database_v1::model::BackupSchedule;
2990    /// use google_cloud_spanner_admin_database_v1::model::CreateBackupEncryptionConfig;
2991    /// let x = BackupSchedule::new().set_encryption_config(CreateBackupEncryptionConfig::default()/* use setters */);
2992    /// ```
2993    pub fn set_encryption_config<T>(mut self, v: T) -> Self
2994    where
2995        T: std::convert::Into<crate::model::CreateBackupEncryptionConfig>,
2996    {
2997        self.encryption_config = std::option::Option::Some(v.into());
2998        self
2999    }
3000
3001    /// Sets or clears the value of [encryption_config][crate::model::BackupSchedule::encryption_config].
3002    ///
3003    /// # Example
3004    /// ```ignore,no_run
3005    /// # use google_cloud_spanner_admin_database_v1::model::BackupSchedule;
3006    /// use google_cloud_spanner_admin_database_v1::model::CreateBackupEncryptionConfig;
3007    /// let x = BackupSchedule::new().set_or_clear_encryption_config(Some(CreateBackupEncryptionConfig::default()/* use setters */));
3008    /// let x = BackupSchedule::new().set_or_clear_encryption_config(None::<CreateBackupEncryptionConfig>);
3009    /// ```
3010    pub fn set_or_clear_encryption_config<T>(mut self, v: std::option::Option<T>) -> Self
3011    where
3012        T: std::convert::Into<crate::model::CreateBackupEncryptionConfig>,
3013    {
3014        self.encryption_config = v.map(|x| x.into());
3015        self
3016    }
3017
3018    /// Sets the value of [update_time][crate::model::BackupSchedule::update_time].
3019    ///
3020    /// # Example
3021    /// ```ignore,no_run
3022    /// # use google_cloud_spanner_admin_database_v1::model::BackupSchedule;
3023    /// use wkt::Timestamp;
3024    /// let x = BackupSchedule::new().set_update_time(Timestamp::default()/* use setters */);
3025    /// ```
3026    pub fn set_update_time<T>(mut self, v: T) -> Self
3027    where
3028        T: std::convert::Into<wkt::Timestamp>,
3029    {
3030        self.update_time = std::option::Option::Some(v.into());
3031        self
3032    }
3033
3034    /// Sets or clears the value of [update_time][crate::model::BackupSchedule::update_time].
3035    ///
3036    /// # Example
3037    /// ```ignore,no_run
3038    /// # use google_cloud_spanner_admin_database_v1::model::BackupSchedule;
3039    /// use wkt::Timestamp;
3040    /// let x = BackupSchedule::new().set_or_clear_update_time(Some(Timestamp::default()/* use setters */));
3041    /// let x = BackupSchedule::new().set_or_clear_update_time(None::<Timestamp>);
3042    /// ```
3043    pub fn set_or_clear_update_time<T>(mut self, v: std::option::Option<T>) -> Self
3044    where
3045        T: std::convert::Into<wkt::Timestamp>,
3046    {
3047        self.update_time = v.map(|x| x.into());
3048        self
3049    }
3050
3051    /// Sets the value of [backup_type_spec][crate::model::BackupSchedule::backup_type_spec].
3052    ///
3053    /// Note that all the setters affecting `backup_type_spec` are mutually
3054    /// exclusive.
3055    ///
3056    /// # Example
3057    /// ```ignore,no_run
3058    /// # use google_cloud_spanner_admin_database_v1::model::BackupSchedule;
3059    /// use google_cloud_spanner_admin_database_v1::model::FullBackupSpec;
3060    /// let x = BackupSchedule::new().set_backup_type_spec(Some(
3061    ///     google_cloud_spanner_admin_database_v1::model::backup_schedule::BackupTypeSpec::FullBackupSpec(FullBackupSpec::default().into())));
3062    /// ```
3063    pub fn set_backup_type_spec<
3064        T: std::convert::Into<std::option::Option<crate::model::backup_schedule::BackupTypeSpec>>,
3065    >(
3066        mut self,
3067        v: T,
3068    ) -> Self {
3069        self.backup_type_spec = v.into();
3070        self
3071    }
3072
3073    /// The value of [backup_type_spec][crate::model::BackupSchedule::backup_type_spec]
3074    /// if it holds a `FullBackupSpec`, `None` if the field is not set or
3075    /// holds a different branch.
3076    pub fn full_backup_spec(
3077        &self,
3078    ) -> std::option::Option<&std::boxed::Box<crate::model::FullBackupSpec>> {
3079        #[allow(unreachable_patterns)]
3080        self.backup_type_spec.as_ref().and_then(|v| match v {
3081            crate::model::backup_schedule::BackupTypeSpec::FullBackupSpec(v) => {
3082                std::option::Option::Some(v)
3083            }
3084            _ => std::option::Option::None,
3085        })
3086    }
3087
3088    /// Sets the value of [backup_type_spec][crate::model::BackupSchedule::backup_type_spec]
3089    /// to hold a `FullBackupSpec`.
3090    ///
3091    /// Note that all the setters affecting `backup_type_spec` are
3092    /// mutually exclusive.
3093    ///
3094    /// # Example
3095    /// ```ignore,no_run
3096    /// # use google_cloud_spanner_admin_database_v1::model::BackupSchedule;
3097    /// use google_cloud_spanner_admin_database_v1::model::FullBackupSpec;
3098    /// let x = BackupSchedule::new().set_full_backup_spec(FullBackupSpec::default()/* use setters */);
3099    /// assert!(x.full_backup_spec().is_some());
3100    /// assert!(x.incremental_backup_spec().is_none());
3101    /// ```
3102    pub fn set_full_backup_spec<
3103        T: std::convert::Into<std::boxed::Box<crate::model::FullBackupSpec>>,
3104    >(
3105        mut self,
3106        v: T,
3107    ) -> Self {
3108        self.backup_type_spec = std::option::Option::Some(
3109            crate::model::backup_schedule::BackupTypeSpec::FullBackupSpec(v.into()),
3110        );
3111        self
3112    }
3113
3114    /// The value of [backup_type_spec][crate::model::BackupSchedule::backup_type_spec]
3115    /// if it holds a `IncrementalBackupSpec`, `None` if the field is not set or
3116    /// holds a different branch.
3117    pub fn incremental_backup_spec(
3118        &self,
3119    ) -> std::option::Option<&std::boxed::Box<crate::model::IncrementalBackupSpec>> {
3120        #[allow(unreachable_patterns)]
3121        self.backup_type_spec.as_ref().and_then(|v| match v {
3122            crate::model::backup_schedule::BackupTypeSpec::IncrementalBackupSpec(v) => {
3123                std::option::Option::Some(v)
3124            }
3125            _ => std::option::Option::None,
3126        })
3127    }
3128
3129    /// Sets the value of [backup_type_spec][crate::model::BackupSchedule::backup_type_spec]
3130    /// to hold a `IncrementalBackupSpec`.
3131    ///
3132    /// Note that all the setters affecting `backup_type_spec` are
3133    /// mutually exclusive.
3134    ///
3135    /// # Example
3136    /// ```ignore,no_run
3137    /// # use google_cloud_spanner_admin_database_v1::model::BackupSchedule;
3138    /// use google_cloud_spanner_admin_database_v1::model::IncrementalBackupSpec;
3139    /// let x = BackupSchedule::new().set_incremental_backup_spec(IncrementalBackupSpec::default()/* use setters */);
3140    /// assert!(x.incremental_backup_spec().is_some());
3141    /// assert!(x.full_backup_spec().is_none());
3142    /// ```
3143    pub fn set_incremental_backup_spec<
3144        T: std::convert::Into<std::boxed::Box<crate::model::IncrementalBackupSpec>>,
3145    >(
3146        mut self,
3147        v: T,
3148    ) -> Self {
3149        self.backup_type_spec = std::option::Option::Some(
3150            crate::model::backup_schedule::BackupTypeSpec::IncrementalBackupSpec(v.into()),
3151        );
3152        self
3153    }
3154}
3155
3156impl wkt::message::Message for BackupSchedule {
3157    fn typename() -> &'static str {
3158        "type.googleapis.com/google.spanner.admin.database.v1.BackupSchedule"
3159    }
3160}
3161
3162/// Defines additional types related to [BackupSchedule].
3163pub mod backup_schedule {
3164    #[allow(unused_imports)]
3165    use super::*;
3166
3167    /// Required. Backup type spec determines the type of backup that is created by
3168    /// the backup schedule. Currently, only full backups are supported.
3169    #[derive(Clone, Debug, PartialEq)]
3170    #[non_exhaustive]
3171    pub enum BackupTypeSpec {
3172        /// The schedule creates only full backups.
3173        FullBackupSpec(std::boxed::Box<crate::model::FullBackupSpec>),
3174        /// The schedule creates incremental backup chains.
3175        IncrementalBackupSpec(std::boxed::Box<crate::model::IncrementalBackupSpec>),
3176    }
3177}
3178
3179/// CrontabSpec can be used to specify the version time and frequency at
3180/// which the backup should be created.
3181#[derive(Clone, Default, PartialEq)]
3182#[non_exhaustive]
3183pub struct CrontabSpec {
3184    /// Required. Textual representation of the crontab. User can customize the
3185    /// backup frequency and the backup version time using the cron
3186    /// expression. The version time must be in UTC timezone.
3187    ///
3188    /// The backup will contain an externally consistent copy of the
3189    /// database at the version time. Allowed frequencies are 12 hour, 1 day,
3190    /// 1 week and 1 month. Examples of valid cron specifications:
3191    ///
3192    /// * `0 2/12 * * * ` : every 12 hours at (2, 14) hours past midnight in UTC.
3193    /// * `0 2,14 * * * ` : every 12 hours at (2,14) hours past midnight in UTC.
3194    /// * `0 2 * * * `    : once a day at 2 past midnight in UTC.
3195    /// * `0 2 * * 0 `    : once a week every Sunday at 2 past midnight in UTC.
3196    /// * `0 2 8 * * `    : once a month on 8th day at 2 past midnight in UTC.
3197    pub text: std::string::String,
3198
3199    /// Output only. The time zone of the times in `CrontabSpec.text`. Currently
3200    /// only UTC is supported.
3201    pub time_zone: std::string::String,
3202
3203    /// Output only. Schedule backups will contain an externally consistent copy
3204    /// of the database at the version time specified in
3205    /// `schedule_spec.cron_spec`. However, Spanner may not initiate the creation
3206    /// of the scheduled backups at that version time. Spanner will initiate
3207    /// the creation of scheduled backups within the time window bounded by the
3208    /// version_time specified in `schedule_spec.cron_spec` and version_time +
3209    /// `creation_window`.
3210    pub creation_window: std::option::Option<wkt::Duration>,
3211
3212    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3213}
3214
3215impl CrontabSpec {
3216    /// Creates a new default instance.
3217    pub fn new() -> Self {
3218        std::default::Default::default()
3219    }
3220
3221    /// Sets the value of [text][crate::model::CrontabSpec::text].
3222    ///
3223    /// # Example
3224    /// ```ignore,no_run
3225    /// # use google_cloud_spanner_admin_database_v1::model::CrontabSpec;
3226    /// let x = CrontabSpec::new().set_text("example");
3227    /// ```
3228    pub fn set_text<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3229        self.text = v.into();
3230        self
3231    }
3232
3233    /// Sets the value of [time_zone][crate::model::CrontabSpec::time_zone].
3234    ///
3235    /// # Example
3236    /// ```ignore,no_run
3237    /// # use google_cloud_spanner_admin_database_v1::model::CrontabSpec;
3238    /// let x = CrontabSpec::new().set_time_zone("example");
3239    /// ```
3240    pub fn set_time_zone<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3241        self.time_zone = v.into();
3242        self
3243    }
3244
3245    /// Sets the value of [creation_window][crate::model::CrontabSpec::creation_window].
3246    ///
3247    /// # Example
3248    /// ```ignore,no_run
3249    /// # use google_cloud_spanner_admin_database_v1::model::CrontabSpec;
3250    /// use wkt::Duration;
3251    /// let x = CrontabSpec::new().set_creation_window(Duration::default()/* use setters */);
3252    /// ```
3253    pub fn set_creation_window<T>(mut self, v: T) -> Self
3254    where
3255        T: std::convert::Into<wkt::Duration>,
3256    {
3257        self.creation_window = std::option::Option::Some(v.into());
3258        self
3259    }
3260
3261    /// Sets or clears the value of [creation_window][crate::model::CrontabSpec::creation_window].
3262    ///
3263    /// # Example
3264    /// ```ignore,no_run
3265    /// # use google_cloud_spanner_admin_database_v1::model::CrontabSpec;
3266    /// use wkt::Duration;
3267    /// let x = CrontabSpec::new().set_or_clear_creation_window(Some(Duration::default()/* use setters */));
3268    /// let x = CrontabSpec::new().set_or_clear_creation_window(None::<Duration>);
3269    /// ```
3270    pub fn set_or_clear_creation_window<T>(mut self, v: std::option::Option<T>) -> Self
3271    where
3272        T: std::convert::Into<wkt::Duration>,
3273    {
3274        self.creation_window = v.map(|x| x.into());
3275        self
3276    }
3277}
3278
3279impl wkt::message::Message for CrontabSpec {
3280    fn typename() -> &'static str {
3281        "type.googleapis.com/google.spanner.admin.database.v1.CrontabSpec"
3282    }
3283}
3284
3285/// The request for
3286/// [CreateBackupSchedule][google.spanner.admin.database.v1.DatabaseAdmin.CreateBackupSchedule].
3287///
3288/// [google.spanner.admin.database.v1.DatabaseAdmin.CreateBackupSchedule]: crate::client::DatabaseAdmin::create_backup_schedule
3289#[derive(Clone, Default, PartialEq)]
3290#[non_exhaustive]
3291pub struct CreateBackupScheduleRequest {
3292    /// Required. The name of the database that this backup schedule applies to.
3293    pub parent: std::string::String,
3294
3295    /// Required. The Id to use for the backup schedule. The `backup_schedule_id`
3296    /// appended to `parent` forms the full backup schedule name of the form
3297    /// `projects/<project>/instances/<instance>/databases/<database>/backupSchedules/<backup_schedule_id>`.
3298    pub backup_schedule_id: std::string::String,
3299
3300    /// Required. The backup schedule to create.
3301    pub backup_schedule: std::option::Option<crate::model::BackupSchedule>,
3302
3303    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3304}
3305
3306impl CreateBackupScheduleRequest {
3307    /// Creates a new default instance.
3308    pub fn new() -> Self {
3309        std::default::Default::default()
3310    }
3311
3312    /// Sets the value of [parent][crate::model::CreateBackupScheduleRequest::parent].
3313    ///
3314    /// # Example
3315    /// ```ignore,no_run
3316    /// # use google_cloud_spanner_admin_database_v1::model::CreateBackupScheduleRequest;
3317    /// # let project_id = "project_id";
3318    /// # let instance_id = "instance_id";
3319    /// # let database_id = "database_id";
3320    /// let x = CreateBackupScheduleRequest::new().set_parent(format!("projects/{project_id}/instances/{instance_id}/databases/{database_id}"));
3321    /// ```
3322    pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3323        self.parent = v.into();
3324        self
3325    }
3326
3327    /// Sets the value of [backup_schedule_id][crate::model::CreateBackupScheduleRequest::backup_schedule_id].
3328    ///
3329    /// # Example
3330    /// ```ignore,no_run
3331    /// # use google_cloud_spanner_admin_database_v1::model::CreateBackupScheduleRequest;
3332    /// let x = CreateBackupScheduleRequest::new().set_backup_schedule_id("example");
3333    /// ```
3334    pub fn set_backup_schedule_id<T: std::convert::Into<std::string::String>>(
3335        mut self,
3336        v: T,
3337    ) -> Self {
3338        self.backup_schedule_id = v.into();
3339        self
3340    }
3341
3342    /// Sets the value of [backup_schedule][crate::model::CreateBackupScheduleRequest::backup_schedule].
3343    ///
3344    /// # Example
3345    /// ```ignore,no_run
3346    /// # use google_cloud_spanner_admin_database_v1::model::CreateBackupScheduleRequest;
3347    /// use google_cloud_spanner_admin_database_v1::model::BackupSchedule;
3348    /// let x = CreateBackupScheduleRequest::new().set_backup_schedule(BackupSchedule::default()/* use setters */);
3349    /// ```
3350    pub fn set_backup_schedule<T>(mut self, v: T) -> Self
3351    where
3352        T: std::convert::Into<crate::model::BackupSchedule>,
3353    {
3354        self.backup_schedule = std::option::Option::Some(v.into());
3355        self
3356    }
3357
3358    /// Sets or clears the value of [backup_schedule][crate::model::CreateBackupScheduleRequest::backup_schedule].
3359    ///
3360    /// # Example
3361    /// ```ignore,no_run
3362    /// # use google_cloud_spanner_admin_database_v1::model::CreateBackupScheduleRequest;
3363    /// use google_cloud_spanner_admin_database_v1::model::BackupSchedule;
3364    /// let x = CreateBackupScheduleRequest::new().set_or_clear_backup_schedule(Some(BackupSchedule::default()/* use setters */));
3365    /// let x = CreateBackupScheduleRequest::new().set_or_clear_backup_schedule(None::<BackupSchedule>);
3366    /// ```
3367    pub fn set_or_clear_backup_schedule<T>(mut self, v: std::option::Option<T>) -> Self
3368    where
3369        T: std::convert::Into<crate::model::BackupSchedule>,
3370    {
3371        self.backup_schedule = v.map(|x| x.into());
3372        self
3373    }
3374}
3375
3376impl wkt::message::Message for CreateBackupScheduleRequest {
3377    fn typename() -> &'static str {
3378        "type.googleapis.com/google.spanner.admin.database.v1.CreateBackupScheduleRequest"
3379    }
3380}
3381
3382/// The request for
3383/// [GetBackupSchedule][google.spanner.admin.database.v1.DatabaseAdmin.GetBackupSchedule].
3384///
3385/// [google.spanner.admin.database.v1.DatabaseAdmin.GetBackupSchedule]: crate::client::DatabaseAdmin::get_backup_schedule
3386#[derive(Clone, Default, PartialEq)]
3387#[non_exhaustive]
3388pub struct GetBackupScheduleRequest {
3389    /// Required. The name of the schedule to retrieve.
3390    /// Values are of the form
3391    /// `projects/<project>/instances/<instance>/databases/<database>/backupSchedules/<backup_schedule_id>`.
3392    pub name: std::string::String,
3393
3394    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3395}
3396
3397impl GetBackupScheduleRequest {
3398    /// Creates a new default instance.
3399    pub fn new() -> Self {
3400        std::default::Default::default()
3401    }
3402
3403    /// Sets the value of [name][crate::model::GetBackupScheduleRequest::name].
3404    ///
3405    /// # Example
3406    /// ```ignore,no_run
3407    /// # use google_cloud_spanner_admin_database_v1::model::GetBackupScheduleRequest;
3408    /// # let project_id = "project_id";
3409    /// # let instance_id = "instance_id";
3410    /// # let database_id = "database_id";
3411    /// # let schedule_id = "schedule_id";
3412    /// let x = GetBackupScheduleRequest::new().set_name(format!("projects/{project_id}/instances/{instance_id}/databases/{database_id}/backupSchedules/{schedule_id}"));
3413    /// ```
3414    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3415        self.name = v.into();
3416        self
3417    }
3418}
3419
3420impl wkt::message::Message for GetBackupScheduleRequest {
3421    fn typename() -> &'static str {
3422        "type.googleapis.com/google.spanner.admin.database.v1.GetBackupScheduleRequest"
3423    }
3424}
3425
3426/// The request for
3427/// [DeleteBackupSchedule][google.spanner.admin.database.v1.DatabaseAdmin.DeleteBackupSchedule].
3428///
3429/// [google.spanner.admin.database.v1.DatabaseAdmin.DeleteBackupSchedule]: crate::client::DatabaseAdmin::delete_backup_schedule
3430#[derive(Clone, Default, PartialEq)]
3431#[non_exhaustive]
3432pub struct DeleteBackupScheduleRequest {
3433    /// Required. The name of the schedule to delete.
3434    /// Values are of the form
3435    /// `projects/<project>/instances/<instance>/databases/<database>/backupSchedules/<backup_schedule_id>`.
3436    pub name: std::string::String,
3437
3438    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3439}
3440
3441impl DeleteBackupScheduleRequest {
3442    /// Creates a new default instance.
3443    pub fn new() -> Self {
3444        std::default::Default::default()
3445    }
3446
3447    /// Sets the value of [name][crate::model::DeleteBackupScheduleRequest::name].
3448    ///
3449    /// # Example
3450    /// ```ignore,no_run
3451    /// # use google_cloud_spanner_admin_database_v1::model::DeleteBackupScheduleRequest;
3452    /// # let project_id = "project_id";
3453    /// # let instance_id = "instance_id";
3454    /// # let database_id = "database_id";
3455    /// # let schedule_id = "schedule_id";
3456    /// let x = DeleteBackupScheduleRequest::new().set_name(format!("projects/{project_id}/instances/{instance_id}/databases/{database_id}/backupSchedules/{schedule_id}"));
3457    /// ```
3458    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3459        self.name = v.into();
3460        self
3461    }
3462}
3463
3464impl wkt::message::Message for DeleteBackupScheduleRequest {
3465    fn typename() -> &'static str {
3466        "type.googleapis.com/google.spanner.admin.database.v1.DeleteBackupScheduleRequest"
3467    }
3468}
3469
3470/// The request for
3471/// [ListBackupSchedules][google.spanner.admin.database.v1.DatabaseAdmin.ListBackupSchedules].
3472///
3473/// [google.spanner.admin.database.v1.DatabaseAdmin.ListBackupSchedules]: crate::client::DatabaseAdmin::list_backup_schedules
3474#[derive(Clone, Default, PartialEq)]
3475#[non_exhaustive]
3476pub struct ListBackupSchedulesRequest {
3477    /// Required. Database is the parent resource whose backup schedules should be
3478    /// listed. Values are of the form
3479    /// projects/\<project\>/instances/\<instance\>/databases/\<database\>
3480    pub parent: std::string::String,
3481
3482    /// Optional. Number of backup schedules to be returned in the response. If 0
3483    /// or less, defaults to the server's maximum allowed page size.
3484    pub page_size: i32,
3485
3486    /// Optional. If non-empty, `page_token` should contain a
3487    /// [next_page_token][google.spanner.admin.database.v1.ListBackupSchedulesResponse.next_page_token]
3488    /// from a previous
3489    /// [ListBackupSchedulesResponse][google.spanner.admin.database.v1.ListBackupSchedulesResponse]
3490    /// to the same `parent`.
3491    ///
3492    /// [google.spanner.admin.database.v1.ListBackupSchedulesResponse]: crate::model::ListBackupSchedulesResponse
3493    /// [google.spanner.admin.database.v1.ListBackupSchedulesResponse.next_page_token]: crate::model::ListBackupSchedulesResponse::next_page_token
3494    pub page_token: std::string::String,
3495
3496    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3497}
3498
3499impl ListBackupSchedulesRequest {
3500    /// Creates a new default instance.
3501    pub fn new() -> Self {
3502        std::default::Default::default()
3503    }
3504
3505    /// Sets the value of [parent][crate::model::ListBackupSchedulesRequest::parent].
3506    ///
3507    /// # Example
3508    /// ```ignore,no_run
3509    /// # use google_cloud_spanner_admin_database_v1::model::ListBackupSchedulesRequest;
3510    /// # let project_id = "project_id";
3511    /// # let instance_id = "instance_id";
3512    /// # let database_id = "database_id";
3513    /// let x = ListBackupSchedulesRequest::new().set_parent(format!("projects/{project_id}/instances/{instance_id}/databases/{database_id}"));
3514    /// ```
3515    pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3516        self.parent = v.into();
3517        self
3518    }
3519
3520    /// Sets the value of [page_size][crate::model::ListBackupSchedulesRequest::page_size].
3521    ///
3522    /// # Example
3523    /// ```ignore,no_run
3524    /// # use google_cloud_spanner_admin_database_v1::model::ListBackupSchedulesRequest;
3525    /// let x = ListBackupSchedulesRequest::new().set_page_size(42);
3526    /// ```
3527    pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
3528        self.page_size = v.into();
3529        self
3530    }
3531
3532    /// Sets the value of [page_token][crate::model::ListBackupSchedulesRequest::page_token].
3533    ///
3534    /// # Example
3535    /// ```ignore,no_run
3536    /// # use google_cloud_spanner_admin_database_v1::model::ListBackupSchedulesRequest;
3537    /// let x = ListBackupSchedulesRequest::new().set_page_token("example");
3538    /// ```
3539    pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3540        self.page_token = v.into();
3541        self
3542    }
3543}
3544
3545impl wkt::message::Message for ListBackupSchedulesRequest {
3546    fn typename() -> &'static str {
3547        "type.googleapis.com/google.spanner.admin.database.v1.ListBackupSchedulesRequest"
3548    }
3549}
3550
3551/// The response for
3552/// [ListBackupSchedules][google.spanner.admin.database.v1.DatabaseAdmin.ListBackupSchedules].
3553///
3554/// [google.spanner.admin.database.v1.DatabaseAdmin.ListBackupSchedules]: crate::client::DatabaseAdmin::list_backup_schedules
3555#[derive(Clone, Default, PartialEq)]
3556#[non_exhaustive]
3557pub struct ListBackupSchedulesResponse {
3558    /// The list of backup schedules for a database.
3559    pub backup_schedules: std::vec::Vec<crate::model::BackupSchedule>,
3560
3561    /// `next_page_token` can be sent in a subsequent
3562    /// [ListBackupSchedules][google.spanner.admin.database.v1.DatabaseAdmin.ListBackupSchedules]
3563    /// call to fetch more of the schedules.
3564    ///
3565    /// [google.spanner.admin.database.v1.DatabaseAdmin.ListBackupSchedules]: crate::client::DatabaseAdmin::list_backup_schedules
3566    pub next_page_token: std::string::String,
3567
3568    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3569}
3570
3571impl ListBackupSchedulesResponse {
3572    /// Creates a new default instance.
3573    pub fn new() -> Self {
3574        std::default::Default::default()
3575    }
3576
3577    /// Sets the value of [backup_schedules][crate::model::ListBackupSchedulesResponse::backup_schedules].
3578    ///
3579    /// # Example
3580    /// ```ignore,no_run
3581    /// # use google_cloud_spanner_admin_database_v1::model::ListBackupSchedulesResponse;
3582    /// use google_cloud_spanner_admin_database_v1::model::BackupSchedule;
3583    /// let x = ListBackupSchedulesResponse::new()
3584    ///     .set_backup_schedules([
3585    ///         BackupSchedule::default()/* use setters */,
3586    ///         BackupSchedule::default()/* use (different) setters */,
3587    ///     ]);
3588    /// ```
3589    pub fn set_backup_schedules<T, V>(mut self, v: T) -> Self
3590    where
3591        T: std::iter::IntoIterator<Item = V>,
3592        V: std::convert::Into<crate::model::BackupSchedule>,
3593    {
3594        use std::iter::Iterator;
3595        self.backup_schedules = v.into_iter().map(|i| i.into()).collect();
3596        self
3597    }
3598
3599    /// Sets the value of [next_page_token][crate::model::ListBackupSchedulesResponse::next_page_token].
3600    ///
3601    /// # Example
3602    /// ```ignore,no_run
3603    /// # use google_cloud_spanner_admin_database_v1::model::ListBackupSchedulesResponse;
3604    /// let x = ListBackupSchedulesResponse::new().set_next_page_token("example");
3605    /// ```
3606    pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3607        self.next_page_token = v.into();
3608        self
3609    }
3610}
3611
3612impl wkt::message::Message for ListBackupSchedulesResponse {
3613    fn typename() -> &'static str {
3614        "type.googleapis.com/google.spanner.admin.database.v1.ListBackupSchedulesResponse"
3615    }
3616}
3617
3618#[doc(hidden)]
3619impl google_cloud_gax::paginator::internal::PageableResponse for ListBackupSchedulesResponse {
3620    type PageItem = crate::model::BackupSchedule;
3621
3622    fn items(self) -> std::vec::Vec<Self::PageItem> {
3623        self.backup_schedules
3624    }
3625
3626    fn next_page_token(&self) -> std::string::String {
3627        use std::clone::Clone;
3628        self.next_page_token.clone()
3629    }
3630}
3631
3632/// The request for
3633/// [UpdateBackupScheduleRequest][google.spanner.admin.database.v1.DatabaseAdmin.UpdateBackupSchedule].
3634///
3635/// [google.spanner.admin.database.v1.DatabaseAdmin.UpdateBackupSchedule]: crate::client::DatabaseAdmin::update_backup_schedule
3636#[derive(Clone, Default, PartialEq)]
3637#[non_exhaustive]
3638pub struct UpdateBackupScheduleRequest {
3639    /// Required. The backup schedule to update. `backup_schedule.name`, and the
3640    /// fields to be updated as specified by `update_mask` are required. Other
3641    /// fields are ignored.
3642    pub backup_schedule: std::option::Option<crate::model::BackupSchedule>,
3643
3644    /// Required. A mask specifying which fields in the BackupSchedule resource
3645    /// should be updated. This mask is relative to the BackupSchedule resource,
3646    /// not to the request message. The field mask must always be
3647    /// specified; this prevents any future fields from being erased
3648    /// accidentally.
3649    pub update_mask: std::option::Option<wkt::FieldMask>,
3650
3651    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3652}
3653
3654impl UpdateBackupScheduleRequest {
3655    /// Creates a new default instance.
3656    pub fn new() -> Self {
3657        std::default::Default::default()
3658    }
3659
3660    /// Sets the value of [backup_schedule][crate::model::UpdateBackupScheduleRequest::backup_schedule].
3661    ///
3662    /// # Example
3663    /// ```ignore,no_run
3664    /// # use google_cloud_spanner_admin_database_v1::model::UpdateBackupScheduleRequest;
3665    /// use google_cloud_spanner_admin_database_v1::model::BackupSchedule;
3666    /// let x = UpdateBackupScheduleRequest::new().set_backup_schedule(BackupSchedule::default()/* use setters */);
3667    /// ```
3668    pub fn set_backup_schedule<T>(mut self, v: T) -> Self
3669    where
3670        T: std::convert::Into<crate::model::BackupSchedule>,
3671    {
3672        self.backup_schedule = std::option::Option::Some(v.into());
3673        self
3674    }
3675
3676    /// Sets or clears the value of [backup_schedule][crate::model::UpdateBackupScheduleRequest::backup_schedule].
3677    ///
3678    /// # Example
3679    /// ```ignore,no_run
3680    /// # use google_cloud_spanner_admin_database_v1::model::UpdateBackupScheduleRequest;
3681    /// use google_cloud_spanner_admin_database_v1::model::BackupSchedule;
3682    /// let x = UpdateBackupScheduleRequest::new().set_or_clear_backup_schedule(Some(BackupSchedule::default()/* use setters */));
3683    /// let x = UpdateBackupScheduleRequest::new().set_or_clear_backup_schedule(None::<BackupSchedule>);
3684    /// ```
3685    pub fn set_or_clear_backup_schedule<T>(mut self, v: std::option::Option<T>) -> Self
3686    where
3687        T: std::convert::Into<crate::model::BackupSchedule>,
3688    {
3689        self.backup_schedule = v.map(|x| x.into());
3690        self
3691    }
3692
3693    /// Sets the value of [update_mask][crate::model::UpdateBackupScheduleRequest::update_mask].
3694    ///
3695    /// # Example
3696    /// ```ignore,no_run
3697    /// # use google_cloud_spanner_admin_database_v1::model::UpdateBackupScheduleRequest;
3698    /// use wkt::FieldMask;
3699    /// let x = UpdateBackupScheduleRequest::new().set_update_mask(FieldMask::default()/* use setters */);
3700    /// ```
3701    pub fn set_update_mask<T>(mut self, v: T) -> Self
3702    where
3703        T: std::convert::Into<wkt::FieldMask>,
3704    {
3705        self.update_mask = std::option::Option::Some(v.into());
3706        self
3707    }
3708
3709    /// Sets or clears the value of [update_mask][crate::model::UpdateBackupScheduleRequest::update_mask].
3710    ///
3711    /// # Example
3712    /// ```ignore,no_run
3713    /// # use google_cloud_spanner_admin_database_v1::model::UpdateBackupScheduleRequest;
3714    /// use wkt::FieldMask;
3715    /// let x = UpdateBackupScheduleRequest::new().set_or_clear_update_mask(Some(FieldMask::default()/* use setters */));
3716    /// let x = UpdateBackupScheduleRequest::new().set_or_clear_update_mask(None::<FieldMask>);
3717    /// ```
3718    pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
3719    where
3720        T: std::convert::Into<wkt::FieldMask>,
3721    {
3722        self.update_mask = v.map(|x| x.into());
3723        self
3724    }
3725}
3726
3727impl wkt::message::Message for UpdateBackupScheduleRequest {
3728    fn typename() -> &'static str {
3729        "type.googleapis.com/google.spanner.admin.database.v1.UpdateBackupScheduleRequest"
3730    }
3731}
3732
3733/// Encapsulates progress related information for a Cloud Spanner long
3734/// running operation.
3735#[derive(Clone, Default, PartialEq)]
3736#[non_exhaustive]
3737pub struct OperationProgress {
3738    /// Percent completion of the operation.
3739    /// Values are between 0 and 100 inclusive.
3740    pub progress_percent: i32,
3741
3742    /// Time the request was received.
3743    pub start_time: std::option::Option<wkt::Timestamp>,
3744
3745    /// If set, the time at which this operation failed or was completed
3746    /// successfully.
3747    pub end_time: std::option::Option<wkt::Timestamp>,
3748
3749    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3750}
3751
3752impl OperationProgress {
3753    /// Creates a new default instance.
3754    pub fn new() -> Self {
3755        std::default::Default::default()
3756    }
3757
3758    /// Sets the value of [progress_percent][crate::model::OperationProgress::progress_percent].
3759    ///
3760    /// # Example
3761    /// ```ignore,no_run
3762    /// # use google_cloud_spanner_admin_database_v1::model::OperationProgress;
3763    /// let x = OperationProgress::new().set_progress_percent(42);
3764    /// ```
3765    pub fn set_progress_percent<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
3766        self.progress_percent = v.into();
3767        self
3768    }
3769
3770    /// Sets the value of [start_time][crate::model::OperationProgress::start_time].
3771    ///
3772    /// # Example
3773    /// ```ignore,no_run
3774    /// # use google_cloud_spanner_admin_database_v1::model::OperationProgress;
3775    /// use wkt::Timestamp;
3776    /// let x = OperationProgress::new().set_start_time(Timestamp::default()/* use setters */);
3777    /// ```
3778    pub fn set_start_time<T>(mut self, v: T) -> Self
3779    where
3780        T: std::convert::Into<wkt::Timestamp>,
3781    {
3782        self.start_time = std::option::Option::Some(v.into());
3783        self
3784    }
3785
3786    /// Sets or clears the value of [start_time][crate::model::OperationProgress::start_time].
3787    ///
3788    /// # Example
3789    /// ```ignore,no_run
3790    /// # use google_cloud_spanner_admin_database_v1::model::OperationProgress;
3791    /// use wkt::Timestamp;
3792    /// let x = OperationProgress::new().set_or_clear_start_time(Some(Timestamp::default()/* use setters */));
3793    /// let x = OperationProgress::new().set_or_clear_start_time(None::<Timestamp>);
3794    /// ```
3795    pub fn set_or_clear_start_time<T>(mut self, v: std::option::Option<T>) -> Self
3796    where
3797        T: std::convert::Into<wkt::Timestamp>,
3798    {
3799        self.start_time = v.map(|x| x.into());
3800        self
3801    }
3802
3803    /// Sets the value of [end_time][crate::model::OperationProgress::end_time].
3804    ///
3805    /// # Example
3806    /// ```ignore,no_run
3807    /// # use google_cloud_spanner_admin_database_v1::model::OperationProgress;
3808    /// use wkt::Timestamp;
3809    /// let x = OperationProgress::new().set_end_time(Timestamp::default()/* use setters */);
3810    /// ```
3811    pub fn set_end_time<T>(mut self, v: T) -> Self
3812    where
3813        T: std::convert::Into<wkt::Timestamp>,
3814    {
3815        self.end_time = std::option::Option::Some(v.into());
3816        self
3817    }
3818
3819    /// Sets or clears the value of [end_time][crate::model::OperationProgress::end_time].
3820    ///
3821    /// # Example
3822    /// ```ignore,no_run
3823    /// # use google_cloud_spanner_admin_database_v1::model::OperationProgress;
3824    /// use wkt::Timestamp;
3825    /// let x = OperationProgress::new().set_or_clear_end_time(Some(Timestamp::default()/* use setters */));
3826    /// let x = OperationProgress::new().set_or_clear_end_time(None::<Timestamp>);
3827    /// ```
3828    pub fn set_or_clear_end_time<T>(mut self, v: std::option::Option<T>) -> Self
3829    where
3830        T: std::convert::Into<wkt::Timestamp>,
3831    {
3832        self.end_time = v.map(|x| x.into());
3833        self
3834    }
3835}
3836
3837impl wkt::message::Message for OperationProgress {
3838    fn typename() -> &'static str {
3839        "type.googleapis.com/google.spanner.admin.database.v1.OperationProgress"
3840    }
3841}
3842
3843/// Encryption configuration for a Cloud Spanner database.
3844#[derive(Clone, Default, PartialEq)]
3845#[non_exhaustive]
3846pub struct EncryptionConfig {
3847    /// The Cloud KMS key to be used for encrypting and decrypting
3848    /// the database. Values are of the form
3849    /// `projects/<project>/locations/<location>/keyRings/<key_ring>/cryptoKeys/<kms_key_name>`.
3850    pub kms_key_name: std::string::String,
3851
3852    /// Specifies the KMS configuration for the one or more keys used to encrypt
3853    /// the database. Values are of the form
3854    /// `projects/<project>/locations/<location>/keyRings/<key_ring>/cryptoKeys/<kms_key_name>`.
3855    ///
3856    /// The keys referenced by kms_key_names must fully cover all
3857    /// regions of the database instance configuration. Some examples:
3858    ///
3859    /// * For single region database instance configs, specify a single regional
3860    ///   location KMS key.
3861    /// * For multi-regional database instance configs of type GOOGLE_MANAGED,
3862    ///   either specify a multi-regional location KMS key or multiple regional
3863    ///   location KMS keys that cover all regions in the instance config.
3864    /// * For a database instance config of type USER_MANAGED, please specify only
3865    ///   regional location KMS keys to cover each region in the instance config.
3866    ///   Multi-regional location KMS keys are not supported for USER_MANAGED
3867    ///   instance configs.
3868    pub kms_key_names: std::vec::Vec<std::string::String>,
3869
3870    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3871}
3872
3873impl EncryptionConfig {
3874    /// Creates a new default instance.
3875    pub fn new() -> Self {
3876        std::default::Default::default()
3877    }
3878
3879    /// Sets the value of [kms_key_name][crate::model::EncryptionConfig::kms_key_name].
3880    ///
3881    /// # Example
3882    /// ```ignore,no_run
3883    /// # use google_cloud_spanner_admin_database_v1::model::EncryptionConfig;
3884    /// let x = EncryptionConfig::new().set_kms_key_name("example");
3885    /// ```
3886    pub fn set_kms_key_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3887        self.kms_key_name = v.into();
3888        self
3889    }
3890
3891    /// Sets the value of [kms_key_names][crate::model::EncryptionConfig::kms_key_names].
3892    ///
3893    /// # Example
3894    /// ```ignore,no_run
3895    /// # use google_cloud_spanner_admin_database_v1::model::EncryptionConfig;
3896    /// let x = EncryptionConfig::new().set_kms_key_names(["a", "b", "c"]);
3897    /// ```
3898    pub fn set_kms_key_names<T, V>(mut self, v: T) -> Self
3899    where
3900        T: std::iter::IntoIterator<Item = V>,
3901        V: std::convert::Into<std::string::String>,
3902    {
3903        use std::iter::Iterator;
3904        self.kms_key_names = v.into_iter().map(|i| i.into()).collect();
3905        self
3906    }
3907}
3908
3909impl wkt::message::Message for EncryptionConfig {
3910    fn typename() -> &'static str {
3911        "type.googleapis.com/google.spanner.admin.database.v1.EncryptionConfig"
3912    }
3913}
3914
3915/// Encryption information for a Cloud Spanner database or backup.
3916#[derive(Clone, Default, PartialEq)]
3917#[non_exhaustive]
3918pub struct EncryptionInfo {
3919    /// Output only. The type of encryption.
3920    pub encryption_type: crate::model::encryption_info::Type,
3921
3922    /// Output only. If present, the status of a recent encrypt/decrypt call on
3923    /// underlying data for this database or backup. Regardless of status, data is
3924    /// always encrypted at rest.
3925    pub encryption_status: std::option::Option<google_cloud_rpc::model::Status>,
3926
3927    /// Output only. A Cloud KMS key version that is being used to protect the
3928    /// database or backup.
3929    pub kms_key_version: std::string::String,
3930
3931    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3932}
3933
3934impl EncryptionInfo {
3935    /// Creates a new default instance.
3936    pub fn new() -> Self {
3937        std::default::Default::default()
3938    }
3939
3940    /// Sets the value of [encryption_type][crate::model::EncryptionInfo::encryption_type].
3941    ///
3942    /// # Example
3943    /// ```ignore,no_run
3944    /// # use google_cloud_spanner_admin_database_v1::model::EncryptionInfo;
3945    /// use google_cloud_spanner_admin_database_v1::model::encryption_info::Type;
3946    /// let x0 = EncryptionInfo::new().set_encryption_type(Type::GoogleDefaultEncryption);
3947    /// let x1 = EncryptionInfo::new().set_encryption_type(Type::CustomerManagedEncryption);
3948    /// ```
3949    pub fn set_encryption_type<T: std::convert::Into<crate::model::encryption_info::Type>>(
3950        mut self,
3951        v: T,
3952    ) -> Self {
3953        self.encryption_type = v.into();
3954        self
3955    }
3956
3957    /// Sets the value of [encryption_status][crate::model::EncryptionInfo::encryption_status].
3958    ///
3959    /// # Example
3960    /// ```ignore,no_run
3961    /// # use google_cloud_spanner_admin_database_v1::model::EncryptionInfo;
3962    /// use google_cloud_rpc::model::Status;
3963    /// let x = EncryptionInfo::new().set_encryption_status(Status::default()/* use setters */);
3964    /// ```
3965    pub fn set_encryption_status<T>(mut self, v: T) -> Self
3966    where
3967        T: std::convert::Into<google_cloud_rpc::model::Status>,
3968    {
3969        self.encryption_status = std::option::Option::Some(v.into());
3970        self
3971    }
3972
3973    /// Sets or clears the value of [encryption_status][crate::model::EncryptionInfo::encryption_status].
3974    ///
3975    /// # Example
3976    /// ```ignore,no_run
3977    /// # use google_cloud_spanner_admin_database_v1::model::EncryptionInfo;
3978    /// use google_cloud_rpc::model::Status;
3979    /// let x = EncryptionInfo::new().set_or_clear_encryption_status(Some(Status::default()/* use setters */));
3980    /// let x = EncryptionInfo::new().set_or_clear_encryption_status(None::<Status>);
3981    /// ```
3982    pub fn set_or_clear_encryption_status<T>(mut self, v: std::option::Option<T>) -> Self
3983    where
3984        T: std::convert::Into<google_cloud_rpc::model::Status>,
3985    {
3986        self.encryption_status = v.map(|x| x.into());
3987        self
3988    }
3989
3990    /// Sets the value of [kms_key_version][crate::model::EncryptionInfo::kms_key_version].
3991    ///
3992    /// # Example
3993    /// ```ignore,no_run
3994    /// # use google_cloud_spanner_admin_database_v1::model::EncryptionInfo;
3995    /// let x = EncryptionInfo::new().set_kms_key_version("example");
3996    /// ```
3997    pub fn set_kms_key_version<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3998        self.kms_key_version = v.into();
3999        self
4000    }
4001}
4002
4003impl wkt::message::Message for EncryptionInfo {
4004    fn typename() -> &'static str {
4005        "type.googleapis.com/google.spanner.admin.database.v1.EncryptionInfo"
4006    }
4007}
4008
4009/// Defines additional types related to [EncryptionInfo].
4010pub mod encryption_info {
4011    #[allow(unused_imports)]
4012    use super::*;
4013
4014    /// Possible encryption types.
4015    ///
4016    /// # Working with unknown values
4017    ///
4018    /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
4019    /// additional enum variants at any time. Adding new variants is not considered
4020    /// a breaking change. Applications should write their code in anticipation of:
4021    ///
4022    /// - New values appearing in future releases of the client library, **and**
4023    /// - New values received dynamically, without application changes.
4024    ///
4025    /// Please consult the [Working with enums] section in the user guide for some
4026    /// guidelines.
4027    ///
4028    /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
4029    #[derive(Clone, Debug, PartialEq)]
4030    #[non_exhaustive]
4031    pub enum Type {
4032        /// Encryption type was not specified, though data at rest remains encrypted.
4033        Unspecified,
4034        /// The data is encrypted at rest with a key that is
4035        /// fully managed by Google. No key version or status will be populated.
4036        /// This is the default state.
4037        GoogleDefaultEncryption,
4038        /// The data is encrypted at rest with a key that is
4039        /// managed by the customer. The active version of the key. `kms_key_version`
4040        /// will be populated, and `encryption_status` may be populated.
4041        CustomerManagedEncryption,
4042        /// If set, the enum was initialized with an unknown value.
4043        ///
4044        /// Applications can examine the value using [Type::value] or
4045        /// [Type::name].
4046        UnknownValue(r#type::UnknownValue),
4047    }
4048
4049    #[doc(hidden)]
4050    pub mod r#type {
4051        #[allow(unused_imports)]
4052        use super::*;
4053        #[derive(Clone, Debug, PartialEq)]
4054        pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
4055    }
4056
4057    impl Type {
4058        /// Gets the enum value.
4059        ///
4060        /// Returns `None` if the enum contains an unknown value deserialized from
4061        /// the string representation of enums.
4062        pub fn value(&self) -> std::option::Option<i32> {
4063            match self {
4064                Self::Unspecified => std::option::Option::Some(0),
4065                Self::GoogleDefaultEncryption => std::option::Option::Some(1),
4066                Self::CustomerManagedEncryption => std::option::Option::Some(2),
4067                Self::UnknownValue(u) => u.0.value(),
4068            }
4069        }
4070
4071        /// Gets the enum value as a string.
4072        ///
4073        /// Returns `None` if the enum contains an unknown value deserialized from
4074        /// the integer representation of enums.
4075        pub fn name(&self) -> std::option::Option<&str> {
4076            match self {
4077                Self::Unspecified => std::option::Option::Some("TYPE_UNSPECIFIED"),
4078                Self::GoogleDefaultEncryption => {
4079                    std::option::Option::Some("GOOGLE_DEFAULT_ENCRYPTION")
4080                }
4081                Self::CustomerManagedEncryption => {
4082                    std::option::Option::Some("CUSTOMER_MANAGED_ENCRYPTION")
4083                }
4084                Self::UnknownValue(u) => u.0.name(),
4085            }
4086        }
4087    }
4088
4089    impl std::default::Default for Type {
4090        fn default() -> Self {
4091            use std::convert::From;
4092            Self::from(0)
4093        }
4094    }
4095
4096    impl std::fmt::Display for Type {
4097        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
4098            wkt::internal::display_enum(f, self.name(), self.value())
4099        }
4100    }
4101
4102    impl std::convert::From<i32> for Type {
4103        fn from(value: i32) -> Self {
4104            match value {
4105                0 => Self::Unspecified,
4106                1 => Self::GoogleDefaultEncryption,
4107                2 => Self::CustomerManagedEncryption,
4108                _ => Self::UnknownValue(r#type::UnknownValue(
4109                    wkt::internal::UnknownEnumValue::Integer(value),
4110                )),
4111            }
4112        }
4113    }
4114
4115    impl std::convert::From<&str> for Type {
4116        fn from(value: &str) -> Self {
4117            use std::string::ToString;
4118            match value {
4119                "TYPE_UNSPECIFIED" => Self::Unspecified,
4120                "GOOGLE_DEFAULT_ENCRYPTION" => Self::GoogleDefaultEncryption,
4121                "CUSTOMER_MANAGED_ENCRYPTION" => Self::CustomerManagedEncryption,
4122                _ => Self::UnknownValue(r#type::UnknownValue(
4123                    wkt::internal::UnknownEnumValue::String(value.to_string()),
4124                )),
4125            }
4126        }
4127    }
4128
4129    impl serde::ser::Serialize for Type {
4130        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
4131        where
4132            S: serde::Serializer,
4133        {
4134            match self {
4135                Self::Unspecified => serializer.serialize_i32(0),
4136                Self::GoogleDefaultEncryption => serializer.serialize_i32(1),
4137                Self::CustomerManagedEncryption => serializer.serialize_i32(2),
4138                Self::UnknownValue(u) => u.0.serialize(serializer),
4139            }
4140        }
4141    }
4142
4143    impl<'de> serde::de::Deserialize<'de> for Type {
4144        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
4145        where
4146            D: serde::Deserializer<'de>,
4147        {
4148            deserializer.deserialize_any(wkt::internal::EnumVisitor::<Type>::new(
4149                ".google.spanner.admin.database.v1.EncryptionInfo.Type",
4150            ))
4151        }
4152    }
4153}
4154
4155/// Information about the database restore.
4156#[derive(Clone, Default, PartialEq)]
4157#[non_exhaustive]
4158pub struct RestoreInfo {
4159    /// The type of the restore source.
4160    pub source_type: crate::model::RestoreSourceType,
4161
4162    /// Information about the source used to restore the database.
4163    pub source_info: std::option::Option<crate::model::restore_info::SourceInfo>,
4164
4165    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4166}
4167
4168impl RestoreInfo {
4169    /// Creates a new default instance.
4170    pub fn new() -> Self {
4171        std::default::Default::default()
4172    }
4173
4174    /// Sets the value of [source_type][crate::model::RestoreInfo::source_type].
4175    ///
4176    /// # Example
4177    /// ```ignore,no_run
4178    /// # use google_cloud_spanner_admin_database_v1::model::RestoreInfo;
4179    /// use google_cloud_spanner_admin_database_v1::model::RestoreSourceType;
4180    /// let x0 = RestoreInfo::new().set_source_type(RestoreSourceType::Backup);
4181    /// ```
4182    pub fn set_source_type<T: std::convert::Into<crate::model::RestoreSourceType>>(
4183        mut self,
4184        v: T,
4185    ) -> Self {
4186        self.source_type = v.into();
4187        self
4188    }
4189
4190    /// Sets the value of [source_info][crate::model::RestoreInfo::source_info].
4191    ///
4192    /// Note that all the setters affecting `source_info` are mutually
4193    /// exclusive.
4194    ///
4195    /// # Example
4196    /// ```ignore,no_run
4197    /// # use google_cloud_spanner_admin_database_v1::model::RestoreInfo;
4198    /// use google_cloud_spanner_admin_database_v1::model::BackupInfo;
4199    /// let x = RestoreInfo::new().set_source_info(Some(
4200    ///     google_cloud_spanner_admin_database_v1::model::restore_info::SourceInfo::BackupInfo(BackupInfo::default().into())));
4201    /// ```
4202    pub fn set_source_info<
4203        T: std::convert::Into<std::option::Option<crate::model::restore_info::SourceInfo>>,
4204    >(
4205        mut self,
4206        v: T,
4207    ) -> Self {
4208        self.source_info = v.into();
4209        self
4210    }
4211
4212    /// The value of [source_info][crate::model::RestoreInfo::source_info]
4213    /// if it holds a `BackupInfo`, `None` if the field is not set or
4214    /// holds a different branch.
4215    pub fn backup_info(&self) -> std::option::Option<&std::boxed::Box<crate::model::BackupInfo>> {
4216        #[allow(unreachable_patterns)]
4217        self.source_info.as_ref().and_then(|v| match v {
4218            crate::model::restore_info::SourceInfo::BackupInfo(v) => std::option::Option::Some(v),
4219            _ => std::option::Option::None,
4220        })
4221    }
4222
4223    /// Sets the value of [source_info][crate::model::RestoreInfo::source_info]
4224    /// to hold a `BackupInfo`.
4225    ///
4226    /// Note that all the setters affecting `source_info` are
4227    /// mutually exclusive.
4228    ///
4229    /// # Example
4230    /// ```ignore,no_run
4231    /// # use google_cloud_spanner_admin_database_v1::model::RestoreInfo;
4232    /// use google_cloud_spanner_admin_database_v1::model::BackupInfo;
4233    /// let x = RestoreInfo::new().set_backup_info(BackupInfo::default()/* use setters */);
4234    /// assert!(x.backup_info().is_some());
4235    /// ```
4236    pub fn set_backup_info<T: std::convert::Into<std::boxed::Box<crate::model::BackupInfo>>>(
4237        mut self,
4238        v: T,
4239    ) -> Self {
4240        self.source_info =
4241            std::option::Option::Some(crate::model::restore_info::SourceInfo::BackupInfo(v.into()));
4242        self
4243    }
4244}
4245
4246impl wkt::message::Message for RestoreInfo {
4247    fn typename() -> &'static str {
4248        "type.googleapis.com/google.spanner.admin.database.v1.RestoreInfo"
4249    }
4250}
4251
4252/// Defines additional types related to [RestoreInfo].
4253pub mod restore_info {
4254    #[allow(unused_imports)]
4255    use super::*;
4256
4257    /// Information about the source used to restore the database.
4258    #[derive(Clone, Debug, PartialEq)]
4259    #[non_exhaustive]
4260    pub enum SourceInfo {
4261        /// Information about the backup used to restore the database. The backup
4262        /// may no longer exist.
4263        BackupInfo(std::boxed::Box<crate::model::BackupInfo>),
4264    }
4265}
4266
4267/// A Cloud Spanner database.
4268#[derive(Clone, Default, PartialEq)]
4269#[non_exhaustive]
4270pub struct Database {
4271    /// Required. The name of the database. Values are of the form
4272    /// `projects/<project>/instances/<instance>/databases/<database>`,
4273    /// where `<database>` is as specified in the `CREATE DATABASE`
4274    /// statement. This name can be passed to other API methods to
4275    /// identify the database.
4276    pub name: std::string::String,
4277
4278    /// Output only. The current database state.
4279    pub state: crate::model::database::State,
4280
4281    /// Output only. If exists, the time at which the database creation started.
4282    pub create_time: std::option::Option<wkt::Timestamp>,
4283
4284    /// Output only. Applicable only for restored databases. Contains information
4285    /// about the restore source.
4286    pub restore_info: std::option::Option<crate::model::RestoreInfo>,
4287
4288    /// Output only. For databases that are using customer managed encryption, this
4289    /// field contains the encryption configuration for the database.
4290    /// For databases that are using Google default or other types of encryption,
4291    /// this field is empty.
4292    pub encryption_config: std::option::Option<crate::model::EncryptionConfig>,
4293
4294    /// Output only. For databases that are using customer managed encryption, this
4295    /// field contains the encryption information for the database, such as
4296    /// all Cloud KMS key versions that are in use. The `encryption_status' field
4297    /// inside of each `EncryptionInfo` is not populated.
4298    ///
4299    /// For databases that are using Google default or other types of encryption,
4300    /// this field is empty.
4301    ///
4302    /// This field is propagated lazily from the backend. There might be a delay
4303    /// from when a key version is being used and when it appears in this field.
4304    pub encryption_info: std::vec::Vec<crate::model::EncryptionInfo>,
4305
4306    /// Output only. The period in which Cloud Spanner retains all versions of data
4307    /// for the database. This is the same as the value of version_retention_period
4308    /// database option set using
4309    /// [UpdateDatabaseDdl][google.spanner.admin.database.v1.DatabaseAdmin.UpdateDatabaseDdl].
4310    /// Defaults to 1 hour, if not set.
4311    ///
4312    /// [google.spanner.admin.database.v1.DatabaseAdmin.UpdateDatabaseDdl]: crate::client::DatabaseAdmin::update_database_ddl
4313    pub version_retention_period: std::string::String,
4314
4315    /// Output only. Earliest timestamp at which older versions of the data can be
4316    /// read. This value is continuously updated by Cloud Spanner and becomes stale
4317    /// the moment it is queried. If you are using this value to recover data, make
4318    /// sure to account for the time from the moment when the value is queried to
4319    /// the moment when you initiate the recovery.
4320    pub earliest_version_time: std::option::Option<wkt::Timestamp>,
4321
4322    /// Output only. The read-write region which contains the database's leader
4323    /// replicas.
4324    ///
4325    /// This is the same as the value of default_leader
4326    /// database option set using DatabaseAdmin.CreateDatabase or
4327    /// DatabaseAdmin.UpdateDatabaseDdl. If not explicitly set, this is empty.
4328    pub default_leader: std::string::String,
4329
4330    /// Output only. The dialect of the Cloud Spanner Database.
4331    pub database_dialect: crate::model::DatabaseDialect,
4332
4333    /// Whether drop protection is enabled for this database. Defaults to false,
4334    /// if not set. For more details, please see how to [prevent accidental
4335    /// database
4336    /// deletion](https://cloud.google.com/spanner/docs/prevent-database-deletion).
4337    pub enable_drop_protection: bool,
4338
4339    /// Output only. If true, the database is being updated. If false, there are no
4340    /// ongoing update operations for the database.
4341    pub reconciling: bool,
4342
4343    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4344}
4345
4346impl Database {
4347    /// Creates a new default instance.
4348    pub fn new() -> Self {
4349        std::default::Default::default()
4350    }
4351
4352    /// Sets the value of [name][crate::model::Database::name].
4353    ///
4354    /// # Example
4355    /// ```ignore,no_run
4356    /// # use google_cloud_spanner_admin_database_v1::model::Database;
4357    /// # let project_id = "project_id";
4358    /// # let instance_id = "instance_id";
4359    /// # let database_id = "database_id";
4360    /// let x = Database::new().set_name(format!("projects/{project_id}/instances/{instance_id}/databases/{database_id}"));
4361    /// ```
4362    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4363        self.name = v.into();
4364        self
4365    }
4366
4367    /// Sets the value of [state][crate::model::Database::state].
4368    ///
4369    /// # Example
4370    /// ```ignore,no_run
4371    /// # use google_cloud_spanner_admin_database_v1::model::Database;
4372    /// use google_cloud_spanner_admin_database_v1::model::database::State;
4373    /// let x0 = Database::new().set_state(State::Creating);
4374    /// let x1 = Database::new().set_state(State::Ready);
4375    /// let x2 = Database::new().set_state(State::ReadyOptimizing);
4376    /// ```
4377    pub fn set_state<T: std::convert::Into<crate::model::database::State>>(mut self, v: T) -> Self {
4378        self.state = v.into();
4379        self
4380    }
4381
4382    /// Sets the value of [create_time][crate::model::Database::create_time].
4383    ///
4384    /// # Example
4385    /// ```ignore,no_run
4386    /// # use google_cloud_spanner_admin_database_v1::model::Database;
4387    /// use wkt::Timestamp;
4388    /// let x = Database::new().set_create_time(Timestamp::default()/* use setters */);
4389    /// ```
4390    pub fn set_create_time<T>(mut self, v: T) -> Self
4391    where
4392        T: std::convert::Into<wkt::Timestamp>,
4393    {
4394        self.create_time = std::option::Option::Some(v.into());
4395        self
4396    }
4397
4398    /// Sets or clears the value of [create_time][crate::model::Database::create_time].
4399    ///
4400    /// # Example
4401    /// ```ignore,no_run
4402    /// # use google_cloud_spanner_admin_database_v1::model::Database;
4403    /// use wkt::Timestamp;
4404    /// let x = Database::new().set_or_clear_create_time(Some(Timestamp::default()/* use setters */));
4405    /// let x = Database::new().set_or_clear_create_time(None::<Timestamp>);
4406    /// ```
4407    pub fn set_or_clear_create_time<T>(mut self, v: std::option::Option<T>) -> Self
4408    where
4409        T: std::convert::Into<wkt::Timestamp>,
4410    {
4411        self.create_time = v.map(|x| x.into());
4412        self
4413    }
4414
4415    /// Sets the value of [restore_info][crate::model::Database::restore_info].
4416    ///
4417    /// # Example
4418    /// ```ignore,no_run
4419    /// # use google_cloud_spanner_admin_database_v1::model::Database;
4420    /// use google_cloud_spanner_admin_database_v1::model::RestoreInfo;
4421    /// let x = Database::new().set_restore_info(RestoreInfo::default()/* use setters */);
4422    /// ```
4423    pub fn set_restore_info<T>(mut self, v: T) -> Self
4424    where
4425        T: std::convert::Into<crate::model::RestoreInfo>,
4426    {
4427        self.restore_info = std::option::Option::Some(v.into());
4428        self
4429    }
4430
4431    /// Sets or clears the value of [restore_info][crate::model::Database::restore_info].
4432    ///
4433    /// # Example
4434    /// ```ignore,no_run
4435    /// # use google_cloud_spanner_admin_database_v1::model::Database;
4436    /// use google_cloud_spanner_admin_database_v1::model::RestoreInfo;
4437    /// let x = Database::new().set_or_clear_restore_info(Some(RestoreInfo::default()/* use setters */));
4438    /// let x = Database::new().set_or_clear_restore_info(None::<RestoreInfo>);
4439    /// ```
4440    pub fn set_or_clear_restore_info<T>(mut self, v: std::option::Option<T>) -> Self
4441    where
4442        T: std::convert::Into<crate::model::RestoreInfo>,
4443    {
4444        self.restore_info = v.map(|x| x.into());
4445        self
4446    }
4447
4448    /// Sets the value of [encryption_config][crate::model::Database::encryption_config].
4449    ///
4450    /// # Example
4451    /// ```ignore,no_run
4452    /// # use google_cloud_spanner_admin_database_v1::model::Database;
4453    /// use google_cloud_spanner_admin_database_v1::model::EncryptionConfig;
4454    /// let x = Database::new().set_encryption_config(EncryptionConfig::default()/* use setters */);
4455    /// ```
4456    pub fn set_encryption_config<T>(mut self, v: T) -> Self
4457    where
4458        T: std::convert::Into<crate::model::EncryptionConfig>,
4459    {
4460        self.encryption_config = std::option::Option::Some(v.into());
4461        self
4462    }
4463
4464    /// Sets or clears the value of [encryption_config][crate::model::Database::encryption_config].
4465    ///
4466    /// # Example
4467    /// ```ignore,no_run
4468    /// # use google_cloud_spanner_admin_database_v1::model::Database;
4469    /// use google_cloud_spanner_admin_database_v1::model::EncryptionConfig;
4470    /// let x = Database::new().set_or_clear_encryption_config(Some(EncryptionConfig::default()/* use setters */));
4471    /// let x = Database::new().set_or_clear_encryption_config(None::<EncryptionConfig>);
4472    /// ```
4473    pub fn set_or_clear_encryption_config<T>(mut self, v: std::option::Option<T>) -> Self
4474    where
4475        T: std::convert::Into<crate::model::EncryptionConfig>,
4476    {
4477        self.encryption_config = v.map(|x| x.into());
4478        self
4479    }
4480
4481    /// Sets the value of [encryption_info][crate::model::Database::encryption_info].
4482    ///
4483    /// # Example
4484    /// ```ignore,no_run
4485    /// # use google_cloud_spanner_admin_database_v1::model::Database;
4486    /// use google_cloud_spanner_admin_database_v1::model::EncryptionInfo;
4487    /// let x = Database::new()
4488    ///     .set_encryption_info([
4489    ///         EncryptionInfo::default()/* use setters */,
4490    ///         EncryptionInfo::default()/* use (different) setters */,
4491    ///     ]);
4492    /// ```
4493    pub fn set_encryption_info<T, V>(mut self, v: T) -> Self
4494    where
4495        T: std::iter::IntoIterator<Item = V>,
4496        V: std::convert::Into<crate::model::EncryptionInfo>,
4497    {
4498        use std::iter::Iterator;
4499        self.encryption_info = v.into_iter().map(|i| i.into()).collect();
4500        self
4501    }
4502
4503    /// Sets the value of [version_retention_period][crate::model::Database::version_retention_period].
4504    ///
4505    /// # Example
4506    /// ```ignore,no_run
4507    /// # use google_cloud_spanner_admin_database_v1::model::Database;
4508    /// let x = Database::new().set_version_retention_period("example");
4509    /// ```
4510    pub fn set_version_retention_period<T: std::convert::Into<std::string::String>>(
4511        mut self,
4512        v: T,
4513    ) -> Self {
4514        self.version_retention_period = v.into();
4515        self
4516    }
4517
4518    /// Sets the value of [earliest_version_time][crate::model::Database::earliest_version_time].
4519    ///
4520    /// # Example
4521    /// ```ignore,no_run
4522    /// # use google_cloud_spanner_admin_database_v1::model::Database;
4523    /// use wkt::Timestamp;
4524    /// let x = Database::new().set_earliest_version_time(Timestamp::default()/* use setters */);
4525    /// ```
4526    pub fn set_earliest_version_time<T>(mut self, v: T) -> Self
4527    where
4528        T: std::convert::Into<wkt::Timestamp>,
4529    {
4530        self.earliest_version_time = std::option::Option::Some(v.into());
4531        self
4532    }
4533
4534    /// Sets or clears the value of [earliest_version_time][crate::model::Database::earliest_version_time].
4535    ///
4536    /// # Example
4537    /// ```ignore,no_run
4538    /// # use google_cloud_spanner_admin_database_v1::model::Database;
4539    /// use wkt::Timestamp;
4540    /// let x = Database::new().set_or_clear_earliest_version_time(Some(Timestamp::default()/* use setters */));
4541    /// let x = Database::new().set_or_clear_earliest_version_time(None::<Timestamp>);
4542    /// ```
4543    pub fn set_or_clear_earliest_version_time<T>(mut self, v: std::option::Option<T>) -> Self
4544    where
4545        T: std::convert::Into<wkt::Timestamp>,
4546    {
4547        self.earliest_version_time = v.map(|x| x.into());
4548        self
4549    }
4550
4551    /// Sets the value of [default_leader][crate::model::Database::default_leader].
4552    ///
4553    /// # Example
4554    /// ```ignore,no_run
4555    /// # use google_cloud_spanner_admin_database_v1::model::Database;
4556    /// let x = Database::new().set_default_leader("example");
4557    /// ```
4558    pub fn set_default_leader<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4559        self.default_leader = v.into();
4560        self
4561    }
4562
4563    /// Sets the value of [database_dialect][crate::model::Database::database_dialect].
4564    ///
4565    /// # Example
4566    /// ```ignore,no_run
4567    /// # use google_cloud_spanner_admin_database_v1::model::Database;
4568    /// use google_cloud_spanner_admin_database_v1::model::DatabaseDialect;
4569    /// let x0 = Database::new().set_database_dialect(DatabaseDialect::GoogleStandardSql);
4570    /// let x1 = Database::new().set_database_dialect(DatabaseDialect::Postgresql);
4571    /// ```
4572    pub fn set_database_dialect<T: std::convert::Into<crate::model::DatabaseDialect>>(
4573        mut self,
4574        v: T,
4575    ) -> Self {
4576        self.database_dialect = v.into();
4577        self
4578    }
4579
4580    /// Sets the value of [enable_drop_protection][crate::model::Database::enable_drop_protection].
4581    ///
4582    /// # Example
4583    /// ```ignore,no_run
4584    /// # use google_cloud_spanner_admin_database_v1::model::Database;
4585    /// let x = Database::new().set_enable_drop_protection(true);
4586    /// ```
4587    pub fn set_enable_drop_protection<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
4588        self.enable_drop_protection = v.into();
4589        self
4590    }
4591
4592    /// Sets the value of [reconciling][crate::model::Database::reconciling].
4593    ///
4594    /// # Example
4595    /// ```ignore,no_run
4596    /// # use google_cloud_spanner_admin_database_v1::model::Database;
4597    /// let x = Database::new().set_reconciling(true);
4598    /// ```
4599    pub fn set_reconciling<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
4600        self.reconciling = v.into();
4601        self
4602    }
4603}
4604
4605impl wkt::message::Message for Database {
4606    fn typename() -> &'static str {
4607        "type.googleapis.com/google.spanner.admin.database.v1.Database"
4608    }
4609}
4610
4611/// Defines additional types related to [Database].
4612pub mod database {
4613    #[allow(unused_imports)]
4614    use super::*;
4615
4616    /// Indicates the current state of the database.
4617    ///
4618    /// # Working with unknown values
4619    ///
4620    /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
4621    /// additional enum variants at any time. Adding new variants is not considered
4622    /// a breaking change. Applications should write their code in anticipation of:
4623    ///
4624    /// - New values appearing in future releases of the client library, **and**
4625    /// - New values received dynamically, without application changes.
4626    ///
4627    /// Please consult the [Working with enums] section in the user guide for some
4628    /// guidelines.
4629    ///
4630    /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
4631    #[derive(Clone, Debug, PartialEq)]
4632    #[non_exhaustive]
4633    pub enum State {
4634        /// Not specified.
4635        Unspecified,
4636        /// The database is still being created. Operations on the database may fail
4637        /// with `FAILED_PRECONDITION` in this state.
4638        Creating,
4639        /// The database is fully created and ready for use.
4640        Ready,
4641        /// The database is fully created and ready for use, but is still
4642        /// being optimized for performance and cannot handle full load.
4643        ///
4644        /// In this state, the database still references the backup
4645        /// it was restore from, preventing the backup
4646        /// from being deleted. When optimizations are complete, the full performance
4647        /// of the database will be restored, and the database will transition to
4648        /// `READY` state.
4649        ReadyOptimizing,
4650        /// If set, the enum was initialized with an unknown value.
4651        ///
4652        /// Applications can examine the value using [State::value] or
4653        /// [State::name].
4654        UnknownValue(state::UnknownValue),
4655    }
4656
4657    #[doc(hidden)]
4658    pub mod state {
4659        #[allow(unused_imports)]
4660        use super::*;
4661        #[derive(Clone, Debug, PartialEq)]
4662        pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
4663    }
4664
4665    impl State {
4666        /// Gets the enum value.
4667        ///
4668        /// Returns `None` if the enum contains an unknown value deserialized from
4669        /// the string representation of enums.
4670        pub fn value(&self) -> std::option::Option<i32> {
4671            match self {
4672                Self::Unspecified => std::option::Option::Some(0),
4673                Self::Creating => std::option::Option::Some(1),
4674                Self::Ready => std::option::Option::Some(2),
4675                Self::ReadyOptimizing => std::option::Option::Some(3),
4676                Self::UnknownValue(u) => u.0.value(),
4677            }
4678        }
4679
4680        /// Gets the enum value as a string.
4681        ///
4682        /// Returns `None` if the enum contains an unknown value deserialized from
4683        /// the integer representation of enums.
4684        pub fn name(&self) -> std::option::Option<&str> {
4685            match self {
4686                Self::Unspecified => std::option::Option::Some("STATE_UNSPECIFIED"),
4687                Self::Creating => std::option::Option::Some("CREATING"),
4688                Self::Ready => std::option::Option::Some("READY"),
4689                Self::ReadyOptimizing => std::option::Option::Some("READY_OPTIMIZING"),
4690                Self::UnknownValue(u) => u.0.name(),
4691            }
4692        }
4693    }
4694
4695    impl std::default::Default for State {
4696        fn default() -> Self {
4697            use std::convert::From;
4698            Self::from(0)
4699        }
4700    }
4701
4702    impl std::fmt::Display for State {
4703        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
4704            wkt::internal::display_enum(f, self.name(), self.value())
4705        }
4706    }
4707
4708    impl std::convert::From<i32> for State {
4709        fn from(value: i32) -> Self {
4710            match value {
4711                0 => Self::Unspecified,
4712                1 => Self::Creating,
4713                2 => Self::Ready,
4714                3 => Self::ReadyOptimizing,
4715                _ => Self::UnknownValue(state::UnknownValue(
4716                    wkt::internal::UnknownEnumValue::Integer(value),
4717                )),
4718            }
4719        }
4720    }
4721
4722    impl std::convert::From<&str> for State {
4723        fn from(value: &str) -> Self {
4724            use std::string::ToString;
4725            match value {
4726                "STATE_UNSPECIFIED" => Self::Unspecified,
4727                "CREATING" => Self::Creating,
4728                "READY" => Self::Ready,
4729                "READY_OPTIMIZING" => Self::ReadyOptimizing,
4730                _ => Self::UnknownValue(state::UnknownValue(
4731                    wkt::internal::UnknownEnumValue::String(value.to_string()),
4732                )),
4733            }
4734        }
4735    }
4736
4737    impl serde::ser::Serialize for State {
4738        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
4739        where
4740            S: serde::Serializer,
4741        {
4742            match self {
4743                Self::Unspecified => serializer.serialize_i32(0),
4744                Self::Creating => serializer.serialize_i32(1),
4745                Self::Ready => serializer.serialize_i32(2),
4746                Self::ReadyOptimizing => serializer.serialize_i32(3),
4747                Self::UnknownValue(u) => u.0.serialize(serializer),
4748            }
4749        }
4750    }
4751
4752    impl<'de> serde::de::Deserialize<'de> for State {
4753        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
4754        where
4755            D: serde::Deserializer<'de>,
4756        {
4757            deserializer.deserialize_any(wkt::internal::EnumVisitor::<State>::new(
4758                ".google.spanner.admin.database.v1.Database.State",
4759            ))
4760        }
4761    }
4762}
4763
4764/// The request for
4765/// [ListDatabases][google.spanner.admin.database.v1.DatabaseAdmin.ListDatabases].
4766///
4767/// [google.spanner.admin.database.v1.DatabaseAdmin.ListDatabases]: crate::client::DatabaseAdmin::list_databases
4768#[derive(Clone, Default, PartialEq)]
4769#[non_exhaustive]
4770pub struct ListDatabasesRequest {
4771    /// Required. The instance whose databases should be listed.
4772    /// Values are of the form `projects/<project>/instances/<instance>`.
4773    pub parent: std::string::String,
4774
4775    /// Number of databases to be returned in the response. If 0 or less,
4776    /// defaults to the server's maximum allowed page size.
4777    pub page_size: i32,
4778
4779    /// If non-empty, `page_token` should contain a
4780    /// [next_page_token][google.spanner.admin.database.v1.ListDatabasesResponse.next_page_token]
4781    /// from a previous
4782    /// [ListDatabasesResponse][google.spanner.admin.database.v1.ListDatabasesResponse].
4783    ///
4784    /// [google.spanner.admin.database.v1.ListDatabasesResponse]: crate::model::ListDatabasesResponse
4785    /// [google.spanner.admin.database.v1.ListDatabasesResponse.next_page_token]: crate::model::ListDatabasesResponse::next_page_token
4786    pub page_token: std::string::String,
4787
4788    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4789}
4790
4791impl ListDatabasesRequest {
4792    /// Creates a new default instance.
4793    pub fn new() -> Self {
4794        std::default::Default::default()
4795    }
4796
4797    /// Sets the value of [parent][crate::model::ListDatabasesRequest::parent].
4798    ///
4799    /// # Example
4800    /// ```ignore,no_run
4801    /// # use google_cloud_spanner_admin_database_v1::model::ListDatabasesRequest;
4802    /// let x = ListDatabasesRequest::new().set_parent("example");
4803    /// ```
4804    pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4805        self.parent = v.into();
4806        self
4807    }
4808
4809    /// Sets the value of [page_size][crate::model::ListDatabasesRequest::page_size].
4810    ///
4811    /// # Example
4812    /// ```ignore,no_run
4813    /// # use google_cloud_spanner_admin_database_v1::model::ListDatabasesRequest;
4814    /// let x = ListDatabasesRequest::new().set_page_size(42);
4815    /// ```
4816    pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
4817        self.page_size = v.into();
4818        self
4819    }
4820
4821    /// Sets the value of [page_token][crate::model::ListDatabasesRequest::page_token].
4822    ///
4823    /// # Example
4824    /// ```ignore,no_run
4825    /// # use google_cloud_spanner_admin_database_v1::model::ListDatabasesRequest;
4826    /// let x = ListDatabasesRequest::new().set_page_token("example");
4827    /// ```
4828    pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4829        self.page_token = v.into();
4830        self
4831    }
4832}
4833
4834impl wkt::message::Message for ListDatabasesRequest {
4835    fn typename() -> &'static str {
4836        "type.googleapis.com/google.spanner.admin.database.v1.ListDatabasesRequest"
4837    }
4838}
4839
4840/// The response for
4841/// [ListDatabases][google.spanner.admin.database.v1.DatabaseAdmin.ListDatabases].
4842///
4843/// [google.spanner.admin.database.v1.DatabaseAdmin.ListDatabases]: crate::client::DatabaseAdmin::list_databases
4844#[derive(Clone, Default, PartialEq)]
4845#[non_exhaustive]
4846pub struct ListDatabasesResponse {
4847    /// Databases that matched the request.
4848    pub databases: std::vec::Vec<crate::model::Database>,
4849
4850    /// `next_page_token` can be sent in a subsequent
4851    /// [ListDatabases][google.spanner.admin.database.v1.DatabaseAdmin.ListDatabases]
4852    /// call to fetch more of the matching databases.
4853    ///
4854    /// [google.spanner.admin.database.v1.DatabaseAdmin.ListDatabases]: crate::client::DatabaseAdmin::list_databases
4855    pub next_page_token: std::string::String,
4856
4857    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4858}
4859
4860impl ListDatabasesResponse {
4861    /// Creates a new default instance.
4862    pub fn new() -> Self {
4863        std::default::Default::default()
4864    }
4865
4866    /// Sets the value of [databases][crate::model::ListDatabasesResponse::databases].
4867    ///
4868    /// # Example
4869    /// ```ignore,no_run
4870    /// # use google_cloud_spanner_admin_database_v1::model::ListDatabasesResponse;
4871    /// use google_cloud_spanner_admin_database_v1::model::Database;
4872    /// let x = ListDatabasesResponse::new()
4873    ///     .set_databases([
4874    ///         Database::default()/* use setters */,
4875    ///         Database::default()/* use (different) setters */,
4876    ///     ]);
4877    /// ```
4878    pub fn set_databases<T, V>(mut self, v: T) -> Self
4879    where
4880        T: std::iter::IntoIterator<Item = V>,
4881        V: std::convert::Into<crate::model::Database>,
4882    {
4883        use std::iter::Iterator;
4884        self.databases = v.into_iter().map(|i| i.into()).collect();
4885        self
4886    }
4887
4888    /// Sets the value of [next_page_token][crate::model::ListDatabasesResponse::next_page_token].
4889    ///
4890    /// # Example
4891    /// ```ignore,no_run
4892    /// # use google_cloud_spanner_admin_database_v1::model::ListDatabasesResponse;
4893    /// let x = ListDatabasesResponse::new().set_next_page_token("example");
4894    /// ```
4895    pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4896        self.next_page_token = v.into();
4897        self
4898    }
4899}
4900
4901impl wkt::message::Message for ListDatabasesResponse {
4902    fn typename() -> &'static str {
4903        "type.googleapis.com/google.spanner.admin.database.v1.ListDatabasesResponse"
4904    }
4905}
4906
4907#[doc(hidden)]
4908impl google_cloud_gax::paginator::internal::PageableResponse for ListDatabasesResponse {
4909    type PageItem = crate::model::Database;
4910
4911    fn items(self) -> std::vec::Vec<Self::PageItem> {
4912        self.databases
4913    }
4914
4915    fn next_page_token(&self) -> std::string::String {
4916        use std::clone::Clone;
4917        self.next_page_token.clone()
4918    }
4919}
4920
4921/// The request for
4922/// [CreateDatabase][google.spanner.admin.database.v1.DatabaseAdmin.CreateDatabase].
4923///
4924/// [google.spanner.admin.database.v1.DatabaseAdmin.CreateDatabase]: crate::client::DatabaseAdmin::create_database
4925#[derive(Clone, Default, PartialEq)]
4926#[non_exhaustive]
4927pub struct CreateDatabaseRequest {
4928    /// Required. The name of the instance that will serve the new database.
4929    /// Values are of the form `projects/<project>/instances/<instance>`.
4930    pub parent: std::string::String,
4931
4932    /// Required. A `CREATE DATABASE` statement, which specifies the ID of the
4933    /// new database.  The database ID must conform to the regular expression
4934    /// `[a-z][a-z0-9_\-]*[a-z0-9]` and be between 2 and 30 characters in length.
4935    /// If the database ID is a reserved word or if it contains a hyphen, the
4936    /// database ID must be enclosed in backticks (`` ` ``).
4937    pub create_statement: std::string::String,
4938
4939    /// Optional. A list of DDL statements to run inside the newly created
4940    /// database. Statements can create tables, indexes, etc. These
4941    /// statements execute atomically with the creation of the database:
4942    /// if there is an error in any statement, the database is not created.
4943    pub extra_statements: std::vec::Vec<std::string::String>,
4944
4945    /// Optional. The encryption configuration for the database. If this field is
4946    /// not specified, Cloud Spanner will encrypt/decrypt all data at rest using
4947    /// Google default encryption.
4948    pub encryption_config: std::option::Option<crate::model::EncryptionConfig>,
4949
4950    /// Optional. The dialect of the Cloud Spanner Database.
4951    pub database_dialect: crate::model::DatabaseDialect,
4952
4953    /// Optional. Proto descriptors used by CREATE/ALTER PROTO BUNDLE statements in
4954    /// 'extra_statements' above.
4955    /// Contains a protobuf-serialized
4956    /// [google.protobuf.FileDescriptorSet](https://github.com/protocolbuffers/protobuf/blob/main/src/google/protobuf/descriptor.proto).
4957    /// To generate it, [install](https://grpc.io/docs/protoc-installation/) and
4958    /// run `protoc` with --include_imports and --descriptor_set_out. For example,
4959    /// to generate for moon/shot/app.proto, run
4960    ///
4961    /// ```norust
4962    /// $protoc  --proto_path=/app_path --proto_path=/lib_path \
4963    ///          --include_imports \
4964    ///          --descriptor_set_out=descriptors.data \
4965    ///          moon/shot/app.proto
4966    /// ```
4967    ///
4968    /// For more details, see protobuffer [self
4969    /// description](https://developers.google.com/protocol-buffers/docs/techniques#self-description).
4970    pub proto_descriptors: ::bytes::Bytes,
4971
4972    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4973}
4974
4975impl CreateDatabaseRequest {
4976    /// Creates a new default instance.
4977    pub fn new() -> Self {
4978        std::default::Default::default()
4979    }
4980
4981    /// Sets the value of [parent][crate::model::CreateDatabaseRequest::parent].
4982    ///
4983    /// # Example
4984    /// ```ignore,no_run
4985    /// # use google_cloud_spanner_admin_database_v1::model::CreateDatabaseRequest;
4986    /// let x = CreateDatabaseRequest::new().set_parent("example");
4987    /// ```
4988    pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4989        self.parent = v.into();
4990        self
4991    }
4992
4993    /// Sets the value of [create_statement][crate::model::CreateDatabaseRequest::create_statement].
4994    ///
4995    /// # Example
4996    /// ```ignore,no_run
4997    /// # use google_cloud_spanner_admin_database_v1::model::CreateDatabaseRequest;
4998    /// let x = CreateDatabaseRequest::new().set_create_statement("example");
4999    /// ```
5000    pub fn set_create_statement<T: std::convert::Into<std::string::String>>(
5001        mut self,
5002        v: T,
5003    ) -> Self {
5004        self.create_statement = v.into();
5005        self
5006    }
5007
5008    /// Sets the value of [extra_statements][crate::model::CreateDatabaseRequest::extra_statements].
5009    ///
5010    /// # Example
5011    /// ```ignore,no_run
5012    /// # use google_cloud_spanner_admin_database_v1::model::CreateDatabaseRequest;
5013    /// let x = CreateDatabaseRequest::new().set_extra_statements(["a", "b", "c"]);
5014    /// ```
5015    pub fn set_extra_statements<T, V>(mut self, v: T) -> Self
5016    where
5017        T: std::iter::IntoIterator<Item = V>,
5018        V: std::convert::Into<std::string::String>,
5019    {
5020        use std::iter::Iterator;
5021        self.extra_statements = v.into_iter().map(|i| i.into()).collect();
5022        self
5023    }
5024
5025    /// Sets the value of [encryption_config][crate::model::CreateDatabaseRequest::encryption_config].
5026    ///
5027    /// # Example
5028    /// ```ignore,no_run
5029    /// # use google_cloud_spanner_admin_database_v1::model::CreateDatabaseRequest;
5030    /// use google_cloud_spanner_admin_database_v1::model::EncryptionConfig;
5031    /// let x = CreateDatabaseRequest::new().set_encryption_config(EncryptionConfig::default()/* use setters */);
5032    /// ```
5033    pub fn set_encryption_config<T>(mut self, v: T) -> Self
5034    where
5035        T: std::convert::Into<crate::model::EncryptionConfig>,
5036    {
5037        self.encryption_config = std::option::Option::Some(v.into());
5038        self
5039    }
5040
5041    /// Sets or clears the value of [encryption_config][crate::model::CreateDatabaseRequest::encryption_config].
5042    ///
5043    /// # Example
5044    /// ```ignore,no_run
5045    /// # use google_cloud_spanner_admin_database_v1::model::CreateDatabaseRequest;
5046    /// use google_cloud_spanner_admin_database_v1::model::EncryptionConfig;
5047    /// let x = CreateDatabaseRequest::new().set_or_clear_encryption_config(Some(EncryptionConfig::default()/* use setters */));
5048    /// let x = CreateDatabaseRequest::new().set_or_clear_encryption_config(None::<EncryptionConfig>);
5049    /// ```
5050    pub fn set_or_clear_encryption_config<T>(mut self, v: std::option::Option<T>) -> Self
5051    where
5052        T: std::convert::Into<crate::model::EncryptionConfig>,
5053    {
5054        self.encryption_config = v.map(|x| x.into());
5055        self
5056    }
5057
5058    /// Sets the value of [database_dialect][crate::model::CreateDatabaseRequest::database_dialect].
5059    ///
5060    /// # Example
5061    /// ```ignore,no_run
5062    /// # use google_cloud_spanner_admin_database_v1::model::CreateDatabaseRequest;
5063    /// use google_cloud_spanner_admin_database_v1::model::DatabaseDialect;
5064    /// let x0 = CreateDatabaseRequest::new().set_database_dialect(DatabaseDialect::GoogleStandardSql);
5065    /// let x1 = CreateDatabaseRequest::new().set_database_dialect(DatabaseDialect::Postgresql);
5066    /// ```
5067    pub fn set_database_dialect<T: std::convert::Into<crate::model::DatabaseDialect>>(
5068        mut self,
5069        v: T,
5070    ) -> Self {
5071        self.database_dialect = v.into();
5072        self
5073    }
5074
5075    /// Sets the value of [proto_descriptors][crate::model::CreateDatabaseRequest::proto_descriptors].
5076    ///
5077    /// # Example
5078    /// ```ignore,no_run
5079    /// # use google_cloud_spanner_admin_database_v1::model::CreateDatabaseRequest;
5080    /// let x = CreateDatabaseRequest::new().set_proto_descriptors(bytes::Bytes::from_static(b"example"));
5081    /// ```
5082    pub fn set_proto_descriptors<T: std::convert::Into<::bytes::Bytes>>(mut self, v: T) -> Self {
5083        self.proto_descriptors = v.into();
5084        self
5085    }
5086}
5087
5088impl wkt::message::Message for CreateDatabaseRequest {
5089    fn typename() -> &'static str {
5090        "type.googleapis.com/google.spanner.admin.database.v1.CreateDatabaseRequest"
5091    }
5092}
5093
5094/// Metadata type for the operation returned by
5095/// [CreateDatabase][google.spanner.admin.database.v1.DatabaseAdmin.CreateDatabase].
5096///
5097/// [google.spanner.admin.database.v1.DatabaseAdmin.CreateDatabase]: crate::client::DatabaseAdmin::create_database
5098#[derive(Clone, Default, PartialEq)]
5099#[non_exhaustive]
5100pub struct CreateDatabaseMetadata {
5101    /// The database being created.
5102    pub database: std::string::String,
5103
5104    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5105}
5106
5107impl CreateDatabaseMetadata {
5108    /// Creates a new default instance.
5109    pub fn new() -> Self {
5110        std::default::Default::default()
5111    }
5112
5113    /// Sets the value of [database][crate::model::CreateDatabaseMetadata::database].
5114    ///
5115    /// # Example
5116    /// ```ignore,no_run
5117    /// # use google_cloud_spanner_admin_database_v1::model::CreateDatabaseMetadata;
5118    /// # let project_id = "project_id";
5119    /// # let instance_id = "instance_id";
5120    /// # let database_id = "database_id";
5121    /// let x = CreateDatabaseMetadata::new().set_database(format!("projects/{project_id}/instances/{instance_id}/databases/{database_id}"));
5122    /// ```
5123    pub fn set_database<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5124        self.database = v.into();
5125        self
5126    }
5127}
5128
5129impl wkt::message::Message for CreateDatabaseMetadata {
5130    fn typename() -> &'static str {
5131        "type.googleapis.com/google.spanner.admin.database.v1.CreateDatabaseMetadata"
5132    }
5133}
5134
5135/// The request for
5136/// [GetDatabase][google.spanner.admin.database.v1.DatabaseAdmin.GetDatabase].
5137///
5138/// [google.spanner.admin.database.v1.DatabaseAdmin.GetDatabase]: crate::client::DatabaseAdmin::get_database
5139#[derive(Clone, Default, PartialEq)]
5140#[non_exhaustive]
5141pub struct GetDatabaseRequest {
5142    /// Required. The name of the requested database. Values are of the form
5143    /// `projects/<project>/instances/<instance>/databases/<database>`.
5144    pub name: std::string::String,
5145
5146    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5147}
5148
5149impl GetDatabaseRequest {
5150    /// Creates a new default instance.
5151    pub fn new() -> Self {
5152        std::default::Default::default()
5153    }
5154
5155    /// Sets the value of [name][crate::model::GetDatabaseRequest::name].
5156    ///
5157    /// # Example
5158    /// ```ignore,no_run
5159    /// # use google_cloud_spanner_admin_database_v1::model::GetDatabaseRequest;
5160    /// # let project_id = "project_id";
5161    /// # let instance_id = "instance_id";
5162    /// # let database_id = "database_id";
5163    /// let x = GetDatabaseRequest::new().set_name(format!("projects/{project_id}/instances/{instance_id}/databases/{database_id}"));
5164    /// ```
5165    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5166        self.name = v.into();
5167        self
5168    }
5169}
5170
5171impl wkt::message::Message for GetDatabaseRequest {
5172    fn typename() -> &'static str {
5173        "type.googleapis.com/google.spanner.admin.database.v1.GetDatabaseRequest"
5174    }
5175}
5176
5177/// The request for
5178/// [UpdateDatabase][google.spanner.admin.database.v1.DatabaseAdmin.UpdateDatabase].
5179///
5180/// [google.spanner.admin.database.v1.DatabaseAdmin.UpdateDatabase]: crate::client::DatabaseAdmin::update_database
5181#[derive(Clone, Default, PartialEq)]
5182#[non_exhaustive]
5183pub struct UpdateDatabaseRequest {
5184    /// Required. The database to update.
5185    /// The `name` field of the database is of the form
5186    /// `projects/<project>/instances/<instance>/databases/<database>`.
5187    pub database: std::option::Option<crate::model::Database>,
5188
5189    /// Required. The list of fields to update. Currently, only
5190    /// `enable_drop_protection` field can be updated.
5191    pub update_mask: std::option::Option<wkt::FieldMask>,
5192
5193    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5194}
5195
5196impl UpdateDatabaseRequest {
5197    /// Creates a new default instance.
5198    pub fn new() -> Self {
5199        std::default::Default::default()
5200    }
5201
5202    /// Sets the value of [database][crate::model::UpdateDatabaseRequest::database].
5203    ///
5204    /// # Example
5205    /// ```ignore,no_run
5206    /// # use google_cloud_spanner_admin_database_v1::model::UpdateDatabaseRequest;
5207    /// use google_cloud_spanner_admin_database_v1::model::Database;
5208    /// let x = UpdateDatabaseRequest::new().set_database(Database::default()/* use setters */);
5209    /// ```
5210    pub fn set_database<T>(mut self, v: T) -> Self
5211    where
5212        T: std::convert::Into<crate::model::Database>,
5213    {
5214        self.database = std::option::Option::Some(v.into());
5215        self
5216    }
5217
5218    /// Sets or clears the value of [database][crate::model::UpdateDatabaseRequest::database].
5219    ///
5220    /// # Example
5221    /// ```ignore,no_run
5222    /// # use google_cloud_spanner_admin_database_v1::model::UpdateDatabaseRequest;
5223    /// use google_cloud_spanner_admin_database_v1::model::Database;
5224    /// let x = UpdateDatabaseRequest::new().set_or_clear_database(Some(Database::default()/* use setters */));
5225    /// let x = UpdateDatabaseRequest::new().set_or_clear_database(None::<Database>);
5226    /// ```
5227    pub fn set_or_clear_database<T>(mut self, v: std::option::Option<T>) -> Self
5228    where
5229        T: std::convert::Into<crate::model::Database>,
5230    {
5231        self.database = v.map(|x| x.into());
5232        self
5233    }
5234
5235    /// Sets the value of [update_mask][crate::model::UpdateDatabaseRequest::update_mask].
5236    ///
5237    /// # Example
5238    /// ```ignore,no_run
5239    /// # use google_cloud_spanner_admin_database_v1::model::UpdateDatabaseRequest;
5240    /// use wkt::FieldMask;
5241    /// let x = UpdateDatabaseRequest::new().set_update_mask(FieldMask::default()/* use setters */);
5242    /// ```
5243    pub fn set_update_mask<T>(mut self, v: T) -> Self
5244    where
5245        T: std::convert::Into<wkt::FieldMask>,
5246    {
5247        self.update_mask = std::option::Option::Some(v.into());
5248        self
5249    }
5250
5251    /// Sets or clears the value of [update_mask][crate::model::UpdateDatabaseRequest::update_mask].
5252    ///
5253    /// # Example
5254    /// ```ignore,no_run
5255    /// # use google_cloud_spanner_admin_database_v1::model::UpdateDatabaseRequest;
5256    /// use wkt::FieldMask;
5257    /// let x = UpdateDatabaseRequest::new().set_or_clear_update_mask(Some(FieldMask::default()/* use setters */));
5258    /// let x = UpdateDatabaseRequest::new().set_or_clear_update_mask(None::<FieldMask>);
5259    /// ```
5260    pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
5261    where
5262        T: std::convert::Into<wkt::FieldMask>,
5263    {
5264        self.update_mask = v.map(|x| x.into());
5265        self
5266    }
5267}
5268
5269impl wkt::message::Message for UpdateDatabaseRequest {
5270    fn typename() -> &'static str {
5271        "type.googleapis.com/google.spanner.admin.database.v1.UpdateDatabaseRequest"
5272    }
5273}
5274
5275/// Metadata type for the operation returned by
5276/// [UpdateDatabase][google.spanner.admin.database.v1.DatabaseAdmin.UpdateDatabase].
5277///
5278/// [google.spanner.admin.database.v1.DatabaseAdmin.UpdateDatabase]: crate::client::DatabaseAdmin::update_database
5279#[derive(Clone, Default, PartialEq)]
5280#[non_exhaustive]
5281pub struct UpdateDatabaseMetadata {
5282    /// The request for
5283    /// [UpdateDatabase][google.spanner.admin.database.v1.DatabaseAdmin.UpdateDatabase].
5284    ///
5285    /// [google.spanner.admin.database.v1.DatabaseAdmin.UpdateDatabase]: crate::client::DatabaseAdmin::update_database
5286    pub request: std::option::Option<crate::model::UpdateDatabaseRequest>,
5287
5288    /// The progress of the
5289    /// [UpdateDatabase][google.spanner.admin.database.v1.DatabaseAdmin.UpdateDatabase]
5290    /// operation.
5291    ///
5292    /// [google.spanner.admin.database.v1.DatabaseAdmin.UpdateDatabase]: crate::client::DatabaseAdmin::update_database
5293    pub progress: std::option::Option<crate::model::OperationProgress>,
5294
5295    /// The time at which this operation was cancelled. If set, this operation is
5296    /// in the process of undoing itself (which is best-effort).
5297    pub cancel_time: std::option::Option<wkt::Timestamp>,
5298
5299    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5300}
5301
5302impl UpdateDatabaseMetadata {
5303    /// Creates a new default instance.
5304    pub fn new() -> Self {
5305        std::default::Default::default()
5306    }
5307
5308    /// Sets the value of [request][crate::model::UpdateDatabaseMetadata::request].
5309    ///
5310    /// # Example
5311    /// ```ignore,no_run
5312    /// # use google_cloud_spanner_admin_database_v1::model::UpdateDatabaseMetadata;
5313    /// use google_cloud_spanner_admin_database_v1::model::UpdateDatabaseRequest;
5314    /// let x = UpdateDatabaseMetadata::new().set_request(UpdateDatabaseRequest::default()/* use setters */);
5315    /// ```
5316    pub fn set_request<T>(mut self, v: T) -> Self
5317    where
5318        T: std::convert::Into<crate::model::UpdateDatabaseRequest>,
5319    {
5320        self.request = std::option::Option::Some(v.into());
5321        self
5322    }
5323
5324    /// Sets or clears the value of [request][crate::model::UpdateDatabaseMetadata::request].
5325    ///
5326    /// # Example
5327    /// ```ignore,no_run
5328    /// # use google_cloud_spanner_admin_database_v1::model::UpdateDatabaseMetadata;
5329    /// use google_cloud_spanner_admin_database_v1::model::UpdateDatabaseRequest;
5330    /// let x = UpdateDatabaseMetadata::new().set_or_clear_request(Some(UpdateDatabaseRequest::default()/* use setters */));
5331    /// let x = UpdateDatabaseMetadata::new().set_or_clear_request(None::<UpdateDatabaseRequest>);
5332    /// ```
5333    pub fn set_or_clear_request<T>(mut self, v: std::option::Option<T>) -> Self
5334    where
5335        T: std::convert::Into<crate::model::UpdateDatabaseRequest>,
5336    {
5337        self.request = v.map(|x| x.into());
5338        self
5339    }
5340
5341    /// Sets the value of [progress][crate::model::UpdateDatabaseMetadata::progress].
5342    ///
5343    /// # Example
5344    /// ```ignore,no_run
5345    /// # use google_cloud_spanner_admin_database_v1::model::UpdateDatabaseMetadata;
5346    /// use google_cloud_spanner_admin_database_v1::model::OperationProgress;
5347    /// let x = UpdateDatabaseMetadata::new().set_progress(OperationProgress::default()/* use setters */);
5348    /// ```
5349    pub fn set_progress<T>(mut self, v: T) -> Self
5350    where
5351        T: std::convert::Into<crate::model::OperationProgress>,
5352    {
5353        self.progress = std::option::Option::Some(v.into());
5354        self
5355    }
5356
5357    /// Sets or clears the value of [progress][crate::model::UpdateDatabaseMetadata::progress].
5358    ///
5359    /// # Example
5360    /// ```ignore,no_run
5361    /// # use google_cloud_spanner_admin_database_v1::model::UpdateDatabaseMetadata;
5362    /// use google_cloud_spanner_admin_database_v1::model::OperationProgress;
5363    /// let x = UpdateDatabaseMetadata::new().set_or_clear_progress(Some(OperationProgress::default()/* use setters */));
5364    /// let x = UpdateDatabaseMetadata::new().set_or_clear_progress(None::<OperationProgress>);
5365    /// ```
5366    pub fn set_or_clear_progress<T>(mut self, v: std::option::Option<T>) -> Self
5367    where
5368        T: std::convert::Into<crate::model::OperationProgress>,
5369    {
5370        self.progress = v.map(|x| x.into());
5371        self
5372    }
5373
5374    /// Sets the value of [cancel_time][crate::model::UpdateDatabaseMetadata::cancel_time].
5375    ///
5376    /// # Example
5377    /// ```ignore,no_run
5378    /// # use google_cloud_spanner_admin_database_v1::model::UpdateDatabaseMetadata;
5379    /// use wkt::Timestamp;
5380    /// let x = UpdateDatabaseMetadata::new().set_cancel_time(Timestamp::default()/* use setters */);
5381    /// ```
5382    pub fn set_cancel_time<T>(mut self, v: T) -> Self
5383    where
5384        T: std::convert::Into<wkt::Timestamp>,
5385    {
5386        self.cancel_time = std::option::Option::Some(v.into());
5387        self
5388    }
5389
5390    /// Sets or clears the value of [cancel_time][crate::model::UpdateDatabaseMetadata::cancel_time].
5391    ///
5392    /// # Example
5393    /// ```ignore,no_run
5394    /// # use google_cloud_spanner_admin_database_v1::model::UpdateDatabaseMetadata;
5395    /// use wkt::Timestamp;
5396    /// let x = UpdateDatabaseMetadata::new().set_or_clear_cancel_time(Some(Timestamp::default()/* use setters */));
5397    /// let x = UpdateDatabaseMetadata::new().set_or_clear_cancel_time(None::<Timestamp>);
5398    /// ```
5399    pub fn set_or_clear_cancel_time<T>(mut self, v: std::option::Option<T>) -> Self
5400    where
5401        T: std::convert::Into<wkt::Timestamp>,
5402    {
5403        self.cancel_time = v.map(|x| x.into());
5404        self
5405    }
5406}
5407
5408impl wkt::message::Message for UpdateDatabaseMetadata {
5409    fn typename() -> &'static str {
5410        "type.googleapis.com/google.spanner.admin.database.v1.UpdateDatabaseMetadata"
5411    }
5412}
5413
5414/// Enqueues the given DDL statements to be applied, in order but not
5415/// necessarily all at once, to the database schema at some point (or
5416/// points) in the future. The server checks that the statements
5417/// are executable (syntactically valid, name tables that exist, etc.)
5418/// before enqueueing them, but they may still fail upon
5419/// later execution (e.g., if a statement from another batch of
5420/// statements is applied first and it conflicts in some way, or if
5421/// there is some data-related problem like a `NULL` value in a column to
5422/// which `NOT NULL` would be added). If a statement fails, all
5423/// subsequent statements in the batch are automatically cancelled.
5424///
5425/// Each batch of statements is assigned a name which can be used with
5426/// the [Operations][google.longrunning.Operations] API to monitor
5427/// progress. See the
5428/// [operation_id][google.spanner.admin.database.v1.UpdateDatabaseDdlRequest.operation_id]
5429/// field for more details.
5430///
5431/// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
5432/// [google.spanner.admin.database.v1.UpdateDatabaseDdlRequest.operation_id]: crate::model::UpdateDatabaseDdlRequest::operation_id
5433#[derive(Clone, Default, PartialEq)]
5434#[non_exhaustive]
5435pub struct UpdateDatabaseDdlRequest {
5436    /// Required. The database to update.
5437    pub database: std::string::String,
5438
5439    /// Required. DDL statements to be applied to the database.
5440    pub statements: std::vec::Vec<std::string::String>,
5441
5442    /// If empty, the new update request is assigned an
5443    /// automatically-generated operation ID. Otherwise, `operation_id`
5444    /// is used to construct the name of the resulting
5445    /// [Operation][google.longrunning.Operation].
5446    ///
5447    /// Specifying an explicit operation ID simplifies determining
5448    /// whether the statements were executed in the event that the
5449    /// [UpdateDatabaseDdl][google.spanner.admin.database.v1.DatabaseAdmin.UpdateDatabaseDdl]
5450    /// call is replayed, or the return value is otherwise lost: the
5451    /// [database][google.spanner.admin.database.v1.UpdateDatabaseDdlRequest.database]
5452    /// and `operation_id` fields can be combined to form the
5453    /// [name][google.longrunning.Operation.name] of the resulting
5454    /// [longrunning.Operation][google.longrunning.Operation]:
5455    /// `<database>/operations/<operation_id>`.
5456    ///
5457    /// `operation_id` should be unique within the database, and must be
5458    /// a valid identifier: `[a-z][a-z0-9_]*`. Note that
5459    /// automatically-generated operation IDs always begin with an
5460    /// underscore. If the named operation already exists,
5461    /// [UpdateDatabaseDdl][google.spanner.admin.database.v1.DatabaseAdmin.UpdateDatabaseDdl]
5462    /// returns `ALREADY_EXISTS`.
5463    ///
5464    /// [google.longrunning.Operation]: google_cloud_longrunning::model::Operation
5465    /// [google.longrunning.Operation.name]: google_cloud_longrunning::model::Operation::name
5466    /// [google.spanner.admin.database.v1.DatabaseAdmin.UpdateDatabaseDdl]: crate::client::DatabaseAdmin::update_database_ddl
5467    /// [google.spanner.admin.database.v1.UpdateDatabaseDdlRequest.database]: crate::model::UpdateDatabaseDdlRequest::database
5468    pub operation_id: std::string::String,
5469
5470    /// Optional. Proto descriptors used by CREATE/ALTER PROTO BUNDLE statements.
5471    /// Contains a protobuf-serialized
5472    /// [google.protobuf.FileDescriptorSet](https://github.com/protocolbuffers/protobuf/blob/main/src/google/protobuf/descriptor.proto).
5473    /// To generate it, [install](https://grpc.io/docs/protoc-installation/) and
5474    /// run `protoc` with --include_imports and --descriptor_set_out. For example,
5475    /// to generate for moon/shot/app.proto, run
5476    ///
5477    /// ```norust
5478    /// $protoc  --proto_path=/app_path --proto_path=/lib_path \
5479    ///          --include_imports \
5480    ///          --descriptor_set_out=descriptors.data \
5481    ///          moon/shot/app.proto
5482    /// ```
5483    ///
5484    /// For more details, see protobuffer [self
5485    /// description](https://developers.google.com/protocol-buffers/docs/techniques#self-description).
5486    pub proto_descriptors: ::bytes::Bytes,
5487
5488    /// Optional. This field is exposed to be used by the Spanner Migration Tool.
5489    /// For more details, see
5490    /// [SMT](https://github.com/GoogleCloudPlatform/spanner-migration-tool).
5491    pub throughput_mode: bool,
5492
5493    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5494}
5495
5496impl UpdateDatabaseDdlRequest {
5497    /// Creates a new default instance.
5498    pub fn new() -> Self {
5499        std::default::Default::default()
5500    }
5501
5502    /// Sets the value of [database][crate::model::UpdateDatabaseDdlRequest::database].
5503    ///
5504    /// # Example
5505    /// ```ignore,no_run
5506    /// # use google_cloud_spanner_admin_database_v1::model::UpdateDatabaseDdlRequest;
5507    /// # let project_id = "project_id";
5508    /// # let instance_id = "instance_id";
5509    /// # let database_id = "database_id";
5510    /// let x = UpdateDatabaseDdlRequest::new().set_database(format!("projects/{project_id}/instances/{instance_id}/databases/{database_id}"));
5511    /// ```
5512    pub fn set_database<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5513        self.database = v.into();
5514        self
5515    }
5516
5517    /// Sets the value of [statements][crate::model::UpdateDatabaseDdlRequest::statements].
5518    ///
5519    /// # Example
5520    /// ```ignore,no_run
5521    /// # use google_cloud_spanner_admin_database_v1::model::UpdateDatabaseDdlRequest;
5522    /// let x = UpdateDatabaseDdlRequest::new().set_statements(["a", "b", "c"]);
5523    /// ```
5524    pub fn set_statements<T, V>(mut self, v: T) -> Self
5525    where
5526        T: std::iter::IntoIterator<Item = V>,
5527        V: std::convert::Into<std::string::String>,
5528    {
5529        use std::iter::Iterator;
5530        self.statements = v.into_iter().map(|i| i.into()).collect();
5531        self
5532    }
5533
5534    /// Sets the value of [operation_id][crate::model::UpdateDatabaseDdlRequest::operation_id].
5535    ///
5536    /// # Example
5537    /// ```ignore,no_run
5538    /// # use google_cloud_spanner_admin_database_v1::model::UpdateDatabaseDdlRequest;
5539    /// let x = UpdateDatabaseDdlRequest::new().set_operation_id("example");
5540    /// ```
5541    pub fn set_operation_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5542        self.operation_id = v.into();
5543        self
5544    }
5545
5546    /// Sets the value of [proto_descriptors][crate::model::UpdateDatabaseDdlRequest::proto_descriptors].
5547    ///
5548    /// # Example
5549    /// ```ignore,no_run
5550    /// # use google_cloud_spanner_admin_database_v1::model::UpdateDatabaseDdlRequest;
5551    /// let x = UpdateDatabaseDdlRequest::new().set_proto_descriptors(bytes::Bytes::from_static(b"example"));
5552    /// ```
5553    pub fn set_proto_descriptors<T: std::convert::Into<::bytes::Bytes>>(mut self, v: T) -> Self {
5554        self.proto_descriptors = v.into();
5555        self
5556    }
5557
5558    /// Sets the value of [throughput_mode][crate::model::UpdateDatabaseDdlRequest::throughput_mode].
5559    ///
5560    /// # Example
5561    /// ```ignore,no_run
5562    /// # use google_cloud_spanner_admin_database_v1::model::UpdateDatabaseDdlRequest;
5563    /// let x = UpdateDatabaseDdlRequest::new().set_throughput_mode(true);
5564    /// ```
5565    pub fn set_throughput_mode<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
5566        self.throughput_mode = v.into();
5567        self
5568    }
5569}
5570
5571impl wkt::message::Message for UpdateDatabaseDdlRequest {
5572    fn typename() -> &'static str {
5573        "type.googleapis.com/google.spanner.admin.database.v1.UpdateDatabaseDdlRequest"
5574    }
5575}
5576
5577/// Action information extracted from a DDL statement. This proto is used to
5578/// display the brief info of the DDL statement for the operation
5579/// [UpdateDatabaseDdl][google.spanner.admin.database.v1.DatabaseAdmin.UpdateDatabaseDdl].
5580///
5581/// [google.spanner.admin.database.v1.DatabaseAdmin.UpdateDatabaseDdl]: crate::client::DatabaseAdmin::update_database_ddl
5582#[derive(Clone, Default, PartialEq)]
5583#[non_exhaustive]
5584pub struct DdlStatementActionInfo {
5585    /// The action for the DDL statement, e.g. CREATE, ALTER, DROP, GRANT, etc.
5586    /// This field is a non-empty string.
5587    pub action: std::string::String,
5588
5589    /// The entity type for the DDL statement, e.g. TABLE, INDEX, VIEW, etc.
5590    /// This field can be empty string for some DDL statement,
5591    /// e.g. for statement "ANALYZE", `entity_type` = "".
5592    pub entity_type: std::string::String,
5593
5594    /// The entity name(s) being operated on the DDL statement.
5595    /// E.g.
5596    ///
5597    /// 1. For statement "CREATE TABLE t1(...)", `entity_names` = ["t1"].
5598    /// 1. For statement "GRANT ROLE r1, r2 ...", `entity_names` = ["r1", "r2"].
5599    /// 1. For statement "ANALYZE", `entity_names` = [].
5600    pub entity_names: std::vec::Vec<std::string::String>,
5601
5602    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5603}
5604
5605impl DdlStatementActionInfo {
5606    /// Creates a new default instance.
5607    pub fn new() -> Self {
5608        std::default::Default::default()
5609    }
5610
5611    /// Sets the value of [action][crate::model::DdlStatementActionInfo::action].
5612    ///
5613    /// # Example
5614    /// ```ignore,no_run
5615    /// # use google_cloud_spanner_admin_database_v1::model::DdlStatementActionInfo;
5616    /// let x = DdlStatementActionInfo::new().set_action("example");
5617    /// ```
5618    pub fn set_action<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5619        self.action = v.into();
5620        self
5621    }
5622
5623    /// Sets the value of [entity_type][crate::model::DdlStatementActionInfo::entity_type].
5624    ///
5625    /// # Example
5626    /// ```ignore,no_run
5627    /// # use google_cloud_spanner_admin_database_v1::model::DdlStatementActionInfo;
5628    /// let x = DdlStatementActionInfo::new().set_entity_type("example");
5629    /// ```
5630    pub fn set_entity_type<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5631        self.entity_type = v.into();
5632        self
5633    }
5634
5635    /// Sets the value of [entity_names][crate::model::DdlStatementActionInfo::entity_names].
5636    ///
5637    /// # Example
5638    /// ```ignore,no_run
5639    /// # use google_cloud_spanner_admin_database_v1::model::DdlStatementActionInfo;
5640    /// let x = DdlStatementActionInfo::new().set_entity_names(["a", "b", "c"]);
5641    /// ```
5642    pub fn set_entity_names<T, V>(mut self, v: T) -> Self
5643    where
5644        T: std::iter::IntoIterator<Item = V>,
5645        V: std::convert::Into<std::string::String>,
5646    {
5647        use std::iter::Iterator;
5648        self.entity_names = v.into_iter().map(|i| i.into()).collect();
5649        self
5650    }
5651}
5652
5653impl wkt::message::Message for DdlStatementActionInfo {
5654    fn typename() -> &'static str {
5655        "type.googleapis.com/google.spanner.admin.database.v1.DdlStatementActionInfo"
5656    }
5657}
5658
5659/// Metadata type for the operation returned by
5660/// [UpdateDatabaseDdl][google.spanner.admin.database.v1.DatabaseAdmin.UpdateDatabaseDdl].
5661///
5662/// [google.spanner.admin.database.v1.DatabaseAdmin.UpdateDatabaseDdl]: crate::client::DatabaseAdmin::update_database_ddl
5663#[derive(Clone, Default, PartialEq)]
5664#[non_exhaustive]
5665pub struct UpdateDatabaseDdlMetadata {
5666    /// The database being modified.
5667    pub database: std::string::String,
5668
5669    /// For an update this list contains all the statements. For an
5670    /// individual statement, this list contains only that statement.
5671    pub statements: std::vec::Vec<std::string::String>,
5672
5673    /// Reports the commit timestamps of all statements that have
5674    /// succeeded so far, where `commit_timestamps[i]` is the commit
5675    /// timestamp for the statement `statements[i]`.
5676    pub commit_timestamps: std::vec::Vec<wkt::Timestamp>,
5677
5678    /// Output only. When true, indicates that the operation is throttled e.g.
5679    /// due to resource constraints. When resources become available the operation
5680    /// will resume and this field will be false again.
5681    pub throttled: bool,
5682
5683    /// The progress of the
5684    /// [UpdateDatabaseDdl][google.spanner.admin.database.v1.DatabaseAdmin.UpdateDatabaseDdl]
5685    /// operations. All DDL statements will have continuously updating progress,
5686    /// and `progress[i]` is the operation progress for `statements[i]`. Also,
5687    /// `progress[i]` will have start time and end time populated with commit
5688    /// timestamp of operation, as well as a progress of 100% once the operation
5689    /// has completed.
5690    ///
5691    /// [google.spanner.admin.database.v1.DatabaseAdmin.UpdateDatabaseDdl]: crate::client::DatabaseAdmin::update_database_ddl
5692    pub progress: std::vec::Vec<crate::model::OperationProgress>,
5693
5694    /// The brief action info for the DDL statements.
5695    /// `actions[i]` is the brief info for `statements[i]`.
5696    pub actions: std::vec::Vec<crate::model::DdlStatementActionInfo>,
5697
5698    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5699}
5700
5701impl UpdateDatabaseDdlMetadata {
5702    /// Creates a new default instance.
5703    pub fn new() -> Self {
5704        std::default::Default::default()
5705    }
5706
5707    /// Sets the value of [database][crate::model::UpdateDatabaseDdlMetadata::database].
5708    ///
5709    /// # Example
5710    /// ```ignore,no_run
5711    /// # use google_cloud_spanner_admin_database_v1::model::UpdateDatabaseDdlMetadata;
5712    /// # let project_id = "project_id";
5713    /// # let instance_id = "instance_id";
5714    /// # let database_id = "database_id";
5715    /// let x = UpdateDatabaseDdlMetadata::new().set_database(format!("projects/{project_id}/instances/{instance_id}/databases/{database_id}"));
5716    /// ```
5717    pub fn set_database<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5718        self.database = v.into();
5719        self
5720    }
5721
5722    /// Sets the value of [statements][crate::model::UpdateDatabaseDdlMetadata::statements].
5723    ///
5724    /// # Example
5725    /// ```ignore,no_run
5726    /// # use google_cloud_spanner_admin_database_v1::model::UpdateDatabaseDdlMetadata;
5727    /// let x = UpdateDatabaseDdlMetadata::new().set_statements(["a", "b", "c"]);
5728    /// ```
5729    pub fn set_statements<T, V>(mut self, v: T) -> Self
5730    where
5731        T: std::iter::IntoIterator<Item = V>,
5732        V: std::convert::Into<std::string::String>,
5733    {
5734        use std::iter::Iterator;
5735        self.statements = v.into_iter().map(|i| i.into()).collect();
5736        self
5737    }
5738
5739    /// Sets the value of [commit_timestamps][crate::model::UpdateDatabaseDdlMetadata::commit_timestamps].
5740    ///
5741    /// # Example
5742    /// ```ignore,no_run
5743    /// # use google_cloud_spanner_admin_database_v1::model::UpdateDatabaseDdlMetadata;
5744    /// use wkt::Timestamp;
5745    /// let x = UpdateDatabaseDdlMetadata::new()
5746    ///     .set_commit_timestamps([
5747    ///         Timestamp::default()/* use setters */,
5748    ///         Timestamp::default()/* use (different) setters */,
5749    ///     ]);
5750    /// ```
5751    pub fn set_commit_timestamps<T, V>(mut self, v: T) -> Self
5752    where
5753        T: std::iter::IntoIterator<Item = V>,
5754        V: std::convert::Into<wkt::Timestamp>,
5755    {
5756        use std::iter::Iterator;
5757        self.commit_timestamps = v.into_iter().map(|i| i.into()).collect();
5758        self
5759    }
5760
5761    /// Sets the value of [throttled][crate::model::UpdateDatabaseDdlMetadata::throttled].
5762    ///
5763    /// # Example
5764    /// ```ignore,no_run
5765    /// # use google_cloud_spanner_admin_database_v1::model::UpdateDatabaseDdlMetadata;
5766    /// let x = UpdateDatabaseDdlMetadata::new().set_throttled(true);
5767    /// ```
5768    pub fn set_throttled<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
5769        self.throttled = v.into();
5770        self
5771    }
5772
5773    /// Sets the value of [progress][crate::model::UpdateDatabaseDdlMetadata::progress].
5774    ///
5775    /// # Example
5776    /// ```ignore,no_run
5777    /// # use google_cloud_spanner_admin_database_v1::model::UpdateDatabaseDdlMetadata;
5778    /// use google_cloud_spanner_admin_database_v1::model::OperationProgress;
5779    /// let x = UpdateDatabaseDdlMetadata::new()
5780    ///     .set_progress([
5781    ///         OperationProgress::default()/* use setters */,
5782    ///         OperationProgress::default()/* use (different) setters */,
5783    ///     ]);
5784    /// ```
5785    pub fn set_progress<T, V>(mut self, v: T) -> Self
5786    where
5787        T: std::iter::IntoIterator<Item = V>,
5788        V: std::convert::Into<crate::model::OperationProgress>,
5789    {
5790        use std::iter::Iterator;
5791        self.progress = v.into_iter().map(|i| i.into()).collect();
5792        self
5793    }
5794
5795    /// Sets the value of [actions][crate::model::UpdateDatabaseDdlMetadata::actions].
5796    ///
5797    /// # Example
5798    /// ```ignore,no_run
5799    /// # use google_cloud_spanner_admin_database_v1::model::UpdateDatabaseDdlMetadata;
5800    /// use google_cloud_spanner_admin_database_v1::model::DdlStatementActionInfo;
5801    /// let x = UpdateDatabaseDdlMetadata::new()
5802    ///     .set_actions([
5803    ///         DdlStatementActionInfo::default()/* use setters */,
5804    ///         DdlStatementActionInfo::default()/* use (different) setters */,
5805    ///     ]);
5806    /// ```
5807    pub fn set_actions<T, V>(mut self, v: T) -> Self
5808    where
5809        T: std::iter::IntoIterator<Item = V>,
5810        V: std::convert::Into<crate::model::DdlStatementActionInfo>,
5811    {
5812        use std::iter::Iterator;
5813        self.actions = v.into_iter().map(|i| i.into()).collect();
5814        self
5815    }
5816}
5817
5818impl wkt::message::Message for UpdateDatabaseDdlMetadata {
5819    fn typename() -> &'static str {
5820        "type.googleapis.com/google.spanner.admin.database.v1.UpdateDatabaseDdlMetadata"
5821    }
5822}
5823
5824/// The request for
5825/// [DropDatabase][google.spanner.admin.database.v1.DatabaseAdmin.DropDatabase].
5826///
5827/// [google.spanner.admin.database.v1.DatabaseAdmin.DropDatabase]: crate::client::DatabaseAdmin::drop_database
5828#[derive(Clone, Default, PartialEq)]
5829#[non_exhaustive]
5830pub struct DropDatabaseRequest {
5831    /// Required. The database to be dropped.
5832    pub database: std::string::String,
5833
5834    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5835}
5836
5837impl DropDatabaseRequest {
5838    /// Creates a new default instance.
5839    pub fn new() -> Self {
5840        std::default::Default::default()
5841    }
5842
5843    /// Sets the value of [database][crate::model::DropDatabaseRequest::database].
5844    ///
5845    /// # Example
5846    /// ```ignore,no_run
5847    /// # use google_cloud_spanner_admin_database_v1::model::DropDatabaseRequest;
5848    /// # let project_id = "project_id";
5849    /// # let instance_id = "instance_id";
5850    /// # let database_id = "database_id";
5851    /// let x = DropDatabaseRequest::new().set_database(format!("projects/{project_id}/instances/{instance_id}/databases/{database_id}"));
5852    /// ```
5853    pub fn set_database<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5854        self.database = v.into();
5855        self
5856    }
5857}
5858
5859impl wkt::message::Message for DropDatabaseRequest {
5860    fn typename() -> &'static str {
5861        "type.googleapis.com/google.spanner.admin.database.v1.DropDatabaseRequest"
5862    }
5863}
5864
5865/// The request for
5866/// [GetDatabaseDdl][google.spanner.admin.database.v1.DatabaseAdmin.GetDatabaseDdl].
5867///
5868/// [google.spanner.admin.database.v1.DatabaseAdmin.GetDatabaseDdl]: crate::client::DatabaseAdmin::get_database_ddl
5869#[derive(Clone, Default, PartialEq)]
5870#[non_exhaustive]
5871pub struct GetDatabaseDdlRequest {
5872    /// Required. The database whose schema we wish to get.
5873    /// Values are of the form
5874    /// `projects/<project>/instances/<instance>/databases/<database>`
5875    pub database: std::string::String,
5876
5877    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5878}
5879
5880impl GetDatabaseDdlRequest {
5881    /// Creates a new default instance.
5882    pub fn new() -> Self {
5883        std::default::Default::default()
5884    }
5885
5886    /// Sets the value of [database][crate::model::GetDatabaseDdlRequest::database].
5887    ///
5888    /// # Example
5889    /// ```ignore,no_run
5890    /// # use google_cloud_spanner_admin_database_v1::model::GetDatabaseDdlRequest;
5891    /// # let project_id = "project_id";
5892    /// # let instance_id = "instance_id";
5893    /// # let database_id = "database_id";
5894    /// let x = GetDatabaseDdlRequest::new().set_database(format!("projects/{project_id}/instances/{instance_id}/databases/{database_id}"));
5895    /// ```
5896    pub fn set_database<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5897        self.database = v.into();
5898        self
5899    }
5900}
5901
5902impl wkt::message::Message for GetDatabaseDdlRequest {
5903    fn typename() -> &'static str {
5904        "type.googleapis.com/google.spanner.admin.database.v1.GetDatabaseDdlRequest"
5905    }
5906}
5907
5908/// The response for
5909/// [GetDatabaseDdl][google.spanner.admin.database.v1.DatabaseAdmin.GetDatabaseDdl].
5910///
5911/// [google.spanner.admin.database.v1.DatabaseAdmin.GetDatabaseDdl]: crate::client::DatabaseAdmin::get_database_ddl
5912#[derive(Clone, Default, PartialEq)]
5913#[non_exhaustive]
5914pub struct GetDatabaseDdlResponse {
5915    /// A list of formatted DDL statements defining the schema of the database
5916    /// specified in the request.
5917    pub statements: std::vec::Vec<std::string::String>,
5918
5919    /// Proto descriptors stored in the database.
5920    /// Contains a protobuf-serialized
5921    /// [google.protobuf.FileDescriptorSet](https://github.com/protocolbuffers/protobuf/blob/main/src/google/protobuf/descriptor.proto).
5922    /// For more details, see protobuffer [self
5923    /// description](https://developers.google.com/protocol-buffers/docs/techniques#self-description).
5924    pub proto_descriptors: ::bytes::Bytes,
5925
5926    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5927}
5928
5929impl GetDatabaseDdlResponse {
5930    /// Creates a new default instance.
5931    pub fn new() -> Self {
5932        std::default::Default::default()
5933    }
5934
5935    /// Sets the value of [statements][crate::model::GetDatabaseDdlResponse::statements].
5936    ///
5937    /// # Example
5938    /// ```ignore,no_run
5939    /// # use google_cloud_spanner_admin_database_v1::model::GetDatabaseDdlResponse;
5940    /// let x = GetDatabaseDdlResponse::new().set_statements(["a", "b", "c"]);
5941    /// ```
5942    pub fn set_statements<T, V>(mut self, v: T) -> Self
5943    where
5944        T: std::iter::IntoIterator<Item = V>,
5945        V: std::convert::Into<std::string::String>,
5946    {
5947        use std::iter::Iterator;
5948        self.statements = v.into_iter().map(|i| i.into()).collect();
5949        self
5950    }
5951
5952    /// Sets the value of [proto_descriptors][crate::model::GetDatabaseDdlResponse::proto_descriptors].
5953    ///
5954    /// # Example
5955    /// ```ignore,no_run
5956    /// # use google_cloud_spanner_admin_database_v1::model::GetDatabaseDdlResponse;
5957    /// let x = GetDatabaseDdlResponse::new().set_proto_descriptors(bytes::Bytes::from_static(b"example"));
5958    /// ```
5959    pub fn set_proto_descriptors<T: std::convert::Into<::bytes::Bytes>>(mut self, v: T) -> Self {
5960        self.proto_descriptors = v.into();
5961        self
5962    }
5963}
5964
5965impl wkt::message::Message for GetDatabaseDdlResponse {
5966    fn typename() -> &'static str {
5967        "type.googleapis.com/google.spanner.admin.database.v1.GetDatabaseDdlResponse"
5968    }
5969}
5970
5971/// The request for
5972/// [ListDatabaseOperations][google.spanner.admin.database.v1.DatabaseAdmin.ListDatabaseOperations].
5973///
5974/// [google.spanner.admin.database.v1.DatabaseAdmin.ListDatabaseOperations]: crate::client::DatabaseAdmin::list_database_operations
5975#[derive(Clone, Default, PartialEq)]
5976#[non_exhaustive]
5977pub struct ListDatabaseOperationsRequest {
5978    /// Required. The instance of the database operations.
5979    /// Values are of the form `projects/<project>/instances/<instance>`.
5980    pub parent: std::string::String,
5981
5982    /// An expression that filters the list of returned operations.
5983    ///
5984    /// A filter expression consists of a field name, a
5985    /// comparison operator, and a value for filtering.
5986    /// The value must be a string, a number, or a boolean. The comparison operator
5987    /// must be one of: `<`, `>`, `<=`, `>=`, `!=`, `=`, or `:`.
5988    /// Colon `:` is the contains operator. Filter rules are not case sensitive.
5989    ///
5990    /// The following fields in the [Operation][google.longrunning.Operation]
5991    /// are eligible for filtering:
5992    ///
5993    /// * `name` - The name of the long-running operation
5994    /// * `done` - False if the operation is in progress, else true.
5995    /// * `metadata.@type` - the type of metadata. For example, the type string
5996    ///   for
5997    ///   [RestoreDatabaseMetadata][google.spanner.admin.database.v1.RestoreDatabaseMetadata]
5998    ///   is
5999    ///   `type.googleapis.com/google.spanner.admin.database.v1.RestoreDatabaseMetadata`.
6000    /// * `metadata.<field_name>` - any field in metadata.value.
6001    ///   `metadata.@type` must be specified first, if filtering on metadata
6002    ///   fields.
6003    /// * `error` - Error associated with the long-running operation.
6004    /// * `response.@type` - the type of response.
6005    /// * `response.<field_name>` - any field in response.value.
6006    ///
6007    /// You can combine multiple expressions by enclosing each expression in
6008    /// parentheses. By default, expressions are combined with AND logic. However,
6009    /// you can specify AND, OR, and NOT logic explicitly.
6010    ///
6011    /// Here are a few examples:
6012    ///
6013    /// * `done:true` - The operation is complete.
6014    /// * `(metadata.@type=type.googleapis.com/google.spanner.admin.database.v1.RestoreDatabaseMetadata) AND` \
6015    ///   `(metadata.source_type:BACKUP) AND` \
6016    ///   `(metadata.backup_info.backup:backup_howl) AND` \
6017    ///   `(metadata.name:restored_howl) AND` \
6018    ///   `(metadata.progress.start_time < \"2018-03-28T14:50:00Z\") AND` \
6019    ///   `(error:*)` - Return operations where:
6020    ///   * The operation's metadata type is
6021    ///     [RestoreDatabaseMetadata][google.spanner.admin.database.v1.RestoreDatabaseMetadata].
6022    ///   * The database is restored from a backup.
6023    ///   * The backup name contains "backup_howl".
6024    ///   * The restored database's name contains "restored_howl".
6025    ///   * The operation started before 2018-03-28T14:50:00Z.
6026    ///   * The operation resulted in an error.
6027    ///
6028    /// [google.longrunning.Operation]: google_cloud_longrunning::model::Operation
6029    /// [google.spanner.admin.database.v1.RestoreDatabaseMetadata]: crate::model::RestoreDatabaseMetadata
6030    pub filter: std::string::String,
6031
6032    /// Number of operations to be returned in the response. If 0 or
6033    /// less, defaults to the server's maximum allowed page size.
6034    pub page_size: i32,
6035
6036    /// If non-empty, `page_token` should contain a
6037    /// [next_page_token][google.spanner.admin.database.v1.ListDatabaseOperationsResponse.next_page_token]
6038    /// from a previous
6039    /// [ListDatabaseOperationsResponse][google.spanner.admin.database.v1.ListDatabaseOperationsResponse]
6040    /// to the same `parent` and with the same `filter`.
6041    ///
6042    /// [google.spanner.admin.database.v1.ListDatabaseOperationsResponse]: crate::model::ListDatabaseOperationsResponse
6043    /// [google.spanner.admin.database.v1.ListDatabaseOperationsResponse.next_page_token]: crate::model::ListDatabaseOperationsResponse::next_page_token
6044    pub page_token: std::string::String,
6045
6046    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
6047}
6048
6049impl ListDatabaseOperationsRequest {
6050    /// Creates a new default instance.
6051    pub fn new() -> Self {
6052        std::default::Default::default()
6053    }
6054
6055    /// Sets the value of [parent][crate::model::ListDatabaseOperationsRequest::parent].
6056    ///
6057    /// # Example
6058    /// ```ignore,no_run
6059    /// # use google_cloud_spanner_admin_database_v1::model::ListDatabaseOperationsRequest;
6060    /// let x = ListDatabaseOperationsRequest::new().set_parent("example");
6061    /// ```
6062    pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6063        self.parent = v.into();
6064        self
6065    }
6066
6067    /// Sets the value of [filter][crate::model::ListDatabaseOperationsRequest::filter].
6068    ///
6069    /// # Example
6070    /// ```ignore,no_run
6071    /// # use google_cloud_spanner_admin_database_v1::model::ListDatabaseOperationsRequest;
6072    /// let x = ListDatabaseOperationsRequest::new().set_filter("example");
6073    /// ```
6074    pub fn set_filter<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6075        self.filter = v.into();
6076        self
6077    }
6078
6079    /// Sets the value of [page_size][crate::model::ListDatabaseOperationsRequest::page_size].
6080    ///
6081    /// # Example
6082    /// ```ignore,no_run
6083    /// # use google_cloud_spanner_admin_database_v1::model::ListDatabaseOperationsRequest;
6084    /// let x = ListDatabaseOperationsRequest::new().set_page_size(42);
6085    /// ```
6086    pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
6087        self.page_size = v.into();
6088        self
6089    }
6090
6091    /// Sets the value of [page_token][crate::model::ListDatabaseOperationsRequest::page_token].
6092    ///
6093    /// # Example
6094    /// ```ignore,no_run
6095    /// # use google_cloud_spanner_admin_database_v1::model::ListDatabaseOperationsRequest;
6096    /// let x = ListDatabaseOperationsRequest::new().set_page_token("example");
6097    /// ```
6098    pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6099        self.page_token = v.into();
6100        self
6101    }
6102}
6103
6104impl wkt::message::Message for ListDatabaseOperationsRequest {
6105    fn typename() -> &'static str {
6106        "type.googleapis.com/google.spanner.admin.database.v1.ListDatabaseOperationsRequest"
6107    }
6108}
6109
6110/// The response for
6111/// [ListDatabaseOperations][google.spanner.admin.database.v1.DatabaseAdmin.ListDatabaseOperations].
6112///
6113/// [google.spanner.admin.database.v1.DatabaseAdmin.ListDatabaseOperations]: crate::client::DatabaseAdmin::list_database_operations
6114#[derive(Clone, Default, PartialEq)]
6115#[non_exhaustive]
6116pub struct ListDatabaseOperationsResponse {
6117    /// The list of matching database [long-running
6118    /// operations][google.longrunning.Operation]. Each operation's name will be
6119    /// prefixed by the database's name. The operation's
6120    /// [metadata][google.longrunning.Operation.metadata] field type
6121    /// `metadata.type_url` describes the type of the metadata.
6122    ///
6123    /// [google.longrunning.Operation]: google_cloud_longrunning::model::Operation
6124    /// [google.longrunning.Operation.metadata]: google_cloud_longrunning::model::Operation::metadata
6125    pub operations: std::vec::Vec<google_cloud_longrunning::model::Operation>,
6126
6127    /// `next_page_token` can be sent in a subsequent
6128    /// [ListDatabaseOperations][google.spanner.admin.database.v1.DatabaseAdmin.ListDatabaseOperations]
6129    /// call to fetch more of the matching metadata.
6130    ///
6131    /// [google.spanner.admin.database.v1.DatabaseAdmin.ListDatabaseOperations]: crate::client::DatabaseAdmin::list_database_operations
6132    pub next_page_token: std::string::String,
6133
6134    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
6135}
6136
6137impl ListDatabaseOperationsResponse {
6138    /// Creates a new default instance.
6139    pub fn new() -> Self {
6140        std::default::Default::default()
6141    }
6142
6143    /// Sets the value of [operations][crate::model::ListDatabaseOperationsResponse::operations].
6144    ///
6145    /// # Example
6146    /// ```ignore,no_run
6147    /// # use google_cloud_spanner_admin_database_v1::model::ListDatabaseOperationsResponse;
6148    /// use google_cloud_longrunning::model::Operation;
6149    /// let x = ListDatabaseOperationsResponse::new()
6150    ///     .set_operations([
6151    ///         Operation::default()/* use setters */,
6152    ///         Operation::default()/* use (different) setters */,
6153    ///     ]);
6154    /// ```
6155    pub fn set_operations<T, V>(mut self, v: T) -> Self
6156    where
6157        T: std::iter::IntoIterator<Item = V>,
6158        V: std::convert::Into<google_cloud_longrunning::model::Operation>,
6159    {
6160        use std::iter::Iterator;
6161        self.operations = v.into_iter().map(|i| i.into()).collect();
6162        self
6163    }
6164
6165    /// Sets the value of [next_page_token][crate::model::ListDatabaseOperationsResponse::next_page_token].
6166    ///
6167    /// # Example
6168    /// ```ignore,no_run
6169    /// # use google_cloud_spanner_admin_database_v1::model::ListDatabaseOperationsResponse;
6170    /// let x = ListDatabaseOperationsResponse::new().set_next_page_token("example");
6171    /// ```
6172    pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6173        self.next_page_token = v.into();
6174        self
6175    }
6176}
6177
6178impl wkt::message::Message for ListDatabaseOperationsResponse {
6179    fn typename() -> &'static str {
6180        "type.googleapis.com/google.spanner.admin.database.v1.ListDatabaseOperationsResponse"
6181    }
6182}
6183
6184#[doc(hidden)]
6185impl google_cloud_gax::paginator::internal::PageableResponse for ListDatabaseOperationsResponse {
6186    type PageItem = google_cloud_longrunning::model::Operation;
6187
6188    fn items(self) -> std::vec::Vec<Self::PageItem> {
6189        self.operations
6190    }
6191
6192    fn next_page_token(&self) -> std::string::String {
6193        use std::clone::Clone;
6194        self.next_page_token.clone()
6195    }
6196}
6197
6198/// The request for
6199/// [RestoreDatabase][google.spanner.admin.database.v1.DatabaseAdmin.RestoreDatabase].
6200///
6201/// [google.spanner.admin.database.v1.DatabaseAdmin.RestoreDatabase]: crate::client::DatabaseAdmin::restore_database
6202#[derive(Clone, Default, PartialEq)]
6203#[non_exhaustive]
6204pub struct RestoreDatabaseRequest {
6205    /// Required. The name of the instance in which to create the
6206    /// restored database. This instance must be in the same project and
6207    /// have the same instance configuration as the instance containing
6208    /// the source backup. Values are of the form
6209    /// `projects/<project>/instances/<instance>`.
6210    pub parent: std::string::String,
6211
6212    /// Required. The id of the database to create and restore to. This
6213    /// database must not already exist. The `database_id` appended to
6214    /// `parent` forms the full database name of the form
6215    /// `projects/<project>/instances/<instance>/databases/<database_id>`.
6216    pub database_id: std::string::String,
6217
6218    /// Optional. An encryption configuration describing the encryption type and
6219    /// key resources in Cloud KMS used to encrypt/decrypt the database to restore
6220    /// to. If this field is not specified, the restored database will use the same
6221    /// encryption configuration as the backup by default, namely
6222    /// [encryption_type][google.spanner.admin.database.v1.RestoreDatabaseEncryptionConfig.encryption_type]
6223    /// = `USE_CONFIG_DEFAULT_OR_BACKUP_ENCRYPTION`.
6224    ///
6225    /// [google.spanner.admin.database.v1.RestoreDatabaseEncryptionConfig.encryption_type]: crate::model::RestoreDatabaseEncryptionConfig::encryption_type
6226    pub encryption_config: std::option::Option<crate::model::RestoreDatabaseEncryptionConfig>,
6227
6228    /// Required. The source from which to restore.
6229    pub source: std::option::Option<crate::model::restore_database_request::Source>,
6230
6231    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
6232}
6233
6234impl RestoreDatabaseRequest {
6235    /// Creates a new default instance.
6236    pub fn new() -> Self {
6237        std::default::Default::default()
6238    }
6239
6240    /// Sets the value of [parent][crate::model::RestoreDatabaseRequest::parent].
6241    ///
6242    /// # Example
6243    /// ```ignore,no_run
6244    /// # use google_cloud_spanner_admin_database_v1::model::RestoreDatabaseRequest;
6245    /// let x = RestoreDatabaseRequest::new().set_parent("example");
6246    /// ```
6247    pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6248        self.parent = v.into();
6249        self
6250    }
6251
6252    /// Sets the value of [database_id][crate::model::RestoreDatabaseRequest::database_id].
6253    ///
6254    /// # Example
6255    /// ```ignore,no_run
6256    /// # use google_cloud_spanner_admin_database_v1::model::RestoreDatabaseRequest;
6257    /// let x = RestoreDatabaseRequest::new().set_database_id("example");
6258    /// ```
6259    pub fn set_database_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6260        self.database_id = v.into();
6261        self
6262    }
6263
6264    /// Sets the value of [encryption_config][crate::model::RestoreDatabaseRequest::encryption_config].
6265    ///
6266    /// # Example
6267    /// ```ignore,no_run
6268    /// # use google_cloud_spanner_admin_database_v1::model::RestoreDatabaseRequest;
6269    /// use google_cloud_spanner_admin_database_v1::model::RestoreDatabaseEncryptionConfig;
6270    /// let x = RestoreDatabaseRequest::new().set_encryption_config(RestoreDatabaseEncryptionConfig::default()/* use setters */);
6271    /// ```
6272    pub fn set_encryption_config<T>(mut self, v: T) -> Self
6273    where
6274        T: std::convert::Into<crate::model::RestoreDatabaseEncryptionConfig>,
6275    {
6276        self.encryption_config = std::option::Option::Some(v.into());
6277        self
6278    }
6279
6280    /// Sets or clears the value of [encryption_config][crate::model::RestoreDatabaseRequest::encryption_config].
6281    ///
6282    /// # Example
6283    /// ```ignore,no_run
6284    /// # use google_cloud_spanner_admin_database_v1::model::RestoreDatabaseRequest;
6285    /// use google_cloud_spanner_admin_database_v1::model::RestoreDatabaseEncryptionConfig;
6286    /// let x = RestoreDatabaseRequest::new().set_or_clear_encryption_config(Some(RestoreDatabaseEncryptionConfig::default()/* use setters */));
6287    /// let x = RestoreDatabaseRequest::new().set_or_clear_encryption_config(None::<RestoreDatabaseEncryptionConfig>);
6288    /// ```
6289    pub fn set_or_clear_encryption_config<T>(mut self, v: std::option::Option<T>) -> Self
6290    where
6291        T: std::convert::Into<crate::model::RestoreDatabaseEncryptionConfig>,
6292    {
6293        self.encryption_config = v.map(|x| x.into());
6294        self
6295    }
6296
6297    /// Sets the value of [source][crate::model::RestoreDatabaseRequest::source].
6298    ///
6299    /// Note that all the setters affecting `source` are mutually
6300    /// exclusive.
6301    ///
6302    /// # Example
6303    /// ```ignore,no_run
6304    /// # use google_cloud_spanner_admin_database_v1::model::RestoreDatabaseRequest;
6305    /// use google_cloud_spanner_admin_database_v1::model::restore_database_request::Source;
6306    /// let x = RestoreDatabaseRequest::new().set_source(Some(Source::Backup("example".to_string())));
6307    /// ```
6308    pub fn set_source<
6309        T: std::convert::Into<std::option::Option<crate::model::restore_database_request::Source>>,
6310    >(
6311        mut self,
6312        v: T,
6313    ) -> Self {
6314        self.source = v.into();
6315        self
6316    }
6317
6318    /// The value of [source][crate::model::RestoreDatabaseRequest::source]
6319    /// if it holds a `Backup`, `None` if the field is not set or
6320    /// holds a different branch.
6321    pub fn backup(&self) -> std::option::Option<&std::string::String> {
6322        #[allow(unreachable_patterns)]
6323        self.source.as_ref().and_then(|v| match v {
6324            crate::model::restore_database_request::Source::Backup(v) => {
6325                std::option::Option::Some(v)
6326            }
6327            _ => std::option::Option::None,
6328        })
6329    }
6330
6331    /// Sets the value of [source][crate::model::RestoreDatabaseRequest::source]
6332    /// to hold a `Backup`.
6333    ///
6334    /// Note that all the setters affecting `source` are
6335    /// mutually exclusive.
6336    ///
6337    /// # Example
6338    /// ```ignore,no_run
6339    /// # use google_cloud_spanner_admin_database_v1::model::RestoreDatabaseRequest;
6340    /// # let project_id = "project_id";
6341    /// # let instance_id = "instance_id";
6342    /// # let backup_id = "backup_id";
6343    /// let x = RestoreDatabaseRequest::new().set_backup(format!("projects/{project_id}/instances/{instance_id}/backups/{backup_id}"));
6344    /// assert!(x.backup().is_some());
6345    /// ```
6346    pub fn set_backup<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6347        self.source = std::option::Option::Some(
6348            crate::model::restore_database_request::Source::Backup(v.into()),
6349        );
6350        self
6351    }
6352}
6353
6354impl wkt::message::Message for RestoreDatabaseRequest {
6355    fn typename() -> &'static str {
6356        "type.googleapis.com/google.spanner.admin.database.v1.RestoreDatabaseRequest"
6357    }
6358}
6359
6360/// Defines additional types related to [RestoreDatabaseRequest].
6361pub mod restore_database_request {
6362    #[allow(unused_imports)]
6363    use super::*;
6364
6365    /// Required. The source from which to restore.
6366    #[derive(Clone, Debug, PartialEq)]
6367    #[non_exhaustive]
6368    pub enum Source {
6369        /// Name of the backup from which to restore.  Values are of the form
6370        /// `projects/<project>/instances/<instance>/backups/<backup>`.
6371        Backup(std::string::String),
6372    }
6373}
6374
6375/// Encryption configuration for the restored database.
6376#[derive(Clone, Default, PartialEq)]
6377#[non_exhaustive]
6378pub struct RestoreDatabaseEncryptionConfig {
6379    /// Required. The encryption type of the restored database.
6380    pub encryption_type: crate::model::restore_database_encryption_config::EncryptionType,
6381
6382    /// Optional. The Cloud KMS key that will be used to encrypt/decrypt the
6383    /// restored database. This field should be set only when
6384    /// [encryption_type][google.spanner.admin.database.v1.RestoreDatabaseEncryptionConfig.encryption_type]
6385    /// is `CUSTOMER_MANAGED_ENCRYPTION`. Values are of the form
6386    /// `projects/<project>/locations/<location>/keyRings/<key_ring>/cryptoKeys/<kms_key_name>`.
6387    ///
6388    /// [google.spanner.admin.database.v1.RestoreDatabaseEncryptionConfig.encryption_type]: crate::model::RestoreDatabaseEncryptionConfig::encryption_type
6389    pub kms_key_name: std::string::String,
6390
6391    /// Optional. Specifies the KMS configuration for the one or more keys used to
6392    /// encrypt the database. Values are of the form
6393    /// `projects/<project>/locations/<location>/keyRings/<key_ring>/cryptoKeys/<kms_key_name>`.
6394    ///
6395    /// The keys referenced by kms_key_names must fully cover all
6396    /// regions of the database instance configuration. Some examples:
6397    ///
6398    /// * For single region database instance configs, specify a single regional
6399    ///   location KMS key.
6400    /// * For multi-regional database instance configs of type GOOGLE_MANAGED,
6401    ///   either specify a multi-regional location KMS key or multiple regional
6402    ///   location KMS keys that cover all regions in the instance config.
6403    /// * For a database instance config of type USER_MANAGED, please specify only
6404    ///   regional location KMS keys to cover each region in the instance config.
6405    ///   Multi-regional location KMS keys are not supported for USER_MANAGED
6406    ///   instance configs.
6407    pub kms_key_names: std::vec::Vec<std::string::String>,
6408
6409    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
6410}
6411
6412impl RestoreDatabaseEncryptionConfig {
6413    /// Creates a new default instance.
6414    pub fn new() -> Self {
6415        std::default::Default::default()
6416    }
6417
6418    /// Sets the value of [encryption_type][crate::model::RestoreDatabaseEncryptionConfig::encryption_type].
6419    ///
6420    /// # Example
6421    /// ```ignore,no_run
6422    /// # use google_cloud_spanner_admin_database_v1::model::RestoreDatabaseEncryptionConfig;
6423    /// use google_cloud_spanner_admin_database_v1::model::restore_database_encryption_config::EncryptionType;
6424    /// let x0 = RestoreDatabaseEncryptionConfig::new().set_encryption_type(EncryptionType::UseConfigDefaultOrBackupEncryption);
6425    /// let x1 = RestoreDatabaseEncryptionConfig::new().set_encryption_type(EncryptionType::GoogleDefaultEncryption);
6426    /// let x2 = RestoreDatabaseEncryptionConfig::new().set_encryption_type(EncryptionType::CustomerManagedEncryption);
6427    /// ```
6428    pub fn set_encryption_type<
6429        T: std::convert::Into<crate::model::restore_database_encryption_config::EncryptionType>,
6430    >(
6431        mut self,
6432        v: T,
6433    ) -> Self {
6434        self.encryption_type = v.into();
6435        self
6436    }
6437
6438    /// Sets the value of [kms_key_name][crate::model::RestoreDatabaseEncryptionConfig::kms_key_name].
6439    ///
6440    /// # Example
6441    /// ```ignore,no_run
6442    /// # use google_cloud_spanner_admin_database_v1::model::RestoreDatabaseEncryptionConfig;
6443    /// let x = RestoreDatabaseEncryptionConfig::new().set_kms_key_name("example");
6444    /// ```
6445    pub fn set_kms_key_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6446        self.kms_key_name = v.into();
6447        self
6448    }
6449
6450    /// Sets the value of [kms_key_names][crate::model::RestoreDatabaseEncryptionConfig::kms_key_names].
6451    ///
6452    /// # Example
6453    /// ```ignore,no_run
6454    /// # use google_cloud_spanner_admin_database_v1::model::RestoreDatabaseEncryptionConfig;
6455    /// let x = RestoreDatabaseEncryptionConfig::new().set_kms_key_names(["a", "b", "c"]);
6456    /// ```
6457    pub fn set_kms_key_names<T, V>(mut self, v: T) -> Self
6458    where
6459        T: std::iter::IntoIterator<Item = V>,
6460        V: std::convert::Into<std::string::String>,
6461    {
6462        use std::iter::Iterator;
6463        self.kms_key_names = v.into_iter().map(|i| i.into()).collect();
6464        self
6465    }
6466}
6467
6468impl wkt::message::Message for RestoreDatabaseEncryptionConfig {
6469    fn typename() -> &'static str {
6470        "type.googleapis.com/google.spanner.admin.database.v1.RestoreDatabaseEncryptionConfig"
6471    }
6472}
6473
6474/// Defines additional types related to [RestoreDatabaseEncryptionConfig].
6475pub mod restore_database_encryption_config {
6476    #[allow(unused_imports)]
6477    use super::*;
6478
6479    /// Encryption types for the database to be restored.
6480    ///
6481    /// # Working with unknown values
6482    ///
6483    /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
6484    /// additional enum variants at any time. Adding new variants is not considered
6485    /// a breaking change. Applications should write their code in anticipation of:
6486    ///
6487    /// - New values appearing in future releases of the client library, **and**
6488    /// - New values received dynamically, without application changes.
6489    ///
6490    /// Please consult the [Working with enums] section in the user guide for some
6491    /// guidelines.
6492    ///
6493    /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
6494    #[derive(Clone, Debug, PartialEq)]
6495    #[non_exhaustive]
6496    pub enum EncryptionType {
6497        /// Unspecified. Do not use.
6498        Unspecified,
6499        /// This is the default option when
6500        /// [encryption_config][google.spanner.admin.database.v1.RestoreDatabaseEncryptionConfig]
6501        /// is not specified.
6502        ///
6503        /// [google.spanner.admin.database.v1.RestoreDatabaseEncryptionConfig]: crate::model::RestoreDatabaseEncryptionConfig
6504        UseConfigDefaultOrBackupEncryption,
6505        /// Use Google default encryption.
6506        GoogleDefaultEncryption,
6507        /// Use customer managed encryption. If specified, `kms_key_name` must
6508        /// must contain a valid Cloud KMS key.
6509        CustomerManagedEncryption,
6510        /// If set, the enum was initialized with an unknown value.
6511        ///
6512        /// Applications can examine the value using [EncryptionType::value] or
6513        /// [EncryptionType::name].
6514        UnknownValue(encryption_type::UnknownValue),
6515    }
6516
6517    #[doc(hidden)]
6518    pub mod encryption_type {
6519        #[allow(unused_imports)]
6520        use super::*;
6521        #[derive(Clone, Debug, PartialEq)]
6522        pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
6523    }
6524
6525    impl EncryptionType {
6526        /// Gets the enum value.
6527        ///
6528        /// Returns `None` if the enum contains an unknown value deserialized from
6529        /// the string representation of enums.
6530        pub fn value(&self) -> std::option::Option<i32> {
6531            match self {
6532                Self::Unspecified => std::option::Option::Some(0),
6533                Self::UseConfigDefaultOrBackupEncryption => std::option::Option::Some(1),
6534                Self::GoogleDefaultEncryption => std::option::Option::Some(2),
6535                Self::CustomerManagedEncryption => std::option::Option::Some(3),
6536                Self::UnknownValue(u) => u.0.value(),
6537            }
6538        }
6539
6540        /// Gets the enum value as a string.
6541        ///
6542        /// Returns `None` if the enum contains an unknown value deserialized from
6543        /// the integer representation of enums.
6544        pub fn name(&self) -> std::option::Option<&str> {
6545            match self {
6546                Self::Unspecified => std::option::Option::Some("ENCRYPTION_TYPE_UNSPECIFIED"),
6547                Self::UseConfigDefaultOrBackupEncryption => {
6548                    std::option::Option::Some("USE_CONFIG_DEFAULT_OR_BACKUP_ENCRYPTION")
6549                }
6550                Self::GoogleDefaultEncryption => {
6551                    std::option::Option::Some("GOOGLE_DEFAULT_ENCRYPTION")
6552                }
6553                Self::CustomerManagedEncryption => {
6554                    std::option::Option::Some("CUSTOMER_MANAGED_ENCRYPTION")
6555                }
6556                Self::UnknownValue(u) => u.0.name(),
6557            }
6558        }
6559    }
6560
6561    impl std::default::Default for EncryptionType {
6562        fn default() -> Self {
6563            use std::convert::From;
6564            Self::from(0)
6565        }
6566    }
6567
6568    impl std::fmt::Display for EncryptionType {
6569        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
6570            wkt::internal::display_enum(f, self.name(), self.value())
6571        }
6572    }
6573
6574    impl std::convert::From<i32> for EncryptionType {
6575        fn from(value: i32) -> Self {
6576            match value {
6577                0 => Self::Unspecified,
6578                1 => Self::UseConfigDefaultOrBackupEncryption,
6579                2 => Self::GoogleDefaultEncryption,
6580                3 => Self::CustomerManagedEncryption,
6581                _ => Self::UnknownValue(encryption_type::UnknownValue(
6582                    wkt::internal::UnknownEnumValue::Integer(value),
6583                )),
6584            }
6585        }
6586    }
6587
6588    impl std::convert::From<&str> for EncryptionType {
6589        fn from(value: &str) -> Self {
6590            use std::string::ToString;
6591            match value {
6592                "ENCRYPTION_TYPE_UNSPECIFIED" => Self::Unspecified,
6593                "USE_CONFIG_DEFAULT_OR_BACKUP_ENCRYPTION" => {
6594                    Self::UseConfigDefaultOrBackupEncryption
6595                }
6596                "GOOGLE_DEFAULT_ENCRYPTION" => Self::GoogleDefaultEncryption,
6597                "CUSTOMER_MANAGED_ENCRYPTION" => Self::CustomerManagedEncryption,
6598                _ => Self::UnknownValue(encryption_type::UnknownValue(
6599                    wkt::internal::UnknownEnumValue::String(value.to_string()),
6600                )),
6601            }
6602        }
6603    }
6604
6605    impl serde::ser::Serialize for EncryptionType {
6606        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
6607        where
6608            S: serde::Serializer,
6609        {
6610            match self {
6611                Self::Unspecified => serializer.serialize_i32(0),
6612                Self::UseConfigDefaultOrBackupEncryption => serializer.serialize_i32(1),
6613                Self::GoogleDefaultEncryption => serializer.serialize_i32(2),
6614                Self::CustomerManagedEncryption => serializer.serialize_i32(3),
6615                Self::UnknownValue(u) => u.0.serialize(serializer),
6616            }
6617        }
6618    }
6619
6620    impl<'de> serde::de::Deserialize<'de> for EncryptionType {
6621        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
6622        where
6623            D: serde::Deserializer<'de>,
6624        {
6625            deserializer.deserialize_any(wkt::internal::EnumVisitor::<EncryptionType>::new(
6626                ".google.spanner.admin.database.v1.RestoreDatabaseEncryptionConfig.EncryptionType",
6627            ))
6628        }
6629    }
6630}
6631
6632/// Metadata type for the long-running operation returned by
6633/// [RestoreDatabase][google.spanner.admin.database.v1.DatabaseAdmin.RestoreDatabase].
6634///
6635/// [google.spanner.admin.database.v1.DatabaseAdmin.RestoreDatabase]: crate::client::DatabaseAdmin::restore_database
6636#[derive(Clone, Default, PartialEq)]
6637#[non_exhaustive]
6638pub struct RestoreDatabaseMetadata {
6639    /// Name of the database being created and restored to.
6640    pub name: std::string::String,
6641
6642    /// The type of the restore source.
6643    pub source_type: crate::model::RestoreSourceType,
6644
6645    /// The progress of the
6646    /// [RestoreDatabase][google.spanner.admin.database.v1.DatabaseAdmin.RestoreDatabase]
6647    /// operation.
6648    ///
6649    /// [google.spanner.admin.database.v1.DatabaseAdmin.RestoreDatabase]: crate::client::DatabaseAdmin::restore_database
6650    pub progress: std::option::Option<crate::model::OperationProgress>,
6651
6652    /// The time at which cancellation of this operation was received.
6653    /// [Operations.CancelOperation][google.longrunning.Operations.CancelOperation]
6654    /// starts asynchronous cancellation on a long-running operation. The server
6655    /// makes a best effort to cancel the operation, but success is not guaranteed.
6656    /// Clients can use
6657    /// [Operations.GetOperation][google.longrunning.Operations.GetOperation] or
6658    /// other methods to check whether the cancellation succeeded or whether the
6659    /// operation completed despite cancellation. On successful cancellation,
6660    /// the operation is not deleted; instead, it becomes an operation with
6661    /// an [Operation.error][google.longrunning.Operation.error] value with a
6662    /// [google.rpc.Status.code][google.rpc.Status.code] of 1, corresponding to
6663    /// `Code.CANCELLED`.
6664    ///
6665    /// [google.longrunning.Operation.error]: google_cloud_longrunning::model::Operation::result
6666    /// [google.rpc.Status.code]: google_cloud_rpc::model::Status::code
6667    pub cancel_time: std::option::Option<wkt::Timestamp>,
6668
6669    /// If exists, the name of the long-running operation that will be used to
6670    /// track the post-restore optimization process to optimize the performance of
6671    /// the restored database, and remove the dependency on the restore source.
6672    /// The name is of the form
6673    /// `projects/<project>/instances/<instance>/databases/<database>/operations/<operation>`
6674    /// where the \<database\> is the name of database being created and restored to.
6675    /// The metadata type of the  long-running operation is
6676    /// [OptimizeRestoredDatabaseMetadata][google.spanner.admin.database.v1.OptimizeRestoredDatabaseMetadata].
6677    /// This long-running operation will be automatically created by the system
6678    /// after the RestoreDatabase long-running operation completes successfully.
6679    /// This operation will not be created if the restore was not successful.
6680    ///
6681    /// [google.spanner.admin.database.v1.OptimizeRestoredDatabaseMetadata]: crate::model::OptimizeRestoredDatabaseMetadata
6682    pub optimize_database_operation_name: std::string::String,
6683
6684    /// Information about the source used to restore the database, as specified by
6685    /// `source` in
6686    /// [RestoreDatabaseRequest][google.spanner.admin.database.v1.RestoreDatabaseRequest].
6687    ///
6688    /// [google.spanner.admin.database.v1.RestoreDatabaseRequest]: crate::model::RestoreDatabaseRequest
6689    pub source_info: std::option::Option<crate::model::restore_database_metadata::SourceInfo>,
6690
6691    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
6692}
6693
6694impl RestoreDatabaseMetadata {
6695    /// Creates a new default instance.
6696    pub fn new() -> Self {
6697        std::default::Default::default()
6698    }
6699
6700    /// Sets the value of [name][crate::model::RestoreDatabaseMetadata::name].
6701    ///
6702    /// # Example
6703    /// ```ignore,no_run
6704    /// # use google_cloud_spanner_admin_database_v1::model::RestoreDatabaseMetadata;
6705    /// # let project_id = "project_id";
6706    /// # let instance_id = "instance_id";
6707    /// # let database_id = "database_id";
6708    /// let x = RestoreDatabaseMetadata::new().set_name(format!("projects/{project_id}/instances/{instance_id}/databases/{database_id}"));
6709    /// ```
6710    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6711        self.name = v.into();
6712        self
6713    }
6714
6715    /// Sets the value of [source_type][crate::model::RestoreDatabaseMetadata::source_type].
6716    ///
6717    /// # Example
6718    /// ```ignore,no_run
6719    /// # use google_cloud_spanner_admin_database_v1::model::RestoreDatabaseMetadata;
6720    /// use google_cloud_spanner_admin_database_v1::model::RestoreSourceType;
6721    /// let x0 = RestoreDatabaseMetadata::new().set_source_type(RestoreSourceType::Backup);
6722    /// ```
6723    pub fn set_source_type<T: std::convert::Into<crate::model::RestoreSourceType>>(
6724        mut self,
6725        v: T,
6726    ) -> Self {
6727        self.source_type = v.into();
6728        self
6729    }
6730
6731    /// Sets the value of [progress][crate::model::RestoreDatabaseMetadata::progress].
6732    ///
6733    /// # Example
6734    /// ```ignore,no_run
6735    /// # use google_cloud_spanner_admin_database_v1::model::RestoreDatabaseMetadata;
6736    /// use google_cloud_spanner_admin_database_v1::model::OperationProgress;
6737    /// let x = RestoreDatabaseMetadata::new().set_progress(OperationProgress::default()/* use setters */);
6738    /// ```
6739    pub fn set_progress<T>(mut self, v: T) -> Self
6740    where
6741        T: std::convert::Into<crate::model::OperationProgress>,
6742    {
6743        self.progress = std::option::Option::Some(v.into());
6744        self
6745    }
6746
6747    /// Sets or clears the value of [progress][crate::model::RestoreDatabaseMetadata::progress].
6748    ///
6749    /// # Example
6750    /// ```ignore,no_run
6751    /// # use google_cloud_spanner_admin_database_v1::model::RestoreDatabaseMetadata;
6752    /// use google_cloud_spanner_admin_database_v1::model::OperationProgress;
6753    /// let x = RestoreDatabaseMetadata::new().set_or_clear_progress(Some(OperationProgress::default()/* use setters */));
6754    /// let x = RestoreDatabaseMetadata::new().set_or_clear_progress(None::<OperationProgress>);
6755    /// ```
6756    pub fn set_or_clear_progress<T>(mut self, v: std::option::Option<T>) -> Self
6757    where
6758        T: std::convert::Into<crate::model::OperationProgress>,
6759    {
6760        self.progress = v.map(|x| x.into());
6761        self
6762    }
6763
6764    /// Sets the value of [cancel_time][crate::model::RestoreDatabaseMetadata::cancel_time].
6765    ///
6766    /// # Example
6767    /// ```ignore,no_run
6768    /// # use google_cloud_spanner_admin_database_v1::model::RestoreDatabaseMetadata;
6769    /// use wkt::Timestamp;
6770    /// let x = RestoreDatabaseMetadata::new().set_cancel_time(Timestamp::default()/* use setters */);
6771    /// ```
6772    pub fn set_cancel_time<T>(mut self, v: T) -> Self
6773    where
6774        T: std::convert::Into<wkt::Timestamp>,
6775    {
6776        self.cancel_time = std::option::Option::Some(v.into());
6777        self
6778    }
6779
6780    /// Sets or clears the value of [cancel_time][crate::model::RestoreDatabaseMetadata::cancel_time].
6781    ///
6782    /// # Example
6783    /// ```ignore,no_run
6784    /// # use google_cloud_spanner_admin_database_v1::model::RestoreDatabaseMetadata;
6785    /// use wkt::Timestamp;
6786    /// let x = RestoreDatabaseMetadata::new().set_or_clear_cancel_time(Some(Timestamp::default()/* use setters */));
6787    /// let x = RestoreDatabaseMetadata::new().set_or_clear_cancel_time(None::<Timestamp>);
6788    /// ```
6789    pub fn set_or_clear_cancel_time<T>(mut self, v: std::option::Option<T>) -> Self
6790    where
6791        T: std::convert::Into<wkt::Timestamp>,
6792    {
6793        self.cancel_time = v.map(|x| x.into());
6794        self
6795    }
6796
6797    /// Sets the value of [optimize_database_operation_name][crate::model::RestoreDatabaseMetadata::optimize_database_operation_name].
6798    ///
6799    /// # Example
6800    /// ```ignore,no_run
6801    /// # use google_cloud_spanner_admin_database_v1::model::RestoreDatabaseMetadata;
6802    /// let x = RestoreDatabaseMetadata::new().set_optimize_database_operation_name("example");
6803    /// ```
6804    pub fn set_optimize_database_operation_name<T: std::convert::Into<std::string::String>>(
6805        mut self,
6806        v: T,
6807    ) -> Self {
6808        self.optimize_database_operation_name = v.into();
6809        self
6810    }
6811
6812    /// Sets the value of [source_info][crate::model::RestoreDatabaseMetadata::source_info].
6813    ///
6814    /// Note that all the setters affecting `source_info` are mutually
6815    /// exclusive.
6816    ///
6817    /// # Example
6818    /// ```ignore,no_run
6819    /// # use google_cloud_spanner_admin_database_v1::model::RestoreDatabaseMetadata;
6820    /// use google_cloud_spanner_admin_database_v1::model::BackupInfo;
6821    /// let x = RestoreDatabaseMetadata::new().set_source_info(Some(
6822    ///     google_cloud_spanner_admin_database_v1::model::restore_database_metadata::SourceInfo::BackupInfo(BackupInfo::default().into())));
6823    /// ```
6824    pub fn set_source_info<
6825        T: std::convert::Into<
6826                std::option::Option<crate::model::restore_database_metadata::SourceInfo>,
6827            >,
6828    >(
6829        mut self,
6830        v: T,
6831    ) -> Self {
6832        self.source_info = v.into();
6833        self
6834    }
6835
6836    /// The value of [source_info][crate::model::RestoreDatabaseMetadata::source_info]
6837    /// if it holds a `BackupInfo`, `None` if the field is not set or
6838    /// holds a different branch.
6839    pub fn backup_info(&self) -> std::option::Option<&std::boxed::Box<crate::model::BackupInfo>> {
6840        #[allow(unreachable_patterns)]
6841        self.source_info.as_ref().and_then(|v| match v {
6842            crate::model::restore_database_metadata::SourceInfo::BackupInfo(v) => {
6843                std::option::Option::Some(v)
6844            }
6845            _ => std::option::Option::None,
6846        })
6847    }
6848
6849    /// Sets the value of [source_info][crate::model::RestoreDatabaseMetadata::source_info]
6850    /// to hold a `BackupInfo`.
6851    ///
6852    /// Note that all the setters affecting `source_info` are
6853    /// mutually exclusive.
6854    ///
6855    /// # Example
6856    /// ```ignore,no_run
6857    /// # use google_cloud_spanner_admin_database_v1::model::RestoreDatabaseMetadata;
6858    /// use google_cloud_spanner_admin_database_v1::model::BackupInfo;
6859    /// let x = RestoreDatabaseMetadata::new().set_backup_info(BackupInfo::default()/* use setters */);
6860    /// assert!(x.backup_info().is_some());
6861    /// ```
6862    pub fn set_backup_info<T: std::convert::Into<std::boxed::Box<crate::model::BackupInfo>>>(
6863        mut self,
6864        v: T,
6865    ) -> Self {
6866        self.source_info = std::option::Option::Some(
6867            crate::model::restore_database_metadata::SourceInfo::BackupInfo(v.into()),
6868        );
6869        self
6870    }
6871}
6872
6873impl wkt::message::Message for RestoreDatabaseMetadata {
6874    fn typename() -> &'static str {
6875        "type.googleapis.com/google.spanner.admin.database.v1.RestoreDatabaseMetadata"
6876    }
6877}
6878
6879/// Defines additional types related to [RestoreDatabaseMetadata].
6880pub mod restore_database_metadata {
6881    #[allow(unused_imports)]
6882    use super::*;
6883
6884    /// Information about the source used to restore the database, as specified by
6885    /// `source` in
6886    /// [RestoreDatabaseRequest][google.spanner.admin.database.v1.RestoreDatabaseRequest].
6887    ///
6888    /// [google.spanner.admin.database.v1.RestoreDatabaseRequest]: crate::model::RestoreDatabaseRequest
6889    #[derive(Clone, Debug, PartialEq)]
6890    #[non_exhaustive]
6891    pub enum SourceInfo {
6892        /// Information about the backup used to restore the database.
6893        BackupInfo(std::boxed::Box<crate::model::BackupInfo>),
6894    }
6895}
6896
6897/// Metadata type for the long-running operation used to track the progress
6898/// of optimizations performed on a newly restored database. This long-running
6899/// operation is automatically created by the system after the successful
6900/// completion of a database restore, and cannot be cancelled.
6901#[derive(Clone, Default, PartialEq)]
6902#[non_exhaustive]
6903pub struct OptimizeRestoredDatabaseMetadata {
6904    /// Name of the restored database being optimized.
6905    pub name: std::string::String,
6906
6907    /// The progress of the post-restore optimizations.
6908    pub progress: std::option::Option<crate::model::OperationProgress>,
6909
6910    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
6911}
6912
6913impl OptimizeRestoredDatabaseMetadata {
6914    /// Creates a new default instance.
6915    pub fn new() -> Self {
6916        std::default::Default::default()
6917    }
6918
6919    /// Sets the value of [name][crate::model::OptimizeRestoredDatabaseMetadata::name].
6920    ///
6921    /// # Example
6922    /// ```ignore,no_run
6923    /// # use google_cloud_spanner_admin_database_v1::model::OptimizeRestoredDatabaseMetadata;
6924    /// # let project_id = "project_id";
6925    /// # let instance_id = "instance_id";
6926    /// # let database_id = "database_id";
6927    /// let x = OptimizeRestoredDatabaseMetadata::new().set_name(format!("projects/{project_id}/instances/{instance_id}/databases/{database_id}"));
6928    /// ```
6929    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6930        self.name = v.into();
6931        self
6932    }
6933
6934    /// Sets the value of [progress][crate::model::OptimizeRestoredDatabaseMetadata::progress].
6935    ///
6936    /// # Example
6937    /// ```ignore,no_run
6938    /// # use google_cloud_spanner_admin_database_v1::model::OptimizeRestoredDatabaseMetadata;
6939    /// use google_cloud_spanner_admin_database_v1::model::OperationProgress;
6940    /// let x = OptimizeRestoredDatabaseMetadata::new().set_progress(OperationProgress::default()/* use setters */);
6941    /// ```
6942    pub fn set_progress<T>(mut self, v: T) -> Self
6943    where
6944        T: std::convert::Into<crate::model::OperationProgress>,
6945    {
6946        self.progress = std::option::Option::Some(v.into());
6947        self
6948    }
6949
6950    /// Sets or clears the value of [progress][crate::model::OptimizeRestoredDatabaseMetadata::progress].
6951    ///
6952    /// # Example
6953    /// ```ignore,no_run
6954    /// # use google_cloud_spanner_admin_database_v1::model::OptimizeRestoredDatabaseMetadata;
6955    /// use google_cloud_spanner_admin_database_v1::model::OperationProgress;
6956    /// let x = OptimizeRestoredDatabaseMetadata::new().set_or_clear_progress(Some(OperationProgress::default()/* use setters */));
6957    /// let x = OptimizeRestoredDatabaseMetadata::new().set_or_clear_progress(None::<OperationProgress>);
6958    /// ```
6959    pub fn set_or_clear_progress<T>(mut self, v: std::option::Option<T>) -> Self
6960    where
6961        T: std::convert::Into<crate::model::OperationProgress>,
6962    {
6963        self.progress = v.map(|x| x.into());
6964        self
6965    }
6966}
6967
6968impl wkt::message::Message for OptimizeRestoredDatabaseMetadata {
6969    fn typename() -> &'static str {
6970        "type.googleapis.com/google.spanner.admin.database.v1.OptimizeRestoredDatabaseMetadata"
6971    }
6972}
6973
6974/// A Cloud Spanner database role.
6975#[derive(Clone, Default, PartialEq)]
6976#[non_exhaustive]
6977pub struct DatabaseRole {
6978    /// Required. The name of the database role. Values are of the form
6979    /// `projects/<project>/instances/<instance>/databases/<database>/databaseRoles/<role>`
6980    /// where `<role>` is as specified in the `CREATE ROLE` DDL statement.
6981    pub name: std::string::String,
6982
6983    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
6984}
6985
6986impl DatabaseRole {
6987    /// Creates a new default instance.
6988    pub fn new() -> Self {
6989        std::default::Default::default()
6990    }
6991
6992    /// Sets the value of [name][crate::model::DatabaseRole::name].
6993    ///
6994    /// # Example
6995    /// ```ignore,no_run
6996    /// # use google_cloud_spanner_admin_database_v1::model::DatabaseRole;
6997    /// # let project_id = "project_id";
6998    /// # let instance_id = "instance_id";
6999    /// # let database_id = "database_id";
7000    /// # let role_id = "role_id";
7001    /// let x = DatabaseRole::new().set_name(format!("projects/{project_id}/instances/{instance_id}/databases/{database_id}/databaseRoles/{role_id}"));
7002    /// ```
7003    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
7004        self.name = v.into();
7005        self
7006    }
7007}
7008
7009impl wkt::message::Message for DatabaseRole {
7010    fn typename() -> &'static str {
7011        "type.googleapis.com/google.spanner.admin.database.v1.DatabaseRole"
7012    }
7013}
7014
7015/// The request for
7016/// [ListDatabaseRoles][google.spanner.admin.database.v1.DatabaseAdmin.ListDatabaseRoles].
7017///
7018/// [google.spanner.admin.database.v1.DatabaseAdmin.ListDatabaseRoles]: crate::client::DatabaseAdmin::list_database_roles
7019#[derive(Clone, Default, PartialEq)]
7020#[non_exhaustive]
7021pub struct ListDatabaseRolesRequest {
7022    /// Required. The database whose roles should be listed.
7023    /// Values are of the form
7024    /// `projects/<project>/instances/<instance>/databases/<database>`.
7025    pub parent: std::string::String,
7026
7027    /// Number of database roles to be returned in the response. If 0 or less,
7028    /// defaults to the server's maximum allowed page size.
7029    pub page_size: i32,
7030
7031    /// If non-empty, `page_token` should contain a
7032    /// [next_page_token][google.spanner.admin.database.v1.ListDatabaseRolesResponse.next_page_token]
7033    /// from a previous
7034    /// [ListDatabaseRolesResponse][google.spanner.admin.database.v1.ListDatabaseRolesResponse].
7035    ///
7036    /// [google.spanner.admin.database.v1.ListDatabaseRolesResponse]: crate::model::ListDatabaseRolesResponse
7037    /// [google.spanner.admin.database.v1.ListDatabaseRolesResponse.next_page_token]: crate::model::ListDatabaseRolesResponse::next_page_token
7038    pub page_token: std::string::String,
7039
7040    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
7041}
7042
7043impl ListDatabaseRolesRequest {
7044    /// Creates a new default instance.
7045    pub fn new() -> Self {
7046        std::default::Default::default()
7047    }
7048
7049    /// Sets the value of [parent][crate::model::ListDatabaseRolesRequest::parent].
7050    ///
7051    /// # Example
7052    /// ```ignore,no_run
7053    /// # use google_cloud_spanner_admin_database_v1::model::ListDatabaseRolesRequest;
7054    /// # let project_id = "project_id";
7055    /// # let instance_id = "instance_id";
7056    /// # let database_id = "database_id";
7057    /// let x = ListDatabaseRolesRequest::new().set_parent(format!("projects/{project_id}/instances/{instance_id}/databases/{database_id}"));
7058    /// ```
7059    pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
7060        self.parent = v.into();
7061        self
7062    }
7063
7064    /// Sets the value of [page_size][crate::model::ListDatabaseRolesRequest::page_size].
7065    ///
7066    /// # Example
7067    /// ```ignore,no_run
7068    /// # use google_cloud_spanner_admin_database_v1::model::ListDatabaseRolesRequest;
7069    /// let x = ListDatabaseRolesRequest::new().set_page_size(42);
7070    /// ```
7071    pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
7072        self.page_size = v.into();
7073        self
7074    }
7075
7076    /// Sets the value of [page_token][crate::model::ListDatabaseRolesRequest::page_token].
7077    ///
7078    /// # Example
7079    /// ```ignore,no_run
7080    /// # use google_cloud_spanner_admin_database_v1::model::ListDatabaseRolesRequest;
7081    /// let x = ListDatabaseRolesRequest::new().set_page_token("example");
7082    /// ```
7083    pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
7084        self.page_token = v.into();
7085        self
7086    }
7087}
7088
7089impl wkt::message::Message for ListDatabaseRolesRequest {
7090    fn typename() -> &'static str {
7091        "type.googleapis.com/google.spanner.admin.database.v1.ListDatabaseRolesRequest"
7092    }
7093}
7094
7095/// The response for
7096/// [ListDatabaseRoles][google.spanner.admin.database.v1.DatabaseAdmin.ListDatabaseRoles].
7097///
7098/// [google.spanner.admin.database.v1.DatabaseAdmin.ListDatabaseRoles]: crate::client::DatabaseAdmin::list_database_roles
7099#[derive(Clone, Default, PartialEq)]
7100#[non_exhaustive]
7101pub struct ListDatabaseRolesResponse {
7102    /// Database roles that matched the request.
7103    pub database_roles: std::vec::Vec<crate::model::DatabaseRole>,
7104
7105    /// `next_page_token` can be sent in a subsequent
7106    /// [ListDatabaseRoles][google.spanner.admin.database.v1.DatabaseAdmin.ListDatabaseRoles]
7107    /// call to fetch more of the matching roles.
7108    ///
7109    /// [google.spanner.admin.database.v1.DatabaseAdmin.ListDatabaseRoles]: crate::client::DatabaseAdmin::list_database_roles
7110    pub next_page_token: std::string::String,
7111
7112    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
7113}
7114
7115impl ListDatabaseRolesResponse {
7116    /// Creates a new default instance.
7117    pub fn new() -> Self {
7118        std::default::Default::default()
7119    }
7120
7121    /// Sets the value of [database_roles][crate::model::ListDatabaseRolesResponse::database_roles].
7122    ///
7123    /// # Example
7124    /// ```ignore,no_run
7125    /// # use google_cloud_spanner_admin_database_v1::model::ListDatabaseRolesResponse;
7126    /// use google_cloud_spanner_admin_database_v1::model::DatabaseRole;
7127    /// let x = ListDatabaseRolesResponse::new()
7128    ///     .set_database_roles([
7129    ///         DatabaseRole::default()/* use setters */,
7130    ///         DatabaseRole::default()/* use (different) setters */,
7131    ///     ]);
7132    /// ```
7133    pub fn set_database_roles<T, V>(mut self, v: T) -> Self
7134    where
7135        T: std::iter::IntoIterator<Item = V>,
7136        V: std::convert::Into<crate::model::DatabaseRole>,
7137    {
7138        use std::iter::Iterator;
7139        self.database_roles = v.into_iter().map(|i| i.into()).collect();
7140        self
7141    }
7142
7143    /// Sets the value of [next_page_token][crate::model::ListDatabaseRolesResponse::next_page_token].
7144    ///
7145    /// # Example
7146    /// ```ignore,no_run
7147    /// # use google_cloud_spanner_admin_database_v1::model::ListDatabaseRolesResponse;
7148    /// let x = ListDatabaseRolesResponse::new().set_next_page_token("example");
7149    /// ```
7150    pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
7151        self.next_page_token = v.into();
7152        self
7153    }
7154}
7155
7156impl wkt::message::Message for ListDatabaseRolesResponse {
7157    fn typename() -> &'static str {
7158        "type.googleapis.com/google.spanner.admin.database.v1.ListDatabaseRolesResponse"
7159    }
7160}
7161
7162#[doc(hidden)]
7163impl google_cloud_gax::paginator::internal::PageableResponse for ListDatabaseRolesResponse {
7164    type PageItem = crate::model::DatabaseRole;
7165
7166    fn items(self) -> std::vec::Vec<Self::PageItem> {
7167        self.database_roles
7168    }
7169
7170    fn next_page_token(&self) -> std::string::String {
7171        use std::clone::Clone;
7172        self.next_page_token.clone()
7173    }
7174}
7175
7176/// The request for
7177/// [AddSplitPoints][google.spanner.admin.database.v1.DatabaseAdmin.AddSplitPoints].
7178///
7179/// [google.spanner.admin.database.v1.DatabaseAdmin.AddSplitPoints]: crate::client::DatabaseAdmin::add_split_points
7180#[derive(Clone, Default, PartialEq)]
7181#[non_exhaustive]
7182pub struct AddSplitPointsRequest {
7183    /// Required. The database on whose tables/indexes split points are to be
7184    /// added. Values are of the form
7185    /// `projects/<project>/instances/<instance>/databases/<database>`.
7186    pub database: std::string::String,
7187
7188    /// Required. The split points to add.
7189    pub split_points: std::vec::Vec<crate::model::SplitPoints>,
7190
7191    /// Optional. A user-supplied tag associated with the split points.
7192    /// For example, "intital_data_load", "special_event_1".
7193    /// Defaults to "CloudAddSplitPointsAPI" if not specified.
7194    /// The length of the tag must not exceed 50 characters,else will be trimmed.
7195    /// Only valid UTF8 characters are allowed.
7196    pub initiator: std::string::String,
7197
7198    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
7199}
7200
7201impl AddSplitPointsRequest {
7202    /// Creates a new default instance.
7203    pub fn new() -> Self {
7204        std::default::Default::default()
7205    }
7206
7207    /// Sets the value of [database][crate::model::AddSplitPointsRequest::database].
7208    ///
7209    /// # Example
7210    /// ```ignore,no_run
7211    /// # use google_cloud_spanner_admin_database_v1::model::AddSplitPointsRequest;
7212    /// # let project_id = "project_id";
7213    /// # let instance_id = "instance_id";
7214    /// # let database_id = "database_id";
7215    /// let x = AddSplitPointsRequest::new().set_database(format!("projects/{project_id}/instances/{instance_id}/databases/{database_id}"));
7216    /// ```
7217    pub fn set_database<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
7218        self.database = v.into();
7219        self
7220    }
7221
7222    /// Sets the value of [split_points][crate::model::AddSplitPointsRequest::split_points].
7223    ///
7224    /// # Example
7225    /// ```ignore,no_run
7226    /// # use google_cloud_spanner_admin_database_v1::model::AddSplitPointsRequest;
7227    /// use google_cloud_spanner_admin_database_v1::model::SplitPoints;
7228    /// let x = AddSplitPointsRequest::new()
7229    ///     .set_split_points([
7230    ///         SplitPoints::default()/* use setters */,
7231    ///         SplitPoints::default()/* use (different) setters */,
7232    ///     ]);
7233    /// ```
7234    pub fn set_split_points<T, V>(mut self, v: T) -> Self
7235    where
7236        T: std::iter::IntoIterator<Item = V>,
7237        V: std::convert::Into<crate::model::SplitPoints>,
7238    {
7239        use std::iter::Iterator;
7240        self.split_points = v.into_iter().map(|i| i.into()).collect();
7241        self
7242    }
7243
7244    /// Sets the value of [initiator][crate::model::AddSplitPointsRequest::initiator].
7245    ///
7246    /// # Example
7247    /// ```ignore,no_run
7248    /// # use google_cloud_spanner_admin_database_v1::model::AddSplitPointsRequest;
7249    /// let x = AddSplitPointsRequest::new().set_initiator("example");
7250    /// ```
7251    pub fn set_initiator<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
7252        self.initiator = v.into();
7253        self
7254    }
7255}
7256
7257impl wkt::message::Message for AddSplitPointsRequest {
7258    fn typename() -> &'static str {
7259        "type.googleapis.com/google.spanner.admin.database.v1.AddSplitPointsRequest"
7260    }
7261}
7262
7263/// The response for
7264/// [AddSplitPoints][google.spanner.admin.database.v1.DatabaseAdmin.AddSplitPoints].
7265///
7266/// [google.spanner.admin.database.v1.DatabaseAdmin.AddSplitPoints]: crate::client::DatabaseAdmin::add_split_points
7267#[derive(Clone, Default, PartialEq)]
7268#[non_exhaustive]
7269pub struct AddSplitPointsResponse {
7270    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
7271}
7272
7273impl AddSplitPointsResponse {
7274    /// Creates a new default instance.
7275    pub fn new() -> Self {
7276        std::default::Default::default()
7277    }
7278}
7279
7280impl wkt::message::Message for AddSplitPointsResponse {
7281    fn typename() -> &'static str {
7282        "type.googleapis.com/google.spanner.admin.database.v1.AddSplitPointsResponse"
7283    }
7284}
7285
7286/// The split points of a table/index.
7287#[derive(Clone, Default, PartialEq)]
7288#[non_exhaustive]
7289pub struct SplitPoints {
7290    /// The table to split.
7291    pub table: std::string::String,
7292
7293    /// The index to split.
7294    /// If specified, the `table` field must refer to the index's base table.
7295    pub index: std::string::String,
7296
7297    /// Required. The list of split keys, i.e., the split boundaries.
7298    pub keys: std::vec::Vec<crate::model::split_points::Key>,
7299
7300    /// Optional. The expiration timestamp of the split points.
7301    /// A timestamp in the past means immediate expiration.
7302    /// The maximum value can be 30 days in the future.
7303    /// Defaults to 10 days in the future if not specified.
7304    pub expire_time: std::option::Option<wkt::Timestamp>,
7305
7306    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
7307}
7308
7309impl SplitPoints {
7310    /// Creates a new default instance.
7311    pub fn new() -> Self {
7312        std::default::Default::default()
7313    }
7314
7315    /// Sets the value of [table][crate::model::SplitPoints::table].
7316    ///
7317    /// # Example
7318    /// ```ignore,no_run
7319    /// # use google_cloud_spanner_admin_database_v1::model::SplitPoints;
7320    /// let x = SplitPoints::new().set_table("example");
7321    /// ```
7322    pub fn set_table<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
7323        self.table = v.into();
7324        self
7325    }
7326
7327    /// Sets the value of [index][crate::model::SplitPoints::index].
7328    ///
7329    /// # Example
7330    /// ```ignore,no_run
7331    /// # use google_cloud_spanner_admin_database_v1::model::SplitPoints;
7332    /// let x = SplitPoints::new().set_index("example");
7333    /// ```
7334    pub fn set_index<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
7335        self.index = v.into();
7336        self
7337    }
7338
7339    /// Sets the value of [keys][crate::model::SplitPoints::keys].
7340    ///
7341    /// # Example
7342    /// ```ignore,no_run
7343    /// # use google_cloud_spanner_admin_database_v1::model::SplitPoints;
7344    /// use google_cloud_spanner_admin_database_v1::model::split_points::Key;
7345    /// let x = SplitPoints::new()
7346    ///     .set_keys([
7347    ///         Key::default()/* use setters */,
7348    ///         Key::default()/* use (different) setters */,
7349    ///     ]);
7350    /// ```
7351    pub fn set_keys<T, V>(mut self, v: T) -> Self
7352    where
7353        T: std::iter::IntoIterator<Item = V>,
7354        V: std::convert::Into<crate::model::split_points::Key>,
7355    {
7356        use std::iter::Iterator;
7357        self.keys = v.into_iter().map(|i| i.into()).collect();
7358        self
7359    }
7360
7361    /// Sets the value of [expire_time][crate::model::SplitPoints::expire_time].
7362    ///
7363    /// # Example
7364    /// ```ignore,no_run
7365    /// # use google_cloud_spanner_admin_database_v1::model::SplitPoints;
7366    /// use wkt::Timestamp;
7367    /// let x = SplitPoints::new().set_expire_time(Timestamp::default()/* use setters */);
7368    /// ```
7369    pub fn set_expire_time<T>(mut self, v: T) -> Self
7370    where
7371        T: std::convert::Into<wkt::Timestamp>,
7372    {
7373        self.expire_time = std::option::Option::Some(v.into());
7374        self
7375    }
7376
7377    /// Sets or clears the value of [expire_time][crate::model::SplitPoints::expire_time].
7378    ///
7379    /// # Example
7380    /// ```ignore,no_run
7381    /// # use google_cloud_spanner_admin_database_v1::model::SplitPoints;
7382    /// use wkt::Timestamp;
7383    /// let x = SplitPoints::new().set_or_clear_expire_time(Some(Timestamp::default()/* use setters */));
7384    /// let x = SplitPoints::new().set_or_clear_expire_time(None::<Timestamp>);
7385    /// ```
7386    pub fn set_or_clear_expire_time<T>(mut self, v: std::option::Option<T>) -> Self
7387    where
7388        T: std::convert::Into<wkt::Timestamp>,
7389    {
7390        self.expire_time = v.map(|x| x.into());
7391        self
7392    }
7393}
7394
7395impl wkt::message::Message for SplitPoints {
7396    fn typename() -> &'static str {
7397        "type.googleapis.com/google.spanner.admin.database.v1.SplitPoints"
7398    }
7399}
7400
7401/// Defines additional types related to [SplitPoints].
7402pub mod split_points {
7403    #[allow(unused_imports)]
7404    use super::*;
7405
7406    /// A split key.
7407    #[derive(Clone, Default, PartialEq)]
7408    #[non_exhaustive]
7409    pub struct Key {
7410        /// Required. The column values making up the split key.
7411        pub key_parts: std::option::Option<wkt::ListValue>,
7412
7413        pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
7414    }
7415
7416    impl Key {
7417        /// Creates a new default instance.
7418        pub fn new() -> Self {
7419            std::default::Default::default()
7420        }
7421
7422        /// Sets the value of [key_parts][crate::model::split_points::Key::key_parts].
7423        ///
7424        /// # Example
7425        /// ```ignore,no_run
7426        /// # use google_cloud_spanner_admin_database_v1::model::split_points::Key;
7427        /// use wkt::ListValue;
7428        /// let x = Key::new().set_key_parts(ListValue::default()/* use setters */);
7429        /// ```
7430        pub fn set_key_parts<T>(mut self, v: T) -> Self
7431        where
7432            T: std::convert::Into<wkt::ListValue>,
7433        {
7434            self.key_parts = std::option::Option::Some(v.into());
7435            self
7436        }
7437
7438        /// Sets or clears the value of [key_parts][crate::model::split_points::Key::key_parts].
7439        ///
7440        /// # Example
7441        /// ```ignore,no_run
7442        /// # use google_cloud_spanner_admin_database_v1::model::split_points::Key;
7443        /// use wkt::ListValue;
7444        /// let x = Key::new().set_or_clear_key_parts(Some(ListValue::default()/* use setters */));
7445        /// let x = Key::new().set_or_clear_key_parts(None::<ListValue>);
7446        /// ```
7447        pub fn set_or_clear_key_parts<T>(mut self, v: std::option::Option<T>) -> Self
7448        where
7449            T: std::convert::Into<wkt::ListValue>,
7450        {
7451            self.key_parts = v.map(|x| x.into());
7452            self
7453        }
7454    }
7455
7456    impl wkt::message::Message for Key {
7457        fn typename() -> &'static str {
7458            "type.googleapis.com/google.spanner.admin.database.v1.SplitPoints.Key"
7459        }
7460    }
7461}
7462
7463/// Indicates the dialect type of a database.
7464///
7465/// # Working with unknown values
7466///
7467/// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
7468/// additional enum variants at any time. Adding new variants is not considered
7469/// a breaking change. Applications should write their code in anticipation of:
7470///
7471/// - New values appearing in future releases of the client library, **and**
7472/// - New values received dynamically, without application changes.
7473///
7474/// Please consult the [Working with enums] section in the user guide for some
7475/// guidelines.
7476///
7477/// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
7478#[derive(Clone, Debug, PartialEq)]
7479#[non_exhaustive]
7480pub enum DatabaseDialect {
7481    /// Default value. This value will create a database with the
7482    /// GOOGLE_STANDARD_SQL dialect.
7483    Unspecified,
7484    /// GoogleSQL supported SQL.
7485    GoogleStandardSql,
7486    /// PostgreSQL supported SQL.
7487    Postgresql,
7488    /// If set, the enum was initialized with an unknown value.
7489    ///
7490    /// Applications can examine the value using [DatabaseDialect::value] or
7491    /// [DatabaseDialect::name].
7492    UnknownValue(database_dialect::UnknownValue),
7493}
7494
7495#[doc(hidden)]
7496pub mod database_dialect {
7497    #[allow(unused_imports)]
7498    use super::*;
7499    #[derive(Clone, Debug, PartialEq)]
7500    pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
7501}
7502
7503impl DatabaseDialect {
7504    /// Gets the enum value.
7505    ///
7506    /// Returns `None` if the enum contains an unknown value deserialized from
7507    /// the string representation of enums.
7508    pub fn value(&self) -> std::option::Option<i32> {
7509        match self {
7510            Self::Unspecified => std::option::Option::Some(0),
7511            Self::GoogleStandardSql => std::option::Option::Some(1),
7512            Self::Postgresql => std::option::Option::Some(2),
7513            Self::UnknownValue(u) => u.0.value(),
7514        }
7515    }
7516
7517    /// Gets the enum value as a string.
7518    ///
7519    /// Returns `None` if the enum contains an unknown value deserialized from
7520    /// the integer representation of enums.
7521    pub fn name(&self) -> std::option::Option<&str> {
7522        match self {
7523            Self::Unspecified => std::option::Option::Some("DATABASE_DIALECT_UNSPECIFIED"),
7524            Self::GoogleStandardSql => std::option::Option::Some("GOOGLE_STANDARD_SQL"),
7525            Self::Postgresql => std::option::Option::Some("POSTGRESQL"),
7526            Self::UnknownValue(u) => u.0.name(),
7527        }
7528    }
7529}
7530
7531impl std::default::Default for DatabaseDialect {
7532    fn default() -> Self {
7533        use std::convert::From;
7534        Self::from(0)
7535    }
7536}
7537
7538impl std::fmt::Display for DatabaseDialect {
7539    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
7540        wkt::internal::display_enum(f, self.name(), self.value())
7541    }
7542}
7543
7544impl std::convert::From<i32> for DatabaseDialect {
7545    fn from(value: i32) -> Self {
7546        match value {
7547            0 => Self::Unspecified,
7548            1 => Self::GoogleStandardSql,
7549            2 => Self::Postgresql,
7550            _ => Self::UnknownValue(database_dialect::UnknownValue(
7551                wkt::internal::UnknownEnumValue::Integer(value),
7552            )),
7553        }
7554    }
7555}
7556
7557impl std::convert::From<&str> for DatabaseDialect {
7558    fn from(value: &str) -> Self {
7559        use std::string::ToString;
7560        match value {
7561            "DATABASE_DIALECT_UNSPECIFIED" => Self::Unspecified,
7562            "GOOGLE_STANDARD_SQL" => Self::GoogleStandardSql,
7563            "POSTGRESQL" => Self::Postgresql,
7564            _ => Self::UnknownValue(database_dialect::UnknownValue(
7565                wkt::internal::UnknownEnumValue::String(value.to_string()),
7566            )),
7567        }
7568    }
7569}
7570
7571impl serde::ser::Serialize for DatabaseDialect {
7572    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
7573    where
7574        S: serde::Serializer,
7575    {
7576        match self {
7577            Self::Unspecified => serializer.serialize_i32(0),
7578            Self::GoogleStandardSql => serializer.serialize_i32(1),
7579            Self::Postgresql => serializer.serialize_i32(2),
7580            Self::UnknownValue(u) => u.0.serialize(serializer),
7581        }
7582    }
7583}
7584
7585impl<'de> serde::de::Deserialize<'de> for DatabaseDialect {
7586    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
7587    where
7588        D: serde::Deserializer<'de>,
7589    {
7590        deserializer.deserialize_any(wkt::internal::EnumVisitor::<DatabaseDialect>::new(
7591            ".google.spanner.admin.database.v1.DatabaseDialect",
7592        ))
7593    }
7594}
7595
7596/// Indicates the type of the restore source.
7597///
7598/// # Working with unknown values
7599///
7600/// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
7601/// additional enum variants at any time. Adding new variants is not considered
7602/// a breaking change. Applications should write their code in anticipation of:
7603///
7604/// - New values appearing in future releases of the client library, **and**
7605/// - New values received dynamically, without application changes.
7606///
7607/// Please consult the [Working with enums] section in the user guide for some
7608/// guidelines.
7609///
7610/// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
7611#[derive(Clone, Debug, PartialEq)]
7612#[non_exhaustive]
7613pub enum RestoreSourceType {
7614    /// No restore associated.
7615    TypeUnspecified,
7616    /// A backup was used as the source of the restore.
7617    Backup,
7618    /// If set, the enum was initialized with an unknown value.
7619    ///
7620    /// Applications can examine the value using [RestoreSourceType::value] or
7621    /// [RestoreSourceType::name].
7622    UnknownValue(restore_source_type::UnknownValue),
7623}
7624
7625#[doc(hidden)]
7626pub mod restore_source_type {
7627    #[allow(unused_imports)]
7628    use super::*;
7629    #[derive(Clone, Debug, PartialEq)]
7630    pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
7631}
7632
7633impl RestoreSourceType {
7634    /// Gets the enum value.
7635    ///
7636    /// Returns `None` if the enum contains an unknown value deserialized from
7637    /// the string representation of enums.
7638    pub fn value(&self) -> std::option::Option<i32> {
7639        match self {
7640            Self::TypeUnspecified => std::option::Option::Some(0),
7641            Self::Backup => std::option::Option::Some(1),
7642            Self::UnknownValue(u) => u.0.value(),
7643        }
7644    }
7645
7646    /// Gets the enum value as a string.
7647    ///
7648    /// Returns `None` if the enum contains an unknown value deserialized from
7649    /// the integer representation of enums.
7650    pub fn name(&self) -> std::option::Option<&str> {
7651        match self {
7652            Self::TypeUnspecified => std::option::Option::Some("TYPE_UNSPECIFIED"),
7653            Self::Backup => std::option::Option::Some("BACKUP"),
7654            Self::UnknownValue(u) => u.0.name(),
7655        }
7656    }
7657}
7658
7659impl std::default::Default for RestoreSourceType {
7660    fn default() -> Self {
7661        use std::convert::From;
7662        Self::from(0)
7663    }
7664}
7665
7666impl std::fmt::Display for RestoreSourceType {
7667    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
7668        wkt::internal::display_enum(f, self.name(), self.value())
7669    }
7670}
7671
7672impl std::convert::From<i32> for RestoreSourceType {
7673    fn from(value: i32) -> Self {
7674        match value {
7675            0 => Self::TypeUnspecified,
7676            1 => Self::Backup,
7677            _ => Self::UnknownValue(restore_source_type::UnknownValue(
7678                wkt::internal::UnknownEnumValue::Integer(value),
7679            )),
7680        }
7681    }
7682}
7683
7684impl std::convert::From<&str> for RestoreSourceType {
7685    fn from(value: &str) -> Self {
7686        use std::string::ToString;
7687        match value {
7688            "TYPE_UNSPECIFIED" => Self::TypeUnspecified,
7689            "BACKUP" => Self::Backup,
7690            _ => Self::UnknownValue(restore_source_type::UnknownValue(
7691                wkt::internal::UnknownEnumValue::String(value.to_string()),
7692            )),
7693        }
7694    }
7695}
7696
7697impl serde::ser::Serialize for RestoreSourceType {
7698    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
7699    where
7700        S: serde::Serializer,
7701    {
7702        match self {
7703            Self::TypeUnspecified => serializer.serialize_i32(0),
7704            Self::Backup => serializer.serialize_i32(1),
7705            Self::UnknownValue(u) => u.0.serialize(serializer),
7706        }
7707    }
7708}
7709
7710impl<'de> serde::de::Deserialize<'de> for RestoreSourceType {
7711    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
7712    where
7713        D: serde::Deserializer<'de>,
7714    {
7715        deserializer.deserialize_any(wkt::internal::EnumVisitor::<RestoreSourceType>::new(
7716            ".google.spanner.admin.database.v1.RestoreSourceType",
7717        ))
7718    }
7719}