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