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