Skip to main content

google_cloud_spanner_admin_database_v1/
model.rs

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