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