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