google_cloud_spanner_admin_database_v1/
model.rs

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