google_cloud_spanner_admin_database_v1/
model.rs

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