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