google_cloud_gkebackup_v1/model.rs
1// Copyright 2025 Google LLC
2//
3// Licensed under the Apache License, Version 2.0 (the "License");
4// you may not use this file except in compliance with the License.
5// You may obtain a copy of the License at
6//
7// https://www.apache.org/licenses/LICENSE-2.0
8//
9// Unless required by applicable law or agreed to in writing, software
10// distributed under the License is distributed on an "AS IS" BASIS,
11// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12// See the License for the specific language governing permissions and
13// limitations under the License.
14//
15// Code generated by sidekick. DO NOT EDIT.
16
17#![allow(rustdoc::redundant_explicit_links)]
18#![allow(rustdoc::broken_intra_doc_links)]
19#![no_implicit_prelude]
20extern crate async_trait;
21extern crate bytes;
22extern crate gaxi;
23extern crate google_cloud_gax;
24extern crate google_cloud_iam_v1;
25extern crate google_cloud_location;
26extern crate google_cloud_longrunning;
27extern crate google_cloud_lro;
28extern crate google_cloud_type;
29extern crate lazy_static;
30extern crate serde;
31extern crate serde_json;
32extern crate serde_with;
33extern crate std;
34extern crate tracing;
35extern crate wkt;
36
37mod debug;
38mod deserialize;
39mod serialize;
40
41/// Represents a request to perform a single point-in-time capture of
42/// some portion of the state of a GKE cluster, the record of the backup
43/// operation itself, and an anchor for the underlying artifacts that
44/// comprise the Backup (the config backup and VolumeBackups).
45#[derive(Clone, Default, PartialEq)]
46#[non_exhaustive]
47pub struct Backup {
48 /// Output only. The fully qualified name of the Backup.
49 /// `projects/*/locations/*/backupPlans/*/backups/*`
50 pub name: std::string::String,
51
52 /// Output only. Server generated global unique identifier of
53 /// [UUID4](https://en.wikipedia.org/wiki/Universally_unique_identifier)
54 pub uid: std::string::String,
55
56 /// Output only. The timestamp when this Backup resource was created.
57 pub create_time: std::option::Option<wkt::Timestamp>,
58
59 /// Output only. The timestamp when this Backup resource was last updated.
60 pub update_time: std::option::Option<wkt::Timestamp>,
61
62 /// Output only. This flag indicates whether this Backup resource was created
63 /// manually by a user or via a schedule in the BackupPlan. A value of True
64 /// means that the Backup was created manually.
65 pub manual: bool,
66
67 /// Optional. A set of custom labels supplied by user.
68 pub labels: std::collections::HashMap<std::string::String, std::string::String>,
69
70 /// Optional. Minimum age for this Backup (in days). If this field is set to a
71 /// non-zero value, the Backup will be "locked" against deletion (either manual
72 /// or automatic deletion) for the number of days provided (measured from the
73 /// creation time of the Backup). MUST be an integer value between 0-90
74 /// (inclusive).
75 ///
76 /// Defaults to parent BackupPlan's
77 /// [backup_delete_lock_days][google.cloud.gkebackup.v1.BackupPlan.RetentionPolicy.backup_delete_lock_days]
78 /// setting and may only be increased
79 /// (either at creation time or in a subsequent update).
80 ///
81 /// [google.cloud.gkebackup.v1.BackupPlan.RetentionPolicy.backup_delete_lock_days]: crate::model::backup_plan::RetentionPolicy::backup_delete_lock_days
82 pub delete_lock_days: i32,
83
84 /// Output only. The time at which an existing delete lock will expire for this
85 /// backup (calculated from create_time +
86 /// [delete_lock_days][google.cloud.gkebackup.v1.Backup.delete_lock_days]).
87 ///
88 /// [google.cloud.gkebackup.v1.Backup.delete_lock_days]: crate::model::Backup::delete_lock_days
89 pub delete_lock_expire_time: std::option::Option<wkt::Timestamp>,
90
91 /// Optional. The age (in days) after which this Backup will be automatically
92 /// deleted. Must be an integer value >= 0:
93 ///
94 /// - If 0, no automatic deletion will occur for this Backup.
95 /// - If not 0, this must be >=
96 /// [delete_lock_days][google.cloud.gkebackup.v1.Backup.delete_lock_days] and
97 /// <= 365.
98 ///
99 /// Once a Backup is created, this value may only be increased.
100 ///
101 /// Defaults to the parent BackupPlan's
102 /// [backup_retain_days][google.cloud.gkebackup.v1.BackupPlan.RetentionPolicy.backup_retain_days]
103 /// value.
104 ///
105 /// [google.cloud.gkebackup.v1.Backup.delete_lock_days]: crate::model::Backup::delete_lock_days
106 /// [google.cloud.gkebackup.v1.BackupPlan.RetentionPolicy.backup_retain_days]: crate::model::backup_plan::RetentionPolicy::backup_retain_days
107 pub retain_days: i32,
108
109 /// Output only. The time at which this Backup will be automatically deleted
110 /// (calculated from create_time +
111 /// [retain_days][google.cloud.gkebackup.v1.Backup.retain_days]).
112 ///
113 /// [google.cloud.gkebackup.v1.Backup.retain_days]: crate::model::Backup::retain_days
114 pub retain_expire_time: std::option::Option<wkt::Timestamp>,
115
116 /// Output only. The customer managed encryption key that was used to encrypt
117 /// the Backup's artifacts. Inherited from the parent BackupPlan's
118 /// [encryption_key][google.cloud.gkebackup.v1.BackupPlan.BackupConfig.encryption_key]
119 /// value.
120 ///
121 /// [google.cloud.gkebackup.v1.BackupPlan.BackupConfig.encryption_key]: crate::model::backup_plan::BackupConfig::encryption_key
122 pub encryption_key: std::option::Option<crate::model::EncryptionKey>,
123
124 /// Output only. Whether or not the Backup contains volume data. Controlled by
125 /// the parent BackupPlan's
126 /// [include_volume_data][google.cloud.gkebackup.v1.BackupPlan.BackupConfig.include_volume_data]
127 /// value.
128 ///
129 /// [google.cloud.gkebackup.v1.BackupPlan.BackupConfig.include_volume_data]: crate::model::backup_plan::BackupConfig::include_volume_data
130 pub contains_volume_data: bool,
131
132 /// Output only. Whether or not the Backup contains Kubernetes Secrets.
133 /// Controlled by the parent BackupPlan's
134 /// [include_secrets][google.cloud.gkebackup.v1.BackupPlan.BackupConfig.include_secrets]
135 /// value.
136 ///
137 /// [google.cloud.gkebackup.v1.BackupPlan.BackupConfig.include_secrets]: crate::model::backup_plan::BackupConfig::include_secrets
138 pub contains_secrets: bool,
139
140 /// Output only. Information about the GKE cluster from which this Backup was
141 /// created.
142 pub cluster_metadata: std::option::Option<crate::model::backup::ClusterMetadata>,
143
144 /// Output only. Current state of the Backup
145 pub state: crate::model::backup::State,
146
147 /// Output only. Human-readable description of why the backup is in the current
148 /// `state`. This field is only meant for human readability and should not be
149 /// used programmatically as this field is not guaranteed to be consistent.
150 pub state_reason: std::string::String,
151
152 /// Output only. Completion time of the Backup
153 pub complete_time: std::option::Option<wkt::Timestamp>,
154
155 /// Output only. The total number of Kubernetes resources included in the
156 /// Backup.
157 pub resource_count: i32,
158
159 /// Output only. The total number of volume backups contained in the Backup.
160 pub volume_count: i32,
161
162 /// Output only. The total size of the Backup in bytes = config backup size +
163 /// sum(volume backup sizes)
164 pub size_bytes: i64,
165
166 /// Output only. `etag` is used for optimistic concurrency control as a way to
167 /// help prevent simultaneous updates of a backup from overwriting each other.
168 /// It is strongly suggested that systems make use of the `etag` in the
169 /// read-modify-write cycle to perform backup updates in order to avoid
170 /// race conditions: An `etag` is returned in the response to `GetBackup`,
171 /// and systems are expected to put that etag in the request to
172 /// `UpdateBackup` or `DeleteBackup` to ensure that their change will be
173 /// applied to the same version of the resource.
174 pub etag: std::string::String,
175
176 /// Optional. User specified descriptive string for this Backup.
177 pub description: std::string::String,
178
179 /// Output only. The total number of Kubernetes Pods contained in the Backup.
180 pub pod_count: i32,
181
182 /// Output only. The size of the config backup in bytes.
183 pub config_backup_size_bytes: i64,
184
185 /// Output only. If false, Backup will fail when Backup for GKE detects
186 /// Kubernetes configuration that is non-standard or
187 /// requires additional setup to restore.
188 ///
189 /// Inherited from the parent BackupPlan's
190 /// [permissive_mode][google.cloud.gkebackup.v1.BackupPlan.BackupConfig.permissive_mode]
191 /// value.
192 ///
193 /// [google.cloud.gkebackup.v1.BackupPlan.BackupConfig.permissive_mode]: crate::model::backup_plan::BackupConfig::permissive_mode
194 pub permissive_mode: bool,
195
196 /// Output only. [Output Only] Reserved for future use.
197 pub satisfies_pzs: bool,
198
199 /// Output only. [Output Only] Reserved for future use.
200 pub satisfies_pzi: bool,
201
202 /// Defines the "scope" of the Backup - which namespaced resources in the
203 /// cluster were included in the Backup. Inherited from the parent
204 /// BackupPlan's
205 /// [backup_scope][google.cloud.gkebackup.v1.BackupPlan.BackupConfig.backup_scope]
206 /// value.
207 ///
208 /// [google.cloud.gkebackup.v1.BackupPlan.BackupConfig.backup_scope]: crate::model::backup_plan::BackupConfig::backup_scope
209 pub backup_scope: std::option::Option<crate::model::backup::BackupScope>,
210
211 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
212}
213
214impl Backup {
215 pub fn new() -> Self {
216 std::default::Default::default()
217 }
218
219 /// Sets the value of [name][crate::model::Backup::name].
220 ///
221 /// # Example
222 /// ```ignore,no_run
223 /// # use google_cloud_gkebackup_v1::model::Backup;
224 /// let x = Backup::new().set_name("example");
225 /// ```
226 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
227 self.name = v.into();
228 self
229 }
230
231 /// Sets the value of [uid][crate::model::Backup::uid].
232 ///
233 /// # Example
234 /// ```ignore,no_run
235 /// # use google_cloud_gkebackup_v1::model::Backup;
236 /// let x = Backup::new().set_uid("example");
237 /// ```
238 pub fn set_uid<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
239 self.uid = v.into();
240 self
241 }
242
243 /// Sets the value of [create_time][crate::model::Backup::create_time].
244 ///
245 /// # Example
246 /// ```ignore,no_run
247 /// # use google_cloud_gkebackup_v1::model::Backup;
248 /// use wkt::Timestamp;
249 /// let x = Backup::new().set_create_time(Timestamp::default()/* use setters */);
250 /// ```
251 pub fn set_create_time<T>(mut self, v: T) -> Self
252 where
253 T: std::convert::Into<wkt::Timestamp>,
254 {
255 self.create_time = std::option::Option::Some(v.into());
256 self
257 }
258
259 /// Sets or clears the value of [create_time][crate::model::Backup::create_time].
260 ///
261 /// # Example
262 /// ```ignore,no_run
263 /// # use google_cloud_gkebackup_v1::model::Backup;
264 /// use wkt::Timestamp;
265 /// let x = Backup::new().set_or_clear_create_time(Some(Timestamp::default()/* use setters */));
266 /// let x = Backup::new().set_or_clear_create_time(None::<Timestamp>);
267 /// ```
268 pub fn set_or_clear_create_time<T>(mut self, v: std::option::Option<T>) -> Self
269 where
270 T: std::convert::Into<wkt::Timestamp>,
271 {
272 self.create_time = v.map(|x| x.into());
273 self
274 }
275
276 /// Sets the value of [update_time][crate::model::Backup::update_time].
277 ///
278 /// # Example
279 /// ```ignore,no_run
280 /// # use google_cloud_gkebackup_v1::model::Backup;
281 /// use wkt::Timestamp;
282 /// let x = Backup::new().set_update_time(Timestamp::default()/* use setters */);
283 /// ```
284 pub fn set_update_time<T>(mut self, v: T) -> Self
285 where
286 T: std::convert::Into<wkt::Timestamp>,
287 {
288 self.update_time = std::option::Option::Some(v.into());
289 self
290 }
291
292 /// Sets or clears the value of [update_time][crate::model::Backup::update_time].
293 ///
294 /// # Example
295 /// ```ignore,no_run
296 /// # use google_cloud_gkebackup_v1::model::Backup;
297 /// use wkt::Timestamp;
298 /// let x = Backup::new().set_or_clear_update_time(Some(Timestamp::default()/* use setters */));
299 /// let x = Backup::new().set_or_clear_update_time(None::<Timestamp>);
300 /// ```
301 pub fn set_or_clear_update_time<T>(mut self, v: std::option::Option<T>) -> Self
302 where
303 T: std::convert::Into<wkt::Timestamp>,
304 {
305 self.update_time = v.map(|x| x.into());
306 self
307 }
308
309 /// Sets the value of [manual][crate::model::Backup::manual].
310 ///
311 /// # Example
312 /// ```ignore,no_run
313 /// # use google_cloud_gkebackup_v1::model::Backup;
314 /// let x = Backup::new().set_manual(true);
315 /// ```
316 pub fn set_manual<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
317 self.manual = v.into();
318 self
319 }
320
321 /// Sets the value of [labels][crate::model::Backup::labels].
322 ///
323 /// # Example
324 /// ```ignore,no_run
325 /// # use google_cloud_gkebackup_v1::model::Backup;
326 /// let x = Backup::new().set_labels([
327 /// ("key0", "abc"),
328 /// ("key1", "xyz"),
329 /// ]);
330 /// ```
331 pub fn set_labels<T, K, V>(mut self, v: T) -> Self
332 where
333 T: std::iter::IntoIterator<Item = (K, V)>,
334 K: std::convert::Into<std::string::String>,
335 V: std::convert::Into<std::string::String>,
336 {
337 use std::iter::Iterator;
338 self.labels = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
339 self
340 }
341
342 /// Sets the value of [delete_lock_days][crate::model::Backup::delete_lock_days].
343 ///
344 /// # Example
345 /// ```ignore,no_run
346 /// # use google_cloud_gkebackup_v1::model::Backup;
347 /// let x = Backup::new().set_delete_lock_days(42);
348 /// ```
349 pub fn set_delete_lock_days<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
350 self.delete_lock_days = v.into();
351 self
352 }
353
354 /// Sets the value of [delete_lock_expire_time][crate::model::Backup::delete_lock_expire_time].
355 ///
356 /// # Example
357 /// ```ignore,no_run
358 /// # use google_cloud_gkebackup_v1::model::Backup;
359 /// use wkt::Timestamp;
360 /// let x = Backup::new().set_delete_lock_expire_time(Timestamp::default()/* use setters */);
361 /// ```
362 pub fn set_delete_lock_expire_time<T>(mut self, v: T) -> Self
363 where
364 T: std::convert::Into<wkt::Timestamp>,
365 {
366 self.delete_lock_expire_time = std::option::Option::Some(v.into());
367 self
368 }
369
370 /// Sets or clears the value of [delete_lock_expire_time][crate::model::Backup::delete_lock_expire_time].
371 ///
372 /// # Example
373 /// ```ignore,no_run
374 /// # use google_cloud_gkebackup_v1::model::Backup;
375 /// use wkt::Timestamp;
376 /// let x = Backup::new().set_or_clear_delete_lock_expire_time(Some(Timestamp::default()/* use setters */));
377 /// let x = Backup::new().set_or_clear_delete_lock_expire_time(None::<Timestamp>);
378 /// ```
379 pub fn set_or_clear_delete_lock_expire_time<T>(mut self, v: std::option::Option<T>) -> Self
380 where
381 T: std::convert::Into<wkt::Timestamp>,
382 {
383 self.delete_lock_expire_time = v.map(|x| x.into());
384 self
385 }
386
387 /// Sets the value of [retain_days][crate::model::Backup::retain_days].
388 ///
389 /// # Example
390 /// ```ignore,no_run
391 /// # use google_cloud_gkebackup_v1::model::Backup;
392 /// let x = Backup::new().set_retain_days(42);
393 /// ```
394 pub fn set_retain_days<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
395 self.retain_days = v.into();
396 self
397 }
398
399 /// Sets the value of [retain_expire_time][crate::model::Backup::retain_expire_time].
400 ///
401 /// # Example
402 /// ```ignore,no_run
403 /// # use google_cloud_gkebackup_v1::model::Backup;
404 /// use wkt::Timestamp;
405 /// let x = Backup::new().set_retain_expire_time(Timestamp::default()/* use setters */);
406 /// ```
407 pub fn set_retain_expire_time<T>(mut self, v: T) -> Self
408 where
409 T: std::convert::Into<wkt::Timestamp>,
410 {
411 self.retain_expire_time = std::option::Option::Some(v.into());
412 self
413 }
414
415 /// Sets or clears the value of [retain_expire_time][crate::model::Backup::retain_expire_time].
416 ///
417 /// # Example
418 /// ```ignore,no_run
419 /// # use google_cloud_gkebackup_v1::model::Backup;
420 /// use wkt::Timestamp;
421 /// let x = Backup::new().set_or_clear_retain_expire_time(Some(Timestamp::default()/* use setters */));
422 /// let x = Backup::new().set_or_clear_retain_expire_time(None::<Timestamp>);
423 /// ```
424 pub fn set_or_clear_retain_expire_time<T>(mut self, v: std::option::Option<T>) -> Self
425 where
426 T: std::convert::Into<wkt::Timestamp>,
427 {
428 self.retain_expire_time = v.map(|x| x.into());
429 self
430 }
431
432 /// Sets the value of [encryption_key][crate::model::Backup::encryption_key].
433 ///
434 /// # Example
435 /// ```ignore,no_run
436 /// # use google_cloud_gkebackup_v1::model::Backup;
437 /// use google_cloud_gkebackup_v1::model::EncryptionKey;
438 /// let x = Backup::new().set_encryption_key(EncryptionKey::default()/* use setters */);
439 /// ```
440 pub fn set_encryption_key<T>(mut self, v: T) -> Self
441 where
442 T: std::convert::Into<crate::model::EncryptionKey>,
443 {
444 self.encryption_key = std::option::Option::Some(v.into());
445 self
446 }
447
448 /// Sets or clears the value of [encryption_key][crate::model::Backup::encryption_key].
449 ///
450 /// # Example
451 /// ```ignore,no_run
452 /// # use google_cloud_gkebackup_v1::model::Backup;
453 /// use google_cloud_gkebackup_v1::model::EncryptionKey;
454 /// let x = Backup::new().set_or_clear_encryption_key(Some(EncryptionKey::default()/* use setters */));
455 /// let x = Backup::new().set_or_clear_encryption_key(None::<EncryptionKey>);
456 /// ```
457 pub fn set_or_clear_encryption_key<T>(mut self, v: std::option::Option<T>) -> Self
458 where
459 T: std::convert::Into<crate::model::EncryptionKey>,
460 {
461 self.encryption_key = v.map(|x| x.into());
462 self
463 }
464
465 /// Sets the value of [contains_volume_data][crate::model::Backup::contains_volume_data].
466 ///
467 /// # Example
468 /// ```ignore,no_run
469 /// # use google_cloud_gkebackup_v1::model::Backup;
470 /// let x = Backup::new().set_contains_volume_data(true);
471 /// ```
472 pub fn set_contains_volume_data<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
473 self.contains_volume_data = v.into();
474 self
475 }
476
477 /// Sets the value of [contains_secrets][crate::model::Backup::contains_secrets].
478 ///
479 /// # Example
480 /// ```ignore,no_run
481 /// # use google_cloud_gkebackup_v1::model::Backup;
482 /// let x = Backup::new().set_contains_secrets(true);
483 /// ```
484 pub fn set_contains_secrets<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
485 self.contains_secrets = v.into();
486 self
487 }
488
489 /// Sets the value of [cluster_metadata][crate::model::Backup::cluster_metadata].
490 ///
491 /// # Example
492 /// ```ignore,no_run
493 /// # use google_cloud_gkebackup_v1::model::Backup;
494 /// use google_cloud_gkebackup_v1::model::backup::ClusterMetadata;
495 /// let x = Backup::new().set_cluster_metadata(ClusterMetadata::default()/* use setters */);
496 /// ```
497 pub fn set_cluster_metadata<T>(mut self, v: T) -> Self
498 where
499 T: std::convert::Into<crate::model::backup::ClusterMetadata>,
500 {
501 self.cluster_metadata = std::option::Option::Some(v.into());
502 self
503 }
504
505 /// Sets or clears the value of [cluster_metadata][crate::model::Backup::cluster_metadata].
506 ///
507 /// # Example
508 /// ```ignore,no_run
509 /// # use google_cloud_gkebackup_v1::model::Backup;
510 /// use google_cloud_gkebackup_v1::model::backup::ClusterMetadata;
511 /// let x = Backup::new().set_or_clear_cluster_metadata(Some(ClusterMetadata::default()/* use setters */));
512 /// let x = Backup::new().set_or_clear_cluster_metadata(None::<ClusterMetadata>);
513 /// ```
514 pub fn set_or_clear_cluster_metadata<T>(mut self, v: std::option::Option<T>) -> Self
515 where
516 T: std::convert::Into<crate::model::backup::ClusterMetadata>,
517 {
518 self.cluster_metadata = v.map(|x| x.into());
519 self
520 }
521
522 /// Sets the value of [state][crate::model::Backup::state].
523 ///
524 /// # Example
525 /// ```ignore,no_run
526 /// # use google_cloud_gkebackup_v1::model::Backup;
527 /// use google_cloud_gkebackup_v1::model::backup::State;
528 /// let x0 = Backup::new().set_state(State::Creating);
529 /// let x1 = Backup::new().set_state(State::InProgress);
530 /// let x2 = Backup::new().set_state(State::Succeeded);
531 /// ```
532 pub fn set_state<T: std::convert::Into<crate::model::backup::State>>(mut self, v: T) -> Self {
533 self.state = v.into();
534 self
535 }
536
537 /// Sets the value of [state_reason][crate::model::Backup::state_reason].
538 ///
539 /// # Example
540 /// ```ignore,no_run
541 /// # use google_cloud_gkebackup_v1::model::Backup;
542 /// let x = Backup::new().set_state_reason("example");
543 /// ```
544 pub fn set_state_reason<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
545 self.state_reason = v.into();
546 self
547 }
548
549 /// Sets the value of [complete_time][crate::model::Backup::complete_time].
550 ///
551 /// # Example
552 /// ```ignore,no_run
553 /// # use google_cloud_gkebackup_v1::model::Backup;
554 /// use wkt::Timestamp;
555 /// let x = Backup::new().set_complete_time(Timestamp::default()/* use setters */);
556 /// ```
557 pub fn set_complete_time<T>(mut self, v: T) -> Self
558 where
559 T: std::convert::Into<wkt::Timestamp>,
560 {
561 self.complete_time = std::option::Option::Some(v.into());
562 self
563 }
564
565 /// Sets or clears the value of [complete_time][crate::model::Backup::complete_time].
566 ///
567 /// # Example
568 /// ```ignore,no_run
569 /// # use google_cloud_gkebackup_v1::model::Backup;
570 /// use wkt::Timestamp;
571 /// let x = Backup::new().set_or_clear_complete_time(Some(Timestamp::default()/* use setters */));
572 /// let x = Backup::new().set_or_clear_complete_time(None::<Timestamp>);
573 /// ```
574 pub fn set_or_clear_complete_time<T>(mut self, v: std::option::Option<T>) -> Self
575 where
576 T: std::convert::Into<wkt::Timestamp>,
577 {
578 self.complete_time = v.map(|x| x.into());
579 self
580 }
581
582 /// Sets the value of [resource_count][crate::model::Backup::resource_count].
583 ///
584 /// # Example
585 /// ```ignore,no_run
586 /// # use google_cloud_gkebackup_v1::model::Backup;
587 /// let x = Backup::new().set_resource_count(42);
588 /// ```
589 pub fn set_resource_count<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
590 self.resource_count = v.into();
591 self
592 }
593
594 /// Sets the value of [volume_count][crate::model::Backup::volume_count].
595 ///
596 /// # Example
597 /// ```ignore,no_run
598 /// # use google_cloud_gkebackup_v1::model::Backup;
599 /// let x = Backup::new().set_volume_count(42);
600 /// ```
601 pub fn set_volume_count<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
602 self.volume_count = v.into();
603 self
604 }
605
606 /// Sets the value of [size_bytes][crate::model::Backup::size_bytes].
607 ///
608 /// # Example
609 /// ```ignore,no_run
610 /// # use google_cloud_gkebackup_v1::model::Backup;
611 /// let x = Backup::new().set_size_bytes(42);
612 /// ```
613 pub fn set_size_bytes<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
614 self.size_bytes = v.into();
615 self
616 }
617
618 /// Sets the value of [etag][crate::model::Backup::etag].
619 ///
620 /// # Example
621 /// ```ignore,no_run
622 /// # use google_cloud_gkebackup_v1::model::Backup;
623 /// let x = Backup::new().set_etag("example");
624 /// ```
625 pub fn set_etag<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
626 self.etag = v.into();
627 self
628 }
629
630 /// Sets the value of [description][crate::model::Backup::description].
631 ///
632 /// # Example
633 /// ```ignore,no_run
634 /// # use google_cloud_gkebackup_v1::model::Backup;
635 /// let x = Backup::new().set_description("example");
636 /// ```
637 pub fn set_description<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
638 self.description = v.into();
639 self
640 }
641
642 /// Sets the value of [pod_count][crate::model::Backup::pod_count].
643 ///
644 /// # Example
645 /// ```ignore,no_run
646 /// # use google_cloud_gkebackup_v1::model::Backup;
647 /// let x = Backup::new().set_pod_count(42);
648 /// ```
649 pub fn set_pod_count<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
650 self.pod_count = v.into();
651 self
652 }
653
654 /// Sets the value of [config_backup_size_bytes][crate::model::Backup::config_backup_size_bytes].
655 ///
656 /// # Example
657 /// ```ignore,no_run
658 /// # use google_cloud_gkebackup_v1::model::Backup;
659 /// let x = Backup::new().set_config_backup_size_bytes(42);
660 /// ```
661 pub fn set_config_backup_size_bytes<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
662 self.config_backup_size_bytes = v.into();
663 self
664 }
665
666 /// Sets the value of [permissive_mode][crate::model::Backup::permissive_mode].
667 ///
668 /// # Example
669 /// ```ignore,no_run
670 /// # use google_cloud_gkebackup_v1::model::Backup;
671 /// let x = Backup::new().set_permissive_mode(true);
672 /// ```
673 pub fn set_permissive_mode<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
674 self.permissive_mode = v.into();
675 self
676 }
677
678 /// Sets the value of [satisfies_pzs][crate::model::Backup::satisfies_pzs].
679 ///
680 /// # Example
681 /// ```ignore,no_run
682 /// # use google_cloud_gkebackup_v1::model::Backup;
683 /// let x = Backup::new().set_satisfies_pzs(true);
684 /// ```
685 pub fn set_satisfies_pzs<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
686 self.satisfies_pzs = v.into();
687 self
688 }
689
690 /// Sets the value of [satisfies_pzi][crate::model::Backup::satisfies_pzi].
691 ///
692 /// # Example
693 /// ```ignore,no_run
694 /// # use google_cloud_gkebackup_v1::model::Backup;
695 /// let x = Backup::new().set_satisfies_pzi(true);
696 /// ```
697 pub fn set_satisfies_pzi<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
698 self.satisfies_pzi = v.into();
699 self
700 }
701
702 /// Sets the value of [backup_scope][crate::model::Backup::backup_scope].
703 ///
704 /// Note that all the setters affecting `backup_scope` are mutually
705 /// exclusive.
706 ///
707 /// # Example
708 /// ```ignore,no_run
709 /// # use google_cloud_gkebackup_v1::model::Backup;
710 /// use google_cloud_gkebackup_v1::model::backup::BackupScope;
711 /// let x = Backup::new().set_backup_scope(Some(BackupScope::AllNamespaces(true)));
712 /// ```
713 pub fn set_backup_scope<
714 T: std::convert::Into<std::option::Option<crate::model::backup::BackupScope>>,
715 >(
716 mut self,
717 v: T,
718 ) -> Self {
719 self.backup_scope = v.into();
720 self
721 }
722
723 /// The value of [backup_scope][crate::model::Backup::backup_scope]
724 /// if it holds a `AllNamespaces`, `None` if the field is not set or
725 /// holds a different branch.
726 pub fn all_namespaces(&self) -> std::option::Option<&bool> {
727 #[allow(unreachable_patterns)]
728 self.backup_scope.as_ref().and_then(|v| match v {
729 crate::model::backup::BackupScope::AllNamespaces(v) => std::option::Option::Some(v),
730 _ => std::option::Option::None,
731 })
732 }
733
734 /// Sets the value of [backup_scope][crate::model::Backup::backup_scope]
735 /// to hold a `AllNamespaces`.
736 ///
737 /// Note that all the setters affecting `backup_scope` are
738 /// mutually exclusive.
739 ///
740 /// # Example
741 /// ```ignore,no_run
742 /// # use google_cloud_gkebackup_v1::model::Backup;
743 /// let x = Backup::new().set_all_namespaces(true);
744 /// assert!(x.all_namespaces().is_some());
745 /// assert!(x.selected_namespaces().is_none());
746 /// assert!(x.selected_applications().is_none());
747 /// ```
748 pub fn set_all_namespaces<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
749 self.backup_scope =
750 std::option::Option::Some(crate::model::backup::BackupScope::AllNamespaces(v.into()));
751 self
752 }
753
754 /// The value of [backup_scope][crate::model::Backup::backup_scope]
755 /// if it holds a `SelectedNamespaces`, `None` if the field is not set or
756 /// holds a different branch.
757 pub fn selected_namespaces(
758 &self,
759 ) -> std::option::Option<&std::boxed::Box<crate::model::Namespaces>> {
760 #[allow(unreachable_patterns)]
761 self.backup_scope.as_ref().and_then(|v| match v {
762 crate::model::backup::BackupScope::SelectedNamespaces(v) => {
763 std::option::Option::Some(v)
764 }
765 _ => std::option::Option::None,
766 })
767 }
768
769 /// Sets the value of [backup_scope][crate::model::Backup::backup_scope]
770 /// to hold a `SelectedNamespaces`.
771 ///
772 /// Note that all the setters affecting `backup_scope` are
773 /// mutually exclusive.
774 ///
775 /// # Example
776 /// ```ignore,no_run
777 /// # use google_cloud_gkebackup_v1::model::Backup;
778 /// use google_cloud_gkebackup_v1::model::Namespaces;
779 /// let x = Backup::new().set_selected_namespaces(Namespaces::default()/* use setters */);
780 /// assert!(x.selected_namespaces().is_some());
781 /// assert!(x.all_namespaces().is_none());
782 /// assert!(x.selected_applications().is_none());
783 /// ```
784 pub fn set_selected_namespaces<
785 T: std::convert::Into<std::boxed::Box<crate::model::Namespaces>>,
786 >(
787 mut self,
788 v: T,
789 ) -> Self {
790 self.backup_scope = std::option::Option::Some(
791 crate::model::backup::BackupScope::SelectedNamespaces(v.into()),
792 );
793 self
794 }
795
796 /// The value of [backup_scope][crate::model::Backup::backup_scope]
797 /// if it holds a `SelectedApplications`, `None` if the field is not set or
798 /// holds a different branch.
799 pub fn selected_applications(
800 &self,
801 ) -> std::option::Option<&std::boxed::Box<crate::model::NamespacedNames>> {
802 #[allow(unreachable_patterns)]
803 self.backup_scope.as_ref().and_then(|v| match v {
804 crate::model::backup::BackupScope::SelectedApplications(v) => {
805 std::option::Option::Some(v)
806 }
807 _ => std::option::Option::None,
808 })
809 }
810
811 /// Sets the value of [backup_scope][crate::model::Backup::backup_scope]
812 /// to hold a `SelectedApplications`.
813 ///
814 /// Note that all the setters affecting `backup_scope` are
815 /// mutually exclusive.
816 ///
817 /// # Example
818 /// ```ignore,no_run
819 /// # use google_cloud_gkebackup_v1::model::Backup;
820 /// use google_cloud_gkebackup_v1::model::NamespacedNames;
821 /// let x = Backup::new().set_selected_applications(NamespacedNames::default()/* use setters */);
822 /// assert!(x.selected_applications().is_some());
823 /// assert!(x.all_namespaces().is_none());
824 /// assert!(x.selected_namespaces().is_none());
825 /// ```
826 pub fn set_selected_applications<
827 T: std::convert::Into<std::boxed::Box<crate::model::NamespacedNames>>,
828 >(
829 mut self,
830 v: T,
831 ) -> Self {
832 self.backup_scope = std::option::Option::Some(
833 crate::model::backup::BackupScope::SelectedApplications(v.into()),
834 );
835 self
836 }
837}
838
839impl wkt::message::Message for Backup {
840 fn typename() -> &'static str {
841 "type.googleapis.com/google.cloud.gkebackup.v1.Backup"
842 }
843}
844
845/// Defines additional types related to [Backup].
846pub mod backup {
847 #[allow(unused_imports)]
848 use super::*;
849
850 /// Information about the GKE cluster from which this Backup was created.
851 #[derive(Clone, Default, PartialEq)]
852 #[non_exhaustive]
853 pub struct ClusterMetadata {
854 /// Output only. The source cluster from which this Backup was created.
855 /// Valid formats:
856 ///
857 /// - `projects/*/locations/*/clusters/*`
858 /// - `projects/*/zones/*/clusters/*`
859 ///
860 /// This is inherited from the parent BackupPlan's
861 /// [cluster][google.cloud.gkebackup.v1.BackupPlan.cluster] field.
862 ///
863 /// [google.cloud.gkebackup.v1.BackupPlan.cluster]: crate::model::BackupPlan::cluster
864 pub cluster: std::string::String,
865
866 /// Output only. The Kubernetes server version of the source cluster.
867 pub k8s_version: std::string::String,
868
869 /// Output only. A list of the Backup for GKE CRD versions found in the
870 /// cluster.
871 pub backup_crd_versions:
872 std::collections::HashMap<std::string::String, std::string::String>,
873
874 /// Platform-specific version
875 pub platform_version:
876 std::option::Option<crate::model::backup::cluster_metadata::PlatformVersion>,
877
878 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
879 }
880
881 impl ClusterMetadata {
882 pub fn new() -> Self {
883 std::default::Default::default()
884 }
885
886 /// Sets the value of [cluster][crate::model::backup::ClusterMetadata::cluster].
887 ///
888 /// # Example
889 /// ```ignore,no_run
890 /// # use google_cloud_gkebackup_v1::model::backup::ClusterMetadata;
891 /// let x = ClusterMetadata::new().set_cluster("example");
892 /// ```
893 pub fn set_cluster<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
894 self.cluster = v.into();
895 self
896 }
897
898 /// Sets the value of [k8s_version][crate::model::backup::ClusterMetadata::k8s_version].
899 ///
900 /// # Example
901 /// ```ignore,no_run
902 /// # use google_cloud_gkebackup_v1::model::backup::ClusterMetadata;
903 /// let x = ClusterMetadata::new().set_k8s_version("example");
904 /// ```
905 pub fn set_k8s_version<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
906 self.k8s_version = v.into();
907 self
908 }
909
910 /// Sets the value of [backup_crd_versions][crate::model::backup::ClusterMetadata::backup_crd_versions].
911 ///
912 /// # Example
913 /// ```ignore,no_run
914 /// # use google_cloud_gkebackup_v1::model::backup::ClusterMetadata;
915 /// let x = ClusterMetadata::new().set_backup_crd_versions([
916 /// ("key0", "abc"),
917 /// ("key1", "xyz"),
918 /// ]);
919 /// ```
920 pub fn set_backup_crd_versions<T, K, V>(mut self, v: T) -> Self
921 where
922 T: std::iter::IntoIterator<Item = (K, V)>,
923 K: std::convert::Into<std::string::String>,
924 V: std::convert::Into<std::string::String>,
925 {
926 use std::iter::Iterator;
927 self.backup_crd_versions = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
928 self
929 }
930
931 /// Sets the value of [platform_version][crate::model::backup::ClusterMetadata::platform_version].
932 ///
933 /// Note that all the setters affecting `platform_version` are mutually
934 /// exclusive.
935 ///
936 /// # Example
937 /// ```ignore,no_run
938 /// # use google_cloud_gkebackup_v1::model::backup::ClusterMetadata;
939 /// use google_cloud_gkebackup_v1::model::backup::cluster_metadata::PlatformVersion;
940 /// let x = ClusterMetadata::new().set_platform_version(Some(PlatformVersion::GkeVersion("example".to_string())));
941 /// ```
942 pub fn set_platform_version<
943 T: std::convert::Into<
944 std::option::Option<crate::model::backup::cluster_metadata::PlatformVersion>,
945 >,
946 >(
947 mut self,
948 v: T,
949 ) -> Self {
950 self.platform_version = v.into();
951 self
952 }
953
954 /// The value of [platform_version][crate::model::backup::ClusterMetadata::platform_version]
955 /// if it holds a `GkeVersion`, `None` if the field is not set or
956 /// holds a different branch.
957 pub fn gke_version(&self) -> std::option::Option<&std::string::String> {
958 #[allow(unreachable_patterns)]
959 self.platform_version.as_ref().and_then(|v| match v {
960 crate::model::backup::cluster_metadata::PlatformVersion::GkeVersion(v) => {
961 std::option::Option::Some(v)
962 }
963 _ => std::option::Option::None,
964 })
965 }
966
967 /// Sets the value of [platform_version][crate::model::backup::ClusterMetadata::platform_version]
968 /// to hold a `GkeVersion`.
969 ///
970 /// Note that all the setters affecting `platform_version` are
971 /// mutually exclusive.
972 ///
973 /// # Example
974 /// ```ignore,no_run
975 /// # use google_cloud_gkebackup_v1::model::backup::ClusterMetadata;
976 /// let x = ClusterMetadata::new().set_gke_version("example");
977 /// assert!(x.gke_version().is_some());
978 /// assert!(x.anthos_version().is_none());
979 /// ```
980 pub fn set_gke_version<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
981 self.platform_version = std::option::Option::Some(
982 crate::model::backup::cluster_metadata::PlatformVersion::GkeVersion(v.into()),
983 );
984 self
985 }
986
987 /// The value of [platform_version][crate::model::backup::ClusterMetadata::platform_version]
988 /// if it holds a `AnthosVersion`, `None` if the field is not set or
989 /// holds a different branch.
990 pub fn anthos_version(&self) -> std::option::Option<&std::string::String> {
991 #[allow(unreachable_patterns)]
992 self.platform_version.as_ref().and_then(|v| match v {
993 crate::model::backup::cluster_metadata::PlatformVersion::AnthosVersion(v) => {
994 std::option::Option::Some(v)
995 }
996 _ => std::option::Option::None,
997 })
998 }
999
1000 /// Sets the value of [platform_version][crate::model::backup::ClusterMetadata::platform_version]
1001 /// to hold a `AnthosVersion`.
1002 ///
1003 /// Note that all the setters affecting `platform_version` are
1004 /// mutually exclusive.
1005 ///
1006 /// # Example
1007 /// ```ignore,no_run
1008 /// # use google_cloud_gkebackup_v1::model::backup::ClusterMetadata;
1009 /// let x = ClusterMetadata::new().set_anthos_version("example");
1010 /// assert!(x.anthos_version().is_some());
1011 /// assert!(x.gke_version().is_none());
1012 /// ```
1013 pub fn set_anthos_version<T: std::convert::Into<std::string::String>>(
1014 mut self,
1015 v: T,
1016 ) -> Self {
1017 self.platform_version = std::option::Option::Some(
1018 crate::model::backup::cluster_metadata::PlatformVersion::AnthosVersion(v.into()),
1019 );
1020 self
1021 }
1022 }
1023
1024 impl wkt::message::Message for ClusterMetadata {
1025 fn typename() -> &'static str {
1026 "type.googleapis.com/google.cloud.gkebackup.v1.Backup.ClusterMetadata"
1027 }
1028 }
1029
1030 /// Defines additional types related to [ClusterMetadata].
1031 pub mod cluster_metadata {
1032 #[allow(unused_imports)]
1033 use super::*;
1034
1035 /// Platform-specific version
1036 #[derive(Clone, Debug, PartialEq)]
1037 #[non_exhaustive]
1038 pub enum PlatformVersion {
1039 /// Output only. GKE version
1040 GkeVersion(std::string::String),
1041 /// Output only. Anthos version
1042 AnthosVersion(std::string::String),
1043 }
1044 }
1045
1046 /// State
1047 ///
1048 /// # Working with unknown values
1049 ///
1050 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
1051 /// additional enum variants at any time. Adding new variants is not considered
1052 /// a breaking change. Applications should write their code in anticipation of:
1053 ///
1054 /// - New values appearing in future releases of the client library, **and**
1055 /// - New values received dynamically, without application changes.
1056 ///
1057 /// Please consult the [Working with enums] section in the user guide for some
1058 /// guidelines.
1059 ///
1060 /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
1061 #[derive(Clone, Debug, PartialEq)]
1062 #[non_exhaustive]
1063 pub enum State {
1064 /// The Backup resource is in the process of being created.
1065 Unspecified,
1066 /// The Backup resource has been created and the associated BackupJob
1067 /// Kubernetes resource has been injected into the source cluster.
1068 Creating,
1069 /// The gkebackup agent in the cluster has begun executing the backup
1070 /// operation.
1071 InProgress,
1072 /// The backup operation has completed successfully.
1073 Succeeded,
1074 /// The backup operation has failed.
1075 Failed,
1076 /// This Backup resource (and its associated artifacts) is in the process
1077 /// of being deleted.
1078 Deleting,
1079 /// If set, the enum was initialized with an unknown value.
1080 ///
1081 /// Applications can examine the value using [State::value] or
1082 /// [State::name].
1083 UnknownValue(state::UnknownValue),
1084 }
1085
1086 #[doc(hidden)]
1087 pub mod state {
1088 #[allow(unused_imports)]
1089 use super::*;
1090 #[derive(Clone, Debug, PartialEq)]
1091 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
1092 }
1093
1094 impl State {
1095 /// Gets the enum value.
1096 ///
1097 /// Returns `None` if the enum contains an unknown value deserialized from
1098 /// the string representation of enums.
1099 pub fn value(&self) -> std::option::Option<i32> {
1100 match self {
1101 Self::Unspecified => std::option::Option::Some(0),
1102 Self::Creating => std::option::Option::Some(1),
1103 Self::InProgress => std::option::Option::Some(2),
1104 Self::Succeeded => std::option::Option::Some(3),
1105 Self::Failed => std::option::Option::Some(4),
1106 Self::Deleting => std::option::Option::Some(5),
1107 Self::UnknownValue(u) => u.0.value(),
1108 }
1109 }
1110
1111 /// Gets the enum value as a string.
1112 ///
1113 /// Returns `None` if the enum contains an unknown value deserialized from
1114 /// the integer representation of enums.
1115 pub fn name(&self) -> std::option::Option<&str> {
1116 match self {
1117 Self::Unspecified => std::option::Option::Some("STATE_UNSPECIFIED"),
1118 Self::Creating => std::option::Option::Some("CREATING"),
1119 Self::InProgress => std::option::Option::Some("IN_PROGRESS"),
1120 Self::Succeeded => std::option::Option::Some("SUCCEEDED"),
1121 Self::Failed => std::option::Option::Some("FAILED"),
1122 Self::Deleting => std::option::Option::Some("DELETING"),
1123 Self::UnknownValue(u) => u.0.name(),
1124 }
1125 }
1126 }
1127
1128 impl std::default::Default for State {
1129 fn default() -> Self {
1130 use std::convert::From;
1131 Self::from(0)
1132 }
1133 }
1134
1135 impl std::fmt::Display for State {
1136 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
1137 wkt::internal::display_enum(f, self.name(), self.value())
1138 }
1139 }
1140
1141 impl std::convert::From<i32> for State {
1142 fn from(value: i32) -> Self {
1143 match value {
1144 0 => Self::Unspecified,
1145 1 => Self::Creating,
1146 2 => Self::InProgress,
1147 3 => Self::Succeeded,
1148 4 => Self::Failed,
1149 5 => Self::Deleting,
1150 _ => Self::UnknownValue(state::UnknownValue(
1151 wkt::internal::UnknownEnumValue::Integer(value),
1152 )),
1153 }
1154 }
1155 }
1156
1157 impl std::convert::From<&str> for State {
1158 fn from(value: &str) -> Self {
1159 use std::string::ToString;
1160 match value {
1161 "STATE_UNSPECIFIED" => Self::Unspecified,
1162 "CREATING" => Self::Creating,
1163 "IN_PROGRESS" => Self::InProgress,
1164 "SUCCEEDED" => Self::Succeeded,
1165 "FAILED" => Self::Failed,
1166 "DELETING" => Self::Deleting,
1167 _ => Self::UnknownValue(state::UnknownValue(
1168 wkt::internal::UnknownEnumValue::String(value.to_string()),
1169 )),
1170 }
1171 }
1172 }
1173
1174 impl serde::ser::Serialize for State {
1175 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
1176 where
1177 S: serde::Serializer,
1178 {
1179 match self {
1180 Self::Unspecified => serializer.serialize_i32(0),
1181 Self::Creating => serializer.serialize_i32(1),
1182 Self::InProgress => serializer.serialize_i32(2),
1183 Self::Succeeded => serializer.serialize_i32(3),
1184 Self::Failed => serializer.serialize_i32(4),
1185 Self::Deleting => serializer.serialize_i32(5),
1186 Self::UnknownValue(u) => u.0.serialize(serializer),
1187 }
1188 }
1189 }
1190
1191 impl<'de> serde::de::Deserialize<'de> for State {
1192 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
1193 where
1194 D: serde::Deserializer<'de>,
1195 {
1196 deserializer.deserialize_any(wkt::internal::EnumVisitor::<State>::new(
1197 ".google.cloud.gkebackup.v1.Backup.State",
1198 ))
1199 }
1200 }
1201
1202 /// Defines the "scope" of the Backup - which namespaced resources in the
1203 /// cluster were included in the Backup. Inherited from the parent
1204 /// BackupPlan's
1205 /// [backup_scope][google.cloud.gkebackup.v1.BackupPlan.BackupConfig.backup_scope]
1206 /// value.
1207 ///
1208 /// [google.cloud.gkebackup.v1.BackupPlan.BackupConfig.backup_scope]: crate::model::backup_plan::BackupConfig::backup_scope
1209 #[derive(Clone, Debug, PartialEq)]
1210 #[non_exhaustive]
1211 pub enum BackupScope {
1212 /// Output only. If True, all namespaces were included in the Backup.
1213 AllNamespaces(bool),
1214 /// Output only. If set, the list of namespaces that were included in the
1215 /// Backup.
1216 SelectedNamespaces(std::boxed::Box<crate::model::Namespaces>),
1217 /// Output only. If set, the list of ProtectedApplications whose resources
1218 /// were included in the Backup.
1219 SelectedApplications(std::boxed::Box<crate::model::NamespacedNames>),
1220 }
1221}
1222
1223/// A BackupChannel imposes constraints on where clusters can be backed up.
1224/// The BackupChannel should be in the same project and region
1225/// as the cluster being backed up.
1226/// The backup can be created only in destination_project.
1227#[derive(Clone, Default, PartialEq)]
1228#[non_exhaustive]
1229pub struct BackupChannel {
1230 /// Identifier. The fully qualified name of the BackupChannel.
1231 /// `projects/*/locations/*/backupChannels/*`
1232 pub name: std::string::String,
1233
1234 /// Required. Immutable. The project where Backups are allowed to be stored.
1235 /// The format is `projects/{projectId}` or `projects/{projectNumber}`.
1236 pub destination_project: std::string::String,
1237
1238 /// Output only. Server generated global unique identifier of
1239 /// [UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier) format.
1240 pub uid: std::string::String,
1241
1242 /// Output only. The timestamp when this BackupChannel resource was created.
1243 pub create_time: std::option::Option<wkt::Timestamp>,
1244
1245 /// Output only. The timestamp when this BackupChannel resource was last
1246 /// updated.
1247 pub update_time: std::option::Option<wkt::Timestamp>,
1248
1249 /// Optional. A set of custom labels supplied by user.
1250 pub labels: std::collections::HashMap<std::string::String, std::string::String>,
1251
1252 /// Optional. User specified descriptive string for this BackupChannel.
1253 pub description: std::string::String,
1254
1255 /// Output only. `etag` is used for optimistic concurrency control as a way to
1256 /// help prevent simultaneous updates of a BackupChannel from overwriting each
1257 /// other. It is strongly suggested that systems make use of the 'etag' in the
1258 /// read-modify-write cycle to perform BackupChannel updates in order to
1259 /// avoid race conditions: An `etag` is returned in the response to
1260 /// `GetBackupChannel`, and systems are expected to put that etag in the
1261 /// request to `UpdateBackupChannel` or `DeleteBackupChannel` to
1262 /// ensure that their change will be applied to the same version of the
1263 /// resource.
1264 pub etag: std::string::String,
1265
1266 /// Output only. The project_id where Backups are allowed to be stored.
1267 /// Example Project ID: "my-project-id".
1268 /// This will be an OUTPUT_ONLY field to return the project_id of the
1269 /// destination project.
1270 pub destination_project_id: std::string::String,
1271
1272 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1273}
1274
1275impl BackupChannel {
1276 pub fn new() -> Self {
1277 std::default::Default::default()
1278 }
1279
1280 /// Sets the value of [name][crate::model::BackupChannel::name].
1281 ///
1282 /// # Example
1283 /// ```ignore,no_run
1284 /// # use google_cloud_gkebackup_v1::model::BackupChannel;
1285 /// let x = BackupChannel::new().set_name("example");
1286 /// ```
1287 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1288 self.name = v.into();
1289 self
1290 }
1291
1292 /// Sets the value of [destination_project][crate::model::BackupChannel::destination_project].
1293 ///
1294 /// # Example
1295 /// ```ignore,no_run
1296 /// # use google_cloud_gkebackup_v1::model::BackupChannel;
1297 /// let x = BackupChannel::new().set_destination_project("example");
1298 /// ```
1299 pub fn set_destination_project<T: std::convert::Into<std::string::String>>(
1300 mut self,
1301 v: T,
1302 ) -> Self {
1303 self.destination_project = v.into();
1304 self
1305 }
1306
1307 /// Sets the value of [uid][crate::model::BackupChannel::uid].
1308 ///
1309 /// # Example
1310 /// ```ignore,no_run
1311 /// # use google_cloud_gkebackup_v1::model::BackupChannel;
1312 /// let x = BackupChannel::new().set_uid("example");
1313 /// ```
1314 pub fn set_uid<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1315 self.uid = v.into();
1316 self
1317 }
1318
1319 /// Sets the value of [create_time][crate::model::BackupChannel::create_time].
1320 ///
1321 /// # Example
1322 /// ```ignore,no_run
1323 /// # use google_cloud_gkebackup_v1::model::BackupChannel;
1324 /// use wkt::Timestamp;
1325 /// let x = BackupChannel::new().set_create_time(Timestamp::default()/* use setters */);
1326 /// ```
1327 pub fn set_create_time<T>(mut self, v: T) -> Self
1328 where
1329 T: std::convert::Into<wkt::Timestamp>,
1330 {
1331 self.create_time = std::option::Option::Some(v.into());
1332 self
1333 }
1334
1335 /// Sets or clears the value of [create_time][crate::model::BackupChannel::create_time].
1336 ///
1337 /// # Example
1338 /// ```ignore,no_run
1339 /// # use google_cloud_gkebackup_v1::model::BackupChannel;
1340 /// use wkt::Timestamp;
1341 /// let x = BackupChannel::new().set_or_clear_create_time(Some(Timestamp::default()/* use setters */));
1342 /// let x = BackupChannel::new().set_or_clear_create_time(None::<Timestamp>);
1343 /// ```
1344 pub fn set_or_clear_create_time<T>(mut self, v: std::option::Option<T>) -> Self
1345 where
1346 T: std::convert::Into<wkt::Timestamp>,
1347 {
1348 self.create_time = v.map(|x| x.into());
1349 self
1350 }
1351
1352 /// Sets the value of [update_time][crate::model::BackupChannel::update_time].
1353 ///
1354 /// # Example
1355 /// ```ignore,no_run
1356 /// # use google_cloud_gkebackup_v1::model::BackupChannel;
1357 /// use wkt::Timestamp;
1358 /// let x = BackupChannel::new().set_update_time(Timestamp::default()/* use setters */);
1359 /// ```
1360 pub fn set_update_time<T>(mut self, v: T) -> Self
1361 where
1362 T: std::convert::Into<wkt::Timestamp>,
1363 {
1364 self.update_time = std::option::Option::Some(v.into());
1365 self
1366 }
1367
1368 /// Sets or clears the value of [update_time][crate::model::BackupChannel::update_time].
1369 ///
1370 /// # Example
1371 /// ```ignore,no_run
1372 /// # use google_cloud_gkebackup_v1::model::BackupChannel;
1373 /// use wkt::Timestamp;
1374 /// let x = BackupChannel::new().set_or_clear_update_time(Some(Timestamp::default()/* use setters */));
1375 /// let x = BackupChannel::new().set_or_clear_update_time(None::<Timestamp>);
1376 /// ```
1377 pub fn set_or_clear_update_time<T>(mut self, v: std::option::Option<T>) -> Self
1378 where
1379 T: std::convert::Into<wkt::Timestamp>,
1380 {
1381 self.update_time = v.map(|x| x.into());
1382 self
1383 }
1384
1385 /// Sets the value of [labels][crate::model::BackupChannel::labels].
1386 ///
1387 /// # Example
1388 /// ```ignore,no_run
1389 /// # use google_cloud_gkebackup_v1::model::BackupChannel;
1390 /// let x = BackupChannel::new().set_labels([
1391 /// ("key0", "abc"),
1392 /// ("key1", "xyz"),
1393 /// ]);
1394 /// ```
1395 pub fn set_labels<T, K, V>(mut self, v: T) -> Self
1396 where
1397 T: std::iter::IntoIterator<Item = (K, V)>,
1398 K: std::convert::Into<std::string::String>,
1399 V: std::convert::Into<std::string::String>,
1400 {
1401 use std::iter::Iterator;
1402 self.labels = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
1403 self
1404 }
1405
1406 /// Sets the value of [description][crate::model::BackupChannel::description].
1407 ///
1408 /// # Example
1409 /// ```ignore,no_run
1410 /// # use google_cloud_gkebackup_v1::model::BackupChannel;
1411 /// let x = BackupChannel::new().set_description("example");
1412 /// ```
1413 pub fn set_description<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1414 self.description = v.into();
1415 self
1416 }
1417
1418 /// Sets the value of [etag][crate::model::BackupChannel::etag].
1419 ///
1420 /// # Example
1421 /// ```ignore,no_run
1422 /// # use google_cloud_gkebackup_v1::model::BackupChannel;
1423 /// let x = BackupChannel::new().set_etag("example");
1424 /// ```
1425 pub fn set_etag<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1426 self.etag = v.into();
1427 self
1428 }
1429
1430 /// Sets the value of [destination_project_id][crate::model::BackupChannel::destination_project_id].
1431 ///
1432 /// # Example
1433 /// ```ignore,no_run
1434 /// # use google_cloud_gkebackup_v1::model::BackupChannel;
1435 /// let x = BackupChannel::new().set_destination_project_id("example");
1436 /// ```
1437 pub fn set_destination_project_id<T: std::convert::Into<std::string::String>>(
1438 mut self,
1439 v: T,
1440 ) -> Self {
1441 self.destination_project_id = v.into();
1442 self
1443 }
1444}
1445
1446impl wkt::message::Message for BackupChannel {
1447 fn typename() -> &'static str {
1448 "type.googleapis.com/google.cloud.gkebackup.v1.BackupChannel"
1449 }
1450}
1451
1452/// Defines the configuration and scheduling for a "line" of Backups.
1453#[derive(Clone, Default, PartialEq)]
1454#[non_exhaustive]
1455pub struct BackupPlan {
1456 /// Output only. The full name of the BackupPlan resource.
1457 /// Format: `projects/*/locations/*/backupPlans/*`
1458 pub name: std::string::String,
1459
1460 /// Output only. Server generated global unique identifier of
1461 /// [UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier) format.
1462 pub uid: std::string::String,
1463
1464 /// Output only. The timestamp when this BackupPlan resource was created.
1465 pub create_time: std::option::Option<wkt::Timestamp>,
1466
1467 /// Output only. The timestamp when this BackupPlan resource was last
1468 /// updated.
1469 pub update_time: std::option::Option<wkt::Timestamp>,
1470
1471 /// Optional. User specified descriptive string for this BackupPlan.
1472 pub description: std::string::String,
1473
1474 /// Required. Immutable. The source cluster from which Backups will be created
1475 /// via this BackupPlan. Valid formats:
1476 ///
1477 /// - `projects/*/locations/*/clusters/*`
1478 /// - `projects/*/zones/*/clusters/*`
1479 pub cluster: std::string::String,
1480
1481 /// Optional. RetentionPolicy governs lifecycle of Backups created under this
1482 /// plan.
1483 pub retention_policy: std::option::Option<crate::model::backup_plan::RetentionPolicy>,
1484
1485 /// Optional. A set of custom labels supplied by user.
1486 pub labels: std::collections::HashMap<std::string::String, std::string::String>,
1487
1488 /// Optional. Defines a schedule for automatic Backup creation via this
1489 /// BackupPlan.
1490 pub backup_schedule: std::option::Option<crate::model::backup_plan::Schedule>,
1491
1492 /// Output only. `etag` is used for optimistic concurrency control as a way to
1493 /// help prevent simultaneous updates of a backup plan from overwriting each
1494 /// other. It is strongly suggested that systems make use of the 'etag' in the
1495 /// read-modify-write cycle to perform BackupPlan updates in order to avoid
1496 /// race conditions: An `etag` is returned in the response to `GetBackupPlan`,
1497 /// and systems are expected to put that etag in the request to
1498 /// `UpdateBackupPlan` or `DeleteBackupPlan` to ensure that their change
1499 /// will be applied to the same version of the resource.
1500 pub etag: std::string::String,
1501
1502 /// Optional. This flag indicates whether this BackupPlan has been deactivated.
1503 /// Setting this field to True locks the BackupPlan such that no further
1504 /// updates will be allowed (except deletes), including the deactivated field
1505 /// itself. It also prevents any new Backups from being created via this
1506 /// BackupPlan (including scheduled Backups).
1507 ///
1508 /// Default: False
1509 pub deactivated: bool,
1510
1511 /// Optional. Defines the configuration of Backups created via this BackupPlan.
1512 pub backup_config: std::option::Option<crate::model::backup_plan::BackupConfig>,
1513
1514 /// Output only. The number of Kubernetes Pods backed up in the
1515 /// last successful Backup created via this BackupPlan.
1516 pub protected_pod_count: i32,
1517
1518 /// Output only. State of the BackupPlan. This State field reflects the
1519 /// various stages a BackupPlan can be in
1520 /// during the Create operation. It will be set to "DEACTIVATED"
1521 /// if the BackupPlan is deactivated on an Update
1522 pub state: crate::model::backup_plan::State,
1523
1524 /// Output only. Human-readable description of why BackupPlan is in the current
1525 /// `state`. This field is only meant for human readability and should not be
1526 /// used programmatically as this field is not guaranteed to be consistent.
1527 pub state_reason: std::string::String,
1528
1529 /// Output only. A number that represents the current risk level of this
1530 /// BackupPlan from RPO perspective with 1 being no risk and 5 being highest
1531 /// risk.
1532 pub rpo_risk_level: i32,
1533
1534 /// Output only. Human-readable description of why the BackupPlan is in the
1535 /// current rpo_risk_level and action items if any.
1536 pub rpo_risk_reason: std::string::String,
1537
1538 /// Output only. The fully qualified name of the BackupChannel to be used to
1539 /// create a backup. This field is set only if the cluster being backed up is
1540 /// in a different project.
1541 /// `projects/*/locations/*/backupChannels/*`
1542 pub backup_channel: std::string::String,
1543
1544 /// Output only. Completion time of the last successful Backup. This is sourced
1545 /// from a successful Backup's complete_time field. This field is added to
1546 /// maintain consistency with BackupPlanBinding to display last successful
1547 /// backup time.
1548 pub last_successful_backup_time: std::option::Option<wkt::Timestamp>,
1549
1550 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1551}
1552
1553impl BackupPlan {
1554 pub fn new() -> Self {
1555 std::default::Default::default()
1556 }
1557
1558 /// Sets the value of [name][crate::model::BackupPlan::name].
1559 ///
1560 /// # Example
1561 /// ```ignore,no_run
1562 /// # use google_cloud_gkebackup_v1::model::BackupPlan;
1563 /// let x = BackupPlan::new().set_name("example");
1564 /// ```
1565 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1566 self.name = v.into();
1567 self
1568 }
1569
1570 /// Sets the value of [uid][crate::model::BackupPlan::uid].
1571 ///
1572 /// # Example
1573 /// ```ignore,no_run
1574 /// # use google_cloud_gkebackup_v1::model::BackupPlan;
1575 /// let x = BackupPlan::new().set_uid("example");
1576 /// ```
1577 pub fn set_uid<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1578 self.uid = v.into();
1579 self
1580 }
1581
1582 /// Sets the value of [create_time][crate::model::BackupPlan::create_time].
1583 ///
1584 /// # Example
1585 /// ```ignore,no_run
1586 /// # use google_cloud_gkebackup_v1::model::BackupPlan;
1587 /// use wkt::Timestamp;
1588 /// let x = BackupPlan::new().set_create_time(Timestamp::default()/* use setters */);
1589 /// ```
1590 pub fn set_create_time<T>(mut self, v: T) -> Self
1591 where
1592 T: std::convert::Into<wkt::Timestamp>,
1593 {
1594 self.create_time = std::option::Option::Some(v.into());
1595 self
1596 }
1597
1598 /// Sets or clears the value of [create_time][crate::model::BackupPlan::create_time].
1599 ///
1600 /// # Example
1601 /// ```ignore,no_run
1602 /// # use google_cloud_gkebackup_v1::model::BackupPlan;
1603 /// use wkt::Timestamp;
1604 /// let x = BackupPlan::new().set_or_clear_create_time(Some(Timestamp::default()/* use setters */));
1605 /// let x = BackupPlan::new().set_or_clear_create_time(None::<Timestamp>);
1606 /// ```
1607 pub fn set_or_clear_create_time<T>(mut self, v: std::option::Option<T>) -> Self
1608 where
1609 T: std::convert::Into<wkt::Timestamp>,
1610 {
1611 self.create_time = v.map(|x| x.into());
1612 self
1613 }
1614
1615 /// Sets the value of [update_time][crate::model::BackupPlan::update_time].
1616 ///
1617 /// # Example
1618 /// ```ignore,no_run
1619 /// # use google_cloud_gkebackup_v1::model::BackupPlan;
1620 /// use wkt::Timestamp;
1621 /// let x = BackupPlan::new().set_update_time(Timestamp::default()/* use setters */);
1622 /// ```
1623 pub fn set_update_time<T>(mut self, v: T) -> Self
1624 where
1625 T: std::convert::Into<wkt::Timestamp>,
1626 {
1627 self.update_time = std::option::Option::Some(v.into());
1628 self
1629 }
1630
1631 /// Sets or clears the value of [update_time][crate::model::BackupPlan::update_time].
1632 ///
1633 /// # Example
1634 /// ```ignore,no_run
1635 /// # use google_cloud_gkebackup_v1::model::BackupPlan;
1636 /// use wkt::Timestamp;
1637 /// let x = BackupPlan::new().set_or_clear_update_time(Some(Timestamp::default()/* use setters */));
1638 /// let x = BackupPlan::new().set_or_clear_update_time(None::<Timestamp>);
1639 /// ```
1640 pub fn set_or_clear_update_time<T>(mut self, v: std::option::Option<T>) -> Self
1641 where
1642 T: std::convert::Into<wkt::Timestamp>,
1643 {
1644 self.update_time = v.map(|x| x.into());
1645 self
1646 }
1647
1648 /// Sets the value of [description][crate::model::BackupPlan::description].
1649 ///
1650 /// # Example
1651 /// ```ignore,no_run
1652 /// # use google_cloud_gkebackup_v1::model::BackupPlan;
1653 /// let x = BackupPlan::new().set_description("example");
1654 /// ```
1655 pub fn set_description<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1656 self.description = v.into();
1657 self
1658 }
1659
1660 /// Sets the value of [cluster][crate::model::BackupPlan::cluster].
1661 ///
1662 /// # Example
1663 /// ```ignore,no_run
1664 /// # use google_cloud_gkebackup_v1::model::BackupPlan;
1665 /// let x = BackupPlan::new().set_cluster("example");
1666 /// ```
1667 pub fn set_cluster<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1668 self.cluster = v.into();
1669 self
1670 }
1671
1672 /// Sets the value of [retention_policy][crate::model::BackupPlan::retention_policy].
1673 ///
1674 /// # Example
1675 /// ```ignore,no_run
1676 /// # use google_cloud_gkebackup_v1::model::BackupPlan;
1677 /// use google_cloud_gkebackup_v1::model::backup_plan::RetentionPolicy;
1678 /// let x = BackupPlan::new().set_retention_policy(RetentionPolicy::default()/* use setters */);
1679 /// ```
1680 pub fn set_retention_policy<T>(mut self, v: T) -> Self
1681 where
1682 T: std::convert::Into<crate::model::backup_plan::RetentionPolicy>,
1683 {
1684 self.retention_policy = std::option::Option::Some(v.into());
1685 self
1686 }
1687
1688 /// Sets or clears the value of [retention_policy][crate::model::BackupPlan::retention_policy].
1689 ///
1690 /// # Example
1691 /// ```ignore,no_run
1692 /// # use google_cloud_gkebackup_v1::model::BackupPlan;
1693 /// use google_cloud_gkebackup_v1::model::backup_plan::RetentionPolicy;
1694 /// let x = BackupPlan::new().set_or_clear_retention_policy(Some(RetentionPolicy::default()/* use setters */));
1695 /// let x = BackupPlan::new().set_or_clear_retention_policy(None::<RetentionPolicy>);
1696 /// ```
1697 pub fn set_or_clear_retention_policy<T>(mut self, v: std::option::Option<T>) -> Self
1698 where
1699 T: std::convert::Into<crate::model::backup_plan::RetentionPolicy>,
1700 {
1701 self.retention_policy = v.map(|x| x.into());
1702 self
1703 }
1704
1705 /// Sets the value of [labels][crate::model::BackupPlan::labels].
1706 ///
1707 /// # Example
1708 /// ```ignore,no_run
1709 /// # use google_cloud_gkebackup_v1::model::BackupPlan;
1710 /// let x = BackupPlan::new().set_labels([
1711 /// ("key0", "abc"),
1712 /// ("key1", "xyz"),
1713 /// ]);
1714 /// ```
1715 pub fn set_labels<T, K, V>(mut self, v: T) -> Self
1716 where
1717 T: std::iter::IntoIterator<Item = (K, V)>,
1718 K: std::convert::Into<std::string::String>,
1719 V: std::convert::Into<std::string::String>,
1720 {
1721 use std::iter::Iterator;
1722 self.labels = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
1723 self
1724 }
1725
1726 /// Sets the value of [backup_schedule][crate::model::BackupPlan::backup_schedule].
1727 ///
1728 /// # Example
1729 /// ```ignore,no_run
1730 /// # use google_cloud_gkebackup_v1::model::BackupPlan;
1731 /// use google_cloud_gkebackup_v1::model::backup_plan::Schedule;
1732 /// let x = BackupPlan::new().set_backup_schedule(Schedule::default()/* use setters */);
1733 /// ```
1734 pub fn set_backup_schedule<T>(mut self, v: T) -> Self
1735 where
1736 T: std::convert::Into<crate::model::backup_plan::Schedule>,
1737 {
1738 self.backup_schedule = std::option::Option::Some(v.into());
1739 self
1740 }
1741
1742 /// Sets or clears the value of [backup_schedule][crate::model::BackupPlan::backup_schedule].
1743 ///
1744 /// # Example
1745 /// ```ignore,no_run
1746 /// # use google_cloud_gkebackup_v1::model::BackupPlan;
1747 /// use google_cloud_gkebackup_v1::model::backup_plan::Schedule;
1748 /// let x = BackupPlan::new().set_or_clear_backup_schedule(Some(Schedule::default()/* use setters */));
1749 /// let x = BackupPlan::new().set_or_clear_backup_schedule(None::<Schedule>);
1750 /// ```
1751 pub fn set_or_clear_backup_schedule<T>(mut self, v: std::option::Option<T>) -> Self
1752 where
1753 T: std::convert::Into<crate::model::backup_plan::Schedule>,
1754 {
1755 self.backup_schedule = v.map(|x| x.into());
1756 self
1757 }
1758
1759 /// Sets the value of [etag][crate::model::BackupPlan::etag].
1760 ///
1761 /// # Example
1762 /// ```ignore,no_run
1763 /// # use google_cloud_gkebackup_v1::model::BackupPlan;
1764 /// let x = BackupPlan::new().set_etag("example");
1765 /// ```
1766 pub fn set_etag<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1767 self.etag = v.into();
1768 self
1769 }
1770
1771 /// Sets the value of [deactivated][crate::model::BackupPlan::deactivated].
1772 ///
1773 /// # Example
1774 /// ```ignore,no_run
1775 /// # use google_cloud_gkebackup_v1::model::BackupPlan;
1776 /// let x = BackupPlan::new().set_deactivated(true);
1777 /// ```
1778 pub fn set_deactivated<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
1779 self.deactivated = v.into();
1780 self
1781 }
1782
1783 /// Sets the value of [backup_config][crate::model::BackupPlan::backup_config].
1784 ///
1785 /// # Example
1786 /// ```ignore,no_run
1787 /// # use google_cloud_gkebackup_v1::model::BackupPlan;
1788 /// use google_cloud_gkebackup_v1::model::backup_plan::BackupConfig;
1789 /// let x = BackupPlan::new().set_backup_config(BackupConfig::default()/* use setters */);
1790 /// ```
1791 pub fn set_backup_config<T>(mut self, v: T) -> Self
1792 where
1793 T: std::convert::Into<crate::model::backup_plan::BackupConfig>,
1794 {
1795 self.backup_config = std::option::Option::Some(v.into());
1796 self
1797 }
1798
1799 /// Sets or clears the value of [backup_config][crate::model::BackupPlan::backup_config].
1800 ///
1801 /// # Example
1802 /// ```ignore,no_run
1803 /// # use google_cloud_gkebackup_v1::model::BackupPlan;
1804 /// use google_cloud_gkebackup_v1::model::backup_plan::BackupConfig;
1805 /// let x = BackupPlan::new().set_or_clear_backup_config(Some(BackupConfig::default()/* use setters */));
1806 /// let x = BackupPlan::new().set_or_clear_backup_config(None::<BackupConfig>);
1807 /// ```
1808 pub fn set_or_clear_backup_config<T>(mut self, v: std::option::Option<T>) -> Self
1809 where
1810 T: std::convert::Into<crate::model::backup_plan::BackupConfig>,
1811 {
1812 self.backup_config = v.map(|x| x.into());
1813 self
1814 }
1815
1816 /// Sets the value of [protected_pod_count][crate::model::BackupPlan::protected_pod_count].
1817 ///
1818 /// # Example
1819 /// ```ignore,no_run
1820 /// # use google_cloud_gkebackup_v1::model::BackupPlan;
1821 /// let x = BackupPlan::new().set_protected_pod_count(42);
1822 /// ```
1823 pub fn set_protected_pod_count<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
1824 self.protected_pod_count = v.into();
1825 self
1826 }
1827
1828 /// Sets the value of [state][crate::model::BackupPlan::state].
1829 ///
1830 /// # Example
1831 /// ```ignore,no_run
1832 /// # use google_cloud_gkebackup_v1::model::BackupPlan;
1833 /// use google_cloud_gkebackup_v1::model::backup_plan::State;
1834 /// let x0 = BackupPlan::new().set_state(State::ClusterPending);
1835 /// let x1 = BackupPlan::new().set_state(State::Provisioning);
1836 /// let x2 = BackupPlan::new().set_state(State::Ready);
1837 /// ```
1838 pub fn set_state<T: std::convert::Into<crate::model::backup_plan::State>>(
1839 mut self,
1840 v: T,
1841 ) -> Self {
1842 self.state = v.into();
1843 self
1844 }
1845
1846 /// Sets the value of [state_reason][crate::model::BackupPlan::state_reason].
1847 ///
1848 /// # Example
1849 /// ```ignore,no_run
1850 /// # use google_cloud_gkebackup_v1::model::BackupPlan;
1851 /// let x = BackupPlan::new().set_state_reason("example");
1852 /// ```
1853 pub fn set_state_reason<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1854 self.state_reason = v.into();
1855 self
1856 }
1857
1858 /// Sets the value of [rpo_risk_level][crate::model::BackupPlan::rpo_risk_level].
1859 ///
1860 /// # Example
1861 /// ```ignore,no_run
1862 /// # use google_cloud_gkebackup_v1::model::BackupPlan;
1863 /// let x = BackupPlan::new().set_rpo_risk_level(42);
1864 /// ```
1865 pub fn set_rpo_risk_level<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
1866 self.rpo_risk_level = v.into();
1867 self
1868 }
1869
1870 /// Sets the value of [rpo_risk_reason][crate::model::BackupPlan::rpo_risk_reason].
1871 ///
1872 /// # Example
1873 /// ```ignore,no_run
1874 /// # use google_cloud_gkebackup_v1::model::BackupPlan;
1875 /// let x = BackupPlan::new().set_rpo_risk_reason("example");
1876 /// ```
1877 pub fn set_rpo_risk_reason<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1878 self.rpo_risk_reason = v.into();
1879 self
1880 }
1881
1882 /// Sets the value of [backup_channel][crate::model::BackupPlan::backup_channel].
1883 ///
1884 /// # Example
1885 /// ```ignore,no_run
1886 /// # use google_cloud_gkebackup_v1::model::BackupPlan;
1887 /// let x = BackupPlan::new().set_backup_channel("example");
1888 /// ```
1889 pub fn set_backup_channel<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1890 self.backup_channel = v.into();
1891 self
1892 }
1893
1894 /// Sets the value of [last_successful_backup_time][crate::model::BackupPlan::last_successful_backup_time].
1895 ///
1896 /// # Example
1897 /// ```ignore,no_run
1898 /// # use google_cloud_gkebackup_v1::model::BackupPlan;
1899 /// use wkt::Timestamp;
1900 /// let x = BackupPlan::new().set_last_successful_backup_time(Timestamp::default()/* use setters */);
1901 /// ```
1902 pub fn set_last_successful_backup_time<T>(mut self, v: T) -> Self
1903 where
1904 T: std::convert::Into<wkt::Timestamp>,
1905 {
1906 self.last_successful_backup_time = std::option::Option::Some(v.into());
1907 self
1908 }
1909
1910 /// Sets or clears the value of [last_successful_backup_time][crate::model::BackupPlan::last_successful_backup_time].
1911 ///
1912 /// # Example
1913 /// ```ignore,no_run
1914 /// # use google_cloud_gkebackup_v1::model::BackupPlan;
1915 /// use wkt::Timestamp;
1916 /// let x = BackupPlan::new().set_or_clear_last_successful_backup_time(Some(Timestamp::default()/* use setters */));
1917 /// let x = BackupPlan::new().set_or_clear_last_successful_backup_time(None::<Timestamp>);
1918 /// ```
1919 pub fn set_or_clear_last_successful_backup_time<T>(mut self, v: std::option::Option<T>) -> Self
1920 where
1921 T: std::convert::Into<wkt::Timestamp>,
1922 {
1923 self.last_successful_backup_time = v.map(|x| x.into());
1924 self
1925 }
1926}
1927
1928impl wkt::message::Message for BackupPlan {
1929 fn typename() -> &'static str {
1930 "type.googleapis.com/google.cloud.gkebackup.v1.BackupPlan"
1931 }
1932}
1933
1934/// Defines additional types related to [BackupPlan].
1935pub mod backup_plan {
1936 #[allow(unused_imports)]
1937 use super::*;
1938
1939 /// RetentionPolicy defines a Backup retention policy for a BackupPlan.
1940 #[derive(Clone, Default, PartialEq)]
1941 #[non_exhaustive]
1942 pub struct RetentionPolicy {
1943 /// Optional. Minimum age for Backups created via this BackupPlan (in days).
1944 /// This field MUST be an integer value between 0-90 (inclusive).
1945 /// A Backup created under this BackupPlan will NOT be deletable until it
1946 /// reaches Backup's (create_time + backup_delete_lock_days).
1947 /// Updating this field of a BackupPlan does NOT affect existing Backups
1948 /// under it. Backups created AFTER a successful update will inherit
1949 /// the new value.
1950 ///
1951 /// Default: 0 (no delete blocking)
1952 pub backup_delete_lock_days: i32,
1953
1954 /// Optional. The default maximum age of a Backup created via this
1955 /// BackupPlan. This field MUST be an integer value >= 0 and <= 365. If
1956 /// specified, a Backup created under this BackupPlan will be automatically
1957 /// deleted after its age reaches (create_time + backup_retain_days). If not
1958 /// specified, Backups created under this BackupPlan will NOT be subject to
1959 /// automatic deletion. Updating this field does NOT affect existing Backups
1960 /// under it. Backups created AFTER a successful update will automatically
1961 /// pick up the new value. NOTE: backup_retain_days must be >=
1962 /// [backup_delete_lock_days][google.cloud.gkebackup.v1.BackupPlan.RetentionPolicy.backup_delete_lock_days].
1963 /// If
1964 /// [cron_schedule][google.cloud.gkebackup.v1.BackupPlan.Schedule.cron_schedule]
1965 /// is defined, then this must be
1966 /// <= 360 * the creation interval. If
1967 /// [rpo_config][google.cloud.gkebackup.v1.BackupPlan.Schedule.rpo_config] is
1968 /// defined, then this must be
1969 /// <= 360 * [target_rpo_minutes][Schedule.rpo_config.target_rpo_minutes] /
1970 /// (1440minutes/day).
1971 ///
1972 /// Default: 0 (no automatic deletion)
1973 ///
1974 /// [google.cloud.gkebackup.v1.BackupPlan.RetentionPolicy.backup_delete_lock_days]: crate::model::backup_plan::RetentionPolicy::backup_delete_lock_days
1975 /// [google.cloud.gkebackup.v1.BackupPlan.Schedule.cron_schedule]: crate::model::backup_plan::Schedule::cron_schedule
1976 /// [google.cloud.gkebackup.v1.BackupPlan.Schedule.rpo_config]: crate::model::backup_plan::Schedule::rpo_config
1977 pub backup_retain_days: i32,
1978
1979 /// Optional. This flag denotes whether the retention policy of this
1980 /// BackupPlan is locked. If set to True, no further update is allowed on
1981 /// this policy, including the `locked` field itself.
1982 ///
1983 /// Default: False
1984 pub locked: bool,
1985
1986 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1987 }
1988
1989 impl RetentionPolicy {
1990 pub fn new() -> Self {
1991 std::default::Default::default()
1992 }
1993
1994 /// Sets the value of [backup_delete_lock_days][crate::model::backup_plan::RetentionPolicy::backup_delete_lock_days].
1995 ///
1996 /// # Example
1997 /// ```ignore,no_run
1998 /// # use google_cloud_gkebackup_v1::model::backup_plan::RetentionPolicy;
1999 /// let x = RetentionPolicy::new().set_backup_delete_lock_days(42);
2000 /// ```
2001 pub fn set_backup_delete_lock_days<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
2002 self.backup_delete_lock_days = v.into();
2003 self
2004 }
2005
2006 /// Sets the value of [backup_retain_days][crate::model::backup_plan::RetentionPolicy::backup_retain_days].
2007 ///
2008 /// # Example
2009 /// ```ignore,no_run
2010 /// # use google_cloud_gkebackup_v1::model::backup_plan::RetentionPolicy;
2011 /// let x = RetentionPolicy::new().set_backup_retain_days(42);
2012 /// ```
2013 pub fn set_backup_retain_days<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
2014 self.backup_retain_days = v.into();
2015 self
2016 }
2017
2018 /// Sets the value of [locked][crate::model::backup_plan::RetentionPolicy::locked].
2019 ///
2020 /// # Example
2021 /// ```ignore,no_run
2022 /// # use google_cloud_gkebackup_v1::model::backup_plan::RetentionPolicy;
2023 /// let x = RetentionPolicy::new().set_locked(true);
2024 /// ```
2025 pub fn set_locked<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
2026 self.locked = v.into();
2027 self
2028 }
2029 }
2030
2031 impl wkt::message::Message for RetentionPolicy {
2032 fn typename() -> &'static str {
2033 "type.googleapis.com/google.cloud.gkebackup.v1.BackupPlan.RetentionPolicy"
2034 }
2035 }
2036
2037 /// Defines scheduling parameters for automatically creating Backups
2038 /// via this BackupPlan.
2039 #[derive(Clone, Default, PartialEq)]
2040 #[non_exhaustive]
2041 pub struct Schedule {
2042 /// Optional. A standard [cron](https://wikipedia.com/wiki/cron) string that
2043 /// defines a repeating schedule for creating Backups via this BackupPlan.
2044 /// This is mutually exclusive with the
2045 /// [rpo_config][google.cloud.gkebackup.v1.BackupPlan.Schedule.rpo_config]
2046 /// field since at most one schedule can be defined for a BackupPlan. If this
2047 /// is defined, then
2048 /// [backup_retain_days][google.cloud.gkebackup.v1.BackupPlan.RetentionPolicy.backup_retain_days]
2049 /// must also be defined.
2050 ///
2051 /// Default (empty): no automatic backup creation will occur.
2052 ///
2053 /// [google.cloud.gkebackup.v1.BackupPlan.RetentionPolicy.backup_retain_days]: crate::model::backup_plan::RetentionPolicy::backup_retain_days
2054 /// [google.cloud.gkebackup.v1.BackupPlan.Schedule.rpo_config]: crate::model::backup_plan::Schedule::rpo_config
2055 pub cron_schedule: std::string::String,
2056
2057 /// Optional. This flag denotes whether automatic Backup creation is paused
2058 /// for this BackupPlan.
2059 ///
2060 /// Default: False
2061 pub paused: bool,
2062
2063 /// Optional. Defines the RPO schedule configuration for this BackupPlan.
2064 /// This is mutually exclusive with the
2065 /// [cron_schedule][google.cloud.gkebackup.v1.BackupPlan.Schedule.cron_schedule]
2066 /// field since at most one schedule can be defined for a BackupPLan. If this
2067 /// is defined, then
2068 /// [backup_retain_days][google.cloud.gkebackup.v1.BackupPlan.RetentionPolicy.backup_retain_days]
2069 /// must also be defined.
2070 ///
2071 /// Default (empty): no automatic backup creation will occur.
2072 ///
2073 /// [google.cloud.gkebackup.v1.BackupPlan.RetentionPolicy.backup_retain_days]: crate::model::backup_plan::RetentionPolicy::backup_retain_days
2074 /// [google.cloud.gkebackup.v1.BackupPlan.Schedule.cron_schedule]: crate::model::backup_plan::Schedule::cron_schedule
2075 pub rpo_config: std::option::Option<crate::model::RpoConfig>,
2076
2077 /// Output only. Start time of next scheduled backup under this BackupPlan by
2078 /// either cron_schedule or rpo config.
2079 pub next_scheduled_backup_time: std::option::Option<wkt::Timestamp>,
2080
2081 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2082 }
2083
2084 impl Schedule {
2085 pub fn new() -> Self {
2086 std::default::Default::default()
2087 }
2088
2089 /// Sets the value of [cron_schedule][crate::model::backup_plan::Schedule::cron_schedule].
2090 ///
2091 /// # Example
2092 /// ```ignore,no_run
2093 /// # use google_cloud_gkebackup_v1::model::backup_plan::Schedule;
2094 /// let x = Schedule::new().set_cron_schedule("example");
2095 /// ```
2096 pub fn set_cron_schedule<T: std::convert::Into<std::string::String>>(
2097 mut self,
2098 v: T,
2099 ) -> Self {
2100 self.cron_schedule = v.into();
2101 self
2102 }
2103
2104 /// Sets the value of [paused][crate::model::backup_plan::Schedule::paused].
2105 ///
2106 /// # Example
2107 /// ```ignore,no_run
2108 /// # use google_cloud_gkebackup_v1::model::backup_plan::Schedule;
2109 /// let x = Schedule::new().set_paused(true);
2110 /// ```
2111 pub fn set_paused<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
2112 self.paused = v.into();
2113 self
2114 }
2115
2116 /// Sets the value of [rpo_config][crate::model::backup_plan::Schedule::rpo_config].
2117 ///
2118 /// # Example
2119 /// ```ignore,no_run
2120 /// # use google_cloud_gkebackup_v1::model::backup_plan::Schedule;
2121 /// use google_cloud_gkebackup_v1::model::RpoConfig;
2122 /// let x = Schedule::new().set_rpo_config(RpoConfig::default()/* use setters */);
2123 /// ```
2124 pub fn set_rpo_config<T>(mut self, v: T) -> Self
2125 where
2126 T: std::convert::Into<crate::model::RpoConfig>,
2127 {
2128 self.rpo_config = std::option::Option::Some(v.into());
2129 self
2130 }
2131
2132 /// Sets or clears the value of [rpo_config][crate::model::backup_plan::Schedule::rpo_config].
2133 ///
2134 /// # Example
2135 /// ```ignore,no_run
2136 /// # use google_cloud_gkebackup_v1::model::backup_plan::Schedule;
2137 /// use google_cloud_gkebackup_v1::model::RpoConfig;
2138 /// let x = Schedule::new().set_or_clear_rpo_config(Some(RpoConfig::default()/* use setters */));
2139 /// let x = Schedule::new().set_or_clear_rpo_config(None::<RpoConfig>);
2140 /// ```
2141 pub fn set_or_clear_rpo_config<T>(mut self, v: std::option::Option<T>) -> Self
2142 where
2143 T: std::convert::Into<crate::model::RpoConfig>,
2144 {
2145 self.rpo_config = v.map(|x| x.into());
2146 self
2147 }
2148
2149 /// Sets the value of [next_scheduled_backup_time][crate::model::backup_plan::Schedule::next_scheduled_backup_time].
2150 ///
2151 /// # Example
2152 /// ```ignore,no_run
2153 /// # use google_cloud_gkebackup_v1::model::backup_plan::Schedule;
2154 /// use wkt::Timestamp;
2155 /// let x = Schedule::new().set_next_scheduled_backup_time(Timestamp::default()/* use setters */);
2156 /// ```
2157 pub fn set_next_scheduled_backup_time<T>(mut self, v: T) -> Self
2158 where
2159 T: std::convert::Into<wkt::Timestamp>,
2160 {
2161 self.next_scheduled_backup_time = std::option::Option::Some(v.into());
2162 self
2163 }
2164
2165 /// Sets or clears the value of [next_scheduled_backup_time][crate::model::backup_plan::Schedule::next_scheduled_backup_time].
2166 ///
2167 /// # Example
2168 /// ```ignore,no_run
2169 /// # use google_cloud_gkebackup_v1::model::backup_plan::Schedule;
2170 /// use wkt::Timestamp;
2171 /// let x = Schedule::new().set_or_clear_next_scheduled_backup_time(Some(Timestamp::default()/* use setters */));
2172 /// let x = Schedule::new().set_or_clear_next_scheduled_backup_time(None::<Timestamp>);
2173 /// ```
2174 pub fn set_or_clear_next_scheduled_backup_time<T>(
2175 mut self,
2176 v: std::option::Option<T>,
2177 ) -> Self
2178 where
2179 T: std::convert::Into<wkt::Timestamp>,
2180 {
2181 self.next_scheduled_backup_time = v.map(|x| x.into());
2182 self
2183 }
2184 }
2185
2186 impl wkt::message::Message for Schedule {
2187 fn typename() -> &'static str {
2188 "type.googleapis.com/google.cloud.gkebackup.v1.BackupPlan.Schedule"
2189 }
2190 }
2191
2192 /// BackupConfig defines the configuration of Backups created via this
2193 /// BackupPlan.
2194 #[derive(Clone, Default, PartialEq)]
2195 #[non_exhaustive]
2196 pub struct BackupConfig {
2197 /// Optional. This flag specifies whether volume data should be backed up
2198 /// when PVCs are included in the scope of a Backup.
2199 ///
2200 /// Default: False
2201 pub include_volume_data: bool,
2202
2203 /// Optional. This flag specifies whether Kubernetes Secret resources should
2204 /// be included when they fall into the scope of Backups.
2205 ///
2206 /// Default: False
2207 pub include_secrets: bool,
2208
2209 /// Optional. This defines a customer managed encryption key that will be
2210 /// used to encrypt the "config" portion (the Kubernetes resources) of
2211 /// Backups created via this plan.
2212 ///
2213 /// Default (empty): Config backup artifacts will not be encrypted.
2214 pub encryption_key: std::option::Option<crate::model::EncryptionKey>,
2215
2216 /// Optional. If false, Backups will fail when Backup for GKE detects
2217 /// Kubernetes configuration that is non-standard or
2218 /// requires additional setup to restore.
2219 ///
2220 /// Default: False
2221 pub permissive_mode: bool,
2222
2223 /// This defines the "scope" of the Backup - which namespaced
2224 /// resources in the cluster will be included in a Backup.
2225 /// Exactly one of the fields of backup_scope MUST be specified.
2226 pub backup_scope:
2227 std::option::Option<crate::model::backup_plan::backup_config::BackupScope>,
2228
2229 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2230 }
2231
2232 impl BackupConfig {
2233 pub fn new() -> Self {
2234 std::default::Default::default()
2235 }
2236
2237 /// Sets the value of [include_volume_data][crate::model::backup_plan::BackupConfig::include_volume_data].
2238 ///
2239 /// # Example
2240 /// ```ignore,no_run
2241 /// # use google_cloud_gkebackup_v1::model::backup_plan::BackupConfig;
2242 /// let x = BackupConfig::new().set_include_volume_data(true);
2243 /// ```
2244 pub fn set_include_volume_data<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
2245 self.include_volume_data = v.into();
2246 self
2247 }
2248
2249 /// Sets the value of [include_secrets][crate::model::backup_plan::BackupConfig::include_secrets].
2250 ///
2251 /// # Example
2252 /// ```ignore,no_run
2253 /// # use google_cloud_gkebackup_v1::model::backup_plan::BackupConfig;
2254 /// let x = BackupConfig::new().set_include_secrets(true);
2255 /// ```
2256 pub fn set_include_secrets<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
2257 self.include_secrets = v.into();
2258 self
2259 }
2260
2261 /// Sets the value of [encryption_key][crate::model::backup_plan::BackupConfig::encryption_key].
2262 ///
2263 /// # Example
2264 /// ```ignore,no_run
2265 /// # use google_cloud_gkebackup_v1::model::backup_plan::BackupConfig;
2266 /// use google_cloud_gkebackup_v1::model::EncryptionKey;
2267 /// let x = BackupConfig::new().set_encryption_key(EncryptionKey::default()/* use setters */);
2268 /// ```
2269 pub fn set_encryption_key<T>(mut self, v: T) -> Self
2270 where
2271 T: std::convert::Into<crate::model::EncryptionKey>,
2272 {
2273 self.encryption_key = std::option::Option::Some(v.into());
2274 self
2275 }
2276
2277 /// Sets or clears the value of [encryption_key][crate::model::backup_plan::BackupConfig::encryption_key].
2278 ///
2279 /// # Example
2280 /// ```ignore,no_run
2281 /// # use google_cloud_gkebackup_v1::model::backup_plan::BackupConfig;
2282 /// use google_cloud_gkebackup_v1::model::EncryptionKey;
2283 /// let x = BackupConfig::new().set_or_clear_encryption_key(Some(EncryptionKey::default()/* use setters */));
2284 /// let x = BackupConfig::new().set_or_clear_encryption_key(None::<EncryptionKey>);
2285 /// ```
2286 pub fn set_or_clear_encryption_key<T>(mut self, v: std::option::Option<T>) -> Self
2287 where
2288 T: std::convert::Into<crate::model::EncryptionKey>,
2289 {
2290 self.encryption_key = v.map(|x| x.into());
2291 self
2292 }
2293
2294 /// Sets the value of [permissive_mode][crate::model::backup_plan::BackupConfig::permissive_mode].
2295 ///
2296 /// # Example
2297 /// ```ignore,no_run
2298 /// # use google_cloud_gkebackup_v1::model::backup_plan::BackupConfig;
2299 /// let x = BackupConfig::new().set_permissive_mode(true);
2300 /// ```
2301 pub fn set_permissive_mode<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
2302 self.permissive_mode = v.into();
2303 self
2304 }
2305
2306 /// Sets the value of [backup_scope][crate::model::backup_plan::BackupConfig::backup_scope].
2307 ///
2308 /// Note that all the setters affecting `backup_scope` are mutually
2309 /// exclusive.
2310 ///
2311 /// # Example
2312 /// ```ignore,no_run
2313 /// # use google_cloud_gkebackup_v1::model::backup_plan::BackupConfig;
2314 /// use google_cloud_gkebackup_v1::model::backup_plan::backup_config::BackupScope;
2315 /// let x = BackupConfig::new().set_backup_scope(Some(BackupScope::AllNamespaces(true)));
2316 /// ```
2317 pub fn set_backup_scope<
2318 T: std::convert::Into<
2319 std::option::Option<crate::model::backup_plan::backup_config::BackupScope>,
2320 >,
2321 >(
2322 mut self,
2323 v: T,
2324 ) -> Self {
2325 self.backup_scope = v.into();
2326 self
2327 }
2328
2329 /// The value of [backup_scope][crate::model::backup_plan::BackupConfig::backup_scope]
2330 /// if it holds a `AllNamespaces`, `None` if the field is not set or
2331 /// holds a different branch.
2332 pub fn all_namespaces(&self) -> std::option::Option<&bool> {
2333 #[allow(unreachable_patterns)]
2334 self.backup_scope.as_ref().and_then(|v| match v {
2335 crate::model::backup_plan::backup_config::BackupScope::AllNamespaces(v) => {
2336 std::option::Option::Some(v)
2337 }
2338 _ => std::option::Option::None,
2339 })
2340 }
2341
2342 /// Sets the value of [backup_scope][crate::model::backup_plan::BackupConfig::backup_scope]
2343 /// to hold a `AllNamespaces`.
2344 ///
2345 /// Note that all the setters affecting `backup_scope` are
2346 /// mutually exclusive.
2347 ///
2348 /// # Example
2349 /// ```ignore,no_run
2350 /// # use google_cloud_gkebackup_v1::model::backup_plan::BackupConfig;
2351 /// let x = BackupConfig::new().set_all_namespaces(true);
2352 /// assert!(x.all_namespaces().is_some());
2353 /// assert!(x.selected_namespaces().is_none());
2354 /// assert!(x.selected_applications().is_none());
2355 /// ```
2356 pub fn set_all_namespaces<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
2357 self.backup_scope = std::option::Option::Some(
2358 crate::model::backup_plan::backup_config::BackupScope::AllNamespaces(v.into()),
2359 );
2360 self
2361 }
2362
2363 /// The value of [backup_scope][crate::model::backup_plan::BackupConfig::backup_scope]
2364 /// if it holds a `SelectedNamespaces`, `None` if the field is not set or
2365 /// holds a different branch.
2366 pub fn selected_namespaces(
2367 &self,
2368 ) -> std::option::Option<&std::boxed::Box<crate::model::Namespaces>> {
2369 #[allow(unreachable_patterns)]
2370 self.backup_scope.as_ref().and_then(|v| match v {
2371 crate::model::backup_plan::backup_config::BackupScope::SelectedNamespaces(v) => {
2372 std::option::Option::Some(v)
2373 }
2374 _ => std::option::Option::None,
2375 })
2376 }
2377
2378 /// Sets the value of [backup_scope][crate::model::backup_plan::BackupConfig::backup_scope]
2379 /// to hold a `SelectedNamespaces`.
2380 ///
2381 /// Note that all the setters affecting `backup_scope` are
2382 /// mutually exclusive.
2383 ///
2384 /// # Example
2385 /// ```ignore,no_run
2386 /// # use google_cloud_gkebackup_v1::model::backup_plan::BackupConfig;
2387 /// use google_cloud_gkebackup_v1::model::Namespaces;
2388 /// let x = BackupConfig::new().set_selected_namespaces(Namespaces::default()/* use setters */);
2389 /// assert!(x.selected_namespaces().is_some());
2390 /// assert!(x.all_namespaces().is_none());
2391 /// assert!(x.selected_applications().is_none());
2392 /// ```
2393 pub fn set_selected_namespaces<
2394 T: std::convert::Into<std::boxed::Box<crate::model::Namespaces>>,
2395 >(
2396 mut self,
2397 v: T,
2398 ) -> Self {
2399 self.backup_scope = std::option::Option::Some(
2400 crate::model::backup_plan::backup_config::BackupScope::SelectedNamespaces(v.into()),
2401 );
2402 self
2403 }
2404
2405 /// The value of [backup_scope][crate::model::backup_plan::BackupConfig::backup_scope]
2406 /// if it holds a `SelectedApplications`, `None` if the field is not set or
2407 /// holds a different branch.
2408 pub fn selected_applications(
2409 &self,
2410 ) -> std::option::Option<&std::boxed::Box<crate::model::NamespacedNames>> {
2411 #[allow(unreachable_patterns)]
2412 self.backup_scope.as_ref().and_then(|v| match v {
2413 crate::model::backup_plan::backup_config::BackupScope::SelectedApplications(v) => {
2414 std::option::Option::Some(v)
2415 }
2416 _ => std::option::Option::None,
2417 })
2418 }
2419
2420 /// Sets the value of [backup_scope][crate::model::backup_plan::BackupConfig::backup_scope]
2421 /// to hold a `SelectedApplications`.
2422 ///
2423 /// Note that all the setters affecting `backup_scope` are
2424 /// mutually exclusive.
2425 ///
2426 /// # Example
2427 /// ```ignore,no_run
2428 /// # use google_cloud_gkebackup_v1::model::backup_plan::BackupConfig;
2429 /// use google_cloud_gkebackup_v1::model::NamespacedNames;
2430 /// let x = BackupConfig::new().set_selected_applications(NamespacedNames::default()/* use setters */);
2431 /// assert!(x.selected_applications().is_some());
2432 /// assert!(x.all_namespaces().is_none());
2433 /// assert!(x.selected_namespaces().is_none());
2434 /// ```
2435 pub fn set_selected_applications<
2436 T: std::convert::Into<std::boxed::Box<crate::model::NamespacedNames>>,
2437 >(
2438 mut self,
2439 v: T,
2440 ) -> Self {
2441 self.backup_scope = std::option::Option::Some(
2442 crate::model::backup_plan::backup_config::BackupScope::SelectedApplications(
2443 v.into(),
2444 ),
2445 );
2446 self
2447 }
2448 }
2449
2450 impl wkt::message::Message for BackupConfig {
2451 fn typename() -> &'static str {
2452 "type.googleapis.com/google.cloud.gkebackup.v1.BackupPlan.BackupConfig"
2453 }
2454 }
2455
2456 /// Defines additional types related to [BackupConfig].
2457 pub mod backup_config {
2458 #[allow(unused_imports)]
2459 use super::*;
2460
2461 /// This defines the "scope" of the Backup - which namespaced
2462 /// resources in the cluster will be included in a Backup.
2463 /// Exactly one of the fields of backup_scope MUST be specified.
2464 #[derive(Clone, Debug, PartialEq)]
2465 #[non_exhaustive]
2466 pub enum BackupScope {
2467 /// If True, include all namespaced resources
2468 AllNamespaces(bool),
2469 /// If set, include just the resources in the listed namespaces.
2470 SelectedNamespaces(std::boxed::Box<crate::model::Namespaces>),
2471 /// If set, include just the resources referenced by the listed
2472 /// ProtectedApplications.
2473 SelectedApplications(std::boxed::Box<crate::model::NamespacedNames>),
2474 }
2475 }
2476
2477 /// State
2478 ///
2479 /// # Working with unknown values
2480 ///
2481 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
2482 /// additional enum variants at any time. Adding new variants is not considered
2483 /// a breaking change. Applications should write their code in anticipation of:
2484 ///
2485 /// - New values appearing in future releases of the client library, **and**
2486 /// - New values received dynamically, without application changes.
2487 ///
2488 /// Please consult the [Working with enums] section in the user guide for some
2489 /// guidelines.
2490 ///
2491 /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
2492 #[derive(Clone, Debug, PartialEq)]
2493 #[non_exhaustive]
2494 pub enum State {
2495 /// Default first value for Enums.
2496 Unspecified,
2497 /// Waiting for cluster state to be RUNNING.
2498 ClusterPending,
2499 /// The BackupPlan is in the process of being created.
2500 Provisioning,
2501 /// The BackupPlan has successfully been created and is ready for Backups.
2502 Ready,
2503 /// BackupPlan creation has failed.
2504 Failed,
2505 /// The BackupPlan has been deactivated.
2506 Deactivated,
2507 /// The BackupPlan is in the process of being deleted.
2508 Deleting,
2509 /// If set, the enum was initialized with an unknown value.
2510 ///
2511 /// Applications can examine the value using [State::value] or
2512 /// [State::name].
2513 UnknownValue(state::UnknownValue),
2514 }
2515
2516 #[doc(hidden)]
2517 pub mod state {
2518 #[allow(unused_imports)]
2519 use super::*;
2520 #[derive(Clone, Debug, PartialEq)]
2521 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
2522 }
2523
2524 impl State {
2525 /// Gets the enum value.
2526 ///
2527 /// Returns `None` if the enum contains an unknown value deserialized from
2528 /// the string representation of enums.
2529 pub fn value(&self) -> std::option::Option<i32> {
2530 match self {
2531 Self::Unspecified => std::option::Option::Some(0),
2532 Self::ClusterPending => std::option::Option::Some(1),
2533 Self::Provisioning => std::option::Option::Some(2),
2534 Self::Ready => std::option::Option::Some(3),
2535 Self::Failed => std::option::Option::Some(4),
2536 Self::Deactivated => std::option::Option::Some(5),
2537 Self::Deleting => std::option::Option::Some(6),
2538 Self::UnknownValue(u) => u.0.value(),
2539 }
2540 }
2541
2542 /// Gets the enum value as a string.
2543 ///
2544 /// Returns `None` if the enum contains an unknown value deserialized from
2545 /// the integer representation of enums.
2546 pub fn name(&self) -> std::option::Option<&str> {
2547 match self {
2548 Self::Unspecified => std::option::Option::Some("STATE_UNSPECIFIED"),
2549 Self::ClusterPending => std::option::Option::Some("CLUSTER_PENDING"),
2550 Self::Provisioning => std::option::Option::Some("PROVISIONING"),
2551 Self::Ready => std::option::Option::Some("READY"),
2552 Self::Failed => std::option::Option::Some("FAILED"),
2553 Self::Deactivated => std::option::Option::Some("DEACTIVATED"),
2554 Self::Deleting => std::option::Option::Some("DELETING"),
2555 Self::UnknownValue(u) => u.0.name(),
2556 }
2557 }
2558 }
2559
2560 impl std::default::Default for State {
2561 fn default() -> Self {
2562 use std::convert::From;
2563 Self::from(0)
2564 }
2565 }
2566
2567 impl std::fmt::Display for State {
2568 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
2569 wkt::internal::display_enum(f, self.name(), self.value())
2570 }
2571 }
2572
2573 impl std::convert::From<i32> for State {
2574 fn from(value: i32) -> Self {
2575 match value {
2576 0 => Self::Unspecified,
2577 1 => Self::ClusterPending,
2578 2 => Self::Provisioning,
2579 3 => Self::Ready,
2580 4 => Self::Failed,
2581 5 => Self::Deactivated,
2582 6 => Self::Deleting,
2583 _ => Self::UnknownValue(state::UnknownValue(
2584 wkt::internal::UnknownEnumValue::Integer(value),
2585 )),
2586 }
2587 }
2588 }
2589
2590 impl std::convert::From<&str> for State {
2591 fn from(value: &str) -> Self {
2592 use std::string::ToString;
2593 match value {
2594 "STATE_UNSPECIFIED" => Self::Unspecified,
2595 "CLUSTER_PENDING" => Self::ClusterPending,
2596 "PROVISIONING" => Self::Provisioning,
2597 "READY" => Self::Ready,
2598 "FAILED" => Self::Failed,
2599 "DEACTIVATED" => Self::Deactivated,
2600 "DELETING" => Self::Deleting,
2601 _ => Self::UnknownValue(state::UnknownValue(
2602 wkt::internal::UnknownEnumValue::String(value.to_string()),
2603 )),
2604 }
2605 }
2606 }
2607
2608 impl serde::ser::Serialize for State {
2609 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
2610 where
2611 S: serde::Serializer,
2612 {
2613 match self {
2614 Self::Unspecified => serializer.serialize_i32(0),
2615 Self::ClusterPending => serializer.serialize_i32(1),
2616 Self::Provisioning => serializer.serialize_i32(2),
2617 Self::Ready => serializer.serialize_i32(3),
2618 Self::Failed => serializer.serialize_i32(4),
2619 Self::Deactivated => serializer.serialize_i32(5),
2620 Self::Deleting => serializer.serialize_i32(6),
2621 Self::UnknownValue(u) => u.0.serialize(serializer),
2622 }
2623 }
2624 }
2625
2626 impl<'de> serde::de::Deserialize<'de> for State {
2627 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
2628 where
2629 D: serde::Deserializer<'de>,
2630 {
2631 deserializer.deserialize_any(wkt::internal::EnumVisitor::<State>::new(
2632 ".google.cloud.gkebackup.v1.BackupPlan.State",
2633 ))
2634 }
2635 }
2636}
2637
2638/// Defines RPO scheduling configuration for automatically creating
2639/// Backups via this BackupPlan.
2640#[derive(Clone, Default, PartialEq)]
2641#[non_exhaustive]
2642pub struct RpoConfig {
2643 /// Required. Defines the target RPO for the BackupPlan in minutes, which means
2644 /// the target maximum data loss in time that is acceptable for this
2645 /// BackupPlan. This must be at least 60, i.e., 1 hour, and at most 86400,
2646 /// i.e., 60 days.
2647 pub target_rpo_minutes: i32,
2648
2649 /// Optional. User specified time windows during which backup can NOT happen
2650 /// for this BackupPlan - backups should start and finish outside of any given
2651 /// exclusion window. Note: backup jobs will be scheduled to start and
2652 /// finish outside the duration of the window as much as possible, but
2653 /// running jobs will not get canceled when it runs into the window.
2654 /// All the time and date values in exclusion_windows entry in the API are in
2655 /// UTC.
2656 /// We only allow <=1 recurrence (daily or weekly) exclusion window for a
2657 /// BackupPlan while no restriction on number of single occurrence
2658 /// windows.
2659 pub exclusion_windows: std::vec::Vec<crate::model::ExclusionWindow>,
2660
2661 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2662}
2663
2664impl RpoConfig {
2665 pub fn new() -> Self {
2666 std::default::Default::default()
2667 }
2668
2669 /// Sets the value of [target_rpo_minutes][crate::model::RpoConfig::target_rpo_minutes].
2670 ///
2671 /// # Example
2672 /// ```ignore,no_run
2673 /// # use google_cloud_gkebackup_v1::model::RpoConfig;
2674 /// let x = RpoConfig::new().set_target_rpo_minutes(42);
2675 /// ```
2676 pub fn set_target_rpo_minutes<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
2677 self.target_rpo_minutes = v.into();
2678 self
2679 }
2680
2681 /// Sets the value of [exclusion_windows][crate::model::RpoConfig::exclusion_windows].
2682 ///
2683 /// # Example
2684 /// ```ignore,no_run
2685 /// # use google_cloud_gkebackup_v1::model::RpoConfig;
2686 /// use google_cloud_gkebackup_v1::model::ExclusionWindow;
2687 /// let x = RpoConfig::new()
2688 /// .set_exclusion_windows([
2689 /// ExclusionWindow::default()/* use setters */,
2690 /// ExclusionWindow::default()/* use (different) setters */,
2691 /// ]);
2692 /// ```
2693 pub fn set_exclusion_windows<T, V>(mut self, v: T) -> Self
2694 where
2695 T: std::iter::IntoIterator<Item = V>,
2696 V: std::convert::Into<crate::model::ExclusionWindow>,
2697 {
2698 use std::iter::Iterator;
2699 self.exclusion_windows = v.into_iter().map(|i| i.into()).collect();
2700 self
2701 }
2702}
2703
2704impl wkt::message::Message for RpoConfig {
2705 fn typename() -> &'static str {
2706 "type.googleapis.com/google.cloud.gkebackup.v1.RpoConfig"
2707 }
2708}
2709
2710/// Defines a time window during which no backup should
2711/// happen. All time and date are in UTC.
2712#[derive(Clone, Default, PartialEq)]
2713#[non_exhaustive]
2714pub struct ExclusionWindow {
2715 /// Required. Specifies the start time of the window using time of the day in
2716 /// UTC.
2717 pub start_time: std::option::Option<google_cloud_type::model::TimeOfDay>,
2718
2719 /// Required. Specifies duration of the window.
2720 /// Duration must be >= 5 minutes and < (target RPO - 20 minutes).
2721 /// Additional restrictions based on the recurrence type to allow some time for
2722 /// backup to happen:
2723 ///
2724 /// - single_occurrence_date: no restriction, but UI may warn about this when
2725 /// duration >= target RPO
2726 /// - daily window: duration < 24 hours
2727 /// - weekly window:
2728 /// - days of week includes all seven days of a week: duration < 24 hours
2729 /// - all other weekly window: duration < 168 hours (i.e., 24 * 7 hours)
2730 pub duration: std::option::Option<wkt::Duration>,
2731
2732 /// Required. Specifies the day(s) on which the exclusion window takes
2733 /// effect. Exactly one of the fields MUST be specified.
2734 pub recurrence: std::option::Option<crate::model::exclusion_window::Recurrence>,
2735
2736 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2737}
2738
2739impl ExclusionWindow {
2740 pub fn new() -> Self {
2741 std::default::Default::default()
2742 }
2743
2744 /// Sets the value of [start_time][crate::model::ExclusionWindow::start_time].
2745 ///
2746 /// # Example
2747 /// ```ignore,no_run
2748 /// # use google_cloud_gkebackup_v1::model::ExclusionWindow;
2749 /// use google_cloud_type::model::TimeOfDay;
2750 /// let x = ExclusionWindow::new().set_start_time(TimeOfDay::default()/* use setters */);
2751 /// ```
2752 pub fn set_start_time<T>(mut self, v: T) -> Self
2753 where
2754 T: std::convert::Into<google_cloud_type::model::TimeOfDay>,
2755 {
2756 self.start_time = std::option::Option::Some(v.into());
2757 self
2758 }
2759
2760 /// Sets or clears the value of [start_time][crate::model::ExclusionWindow::start_time].
2761 ///
2762 /// # Example
2763 /// ```ignore,no_run
2764 /// # use google_cloud_gkebackup_v1::model::ExclusionWindow;
2765 /// use google_cloud_type::model::TimeOfDay;
2766 /// let x = ExclusionWindow::new().set_or_clear_start_time(Some(TimeOfDay::default()/* use setters */));
2767 /// let x = ExclusionWindow::new().set_or_clear_start_time(None::<TimeOfDay>);
2768 /// ```
2769 pub fn set_or_clear_start_time<T>(mut self, v: std::option::Option<T>) -> Self
2770 where
2771 T: std::convert::Into<google_cloud_type::model::TimeOfDay>,
2772 {
2773 self.start_time = v.map(|x| x.into());
2774 self
2775 }
2776
2777 /// Sets the value of [duration][crate::model::ExclusionWindow::duration].
2778 ///
2779 /// # Example
2780 /// ```ignore,no_run
2781 /// # use google_cloud_gkebackup_v1::model::ExclusionWindow;
2782 /// use wkt::Duration;
2783 /// let x = ExclusionWindow::new().set_duration(Duration::default()/* use setters */);
2784 /// ```
2785 pub fn set_duration<T>(mut self, v: T) -> Self
2786 where
2787 T: std::convert::Into<wkt::Duration>,
2788 {
2789 self.duration = std::option::Option::Some(v.into());
2790 self
2791 }
2792
2793 /// Sets or clears the value of [duration][crate::model::ExclusionWindow::duration].
2794 ///
2795 /// # Example
2796 /// ```ignore,no_run
2797 /// # use google_cloud_gkebackup_v1::model::ExclusionWindow;
2798 /// use wkt::Duration;
2799 /// let x = ExclusionWindow::new().set_or_clear_duration(Some(Duration::default()/* use setters */));
2800 /// let x = ExclusionWindow::new().set_or_clear_duration(None::<Duration>);
2801 /// ```
2802 pub fn set_or_clear_duration<T>(mut self, v: std::option::Option<T>) -> Self
2803 where
2804 T: std::convert::Into<wkt::Duration>,
2805 {
2806 self.duration = v.map(|x| x.into());
2807 self
2808 }
2809
2810 /// Sets the value of [recurrence][crate::model::ExclusionWindow::recurrence].
2811 ///
2812 /// Note that all the setters affecting `recurrence` are mutually
2813 /// exclusive.
2814 ///
2815 /// # Example
2816 /// ```ignore,no_run
2817 /// # use google_cloud_gkebackup_v1::model::ExclusionWindow;
2818 /// use google_cloud_gkebackup_v1::model::exclusion_window::Recurrence;
2819 /// let x = ExclusionWindow::new().set_recurrence(Some(Recurrence::Daily(true)));
2820 /// ```
2821 pub fn set_recurrence<
2822 T: std::convert::Into<std::option::Option<crate::model::exclusion_window::Recurrence>>,
2823 >(
2824 mut self,
2825 v: T,
2826 ) -> Self {
2827 self.recurrence = v.into();
2828 self
2829 }
2830
2831 /// The value of [recurrence][crate::model::ExclusionWindow::recurrence]
2832 /// if it holds a `SingleOccurrenceDate`, `None` if the field is not set or
2833 /// holds a different branch.
2834 pub fn single_occurrence_date(
2835 &self,
2836 ) -> std::option::Option<&std::boxed::Box<google_cloud_type::model::Date>> {
2837 #[allow(unreachable_patterns)]
2838 self.recurrence.as_ref().and_then(|v| match v {
2839 crate::model::exclusion_window::Recurrence::SingleOccurrenceDate(v) => {
2840 std::option::Option::Some(v)
2841 }
2842 _ => std::option::Option::None,
2843 })
2844 }
2845
2846 /// Sets the value of [recurrence][crate::model::ExclusionWindow::recurrence]
2847 /// to hold a `SingleOccurrenceDate`.
2848 ///
2849 /// Note that all the setters affecting `recurrence` are
2850 /// mutually exclusive.
2851 ///
2852 /// # Example
2853 /// ```ignore,no_run
2854 /// # use google_cloud_gkebackup_v1::model::ExclusionWindow;
2855 /// use google_cloud_type::model::Date;
2856 /// let x = ExclusionWindow::new().set_single_occurrence_date(Date::default()/* use setters */);
2857 /// assert!(x.single_occurrence_date().is_some());
2858 /// assert!(x.daily().is_none());
2859 /// assert!(x.days_of_week().is_none());
2860 /// ```
2861 pub fn set_single_occurrence_date<
2862 T: std::convert::Into<std::boxed::Box<google_cloud_type::model::Date>>,
2863 >(
2864 mut self,
2865 v: T,
2866 ) -> Self {
2867 self.recurrence = std::option::Option::Some(
2868 crate::model::exclusion_window::Recurrence::SingleOccurrenceDate(v.into()),
2869 );
2870 self
2871 }
2872
2873 /// The value of [recurrence][crate::model::ExclusionWindow::recurrence]
2874 /// if it holds a `Daily`, `None` if the field is not set or
2875 /// holds a different branch.
2876 pub fn daily(&self) -> std::option::Option<&bool> {
2877 #[allow(unreachable_patterns)]
2878 self.recurrence.as_ref().and_then(|v| match v {
2879 crate::model::exclusion_window::Recurrence::Daily(v) => std::option::Option::Some(v),
2880 _ => std::option::Option::None,
2881 })
2882 }
2883
2884 /// Sets the value of [recurrence][crate::model::ExclusionWindow::recurrence]
2885 /// to hold a `Daily`.
2886 ///
2887 /// Note that all the setters affecting `recurrence` are
2888 /// mutually exclusive.
2889 ///
2890 /// # Example
2891 /// ```ignore,no_run
2892 /// # use google_cloud_gkebackup_v1::model::ExclusionWindow;
2893 /// let x = ExclusionWindow::new().set_daily(true);
2894 /// assert!(x.daily().is_some());
2895 /// assert!(x.single_occurrence_date().is_none());
2896 /// assert!(x.days_of_week().is_none());
2897 /// ```
2898 pub fn set_daily<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
2899 self.recurrence =
2900 std::option::Option::Some(crate::model::exclusion_window::Recurrence::Daily(v.into()));
2901 self
2902 }
2903
2904 /// The value of [recurrence][crate::model::ExclusionWindow::recurrence]
2905 /// if it holds a `DaysOfWeek`, `None` if the field is not set or
2906 /// holds a different branch.
2907 pub fn days_of_week(
2908 &self,
2909 ) -> std::option::Option<&std::boxed::Box<crate::model::exclusion_window::DayOfWeekList>> {
2910 #[allow(unreachable_patterns)]
2911 self.recurrence.as_ref().and_then(|v| match v {
2912 crate::model::exclusion_window::Recurrence::DaysOfWeek(v) => {
2913 std::option::Option::Some(v)
2914 }
2915 _ => std::option::Option::None,
2916 })
2917 }
2918
2919 /// Sets the value of [recurrence][crate::model::ExclusionWindow::recurrence]
2920 /// to hold a `DaysOfWeek`.
2921 ///
2922 /// Note that all the setters affecting `recurrence` are
2923 /// mutually exclusive.
2924 ///
2925 /// # Example
2926 /// ```ignore,no_run
2927 /// # use google_cloud_gkebackup_v1::model::ExclusionWindow;
2928 /// use google_cloud_gkebackup_v1::model::exclusion_window::DayOfWeekList;
2929 /// let x = ExclusionWindow::new().set_days_of_week(DayOfWeekList::default()/* use setters */);
2930 /// assert!(x.days_of_week().is_some());
2931 /// assert!(x.single_occurrence_date().is_none());
2932 /// assert!(x.daily().is_none());
2933 /// ```
2934 pub fn set_days_of_week<
2935 T: std::convert::Into<std::boxed::Box<crate::model::exclusion_window::DayOfWeekList>>,
2936 >(
2937 mut self,
2938 v: T,
2939 ) -> Self {
2940 self.recurrence = std::option::Option::Some(
2941 crate::model::exclusion_window::Recurrence::DaysOfWeek(v.into()),
2942 );
2943 self
2944 }
2945}
2946
2947impl wkt::message::Message for ExclusionWindow {
2948 fn typename() -> &'static str {
2949 "type.googleapis.com/google.cloud.gkebackup.v1.ExclusionWindow"
2950 }
2951}
2952
2953/// Defines additional types related to [ExclusionWindow].
2954pub mod exclusion_window {
2955 #[allow(unused_imports)]
2956 use super::*;
2957
2958 /// Holds repeated DaysOfWeek values as a container.
2959 #[derive(Clone, Default, PartialEq)]
2960 #[non_exhaustive]
2961 pub struct DayOfWeekList {
2962 /// Optional. A list of days of week.
2963 pub days_of_week: std::vec::Vec<google_cloud_type::model::DayOfWeek>,
2964
2965 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2966 }
2967
2968 impl DayOfWeekList {
2969 pub fn new() -> Self {
2970 std::default::Default::default()
2971 }
2972
2973 /// Sets the value of [days_of_week][crate::model::exclusion_window::DayOfWeekList::days_of_week].
2974 ///
2975 /// # Example
2976 /// ```ignore,no_run
2977 /// # use google_cloud_gkebackup_v1::model::exclusion_window::DayOfWeekList;
2978 /// use google_cloud_type::model::DayOfWeek;
2979 /// let x = DayOfWeekList::new().set_days_of_week([
2980 /// DayOfWeek::Monday,
2981 /// DayOfWeek::Tuesday,
2982 /// DayOfWeek::Wednesday,
2983 /// ]);
2984 /// ```
2985 pub fn set_days_of_week<T, V>(mut self, v: T) -> Self
2986 where
2987 T: std::iter::IntoIterator<Item = V>,
2988 V: std::convert::Into<google_cloud_type::model::DayOfWeek>,
2989 {
2990 use std::iter::Iterator;
2991 self.days_of_week = v.into_iter().map(|i| i.into()).collect();
2992 self
2993 }
2994 }
2995
2996 impl wkt::message::Message for DayOfWeekList {
2997 fn typename() -> &'static str {
2998 "type.googleapis.com/google.cloud.gkebackup.v1.ExclusionWindow.DayOfWeekList"
2999 }
3000 }
3001
3002 /// Required. Specifies the day(s) on which the exclusion window takes
3003 /// effect. Exactly one of the fields MUST be specified.
3004 #[derive(Clone, Debug, PartialEq)]
3005 #[non_exhaustive]
3006 pub enum Recurrence {
3007 /// No recurrence. The exclusion window occurs only once and on this
3008 /// date in UTC.
3009 SingleOccurrenceDate(std::boxed::Box<google_cloud_type::model::Date>),
3010 /// The exclusion window occurs every day if set to "True".
3011 /// Specifying this field to "False" is an error.
3012 Daily(bool),
3013 /// The exclusion window occurs on these days of each week in UTC.
3014 DaysOfWeek(std::boxed::Box<crate::model::exclusion_window::DayOfWeekList>),
3015 }
3016}
3017
3018/// A BackupPlanBinding binds a BackupPlan with a BackupChannel.
3019/// This resource is created automatically when a BackupPlan is created using a
3020/// BackupChannel. This also serves as a holder for cross-project fields
3021/// that need to be displayed in the current project.
3022#[derive(Clone, Default, PartialEq)]
3023#[non_exhaustive]
3024pub struct BackupPlanBinding {
3025 /// Identifier. The fully qualified name of the BackupPlanBinding.
3026 /// `projects/*/locations/*/backupChannels/*/backupPlanBindings/*`
3027 pub name: std::string::String,
3028
3029 /// Output only. Server generated global unique identifier of
3030 /// [UUID4](https://en.wikipedia.org/wiki/Universally_unique_identifier)
3031 pub uid: std::string::String,
3032
3033 /// Output only. The timestamp when this binding was created.
3034 pub create_time: std::option::Option<wkt::Timestamp>,
3035
3036 /// Output only. The timestamp when this binding was created.
3037 pub update_time: std::option::Option<wkt::Timestamp>,
3038
3039 /// Output only. Immutable. The fully qualified name of the BackupPlan bound
3040 /// with the parent BackupChannel.
3041 /// `projects/*/locations/*/backupPlans/{backup_plan}`
3042 pub backup_plan: std::string::String,
3043
3044 /// Output only. Immutable. The fully qualified name of the cluster that is
3045 /// being backed up Valid formats:
3046 ///
3047 /// - `projects/*/locations/*/clusters/*`
3048 /// - `projects/*/zones/*/clusters/*`
3049 pub cluster: std::string::String,
3050
3051 /// Output only. Contains details about the backup plan/backup.
3052 pub backup_plan_details:
3053 std::option::Option<crate::model::backup_plan_binding::BackupPlanDetails>,
3054
3055 /// Output only. `etag` is used for optimistic concurrency control as a way to
3056 /// help prevent simultaneous updates of a BackupPlanBinding from overwriting
3057 /// each other. It is strongly suggested that systems make use of the 'etag' in
3058 /// the read-modify-write cycle to perform BackupPlanBinding updates in
3059 /// order to avoid race conditions: An `etag` is returned in the response to
3060 /// `GetBackupPlanBinding`, and systems are expected to put that etag in
3061 /// the request to `UpdateBackupPlanBinding` or
3062 /// `DeleteBackupPlanBinding` to ensure that their change will be applied
3063 /// to the same version of the resource.
3064 pub etag: std::string::String,
3065
3066 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3067}
3068
3069impl BackupPlanBinding {
3070 pub fn new() -> Self {
3071 std::default::Default::default()
3072 }
3073
3074 /// Sets the value of [name][crate::model::BackupPlanBinding::name].
3075 ///
3076 /// # Example
3077 /// ```ignore,no_run
3078 /// # use google_cloud_gkebackup_v1::model::BackupPlanBinding;
3079 /// let x = BackupPlanBinding::new().set_name("example");
3080 /// ```
3081 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3082 self.name = v.into();
3083 self
3084 }
3085
3086 /// Sets the value of [uid][crate::model::BackupPlanBinding::uid].
3087 ///
3088 /// # Example
3089 /// ```ignore,no_run
3090 /// # use google_cloud_gkebackup_v1::model::BackupPlanBinding;
3091 /// let x = BackupPlanBinding::new().set_uid("example");
3092 /// ```
3093 pub fn set_uid<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3094 self.uid = v.into();
3095 self
3096 }
3097
3098 /// Sets the value of [create_time][crate::model::BackupPlanBinding::create_time].
3099 ///
3100 /// # Example
3101 /// ```ignore,no_run
3102 /// # use google_cloud_gkebackup_v1::model::BackupPlanBinding;
3103 /// use wkt::Timestamp;
3104 /// let x = BackupPlanBinding::new().set_create_time(Timestamp::default()/* use setters */);
3105 /// ```
3106 pub fn set_create_time<T>(mut self, v: T) -> Self
3107 where
3108 T: std::convert::Into<wkt::Timestamp>,
3109 {
3110 self.create_time = std::option::Option::Some(v.into());
3111 self
3112 }
3113
3114 /// Sets or clears the value of [create_time][crate::model::BackupPlanBinding::create_time].
3115 ///
3116 /// # Example
3117 /// ```ignore,no_run
3118 /// # use google_cloud_gkebackup_v1::model::BackupPlanBinding;
3119 /// use wkt::Timestamp;
3120 /// let x = BackupPlanBinding::new().set_or_clear_create_time(Some(Timestamp::default()/* use setters */));
3121 /// let x = BackupPlanBinding::new().set_or_clear_create_time(None::<Timestamp>);
3122 /// ```
3123 pub fn set_or_clear_create_time<T>(mut self, v: std::option::Option<T>) -> Self
3124 where
3125 T: std::convert::Into<wkt::Timestamp>,
3126 {
3127 self.create_time = v.map(|x| x.into());
3128 self
3129 }
3130
3131 /// Sets the value of [update_time][crate::model::BackupPlanBinding::update_time].
3132 ///
3133 /// # Example
3134 /// ```ignore,no_run
3135 /// # use google_cloud_gkebackup_v1::model::BackupPlanBinding;
3136 /// use wkt::Timestamp;
3137 /// let x = BackupPlanBinding::new().set_update_time(Timestamp::default()/* use setters */);
3138 /// ```
3139 pub fn set_update_time<T>(mut self, v: T) -> Self
3140 where
3141 T: std::convert::Into<wkt::Timestamp>,
3142 {
3143 self.update_time = std::option::Option::Some(v.into());
3144 self
3145 }
3146
3147 /// Sets or clears the value of [update_time][crate::model::BackupPlanBinding::update_time].
3148 ///
3149 /// # Example
3150 /// ```ignore,no_run
3151 /// # use google_cloud_gkebackup_v1::model::BackupPlanBinding;
3152 /// use wkt::Timestamp;
3153 /// let x = BackupPlanBinding::new().set_or_clear_update_time(Some(Timestamp::default()/* use setters */));
3154 /// let x = BackupPlanBinding::new().set_or_clear_update_time(None::<Timestamp>);
3155 /// ```
3156 pub fn set_or_clear_update_time<T>(mut self, v: std::option::Option<T>) -> Self
3157 where
3158 T: std::convert::Into<wkt::Timestamp>,
3159 {
3160 self.update_time = v.map(|x| x.into());
3161 self
3162 }
3163
3164 /// Sets the value of [backup_plan][crate::model::BackupPlanBinding::backup_plan].
3165 ///
3166 /// # Example
3167 /// ```ignore,no_run
3168 /// # use google_cloud_gkebackup_v1::model::BackupPlanBinding;
3169 /// let x = BackupPlanBinding::new().set_backup_plan("example");
3170 /// ```
3171 pub fn set_backup_plan<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3172 self.backup_plan = v.into();
3173 self
3174 }
3175
3176 /// Sets the value of [cluster][crate::model::BackupPlanBinding::cluster].
3177 ///
3178 /// # Example
3179 /// ```ignore,no_run
3180 /// # use google_cloud_gkebackup_v1::model::BackupPlanBinding;
3181 /// let x = BackupPlanBinding::new().set_cluster("example");
3182 /// ```
3183 pub fn set_cluster<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3184 self.cluster = v.into();
3185 self
3186 }
3187
3188 /// Sets the value of [backup_plan_details][crate::model::BackupPlanBinding::backup_plan_details].
3189 ///
3190 /// # Example
3191 /// ```ignore,no_run
3192 /// # use google_cloud_gkebackup_v1::model::BackupPlanBinding;
3193 /// use google_cloud_gkebackup_v1::model::backup_plan_binding::BackupPlanDetails;
3194 /// let x = BackupPlanBinding::new().set_backup_plan_details(BackupPlanDetails::default()/* use setters */);
3195 /// ```
3196 pub fn set_backup_plan_details<T>(mut self, v: T) -> Self
3197 where
3198 T: std::convert::Into<crate::model::backup_plan_binding::BackupPlanDetails>,
3199 {
3200 self.backup_plan_details = std::option::Option::Some(v.into());
3201 self
3202 }
3203
3204 /// Sets or clears the value of [backup_plan_details][crate::model::BackupPlanBinding::backup_plan_details].
3205 ///
3206 /// # Example
3207 /// ```ignore,no_run
3208 /// # use google_cloud_gkebackup_v1::model::BackupPlanBinding;
3209 /// use google_cloud_gkebackup_v1::model::backup_plan_binding::BackupPlanDetails;
3210 /// let x = BackupPlanBinding::new().set_or_clear_backup_plan_details(Some(BackupPlanDetails::default()/* use setters */));
3211 /// let x = BackupPlanBinding::new().set_or_clear_backup_plan_details(None::<BackupPlanDetails>);
3212 /// ```
3213 pub fn set_or_clear_backup_plan_details<T>(mut self, v: std::option::Option<T>) -> Self
3214 where
3215 T: std::convert::Into<crate::model::backup_plan_binding::BackupPlanDetails>,
3216 {
3217 self.backup_plan_details = v.map(|x| x.into());
3218 self
3219 }
3220
3221 /// Sets the value of [etag][crate::model::BackupPlanBinding::etag].
3222 ///
3223 /// # Example
3224 /// ```ignore,no_run
3225 /// # use google_cloud_gkebackup_v1::model::BackupPlanBinding;
3226 /// let x = BackupPlanBinding::new().set_etag("example");
3227 /// ```
3228 pub fn set_etag<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3229 self.etag = v.into();
3230 self
3231 }
3232}
3233
3234impl wkt::message::Message for BackupPlanBinding {
3235 fn typename() -> &'static str {
3236 "type.googleapis.com/google.cloud.gkebackup.v1.BackupPlanBinding"
3237 }
3238}
3239
3240/// Defines additional types related to [BackupPlanBinding].
3241pub mod backup_plan_binding {
3242 #[allow(unused_imports)]
3243 use super::*;
3244
3245 /// Contains metadata about the backup plan/backup.
3246 #[derive(Clone, Default, PartialEq)]
3247 #[non_exhaustive]
3248 pub struct BackupPlanDetails {
3249 /// Output only. The number of Kubernetes Pods backed up in the
3250 /// last successful Backup created via this BackupPlan.
3251 pub protected_pod_count: i32,
3252
3253 /// Output only. State of the BackupPlan.
3254 pub state: crate::model::backup_plan_binding::backup_plan_details::State,
3255
3256 /// Output only. Completion time of the last successful Backup. This is
3257 /// sourced from a successful Backup's complete_time field.
3258 pub last_successful_backup_time: std::option::Option<wkt::Timestamp>,
3259
3260 /// Output only. Start time of next scheduled backup under this BackupPlan by
3261 /// either cron_schedule or rpo config. This is sourced from BackupPlan.
3262 pub next_scheduled_backup_time: std::option::Option<wkt::Timestamp>,
3263
3264 /// Output only. A number that represents the current risk level of this
3265 /// BackupPlan from RPO perspective with 1 being no risk and 5 being highest
3266 /// risk.
3267 pub rpo_risk_level: i32,
3268
3269 /// Output only. The fully qualified name of the last successful Backup
3270 /// created under this BackupPlan.
3271 /// `projects/*/locations/*/backupPlans/*/backups/*`
3272 pub last_successful_backup: std::string::String,
3273
3274 /// Output only. Contains details about the BackupConfig of Backups created
3275 /// via this BackupPlan.
3276 pub backup_config_details: std::option::Option<
3277 crate::model::backup_plan_binding::backup_plan_details::BackupConfigDetails,
3278 >,
3279
3280 /// Output only. Contains details about the RetentionPolicy of Backups
3281 /// created via this BackupPlan.
3282 pub retention_policy_details: std::option::Option<
3283 crate::model::backup_plan_binding::backup_plan_details::RetentionPolicyDetails,
3284 >,
3285
3286 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3287 }
3288
3289 impl BackupPlanDetails {
3290 pub fn new() -> Self {
3291 std::default::Default::default()
3292 }
3293
3294 /// Sets the value of [protected_pod_count][crate::model::backup_plan_binding::BackupPlanDetails::protected_pod_count].
3295 ///
3296 /// # Example
3297 /// ```ignore,no_run
3298 /// # use google_cloud_gkebackup_v1::model::backup_plan_binding::BackupPlanDetails;
3299 /// let x = BackupPlanDetails::new().set_protected_pod_count(42);
3300 /// ```
3301 pub fn set_protected_pod_count<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
3302 self.protected_pod_count = v.into();
3303 self
3304 }
3305
3306 /// Sets the value of [state][crate::model::backup_plan_binding::BackupPlanDetails::state].
3307 ///
3308 /// # Example
3309 /// ```ignore,no_run
3310 /// # use google_cloud_gkebackup_v1::model::backup_plan_binding::BackupPlanDetails;
3311 /// use google_cloud_gkebackup_v1::model::backup_plan_binding::backup_plan_details::State;
3312 /// let x0 = BackupPlanDetails::new().set_state(State::ClusterPending);
3313 /// let x1 = BackupPlanDetails::new().set_state(State::Provisioning);
3314 /// let x2 = BackupPlanDetails::new().set_state(State::Ready);
3315 /// ```
3316 pub fn set_state<
3317 T: std::convert::Into<crate::model::backup_plan_binding::backup_plan_details::State>,
3318 >(
3319 mut self,
3320 v: T,
3321 ) -> Self {
3322 self.state = v.into();
3323 self
3324 }
3325
3326 /// Sets the value of [last_successful_backup_time][crate::model::backup_plan_binding::BackupPlanDetails::last_successful_backup_time].
3327 ///
3328 /// # Example
3329 /// ```ignore,no_run
3330 /// # use google_cloud_gkebackup_v1::model::backup_plan_binding::BackupPlanDetails;
3331 /// use wkt::Timestamp;
3332 /// let x = BackupPlanDetails::new().set_last_successful_backup_time(Timestamp::default()/* use setters */);
3333 /// ```
3334 pub fn set_last_successful_backup_time<T>(mut self, v: T) -> Self
3335 where
3336 T: std::convert::Into<wkt::Timestamp>,
3337 {
3338 self.last_successful_backup_time = std::option::Option::Some(v.into());
3339 self
3340 }
3341
3342 /// Sets or clears the value of [last_successful_backup_time][crate::model::backup_plan_binding::BackupPlanDetails::last_successful_backup_time].
3343 ///
3344 /// # Example
3345 /// ```ignore,no_run
3346 /// # use google_cloud_gkebackup_v1::model::backup_plan_binding::BackupPlanDetails;
3347 /// use wkt::Timestamp;
3348 /// let x = BackupPlanDetails::new().set_or_clear_last_successful_backup_time(Some(Timestamp::default()/* use setters */));
3349 /// let x = BackupPlanDetails::new().set_or_clear_last_successful_backup_time(None::<Timestamp>);
3350 /// ```
3351 pub fn set_or_clear_last_successful_backup_time<T>(
3352 mut self,
3353 v: std::option::Option<T>,
3354 ) -> Self
3355 where
3356 T: std::convert::Into<wkt::Timestamp>,
3357 {
3358 self.last_successful_backup_time = v.map(|x| x.into());
3359 self
3360 }
3361
3362 /// Sets the value of [next_scheduled_backup_time][crate::model::backup_plan_binding::BackupPlanDetails::next_scheduled_backup_time].
3363 ///
3364 /// # Example
3365 /// ```ignore,no_run
3366 /// # use google_cloud_gkebackup_v1::model::backup_plan_binding::BackupPlanDetails;
3367 /// use wkt::Timestamp;
3368 /// let x = BackupPlanDetails::new().set_next_scheduled_backup_time(Timestamp::default()/* use setters */);
3369 /// ```
3370 pub fn set_next_scheduled_backup_time<T>(mut self, v: T) -> Self
3371 where
3372 T: std::convert::Into<wkt::Timestamp>,
3373 {
3374 self.next_scheduled_backup_time = std::option::Option::Some(v.into());
3375 self
3376 }
3377
3378 /// Sets or clears the value of [next_scheduled_backup_time][crate::model::backup_plan_binding::BackupPlanDetails::next_scheduled_backup_time].
3379 ///
3380 /// # Example
3381 /// ```ignore,no_run
3382 /// # use google_cloud_gkebackup_v1::model::backup_plan_binding::BackupPlanDetails;
3383 /// use wkt::Timestamp;
3384 /// let x = BackupPlanDetails::new().set_or_clear_next_scheduled_backup_time(Some(Timestamp::default()/* use setters */));
3385 /// let x = BackupPlanDetails::new().set_or_clear_next_scheduled_backup_time(None::<Timestamp>);
3386 /// ```
3387 pub fn set_or_clear_next_scheduled_backup_time<T>(
3388 mut self,
3389 v: std::option::Option<T>,
3390 ) -> Self
3391 where
3392 T: std::convert::Into<wkt::Timestamp>,
3393 {
3394 self.next_scheduled_backup_time = v.map(|x| x.into());
3395 self
3396 }
3397
3398 /// Sets the value of [rpo_risk_level][crate::model::backup_plan_binding::BackupPlanDetails::rpo_risk_level].
3399 ///
3400 /// # Example
3401 /// ```ignore,no_run
3402 /// # use google_cloud_gkebackup_v1::model::backup_plan_binding::BackupPlanDetails;
3403 /// let x = BackupPlanDetails::new().set_rpo_risk_level(42);
3404 /// ```
3405 pub fn set_rpo_risk_level<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
3406 self.rpo_risk_level = v.into();
3407 self
3408 }
3409
3410 /// Sets the value of [last_successful_backup][crate::model::backup_plan_binding::BackupPlanDetails::last_successful_backup].
3411 ///
3412 /// # Example
3413 /// ```ignore,no_run
3414 /// # use google_cloud_gkebackup_v1::model::backup_plan_binding::BackupPlanDetails;
3415 /// let x = BackupPlanDetails::new().set_last_successful_backup("example");
3416 /// ```
3417 pub fn set_last_successful_backup<T: std::convert::Into<std::string::String>>(
3418 mut self,
3419 v: T,
3420 ) -> Self {
3421 self.last_successful_backup = v.into();
3422 self
3423 }
3424
3425 /// Sets the value of [backup_config_details][crate::model::backup_plan_binding::BackupPlanDetails::backup_config_details].
3426 ///
3427 /// # Example
3428 /// ```ignore,no_run
3429 /// # use google_cloud_gkebackup_v1::model::backup_plan_binding::BackupPlanDetails;
3430 /// use google_cloud_gkebackup_v1::model::backup_plan_binding::backup_plan_details::BackupConfigDetails;
3431 /// let x = BackupPlanDetails::new().set_backup_config_details(BackupConfigDetails::default()/* use setters */);
3432 /// ```
3433 pub fn set_backup_config_details<T>(mut self, v: T) -> Self
3434 where
3435 T: std::convert::Into<
3436 crate::model::backup_plan_binding::backup_plan_details::BackupConfigDetails,
3437 >,
3438 {
3439 self.backup_config_details = std::option::Option::Some(v.into());
3440 self
3441 }
3442
3443 /// Sets or clears the value of [backup_config_details][crate::model::backup_plan_binding::BackupPlanDetails::backup_config_details].
3444 ///
3445 /// # Example
3446 /// ```ignore,no_run
3447 /// # use google_cloud_gkebackup_v1::model::backup_plan_binding::BackupPlanDetails;
3448 /// use google_cloud_gkebackup_v1::model::backup_plan_binding::backup_plan_details::BackupConfigDetails;
3449 /// let x = BackupPlanDetails::new().set_or_clear_backup_config_details(Some(BackupConfigDetails::default()/* use setters */));
3450 /// let x = BackupPlanDetails::new().set_or_clear_backup_config_details(None::<BackupConfigDetails>);
3451 /// ```
3452 pub fn set_or_clear_backup_config_details<T>(mut self, v: std::option::Option<T>) -> Self
3453 where
3454 T: std::convert::Into<
3455 crate::model::backup_plan_binding::backup_plan_details::BackupConfigDetails,
3456 >,
3457 {
3458 self.backup_config_details = v.map(|x| x.into());
3459 self
3460 }
3461
3462 /// Sets the value of [retention_policy_details][crate::model::backup_plan_binding::BackupPlanDetails::retention_policy_details].
3463 ///
3464 /// # Example
3465 /// ```ignore,no_run
3466 /// # use google_cloud_gkebackup_v1::model::backup_plan_binding::BackupPlanDetails;
3467 /// use google_cloud_gkebackup_v1::model::backup_plan_binding::backup_plan_details::RetentionPolicyDetails;
3468 /// let x = BackupPlanDetails::new().set_retention_policy_details(RetentionPolicyDetails::default()/* use setters */);
3469 /// ```
3470 pub fn set_retention_policy_details<T>(mut self, v: T) -> Self
3471 where
3472 T: std::convert::Into<
3473 crate::model::backup_plan_binding::backup_plan_details::RetentionPolicyDetails,
3474 >,
3475 {
3476 self.retention_policy_details = std::option::Option::Some(v.into());
3477 self
3478 }
3479
3480 /// Sets or clears the value of [retention_policy_details][crate::model::backup_plan_binding::BackupPlanDetails::retention_policy_details].
3481 ///
3482 /// # Example
3483 /// ```ignore,no_run
3484 /// # use google_cloud_gkebackup_v1::model::backup_plan_binding::BackupPlanDetails;
3485 /// use google_cloud_gkebackup_v1::model::backup_plan_binding::backup_plan_details::RetentionPolicyDetails;
3486 /// let x = BackupPlanDetails::new().set_or_clear_retention_policy_details(Some(RetentionPolicyDetails::default()/* use setters */));
3487 /// let x = BackupPlanDetails::new().set_or_clear_retention_policy_details(None::<RetentionPolicyDetails>);
3488 /// ```
3489 pub fn set_or_clear_retention_policy_details<T>(mut self, v: std::option::Option<T>) -> Self
3490 where
3491 T: std::convert::Into<
3492 crate::model::backup_plan_binding::backup_plan_details::RetentionPolicyDetails,
3493 >,
3494 {
3495 self.retention_policy_details = v.map(|x| x.into());
3496 self
3497 }
3498 }
3499
3500 impl wkt::message::Message for BackupPlanDetails {
3501 fn typename() -> &'static str {
3502 "type.googleapis.com/google.cloud.gkebackup.v1.BackupPlanBinding.BackupPlanDetails"
3503 }
3504 }
3505
3506 /// Defines additional types related to [BackupPlanDetails].
3507 pub mod backup_plan_details {
3508 #[allow(unused_imports)]
3509 use super::*;
3510
3511 /// BackupConfigDetails defines the configuration of Backups created via this
3512 /// BackupPlan.
3513 #[derive(Clone, Default, PartialEq)]
3514 #[non_exhaustive]
3515 pub struct BackupConfigDetails {
3516
3517 /// Output only. This flag specifies whether volume data should be backed
3518 /// up when PVCs are included in the scope of a Backup.
3519 ///
3520 /// Default: False
3521 pub include_volume_data: bool,
3522
3523 /// Output only. This flag specifies whether Kubernetes Secret resources
3524 /// should be included when they fall into the scope of Backups.
3525 ///
3526 /// Default: False
3527 pub include_secrets: bool,
3528
3529 /// Output only. This defines a customer managed encryption key that will
3530 /// be used to encrypt the "config" portion (the Kubernetes resources) of
3531 /// Backups created via this plan.
3532 ///
3533 /// Default (empty): Config backup artifacts will not be encrypted.
3534 pub encryption_key: std::option::Option<crate::model::EncryptionKey>,
3535
3536 /// This defines the "scope" of the Backup - which namespaced
3537 /// resources in the cluster will be included in a Backup.
3538 /// Exactly one of the fields of backup_scope MUST be specified.
3539 pub backup_scope: std::option::Option<crate::model::backup_plan_binding::backup_plan_details::backup_config_details::BackupScope>,
3540
3541 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3542 }
3543
3544 impl BackupConfigDetails {
3545 pub fn new() -> Self {
3546 std::default::Default::default()
3547 }
3548
3549 /// Sets the value of [include_volume_data][crate::model::backup_plan_binding::backup_plan_details::BackupConfigDetails::include_volume_data].
3550 ///
3551 /// # Example
3552 /// ```ignore,no_run
3553 /// # use google_cloud_gkebackup_v1::model::backup_plan_binding::backup_plan_details::BackupConfigDetails;
3554 /// let x = BackupConfigDetails::new().set_include_volume_data(true);
3555 /// ```
3556 pub fn set_include_volume_data<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
3557 self.include_volume_data = v.into();
3558 self
3559 }
3560
3561 /// Sets the value of [include_secrets][crate::model::backup_plan_binding::backup_plan_details::BackupConfigDetails::include_secrets].
3562 ///
3563 /// # Example
3564 /// ```ignore,no_run
3565 /// # use google_cloud_gkebackup_v1::model::backup_plan_binding::backup_plan_details::BackupConfigDetails;
3566 /// let x = BackupConfigDetails::new().set_include_secrets(true);
3567 /// ```
3568 pub fn set_include_secrets<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
3569 self.include_secrets = v.into();
3570 self
3571 }
3572
3573 /// Sets the value of [encryption_key][crate::model::backup_plan_binding::backup_plan_details::BackupConfigDetails::encryption_key].
3574 ///
3575 /// # Example
3576 /// ```ignore,no_run
3577 /// # use google_cloud_gkebackup_v1::model::backup_plan_binding::backup_plan_details::BackupConfigDetails;
3578 /// use google_cloud_gkebackup_v1::model::EncryptionKey;
3579 /// let x = BackupConfigDetails::new().set_encryption_key(EncryptionKey::default()/* use setters */);
3580 /// ```
3581 pub fn set_encryption_key<T>(mut self, v: T) -> Self
3582 where
3583 T: std::convert::Into<crate::model::EncryptionKey>,
3584 {
3585 self.encryption_key = std::option::Option::Some(v.into());
3586 self
3587 }
3588
3589 /// Sets or clears the value of [encryption_key][crate::model::backup_plan_binding::backup_plan_details::BackupConfigDetails::encryption_key].
3590 ///
3591 /// # Example
3592 /// ```ignore,no_run
3593 /// # use google_cloud_gkebackup_v1::model::backup_plan_binding::backup_plan_details::BackupConfigDetails;
3594 /// use google_cloud_gkebackup_v1::model::EncryptionKey;
3595 /// let x = BackupConfigDetails::new().set_or_clear_encryption_key(Some(EncryptionKey::default()/* use setters */));
3596 /// let x = BackupConfigDetails::new().set_or_clear_encryption_key(None::<EncryptionKey>);
3597 /// ```
3598 pub fn set_or_clear_encryption_key<T>(mut self, v: std::option::Option<T>) -> Self
3599 where
3600 T: std::convert::Into<crate::model::EncryptionKey>,
3601 {
3602 self.encryption_key = v.map(|x| x.into());
3603 self
3604 }
3605
3606 /// Sets the value of [backup_scope][crate::model::backup_plan_binding::backup_plan_details::BackupConfigDetails::backup_scope].
3607 ///
3608 /// Note that all the setters affecting `backup_scope` are mutually
3609 /// exclusive.
3610 ///
3611 /// # Example
3612 /// ```ignore,no_run
3613 /// # use google_cloud_gkebackup_v1::model::backup_plan_binding::backup_plan_details::BackupConfigDetails;
3614 /// use google_cloud_gkebackup_v1::model::backup_plan_binding::backup_plan_details::backup_config_details::BackupScope;
3615 /// let x = BackupConfigDetails::new().set_backup_scope(Some(BackupScope::AllNamespaces(true)));
3616 /// ```
3617 pub fn set_backup_scope<T: std::convert::Into<std::option::Option<crate::model::backup_plan_binding::backup_plan_details::backup_config_details::BackupScope>>>(mut self, v: T) -> Self
3618 {
3619 self.backup_scope = v.into();
3620 self
3621 }
3622
3623 /// The value of [backup_scope][crate::model::backup_plan_binding::backup_plan_details::BackupConfigDetails::backup_scope]
3624 /// if it holds a `AllNamespaces`, `None` if the field is not set or
3625 /// holds a different branch.
3626 pub fn all_namespaces(&self) -> std::option::Option<&bool> {
3627 #[allow(unreachable_patterns)]
3628 self.backup_scope.as_ref().and_then(|v| match v {
3629 crate::model::backup_plan_binding::backup_plan_details::backup_config_details::BackupScope::AllNamespaces(v) => std::option::Option::Some(v),
3630 _ => std::option::Option::None,
3631 })
3632 }
3633
3634 /// Sets the value of [backup_scope][crate::model::backup_plan_binding::backup_plan_details::BackupConfigDetails::backup_scope]
3635 /// to hold a `AllNamespaces`.
3636 ///
3637 /// Note that all the setters affecting `backup_scope` are
3638 /// mutually exclusive.
3639 ///
3640 /// # Example
3641 /// ```ignore,no_run
3642 /// # use google_cloud_gkebackup_v1::model::backup_plan_binding::backup_plan_details::BackupConfigDetails;
3643 /// let x = BackupConfigDetails::new().set_all_namespaces(true);
3644 /// assert!(x.all_namespaces().is_some());
3645 /// assert!(x.selected_namespaces().is_none());
3646 /// assert!(x.selected_applications().is_none());
3647 /// ```
3648 pub fn set_all_namespaces<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
3649 self.backup_scope = std::option::Option::Some(
3650 crate::model::backup_plan_binding::backup_plan_details::backup_config_details::BackupScope::AllNamespaces(
3651 v.into()
3652 )
3653 );
3654 self
3655 }
3656
3657 /// The value of [backup_scope][crate::model::backup_plan_binding::backup_plan_details::BackupConfigDetails::backup_scope]
3658 /// if it holds a `SelectedNamespaces`, `None` if the field is not set or
3659 /// holds a different branch.
3660 pub fn selected_namespaces(
3661 &self,
3662 ) -> std::option::Option<&std::boxed::Box<crate::model::Namespaces>> {
3663 #[allow(unreachable_patterns)]
3664 self.backup_scope.as_ref().and_then(|v| match v {
3665 crate::model::backup_plan_binding::backup_plan_details::backup_config_details::BackupScope::SelectedNamespaces(v) => std::option::Option::Some(v),
3666 _ => std::option::Option::None,
3667 })
3668 }
3669
3670 /// Sets the value of [backup_scope][crate::model::backup_plan_binding::backup_plan_details::BackupConfigDetails::backup_scope]
3671 /// to hold a `SelectedNamespaces`.
3672 ///
3673 /// Note that all the setters affecting `backup_scope` are
3674 /// mutually exclusive.
3675 ///
3676 /// # Example
3677 /// ```ignore,no_run
3678 /// # use google_cloud_gkebackup_v1::model::backup_plan_binding::backup_plan_details::BackupConfigDetails;
3679 /// use google_cloud_gkebackup_v1::model::Namespaces;
3680 /// let x = BackupConfigDetails::new().set_selected_namespaces(Namespaces::default()/* use setters */);
3681 /// assert!(x.selected_namespaces().is_some());
3682 /// assert!(x.all_namespaces().is_none());
3683 /// assert!(x.selected_applications().is_none());
3684 /// ```
3685 pub fn set_selected_namespaces<
3686 T: std::convert::Into<std::boxed::Box<crate::model::Namespaces>>,
3687 >(
3688 mut self,
3689 v: T,
3690 ) -> Self {
3691 self.backup_scope = std::option::Option::Some(
3692 crate::model::backup_plan_binding::backup_plan_details::backup_config_details::BackupScope::SelectedNamespaces(
3693 v.into()
3694 )
3695 );
3696 self
3697 }
3698
3699 /// The value of [backup_scope][crate::model::backup_plan_binding::backup_plan_details::BackupConfigDetails::backup_scope]
3700 /// if it holds a `SelectedApplications`, `None` if the field is not set or
3701 /// holds a different branch.
3702 pub fn selected_applications(
3703 &self,
3704 ) -> std::option::Option<&std::boxed::Box<crate::model::NamespacedNames>> {
3705 #[allow(unreachable_patterns)]
3706 self.backup_scope.as_ref().and_then(|v| match v {
3707 crate::model::backup_plan_binding::backup_plan_details::backup_config_details::BackupScope::SelectedApplications(v) => std::option::Option::Some(v),
3708 _ => std::option::Option::None,
3709 })
3710 }
3711
3712 /// Sets the value of [backup_scope][crate::model::backup_plan_binding::backup_plan_details::BackupConfigDetails::backup_scope]
3713 /// to hold a `SelectedApplications`.
3714 ///
3715 /// Note that all the setters affecting `backup_scope` are
3716 /// mutually exclusive.
3717 ///
3718 /// # Example
3719 /// ```ignore,no_run
3720 /// # use google_cloud_gkebackup_v1::model::backup_plan_binding::backup_plan_details::BackupConfigDetails;
3721 /// use google_cloud_gkebackup_v1::model::NamespacedNames;
3722 /// let x = BackupConfigDetails::new().set_selected_applications(NamespacedNames::default()/* use setters */);
3723 /// assert!(x.selected_applications().is_some());
3724 /// assert!(x.all_namespaces().is_none());
3725 /// assert!(x.selected_namespaces().is_none());
3726 /// ```
3727 pub fn set_selected_applications<
3728 T: std::convert::Into<std::boxed::Box<crate::model::NamespacedNames>>,
3729 >(
3730 mut self,
3731 v: T,
3732 ) -> Self {
3733 self.backup_scope = std::option::Option::Some(
3734 crate::model::backup_plan_binding::backup_plan_details::backup_config_details::BackupScope::SelectedApplications(
3735 v.into()
3736 )
3737 );
3738 self
3739 }
3740 }
3741
3742 impl wkt::message::Message for BackupConfigDetails {
3743 fn typename() -> &'static str {
3744 "type.googleapis.com/google.cloud.gkebackup.v1.BackupPlanBinding.BackupPlanDetails.BackupConfigDetails"
3745 }
3746 }
3747
3748 /// Defines additional types related to [BackupConfigDetails].
3749 pub mod backup_config_details {
3750 #[allow(unused_imports)]
3751 use super::*;
3752
3753 /// This defines the "scope" of the Backup - which namespaced
3754 /// resources in the cluster will be included in a Backup.
3755 /// Exactly one of the fields of backup_scope MUST be specified.
3756 #[derive(Clone, Debug, PartialEq)]
3757 #[non_exhaustive]
3758 pub enum BackupScope {
3759 /// Output only. If True, include all namespaced resources
3760 AllNamespaces(bool),
3761 /// Output only. If set, include just the resources in the listed
3762 /// namespaces.
3763 SelectedNamespaces(std::boxed::Box<crate::model::Namespaces>),
3764 /// Output only. If set, include just the resources referenced by the
3765 /// listed ProtectedApplications.
3766 SelectedApplications(std::boxed::Box<crate::model::NamespacedNames>),
3767 }
3768 }
3769
3770 /// RetentionPolicyDetails defines a Backup retention policy for a
3771 /// BackupPlan.
3772 #[derive(Clone, Default, PartialEq)]
3773 #[non_exhaustive]
3774 pub struct RetentionPolicyDetails {
3775 /// Optional. Minimum age for Backups created via this BackupPlan (in
3776 /// days). This field MUST be an integer value between 0-90 (inclusive). A
3777 /// Backup created under this BackupPlan will NOT be deletable until it
3778 /// reaches Backup's (create_time + backup_delete_lock_days).
3779 /// Updating this field of a BackupPlan does NOT affect existing Backups
3780 /// under it. Backups created AFTER a successful update will inherit
3781 /// the new value.
3782 ///
3783 /// Default: 0 (no delete blocking)
3784 pub backup_delete_lock_days: i32,
3785
3786 /// Optional. The default maximum age of a Backup created via this
3787 /// BackupPlan. This field MUST be an integer value >= 0 and <= 365. If
3788 /// specified, a Backup created under this BackupPlan will be automatically
3789 /// deleted after its age reaches (create_time + backup_retain_days). If
3790 /// not specified, Backups created under this BackupPlan will NOT be
3791 /// subject to automatic deletion.
3792 /// Default: 0 (no automatic deletion)
3793 pub backup_retain_days: i32,
3794
3795 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3796 }
3797
3798 impl RetentionPolicyDetails {
3799 pub fn new() -> Self {
3800 std::default::Default::default()
3801 }
3802
3803 /// Sets the value of [backup_delete_lock_days][crate::model::backup_plan_binding::backup_plan_details::RetentionPolicyDetails::backup_delete_lock_days].
3804 ///
3805 /// # Example
3806 /// ```ignore,no_run
3807 /// # use google_cloud_gkebackup_v1::model::backup_plan_binding::backup_plan_details::RetentionPolicyDetails;
3808 /// let x = RetentionPolicyDetails::new().set_backup_delete_lock_days(42);
3809 /// ```
3810 pub fn set_backup_delete_lock_days<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
3811 self.backup_delete_lock_days = v.into();
3812 self
3813 }
3814
3815 /// Sets the value of [backup_retain_days][crate::model::backup_plan_binding::backup_plan_details::RetentionPolicyDetails::backup_retain_days].
3816 ///
3817 /// # Example
3818 /// ```ignore,no_run
3819 /// # use google_cloud_gkebackup_v1::model::backup_plan_binding::backup_plan_details::RetentionPolicyDetails;
3820 /// let x = RetentionPolicyDetails::new().set_backup_retain_days(42);
3821 /// ```
3822 pub fn set_backup_retain_days<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
3823 self.backup_retain_days = v.into();
3824 self
3825 }
3826 }
3827
3828 impl wkt::message::Message for RetentionPolicyDetails {
3829 fn typename() -> &'static str {
3830 "type.googleapis.com/google.cloud.gkebackup.v1.BackupPlanBinding.BackupPlanDetails.RetentionPolicyDetails"
3831 }
3832 }
3833
3834 /// State
3835 ///
3836 /// # Working with unknown values
3837 ///
3838 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
3839 /// additional enum variants at any time. Adding new variants is not considered
3840 /// a breaking change. Applications should write their code in anticipation of:
3841 ///
3842 /// - New values appearing in future releases of the client library, **and**
3843 /// - New values received dynamically, without application changes.
3844 ///
3845 /// Please consult the [Working with enums] section in the user guide for some
3846 /// guidelines.
3847 ///
3848 /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
3849 #[derive(Clone, Debug, PartialEq)]
3850 #[non_exhaustive]
3851 pub enum State {
3852 /// Default first value for Enums.
3853 Unspecified,
3854 /// Waiting for cluster state to be RUNNING.
3855 ClusterPending,
3856 /// The BackupPlan is in the process of being created.
3857 Provisioning,
3858 /// The BackupPlan has successfully been created and is ready for Backups.
3859 Ready,
3860 /// BackupPlan creation has failed.
3861 Failed,
3862 /// The BackupPlan has been deactivated.
3863 Deactivated,
3864 /// The BackupPlan is in the process of being deleted.
3865 Deleting,
3866 /// If set, the enum was initialized with an unknown value.
3867 ///
3868 /// Applications can examine the value using [State::value] or
3869 /// [State::name].
3870 UnknownValue(state::UnknownValue),
3871 }
3872
3873 #[doc(hidden)]
3874 pub mod state {
3875 #[allow(unused_imports)]
3876 use super::*;
3877 #[derive(Clone, Debug, PartialEq)]
3878 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
3879 }
3880
3881 impl State {
3882 /// Gets the enum value.
3883 ///
3884 /// Returns `None` if the enum contains an unknown value deserialized from
3885 /// the string representation of enums.
3886 pub fn value(&self) -> std::option::Option<i32> {
3887 match self {
3888 Self::Unspecified => std::option::Option::Some(0),
3889 Self::ClusterPending => std::option::Option::Some(1),
3890 Self::Provisioning => std::option::Option::Some(2),
3891 Self::Ready => std::option::Option::Some(3),
3892 Self::Failed => std::option::Option::Some(4),
3893 Self::Deactivated => std::option::Option::Some(5),
3894 Self::Deleting => std::option::Option::Some(6),
3895 Self::UnknownValue(u) => u.0.value(),
3896 }
3897 }
3898
3899 /// Gets the enum value as a string.
3900 ///
3901 /// Returns `None` if the enum contains an unknown value deserialized from
3902 /// the integer representation of enums.
3903 pub fn name(&self) -> std::option::Option<&str> {
3904 match self {
3905 Self::Unspecified => std::option::Option::Some("STATE_UNSPECIFIED"),
3906 Self::ClusterPending => std::option::Option::Some("CLUSTER_PENDING"),
3907 Self::Provisioning => std::option::Option::Some("PROVISIONING"),
3908 Self::Ready => std::option::Option::Some("READY"),
3909 Self::Failed => std::option::Option::Some("FAILED"),
3910 Self::Deactivated => std::option::Option::Some("DEACTIVATED"),
3911 Self::Deleting => std::option::Option::Some("DELETING"),
3912 Self::UnknownValue(u) => u.0.name(),
3913 }
3914 }
3915 }
3916
3917 impl std::default::Default for State {
3918 fn default() -> Self {
3919 use std::convert::From;
3920 Self::from(0)
3921 }
3922 }
3923
3924 impl std::fmt::Display for State {
3925 fn fmt(
3926 &self,
3927 f: &mut std::fmt::Formatter<'_>,
3928 ) -> std::result::Result<(), std::fmt::Error> {
3929 wkt::internal::display_enum(f, self.name(), self.value())
3930 }
3931 }
3932
3933 impl std::convert::From<i32> for State {
3934 fn from(value: i32) -> Self {
3935 match value {
3936 0 => Self::Unspecified,
3937 1 => Self::ClusterPending,
3938 2 => Self::Provisioning,
3939 3 => Self::Ready,
3940 4 => Self::Failed,
3941 5 => Self::Deactivated,
3942 6 => Self::Deleting,
3943 _ => Self::UnknownValue(state::UnknownValue(
3944 wkt::internal::UnknownEnumValue::Integer(value),
3945 )),
3946 }
3947 }
3948 }
3949
3950 impl std::convert::From<&str> for State {
3951 fn from(value: &str) -> Self {
3952 use std::string::ToString;
3953 match value {
3954 "STATE_UNSPECIFIED" => Self::Unspecified,
3955 "CLUSTER_PENDING" => Self::ClusterPending,
3956 "PROVISIONING" => Self::Provisioning,
3957 "READY" => Self::Ready,
3958 "FAILED" => Self::Failed,
3959 "DEACTIVATED" => Self::Deactivated,
3960 "DELETING" => Self::Deleting,
3961 _ => Self::UnknownValue(state::UnknownValue(
3962 wkt::internal::UnknownEnumValue::String(value.to_string()),
3963 )),
3964 }
3965 }
3966 }
3967
3968 impl serde::ser::Serialize for State {
3969 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
3970 where
3971 S: serde::Serializer,
3972 {
3973 match self {
3974 Self::Unspecified => serializer.serialize_i32(0),
3975 Self::ClusterPending => serializer.serialize_i32(1),
3976 Self::Provisioning => serializer.serialize_i32(2),
3977 Self::Ready => serializer.serialize_i32(3),
3978 Self::Failed => serializer.serialize_i32(4),
3979 Self::Deactivated => serializer.serialize_i32(5),
3980 Self::Deleting => serializer.serialize_i32(6),
3981 Self::UnknownValue(u) => u.0.serialize(serializer),
3982 }
3983 }
3984 }
3985
3986 impl<'de> serde::de::Deserialize<'de> for State {
3987 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
3988 where
3989 D: serde::Deserializer<'de>,
3990 {
3991 deserializer.deserialize_any(wkt::internal::EnumVisitor::<State>::new(
3992 ".google.cloud.gkebackup.v1.BackupPlanBinding.BackupPlanDetails.State",
3993 ))
3994 }
3995 }
3996 }
3997}
3998
3999/// A list of Kubernetes Namespaces.
4000#[derive(Clone, Default, PartialEq)]
4001#[non_exhaustive]
4002pub struct Namespaces {
4003 /// Optional. A list of Kubernetes Namespaces.
4004 pub namespaces: std::vec::Vec<std::string::String>,
4005
4006 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4007}
4008
4009impl Namespaces {
4010 pub fn new() -> Self {
4011 std::default::Default::default()
4012 }
4013
4014 /// Sets the value of [namespaces][crate::model::Namespaces::namespaces].
4015 ///
4016 /// # Example
4017 /// ```ignore,no_run
4018 /// # use google_cloud_gkebackup_v1::model::Namespaces;
4019 /// let x = Namespaces::new().set_namespaces(["a", "b", "c"]);
4020 /// ```
4021 pub fn set_namespaces<T, V>(mut self, v: T) -> Self
4022 where
4023 T: std::iter::IntoIterator<Item = V>,
4024 V: std::convert::Into<std::string::String>,
4025 {
4026 use std::iter::Iterator;
4027 self.namespaces = v.into_iter().map(|i| i.into()).collect();
4028 self
4029 }
4030}
4031
4032impl wkt::message::Message for Namespaces {
4033 fn typename() -> &'static str {
4034 "type.googleapis.com/google.cloud.gkebackup.v1.Namespaces"
4035 }
4036}
4037
4038/// A reference to a namespaced resource in Kubernetes.
4039#[derive(Clone, Default, PartialEq)]
4040#[non_exhaustive]
4041pub struct NamespacedName {
4042 /// Optional. The Namespace of the Kubernetes resource.
4043 pub namespace: std::string::String,
4044
4045 /// Optional. The name of the Kubernetes resource.
4046 pub name: std::string::String,
4047
4048 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4049}
4050
4051impl NamespacedName {
4052 pub fn new() -> Self {
4053 std::default::Default::default()
4054 }
4055
4056 /// Sets the value of [namespace][crate::model::NamespacedName::namespace].
4057 ///
4058 /// # Example
4059 /// ```ignore,no_run
4060 /// # use google_cloud_gkebackup_v1::model::NamespacedName;
4061 /// let x = NamespacedName::new().set_namespace("example");
4062 /// ```
4063 pub fn set_namespace<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4064 self.namespace = v.into();
4065 self
4066 }
4067
4068 /// Sets the value of [name][crate::model::NamespacedName::name].
4069 ///
4070 /// # Example
4071 /// ```ignore,no_run
4072 /// # use google_cloud_gkebackup_v1::model::NamespacedName;
4073 /// let x = NamespacedName::new().set_name("example");
4074 /// ```
4075 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4076 self.name = v.into();
4077 self
4078 }
4079}
4080
4081impl wkt::message::Message for NamespacedName {
4082 fn typename() -> &'static str {
4083 "type.googleapis.com/google.cloud.gkebackup.v1.NamespacedName"
4084 }
4085}
4086
4087/// A list of namespaced Kubernetes resources.
4088#[derive(Clone, Default, PartialEq)]
4089#[non_exhaustive]
4090pub struct NamespacedNames {
4091 /// Optional. A list of namespaced Kubernetes resources.
4092 pub namespaced_names: std::vec::Vec<crate::model::NamespacedName>,
4093
4094 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4095}
4096
4097impl NamespacedNames {
4098 pub fn new() -> Self {
4099 std::default::Default::default()
4100 }
4101
4102 /// Sets the value of [namespaced_names][crate::model::NamespacedNames::namespaced_names].
4103 ///
4104 /// # Example
4105 /// ```ignore,no_run
4106 /// # use google_cloud_gkebackup_v1::model::NamespacedNames;
4107 /// use google_cloud_gkebackup_v1::model::NamespacedName;
4108 /// let x = NamespacedNames::new()
4109 /// .set_namespaced_names([
4110 /// NamespacedName::default()/* use setters */,
4111 /// NamespacedName::default()/* use (different) setters */,
4112 /// ]);
4113 /// ```
4114 pub fn set_namespaced_names<T, V>(mut self, v: T) -> Self
4115 where
4116 T: std::iter::IntoIterator<Item = V>,
4117 V: std::convert::Into<crate::model::NamespacedName>,
4118 {
4119 use std::iter::Iterator;
4120 self.namespaced_names = v.into_iter().map(|i| i.into()).collect();
4121 self
4122 }
4123}
4124
4125impl wkt::message::Message for NamespacedNames {
4126 fn typename() -> &'static str {
4127 "type.googleapis.com/google.cloud.gkebackup.v1.NamespacedNames"
4128 }
4129}
4130
4131/// Defined a customer managed encryption key that will be used to encrypt Backup
4132/// artifacts.
4133#[derive(Clone, Default, PartialEq)]
4134#[non_exhaustive]
4135pub struct EncryptionKey {
4136 /// Optional. Google Cloud KMS encryption key. Format:
4137 /// `projects/*/locations/*/keyRings/*/cryptoKeys/*`
4138 pub gcp_kms_encryption_key: std::string::String,
4139
4140 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4141}
4142
4143impl EncryptionKey {
4144 pub fn new() -> Self {
4145 std::default::Default::default()
4146 }
4147
4148 /// Sets the value of [gcp_kms_encryption_key][crate::model::EncryptionKey::gcp_kms_encryption_key].
4149 ///
4150 /// # Example
4151 /// ```ignore,no_run
4152 /// # use google_cloud_gkebackup_v1::model::EncryptionKey;
4153 /// let x = EncryptionKey::new().set_gcp_kms_encryption_key("example");
4154 /// ```
4155 pub fn set_gcp_kms_encryption_key<T: std::convert::Into<std::string::String>>(
4156 mut self,
4157 v: T,
4158 ) -> Self {
4159 self.gcp_kms_encryption_key = v.into();
4160 self
4161 }
4162}
4163
4164impl wkt::message::Message for EncryptionKey {
4165 fn typename() -> &'static str {
4166 "type.googleapis.com/google.cloud.gkebackup.v1.EncryptionKey"
4167 }
4168}
4169
4170/// Message to encapsulate VolumeType enum.
4171#[derive(Clone, Default, PartialEq)]
4172#[non_exhaustive]
4173pub struct VolumeTypeEnum {
4174 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4175}
4176
4177impl VolumeTypeEnum {
4178 pub fn new() -> Self {
4179 std::default::Default::default()
4180 }
4181}
4182
4183impl wkt::message::Message for VolumeTypeEnum {
4184 fn typename() -> &'static str {
4185 "type.googleapis.com/google.cloud.gkebackup.v1.VolumeTypeEnum"
4186 }
4187}
4188
4189/// Defines additional types related to [VolumeTypeEnum].
4190pub mod volume_type_enum {
4191 #[allow(unused_imports)]
4192 use super::*;
4193
4194 /// Supported volume types.
4195 ///
4196 /// # Working with unknown values
4197 ///
4198 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
4199 /// additional enum variants at any time. Adding new variants is not considered
4200 /// a breaking change. Applications should write their code in anticipation of:
4201 ///
4202 /// - New values appearing in future releases of the client library, **and**
4203 /// - New values received dynamically, without application changes.
4204 ///
4205 /// Please consult the [Working with enums] section in the user guide for some
4206 /// guidelines.
4207 ///
4208 /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
4209 #[derive(Clone, Debug, PartialEq)]
4210 #[non_exhaustive]
4211 pub enum VolumeType {
4212 /// Default
4213 Unspecified,
4214 /// Compute Engine Persistent Disk volume
4215 GcePersistentDisk,
4216 /// If set, the enum was initialized with an unknown value.
4217 ///
4218 /// Applications can examine the value using [VolumeType::value] or
4219 /// [VolumeType::name].
4220 UnknownValue(volume_type::UnknownValue),
4221 }
4222
4223 #[doc(hidden)]
4224 pub mod volume_type {
4225 #[allow(unused_imports)]
4226 use super::*;
4227 #[derive(Clone, Debug, PartialEq)]
4228 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
4229 }
4230
4231 impl VolumeType {
4232 /// Gets the enum value.
4233 ///
4234 /// Returns `None` if the enum contains an unknown value deserialized from
4235 /// the string representation of enums.
4236 pub fn value(&self) -> std::option::Option<i32> {
4237 match self {
4238 Self::Unspecified => std::option::Option::Some(0),
4239 Self::GcePersistentDisk => std::option::Option::Some(1),
4240 Self::UnknownValue(u) => u.0.value(),
4241 }
4242 }
4243
4244 /// Gets the enum value as a string.
4245 ///
4246 /// Returns `None` if the enum contains an unknown value deserialized from
4247 /// the integer representation of enums.
4248 pub fn name(&self) -> std::option::Option<&str> {
4249 match self {
4250 Self::Unspecified => std::option::Option::Some("VOLUME_TYPE_UNSPECIFIED"),
4251 Self::GcePersistentDisk => std::option::Option::Some("GCE_PERSISTENT_DISK"),
4252 Self::UnknownValue(u) => u.0.name(),
4253 }
4254 }
4255 }
4256
4257 impl std::default::Default for VolumeType {
4258 fn default() -> Self {
4259 use std::convert::From;
4260 Self::from(0)
4261 }
4262 }
4263
4264 impl std::fmt::Display for VolumeType {
4265 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
4266 wkt::internal::display_enum(f, self.name(), self.value())
4267 }
4268 }
4269
4270 impl std::convert::From<i32> for VolumeType {
4271 fn from(value: i32) -> Self {
4272 match value {
4273 0 => Self::Unspecified,
4274 1 => Self::GcePersistentDisk,
4275 _ => Self::UnknownValue(volume_type::UnknownValue(
4276 wkt::internal::UnknownEnumValue::Integer(value),
4277 )),
4278 }
4279 }
4280 }
4281
4282 impl std::convert::From<&str> for VolumeType {
4283 fn from(value: &str) -> Self {
4284 use std::string::ToString;
4285 match value {
4286 "VOLUME_TYPE_UNSPECIFIED" => Self::Unspecified,
4287 "GCE_PERSISTENT_DISK" => Self::GcePersistentDisk,
4288 _ => Self::UnknownValue(volume_type::UnknownValue(
4289 wkt::internal::UnknownEnumValue::String(value.to_string()),
4290 )),
4291 }
4292 }
4293 }
4294
4295 impl serde::ser::Serialize for VolumeType {
4296 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
4297 where
4298 S: serde::Serializer,
4299 {
4300 match self {
4301 Self::Unspecified => serializer.serialize_i32(0),
4302 Self::GcePersistentDisk => serializer.serialize_i32(1),
4303 Self::UnknownValue(u) => u.0.serialize(serializer),
4304 }
4305 }
4306 }
4307
4308 impl<'de> serde::de::Deserialize<'de> for VolumeType {
4309 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
4310 where
4311 D: serde::Deserializer<'de>,
4312 {
4313 deserializer.deserialize_any(wkt::internal::EnumVisitor::<VolumeType>::new(
4314 ".google.cloud.gkebackup.v1.VolumeTypeEnum.VolumeType",
4315 ))
4316 }
4317 }
4318}
4319
4320/// Represents the metadata of the long-running operation.
4321#[derive(Clone, Default, PartialEq)]
4322#[non_exhaustive]
4323pub struct OperationMetadata {
4324 /// Output only. The time the operation was created.
4325 pub create_time: std::option::Option<wkt::Timestamp>,
4326
4327 /// Output only. The time the operation finished running.
4328 pub end_time: std::option::Option<wkt::Timestamp>,
4329
4330 /// Output only. Server-defined resource path for the target of the operation.
4331 pub target: std::string::String,
4332
4333 /// Output only. Name of the verb executed by the operation.
4334 pub verb: std::string::String,
4335
4336 /// Output only. Human-readable status of the operation, if any.
4337 pub status_message: std::string::String,
4338
4339 /// Output only. Identifies whether the user has requested cancellation
4340 /// of the operation. Operations that have successfully been cancelled
4341 /// have
4342 /// [google.longrunning.Operation.error][google.longrunning.Operation.error]
4343 /// value with a [google.rpc.Status.code][google.rpc.Status.code] of 1,
4344 /// corresponding to `Code.CANCELLED`.
4345 ///
4346 /// [google.longrunning.Operation.error]: google_cloud_longrunning::model::Operation::result
4347 /// [google.rpc.Status.code]: google_cloud_rpc::model::Status::code
4348 pub requested_cancellation: bool,
4349
4350 /// Output only. API version used to start the operation.
4351 pub api_version: std::string::String,
4352
4353 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4354}
4355
4356impl OperationMetadata {
4357 pub fn new() -> Self {
4358 std::default::Default::default()
4359 }
4360
4361 /// Sets the value of [create_time][crate::model::OperationMetadata::create_time].
4362 ///
4363 /// # Example
4364 /// ```ignore,no_run
4365 /// # use google_cloud_gkebackup_v1::model::OperationMetadata;
4366 /// use wkt::Timestamp;
4367 /// let x = OperationMetadata::new().set_create_time(Timestamp::default()/* use setters */);
4368 /// ```
4369 pub fn set_create_time<T>(mut self, v: T) -> Self
4370 where
4371 T: std::convert::Into<wkt::Timestamp>,
4372 {
4373 self.create_time = std::option::Option::Some(v.into());
4374 self
4375 }
4376
4377 /// Sets or clears the value of [create_time][crate::model::OperationMetadata::create_time].
4378 ///
4379 /// # Example
4380 /// ```ignore,no_run
4381 /// # use google_cloud_gkebackup_v1::model::OperationMetadata;
4382 /// use wkt::Timestamp;
4383 /// let x = OperationMetadata::new().set_or_clear_create_time(Some(Timestamp::default()/* use setters */));
4384 /// let x = OperationMetadata::new().set_or_clear_create_time(None::<Timestamp>);
4385 /// ```
4386 pub fn set_or_clear_create_time<T>(mut self, v: std::option::Option<T>) -> Self
4387 where
4388 T: std::convert::Into<wkt::Timestamp>,
4389 {
4390 self.create_time = v.map(|x| x.into());
4391 self
4392 }
4393
4394 /// Sets the value of [end_time][crate::model::OperationMetadata::end_time].
4395 ///
4396 /// # Example
4397 /// ```ignore,no_run
4398 /// # use google_cloud_gkebackup_v1::model::OperationMetadata;
4399 /// use wkt::Timestamp;
4400 /// let x = OperationMetadata::new().set_end_time(Timestamp::default()/* use setters */);
4401 /// ```
4402 pub fn set_end_time<T>(mut self, v: T) -> Self
4403 where
4404 T: std::convert::Into<wkt::Timestamp>,
4405 {
4406 self.end_time = std::option::Option::Some(v.into());
4407 self
4408 }
4409
4410 /// Sets or clears the value of [end_time][crate::model::OperationMetadata::end_time].
4411 ///
4412 /// # Example
4413 /// ```ignore,no_run
4414 /// # use google_cloud_gkebackup_v1::model::OperationMetadata;
4415 /// use wkt::Timestamp;
4416 /// let x = OperationMetadata::new().set_or_clear_end_time(Some(Timestamp::default()/* use setters */));
4417 /// let x = OperationMetadata::new().set_or_clear_end_time(None::<Timestamp>);
4418 /// ```
4419 pub fn set_or_clear_end_time<T>(mut self, v: std::option::Option<T>) -> Self
4420 where
4421 T: std::convert::Into<wkt::Timestamp>,
4422 {
4423 self.end_time = v.map(|x| x.into());
4424 self
4425 }
4426
4427 /// Sets the value of [target][crate::model::OperationMetadata::target].
4428 ///
4429 /// # Example
4430 /// ```ignore,no_run
4431 /// # use google_cloud_gkebackup_v1::model::OperationMetadata;
4432 /// let x = OperationMetadata::new().set_target("example");
4433 /// ```
4434 pub fn set_target<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4435 self.target = v.into();
4436 self
4437 }
4438
4439 /// Sets the value of [verb][crate::model::OperationMetadata::verb].
4440 ///
4441 /// # Example
4442 /// ```ignore,no_run
4443 /// # use google_cloud_gkebackup_v1::model::OperationMetadata;
4444 /// let x = OperationMetadata::new().set_verb("example");
4445 /// ```
4446 pub fn set_verb<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4447 self.verb = v.into();
4448 self
4449 }
4450
4451 /// Sets the value of [status_message][crate::model::OperationMetadata::status_message].
4452 ///
4453 /// # Example
4454 /// ```ignore,no_run
4455 /// # use google_cloud_gkebackup_v1::model::OperationMetadata;
4456 /// let x = OperationMetadata::new().set_status_message("example");
4457 /// ```
4458 pub fn set_status_message<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4459 self.status_message = v.into();
4460 self
4461 }
4462
4463 /// Sets the value of [requested_cancellation][crate::model::OperationMetadata::requested_cancellation].
4464 ///
4465 /// # Example
4466 /// ```ignore,no_run
4467 /// # use google_cloud_gkebackup_v1::model::OperationMetadata;
4468 /// let x = OperationMetadata::new().set_requested_cancellation(true);
4469 /// ```
4470 pub fn set_requested_cancellation<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
4471 self.requested_cancellation = v.into();
4472 self
4473 }
4474
4475 /// Sets the value of [api_version][crate::model::OperationMetadata::api_version].
4476 ///
4477 /// # Example
4478 /// ```ignore,no_run
4479 /// # use google_cloud_gkebackup_v1::model::OperationMetadata;
4480 /// let x = OperationMetadata::new().set_api_version("example");
4481 /// ```
4482 pub fn set_api_version<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4483 self.api_version = v.into();
4484 self
4485 }
4486}
4487
4488impl wkt::message::Message for OperationMetadata {
4489 fn typename() -> &'static str {
4490 "type.googleapis.com/google.cloud.gkebackup.v1.OperationMetadata"
4491 }
4492}
4493
4494/// Request message for CreateBackupPlan.
4495#[derive(Clone, Default, PartialEq)]
4496#[non_exhaustive]
4497pub struct CreateBackupPlanRequest {
4498 /// Required. The location within which to create the BackupPlan.
4499 /// Format: `projects/*/locations/*`
4500 pub parent: std::string::String,
4501
4502 /// Required. The BackupPlan resource object to create.
4503 pub backup_plan: std::option::Option<crate::model::BackupPlan>,
4504
4505 /// Required. The client-provided short name for the BackupPlan resource.
4506 /// This name must:
4507 ///
4508 /// - be between 1 and 63 characters long (inclusive)
4509 /// - consist of only lower-case ASCII letters, numbers, and dashes
4510 /// - start with a lower-case letter
4511 /// - end with a lower-case letter or number
4512 /// - be unique within the set of BackupPlans in this location
4513 pub backup_plan_id: std::string::String,
4514
4515 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4516}
4517
4518impl CreateBackupPlanRequest {
4519 pub fn new() -> Self {
4520 std::default::Default::default()
4521 }
4522
4523 /// Sets the value of [parent][crate::model::CreateBackupPlanRequest::parent].
4524 ///
4525 /// # Example
4526 /// ```ignore,no_run
4527 /// # use google_cloud_gkebackup_v1::model::CreateBackupPlanRequest;
4528 /// let x = CreateBackupPlanRequest::new().set_parent("example");
4529 /// ```
4530 pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4531 self.parent = v.into();
4532 self
4533 }
4534
4535 /// Sets the value of [backup_plan][crate::model::CreateBackupPlanRequest::backup_plan].
4536 ///
4537 /// # Example
4538 /// ```ignore,no_run
4539 /// # use google_cloud_gkebackup_v1::model::CreateBackupPlanRequest;
4540 /// use google_cloud_gkebackup_v1::model::BackupPlan;
4541 /// let x = CreateBackupPlanRequest::new().set_backup_plan(BackupPlan::default()/* use setters */);
4542 /// ```
4543 pub fn set_backup_plan<T>(mut self, v: T) -> Self
4544 where
4545 T: std::convert::Into<crate::model::BackupPlan>,
4546 {
4547 self.backup_plan = std::option::Option::Some(v.into());
4548 self
4549 }
4550
4551 /// Sets or clears the value of [backup_plan][crate::model::CreateBackupPlanRequest::backup_plan].
4552 ///
4553 /// # Example
4554 /// ```ignore,no_run
4555 /// # use google_cloud_gkebackup_v1::model::CreateBackupPlanRequest;
4556 /// use google_cloud_gkebackup_v1::model::BackupPlan;
4557 /// let x = CreateBackupPlanRequest::new().set_or_clear_backup_plan(Some(BackupPlan::default()/* use setters */));
4558 /// let x = CreateBackupPlanRequest::new().set_or_clear_backup_plan(None::<BackupPlan>);
4559 /// ```
4560 pub fn set_or_clear_backup_plan<T>(mut self, v: std::option::Option<T>) -> Self
4561 where
4562 T: std::convert::Into<crate::model::BackupPlan>,
4563 {
4564 self.backup_plan = v.map(|x| x.into());
4565 self
4566 }
4567
4568 /// Sets the value of [backup_plan_id][crate::model::CreateBackupPlanRequest::backup_plan_id].
4569 ///
4570 /// # Example
4571 /// ```ignore,no_run
4572 /// # use google_cloud_gkebackup_v1::model::CreateBackupPlanRequest;
4573 /// let x = CreateBackupPlanRequest::new().set_backup_plan_id("example");
4574 /// ```
4575 pub fn set_backup_plan_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4576 self.backup_plan_id = v.into();
4577 self
4578 }
4579}
4580
4581impl wkt::message::Message for CreateBackupPlanRequest {
4582 fn typename() -> &'static str {
4583 "type.googleapis.com/google.cloud.gkebackup.v1.CreateBackupPlanRequest"
4584 }
4585}
4586
4587/// Request message for ListBackupPlans.
4588#[derive(Clone, Default, PartialEq)]
4589#[non_exhaustive]
4590pub struct ListBackupPlansRequest {
4591 /// Required. The location that contains the BackupPlans to list.
4592 /// Format: `projects/*/locations/*`
4593 pub parent: std::string::String,
4594
4595 /// Optional. The target number of results to return in a single response.
4596 /// If not specified, a default value will be chosen by the service.
4597 /// Note that the response may include a partial list and a caller should
4598 /// only rely on the response's
4599 /// [next_page_token][google.cloud.gkebackup.v1.ListBackupPlansResponse.next_page_token]
4600 /// to determine if there are more instances left to be queried.
4601 ///
4602 /// [google.cloud.gkebackup.v1.ListBackupPlansResponse.next_page_token]: crate::model::ListBackupPlansResponse::next_page_token
4603 pub page_size: i32,
4604
4605 /// Optional. The value of
4606 /// [next_page_token][google.cloud.gkebackup.v1.ListBackupPlansResponse.next_page_token]
4607 /// received from a previous `ListBackupPlans` call.
4608 /// Provide this to retrieve the subsequent page in a multi-page list of
4609 /// results. When paginating, all other parameters provided to
4610 /// `ListBackupPlans` must match the call that provided the page token.
4611 ///
4612 /// [google.cloud.gkebackup.v1.ListBackupPlansResponse.next_page_token]: crate::model::ListBackupPlansResponse::next_page_token
4613 pub page_token: std::string::String,
4614
4615 /// Optional. Field match expression used to filter the results.
4616 pub filter: std::string::String,
4617
4618 /// Optional. Field by which to sort the results.
4619 pub order_by: std::string::String,
4620
4621 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4622}
4623
4624impl ListBackupPlansRequest {
4625 pub fn new() -> Self {
4626 std::default::Default::default()
4627 }
4628
4629 /// Sets the value of [parent][crate::model::ListBackupPlansRequest::parent].
4630 ///
4631 /// # Example
4632 /// ```ignore,no_run
4633 /// # use google_cloud_gkebackup_v1::model::ListBackupPlansRequest;
4634 /// let x = ListBackupPlansRequest::new().set_parent("example");
4635 /// ```
4636 pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4637 self.parent = v.into();
4638 self
4639 }
4640
4641 /// Sets the value of [page_size][crate::model::ListBackupPlansRequest::page_size].
4642 ///
4643 /// # Example
4644 /// ```ignore,no_run
4645 /// # use google_cloud_gkebackup_v1::model::ListBackupPlansRequest;
4646 /// let x = ListBackupPlansRequest::new().set_page_size(42);
4647 /// ```
4648 pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
4649 self.page_size = v.into();
4650 self
4651 }
4652
4653 /// Sets the value of [page_token][crate::model::ListBackupPlansRequest::page_token].
4654 ///
4655 /// # Example
4656 /// ```ignore,no_run
4657 /// # use google_cloud_gkebackup_v1::model::ListBackupPlansRequest;
4658 /// let x = ListBackupPlansRequest::new().set_page_token("example");
4659 /// ```
4660 pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4661 self.page_token = v.into();
4662 self
4663 }
4664
4665 /// Sets the value of [filter][crate::model::ListBackupPlansRequest::filter].
4666 ///
4667 /// # Example
4668 /// ```ignore,no_run
4669 /// # use google_cloud_gkebackup_v1::model::ListBackupPlansRequest;
4670 /// let x = ListBackupPlansRequest::new().set_filter("example");
4671 /// ```
4672 pub fn set_filter<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4673 self.filter = v.into();
4674 self
4675 }
4676
4677 /// Sets the value of [order_by][crate::model::ListBackupPlansRequest::order_by].
4678 ///
4679 /// # Example
4680 /// ```ignore,no_run
4681 /// # use google_cloud_gkebackup_v1::model::ListBackupPlansRequest;
4682 /// let x = ListBackupPlansRequest::new().set_order_by("example");
4683 /// ```
4684 pub fn set_order_by<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4685 self.order_by = v.into();
4686 self
4687 }
4688}
4689
4690impl wkt::message::Message for ListBackupPlansRequest {
4691 fn typename() -> &'static str {
4692 "type.googleapis.com/google.cloud.gkebackup.v1.ListBackupPlansRequest"
4693 }
4694}
4695
4696/// Response message for ListBackupPlans.
4697#[derive(Clone, Default, PartialEq)]
4698#[non_exhaustive]
4699pub struct ListBackupPlansResponse {
4700 /// The list of BackupPlans matching the given criteria.
4701 pub backup_plans: std::vec::Vec<crate::model::BackupPlan>,
4702
4703 /// A token which may be sent as
4704 /// [page_token][google.cloud.gkebackup.v1.ListBackupPlansRequest.page_token]
4705 /// in a subsequent `ListBackupPlans` call to retrieve the next page of
4706 /// results. If this field is omitted or empty, then there are no more results
4707 /// to return.
4708 ///
4709 /// [google.cloud.gkebackup.v1.ListBackupPlansRequest.page_token]: crate::model::ListBackupPlansRequest::page_token
4710 pub next_page_token: std::string::String,
4711
4712 /// Locations that could not be reached.
4713 pub unreachable: std::vec::Vec<std::string::String>,
4714
4715 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4716}
4717
4718impl ListBackupPlansResponse {
4719 pub fn new() -> Self {
4720 std::default::Default::default()
4721 }
4722
4723 /// Sets the value of [backup_plans][crate::model::ListBackupPlansResponse::backup_plans].
4724 ///
4725 /// # Example
4726 /// ```ignore,no_run
4727 /// # use google_cloud_gkebackup_v1::model::ListBackupPlansResponse;
4728 /// use google_cloud_gkebackup_v1::model::BackupPlan;
4729 /// let x = ListBackupPlansResponse::new()
4730 /// .set_backup_plans([
4731 /// BackupPlan::default()/* use setters */,
4732 /// BackupPlan::default()/* use (different) setters */,
4733 /// ]);
4734 /// ```
4735 pub fn set_backup_plans<T, V>(mut self, v: T) -> Self
4736 where
4737 T: std::iter::IntoIterator<Item = V>,
4738 V: std::convert::Into<crate::model::BackupPlan>,
4739 {
4740 use std::iter::Iterator;
4741 self.backup_plans = v.into_iter().map(|i| i.into()).collect();
4742 self
4743 }
4744
4745 /// Sets the value of [next_page_token][crate::model::ListBackupPlansResponse::next_page_token].
4746 ///
4747 /// # Example
4748 /// ```ignore,no_run
4749 /// # use google_cloud_gkebackup_v1::model::ListBackupPlansResponse;
4750 /// let x = ListBackupPlansResponse::new().set_next_page_token("example");
4751 /// ```
4752 pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4753 self.next_page_token = v.into();
4754 self
4755 }
4756
4757 /// Sets the value of [unreachable][crate::model::ListBackupPlansResponse::unreachable].
4758 ///
4759 /// # Example
4760 /// ```ignore,no_run
4761 /// # use google_cloud_gkebackup_v1::model::ListBackupPlansResponse;
4762 /// let x = ListBackupPlansResponse::new().set_unreachable(["a", "b", "c"]);
4763 /// ```
4764 pub fn set_unreachable<T, V>(mut self, v: T) -> Self
4765 where
4766 T: std::iter::IntoIterator<Item = V>,
4767 V: std::convert::Into<std::string::String>,
4768 {
4769 use std::iter::Iterator;
4770 self.unreachable = v.into_iter().map(|i| i.into()).collect();
4771 self
4772 }
4773}
4774
4775impl wkt::message::Message for ListBackupPlansResponse {
4776 fn typename() -> &'static str {
4777 "type.googleapis.com/google.cloud.gkebackup.v1.ListBackupPlansResponse"
4778 }
4779}
4780
4781#[doc(hidden)]
4782impl google_cloud_gax::paginator::internal::PageableResponse for ListBackupPlansResponse {
4783 type PageItem = crate::model::BackupPlan;
4784
4785 fn items(self) -> std::vec::Vec<Self::PageItem> {
4786 self.backup_plans
4787 }
4788
4789 fn next_page_token(&self) -> std::string::String {
4790 use std::clone::Clone;
4791 self.next_page_token.clone()
4792 }
4793}
4794
4795/// Request message for GetBackupPlan.
4796#[derive(Clone, Default, PartialEq)]
4797#[non_exhaustive]
4798pub struct GetBackupPlanRequest {
4799 /// Required. Fully qualified BackupPlan name.
4800 /// Format: `projects/*/locations/*/backupPlans/*`
4801 pub name: std::string::String,
4802
4803 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4804}
4805
4806impl GetBackupPlanRequest {
4807 pub fn new() -> Self {
4808 std::default::Default::default()
4809 }
4810
4811 /// Sets the value of [name][crate::model::GetBackupPlanRequest::name].
4812 ///
4813 /// # Example
4814 /// ```ignore,no_run
4815 /// # use google_cloud_gkebackup_v1::model::GetBackupPlanRequest;
4816 /// let x = GetBackupPlanRequest::new().set_name("example");
4817 /// ```
4818 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4819 self.name = v.into();
4820 self
4821 }
4822}
4823
4824impl wkt::message::Message for GetBackupPlanRequest {
4825 fn typename() -> &'static str {
4826 "type.googleapis.com/google.cloud.gkebackup.v1.GetBackupPlanRequest"
4827 }
4828}
4829
4830/// Request message for UpdateBackupPlan.
4831#[derive(Clone, Default, PartialEq)]
4832#[non_exhaustive]
4833pub struct UpdateBackupPlanRequest {
4834 /// Required. A new version of the BackupPlan resource that contains updated
4835 /// fields. This may be sparsely populated if an `update_mask` is provided.
4836 pub backup_plan: std::option::Option<crate::model::BackupPlan>,
4837
4838 /// Optional. This is used to specify the fields to be overwritten in the
4839 /// BackupPlan targeted for update. The values for each of these
4840 /// updated fields will be taken from the `backup_plan` provided
4841 /// with this request. Field names are relative to the root of the resource
4842 /// (e.g., `description`, `backup_config.include_volume_data`, etc.)
4843 /// If no `update_mask` is provided, all fields in `backup_plan` will be
4844 /// written to the target BackupPlan resource.
4845 /// Note that OUTPUT_ONLY and IMMUTABLE fields in `backup_plan` are ignored
4846 /// and are not used to update the target BackupPlan.
4847 pub update_mask: std::option::Option<wkt::FieldMask>,
4848
4849 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4850}
4851
4852impl UpdateBackupPlanRequest {
4853 pub fn new() -> Self {
4854 std::default::Default::default()
4855 }
4856
4857 /// Sets the value of [backup_plan][crate::model::UpdateBackupPlanRequest::backup_plan].
4858 ///
4859 /// # Example
4860 /// ```ignore,no_run
4861 /// # use google_cloud_gkebackup_v1::model::UpdateBackupPlanRequest;
4862 /// use google_cloud_gkebackup_v1::model::BackupPlan;
4863 /// let x = UpdateBackupPlanRequest::new().set_backup_plan(BackupPlan::default()/* use setters */);
4864 /// ```
4865 pub fn set_backup_plan<T>(mut self, v: T) -> Self
4866 where
4867 T: std::convert::Into<crate::model::BackupPlan>,
4868 {
4869 self.backup_plan = std::option::Option::Some(v.into());
4870 self
4871 }
4872
4873 /// Sets or clears the value of [backup_plan][crate::model::UpdateBackupPlanRequest::backup_plan].
4874 ///
4875 /// # Example
4876 /// ```ignore,no_run
4877 /// # use google_cloud_gkebackup_v1::model::UpdateBackupPlanRequest;
4878 /// use google_cloud_gkebackup_v1::model::BackupPlan;
4879 /// let x = UpdateBackupPlanRequest::new().set_or_clear_backup_plan(Some(BackupPlan::default()/* use setters */));
4880 /// let x = UpdateBackupPlanRequest::new().set_or_clear_backup_plan(None::<BackupPlan>);
4881 /// ```
4882 pub fn set_or_clear_backup_plan<T>(mut self, v: std::option::Option<T>) -> Self
4883 where
4884 T: std::convert::Into<crate::model::BackupPlan>,
4885 {
4886 self.backup_plan = v.map(|x| x.into());
4887 self
4888 }
4889
4890 /// Sets the value of [update_mask][crate::model::UpdateBackupPlanRequest::update_mask].
4891 ///
4892 /// # Example
4893 /// ```ignore,no_run
4894 /// # use google_cloud_gkebackup_v1::model::UpdateBackupPlanRequest;
4895 /// use wkt::FieldMask;
4896 /// let x = UpdateBackupPlanRequest::new().set_update_mask(FieldMask::default()/* use setters */);
4897 /// ```
4898 pub fn set_update_mask<T>(mut self, v: T) -> Self
4899 where
4900 T: std::convert::Into<wkt::FieldMask>,
4901 {
4902 self.update_mask = std::option::Option::Some(v.into());
4903 self
4904 }
4905
4906 /// Sets or clears the value of [update_mask][crate::model::UpdateBackupPlanRequest::update_mask].
4907 ///
4908 /// # Example
4909 /// ```ignore,no_run
4910 /// # use google_cloud_gkebackup_v1::model::UpdateBackupPlanRequest;
4911 /// use wkt::FieldMask;
4912 /// let x = UpdateBackupPlanRequest::new().set_or_clear_update_mask(Some(FieldMask::default()/* use setters */));
4913 /// let x = UpdateBackupPlanRequest::new().set_or_clear_update_mask(None::<FieldMask>);
4914 /// ```
4915 pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
4916 where
4917 T: std::convert::Into<wkt::FieldMask>,
4918 {
4919 self.update_mask = v.map(|x| x.into());
4920 self
4921 }
4922}
4923
4924impl wkt::message::Message for UpdateBackupPlanRequest {
4925 fn typename() -> &'static str {
4926 "type.googleapis.com/google.cloud.gkebackup.v1.UpdateBackupPlanRequest"
4927 }
4928}
4929
4930/// Request message for DeleteBackupPlan.
4931#[derive(Clone, Default, PartialEq)]
4932#[non_exhaustive]
4933pub struct DeleteBackupPlanRequest {
4934 /// Required. Fully qualified BackupPlan name.
4935 /// Format: `projects/*/locations/*/backupPlans/*`
4936 pub name: std::string::String,
4937
4938 /// Optional. If provided, this value must match the current value of the
4939 /// target BackupPlan's [etag][google.cloud.gkebackup.v1.BackupPlan.etag] field
4940 /// or the request is rejected.
4941 ///
4942 /// [google.cloud.gkebackup.v1.BackupPlan.etag]: crate::model::BackupPlan::etag
4943 pub etag: std::string::String,
4944
4945 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4946}
4947
4948impl DeleteBackupPlanRequest {
4949 pub fn new() -> Self {
4950 std::default::Default::default()
4951 }
4952
4953 /// Sets the value of [name][crate::model::DeleteBackupPlanRequest::name].
4954 ///
4955 /// # Example
4956 /// ```ignore,no_run
4957 /// # use google_cloud_gkebackup_v1::model::DeleteBackupPlanRequest;
4958 /// let x = DeleteBackupPlanRequest::new().set_name("example");
4959 /// ```
4960 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4961 self.name = v.into();
4962 self
4963 }
4964
4965 /// Sets the value of [etag][crate::model::DeleteBackupPlanRequest::etag].
4966 ///
4967 /// # Example
4968 /// ```ignore,no_run
4969 /// # use google_cloud_gkebackup_v1::model::DeleteBackupPlanRequest;
4970 /// let x = DeleteBackupPlanRequest::new().set_etag("example");
4971 /// ```
4972 pub fn set_etag<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4973 self.etag = v.into();
4974 self
4975 }
4976}
4977
4978impl wkt::message::Message for DeleteBackupPlanRequest {
4979 fn typename() -> &'static str {
4980 "type.googleapis.com/google.cloud.gkebackup.v1.DeleteBackupPlanRequest"
4981 }
4982}
4983
4984/// Request message for CreateBackupChannel.
4985#[derive(Clone, Default, PartialEq)]
4986#[non_exhaustive]
4987pub struct CreateBackupChannelRequest {
4988 /// Required. The location within which to create the BackupChannel.
4989 /// Format: `projects/*/locations/*`
4990 pub parent: std::string::String,
4991
4992 /// Required. The BackupChannel resource object to create.
4993 pub backup_channel: std::option::Option<crate::model::BackupChannel>,
4994
4995 /// Optional. The client-provided short name for the BackupChannel resource.
4996 /// This name must:
4997 ///
4998 /// - be between 1 and 63 characters long (inclusive)
4999 /// - consist of only lower-case ASCII letters, numbers, and dashes
5000 /// - start with a lower-case letter
5001 /// - end with a lower-case letter or number
5002 /// - be unique within the set of BackupChannels in this location
5003 /// If the user does not provide a name, a uuid will be used as the name.
5004 pub backup_channel_id: std::string::String,
5005
5006 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5007}
5008
5009impl CreateBackupChannelRequest {
5010 pub fn new() -> Self {
5011 std::default::Default::default()
5012 }
5013
5014 /// Sets the value of [parent][crate::model::CreateBackupChannelRequest::parent].
5015 ///
5016 /// # Example
5017 /// ```ignore,no_run
5018 /// # use google_cloud_gkebackup_v1::model::CreateBackupChannelRequest;
5019 /// let x = CreateBackupChannelRequest::new().set_parent("example");
5020 /// ```
5021 pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5022 self.parent = v.into();
5023 self
5024 }
5025
5026 /// Sets the value of [backup_channel][crate::model::CreateBackupChannelRequest::backup_channel].
5027 ///
5028 /// # Example
5029 /// ```ignore,no_run
5030 /// # use google_cloud_gkebackup_v1::model::CreateBackupChannelRequest;
5031 /// use google_cloud_gkebackup_v1::model::BackupChannel;
5032 /// let x = CreateBackupChannelRequest::new().set_backup_channel(BackupChannel::default()/* use setters */);
5033 /// ```
5034 pub fn set_backup_channel<T>(mut self, v: T) -> Self
5035 where
5036 T: std::convert::Into<crate::model::BackupChannel>,
5037 {
5038 self.backup_channel = std::option::Option::Some(v.into());
5039 self
5040 }
5041
5042 /// Sets or clears the value of [backup_channel][crate::model::CreateBackupChannelRequest::backup_channel].
5043 ///
5044 /// # Example
5045 /// ```ignore,no_run
5046 /// # use google_cloud_gkebackup_v1::model::CreateBackupChannelRequest;
5047 /// use google_cloud_gkebackup_v1::model::BackupChannel;
5048 /// let x = CreateBackupChannelRequest::new().set_or_clear_backup_channel(Some(BackupChannel::default()/* use setters */));
5049 /// let x = CreateBackupChannelRequest::new().set_or_clear_backup_channel(None::<BackupChannel>);
5050 /// ```
5051 pub fn set_or_clear_backup_channel<T>(mut self, v: std::option::Option<T>) -> Self
5052 where
5053 T: std::convert::Into<crate::model::BackupChannel>,
5054 {
5055 self.backup_channel = v.map(|x| x.into());
5056 self
5057 }
5058
5059 /// Sets the value of [backup_channel_id][crate::model::CreateBackupChannelRequest::backup_channel_id].
5060 ///
5061 /// # Example
5062 /// ```ignore,no_run
5063 /// # use google_cloud_gkebackup_v1::model::CreateBackupChannelRequest;
5064 /// let x = CreateBackupChannelRequest::new().set_backup_channel_id("example");
5065 /// ```
5066 pub fn set_backup_channel_id<T: std::convert::Into<std::string::String>>(
5067 mut self,
5068 v: T,
5069 ) -> Self {
5070 self.backup_channel_id = v.into();
5071 self
5072 }
5073}
5074
5075impl wkt::message::Message for CreateBackupChannelRequest {
5076 fn typename() -> &'static str {
5077 "type.googleapis.com/google.cloud.gkebackup.v1.CreateBackupChannelRequest"
5078 }
5079}
5080
5081/// Request message for ListBackupChannels.
5082#[derive(Clone, Default, PartialEq)]
5083#[non_exhaustive]
5084pub struct ListBackupChannelsRequest {
5085 /// Required. The location that contains the BackupChannels to list.
5086 /// Format: `projects/*/locations/*`
5087 pub parent: std::string::String,
5088
5089 /// Optional. The target number of results to return in a single response.
5090 /// If not specified, a default value will be chosen by the service.
5091 /// Note that the response may include a partial list and a caller should
5092 /// only rely on the response's
5093 /// [next_page_token][google.cloud.gkebackup.v1.ListBackupChannelsResponse.next_page_token]
5094 /// to determine if there are more instances left to be queried.
5095 ///
5096 /// [google.cloud.gkebackup.v1.ListBackupChannelsResponse.next_page_token]: crate::model::ListBackupChannelsResponse::next_page_token
5097 pub page_size: i32,
5098
5099 /// Optional. The value of
5100 /// [next_page_token][google.cloud.gkebackup.v1.ListBackupChannelsResponse.next_page_token]
5101 /// received from a previous `ListBackupChannels` call.
5102 /// Provide this to retrieve the subsequent page in a multi-page list of
5103 /// results. When paginating, all other parameters provided to
5104 /// `ListBackupChannels` must match the call that provided the page
5105 /// token.
5106 ///
5107 /// [google.cloud.gkebackup.v1.ListBackupChannelsResponse.next_page_token]: crate::model::ListBackupChannelsResponse::next_page_token
5108 pub page_token: std::string::String,
5109
5110 /// Optional. Field match expression used to filter the results.
5111 pub filter: std::string::String,
5112
5113 /// Optional. Field by which to sort the results.
5114 pub order_by: std::string::String,
5115
5116 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5117}
5118
5119impl ListBackupChannelsRequest {
5120 pub fn new() -> Self {
5121 std::default::Default::default()
5122 }
5123
5124 /// Sets the value of [parent][crate::model::ListBackupChannelsRequest::parent].
5125 ///
5126 /// # Example
5127 /// ```ignore,no_run
5128 /// # use google_cloud_gkebackup_v1::model::ListBackupChannelsRequest;
5129 /// let x = ListBackupChannelsRequest::new().set_parent("example");
5130 /// ```
5131 pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5132 self.parent = v.into();
5133 self
5134 }
5135
5136 /// Sets the value of [page_size][crate::model::ListBackupChannelsRequest::page_size].
5137 ///
5138 /// # Example
5139 /// ```ignore,no_run
5140 /// # use google_cloud_gkebackup_v1::model::ListBackupChannelsRequest;
5141 /// let x = ListBackupChannelsRequest::new().set_page_size(42);
5142 /// ```
5143 pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
5144 self.page_size = v.into();
5145 self
5146 }
5147
5148 /// Sets the value of [page_token][crate::model::ListBackupChannelsRequest::page_token].
5149 ///
5150 /// # Example
5151 /// ```ignore,no_run
5152 /// # use google_cloud_gkebackup_v1::model::ListBackupChannelsRequest;
5153 /// let x = ListBackupChannelsRequest::new().set_page_token("example");
5154 /// ```
5155 pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5156 self.page_token = v.into();
5157 self
5158 }
5159
5160 /// Sets the value of [filter][crate::model::ListBackupChannelsRequest::filter].
5161 ///
5162 /// # Example
5163 /// ```ignore,no_run
5164 /// # use google_cloud_gkebackup_v1::model::ListBackupChannelsRequest;
5165 /// let x = ListBackupChannelsRequest::new().set_filter("example");
5166 /// ```
5167 pub fn set_filter<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5168 self.filter = v.into();
5169 self
5170 }
5171
5172 /// Sets the value of [order_by][crate::model::ListBackupChannelsRequest::order_by].
5173 ///
5174 /// # Example
5175 /// ```ignore,no_run
5176 /// # use google_cloud_gkebackup_v1::model::ListBackupChannelsRequest;
5177 /// let x = ListBackupChannelsRequest::new().set_order_by("example");
5178 /// ```
5179 pub fn set_order_by<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5180 self.order_by = v.into();
5181 self
5182 }
5183}
5184
5185impl wkt::message::Message for ListBackupChannelsRequest {
5186 fn typename() -> &'static str {
5187 "type.googleapis.com/google.cloud.gkebackup.v1.ListBackupChannelsRequest"
5188 }
5189}
5190
5191/// Response message for ListBackupChannels.
5192#[derive(Clone, Default, PartialEq)]
5193#[non_exhaustive]
5194pub struct ListBackupChannelsResponse {
5195 /// The list of BackupChannels matching the given criteria.
5196 pub backup_channels: std::vec::Vec<crate::model::BackupChannel>,
5197
5198 /// A token which may be sent as
5199 /// [page_token][google.cloud.gkebackup.v1.ListBackupChannelsRequest.page_token]
5200 /// in a subsequent `ListBackupChannels` call to retrieve the next page of
5201 /// results. If this field is omitted or empty, then there are no more results
5202 /// to return.
5203 ///
5204 /// [google.cloud.gkebackup.v1.ListBackupChannelsRequest.page_token]: crate::model::ListBackupChannelsRequest::page_token
5205 pub next_page_token: std::string::String,
5206
5207 /// Locations that could not be reached.
5208 pub unreachable: std::vec::Vec<std::string::String>,
5209
5210 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5211}
5212
5213impl ListBackupChannelsResponse {
5214 pub fn new() -> Self {
5215 std::default::Default::default()
5216 }
5217
5218 /// Sets the value of [backup_channels][crate::model::ListBackupChannelsResponse::backup_channels].
5219 ///
5220 /// # Example
5221 /// ```ignore,no_run
5222 /// # use google_cloud_gkebackup_v1::model::ListBackupChannelsResponse;
5223 /// use google_cloud_gkebackup_v1::model::BackupChannel;
5224 /// let x = ListBackupChannelsResponse::new()
5225 /// .set_backup_channels([
5226 /// BackupChannel::default()/* use setters */,
5227 /// BackupChannel::default()/* use (different) setters */,
5228 /// ]);
5229 /// ```
5230 pub fn set_backup_channels<T, V>(mut self, v: T) -> Self
5231 where
5232 T: std::iter::IntoIterator<Item = V>,
5233 V: std::convert::Into<crate::model::BackupChannel>,
5234 {
5235 use std::iter::Iterator;
5236 self.backup_channels = v.into_iter().map(|i| i.into()).collect();
5237 self
5238 }
5239
5240 /// Sets the value of [next_page_token][crate::model::ListBackupChannelsResponse::next_page_token].
5241 ///
5242 /// # Example
5243 /// ```ignore,no_run
5244 /// # use google_cloud_gkebackup_v1::model::ListBackupChannelsResponse;
5245 /// let x = ListBackupChannelsResponse::new().set_next_page_token("example");
5246 /// ```
5247 pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5248 self.next_page_token = v.into();
5249 self
5250 }
5251
5252 /// Sets the value of [unreachable][crate::model::ListBackupChannelsResponse::unreachable].
5253 ///
5254 /// # Example
5255 /// ```ignore,no_run
5256 /// # use google_cloud_gkebackup_v1::model::ListBackupChannelsResponse;
5257 /// let x = ListBackupChannelsResponse::new().set_unreachable(["a", "b", "c"]);
5258 /// ```
5259 pub fn set_unreachable<T, V>(mut self, v: T) -> Self
5260 where
5261 T: std::iter::IntoIterator<Item = V>,
5262 V: std::convert::Into<std::string::String>,
5263 {
5264 use std::iter::Iterator;
5265 self.unreachable = v.into_iter().map(|i| i.into()).collect();
5266 self
5267 }
5268}
5269
5270impl wkt::message::Message for ListBackupChannelsResponse {
5271 fn typename() -> &'static str {
5272 "type.googleapis.com/google.cloud.gkebackup.v1.ListBackupChannelsResponse"
5273 }
5274}
5275
5276#[doc(hidden)]
5277impl google_cloud_gax::paginator::internal::PageableResponse for ListBackupChannelsResponse {
5278 type PageItem = crate::model::BackupChannel;
5279
5280 fn items(self) -> std::vec::Vec<Self::PageItem> {
5281 self.backup_channels
5282 }
5283
5284 fn next_page_token(&self) -> std::string::String {
5285 use std::clone::Clone;
5286 self.next_page_token.clone()
5287 }
5288}
5289
5290/// Request message for GetBackupChannel.
5291#[derive(Clone, Default, PartialEq)]
5292#[non_exhaustive]
5293pub struct GetBackupChannelRequest {
5294 /// Required. Fully qualified BackupChannel name.
5295 /// Format: `projects/*/locations/*/backupChannels/*`
5296 pub name: std::string::String,
5297
5298 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5299}
5300
5301impl GetBackupChannelRequest {
5302 pub fn new() -> Self {
5303 std::default::Default::default()
5304 }
5305
5306 /// Sets the value of [name][crate::model::GetBackupChannelRequest::name].
5307 ///
5308 /// # Example
5309 /// ```ignore,no_run
5310 /// # use google_cloud_gkebackup_v1::model::GetBackupChannelRequest;
5311 /// let x = GetBackupChannelRequest::new().set_name("example");
5312 /// ```
5313 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5314 self.name = v.into();
5315 self
5316 }
5317}
5318
5319impl wkt::message::Message for GetBackupChannelRequest {
5320 fn typename() -> &'static str {
5321 "type.googleapis.com/google.cloud.gkebackup.v1.GetBackupChannelRequest"
5322 }
5323}
5324
5325/// Request message for UpdateBackupChannel.
5326#[derive(Clone, Default, PartialEq)]
5327#[non_exhaustive]
5328pub struct UpdateBackupChannelRequest {
5329 /// Required. A new version of the BackupChannel resource that contains updated
5330 /// fields. This may be sparsely populated if an `update_mask` is provided.
5331 pub backup_channel: std::option::Option<crate::model::BackupChannel>,
5332
5333 /// Optional. This is used to specify the fields to be overwritten in the
5334 /// BackupChannel targeted for update. The values for each of these
5335 /// updated fields will be taken from the `backup_channel` provided
5336 /// with this request. Field names are relative to the root of the resource
5337 /// (e.g., `description`, `labels`, etc.)
5338 /// If no `update_mask` is provided, all fields in `backup_channel` will
5339 /// be written to the target BackupChannel resource. Note that
5340 /// OUTPUT_ONLY and IMMUTABLE fields in `backup_channel` are ignored and
5341 /// are not used to update the target BackupChannel.
5342 pub update_mask: std::option::Option<wkt::FieldMask>,
5343
5344 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5345}
5346
5347impl UpdateBackupChannelRequest {
5348 pub fn new() -> Self {
5349 std::default::Default::default()
5350 }
5351
5352 /// Sets the value of [backup_channel][crate::model::UpdateBackupChannelRequest::backup_channel].
5353 ///
5354 /// # Example
5355 /// ```ignore,no_run
5356 /// # use google_cloud_gkebackup_v1::model::UpdateBackupChannelRequest;
5357 /// use google_cloud_gkebackup_v1::model::BackupChannel;
5358 /// let x = UpdateBackupChannelRequest::new().set_backup_channel(BackupChannel::default()/* use setters */);
5359 /// ```
5360 pub fn set_backup_channel<T>(mut self, v: T) -> Self
5361 where
5362 T: std::convert::Into<crate::model::BackupChannel>,
5363 {
5364 self.backup_channel = std::option::Option::Some(v.into());
5365 self
5366 }
5367
5368 /// Sets or clears the value of [backup_channel][crate::model::UpdateBackupChannelRequest::backup_channel].
5369 ///
5370 /// # Example
5371 /// ```ignore,no_run
5372 /// # use google_cloud_gkebackup_v1::model::UpdateBackupChannelRequest;
5373 /// use google_cloud_gkebackup_v1::model::BackupChannel;
5374 /// let x = UpdateBackupChannelRequest::new().set_or_clear_backup_channel(Some(BackupChannel::default()/* use setters */));
5375 /// let x = UpdateBackupChannelRequest::new().set_or_clear_backup_channel(None::<BackupChannel>);
5376 /// ```
5377 pub fn set_or_clear_backup_channel<T>(mut self, v: std::option::Option<T>) -> Self
5378 where
5379 T: std::convert::Into<crate::model::BackupChannel>,
5380 {
5381 self.backup_channel = v.map(|x| x.into());
5382 self
5383 }
5384
5385 /// Sets the value of [update_mask][crate::model::UpdateBackupChannelRequest::update_mask].
5386 ///
5387 /// # Example
5388 /// ```ignore,no_run
5389 /// # use google_cloud_gkebackup_v1::model::UpdateBackupChannelRequest;
5390 /// use wkt::FieldMask;
5391 /// let x = UpdateBackupChannelRequest::new().set_update_mask(FieldMask::default()/* use setters */);
5392 /// ```
5393 pub fn set_update_mask<T>(mut self, v: T) -> Self
5394 where
5395 T: std::convert::Into<wkt::FieldMask>,
5396 {
5397 self.update_mask = std::option::Option::Some(v.into());
5398 self
5399 }
5400
5401 /// Sets or clears the value of [update_mask][crate::model::UpdateBackupChannelRequest::update_mask].
5402 ///
5403 /// # Example
5404 /// ```ignore,no_run
5405 /// # use google_cloud_gkebackup_v1::model::UpdateBackupChannelRequest;
5406 /// use wkt::FieldMask;
5407 /// let x = UpdateBackupChannelRequest::new().set_or_clear_update_mask(Some(FieldMask::default()/* use setters */));
5408 /// let x = UpdateBackupChannelRequest::new().set_or_clear_update_mask(None::<FieldMask>);
5409 /// ```
5410 pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
5411 where
5412 T: std::convert::Into<wkt::FieldMask>,
5413 {
5414 self.update_mask = v.map(|x| x.into());
5415 self
5416 }
5417}
5418
5419impl wkt::message::Message for UpdateBackupChannelRequest {
5420 fn typename() -> &'static str {
5421 "type.googleapis.com/google.cloud.gkebackup.v1.UpdateBackupChannelRequest"
5422 }
5423}
5424
5425/// Request message for DeleteBackupChannel.
5426#[derive(Clone, Default, PartialEq)]
5427#[non_exhaustive]
5428pub struct DeleteBackupChannelRequest {
5429 /// Required. Fully qualified BackupChannel name.
5430 /// Format: `projects/*/locations/*/backupChannels/*`
5431 pub name: std::string::String,
5432
5433 /// Optional. If provided, this value must match the current value of the
5434 /// target BackupChannel's [etag][google.cloud.gkebackup.v1.BackupChannel.etag]
5435 /// field or the request is rejected.
5436 ///
5437 /// [google.cloud.gkebackup.v1.BackupChannel.etag]: crate::model::BackupChannel::etag
5438 pub etag: std::string::String,
5439
5440 /// Optional. If set to true, any BackupPlanAssociations below this
5441 /// BackupChannel will also be deleted. Otherwise, the request will only
5442 /// succeed if the BackupChannel has no BackupPlanAssociations.
5443 pub force: bool,
5444
5445 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5446}
5447
5448impl DeleteBackupChannelRequest {
5449 pub fn new() -> Self {
5450 std::default::Default::default()
5451 }
5452
5453 /// Sets the value of [name][crate::model::DeleteBackupChannelRequest::name].
5454 ///
5455 /// # Example
5456 /// ```ignore,no_run
5457 /// # use google_cloud_gkebackup_v1::model::DeleteBackupChannelRequest;
5458 /// let x = DeleteBackupChannelRequest::new().set_name("example");
5459 /// ```
5460 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5461 self.name = v.into();
5462 self
5463 }
5464
5465 /// Sets the value of [etag][crate::model::DeleteBackupChannelRequest::etag].
5466 ///
5467 /// # Example
5468 /// ```ignore,no_run
5469 /// # use google_cloud_gkebackup_v1::model::DeleteBackupChannelRequest;
5470 /// let x = DeleteBackupChannelRequest::new().set_etag("example");
5471 /// ```
5472 pub fn set_etag<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5473 self.etag = v.into();
5474 self
5475 }
5476
5477 /// Sets the value of [force][crate::model::DeleteBackupChannelRequest::force].
5478 ///
5479 /// # Example
5480 /// ```ignore,no_run
5481 /// # use google_cloud_gkebackup_v1::model::DeleteBackupChannelRequest;
5482 /// let x = DeleteBackupChannelRequest::new().set_force(true);
5483 /// ```
5484 pub fn set_force<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
5485 self.force = v.into();
5486 self
5487 }
5488}
5489
5490impl wkt::message::Message for DeleteBackupChannelRequest {
5491 fn typename() -> &'static str {
5492 "type.googleapis.com/google.cloud.gkebackup.v1.DeleteBackupChannelRequest"
5493 }
5494}
5495
5496/// Request message for ListBackupPlanBindings.
5497#[derive(Clone, Default, PartialEq)]
5498#[non_exhaustive]
5499pub struct ListBackupPlanBindingsRequest {
5500 /// Required. The BackupChannel that contains the BackupPlanBindings to list.
5501 /// Format: `projects/*/locations/*/backupChannels/*`
5502 pub parent: std::string::String,
5503
5504 /// Optional. The target number of results to return in a single response.
5505 /// If not specified, a default value will be chosen by the service.
5506 /// Note that the response may include a partial list and a caller should
5507 /// only rely on the response's
5508 /// [next_page_token][google.cloud.gkebackup.v1.ListBackupPlanBindingsResponse.next_page_token]
5509 /// to determine if there are more instances left to be queried.
5510 ///
5511 /// [google.cloud.gkebackup.v1.ListBackupPlanBindingsResponse.next_page_token]: crate::model::ListBackupPlanBindingsResponse::next_page_token
5512 pub page_size: i32,
5513
5514 /// Optional. The value of
5515 /// [next_page_token][google.cloud.gkebackup.v1.ListBackupPlanBindingsResponse.next_page_token]
5516 /// received from a previous `ListBackupPlanBindings` call.
5517 /// Provide this to retrieve the subsequent page in a multi-page list of
5518 /// results. When paginating, all other parameters provided to
5519 /// `ListBackupPlanBindings` must match the call that provided the page
5520 /// token.
5521 ///
5522 /// [google.cloud.gkebackup.v1.ListBackupPlanBindingsResponse.next_page_token]: crate::model::ListBackupPlanBindingsResponse::next_page_token
5523 pub page_token: std::string::String,
5524
5525 /// Optional. Field match expression used to filter the results.
5526 pub filter: std::string::String,
5527
5528 /// Optional. Field by which to sort the results.
5529 pub order_by: std::string::String,
5530
5531 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5532}
5533
5534impl ListBackupPlanBindingsRequest {
5535 pub fn new() -> Self {
5536 std::default::Default::default()
5537 }
5538
5539 /// Sets the value of [parent][crate::model::ListBackupPlanBindingsRequest::parent].
5540 ///
5541 /// # Example
5542 /// ```ignore,no_run
5543 /// # use google_cloud_gkebackup_v1::model::ListBackupPlanBindingsRequest;
5544 /// let x = ListBackupPlanBindingsRequest::new().set_parent("example");
5545 /// ```
5546 pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5547 self.parent = v.into();
5548 self
5549 }
5550
5551 /// Sets the value of [page_size][crate::model::ListBackupPlanBindingsRequest::page_size].
5552 ///
5553 /// # Example
5554 /// ```ignore,no_run
5555 /// # use google_cloud_gkebackup_v1::model::ListBackupPlanBindingsRequest;
5556 /// let x = ListBackupPlanBindingsRequest::new().set_page_size(42);
5557 /// ```
5558 pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
5559 self.page_size = v.into();
5560 self
5561 }
5562
5563 /// Sets the value of [page_token][crate::model::ListBackupPlanBindingsRequest::page_token].
5564 ///
5565 /// # Example
5566 /// ```ignore,no_run
5567 /// # use google_cloud_gkebackup_v1::model::ListBackupPlanBindingsRequest;
5568 /// let x = ListBackupPlanBindingsRequest::new().set_page_token("example");
5569 /// ```
5570 pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5571 self.page_token = v.into();
5572 self
5573 }
5574
5575 /// Sets the value of [filter][crate::model::ListBackupPlanBindingsRequest::filter].
5576 ///
5577 /// # Example
5578 /// ```ignore,no_run
5579 /// # use google_cloud_gkebackup_v1::model::ListBackupPlanBindingsRequest;
5580 /// let x = ListBackupPlanBindingsRequest::new().set_filter("example");
5581 /// ```
5582 pub fn set_filter<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5583 self.filter = v.into();
5584 self
5585 }
5586
5587 /// Sets the value of [order_by][crate::model::ListBackupPlanBindingsRequest::order_by].
5588 ///
5589 /// # Example
5590 /// ```ignore,no_run
5591 /// # use google_cloud_gkebackup_v1::model::ListBackupPlanBindingsRequest;
5592 /// let x = ListBackupPlanBindingsRequest::new().set_order_by("example");
5593 /// ```
5594 pub fn set_order_by<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5595 self.order_by = v.into();
5596 self
5597 }
5598}
5599
5600impl wkt::message::Message for ListBackupPlanBindingsRequest {
5601 fn typename() -> &'static str {
5602 "type.googleapis.com/google.cloud.gkebackup.v1.ListBackupPlanBindingsRequest"
5603 }
5604}
5605
5606/// Response message for ListBackupPlanBindings.
5607#[derive(Clone, Default, PartialEq)]
5608#[non_exhaustive]
5609pub struct ListBackupPlanBindingsResponse {
5610 /// The list of BackupPlanBindings matching the given criteria.
5611 pub backup_plan_bindings: std::vec::Vec<crate::model::BackupPlanBinding>,
5612
5613 /// A token which may be sent as
5614 /// [page_token][google.cloud.gkebackup.v1.ListBackupPlanBindingsRequest.page_token]
5615 /// in a subsequent `ListBackupPlanBindingss` call to retrieve the next page of
5616 /// results. If this field is omitted or empty, then there are no more results
5617 /// to return.
5618 ///
5619 /// [google.cloud.gkebackup.v1.ListBackupPlanBindingsRequest.page_token]: crate::model::ListBackupPlanBindingsRequest::page_token
5620 pub next_page_token: std::string::String,
5621
5622 /// Locations that could not be reached.
5623 pub unreachable: std::vec::Vec<std::string::String>,
5624
5625 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5626}
5627
5628impl ListBackupPlanBindingsResponse {
5629 pub fn new() -> Self {
5630 std::default::Default::default()
5631 }
5632
5633 /// Sets the value of [backup_plan_bindings][crate::model::ListBackupPlanBindingsResponse::backup_plan_bindings].
5634 ///
5635 /// # Example
5636 /// ```ignore,no_run
5637 /// # use google_cloud_gkebackup_v1::model::ListBackupPlanBindingsResponse;
5638 /// use google_cloud_gkebackup_v1::model::BackupPlanBinding;
5639 /// let x = ListBackupPlanBindingsResponse::new()
5640 /// .set_backup_plan_bindings([
5641 /// BackupPlanBinding::default()/* use setters */,
5642 /// BackupPlanBinding::default()/* use (different) setters */,
5643 /// ]);
5644 /// ```
5645 pub fn set_backup_plan_bindings<T, V>(mut self, v: T) -> Self
5646 where
5647 T: std::iter::IntoIterator<Item = V>,
5648 V: std::convert::Into<crate::model::BackupPlanBinding>,
5649 {
5650 use std::iter::Iterator;
5651 self.backup_plan_bindings = v.into_iter().map(|i| i.into()).collect();
5652 self
5653 }
5654
5655 /// Sets the value of [next_page_token][crate::model::ListBackupPlanBindingsResponse::next_page_token].
5656 ///
5657 /// # Example
5658 /// ```ignore,no_run
5659 /// # use google_cloud_gkebackup_v1::model::ListBackupPlanBindingsResponse;
5660 /// let x = ListBackupPlanBindingsResponse::new().set_next_page_token("example");
5661 /// ```
5662 pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5663 self.next_page_token = v.into();
5664 self
5665 }
5666
5667 /// Sets the value of [unreachable][crate::model::ListBackupPlanBindingsResponse::unreachable].
5668 ///
5669 /// # Example
5670 /// ```ignore,no_run
5671 /// # use google_cloud_gkebackup_v1::model::ListBackupPlanBindingsResponse;
5672 /// let x = ListBackupPlanBindingsResponse::new().set_unreachable(["a", "b", "c"]);
5673 /// ```
5674 pub fn set_unreachable<T, V>(mut self, v: T) -> Self
5675 where
5676 T: std::iter::IntoIterator<Item = V>,
5677 V: std::convert::Into<std::string::String>,
5678 {
5679 use std::iter::Iterator;
5680 self.unreachable = v.into_iter().map(|i| i.into()).collect();
5681 self
5682 }
5683}
5684
5685impl wkt::message::Message for ListBackupPlanBindingsResponse {
5686 fn typename() -> &'static str {
5687 "type.googleapis.com/google.cloud.gkebackup.v1.ListBackupPlanBindingsResponse"
5688 }
5689}
5690
5691#[doc(hidden)]
5692impl google_cloud_gax::paginator::internal::PageableResponse for ListBackupPlanBindingsResponse {
5693 type PageItem = crate::model::BackupPlanBinding;
5694
5695 fn items(self) -> std::vec::Vec<Self::PageItem> {
5696 self.backup_plan_bindings
5697 }
5698
5699 fn next_page_token(&self) -> std::string::String {
5700 use std::clone::Clone;
5701 self.next_page_token.clone()
5702 }
5703}
5704
5705/// Request message for GetBackupPlanBinding.
5706#[derive(Clone, Default, PartialEq)]
5707#[non_exhaustive]
5708pub struct GetBackupPlanBindingRequest {
5709 /// Required. Fully qualified BackupPlanBinding name.
5710 /// Format:
5711 /// `projects/*/locations/*/backupChannels/*/backupPlanBindings/*`
5712 pub name: std::string::String,
5713
5714 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5715}
5716
5717impl GetBackupPlanBindingRequest {
5718 pub fn new() -> Self {
5719 std::default::Default::default()
5720 }
5721
5722 /// Sets the value of [name][crate::model::GetBackupPlanBindingRequest::name].
5723 ///
5724 /// # Example
5725 /// ```ignore,no_run
5726 /// # use google_cloud_gkebackup_v1::model::GetBackupPlanBindingRequest;
5727 /// let x = GetBackupPlanBindingRequest::new().set_name("example");
5728 /// ```
5729 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5730 self.name = v.into();
5731 self
5732 }
5733}
5734
5735impl wkt::message::Message for GetBackupPlanBindingRequest {
5736 fn typename() -> &'static str {
5737 "type.googleapis.com/google.cloud.gkebackup.v1.GetBackupPlanBindingRequest"
5738 }
5739}
5740
5741/// Request message for CreateBackup.
5742#[derive(Clone, Default, PartialEq)]
5743#[non_exhaustive]
5744pub struct CreateBackupRequest {
5745 /// Required. The BackupPlan within which to create the Backup.
5746 /// Format: `projects/*/locations/*/backupPlans/*`
5747 pub parent: std::string::String,
5748
5749 /// Optional. The Backup resource to create.
5750 pub backup: std::option::Option<crate::model::Backup>,
5751
5752 /// Optional. The client-provided short name for the Backup resource.
5753 /// This name must:
5754 ///
5755 /// - be between 1 and 63 characters long (inclusive)
5756 /// - consist of only lower-case ASCII letters, numbers, and dashes
5757 /// - start with a lower-case letter
5758 /// - end with a lower-case letter or number
5759 /// - be unique within the set of Backups in this BackupPlan
5760 pub backup_id: std::string::String,
5761
5762 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5763}
5764
5765impl CreateBackupRequest {
5766 pub fn new() -> Self {
5767 std::default::Default::default()
5768 }
5769
5770 /// Sets the value of [parent][crate::model::CreateBackupRequest::parent].
5771 ///
5772 /// # Example
5773 /// ```ignore,no_run
5774 /// # use google_cloud_gkebackup_v1::model::CreateBackupRequest;
5775 /// let x = CreateBackupRequest::new().set_parent("example");
5776 /// ```
5777 pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5778 self.parent = v.into();
5779 self
5780 }
5781
5782 /// Sets the value of [backup][crate::model::CreateBackupRequest::backup].
5783 ///
5784 /// # Example
5785 /// ```ignore,no_run
5786 /// # use google_cloud_gkebackup_v1::model::CreateBackupRequest;
5787 /// use google_cloud_gkebackup_v1::model::Backup;
5788 /// let x = CreateBackupRequest::new().set_backup(Backup::default()/* use setters */);
5789 /// ```
5790 pub fn set_backup<T>(mut self, v: T) -> Self
5791 where
5792 T: std::convert::Into<crate::model::Backup>,
5793 {
5794 self.backup = std::option::Option::Some(v.into());
5795 self
5796 }
5797
5798 /// Sets or clears the value of [backup][crate::model::CreateBackupRequest::backup].
5799 ///
5800 /// # Example
5801 /// ```ignore,no_run
5802 /// # use google_cloud_gkebackup_v1::model::CreateBackupRequest;
5803 /// use google_cloud_gkebackup_v1::model::Backup;
5804 /// let x = CreateBackupRequest::new().set_or_clear_backup(Some(Backup::default()/* use setters */));
5805 /// let x = CreateBackupRequest::new().set_or_clear_backup(None::<Backup>);
5806 /// ```
5807 pub fn set_or_clear_backup<T>(mut self, v: std::option::Option<T>) -> Self
5808 where
5809 T: std::convert::Into<crate::model::Backup>,
5810 {
5811 self.backup = v.map(|x| x.into());
5812 self
5813 }
5814
5815 /// Sets the value of [backup_id][crate::model::CreateBackupRequest::backup_id].
5816 ///
5817 /// # Example
5818 /// ```ignore,no_run
5819 /// # use google_cloud_gkebackup_v1::model::CreateBackupRequest;
5820 /// let x = CreateBackupRequest::new().set_backup_id("example");
5821 /// ```
5822 pub fn set_backup_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5823 self.backup_id = v.into();
5824 self
5825 }
5826}
5827
5828impl wkt::message::Message for CreateBackupRequest {
5829 fn typename() -> &'static str {
5830 "type.googleapis.com/google.cloud.gkebackup.v1.CreateBackupRequest"
5831 }
5832}
5833
5834/// Request message for ListBackups.
5835#[derive(Clone, Default, PartialEq)]
5836#[non_exhaustive]
5837pub struct ListBackupsRequest {
5838 /// Required. The BackupPlan that contains the Backups to list.
5839 /// Format: `projects/*/locations/*/backupPlans/*`
5840 pub parent: std::string::String,
5841
5842 /// Optional. The target number of results to return in a single response.
5843 /// If not specified, a default value will be chosen by the service.
5844 /// Note that the response may include a partial list and a caller should
5845 /// only rely on the response's
5846 /// [next_page_token][google.cloud.gkebackup.v1.ListBackupsResponse.next_page_token]
5847 /// to determine if there are more instances left to be queried.
5848 ///
5849 /// [google.cloud.gkebackup.v1.ListBackupsResponse.next_page_token]: crate::model::ListBackupsResponse::next_page_token
5850 pub page_size: i32,
5851
5852 /// Optional. The value of
5853 /// [next_page_token][google.cloud.gkebackup.v1.ListBackupsResponse.next_page_token]
5854 /// received from a previous `ListBackups` call.
5855 /// Provide this to retrieve the subsequent page in a multi-page list of
5856 /// results. When paginating, all other parameters provided to
5857 /// `ListBackups` must match the call that provided the page token.
5858 ///
5859 /// [google.cloud.gkebackup.v1.ListBackupsResponse.next_page_token]: crate::model::ListBackupsResponse::next_page_token
5860 pub page_token: std::string::String,
5861
5862 /// Optional. Field match expression used to filter the results.
5863 pub filter: std::string::String,
5864
5865 /// Optional. Field by which to sort the results.
5866 pub order_by: std::string::String,
5867
5868 /// Optional. If set to true, the response will return partial results when
5869 /// some regions are unreachable and the unreachable field will be populated.
5870 pub return_partial_success: bool,
5871
5872 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5873}
5874
5875impl ListBackupsRequest {
5876 pub fn new() -> Self {
5877 std::default::Default::default()
5878 }
5879
5880 /// Sets the value of [parent][crate::model::ListBackupsRequest::parent].
5881 ///
5882 /// # Example
5883 /// ```ignore,no_run
5884 /// # use google_cloud_gkebackup_v1::model::ListBackupsRequest;
5885 /// let x = ListBackupsRequest::new().set_parent("example");
5886 /// ```
5887 pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5888 self.parent = v.into();
5889 self
5890 }
5891
5892 /// Sets the value of [page_size][crate::model::ListBackupsRequest::page_size].
5893 ///
5894 /// # Example
5895 /// ```ignore,no_run
5896 /// # use google_cloud_gkebackup_v1::model::ListBackupsRequest;
5897 /// let x = ListBackupsRequest::new().set_page_size(42);
5898 /// ```
5899 pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
5900 self.page_size = v.into();
5901 self
5902 }
5903
5904 /// Sets the value of [page_token][crate::model::ListBackupsRequest::page_token].
5905 ///
5906 /// # Example
5907 /// ```ignore,no_run
5908 /// # use google_cloud_gkebackup_v1::model::ListBackupsRequest;
5909 /// let x = ListBackupsRequest::new().set_page_token("example");
5910 /// ```
5911 pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5912 self.page_token = v.into();
5913 self
5914 }
5915
5916 /// Sets the value of [filter][crate::model::ListBackupsRequest::filter].
5917 ///
5918 /// # Example
5919 /// ```ignore,no_run
5920 /// # use google_cloud_gkebackup_v1::model::ListBackupsRequest;
5921 /// let x = ListBackupsRequest::new().set_filter("example");
5922 /// ```
5923 pub fn set_filter<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5924 self.filter = v.into();
5925 self
5926 }
5927
5928 /// Sets the value of [order_by][crate::model::ListBackupsRequest::order_by].
5929 ///
5930 /// # Example
5931 /// ```ignore,no_run
5932 /// # use google_cloud_gkebackup_v1::model::ListBackupsRequest;
5933 /// let x = ListBackupsRequest::new().set_order_by("example");
5934 /// ```
5935 pub fn set_order_by<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5936 self.order_by = v.into();
5937 self
5938 }
5939
5940 /// Sets the value of [return_partial_success][crate::model::ListBackupsRequest::return_partial_success].
5941 ///
5942 /// # Example
5943 /// ```ignore,no_run
5944 /// # use google_cloud_gkebackup_v1::model::ListBackupsRequest;
5945 /// let x = ListBackupsRequest::new().set_return_partial_success(true);
5946 /// ```
5947 pub fn set_return_partial_success<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
5948 self.return_partial_success = v.into();
5949 self
5950 }
5951}
5952
5953impl wkt::message::Message for ListBackupsRequest {
5954 fn typename() -> &'static str {
5955 "type.googleapis.com/google.cloud.gkebackup.v1.ListBackupsRequest"
5956 }
5957}
5958
5959/// Response message for ListBackups.
5960#[derive(Clone, Default, PartialEq)]
5961#[non_exhaustive]
5962pub struct ListBackupsResponse {
5963 /// The list of Backups matching the given criteria.
5964 pub backups: std::vec::Vec<crate::model::Backup>,
5965
5966 /// A token which may be sent as
5967 /// [page_token][google.cloud.gkebackup.v1.ListBackupsRequest.page_token] in a
5968 /// subsequent `ListBackups` call to retrieve the next page of results. If this
5969 /// field is omitted or empty, then there are no more results to return.
5970 ///
5971 /// [google.cloud.gkebackup.v1.ListBackupsRequest.page_token]: crate::model::ListBackupsRequest::page_token
5972 pub next_page_token: std::string::String,
5973
5974 /// Locations that could not be reached.
5975 pub unreachable: std::vec::Vec<std::string::String>,
5976
5977 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5978}
5979
5980impl ListBackupsResponse {
5981 pub fn new() -> Self {
5982 std::default::Default::default()
5983 }
5984
5985 /// Sets the value of [backups][crate::model::ListBackupsResponse::backups].
5986 ///
5987 /// # Example
5988 /// ```ignore,no_run
5989 /// # use google_cloud_gkebackup_v1::model::ListBackupsResponse;
5990 /// use google_cloud_gkebackup_v1::model::Backup;
5991 /// let x = ListBackupsResponse::new()
5992 /// .set_backups([
5993 /// Backup::default()/* use setters */,
5994 /// Backup::default()/* use (different) setters */,
5995 /// ]);
5996 /// ```
5997 pub fn set_backups<T, V>(mut self, v: T) -> Self
5998 where
5999 T: std::iter::IntoIterator<Item = V>,
6000 V: std::convert::Into<crate::model::Backup>,
6001 {
6002 use std::iter::Iterator;
6003 self.backups = v.into_iter().map(|i| i.into()).collect();
6004 self
6005 }
6006
6007 /// Sets the value of [next_page_token][crate::model::ListBackupsResponse::next_page_token].
6008 ///
6009 /// # Example
6010 /// ```ignore,no_run
6011 /// # use google_cloud_gkebackup_v1::model::ListBackupsResponse;
6012 /// let x = ListBackupsResponse::new().set_next_page_token("example");
6013 /// ```
6014 pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6015 self.next_page_token = v.into();
6016 self
6017 }
6018
6019 /// Sets the value of [unreachable][crate::model::ListBackupsResponse::unreachable].
6020 ///
6021 /// # Example
6022 /// ```ignore,no_run
6023 /// # use google_cloud_gkebackup_v1::model::ListBackupsResponse;
6024 /// let x = ListBackupsResponse::new().set_unreachable(["a", "b", "c"]);
6025 /// ```
6026 pub fn set_unreachable<T, V>(mut self, v: T) -> Self
6027 where
6028 T: std::iter::IntoIterator<Item = V>,
6029 V: std::convert::Into<std::string::String>,
6030 {
6031 use std::iter::Iterator;
6032 self.unreachable = v.into_iter().map(|i| i.into()).collect();
6033 self
6034 }
6035}
6036
6037impl wkt::message::Message for ListBackupsResponse {
6038 fn typename() -> &'static str {
6039 "type.googleapis.com/google.cloud.gkebackup.v1.ListBackupsResponse"
6040 }
6041}
6042
6043#[doc(hidden)]
6044impl google_cloud_gax::paginator::internal::PageableResponse for ListBackupsResponse {
6045 type PageItem = crate::model::Backup;
6046
6047 fn items(self) -> std::vec::Vec<Self::PageItem> {
6048 self.backups
6049 }
6050
6051 fn next_page_token(&self) -> std::string::String {
6052 use std::clone::Clone;
6053 self.next_page_token.clone()
6054 }
6055}
6056
6057/// Request message for GetBackup.
6058#[derive(Clone, Default, PartialEq)]
6059#[non_exhaustive]
6060pub struct GetBackupRequest {
6061 /// Required. Full name of the Backup resource.
6062 /// Format: `projects/*/locations/*/backupPlans/*/backups/*`
6063 pub name: std::string::String,
6064
6065 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
6066}
6067
6068impl GetBackupRequest {
6069 pub fn new() -> Self {
6070 std::default::Default::default()
6071 }
6072
6073 /// Sets the value of [name][crate::model::GetBackupRequest::name].
6074 ///
6075 /// # Example
6076 /// ```ignore,no_run
6077 /// # use google_cloud_gkebackup_v1::model::GetBackupRequest;
6078 /// let x = GetBackupRequest::new().set_name("example");
6079 /// ```
6080 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6081 self.name = v.into();
6082 self
6083 }
6084}
6085
6086impl wkt::message::Message for GetBackupRequest {
6087 fn typename() -> &'static str {
6088 "type.googleapis.com/google.cloud.gkebackup.v1.GetBackupRequest"
6089 }
6090}
6091
6092/// Request message for UpdateBackup.
6093#[derive(Clone, Default, PartialEq)]
6094#[non_exhaustive]
6095pub struct UpdateBackupRequest {
6096 /// Required. A new version of the Backup resource that contains updated
6097 /// fields. This may be sparsely populated if an `update_mask` is provided.
6098 pub backup: std::option::Option<crate::model::Backup>,
6099
6100 /// Optional. This is used to specify the fields to be overwritten in the
6101 /// Backup targeted for update. The values for each of these
6102 /// updated fields will be taken from the `backup_plan` provided
6103 /// with this request. Field names are relative to the root of the resource.
6104 /// If no `update_mask` is provided, all fields in `backup` will be
6105 /// written to the target Backup resource.
6106 /// Note that OUTPUT_ONLY and IMMUTABLE fields in `backup` are ignored
6107 /// and are not used to update the target Backup.
6108 pub update_mask: std::option::Option<wkt::FieldMask>,
6109
6110 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
6111}
6112
6113impl UpdateBackupRequest {
6114 pub fn new() -> Self {
6115 std::default::Default::default()
6116 }
6117
6118 /// Sets the value of [backup][crate::model::UpdateBackupRequest::backup].
6119 ///
6120 /// # Example
6121 /// ```ignore,no_run
6122 /// # use google_cloud_gkebackup_v1::model::UpdateBackupRequest;
6123 /// use google_cloud_gkebackup_v1::model::Backup;
6124 /// let x = UpdateBackupRequest::new().set_backup(Backup::default()/* use setters */);
6125 /// ```
6126 pub fn set_backup<T>(mut self, v: T) -> Self
6127 where
6128 T: std::convert::Into<crate::model::Backup>,
6129 {
6130 self.backup = std::option::Option::Some(v.into());
6131 self
6132 }
6133
6134 /// Sets or clears the value of [backup][crate::model::UpdateBackupRequest::backup].
6135 ///
6136 /// # Example
6137 /// ```ignore,no_run
6138 /// # use google_cloud_gkebackup_v1::model::UpdateBackupRequest;
6139 /// use google_cloud_gkebackup_v1::model::Backup;
6140 /// let x = UpdateBackupRequest::new().set_or_clear_backup(Some(Backup::default()/* use setters */));
6141 /// let x = UpdateBackupRequest::new().set_or_clear_backup(None::<Backup>);
6142 /// ```
6143 pub fn set_or_clear_backup<T>(mut self, v: std::option::Option<T>) -> Self
6144 where
6145 T: std::convert::Into<crate::model::Backup>,
6146 {
6147 self.backup = v.map(|x| x.into());
6148 self
6149 }
6150
6151 /// Sets the value of [update_mask][crate::model::UpdateBackupRequest::update_mask].
6152 ///
6153 /// # Example
6154 /// ```ignore,no_run
6155 /// # use google_cloud_gkebackup_v1::model::UpdateBackupRequest;
6156 /// use wkt::FieldMask;
6157 /// let x = UpdateBackupRequest::new().set_update_mask(FieldMask::default()/* use setters */);
6158 /// ```
6159 pub fn set_update_mask<T>(mut self, v: T) -> Self
6160 where
6161 T: std::convert::Into<wkt::FieldMask>,
6162 {
6163 self.update_mask = std::option::Option::Some(v.into());
6164 self
6165 }
6166
6167 /// Sets or clears the value of [update_mask][crate::model::UpdateBackupRequest::update_mask].
6168 ///
6169 /// # Example
6170 /// ```ignore,no_run
6171 /// # use google_cloud_gkebackup_v1::model::UpdateBackupRequest;
6172 /// use wkt::FieldMask;
6173 /// let x = UpdateBackupRequest::new().set_or_clear_update_mask(Some(FieldMask::default()/* use setters */));
6174 /// let x = UpdateBackupRequest::new().set_or_clear_update_mask(None::<FieldMask>);
6175 /// ```
6176 pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
6177 where
6178 T: std::convert::Into<wkt::FieldMask>,
6179 {
6180 self.update_mask = v.map(|x| x.into());
6181 self
6182 }
6183}
6184
6185impl wkt::message::Message for UpdateBackupRequest {
6186 fn typename() -> &'static str {
6187 "type.googleapis.com/google.cloud.gkebackup.v1.UpdateBackupRequest"
6188 }
6189}
6190
6191/// Request message for DeleteBackup.
6192#[derive(Clone, Default, PartialEq)]
6193#[non_exhaustive]
6194pub struct DeleteBackupRequest {
6195 /// Required. Name of the Backup resource.
6196 /// Format: `projects/*/locations/*/backupPlans/*/backups/*`
6197 pub name: std::string::String,
6198
6199 /// Optional. If provided, this value must match the current value of the
6200 /// target Backup's [etag][google.cloud.gkebackup.v1.Backup.etag] field or the
6201 /// request is rejected.
6202 ///
6203 /// [google.cloud.gkebackup.v1.Backup.etag]: crate::model::Backup::etag
6204 pub etag: std::string::String,
6205
6206 /// Optional. If set to true, any VolumeBackups below this Backup will also be
6207 /// deleted. Otherwise, the request will only succeed if the Backup has no
6208 /// VolumeBackups.
6209 pub force: bool,
6210
6211 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
6212}
6213
6214impl DeleteBackupRequest {
6215 pub fn new() -> Self {
6216 std::default::Default::default()
6217 }
6218
6219 /// Sets the value of [name][crate::model::DeleteBackupRequest::name].
6220 ///
6221 /// # Example
6222 /// ```ignore,no_run
6223 /// # use google_cloud_gkebackup_v1::model::DeleteBackupRequest;
6224 /// let x = DeleteBackupRequest::new().set_name("example");
6225 /// ```
6226 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6227 self.name = v.into();
6228 self
6229 }
6230
6231 /// Sets the value of [etag][crate::model::DeleteBackupRequest::etag].
6232 ///
6233 /// # Example
6234 /// ```ignore,no_run
6235 /// # use google_cloud_gkebackup_v1::model::DeleteBackupRequest;
6236 /// let x = DeleteBackupRequest::new().set_etag("example");
6237 /// ```
6238 pub fn set_etag<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6239 self.etag = v.into();
6240 self
6241 }
6242
6243 /// Sets the value of [force][crate::model::DeleteBackupRequest::force].
6244 ///
6245 /// # Example
6246 /// ```ignore,no_run
6247 /// # use google_cloud_gkebackup_v1::model::DeleteBackupRequest;
6248 /// let x = DeleteBackupRequest::new().set_force(true);
6249 /// ```
6250 pub fn set_force<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
6251 self.force = v.into();
6252 self
6253 }
6254}
6255
6256impl wkt::message::Message for DeleteBackupRequest {
6257 fn typename() -> &'static str {
6258 "type.googleapis.com/google.cloud.gkebackup.v1.DeleteBackupRequest"
6259 }
6260}
6261
6262/// Request message for ListVolumeBackups.
6263#[derive(Clone, Default, PartialEq)]
6264#[non_exhaustive]
6265pub struct ListVolumeBackupsRequest {
6266 /// Required. The Backup that contains the VolumeBackups to list.
6267 /// Format: `projects/*/locations/*/backupPlans/*/backups/*`
6268 pub parent: std::string::String,
6269
6270 /// Optional. The target number of results to return in a single response.
6271 /// If not specified, a default value will be chosen by the service.
6272 /// Note that the response may include a partial list and a caller should
6273 /// only rely on the response's
6274 /// [next_page_token][google.cloud.gkebackup.v1.ListVolumeBackupsResponse.next_page_token]
6275 /// to determine if there are more instances left to be queried.
6276 ///
6277 /// [google.cloud.gkebackup.v1.ListVolumeBackupsResponse.next_page_token]: crate::model::ListVolumeBackupsResponse::next_page_token
6278 pub page_size: i32,
6279
6280 /// Optional. The value of
6281 /// [next_page_token][google.cloud.gkebackup.v1.ListVolumeBackupsResponse.next_page_token]
6282 /// received from a previous `ListVolumeBackups` call.
6283 /// Provide this to retrieve the subsequent page in a multi-page list of
6284 /// results. When paginating, all other parameters provided to
6285 /// `ListVolumeBackups` must match the call that provided the page token.
6286 ///
6287 /// [google.cloud.gkebackup.v1.ListVolumeBackupsResponse.next_page_token]: crate::model::ListVolumeBackupsResponse::next_page_token
6288 pub page_token: std::string::String,
6289
6290 /// Optional. Field match expression used to filter the results.
6291 pub filter: std::string::String,
6292
6293 /// Optional. Field by which to sort the results.
6294 pub order_by: std::string::String,
6295
6296 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
6297}
6298
6299impl ListVolumeBackupsRequest {
6300 pub fn new() -> Self {
6301 std::default::Default::default()
6302 }
6303
6304 /// Sets the value of [parent][crate::model::ListVolumeBackupsRequest::parent].
6305 ///
6306 /// # Example
6307 /// ```ignore,no_run
6308 /// # use google_cloud_gkebackup_v1::model::ListVolumeBackupsRequest;
6309 /// let x = ListVolumeBackupsRequest::new().set_parent("example");
6310 /// ```
6311 pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6312 self.parent = v.into();
6313 self
6314 }
6315
6316 /// Sets the value of [page_size][crate::model::ListVolumeBackupsRequest::page_size].
6317 ///
6318 /// # Example
6319 /// ```ignore,no_run
6320 /// # use google_cloud_gkebackup_v1::model::ListVolumeBackupsRequest;
6321 /// let x = ListVolumeBackupsRequest::new().set_page_size(42);
6322 /// ```
6323 pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
6324 self.page_size = v.into();
6325 self
6326 }
6327
6328 /// Sets the value of [page_token][crate::model::ListVolumeBackupsRequest::page_token].
6329 ///
6330 /// # Example
6331 /// ```ignore,no_run
6332 /// # use google_cloud_gkebackup_v1::model::ListVolumeBackupsRequest;
6333 /// let x = ListVolumeBackupsRequest::new().set_page_token("example");
6334 /// ```
6335 pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6336 self.page_token = v.into();
6337 self
6338 }
6339
6340 /// Sets the value of [filter][crate::model::ListVolumeBackupsRequest::filter].
6341 ///
6342 /// # Example
6343 /// ```ignore,no_run
6344 /// # use google_cloud_gkebackup_v1::model::ListVolumeBackupsRequest;
6345 /// let x = ListVolumeBackupsRequest::new().set_filter("example");
6346 /// ```
6347 pub fn set_filter<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6348 self.filter = v.into();
6349 self
6350 }
6351
6352 /// Sets the value of [order_by][crate::model::ListVolumeBackupsRequest::order_by].
6353 ///
6354 /// # Example
6355 /// ```ignore,no_run
6356 /// # use google_cloud_gkebackup_v1::model::ListVolumeBackupsRequest;
6357 /// let x = ListVolumeBackupsRequest::new().set_order_by("example");
6358 /// ```
6359 pub fn set_order_by<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6360 self.order_by = v.into();
6361 self
6362 }
6363}
6364
6365impl wkt::message::Message for ListVolumeBackupsRequest {
6366 fn typename() -> &'static str {
6367 "type.googleapis.com/google.cloud.gkebackup.v1.ListVolumeBackupsRequest"
6368 }
6369}
6370
6371/// Response message for ListVolumeBackups.
6372#[derive(Clone, Default, PartialEq)]
6373#[non_exhaustive]
6374pub struct ListVolumeBackupsResponse {
6375 /// The list of VolumeBackups matching the given criteria.
6376 pub volume_backups: std::vec::Vec<crate::model::VolumeBackup>,
6377
6378 /// A token which may be sent as
6379 /// [page_token][google.cloud.gkebackup.v1.ListVolumeBackupsRequest.page_token]
6380 /// in a subsequent `ListVolumeBackups` call to retrieve the next page of
6381 /// results. If this field is omitted or empty, then there are no more results
6382 /// to return.
6383 ///
6384 /// [google.cloud.gkebackup.v1.ListVolumeBackupsRequest.page_token]: crate::model::ListVolumeBackupsRequest::page_token
6385 pub next_page_token: std::string::String,
6386
6387 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
6388}
6389
6390impl ListVolumeBackupsResponse {
6391 pub fn new() -> Self {
6392 std::default::Default::default()
6393 }
6394
6395 /// Sets the value of [volume_backups][crate::model::ListVolumeBackupsResponse::volume_backups].
6396 ///
6397 /// # Example
6398 /// ```ignore,no_run
6399 /// # use google_cloud_gkebackup_v1::model::ListVolumeBackupsResponse;
6400 /// use google_cloud_gkebackup_v1::model::VolumeBackup;
6401 /// let x = ListVolumeBackupsResponse::new()
6402 /// .set_volume_backups([
6403 /// VolumeBackup::default()/* use setters */,
6404 /// VolumeBackup::default()/* use (different) setters */,
6405 /// ]);
6406 /// ```
6407 pub fn set_volume_backups<T, V>(mut self, v: T) -> Self
6408 where
6409 T: std::iter::IntoIterator<Item = V>,
6410 V: std::convert::Into<crate::model::VolumeBackup>,
6411 {
6412 use std::iter::Iterator;
6413 self.volume_backups = v.into_iter().map(|i| i.into()).collect();
6414 self
6415 }
6416
6417 /// Sets the value of [next_page_token][crate::model::ListVolumeBackupsResponse::next_page_token].
6418 ///
6419 /// # Example
6420 /// ```ignore,no_run
6421 /// # use google_cloud_gkebackup_v1::model::ListVolumeBackupsResponse;
6422 /// let x = ListVolumeBackupsResponse::new().set_next_page_token("example");
6423 /// ```
6424 pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6425 self.next_page_token = v.into();
6426 self
6427 }
6428}
6429
6430impl wkt::message::Message for ListVolumeBackupsResponse {
6431 fn typename() -> &'static str {
6432 "type.googleapis.com/google.cloud.gkebackup.v1.ListVolumeBackupsResponse"
6433 }
6434}
6435
6436#[doc(hidden)]
6437impl google_cloud_gax::paginator::internal::PageableResponse for ListVolumeBackupsResponse {
6438 type PageItem = crate::model::VolumeBackup;
6439
6440 fn items(self) -> std::vec::Vec<Self::PageItem> {
6441 self.volume_backups
6442 }
6443
6444 fn next_page_token(&self) -> std::string::String {
6445 use std::clone::Clone;
6446 self.next_page_token.clone()
6447 }
6448}
6449
6450/// Request message for GetVolumeBackup.
6451#[derive(Clone, Default, PartialEq)]
6452#[non_exhaustive]
6453pub struct GetVolumeBackupRequest {
6454 /// Required. Full name of the VolumeBackup resource.
6455 /// Format: `projects/*/locations/*/backupPlans/*/backups/*/volumeBackups/*`
6456 pub name: std::string::String,
6457
6458 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
6459}
6460
6461impl GetVolumeBackupRequest {
6462 pub fn new() -> Self {
6463 std::default::Default::default()
6464 }
6465
6466 /// Sets the value of [name][crate::model::GetVolumeBackupRequest::name].
6467 ///
6468 /// # Example
6469 /// ```ignore,no_run
6470 /// # use google_cloud_gkebackup_v1::model::GetVolumeBackupRequest;
6471 /// let x = GetVolumeBackupRequest::new().set_name("example");
6472 /// ```
6473 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6474 self.name = v.into();
6475 self
6476 }
6477}
6478
6479impl wkt::message::Message for GetVolumeBackupRequest {
6480 fn typename() -> &'static str {
6481 "type.googleapis.com/google.cloud.gkebackup.v1.GetVolumeBackupRequest"
6482 }
6483}
6484
6485/// Request message for CreateRestorePlan.
6486#[derive(Clone, Default, PartialEq)]
6487#[non_exhaustive]
6488pub struct CreateRestorePlanRequest {
6489 /// Required. The location within which to create the RestorePlan.
6490 /// Format: `projects/*/locations/*`
6491 pub parent: std::string::String,
6492
6493 /// Required. The RestorePlan resource object to create.
6494 pub restore_plan: std::option::Option<crate::model::RestorePlan>,
6495
6496 /// Required. The client-provided short name for the RestorePlan resource.
6497 /// This name must:
6498 ///
6499 /// - be between 1 and 63 characters long (inclusive)
6500 /// - consist of only lower-case ASCII letters, numbers, and dashes
6501 /// - start with a lower-case letter
6502 /// - end with a lower-case letter or number
6503 /// - be unique within the set of RestorePlans in this location
6504 pub restore_plan_id: std::string::String,
6505
6506 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
6507}
6508
6509impl CreateRestorePlanRequest {
6510 pub fn new() -> Self {
6511 std::default::Default::default()
6512 }
6513
6514 /// Sets the value of [parent][crate::model::CreateRestorePlanRequest::parent].
6515 ///
6516 /// # Example
6517 /// ```ignore,no_run
6518 /// # use google_cloud_gkebackup_v1::model::CreateRestorePlanRequest;
6519 /// let x = CreateRestorePlanRequest::new().set_parent("example");
6520 /// ```
6521 pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6522 self.parent = v.into();
6523 self
6524 }
6525
6526 /// Sets the value of [restore_plan][crate::model::CreateRestorePlanRequest::restore_plan].
6527 ///
6528 /// # Example
6529 /// ```ignore,no_run
6530 /// # use google_cloud_gkebackup_v1::model::CreateRestorePlanRequest;
6531 /// use google_cloud_gkebackup_v1::model::RestorePlan;
6532 /// let x = CreateRestorePlanRequest::new().set_restore_plan(RestorePlan::default()/* use setters */);
6533 /// ```
6534 pub fn set_restore_plan<T>(mut self, v: T) -> Self
6535 where
6536 T: std::convert::Into<crate::model::RestorePlan>,
6537 {
6538 self.restore_plan = std::option::Option::Some(v.into());
6539 self
6540 }
6541
6542 /// Sets or clears the value of [restore_plan][crate::model::CreateRestorePlanRequest::restore_plan].
6543 ///
6544 /// # Example
6545 /// ```ignore,no_run
6546 /// # use google_cloud_gkebackup_v1::model::CreateRestorePlanRequest;
6547 /// use google_cloud_gkebackup_v1::model::RestorePlan;
6548 /// let x = CreateRestorePlanRequest::new().set_or_clear_restore_plan(Some(RestorePlan::default()/* use setters */));
6549 /// let x = CreateRestorePlanRequest::new().set_or_clear_restore_plan(None::<RestorePlan>);
6550 /// ```
6551 pub fn set_or_clear_restore_plan<T>(mut self, v: std::option::Option<T>) -> Self
6552 where
6553 T: std::convert::Into<crate::model::RestorePlan>,
6554 {
6555 self.restore_plan = v.map(|x| x.into());
6556 self
6557 }
6558
6559 /// Sets the value of [restore_plan_id][crate::model::CreateRestorePlanRequest::restore_plan_id].
6560 ///
6561 /// # Example
6562 /// ```ignore,no_run
6563 /// # use google_cloud_gkebackup_v1::model::CreateRestorePlanRequest;
6564 /// let x = CreateRestorePlanRequest::new().set_restore_plan_id("example");
6565 /// ```
6566 pub fn set_restore_plan_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6567 self.restore_plan_id = v.into();
6568 self
6569 }
6570}
6571
6572impl wkt::message::Message for CreateRestorePlanRequest {
6573 fn typename() -> &'static str {
6574 "type.googleapis.com/google.cloud.gkebackup.v1.CreateRestorePlanRequest"
6575 }
6576}
6577
6578/// Request message for ListRestorePlans.
6579#[derive(Clone, Default, PartialEq)]
6580#[non_exhaustive]
6581pub struct ListRestorePlansRequest {
6582 /// Required. The location that contains the RestorePlans to list.
6583 /// Format: `projects/*/locations/*`
6584 pub parent: std::string::String,
6585
6586 /// Optional. The target number of results to return in a single response.
6587 /// If not specified, a default value will be chosen by the service.
6588 /// Note that the response may include a partial list and a caller should
6589 /// only rely on the response's
6590 /// [next_page_token][google.cloud.gkebackup.v1.ListRestorePlansResponse.next_page_token]
6591 /// to determine if there are more instances left to be queried.
6592 ///
6593 /// [google.cloud.gkebackup.v1.ListRestorePlansResponse.next_page_token]: crate::model::ListRestorePlansResponse::next_page_token
6594 pub page_size: i32,
6595
6596 /// Optional. The value of
6597 /// [next_page_token][google.cloud.gkebackup.v1.ListRestorePlansResponse.next_page_token]
6598 /// received from a previous `ListRestorePlans` call.
6599 /// Provide this to retrieve the subsequent page in a multi-page list of
6600 /// results. When paginating, all other parameters provided to
6601 /// `ListRestorePlans` must match the call that provided the page token.
6602 ///
6603 /// [google.cloud.gkebackup.v1.ListRestorePlansResponse.next_page_token]: crate::model::ListRestorePlansResponse::next_page_token
6604 pub page_token: std::string::String,
6605
6606 /// Optional. Field match expression used to filter the results.
6607 pub filter: std::string::String,
6608
6609 /// Optional. Field by which to sort the results.
6610 pub order_by: std::string::String,
6611
6612 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
6613}
6614
6615impl ListRestorePlansRequest {
6616 pub fn new() -> Self {
6617 std::default::Default::default()
6618 }
6619
6620 /// Sets the value of [parent][crate::model::ListRestorePlansRequest::parent].
6621 ///
6622 /// # Example
6623 /// ```ignore,no_run
6624 /// # use google_cloud_gkebackup_v1::model::ListRestorePlansRequest;
6625 /// let x = ListRestorePlansRequest::new().set_parent("example");
6626 /// ```
6627 pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6628 self.parent = v.into();
6629 self
6630 }
6631
6632 /// Sets the value of [page_size][crate::model::ListRestorePlansRequest::page_size].
6633 ///
6634 /// # Example
6635 /// ```ignore,no_run
6636 /// # use google_cloud_gkebackup_v1::model::ListRestorePlansRequest;
6637 /// let x = ListRestorePlansRequest::new().set_page_size(42);
6638 /// ```
6639 pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
6640 self.page_size = v.into();
6641 self
6642 }
6643
6644 /// Sets the value of [page_token][crate::model::ListRestorePlansRequest::page_token].
6645 ///
6646 /// # Example
6647 /// ```ignore,no_run
6648 /// # use google_cloud_gkebackup_v1::model::ListRestorePlansRequest;
6649 /// let x = ListRestorePlansRequest::new().set_page_token("example");
6650 /// ```
6651 pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6652 self.page_token = v.into();
6653 self
6654 }
6655
6656 /// Sets the value of [filter][crate::model::ListRestorePlansRequest::filter].
6657 ///
6658 /// # Example
6659 /// ```ignore,no_run
6660 /// # use google_cloud_gkebackup_v1::model::ListRestorePlansRequest;
6661 /// let x = ListRestorePlansRequest::new().set_filter("example");
6662 /// ```
6663 pub fn set_filter<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6664 self.filter = v.into();
6665 self
6666 }
6667
6668 /// Sets the value of [order_by][crate::model::ListRestorePlansRequest::order_by].
6669 ///
6670 /// # Example
6671 /// ```ignore,no_run
6672 /// # use google_cloud_gkebackup_v1::model::ListRestorePlansRequest;
6673 /// let x = ListRestorePlansRequest::new().set_order_by("example");
6674 /// ```
6675 pub fn set_order_by<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6676 self.order_by = v.into();
6677 self
6678 }
6679}
6680
6681impl wkt::message::Message for ListRestorePlansRequest {
6682 fn typename() -> &'static str {
6683 "type.googleapis.com/google.cloud.gkebackup.v1.ListRestorePlansRequest"
6684 }
6685}
6686
6687/// Response message for ListRestorePlans.
6688#[derive(Clone, Default, PartialEq)]
6689#[non_exhaustive]
6690pub struct ListRestorePlansResponse {
6691 /// The list of RestorePlans matching the given criteria.
6692 pub restore_plans: std::vec::Vec<crate::model::RestorePlan>,
6693
6694 /// A token which may be sent as
6695 /// [page_token][google.cloud.gkebackup.v1.ListRestorePlansRequest.page_token]
6696 /// in a subsequent `ListRestorePlans` call to retrieve the next page of
6697 /// results. If this field is omitted or empty, then there are no more results
6698 /// to return.
6699 ///
6700 /// [google.cloud.gkebackup.v1.ListRestorePlansRequest.page_token]: crate::model::ListRestorePlansRequest::page_token
6701 pub next_page_token: std::string::String,
6702
6703 /// Locations that could not be reached.
6704 pub unreachable: std::vec::Vec<std::string::String>,
6705
6706 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
6707}
6708
6709impl ListRestorePlansResponse {
6710 pub fn new() -> Self {
6711 std::default::Default::default()
6712 }
6713
6714 /// Sets the value of [restore_plans][crate::model::ListRestorePlansResponse::restore_plans].
6715 ///
6716 /// # Example
6717 /// ```ignore,no_run
6718 /// # use google_cloud_gkebackup_v1::model::ListRestorePlansResponse;
6719 /// use google_cloud_gkebackup_v1::model::RestorePlan;
6720 /// let x = ListRestorePlansResponse::new()
6721 /// .set_restore_plans([
6722 /// RestorePlan::default()/* use setters */,
6723 /// RestorePlan::default()/* use (different) setters */,
6724 /// ]);
6725 /// ```
6726 pub fn set_restore_plans<T, V>(mut self, v: T) -> Self
6727 where
6728 T: std::iter::IntoIterator<Item = V>,
6729 V: std::convert::Into<crate::model::RestorePlan>,
6730 {
6731 use std::iter::Iterator;
6732 self.restore_plans = v.into_iter().map(|i| i.into()).collect();
6733 self
6734 }
6735
6736 /// Sets the value of [next_page_token][crate::model::ListRestorePlansResponse::next_page_token].
6737 ///
6738 /// # Example
6739 /// ```ignore,no_run
6740 /// # use google_cloud_gkebackup_v1::model::ListRestorePlansResponse;
6741 /// let x = ListRestorePlansResponse::new().set_next_page_token("example");
6742 /// ```
6743 pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6744 self.next_page_token = v.into();
6745 self
6746 }
6747
6748 /// Sets the value of [unreachable][crate::model::ListRestorePlansResponse::unreachable].
6749 ///
6750 /// # Example
6751 /// ```ignore,no_run
6752 /// # use google_cloud_gkebackup_v1::model::ListRestorePlansResponse;
6753 /// let x = ListRestorePlansResponse::new().set_unreachable(["a", "b", "c"]);
6754 /// ```
6755 pub fn set_unreachable<T, V>(mut self, v: T) -> Self
6756 where
6757 T: std::iter::IntoIterator<Item = V>,
6758 V: std::convert::Into<std::string::String>,
6759 {
6760 use std::iter::Iterator;
6761 self.unreachable = v.into_iter().map(|i| i.into()).collect();
6762 self
6763 }
6764}
6765
6766impl wkt::message::Message for ListRestorePlansResponse {
6767 fn typename() -> &'static str {
6768 "type.googleapis.com/google.cloud.gkebackup.v1.ListRestorePlansResponse"
6769 }
6770}
6771
6772#[doc(hidden)]
6773impl google_cloud_gax::paginator::internal::PageableResponse for ListRestorePlansResponse {
6774 type PageItem = crate::model::RestorePlan;
6775
6776 fn items(self) -> std::vec::Vec<Self::PageItem> {
6777 self.restore_plans
6778 }
6779
6780 fn next_page_token(&self) -> std::string::String {
6781 use std::clone::Clone;
6782 self.next_page_token.clone()
6783 }
6784}
6785
6786/// Request message for GetRestorePlan.
6787#[derive(Clone, Default, PartialEq)]
6788#[non_exhaustive]
6789pub struct GetRestorePlanRequest {
6790 /// Required. Fully qualified RestorePlan name.
6791 /// Format: `projects/*/locations/*/restorePlans/*`
6792 pub name: std::string::String,
6793
6794 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
6795}
6796
6797impl GetRestorePlanRequest {
6798 pub fn new() -> Self {
6799 std::default::Default::default()
6800 }
6801
6802 /// Sets the value of [name][crate::model::GetRestorePlanRequest::name].
6803 ///
6804 /// # Example
6805 /// ```ignore,no_run
6806 /// # use google_cloud_gkebackup_v1::model::GetRestorePlanRequest;
6807 /// let x = GetRestorePlanRequest::new().set_name("example");
6808 /// ```
6809 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6810 self.name = v.into();
6811 self
6812 }
6813}
6814
6815impl wkt::message::Message for GetRestorePlanRequest {
6816 fn typename() -> &'static str {
6817 "type.googleapis.com/google.cloud.gkebackup.v1.GetRestorePlanRequest"
6818 }
6819}
6820
6821/// Request message for UpdateRestorePlan.
6822#[derive(Clone, Default, PartialEq)]
6823#[non_exhaustive]
6824pub struct UpdateRestorePlanRequest {
6825 /// Required. A new version of the RestorePlan resource that contains updated
6826 /// fields. This may be sparsely populated if an `update_mask` is provided.
6827 pub restore_plan: std::option::Option<crate::model::RestorePlan>,
6828
6829 /// Optional. This is used to specify the fields to be overwritten in the
6830 /// RestorePlan targeted for update. The values for each of these
6831 /// updated fields will be taken from the `restore_plan` provided
6832 /// with this request. Field names are relative to the root of the resource.
6833 /// If no `update_mask` is provided, all fields in `restore_plan` will be
6834 /// written to the target RestorePlan resource.
6835 /// Note that OUTPUT_ONLY and IMMUTABLE fields in `restore_plan` are ignored
6836 /// and are not used to update the target RestorePlan.
6837 pub update_mask: std::option::Option<wkt::FieldMask>,
6838
6839 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
6840}
6841
6842impl UpdateRestorePlanRequest {
6843 pub fn new() -> Self {
6844 std::default::Default::default()
6845 }
6846
6847 /// Sets the value of [restore_plan][crate::model::UpdateRestorePlanRequest::restore_plan].
6848 ///
6849 /// # Example
6850 /// ```ignore,no_run
6851 /// # use google_cloud_gkebackup_v1::model::UpdateRestorePlanRequest;
6852 /// use google_cloud_gkebackup_v1::model::RestorePlan;
6853 /// let x = UpdateRestorePlanRequest::new().set_restore_plan(RestorePlan::default()/* use setters */);
6854 /// ```
6855 pub fn set_restore_plan<T>(mut self, v: T) -> Self
6856 where
6857 T: std::convert::Into<crate::model::RestorePlan>,
6858 {
6859 self.restore_plan = std::option::Option::Some(v.into());
6860 self
6861 }
6862
6863 /// Sets or clears the value of [restore_plan][crate::model::UpdateRestorePlanRequest::restore_plan].
6864 ///
6865 /// # Example
6866 /// ```ignore,no_run
6867 /// # use google_cloud_gkebackup_v1::model::UpdateRestorePlanRequest;
6868 /// use google_cloud_gkebackup_v1::model::RestorePlan;
6869 /// let x = UpdateRestorePlanRequest::new().set_or_clear_restore_plan(Some(RestorePlan::default()/* use setters */));
6870 /// let x = UpdateRestorePlanRequest::new().set_or_clear_restore_plan(None::<RestorePlan>);
6871 /// ```
6872 pub fn set_or_clear_restore_plan<T>(mut self, v: std::option::Option<T>) -> Self
6873 where
6874 T: std::convert::Into<crate::model::RestorePlan>,
6875 {
6876 self.restore_plan = v.map(|x| x.into());
6877 self
6878 }
6879
6880 /// Sets the value of [update_mask][crate::model::UpdateRestorePlanRequest::update_mask].
6881 ///
6882 /// # Example
6883 /// ```ignore,no_run
6884 /// # use google_cloud_gkebackup_v1::model::UpdateRestorePlanRequest;
6885 /// use wkt::FieldMask;
6886 /// let x = UpdateRestorePlanRequest::new().set_update_mask(FieldMask::default()/* use setters */);
6887 /// ```
6888 pub fn set_update_mask<T>(mut self, v: T) -> Self
6889 where
6890 T: std::convert::Into<wkt::FieldMask>,
6891 {
6892 self.update_mask = std::option::Option::Some(v.into());
6893 self
6894 }
6895
6896 /// Sets or clears the value of [update_mask][crate::model::UpdateRestorePlanRequest::update_mask].
6897 ///
6898 /// # Example
6899 /// ```ignore,no_run
6900 /// # use google_cloud_gkebackup_v1::model::UpdateRestorePlanRequest;
6901 /// use wkt::FieldMask;
6902 /// let x = UpdateRestorePlanRequest::new().set_or_clear_update_mask(Some(FieldMask::default()/* use setters */));
6903 /// let x = UpdateRestorePlanRequest::new().set_or_clear_update_mask(None::<FieldMask>);
6904 /// ```
6905 pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
6906 where
6907 T: std::convert::Into<wkt::FieldMask>,
6908 {
6909 self.update_mask = v.map(|x| x.into());
6910 self
6911 }
6912}
6913
6914impl wkt::message::Message for UpdateRestorePlanRequest {
6915 fn typename() -> &'static str {
6916 "type.googleapis.com/google.cloud.gkebackup.v1.UpdateRestorePlanRequest"
6917 }
6918}
6919
6920/// Request message for DeleteRestorePlan.
6921#[derive(Clone, Default, PartialEq)]
6922#[non_exhaustive]
6923pub struct DeleteRestorePlanRequest {
6924 /// Required. Fully qualified RestorePlan name.
6925 /// Format: `projects/*/locations/*/restorePlans/*`
6926 pub name: std::string::String,
6927
6928 /// Optional. If provided, this value must match the current value of the
6929 /// target RestorePlan's [etag][google.cloud.gkebackup.v1.RestorePlan.etag]
6930 /// field or the request is rejected.
6931 ///
6932 /// [google.cloud.gkebackup.v1.RestorePlan.etag]: crate::model::RestorePlan::etag
6933 pub etag: std::string::String,
6934
6935 /// Optional. If set to true, any Restores below this RestorePlan will also be
6936 /// deleted. Otherwise, the request will only succeed if the RestorePlan has no
6937 /// Restores.
6938 pub force: bool,
6939
6940 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
6941}
6942
6943impl DeleteRestorePlanRequest {
6944 pub fn new() -> Self {
6945 std::default::Default::default()
6946 }
6947
6948 /// Sets the value of [name][crate::model::DeleteRestorePlanRequest::name].
6949 ///
6950 /// # Example
6951 /// ```ignore,no_run
6952 /// # use google_cloud_gkebackup_v1::model::DeleteRestorePlanRequest;
6953 /// let x = DeleteRestorePlanRequest::new().set_name("example");
6954 /// ```
6955 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6956 self.name = v.into();
6957 self
6958 }
6959
6960 /// Sets the value of [etag][crate::model::DeleteRestorePlanRequest::etag].
6961 ///
6962 /// # Example
6963 /// ```ignore,no_run
6964 /// # use google_cloud_gkebackup_v1::model::DeleteRestorePlanRequest;
6965 /// let x = DeleteRestorePlanRequest::new().set_etag("example");
6966 /// ```
6967 pub fn set_etag<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6968 self.etag = v.into();
6969 self
6970 }
6971
6972 /// Sets the value of [force][crate::model::DeleteRestorePlanRequest::force].
6973 ///
6974 /// # Example
6975 /// ```ignore,no_run
6976 /// # use google_cloud_gkebackup_v1::model::DeleteRestorePlanRequest;
6977 /// let x = DeleteRestorePlanRequest::new().set_force(true);
6978 /// ```
6979 pub fn set_force<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
6980 self.force = v.into();
6981 self
6982 }
6983}
6984
6985impl wkt::message::Message for DeleteRestorePlanRequest {
6986 fn typename() -> &'static str {
6987 "type.googleapis.com/google.cloud.gkebackup.v1.DeleteRestorePlanRequest"
6988 }
6989}
6990
6991/// Request message for CreateRestoreChannel.
6992#[derive(Clone, Default, PartialEq)]
6993#[non_exhaustive]
6994pub struct CreateRestoreChannelRequest {
6995 /// Required. The location within which to create the RestoreChannel.
6996 /// Format: `projects/*/locations/*`
6997 pub parent: std::string::String,
6998
6999 /// Required. The RestoreChannel resource object to create.
7000 pub restore_channel: std::option::Option<crate::model::RestoreChannel>,
7001
7002 /// Optional. The client-provided short name for the RestoreChannel resource.
7003 /// This name must:
7004 ///
7005 /// - be between 1 and 63 characters long (inclusive)
7006 /// - consist of only lower-case ASCII letters, numbers, and dashes
7007 /// - start with a lower-case letter
7008 /// - end with a lower-case letter or number
7009 /// - be unique within the set of RestoreChannels in this location
7010 /// If the user does not provide a name, a uuid will be used as the name.
7011 pub restore_channel_id: std::string::String,
7012
7013 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
7014}
7015
7016impl CreateRestoreChannelRequest {
7017 pub fn new() -> Self {
7018 std::default::Default::default()
7019 }
7020
7021 /// Sets the value of [parent][crate::model::CreateRestoreChannelRequest::parent].
7022 ///
7023 /// # Example
7024 /// ```ignore,no_run
7025 /// # use google_cloud_gkebackup_v1::model::CreateRestoreChannelRequest;
7026 /// let x = CreateRestoreChannelRequest::new().set_parent("example");
7027 /// ```
7028 pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
7029 self.parent = v.into();
7030 self
7031 }
7032
7033 /// Sets the value of [restore_channel][crate::model::CreateRestoreChannelRequest::restore_channel].
7034 ///
7035 /// # Example
7036 /// ```ignore,no_run
7037 /// # use google_cloud_gkebackup_v1::model::CreateRestoreChannelRequest;
7038 /// use google_cloud_gkebackup_v1::model::RestoreChannel;
7039 /// let x = CreateRestoreChannelRequest::new().set_restore_channel(RestoreChannel::default()/* use setters */);
7040 /// ```
7041 pub fn set_restore_channel<T>(mut self, v: T) -> Self
7042 where
7043 T: std::convert::Into<crate::model::RestoreChannel>,
7044 {
7045 self.restore_channel = std::option::Option::Some(v.into());
7046 self
7047 }
7048
7049 /// Sets or clears the value of [restore_channel][crate::model::CreateRestoreChannelRequest::restore_channel].
7050 ///
7051 /// # Example
7052 /// ```ignore,no_run
7053 /// # use google_cloud_gkebackup_v1::model::CreateRestoreChannelRequest;
7054 /// use google_cloud_gkebackup_v1::model::RestoreChannel;
7055 /// let x = CreateRestoreChannelRequest::new().set_or_clear_restore_channel(Some(RestoreChannel::default()/* use setters */));
7056 /// let x = CreateRestoreChannelRequest::new().set_or_clear_restore_channel(None::<RestoreChannel>);
7057 /// ```
7058 pub fn set_or_clear_restore_channel<T>(mut self, v: std::option::Option<T>) -> Self
7059 where
7060 T: std::convert::Into<crate::model::RestoreChannel>,
7061 {
7062 self.restore_channel = v.map(|x| x.into());
7063 self
7064 }
7065
7066 /// Sets the value of [restore_channel_id][crate::model::CreateRestoreChannelRequest::restore_channel_id].
7067 ///
7068 /// # Example
7069 /// ```ignore,no_run
7070 /// # use google_cloud_gkebackup_v1::model::CreateRestoreChannelRequest;
7071 /// let x = CreateRestoreChannelRequest::new().set_restore_channel_id("example");
7072 /// ```
7073 pub fn set_restore_channel_id<T: std::convert::Into<std::string::String>>(
7074 mut self,
7075 v: T,
7076 ) -> Self {
7077 self.restore_channel_id = v.into();
7078 self
7079 }
7080}
7081
7082impl wkt::message::Message for CreateRestoreChannelRequest {
7083 fn typename() -> &'static str {
7084 "type.googleapis.com/google.cloud.gkebackup.v1.CreateRestoreChannelRequest"
7085 }
7086}
7087
7088/// Request message for ListRestoreChannels.
7089#[derive(Clone, Default, PartialEq)]
7090#[non_exhaustive]
7091pub struct ListRestoreChannelsRequest {
7092 /// Required. The location that contains the RestoreChannels to list.
7093 /// Format: `projects/*/locations/*`
7094 pub parent: std::string::String,
7095
7096 /// Optional. The target number of results to return in a single response.
7097 /// If not specified, a default value will be chosen by the service.
7098 /// Note that the response may include a partial list and a caller should
7099 /// only rely on the response's
7100 /// [next_page_token][google.cloud.gkebackup.v1.ListRestoreChannelsResponse.next_page_token]
7101 /// to determine if there are more instances left to be queried.
7102 ///
7103 /// [google.cloud.gkebackup.v1.ListRestoreChannelsResponse.next_page_token]: crate::model::ListRestoreChannelsResponse::next_page_token
7104 pub page_size: i32,
7105
7106 /// Optional. The value of
7107 /// [next_page_token][google.cloud.gkebackup.v1.ListRestoreChannelsResponse.next_page_token]
7108 /// received from a previous `ListRestoreChannels` call.
7109 /// Provide this to retrieve the subsequent page in a multi-page list of
7110 /// results. When paginating, all other parameters provided to
7111 /// `ListRestoreChannels` must match the call that provided the page
7112 /// token.
7113 ///
7114 /// [google.cloud.gkebackup.v1.ListRestoreChannelsResponse.next_page_token]: crate::model::ListRestoreChannelsResponse::next_page_token
7115 pub page_token: std::string::String,
7116
7117 /// Optional. Field match expression used to filter the results.
7118 pub filter: std::string::String,
7119
7120 /// Optional. Field by which to sort the results.
7121 pub order_by: std::string::String,
7122
7123 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
7124}
7125
7126impl ListRestoreChannelsRequest {
7127 pub fn new() -> Self {
7128 std::default::Default::default()
7129 }
7130
7131 /// Sets the value of [parent][crate::model::ListRestoreChannelsRequest::parent].
7132 ///
7133 /// # Example
7134 /// ```ignore,no_run
7135 /// # use google_cloud_gkebackup_v1::model::ListRestoreChannelsRequest;
7136 /// let x = ListRestoreChannelsRequest::new().set_parent("example");
7137 /// ```
7138 pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
7139 self.parent = v.into();
7140 self
7141 }
7142
7143 /// Sets the value of [page_size][crate::model::ListRestoreChannelsRequest::page_size].
7144 ///
7145 /// # Example
7146 /// ```ignore,no_run
7147 /// # use google_cloud_gkebackup_v1::model::ListRestoreChannelsRequest;
7148 /// let x = ListRestoreChannelsRequest::new().set_page_size(42);
7149 /// ```
7150 pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
7151 self.page_size = v.into();
7152 self
7153 }
7154
7155 /// Sets the value of [page_token][crate::model::ListRestoreChannelsRequest::page_token].
7156 ///
7157 /// # Example
7158 /// ```ignore,no_run
7159 /// # use google_cloud_gkebackup_v1::model::ListRestoreChannelsRequest;
7160 /// let x = ListRestoreChannelsRequest::new().set_page_token("example");
7161 /// ```
7162 pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
7163 self.page_token = v.into();
7164 self
7165 }
7166
7167 /// Sets the value of [filter][crate::model::ListRestoreChannelsRequest::filter].
7168 ///
7169 /// # Example
7170 /// ```ignore,no_run
7171 /// # use google_cloud_gkebackup_v1::model::ListRestoreChannelsRequest;
7172 /// let x = ListRestoreChannelsRequest::new().set_filter("example");
7173 /// ```
7174 pub fn set_filter<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
7175 self.filter = v.into();
7176 self
7177 }
7178
7179 /// Sets the value of [order_by][crate::model::ListRestoreChannelsRequest::order_by].
7180 ///
7181 /// # Example
7182 /// ```ignore,no_run
7183 /// # use google_cloud_gkebackup_v1::model::ListRestoreChannelsRequest;
7184 /// let x = ListRestoreChannelsRequest::new().set_order_by("example");
7185 /// ```
7186 pub fn set_order_by<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
7187 self.order_by = v.into();
7188 self
7189 }
7190}
7191
7192impl wkt::message::Message for ListRestoreChannelsRequest {
7193 fn typename() -> &'static str {
7194 "type.googleapis.com/google.cloud.gkebackup.v1.ListRestoreChannelsRequest"
7195 }
7196}
7197
7198/// Response message for ListRestoreChannels.
7199#[derive(Clone, Default, PartialEq)]
7200#[non_exhaustive]
7201pub struct ListRestoreChannelsResponse {
7202 /// The list of RestoreChannels matching the given criteria.
7203 pub restore_channels: std::vec::Vec<crate::model::RestoreChannel>,
7204
7205 /// A token which may be sent as
7206 /// [page_token][google.cloud.gkebackup.v1.ListRestoreChannelsRequest.page_token]
7207 /// in a subsequent `ListRestoreChannels` call to retrieve the next page of
7208 /// results. If this field is omitted or empty, then there are no more results
7209 /// to return.
7210 ///
7211 /// [google.cloud.gkebackup.v1.ListRestoreChannelsRequest.page_token]: crate::model::ListRestoreChannelsRequest::page_token
7212 pub next_page_token: std::string::String,
7213
7214 /// Locations that could not be reached.
7215 pub unreachable: std::vec::Vec<std::string::String>,
7216
7217 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
7218}
7219
7220impl ListRestoreChannelsResponse {
7221 pub fn new() -> Self {
7222 std::default::Default::default()
7223 }
7224
7225 /// Sets the value of [restore_channels][crate::model::ListRestoreChannelsResponse::restore_channels].
7226 ///
7227 /// # Example
7228 /// ```ignore,no_run
7229 /// # use google_cloud_gkebackup_v1::model::ListRestoreChannelsResponse;
7230 /// use google_cloud_gkebackup_v1::model::RestoreChannel;
7231 /// let x = ListRestoreChannelsResponse::new()
7232 /// .set_restore_channels([
7233 /// RestoreChannel::default()/* use setters */,
7234 /// RestoreChannel::default()/* use (different) setters */,
7235 /// ]);
7236 /// ```
7237 pub fn set_restore_channels<T, V>(mut self, v: T) -> Self
7238 where
7239 T: std::iter::IntoIterator<Item = V>,
7240 V: std::convert::Into<crate::model::RestoreChannel>,
7241 {
7242 use std::iter::Iterator;
7243 self.restore_channels = v.into_iter().map(|i| i.into()).collect();
7244 self
7245 }
7246
7247 /// Sets the value of [next_page_token][crate::model::ListRestoreChannelsResponse::next_page_token].
7248 ///
7249 /// # Example
7250 /// ```ignore,no_run
7251 /// # use google_cloud_gkebackup_v1::model::ListRestoreChannelsResponse;
7252 /// let x = ListRestoreChannelsResponse::new().set_next_page_token("example");
7253 /// ```
7254 pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
7255 self.next_page_token = v.into();
7256 self
7257 }
7258
7259 /// Sets the value of [unreachable][crate::model::ListRestoreChannelsResponse::unreachable].
7260 ///
7261 /// # Example
7262 /// ```ignore,no_run
7263 /// # use google_cloud_gkebackup_v1::model::ListRestoreChannelsResponse;
7264 /// let x = ListRestoreChannelsResponse::new().set_unreachable(["a", "b", "c"]);
7265 /// ```
7266 pub fn set_unreachable<T, V>(mut self, v: T) -> Self
7267 where
7268 T: std::iter::IntoIterator<Item = V>,
7269 V: std::convert::Into<std::string::String>,
7270 {
7271 use std::iter::Iterator;
7272 self.unreachable = v.into_iter().map(|i| i.into()).collect();
7273 self
7274 }
7275}
7276
7277impl wkt::message::Message for ListRestoreChannelsResponse {
7278 fn typename() -> &'static str {
7279 "type.googleapis.com/google.cloud.gkebackup.v1.ListRestoreChannelsResponse"
7280 }
7281}
7282
7283#[doc(hidden)]
7284impl google_cloud_gax::paginator::internal::PageableResponse for ListRestoreChannelsResponse {
7285 type PageItem = crate::model::RestoreChannel;
7286
7287 fn items(self) -> std::vec::Vec<Self::PageItem> {
7288 self.restore_channels
7289 }
7290
7291 fn next_page_token(&self) -> std::string::String {
7292 use std::clone::Clone;
7293 self.next_page_token.clone()
7294 }
7295}
7296
7297/// Request message for GetRestoreChannel.
7298#[derive(Clone, Default, PartialEq)]
7299#[non_exhaustive]
7300pub struct GetRestoreChannelRequest {
7301 /// Required. Fully qualified RestoreChannel name.
7302 /// Format: `projects/*/locations/*/restoreChannels/*`
7303 pub name: std::string::String,
7304
7305 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
7306}
7307
7308impl GetRestoreChannelRequest {
7309 pub fn new() -> Self {
7310 std::default::Default::default()
7311 }
7312
7313 /// Sets the value of [name][crate::model::GetRestoreChannelRequest::name].
7314 ///
7315 /// # Example
7316 /// ```ignore,no_run
7317 /// # use google_cloud_gkebackup_v1::model::GetRestoreChannelRequest;
7318 /// let x = GetRestoreChannelRequest::new().set_name("example");
7319 /// ```
7320 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
7321 self.name = v.into();
7322 self
7323 }
7324}
7325
7326impl wkt::message::Message for GetRestoreChannelRequest {
7327 fn typename() -> &'static str {
7328 "type.googleapis.com/google.cloud.gkebackup.v1.GetRestoreChannelRequest"
7329 }
7330}
7331
7332/// Request message for UpdateRestoreChannel.
7333#[derive(Clone, Default, PartialEq)]
7334#[non_exhaustive]
7335pub struct UpdateRestoreChannelRequest {
7336 /// Required. A new version of the RestoreChannel resource that contains
7337 /// updated fields. This may be sparsely populated if an `update_mask` is
7338 /// provided.
7339 pub restore_channel: std::option::Option<crate::model::RestoreChannel>,
7340
7341 /// Optional. This is used to specify the fields to be overwritten in the
7342 /// RestoreChannel targeted for update. The values for each of these
7343 /// updated fields will be taken from the `restore_channel` provided
7344 /// with this request. Field names are relative to the root of the resource
7345 /// (e.g., `description`, `destination_project_id`, etc.)
7346 /// If no `update_mask` is provided, all fields in `restore_channel` will
7347 /// be written to the target RestoreChannel resource. Note that
7348 /// OUTPUT_ONLY and IMMUTABLE fields in `restore_channel` are ignored and
7349 /// are not used to update the target RestoreChannel.
7350 pub update_mask: std::option::Option<wkt::FieldMask>,
7351
7352 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
7353}
7354
7355impl UpdateRestoreChannelRequest {
7356 pub fn new() -> Self {
7357 std::default::Default::default()
7358 }
7359
7360 /// Sets the value of [restore_channel][crate::model::UpdateRestoreChannelRequest::restore_channel].
7361 ///
7362 /// # Example
7363 /// ```ignore,no_run
7364 /// # use google_cloud_gkebackup_v1::model::UpdateRestoreChannelRequest;
7365 /// use google_cloud_gkebackup_v1::model::RestoreChannel;
7366 /// let x = UpdateRestoreChannelRequest::new().set_restore_channel(RestoreChannel::default()/* use setters */);
7367 /// ```
7368 pub fn set_restore_channel<T>(mut self, v: T) -> Self
7369 where
7370 T: std::convert::Into<crate::model::RestoreChannel>,
7371 {
7372 self.restore_channel = std::option::Option::Some(v.into());
7373 self
7374 }
7375
7376 /// Sets or clears the value of [restore_channel][crate::model::UpdateRestoreChannelRequest::restore_channel].
7377 ///
7378 /// # Example
7379 /// ```ignore,no_run
7380 /// # use google_cloud_gkebackup_v1::model::UpdateRestoreChannelRequest;
7381 /// use google_cloud_gkebackup_v1::model::RestoreChannel;
7382 /// let x = UpdateRestoreChannelRequest::new().set_or_clear_restore_channel(Some(RestoreChannel::default()/* use setters */));
7383 /// let x = UpdateRestoreChannelRequest::new().set_or_clear_restore_channel(None::<RestoreChannel>);
7384 /// ```
7385 pub fn set_or_clear_restore_channel<T>(mut self, v: std::option::Option<T>) -> Self
7386 where
7387 T: std::convert::Into<crate::model::RestoreChannel>,
7388 {
7389 self.restore_channel = v.map(|x| x.into());
7390 self
7391 }
7392
7393 /// Sets the value of [update_mask][crate::model::UpdateRestoreChannelRequest::update_mask].
7394 ///
7395 /// # Example
7396 /// ```ignore,no_run
7397 /// # use google_cloud_gkebackup_v1::model::UpdateRestoreChannelRequest;
7398 /// use wkt::FieldMask;
7399 /// let x = UpdateRestoreChannelRequest::new().set_update_mask(FieldMask::default()/* use setters */);
7400 /// ```
7401 pub fn set_update_mask<T>(mut self, v: T) -> Self
7402 where
7403 T: std::convert::Into<wkt::FieldMask>,
7404 {
7405 self.update_mask = std::option::Option::Some(v.into());
7406 self
7407 }
7408
7409 /// Sets or clears the value of [update_mask][crate::model::UpdateRestoreChannelRequest::update_mask].
7410 ///
7411 /// # Example
7412 /// ```ignore,no_run
7413 /// # use google_cloud_gkebackup_v1::model::UpdateRestoreChannelRequest;
7414 /// use wkt::FieldMask;
7415 /// let x = UpdateRestoreChannelRequest::new().set_or_clear_update_mask(Some(FieldMask::default()/* use setters */));
7416 /// let x = UpdateRestoreChannelRequest::new().set_or_clear_update_mask(None::<FieldMask>);
7417 /// ```
7418 pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
7419 where
7420 T: std::convert::Into<wkt::FieldMask>,
7421 {
7422 self.update_mask = v.map(|x| x.into());
7423 self
7424 }
7425}
7426
7427impl wkt::message::Message for UpdateRestoreChannelRequest {
7428 fn typename() -> &'static str {
7429 "type.googleapis.com/google.cloud.gkebackup.v1.UpdateRestoreChannelRequest"
7430 }
7431}
7432
7433/// Request message for DeleteRestoreChannel.
7434#[derive(Clone, Default, PartialEq)]
7435#[non_exhaustive]
7436pub struct DeleteRestoreChannelRequest {
7437 /// Required. Fully qualified RestoreChannel name.
7438 /// Format: `projects/*/locations/*/restoreChannels/*`
7439 pub name: std::string::String,
7440
7441 /// Optional. If provided, this value must match the current value of the
7442 /// target RestoreChannel's
7443 /// [etag][google.cloud.gkebackup.v1.RestoreChannel.etag] field or the request
7444 /// is rejected.
7445 ///
7446 /// [google.cloud.gkebackup.v1.RestoreChannel.etag]: crate::model::RestoreChannel::etag
7447 pub etag: std::string::String,
7448
7449 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
7450}
7451
7452impl DeleteRestoreChannelRequest {
7453 pub fn new() -> Self {
7454 std::default::Default::default()
7455 }
7456
7457 /// Sets the value of [name][crate::model::DeleteRestoreChannelRequest::name].
7458 ///
7459 /// # Example
7460 /// ```ignore,no_run
7461 /// # use google_cloud_gkebackup_v1::model::DeleteRestoreChannelRequest;
7462 /// let x = DeleteRestoreChannelRequest::new().set_name("example");
7463 /// ```
7464 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
7465 self.name = v.into();
7466 self
7467 }
7468
7469 /// Sets the value of [etag][crate::model::DeleteRestoreChannelRequest::etag].
7470 ///
7471 /// # Example
7472 /// ```ignore,no_run
7473 /// # use google_cloud_gkebackup_v1::model::DeleteRestoreChannelRequest;
7474 /// let x = DeleteRestoreChannelRequest::new().set_etag("example");
7475 /// ```
7476 pub fn set_etag<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
7477 self.etag = v.into();
7478 self
7479 }
7480}
7481
7482impl wkt::message::Message for DeleteRestoreChannelRequest {
7483 fn typename() -> &'static str {
7484 "type.googleapis.com/google.cloud.gkebackup.v1.DeleteRestoreChannelRequest"
7485 }
7486}
7487
7488/// Request message for ListRestorePlanBindings.
7489#[derive(Clone, Default, PartialEq)]
7490#[non_exhaustive]
7491pub struct ListRestorePlanBindingsRequest {
7492 /// Required. The RestoreChannel that contains the ListRestorePlanBindings to
7493 /// list. Format: `projects/*/locations/*/restoreChannels/*`
7494 pub parent: std::string::String,
7495
7496 /// Optional. The target number of results to return in a single response.
7497 /// If not specified, a default value will be chosen by the service.
7498 /// Note that the response may include a partial list and a caller should
7499 /// only rely on the response's
7500 /// [next_page_token][google.cloud.gkebackup.v1.ListRestorePlanBindingsResponse.next_page_token]
7501 /// to determine if there are more instances left to be queried.
7502 ///
7503 /// [google.cloud.gkebackup.v1.ListRestorePlanBindingsResponse.next_page_token]: crate::model::ListRestorePlanBindingsResponse::next_page_token
7504 pub page_size: i32,
7505
7506 /// Optional. The value of
7507 /// [next_page_token][google.cloud.gkebackup.v1.ListRestorePlanBindingsResponse.next_page_token]
7508 /// received from a previous `ListRestorePlanBindings` call.
7509 /// Provide this to retrieve the subsequent page in a multi-page list of
7510 /// results. When paginating, all other parameters provided to
7511 /// `ListRestorePlanBindings` must match the call that provided the page
7512 /// token.
7513 ///
7514 /// [google.cloud.gkebackup.v1.ListRestorePlanBindingsResponse.next_page_token]: crate::model::ListRestorePlanBindingsResponse::next_page_token
7515 pub page_token: std::string::String,
7516
7517 /// Optional. Field match expression used to filter the results.
7518 pub filter: std::string::String,
7519
7520 /// Optional. Field by which to sort the results.
7521 pub order_by: std::string::String,
7522
7523 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
7524}
7525
7526impl ListRestorePlanBindingsRequest {
7527 pub fn new() -> Self {
7528 std::default::Default::default()
7529 }
7530
7531 /// Sets the value of [parent][crate::model::ListRestorePlanBindingsRequest::parent].
7532 ///
7533 /// # Example
7534 /// ```ignore,no_run
7535 /// # use google_cloud_gkebackup_v1::model::ListRestorePlanBindingsRequest;
7536 /// let x = ListRestorePlanBindingsRequest::new().set_parent("example");
7537 /// ```
7538 pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
7539 self.parent = v.into();
7540 self
7541 }
7542
7543 /// Sets the value of [page_size][crate::model::ListRestorePlanBindingsRequest::page_size].
7544 ///
7545 /// # Example
7546 /// ```ignore,no_run
7547 /// # use google_cloud_gkebackup_v1::model::ListRestorePlanBindingsRequest;
7548 /// let x = ListRestorePlanBindingsRequest::new().set_page_size(42);
7549 /// ```
7550 pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
7551 self.page_size = v.into();
7552 self
7553 }
7554
7555 /// Sets the value of [page_token][crate::model::ListRestorePlanBindingsRequest::page_token].
7556 ///
7557 /// # Example
7558 /// ```ignore,no_run
7559 /// # use google_cloud_gkebackup_v1::model::ListRestorePlanBindingsRequest;
7560 /// let x = ListRestorePlanBindingsRequest::new().set_page_token("example");
7561 /// ```
7562 pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
7563 self.page_token = v.into();
7564 self
7565 }
7566
7567 /// Sets the value of [filter][crate::model::ListRestorePlanBindingsRequest::filter].
7568 ///
7569 /// # Example
7570 /// ```ignore,no_run
7571 /// # use google_cloud_gkebackup_v1::model::ListRestorePlanBindingsRequest;
7572 /// let x = ListRestorePlanBindingsRequest::new().set_filter("example");
7573 /// ```
7574 pub fn set_filter<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
7575 self.filter = v.into();
7576 self
7577 }
7578
7579 /// Sets the value of [order_by][crate::model::ListRestorePlanBindingsRequest::order_by].
7580 ///
7581 /// # Example
7582 /// ```ignore,no_run
7583 /// # use google_cloud_gkebackup_v1::model::ListRestorePlanBindingsRequest;
7584 /// let x = ListRestorePlanBindingsRequest::new().set_order_by("example");
7585 /// ```
7586 pub fn set_order_by<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
7587 self.order_by = v.into();
7588 self
7589 }
7590}
7591
7592impl wkt::message::Message for ListRestorePlanBindingsRequest {
7593 fn typename() -> &'static str {
7594 "type.googleapis.com/google.cloud.gkebackup.v1.ListRestorePlanBindingsRequest"
7595 }
7596}
7597
7598/// Response message for ListRestorePlanBindings.
7599#[derive(Clone, Default, PartialEq)]
7600#[non_exhaustive]
7601pub struct ListRestorePlanBindingsResponse {
7602 /// The list of RestorePlanBindings matching the given criteria.
7603 pub restore_plan_bindings: std::vec::Vec<crate::model::RestorePlanBinding>,
7604
7605 /// A token which may be sent as
7606 /// [page_token][google.cloud.gkebackup.v1.ListRestorePlanBindingsRequest.page_token]
7607 /// in a subsequent `ListRestorePlanBindings` call to retrieve the next page of
7608 /// results. If this field is omitted or empty, then there are no more results
7609 /// to return.
7610 ///
7611 /// [google.cloud.gkebackup.v1.ListRestorePlanBindingsRequest.page_token]: crate::model::ListRestorePlanBindingsRequest::page_token
7612 pub next_page_token: std::string::String,
7613
7614 /// Unordered list. Locations that could not be reached.
7615 pub unreachable: std::vec::Vec<std::string::String>,
7616
7617 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
7618}
7619
7620impl ListRestorePlanBindingsResponse {
7621 pub fn new() -> Self {
7622 std::default::Default::default()
7623 }
7624
7625 /// Sets the value of [restore_plan_bindings][crate::model::ListRestorePlanBindingsResponse::restore_plan_bindings].
7626 ///
7627 /// # Example
7628 /// ```ignore,no_run
7629 /// # use google_cloud_gkebackup_v1::model::ListRestorePlanBindingsResponse;
7630 /// use google_cloud_gkebackup_v1::model::RestorePlanBinding;
7631 /// let x = ListRestorePlanBindingsResponse::new()
7632 /// .set_restore_plan_bindings([
7633 /// RestorePlanBinding::default()/* use setters */,
7634 /// RestorePlanBinding::default()/* use (different) setters */,
7635 /// ]);
7636 /// ```
7637 pub fn set_restore_plan_bindings<T, V>(mut self, v: T) -> Self
7638 where
7639 T: std::iter::IntoIterator<Item = V>,
7640 V: std::convert::Into<crate::model::RestorePlanBinding>,
7641 {
7642 use std::iter::Iterator;
7643 self.restore_plan_bindings = v.into_iter().map(|i| i.into()).collect();
7644 self
7645 }
7646
7647 /// Sets the value of [next_page_token][crate::model::ListRestorePlanBindingsResponse::next_page_token].
7648 ///
7649 /// # Example
7650 /// ```ignore,no_run
7651 /// # use google_cloud_gkebackup_v1::model::ListRestorePlanBindingsResponse;
7652 /// let x = ListRestorePlanBindingsResponse::new().set_next_page_token("example");
7653 /// ```
7654 pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
7655 self.next_page_token = v.into();
7656 self
7657 }
7658
7659 /// Sets the value of [unreachable][crate::model::ListRestorePlanBindingsResponse::unreachable].
7660 ///
7661 /// # Example
7662 /// ```ignore,no_run
7663 /// # use google_cloud_gkebackup_v1::model::ListRestorePlanBindingsResponse;
7664 /// let x = ListRestorePlanBindingsResponse::new().set_unreachable(["a", "b", "c"]);
7665 /// ```
7666 pub fn set_unreachable<T, V>(mut self, v: T) -> Self
7667 where
7668 T: std::iter::IntoIterator<Item = V>,
7669 V: std::convert::Into<std::string::String>,
7670 {
7671 use std::iter::Iterator;
7672 self.unreachable = v.into_iter().map(|i| i.into()).collect();
7673 self
7674 }
7675}
7676
7677impl wkt::message::Message for ListRestorePlanBindingsResponse {
7678 fn typename() -> &'static str {
7679 "type.googleapis.com/google.cloud.gkebackup.v1.ListRestorePlanBindingsResponse"
7680 }
7681}
7682
7683#[doc(hidden)]
7684impl google_cloud_gax::paginator::internal::PageableResponse for ListRestorePlanBindingsResponse {
7685 type PageItem = crate::model::RestorePlanBinding;
7686
7687 fn items(self) -> std::vec::Vec<Self::PageItem> {
7688 self.restore_plan_bindings
7689 }
7690
7691 fn next_page_token(&self) -> std::string::String {
7692 use std::clone::Clone;
7693 self.next_page_token.clone()
7694 }
7695}
7696
7697/// Request message for GetRestorePlanBinding.
7698#[derive(Clone, Default, PartialEq)]
7699#[non_exhaustive]
7700pub struct GetRestorePlanBindingRequest {
7701 /// Required. Fully qualified RestorePlanBinding name.
7702 /// Format:
7703 /// `projects/*/locations/*/restoreChannels/*/restorePlanBindings/*`
7704 pub name: std::string::String,
7705
7706 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
7707}
7708
7709impl GetRestorePlanBindingRequest {
7710 pub fn new() -> Self {
7711 std::default::Default::default()
7712 }
7713
7714 /// Sets the value of [name][crate::model::GetRestorePlanBindingRequest::name].
7715 ///
7716 /// # Example
7717 /// ```ignore,no_run
7718 /// # use google_cloud_gkebackup_v1::model::GetRestorePlanBindingRequest;
7719 /// let x = GetRestorePlanBindingRequest::new().set_name("example");
7720 /// ```
7721 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
7722 self.name = v.into();
7723 self
7724 }
7725}
7726
7727impl wkt::message::Message for GetRestorePlanBindingRequest {
7728 fn typename() -> &'static str {
7729 "type.googleapis.com/google.cloud.gkebackup.v1.GetRestorePlanBindingRequest"
7730 }
7731}
7732
7733/// Request message for CreateRestore.
7734#[derive(Clone, Default, PartialEq)]
7735#[non_exhaustive]
7736pub struct CreateRestoreRequest {
7737 /// Required. The RestorePlan within which to create the Restore.
7738 /// Format: `projects/*/locations/*/restorePlans/*`
7739 pub parent: std::string::String,
7740
7741 /// Required. The restore resource to create.
7742 pub restore: std::option::Option<crate::model::Restore>,
7743
7744 /// Required. The client-provided short name for the Restore resource.
7745 /// This name must:
7746 ///
7747 /// - be between 1 and 63 characters long (inclusive)
7748 /// - consist of only lower-case ASCII letters, numbers, and dashes
7749 /// - start with a lower-case letter
7750 /// - end with a lower-case letter or number
7751 /// - be unique within the set of Restores in this RestorePlan.
7752 pub restore_id: std::string::String,
7753
7754 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
7755}
7756
7757impl CreateRestoreRequest {
7758 pub fn new() -> Self {
7759 std::default::Default::default()
7760 }
7761
7762 /// Sets the value of [parent][crate::model::CreateRestoreRequest::parent].
7763 ///
7764 /// # Example
7765 /// ```ignore,no_run
7766 /// # use google_cloud_gkebackup_v1::model::CreateRestoreRequest;
7767 /// let x = CreateRestoreRequest::new().set_parent("example");
7768 /// ```
7769 pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
7770 self.parent = v.into();
7771 self
7772 }
7773
7774 /// Sets the value of [restore][crate::model::CreateRestoreRequest::restore].
7775 ///
7776 /// # Example
7777 /// ```ignore,no_run
7778 /// # use google_cloud_gkebackup_v1::model::CreateRestoreRequest;
7779 /// use google_cloud_gkebackup_v1::model::Restore;
7780 /// let x = CreateRestoreRequest::new().set_restore(Restore::default()/* use setters */);
7781 /// ```
7782 pub fn set_restore<T>(mut self, v: T) -> Self
7783 where
7784 T: std::convert::Into<crate::model::Restore>,
7785 {
7786 self.restore = std::option::Option::Some(v.into());
7787 self
7788 }
7789
7790 /// Sets or clears the value of [restore][crate::model::CreateRestoreRequest::restore].
7791 ///
7792 /// # Example
7793 /// ```ignore,no_run
7794 /// # use google_cloud_gkebackup_v1::model::CreateRestoreRequest;
7795 /// use google_cloud_gkebackup_v1::model::Restore;
7796 /// let x = CreateRestoreRequest::new().set_or_clear_restore(Some(Restore::default()/* use setters */));
7797 /// let x = CreateRestoreRequest::new().set_or_clear_restore(None::<Restore>);
7798 /// ```
7799 pub fn set_or_clear_restore<T>(mut self, v: std::option::Option<T>) -> Self
7800 where
7801 T: std::convert::Into<crate::model::Restore>,
7802 {
7803 self.restore = v.map(|x| x.into());
7804 self
7805 }
7806
7807 /// Sets the value of [restore_id][crate::model::CreateRestoreRequest::restore_id].
7808 ///
7809 /// # Example
7810 /// ```ignore,no_run
7811 /// # use google_cloud_gkebackup_v1::model::CreateRestoreRequest;
7812 /// let x = CreateRestoreRequest::new().set_restore_id("example");
7813 /// ```
7814 pub fn set_restore_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
7815 self.restore_id = v.into();
7816 self
7817 }
7818}
7819
7820impl wkt::message::Message for CreateRestoreRequest {
7821 fn typename() -> &'static str {
7822 "type.googleapis.com/google.cloud.gkebackup.v1.CreateRestoreRequest"
7823 }
7824}
7825
7826/// Request message for ListRestores.
7827#[derive(Clone, Default, PartialEq)]
7828#[non_exhaustive]
7829pub struct ListRestoresRequest {
7830 /// Required. The RestorePlan that contains the Restores to list.
7831 /// Format: `projects/*/locations/*/restorePlans/*`
7832 pub parent: std::string::String,
7833
7834 /// Optional. The target number of results to return in a single response.
7835 /// If not specified, a default value will be chosen by the service.
7836 /// Note that the response may include a partial list and a caller should
7837 /// only rely on the response's
7838 /// [next_page_token][google.cloud.gkebackup.v1.ListRestoresResponse.next_page_token]
7839 /// to determine if there are more instances left to be queried.
7840 ///
7841 /// [google.cloud.gkebackup.v1.ListRestoresResponse.next_page_token]: crate::model::ListRestoresResponse::next_page_token
7842 pub page_size: i32,
7843
7844 /// Optional. The value of
7845 /// [next_page_token][google.cloud.gkebackup.v1.ListRestoresResponse.next_page_token]
7846 /// received from a previous `ListRestores` call.
7847 /// Provide this to retrieve the subsequent page in a multi-page list of
7848 /// results. When paginating, all other parameters provided to `ListRestores`
7849 /// must match the call that provided the page token.
7850 ///
7851 /// [google.cloud.gkebackup.v1.ListRestoresResponse.next_page_token]: crate::model::ListRestoresResponse::next_page_token
7852 pub page_token: std::string::String,
7853
7854 /// Optional. Field match expression used to filter the results.
7855 pub filter: std::string::String,
7856
7857 /// Optional. Field by which to sort the results.
7858 pub order_by: std::string::String,
7859
7860 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
7861}
7862
7863impl ListRestoresRequest {
7864 pub fn new() -> Self {
7865 std::default::Default::default()
7866 }
7867
7868 /// Sets the value of [parent][crate::model::ListRestoresRequest::parent].
7869 ///
7870 /// # Example
7871 /// ```ignore,no_run
7872 /// # use google_cloud_gkebackup_v1::model::ListRestoresRequest;
7873 /// let x = ListRestoresRequest::new().set_parent("example");
7874 /// ```
7875 pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
7876 self.parent = v.into();
7877 self
7878 }
7879
7880 /// Sets the value of [page_size][crate::model::ListRestoresRequest::page_size].
7881 ///
7882 /// # Example
7883 /// ```ignore,no_run
7884 /// # use google_cloud_gkebackup_v1::model::ListRestoresRequest;
7885 /// let x = ListRestoresRequest::new().set_page_size(42);
7886 /// ```
7887 pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
7888 self.page_size = v.into();
7889 self
7890 }
7891
7892 /// Sets the value of [page_token][crate::model::ListRestoresRequest::page_token].
7893 ///
7894 /// # Example
7895 /// ```ignore,no_run
7896 /// # use google_cloud_gkebackup_v1::model::ListRestoresRequest;
7897 /// let x = ListRestoresRequest::new().set_page_token("example");
7898 /// ```
7899 pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
7900 self.page_token = v.into();
7901 self
7902 }
7903
7904 /// Sets the value of [filter][crate::model::ListRestoresRequest::filter].
7905 ///
7906 /// # Example
7907 /// ```ignore,no_run
7908 /// # use google_cloud_gkebackup_v1::model::ListRestoresRequest;
7909 /// let x = ListRestoresRequest::new().set_filter("example");
7910 /// ```
7911 pub fn set_filter<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
7912 self.filter = v.into();
7913 self
7914 }
7915
7916 /// Sets the value of [order_by][crate::model::ListRestoresRequest::order_by].
7917 ///
7918 /// # Example
7919 /// ```ignore,no_run
7920 /// # use google_cloud_gkebackup_v1::model::ListRestoresRequest;
7921 /// let x = ListRestoresRequest::new().set_order_by("example");
7922 /// ```
7923 pub fn set_order_by<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
7924 self.order_by = v.into();
7925 self
7926 }
7927}
7928
7929impl wkt::message::Message for ListRestoresRequest {
7930 fn typename() -> &'static str {
7931 "type.googleapis.com/google.cloud.gkebackup.v1.ListRestoresRequest"
7932 }
7933}
7934
7935/// Response message for ListRestores.
7936#[derive(Clone, Default, PartialEq)]
7937#[non_exhaustive]
7938pub struct ListRestoresResponse {
7939 /// The list of Restores matching the given criteria.
7940 pub restores: std::vec::Vec<crate::model::Restore>,
7941
7942 /// A token which may be sent as
7943 /// [page_token][google.cloud.gkebackup.v1.ListRestoresRequest.page_token] in a
7944 /// subsequent `ListRestores` call to retrieve the next page of results. If
7945 /// this field is omitted or empty, then there are no more results to return.
7946 ///
7947 /// [google.cloud.gkebackup.v1.ListRestoresRequest.page_token]: crate::model::ListRestoresRequest::page_token
7948 pub next_page_token: std::string::String,
7949
7950 /// Locations that could not be reached.
7951 pub unreachable: std::vec::Vec<std::string::String>,
7952
7953 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
7954}
7955
7956impl ListRestoresResponse {
7957 pub fn new() -> Self {
7958 std::default::Default::default()
7959 }
7960
7961 /// Sets the value of [restores][crate::model::ListRestoresResponse::restores].
7962 ///
7963 /// # Example
7964 /// ```ignore,no_run
7965 /// # use google_cloud_gkebackup_v1::model::ListRestoresResponse;
7966 /// use google_cloud_gkebackup_v1::model::Restore;
7967 /// let x = ListRestoresResponse::new()
7968 /// .set_restores([
7969 /// Restore::default()/* use setters */,
7970 /// Restore::default()/* use (different) setters */,
7971 /// ]);
7972 /// ```
7973 pub fn set_restores<T, V>(mut self, v: T) -> Self
7974 where
7975 T: std::iter::IntoIterator<Item = V>,
7976 V: std::convert::Into<crate::model::Restore>,
7977 {
7978 use std::iter::Iterator;
7979 self.restores = v.into_iter().map(|i| i.into()).collect();
7980 self
7981 }
7982
7983 /// Sets the value of [next_page_token][crate::model::ListRestoresResponse::next_page_token].
7984 ///
7985 /// # Example
7986 /// ```ignore,no_run
7987 /// # use google_cloud_gkebackup_v1::model::ListRestoresResponse;
7988 /// let x = ListRestoresResponse::new().set_next_page_token("example");
7989 /// ```
7990 pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
7991 self.next_page_token = v.into();
7992 self
7993 }
7994
7995 /// Sets the value of [unreachable][crate::model::ListRestoresResponse::unreachable].
7996 ///
7997 /// # Example
7998 /// ```ignore,no_run
7999 /// # use google_cloud_gkebackup_v1::model::ListRestoresResponse;
8000 /// let x = ListRestoresResponse::new().set_unreachable(["a", "b", "c"]);
8001 /// ```
8002 pub fn set_unreachable<T, V>(mut self, v: T) -> Self
8003 where
8004 T: std::iter::IntoIterator<Item = V>,
8005 V: std::convert::Into<std::string::String>,
8006 {
8007 use std::iter::Iterator;
8008 self.unreachable = v.into_iter().map(|i| i.into()).collect();
8009 self
8010 }
8011}
8012
8013impl wkt::message::Message for ListRestoresResponse {
8014 fn typename() -> &'static str {
8015 "type.googleapis.com/google.cloud.gkebackup.v1.ListRestoresResponse"
8016 }
8017}
8018
8019#[doc(hidden)]
8020impl google_cloud_gax::paginator::internal::PageableResponse for ListRestoresResponse {
8021 type PageItem = crate::model::Restore;
8022
8023 fn items(self) -> std::vec::Vec<Self::PageItem> {
8024 self.restores
8025 }
8026
8027 fn next_page_token(&self) -> std::string::String {
8028 use std::clone::Clone;
8029 self.next_page_token.clone()
8030 }
8031}
8032
8033/// Request message for GetRestore.
8034#[derive(Clone, Default, PartialEq)]
8035#[non_exhaustive]
8036pub struct GetRestoreRequest {
8037 /// Required. Name of the restore resource.
8038 /// Format: `projects/*/locations/*/restorePlans/*/restores/*`
8039 pub name: std::string::String,
8040
8041 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
8042}
8043
8044impl GetRestoreRequest {
8045 pub fn new() -> Self {
8046 std::default::Default::default()
8047 }
8048
8049 /// Sets the value of [name][crate::model::GetRestoreRequest::name].
8050 ///
8051 /// # Example
8052 /// ```ignore,no_run
8053 /// # use google_cloud_gkebackup_v1::model::GetRestoreRequest;
8054 /// let x = GetRestoreRequest::new().set_name("example");
8055 /// ```
8056 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
8057 self.name = v.into();
8058 self
8059 }
8060}
8061
8062impl wkt::message::Message for GetRestoreRequest {
8063 fn typename() -> &'static str {
8064 "type.googleapis.com/google.cloud.gkebackup.v1.GetRestoreRequest"
8065 }
8066}
8067
8068/// Request message for UpdateRestore.
8069#[derive(Clone, Default, PartialEq)]
8070#[non_exhaustive]
8071pub struct UpdateRestoreRequest {
8072 /// Required. A new version of the Restore resource that contains updated
8073 /// fields. This may be sparsely populated if an `update_mask` is provided.
8074 pub restore: std::option::Option<crate::model::Restore>,
8075
8076 /// Optional. This is used to specify the fields to be overwritten in the
8077 /// Restore targeted for update. The values for each of these
8078 /// updated fields will be taken from the `restore` provided
8079 /// with this request. Field names are relative to the root of the resource.
8080 /// If no `update_mask` is provided, all fields in `restore` will be
8081 /// written to the target Restore resource.
8082 /// Note that OUTPUT_ONLY and IMMUTABLE fields in `restore` are ignored
8083 /// and are not used to update the target Restore.
8084 pub update_mask: std::option::Option<wkt::FieldMask>,
8085
8086 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
8087}
8088
8089impl UpdateRestoreRequest {
8090 pub fn new() -> Self {
8091 std::default::Default::default()
8092 }
8093
8094 /// Sets the value of [restore][crate::model::UpdateRestoreRequest::restore].
8095 ///
8096 /// # Example
8097 /// ```ignore,no_run
8098 /// # use google_cloud_gkebackup_v1::model::UpdateRestoreRequest;
8099 /// use google_cloud_gkebackup_v1::model::Restore;
8100 /// let x = UpdateRestoreRequest::new().set_restore(Restore::default()/* use setters */);
8101 /// ```
8102 pub fn set_restore<T>(mut self, v: T) -> Self
8103 where
8104 T: std::convert::Into<crate::model::Restore>,
8105 {
8106 self.restore = std::option::Option::Some(v.into());
8107 self
8108 }
8109
8110 /// Sets or clears the value of [restore][crate::model::UpdateRestoreRequest::restore].
8111 ///
8112 /// # Example
8113 /// ```ignore,no_run
8114 /// # use google_cloud_gkebackup_v1::model::UpdateRestoreRequest;
8115 /// use google_cloud_gkebackup_v1::model::Restore;
8116 /// let x = UpdateRestoreRequest::new().set_or_clear_restore(Some(Restore::default()/* use setters */));
8117 /// let x = UpdateRestoreRequest::new().set_or_clear_restore(None::<Restore>);
8118 /// ```
8119 pub fn set_or_clear_restore<T>(mut self, v: std::option::Option<T>) -> Self
8120 where
8121 T: std::convert::Into<crate::model::Restore>,
8122 {
8123 self.restore = v.map(|x| x.into());
8124 self
8125 }
8126
8127 /// Sets the value of [update_mask][crate::model::UpdateRestoreRequest::update_mask].
8128 ///
8129 /// # Example
8130 /// ```ignore,no_run
8131 /// # use google_cloud_gkebackup_v1::model::UpdateRestoreRequest;
8132 /// use wkt::FieldMask;
8133 /// let x = UpdateRestoreRequest::new().set_update_mask(FieldMask::default()/* use setters */);
8134 /// ```
8135 pub fn set_update_mask<T>(mut self, v: T) -> Self
8136 where
8137 T: std::convert::Into<wkt::FieldMask>,
8138 {
8139 self.update_mask = std::option::Option::Some(v.into());
8140 self
8141 }
8142
8143 /// Sets or clears the value of [update_mask][crate::model::UpdateRestoreRequest::update_mask].
8144 ///
8145 /// # Example
8146 /// ```ignore,no_run
8147 /// # use google_cloud_gkebackup_v1::model::UpdateRestoreRequest;
8148 /// use wkt::FieldMask;
8149 /// let x = UpdateRestoreRequest::new().set_or_clear_update_mask(Some(FieldMask::default()/* use setters */));
8150 /// let x = UpdateRestoreRequest::new().set_or_clear_update_mask(None::<FieldMask>);
8151 /// ```
8152 pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
8153 where
8154 T: std::convert::Into<wkt::FieldMask>,
8155 {
8156 self.update_mask = v.map(|x| x.into());
8157 self
8158 }
8159}
8160
8161impl wkt::message::Message for UpdateRestoreRequest {
8162 fn typename() -> &'static str {
8163 "type.googleapis.com/google.cloud.gkebackup.v1.UpdateRestoreRequest"
8164 }
8165}
8166
8167/// Request message for DeleteRestore.
8168#[derive(Clone, Default, PartialEq)]
8169#[non_exhaustive]
8170pub struct DeleteRestoreRequest {
8171 /// Required. Full name of the Restore
8172 /// Format: `projects/*/locations/*/restorePlans/*/restores/*`
8173 pub name: std::string::String,
8174
8175 /// Optional. If provided, this value must match the current value of the
8176 /// target Restore's [etag][google.cloud.gkebackup.v1.Restore.etag] field or
8177 /// the request is rejected.
8178 ///
8179 /// [google.cloud.gkebackup.v1.Restore.etag]: crate::model::Restore::etag
8180 pub etag: std::string::String,
8181
8182 /// Optional. If set to true, any VolumeRestores below this restore will also
8183 /// be deleted. Otherwise, the request will only succeed if the restore has no
8184 /// VolumeRestores.
8185 pub force: bool,
8186
8187 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
8188}
8189
8190impl DeleteRestoreRequest {
8191 pub fn new() -> Self {
8192 std::default::Default::default()
8193 }
8194
8195 /// Sets the value of [name][crate::model::DeleteRestoreRequest::name].
8196 ///
8197 /// # Example
8198 /// ```ignore,no_run
8199 /// # use google_cloud_gkebackup_v1::model::DeleteRestoreRequest;
8200 /// let x = DeleteRestoreRequest::new().set_name("example");
8201 /// ```
8202 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
8203 self.name = v.into();
8204 self
8205 }
8206
8207 /// Sets the value of [etag][crate::model::DeleteRestoreRequest::etag].
8208 ///
8209 /// # Example
8210 /// ```ignore,no_run
8211 /// # use google_cloud_gkebackup_v1::model::DeleteRestoreRequest;
8212 /// let x = DeleteRestoreRequest::new().set_etag("example");
8213 /// ```
8214 pub fn set_etag<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
8215 self.etag = v.into();
8216 self
8217 }
8218
8219 /// Sets the value of [force][crate::model::DeleteRestoreRequest::force].
8220 ///
8221 /// # Example
8222 /// ```ignore,no_run
8223 /// # use google_cloud_gkebackup_v1::model::DeleteRestoreRequest;
8224 /// let x = DeleteRestoreRequest::new().set_force(true);
8225 /// ```
8226 pub fn set_force<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
8227 self.force = v.into();
8228 self
8229 }
8230}
8231
8232impl wkt::message::Message for DeleteRestoreRequest {
8233 fn typename() -> &'static str {
8234 "type.googleapis.com/google.cloud.gkebackup.v1.DeleteRestoreRequest"
8235 }
8236}
8237
8238/// Request message for ListVolumeRestores.
8239#[derive(Clone, Default, PartialEq)]
8240#[non_exhaustive]
8241pub struct ListVolumeRestoresRequest {
8242 /// Required. The Restore that contains the VolumeRestores to list.
8243 /// Format: `projects/*/locations/*/restorePlans/*/restores/*`
8244 pub parent: std::string::String,
8245
8246 /// Optional. The target number of results to return in a single response.
8247 /// If not specified, a default value will be chosen by the service.
8248 /// Note that the response may include a partial list and a caller should
8249 /// only rely on the response's
8250 /// [next_page_token][google.cloud.gkebackup.v1.ListVolumeRestoresResponse.next_page_token]
8251 /// to determine if there are more instances left to be queried.
8252 ///
8253 /// [google.cloud.gkebackup.v1.ListVolumeRestoresResponse.next_page_token]: crate::model::ListVolumeRestoresResponse::next_page_token
8254 pub page_size: i32,
8255
8256 /// Optional. The value of
8257 /// [next_page_token][google.cloud.gkebackup.v1.ListVolumeRestoresResponse.next_page_token]
8258 /// received from a previous `ListVolumeRestores` call.
8259 /// Provide this to retrieve the subsequent page in a multi-page list of
8260 /// results. When paginating, all other parameters provided to
8261 /// `ListVolumeRestores` must match the call that provided the page token.
8262 ///
8263 /// [google.cloud.gkebackup.v1.ListVolumeRestoresResponse.next_page_token]: crate::model::ListVolumeRestoresResponse::next_page_token
8264 pub page_token: std::string::String,
8265
8266 /// Optional. Field match expression used to filter the results.
8267 pub filter: std::string::String,
8268
8269 /// Optional. Field by which to sort the results.
8270 pub order_by: std::string::String,
8271
8272 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
8273}
8274
8275impl ListVolumeRestoresRequest {
8276 pub fn new() -> Self {
8277 std::default::Default::default()
8278 }
8279
8280 /// Sets the value of [parent][crate::model::ListVolumeRestoresRequest::parent].
8281 ///
8282 /// # Example
8283 /// ```ignore,no_run
8284 /// # use google_cloud_gkebackup_v1::model::ListVolumeRestoresRequest;
8285 /// let x = ListVolumeRestoresRequest::new().set_parent("example");
8286 /// ```
8287 pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
8288 self.parent = v.into();
8289 self
8290 }
8291
8292 /// Sets the value of [page_size][crate::model::ListVolumeRestoresRequest::page_size].
8293 ///
8294 /// # Example
8295 /// ```ignore,no_run
8296 /// # use google_cloud_gkebackup_v1::model::ListVolumeRestoresRequest;
8297 /// let x = ListVolumeRestoresRequest::new().set_page_size(42);
8298 /// ```
8299 pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
8300 self.page_size = v.into();
8301 self
8302 }
8303
8304 /// Sets the value of [page_token][crate::model::ListVolumeRestoresRequest::page_token].
8305 ///
8306 /// # Example
8307 /// ```ignore,no_run
8308 /// # use google_cloud_gkebackup_v1::model::ListVolumeRestoresRequest;
8309 /// let x = ListVolumeRestoresRequest::new().set_page_token("example");
8310 /// ```
8311 pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
8312 self.page_token = v.into();
8313 self
8314 }
8315
8316 /// Sets the value of [filter][crate::model::ListVolumeRestoresRequest::filter].
8317 ///
8318 /// # Example
8319 /// ```ignore,no_run
8320 /// # use google_cloud_gkebackup_v1::model::ListVolumeRestoresRequest;
8321 /// let x = ListVolumeRestoresRequest::new().set_filter("example");
8322 /// ```
8323 pub fn set_filter<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
8324 self.filter = v.into();
8325 self
8326 }
8327
8328 /// Sets the value of [order_by][crate::model::ListVolumeRestoresRequest::order_by].
8329 ///
8330 /// # Example
8331 /// ```ignore,no_run
8332 /// # use google_cloud_gkebackup_v1::model::ListVolumeRestoresRequest;
8333 /// let x = ListVolumeRestoresRequest::new().set_order_by("example");
8334 /// ```
8335 pub fn set_order_by<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
8336 self.order_by = v.into();
8337 self
8338 }
8339}
8340
8341impl wkt::message::Message for ListVolumeRestoresRequest {
8342 fn typename() -> &'static str {
8343 "type.googleapis.com/google.cloud.gkebackup.v1.ListVolumeRestoresRequest"
8344 }
8345}
8346
8347/// Response message for ListVolumeRestores.
8348#[derive(Clone, Default, PartialEq)]
8349#[non_exhaustive]
8350pub struct ListVolumeRestoresResponse {
8351 /// The list of VolumeRestores matching the given criteria.
8352 pub volume_restores: std::vec::Vec<crate::model::VolumeRestore>,
8353
8354 /// A token which may be sent as
8355 /// [page_token][google.cloud.gkebackup.v1.ListVolumeRestoresRequest.page_token]
8356 /// in a subsequent `ListVolumeRestores` call to retrieve the next page of
8357 /// results. If this field is omitted or empty, then there are no more results
8358 /// to return.
8359 ///
8360 /// [google.cloud.gkebackup.v1.ListVolumeRestoresRequest.page_token]: crate::model::ListVolumeRestoresRequest::page_token
8361 pub next_page_token: std::string::String,
8362
8363 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
8364}
8365
8366impl ListVolumeRestoresResponse {
8367 pub fn new() -> Self {
8368 std::default::Default::default()
8369 }
8370
8371 /// Sets the value of [volume_restores][crate::model::ListVolumeRestoresResponse::volume_restores].
8372 ///
8373 /// # Example
8374 /// ```ignore,no_run
8375 /// # use google_cloud_gkebackup_v1::model::ListVolumeRestoresResponse;
8376 /// use google_cloud_gkebackup_v1::model::VolumeRestore;
8377 /// let x = ListVolumeRestoresResponse::new()
8378 /// .set_volume_restores([
8379 /// VolumeRestore::default()/* use setters */,
8380 /// VolumeRestore::default()/* use (different) setters */,
8381 /// ]);
8382 /// ```
8383 pub fn set_volume_restores<T, V>(mut self, v: T) -> Self
8384 where
8385 T: std::iter::IntoIterator<Item = V>,
8386 V: std::convert::Into<crate::model::VolumeRestore>,
8387 {
8388 use std::iter::Iterator;
8389 self.volume_restores = v.into_iter().map(|i| i.into()).collect();
8390 self
8391 }
8392
8393 /// Sets the value of [next_page_token][crate::model::ListVolumeRestoresResponse::next_page_token].
8394 ///
8395 /// # Example
8396 /// ```ignore,no_run
8397 /// # use google_cloud_gkebackup_v1::model::ListVolumeRestoresResponse;
8398 /// let x = ListVolumeRestoresResponse::new().set_next_page_token("example");
8399 /// ```
8400 pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
8401 self.next_page_token = v.into();
8402 self
8403 }
8404}
8405
8406impl wkt::message::Message for ListVolumeRestoresResponse {
8407 fn typename() -> &'static str {
8408 "type.googleapis.com/google.cloud.gkebackup.v1.ListVolumeRestoresResponse"
8409 }
8410}
8411
8412#[doc(hidden)]
8413impl google_cloud_gax::paginator::internal::PageableResponse for ListVolumeRestoresResponse {
8414 type PageItem = crate::model::VolumeRestore;
8415
8416 fn items(self) -> std::vec::Vec<Self::PageItem> {
8417 self.volume_restores
8418 }
8419
8420 fn next_page_token(&self) -> std::string::String {
8421 use std::clone::Clone;
8422 self.next_page_token.clone()
8423 }
8424}
8425
8426/// Request message for GetVolumeRestore.
8427#[derive(Clone, Default, PartialEq)]
8428#[non_exhaustive]
8429pub struct GetVolumeRestoreRequest {
8430 /// Required. Full name of the VolumeRestore resource.
8431 /// Format: `projects/*/locations/*/restorePlans/*/restores/*/volumeRestores/*`
8432 pub name: std::string::String,
8433
8434 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
8435}
8436
8437impl GetVolumeRestoreRequest {
8438 pub fn new() -> Self {
8439 std::default::Default::default()
8440 }
8441
8442 /// Sets the value of [name][crate::model::GetVolumeRestoreRequest::name].
8443 ///
8444 /// # Example
8445 /// ```ignore,no_run
8446 /// # use google_cloud_gkebackup_v1::model::GetVolumeRestoreRequest;
8447 /// let x = GetVolumeRestoreRequest::new().set_name("example");
8448 /// ```
8449 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
8450 self.name = v.into();
8451 self
8452 }
8453}
8454
8455impl wkt::message::Message for GetVolumeRestoreRequest {
8456 fn typename() -> &'static str {
8457 "type.googleapis.com/google.cloud.gkebackup.v1.GetVolumeRestoreRequest"
8458 }
8459}
8460
8461/// Request message for GetBackupIndexDownloadUrl.
8462#[derive(Clone, Default, PartialEq)]
8463#[non_exhaustive]
8464pub struct GetBackupIndexDownloadUrlRequest {
8465 /// Required. Full name of Backup resource.
8466 /// Format:
8467 /// projects/{project}/locations/{location}/backupPlans/{backup_plan}/backups/{backup}
8468 pub backup: std::string::String,
8469
8470 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
8471}
8472
8473impl GetBackupIndexDownloadUrlRequest {
8474 pub fn new() -> Self {
8475 std::default::Default::default()
8476 }
8477
8478 /// Sets the value of [backup][crate::model::GetBackupIndexDownloadUrlRequest::backup].
8479 ///
8480 /// # Example
8481 /// ```ignore,no_run
8482 /// # use google_cloud_gkebackup_v1::model::GetBackupIndexDownloadUrlRequest;
8483 /// let x = GetBackupIndexDownloadUrlRequest::new().set_backup("example");
8484 /// ```
8485 pub fn set_backup<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
8486 self.backup = v.into();
8487 self
8488 }
8489}
8490
8491impl wkt::message::Message for GetBackupIndexDownloadUrlRequest {
8492 fn typename() -> &'static str {
8493 "type.googleapis.com/google.cloud.gkebackup.v1.GetBackupIndexDownloadUrlRequest"
8494 }
8495}
8496
8497/// Response message for GetBackupIndexDownloadUrl.
8498#[derive(Clone, Default, PartialEq)]
8499#[non_exhaustive]
8500pub struct GetBackupIndexDownloadUrlResponse {
8501 /// Required. The signed URL for downloading the backup index.
8502 pub signed_url: std::string::String,
8503
8504 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
8505}
8506
8507impl GetBackupIndexDownloadUrlResponse {
8508 pub fn new() -> Self {
8509 std::default::Default::default()
8510 }
8511
8512 /// Sets the value of [signed_url][crate::model::GetBackupIndexDownloadUrlResponse::signed_url].
8513 ///
8514 /// # Example
8515 /// ```ignore,no_run
8516 /// # use google_cloud_gkebackup_v1::model::GetBackupIndexDownloadUrlResponse;
8517 /// let x = GetBackupIndexDownloadUrlResponse::new().set_signed_url("example");
8518 /// ```
8519 pub fn set_signed_url<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
8520 self.signed_url = v.into();
8521 self
8522 }
8523}
8524
8525impl wkt::message::Message for GetBackupIndexDownloadUrlResponse {
8526 fn typename() -> &'static str {
8527 "type.googleapis.com/google.cloud.gkebackup.v1.GetBackupIndexDownloadUrlResponse"
8528 }
8529}
8530
8531/// Represents both a request to Restore some portion of a Backup into
8532/// a target GKE cluster and a record of the restore operation itself.
8533#[derive(Clone, Default, PartialEq)]
8534#[non_exhaustive]
8535pub struct Restore {
8536 /// Output only. The full name of the Restore resource.
8537 /// Format: `projects/*/locations/*/restorePlans/*/restores/*`
8538 pub name: std::string::String,
8539
8540 /// Output only. Server generated global unique identifier of
8541 /// [UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier) format.
8542 pub uid: std::string::String,
8543
8544 /// Output only. The timestamp when this Restore resource was created.
8545 pub create_time: std::option::Option<wkt::Timestamp>,
8546
8547 /// Output only. The timestamp when this Restore resource was last
8548 /// updated.
8549 pub update_time: std::option::Option<wkt::Timestamp>,
8550
8551 /// Optional. User specified descriptive string for this Restore.
8552 pub description: std::string::String,
8553
8554 /// Required. Immutable. A reference to the
8555 /// [Backup][google.cloud.gkebackup.v1.Backup] used as the source from which
8556 /// this Restore will restore. Note that this Backup must be a sub-resource of
8557 /// the RestorePlan's
8558 /// [backup_plan][google.cloud.gkebackup.v1.RestorePlan.backup_plan]. Format:
8559 /// `projects/*/locations/*/backupPlans/*/backups/*`.
8560 ///
8561 /// [google.cloud.gkebackup.v1.Backup]: crate::model::Backup
8562 /// [google.cloud.gkebackup.v1.RestorePlan.backup_plan]: crate::model::RestorePlan::backup_plan
8563 pub backup: std::string::String,
8564
8565 /// Output only. The target cluster into which this Restore will restore data.
8566 /// Valid formats:
8567 ///
8568 /// - `projects/*/locations/*/clusters/*`
8569 /// - `projects/*/zones/*/clusters/*`
8570 ///
8571 /// Inherited from parent RestorePlan's
8572 /// [cluster][google.cloud.gkebackup.v1.RestorePlan.cluster] value.
8573 ///
8574 /// [google.cloud.gkebackup.v1.RestorePlan.cluster]: crate::model::RestorePlan::cluster
8575 pub cluster: std::string::String,
8576
8577 /// Output only. Configuration of the Restore. Inherited from parent
8578 /// RestorePlan's
8579 /// [restore_config][google.cloud.gkebackup.v1.RestorePlan.restore_config].
8580 ///
8581 /// [google.cloud.gkebackup.v1.RestorePlan.restore_config]: crate::model::RestorePlan::restore_config
8582 pub restore_config: std::option::Option<crate::model::RestoreConfig>,
8583
8584 /// A set of custom labels supplied by user.
8585 pub labels: std::collections::HashMap<std::string::String, std::string::String>,
8586
8587 /// Output only. The current state of the Restore.
8588 pub state: crate::model::restore::State,
8589
8590 /// Output only. Human-readable description of why the Restore is in its
8591 /// current state. This field is only meant for human readability and should
8592 /// not be used programmatically as this field is not guaranteed to be
8593 /// consistent.
8594 pub state_reason: std::string::String,
8595
8596 /// Output only. Timestamp of when the restore operation completed.
8597 pub complete_time: std::option::Option<wkt::Timestamp>,
8598
8599 /// Output only. Number of resources restored during the restore execution.
8600 pub resources_restored_count: i32,
8601
8602 /// Output only. Number of resources excluded during the restore execution.
8603 pub resources_excluded_count: i32,
8604
8605 /// Output only. Number of resources that failed to be restored during the
8606 /// restore execution.
8607 pub resources_failed_count: i32,
8608
8609 /// Output only. Number of volumes restored during the restore execution.
8610 pub volumes_restored_count: i32,
8611
8612 /// Output only. `etag` is used for optimistic concurrency control as a way to
8613 /// help prevent simultaneous updates of a restore from overwriting each other.
8614 /// It is strongly suggested that systems make use of the `etag` in the
8615 /// read-modify-write cycle to perform restore updates in order to avoid
8616 /// race conditions: An `etag` is returned in the response to `GetRestore`,
8617 /// and systems are expected to put that etag in the request to
8618 /// `UpdateRestore` or `DeleteRestore` to ensure that their change will be
8619 /// applied to the same version of the resource.
8620 pub etag: std::string::String,
8621
8622 /// Optional. Immutable. Filters resources for `Restore`. If not specified, the
8623 /// scope of the restore will remain the same as defined in the `RestorePlan`.
8624 /// If this is specified and no resources are matched by the
8625 /// `inclusion_filters` or everything is excluded by the `exclusion_filters`,
8626 /// nothing will be restored. This filter can only be specified if the value of
8627 /// [namespaced_resource_restore_mode][google.cloud.gkebackup.v1.RestoreConfig.namespaced_resource_restore_mode]
8628 /// is set to `MERGE_SKIP_ON_CONFLICT`, `MERGE_REPLACE_VOLUME_ON_CONFLICT` or
8629 /// `MERGE_REPLACE_ON_CONFLICT`.
8630 ///
8631 /// [google.cloud.gkebackup.v1.RestoreConfig.namespaced_resource_restore_mode]: crate::model::RestoreConfig::namespaced_resource_restore_mode
8632 pub filter: std::option::Option<crate::model::restore::Filter>,
8633
8634 /// Optional. Immutable. Overrides the volume data restore policies selected in
8635 /// the Restore Config for override-scoped resources.
8636 pub volume_data_restore_policy_overrides:
8637 std::vec::Vec<crate::model::VolumeDataRestorePolicyOverride>,
8638
8639 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
8640}
8641
8642impl Restore {
8643 pub fn new() -> Self {
8644 std::default::Default::default()
8645 }
8646
8647 /// Sets the value of [name][crate::model::Restore::name].
8648 ///
8649 /// # Example
8650 /// ```ignore,no_run
8651 /// # use google_cloud_gkebackup_v1::model::Restore;
8652 /// let x = Restore::new().set_name("example");
8653 /// ```
8654 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
8655 self.name = v.into();
8656 self
8657 }
8658
8659 /// Sets the value of [uid][crate::model::Restore::uid].
8660 ///
8661 /// # Example
8662 /// ```ignore,no_run
8663 /// # use google_cloud_gkebackup_v1::model::Restore;
8664 /// let x = Restore::new().set_uid("example");
8665 /// ```
8666 pub fn set_uid<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
8667 self.uid = v.into();
8668 self
8669 }
8670
8671 /// Sets the value of [create_time][crate::model::Restore::create_time].
8672 ///
8673 /// # Example
8674 /// ```ignore,no_run
8675 /// # use google_cloud_gkebackup_v1::model::Restore;
8676 /// use wkt::Timestamp;
8677 /// let x = Restore::new().set_create_time(Timestamp::default()/* use setters */);
8678 /// ```
8679 pub fn set_create_time<T>(mut self, v: T) -> Self
8680 where
8681 T: std::convert::Into<wkt::Timestamp>,
8682 {
8683 self.create_time = std::option::Option::Some(v.into());
8684 self
8685 }
8686
8687 /// Sets or clears the value of [create_time][crate::model::Restore::create_time].
8688 ///
8689 /// # Example
8690 /// ```ignore,no_run
8691 /// # use google_cloud_gkebackup_v1::model::Restore;
8692 /// use wkt::Timestamp;
8693 /// let x = Restore::new().set_or_clear_create_time(Some(Timestamp::default()/* use setters */));
8694 /// let x = Restore::new().set_or_clear_create_time(None::<Timestamp>);
8695 /// ```
8696 pub fn set_or_clear_create_time<T>(mut self, v: std::option::Option<T>) -> Self
8697 where
8698 T: std::convert::Into<wkt::Timestamp>,
8699 {
8700 self.create_time = v.map(|x| x.into());
8701 self
8702 }
8703
8704 /// Sets the value of [update_time][crate::model::Restore::update_time].
8705 ///
8706 /// # Example
8707 /// ```ignore,no_run
8708 /// # use google_cloud_gkebackup_v1::model::Restore;
8709 /// use wkt::Timestamp;
8710 /// let x = Restore::new().set_update_time(Timestamp::default()/* use setters */);
8711 /// ```
8712 pub fn set_update_time<T>(mut self, v: T) -> Self
8713 where
8714 T: std::convert::Into<wkt::Timestamp>,
8715 {
8716 self.update_time = std::option::Option::Some(v.into());
8717 self
8718 }
8719
8720 /// Sets or clears the value of [update_time][crate::model::Restore::update_time].
8721 ///
8722 /// # Example
8723 /// ```ignore,no_run
8724 /// # use google_cloud_gkebackup_v1::model::Restore;
8725 /// use wkt::Timestamp;
8726 /// let x = Restore::new().set_or_clear_update_time(Some(Timestamp::default()/* use setters */));
8727 /// let x = Restore::new().set_or_clear_update_time(None::<Timestamp>);
8728 /// ```
8729 pub fn set_or_clear_update_time<T>(mut self, v: std::option::Option<T>) -> Self
8730 where
8731 T: std::convert::Into<wkt::Timestamp>,
8732 {
8733 self.update_time = v.map(|x| x.into());
8734 self
8735 }
8736
8737 /// Sets the value of [description][crate::model::Restore::description].
8738 ///
8739 /// # Example
8740 /// ```ignore,no_run
8741 /// # use google_cloud_gkebackup_v1::model::Restore;
8742 /// let x = Restore::new().set_description("example");
8743 /// ```
8744 pub fn set_description<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
8745 self.description = v.into();
8746 self
8747 }
8748
8749 /// Sets the value of [backup][crate::model::Restore::backup].
8750 ///
8751 /// # Example
8752 /// ```ignore,no_run
8753 /// # use google_cloud_gkebackup_v1::model::Restore;
8754 /// let x = Restore::new().set_backup("example");
8755 /// ```
8756 pub fn set_backup<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
8757 self.backup = v.into();
8758 self
8759 }
8760
8761 /// Sets the value of [cluster][crate::model::Restore::cluster].
8762 ///
8763 /// # Example
8764 /// ```ignore,no_run
8765 /// # use google_cloud_gkebackup_v1::model::Restore;
8766 /// let x = Restore::new().set_cluster("example");
8767 /// ```
8768 pub fn set_cluster<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
8769 self.cluster = v.into();
8770 self
8771 }
8772
8773 /// Sets the value of [restore_config][crate::model::Restore::restore_config].
8774 ///
8775 /// # Example
8776 /// ```ignore,no_run
8777 /// # use google_cloud_gkebackup_v1::model::Restore;
8778 /// use google_cloud_gkebackup_v1::model::RestoreConfig;
8779 /// let x = Restore::new().set_restore_config(RestoreConfig::default()/* use setters */);
8780 /// ```
8781 pub fn set_restore_config<T>(mut self, v: T) -> Self
8782 where
8783 T: std::convert::Into<crate::model::RestoreConfig>,
8784 {
8785 self.restore_config = std::option::Option::Some(v.into());
8786 self
8787 }
8788
8789 /// Sets or clears the value of [restore_config][crate::model::Restore::restore_config].
8790 ///
8791 /// # Example
8792 /// ```ignore,no_run
8793 /// # use google_cloud_gkebackup_v1::model::Restore;
8794 /// use google_cloud_gkebackup_v1::model::RestoreConfig;
8795 /// let x = Restore::new().set_or_clear_restore_config(Some(RestoreConfig::default()/* use setters */));
8796 /// let x = Restore::new().set_or_clear_restore_config(None::<RestoreConfig>);
8797 /// ```
8798 pub fn set_or_clear_restore_config<T>(mut self, v: std::option::Option<T>) -> Self
8799 where
8800 T: std::convert::Into<crate::model::RestoreConfig>,
8801 {
8802 self.restore_config = v.map(|x| x.into());
8803 self
8804 }
8805
8806 /// Sets the value of [labels][crate::model::Restore::labels].
8807 ///
8808 /// # Example
8809 /// ```ignore,no_run
8810 /// # use google_cloud_gkebackup_v1::model::Restore;
8811 /// let x = Restore::new().set_labels([
8812 /// ("key0", "abc"),
8813 /// ("key1", "xyz"),
8814 /// ]);
8815 /// ```
8816 pub fn set_labels<T, K, V>(mut self, v: T) -> Self
8817 where
8818 T: std::iter::IntoIterator<Item = (K, V)>,
8819 K: std::convert::Into<std::string::String>,
8820 V: std::convert::Into<std::string::String>,
8821 {
8822 use std::iter::Iterator;
8823 self.labels = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
8824 self
8825 }
8826
8827 /// Sets the value of [state][crate::model::Restore::state].
8828 ///
8829 /// # Example
8830 /// ```ignore,no_run
8831 /// # use google_cloud_gkebackup_v1::model::Restore;
8832 /// use google_cloud_gkebackup_v1::model::restore::State;
8833 /// let x0 = Restore::new().set_state(State::Creating);
8834 /// let x1 = Restore::new().set_state(State::InProgress);
8835 /// let x2 = Restore::new().set_state(State::Succeeded);
8836 /// ```
8837 pub fn set_state<T: std::convert::Into<crate::model::restore::State>>(mut self, v: T) -> Self {
8838 self.state = v.into();
8839 self
8840 }
8841
8842 /// Sets the value of [state_reason][crate::model::Restore::state_reason].
8843 ///
8844 /// # Example
8845 /// ```ignore,no_run
8846 /// # use google_cloud_gkebackup_v1::model::Restore;
8847 /// let x = Restore::new().set_state_reason("example");
8848 /// ```
8849 pub fn set_state_reason<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
8850 self.state_reason = v.into();
8851 self
8852 }
8853
8854 /// Sets the value of [complete_time][crate::model::Restore::complete_time].
8855 ///
8856 /// # Example
8857 /// ```ignore,no_run
8858 /// # use google_cloud_gkebackup_v1::model::Restore;
8859 /// use wkt::Timestamp;
8860 /// let x = Restore::new().set_complete_time(Timestamp::default()/* use setters */);
8861 /// ```
8862 pub fn set_complete_time<T>(mut self, v: T) -> Self
8863 where
8864 T: std::convert::Into<wkt::Timestamp>,
8865 {
8866 self.complete_time = std::option::Option::Some(v.into());
8867 self
8868 }
8869
8870 /// Sets or clears the value of [complete_time][crate::model::Restore::complete_time].
8871 ///
8872 /// # Example
8873 /// ```ignore,no_run
8874 /// # use google_cloud_gkebackup_v1::model::Restore;
8875 /// use wkt::Timestamp;
8876 /// let x = Restore::new().set_or_clear_complete_time(Some(Timestamp::default()/* use setters */));
8877 /// let x = Restore::new().set_or_clear_complete_time(None::<Timestamp>);
8878 /// ```
8879 pub fn set_or_clear_complete_time<T>(mut self, v: std::option::Option<T>) -> Self
8880 where
8881 T: std::convert::Into<wkt::Timestamp>,
8882 {
8883 self.complete_time = v.map(|x| x.into());
8884 self
8885 }
8886
8887 /// Sets the value of [resources_restored_count][crate::model::Restore::resources_restored_count].
8888 ///
8889 /// # Example
8890 /// ```ignore,no_run
8891 /// # use google_cloud_gkebackup_v1::model::Restore;
8892 /// let x = Restore::new().set_resources_restored_count(42);
8893 /// ```
8894 pub fn set_resources_restored_count<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
8895 self.resources_restored_count = v.into();
8896 self
8897 }
8898
8899 /// Sets the value of [resources_excluded_count][crate::model::Restore::resources_excluded_count].
8900 ///
8901 /// # Example
8902 /// ```ignore,no_run
8903 /// # use google_cloud_gkebackup_v1::model::Restore;
8904 /// let x = Restore::new().set_resources_excluded_count(42);
8905 /// ```
8906 pub fn set_resources_excluded_count<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
8907 self.resources_excluded_count = v.into();
8908 self
8909 }
8910
8911 /// Sets the value of [resources_failed_count][crate::model::Restore::resources_failed_count].
8912 ///
8913 /// # Example
8914 /// ```ignore,no_run
8915 /// # use google_cloud_gkebackup_v1::model::Restore;
8916 /// let x = Restore::new().set_resources_failed_count(42);
8917 /// ```
8918 pub fn set_resources_failed_count<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
8919 self.resources_failed_count = v.into();
8920 self
8921 }
8922
8923 /// Sets the value of [volumes_restored_count][crate::model::Restore::volumes_restored_count].
8924 ///
8925 /// # Example
8926 /// ```ignore,no_run
8927 /// # use google_cloud_gkebackup_v1::model::Restore;
8928 /// let x = Restore::new().set_volumes_restored_count(42);
8929 /// ```
8930 pub fn set_volumes_restored_count<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
8931 self.volumes_restored_count = v.into();
8932 self
8933 }
8934
8935 /// Sets the value of [etag][crate::model::Restore::etag].
8936 ///
8937 /// # Example
8938 /// ```ignore,no_run
8939 /// # use google_cloud_gkebackup_v1::model::Restore;
8940 /// let x = Restore::new().set_etag("example");
8941 /// ```
8942 pub fn set_etag<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
8943 self.etag = v.into();
8944 self
8945 }
8946
8947 /// Sets the value of [filter][crate::model::Restore::filter].
8948 ///
8949 /// # Example
8950 /// ```ignore,no_run
8951 /// # use google_cloud_gkebackup_v1::model::Restore;
8952 /// use google_cloud_gkebackup_v1::model::restore::Filter;
8953 /// let x = Restore::new().set_filter(Filter::default()/* use setters */);
8954 /// ```
8955 pub fn set_filter<T>(mut self, v: T) -> Self
8956 where
8957 T: std::convert::Into<crate::model::restore::Filter>,
8958 {
8959 self.filter = std::option::Option::Some(v.into());
8960 self
8961 }
8962
8963 /// Sets or clears the value of [filter][crate::model::Restore::filter].
8964 ///
8965 /// # Example
8966 /// ```ignore,no_run
8967 /// # use google_cloud_gkebackup_v1::model::Restore;
8968 /// use google_cloud_gkebackup_v1::model::restore::Filter;
8969 /// let x = Restore::new().set_or_clear_filter(Some(Filter::default()/* use setters */));
8970 /// let x = Restore::new().set_or_clear_filter(None::<Filter>);
8971 /// ```
8972 pub fn set_or_clear_filter<T>(mut self, v: std::option::Option<T>) -> Self
8973 where
8974 T: std::convert::Into<crate::model::restore::Filter>,
8975 {
8976 self.filter = v.map(|x| x.into());
8977 self
8978 }
8979
8980 /// Sets the value of [volume_data_restore_policy_overrides][crate::model::Restore::volume_data_restore_policy_overrides].
8981 ///
8982 /// # Example
8983 /// ```ignore,no_run
8984 /// # use google_cloud_gkebackup_v1::model::Restore;
8985 /// use google_cloud_gkebackup_v1::model::VolumeDataRestorePolicyOverride;
8986 /// let x = Restore::new()
8987 /// .set_volume_data_restore_policy_overrides([
8988 /// VolumeDataRestorePolicyOverride::default()/* use setters */,
8989 /// VolumeDataRestorePolicyOverride::default()/* use (different) setters */,
8990 /// ]);
8991 /// ```
8992 pub fn set_volume_data_restore_policy_overrides<T, V>(mut self, v: T) -> Self
8993 where
8994 T: std::iter::IntoIterator<Item = V>,
8995 V: std::convert::Into<crate::model::VolumeDataRestorePolicyOverride>,
8996 {
8997 use std::iter::Iterator;
8998 self.volume_data_restore_policy_overrides = v.into_iter().map(|i| i.into()).collect();
8999 self
9000 }
9001}
9002
9003impl wkt::message::Message for Restore {
9004 fn typename() -> &'static str {
9005 "type.googleapis.com/google.cloud.gkebackup.v1.Restore"
9006 }
9007}
9008
9009/// Defines additional types related to [Restore].
9010pub mod restore {
9011 #[allow(unused_imports)]
9012 use super::*;
9013
9014 /// Defines the filter for `Restore`. This filter can be used to further
9015 /// refine the resource selection of the `Restore` beyond the coarse-grained
9016 /// scope defined in the `RestorePlan`. `exclusion_filters` take precedence
9017 /// over `inclusion_filters`. If a resource matches both `inclusion_filters`
9018 /// and `exclusion_filters`, it will not be restored.
9019 #[derive(Clone, Default, PartialEq)]
9020 #[non_exhaustive]
9021 pub struct Filter {
9022 /// Optional. Selects resources for restoration. If specified, only resources
9023 /// which match `inclusion_filters` will be selected for restoration. A
9024 /// resource will be selected if it matches any `ResourceSelector` of the
9025 /// `inclusion_filters`.
9026 pub inclusion_filters: std::vec::Vec<crate::model::ResourceSelector>,
9027
9028 /// Optional. Excludes resources from restoration. If specified,
9029 /// a resource will not be restored if it matches
9030 /// any `ResourceSelector` of the `exclusion_filters`.
9031 pub exclusion_filters: std::vec::Vec<crate::model::ResourceSelector>,
9032
9033 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
9034 }
9035
9036 impl Filter {
9037 pub fn new() -> Self {
9038 std::default::Default::default()
9039 }
9040
9041 /// Sets the value of [inclusion_filters][crate::model::restore::Filter::inclusion_filters].
9042 ///
9043 /// # Example
9044 /// ```ignore,no_run
9045 /// # use google_cloud_gkebackup_v1::model::restore::Filter;
9046 /// use google_cloud_gkebackup_v1::model::ResourceSelector;
9047 /// let x = Filter::new()
9048 /// .set_inclusion_filters([
9049 /// ResourceSelector::default()/* use setters */,
9050 /// ResourceSelector::default()/* use (different) setters */,
9051 /// ]);
9052 /// ```
9053 pub fn set_inclusion_filters<T, V>(mut self, v: T) -> Self
9054 where
9055 T: std::iter::IntoIterator<Item = V>,
9056 V: std::convert::Into<crate::model::ResourceSelector>,
9057 {
9058 use std::iter::Iterator;
9059 self.inclusion_filters = v.into_iter().map(|i| i.into()).collect();
9060 self
9061 }
9062
9063 /// Sets the value of [exclusion_filters][crate::model::restore::Filter::exclusion_filters].
9064 ///
9065 /// # Example
9066 /// ```ignore,no_run
9067 /// # use google_cloud_gkebackup_v1::model::restore::Filter;
9068 /// use google_cloud_gkebackup_v1::model::ResourceSelector;
9069 /// let x = Filter::new()
9070 /// .set_exclusion_filters([
9071 /// ResourceSelector::default()/* use setters */,
9072 /// ResourceSelector::default()/* use (different) setters */,
9073 /// ]);
9074 /// ```
9075 pub fn set_exclusion_filters<T, V>(mut self, v: T) -> Self
9076 where
9077 T: std::iter::IntoIterator<Item = V>,
9078 V: std::convert::Into<crate::model::ResourceSelector>,
9079 {
9080 use std::iter::Iterator;
9081 self.exclusion_filters = v.into_iter().map(|i| i.into()).collect();
9082 self
9083 }
9084 }
9085
9086 impl wkt::message::Message for Filter {
9087 fn typename() -> &'static str {
9088 "type.googleapis.com/google.cloud.gkebackup.v1.Restore.Filter"
9089 }
9090 }
9091
9092 /// Possible values for state of the Restore.
9093 ///
9094 /// # Working with unknown values
9095 ///
9096 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
9097 /// additional enum variants at any time. Adding new variants is not considered
9098 /// a breaking change. Applications should write their code in anticipation of:
9099 ///
9100 /// - New values appearing in future releases of the client library, **and**
9101 /// - New values received dynamically, without application changes.
9102 ///
9103 /// Please consult the [Working with enums] section in the user guide for some
9104 /// guidelines.
9105 ///
9106 /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
9107 #[derive(Clone, Debug, PartialEq)]
9108 #[non_exhaustive]
9109 pub enum State {
9110 /// The Restore resource is in the process of being created.
9111 Unspecified,
9112 /// The Restore resource has been created and the associated RestoreJob
9113 /// Kubernetes resource has been injected into target cluster.
9114 Creating,
9115 /// The gkebackup agent in the cluster has begun executing the restore
9116 /// operation.
9117 InProgress,
9118 /// The restore operation has completed successfully. Restored workloads may
9119 /// not yet be operational.
9120 Succeeded,
9121 /// The restore operation has failed.
9122 Failed,
9123 /// This Restore resource is in the process of being deleted.
9124 Deleting,
9125 /// The Kubernetes resources created by this Restore are being
9126 /// validated.
9127 Validating,
9128 /// If set, the enum was initialized with an unknown value.
9129 ///
9130 /// Applications can examine the value using [State::value] or
9131 /// [State::name].
9132 UnknownValue(state::UnknownValue),
9133 }
9134
9135 #[doc(hidden)]
9136 pub mod state {
9137 #[allow(unused_imports)]
9138 use super::*;
9139 #[derive(Clone, Debug, PartialEq)]
9140 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
9141 }
9142
9143 impl State {
9144 /// Gets the enum value.
9145 ///
9146 /// Returns `None` if the enum contains an unknown value deserialized from
9147 /// the string representation of enums.
9148 pub fn value(&self) -> std::option::Option<i32> {
9149 match self {
9150 Self::Unspecified => std::option::Option::Some(0),
9151 Self::Creating => std::option::Option::Some(1),
9152 Self::InProgress => std::option::Option::Some(2),
9153 Self::Succeeded => std::option::Option::Some(3),
9154 Self::Failed => std::option::Option::Some(4),
9155 Self::Deleting => std::option::Option::Some(5),
9156 Self::Validating => std::option::Option::Some(6),
9157 Self::UnknownValue(u) => u.0.value(),
9158 }
9159 }
9160
9161 /// Gets the enum value as a string.
9162 ///
9163 /// Returns `None` if the enum contains an unknown value deserialized from
9164 /// the integer representation of enums.
9165 pub fn name(&self) -> std::option::Option<&str> {
9166 match self {
9167 Self::Unspecified => std::option::Option::Some("STATE_UNSPECIFIED"),
9168 Self::Creating => std::option::Option::Some("CREATING"),
9169 Self::InProgress => std::option::Option::Some("IN_PROGRESS"),
9170 Self::Succeeded => std::option::Option::Some("SUCCEEDED"),
9171 Self::Failed => std::option::Option::Some("FAILED"),
9172 Self::Deleting => std::option::Option::Some("DELETING"),
9173 Self::Validating => std::option::Option::Some("VALIDATING"),
9174 Self::UnknownValue(u) => u.0.name(),
9175 }
9176 }
9177 }
9178
9179 impl std::default::Default for State {
9180 fn default() -> Self {
9181 use std::convert::From;
9182 Self::from(0)
9183 }
9184 }
9185
9186 impl std::fmt::Display for State {
9187 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
9188 wkt::internal::display_enum(f, self.name(), self.value())
9189 }
9190 }
9191
9192 impl std::convert::From<i32> for State {
9193 fn from(value: i32) -> Self {
9194 match value {
9195 0 => Self::Unspecified,
9196 1 => Self::Creating,
9197 2 => Self::InProgress,
9198 3 => Self::Succeeded,
9199 4 => Self::Failed,
9200 5 => Self::Deleting,
9201 6 => Self::Validating,
9202 _ => Self::UnknownValue(state::UnknownValue(
9203 wkt::internal::UnknownEnumValue::Integer(value),
9204 )),
9205 }
9206 }
9207 }
9208
9209 impl std::convert::From<&str> for State {
9210 fn from(value: &str) -> Self {
9211 use std::string::ToString;
9212 match value {
9213 "STATE_UNSPECIFIED" => Self::Unspecified,
9214 "CREATING" => Self::Creating,
9215 "IN_PROGRESS" => Self::InProgress,
9216 "SUCCEEDED" => Self::Succeeded,
9217 "FAILED" => Self::Failed,
9218 "DELETING" => Self::Deleting,
9219 "VALIDATING" => Self::Validating,
9220 _ => Self::UnknownValue(state::UnknownValue(
9221 wkt::internal::UnknownEnumValue::String(value.to_string()),
9222 )),
9223 }
9224 }
9225 }
9226
9227 impl serde::ser::Serialize for State {
9228 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
9229 where
9230 S: serde::Serializer,
9231 {
9232 match self {
9233 Self::Unspecified => serializer.serialize_i32(0),
9234 Self::Creating => serializer.serialize_i32(1),
9235 Self::InProgress => serializer.serialize_i32(2),
9236 Self::Succeeded => serializer.serialize_i32(3),
9237 Self::Failed => serializer.serialize_i32(4),
9238 Self::Deleting => serializer.serialize_i32(5),
9239 Self::Validating => serializer.serialize_i32(6),
9240 Self::UnknownValue(u) => u.0.serialize(serializer),
9241 }
9242 }
9243 }
9244
9245 impl<'de> serde::de::Deserialize<'de> for State {
9246 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
9247 where
9248 D: serde::Deserializer<'de>,
9249 {
9250 deserializer.deserialize_any(wkt::internal::EnumVisitor::<State>::new(
9251 ".google.cloud.gkebackup.v1.Restore.State",
9252 ))
9253 }
9254 }
9255}
9256
9257/// Configuration of a restore.
9258#[derive(Clone, Default, PartialEq)]
9259#[non_exhaustive]
9260pub struct RestoreConfig {
9261 /// Optional. Specifies the mechanism to be used to restore volume data.
9262 /// Default: VOLUME_DATA_RESTORE_POLICY_UNSPECIFIED (will be treated as
9263 /// NO_VOLUME_DATA_RESTORATION).
9264 pub volume_data_restore_policy: crate::model::restore_config::VolumeDataRestorePolicy,
9265
9266 /// Optional. Defines the behavior for handling the situation where
9267 /// cluster-scoped resources being restored already exist in the target
9268 /// cluster. This MUST be set to a value other than
9269 /// CLUSTER_RESOURCE_CONFLICT_POLICY_UNSPECIFIED if
9270 /// [cluster_resource_restore_scope][google.cloud.gkebackup.v1.RestoreConfig.cluster_resource_restore_scope]
9271 /// is not empty.
9272 ///
9273 /// [google.cloud.gkebackup.v1.RestoreConfig.cluster_resource_restore_scope]: crate::model::RestoreConfig::cluster_resource_restore_scope
9274 pub cluster_resource_conflict_policy:
9275 crate::model::restore_config::ClusterResourceConflictPolicy,
9276
9277 /// Optional. Defines the behavior for handling the situation where sets of
9278 /// namespaced resources being restored already exist in the target cluster.
9279 /// This MUST be set to a value other than
9280 /// NAMESPACED_RESOURCE_RESTORE_MODE_UNSPECIFIED.
9281 pub namespaced_resource_restore_mode:
9282 crate::model::restore_config::NamespacedResourceRestoreMode,
9283
9284 /// Optional. Identifies the cluster-scoped resources to restore from the
9285 /// Backup. Not specifying it means NO cluster resource will be restored.
9286 pub cluster_resource_restore_scope:
9287 std::option::Option<crate::model::restore_config::ClusterResourceRestoreScope>,
9288
9289 /// Optional. A list of transformation rules to be applied against Kubernetes
9290 /// resources as they are selected for restoration from a Backup. Rules are
9291 /// executed in order defined - this order matters, as changes made by a rule
9292 /// may impact the filtering logic of subsequent rules. An empty list means no
9293 /// substitution will occur.
9294 pub substitution_rules: std::vec::Vec<crate::model::restore_config::SubstitutionRule>,
9295
9296 /// Optional. A list of transformation rules to be applied against Kubernetes
9297 /// resources as they are selected for restoration from a Backup. Rules are
9298 /// executed in order defined - this order matters, as changes made by a rule
9299 /// may impact the filtering logic of subsequent rules. An empty list means no
9300 /// transformation will occur.
9301 pub transformation_rules: std::vec::Vec<crate::model::restore_config::TransformationRule>,
9302
9303 /// Optional. A table that binds volumes by their scope to a restore policy.
9304 /// Bindings must have a unique scope. Any volumes not scoped in the bindings
9305 /// are subject to the policy defined in volume_data_restore_policy.
9306 pub volume_data_restore_policy_bindings:
9307 std::vec::Vec<crate::model::restore_config::VolumeDataRestorePolicyBinding>,
9308
9309 /// Optional. RestoreOrder contains custom ordering to use on a Restore.
9310 pub restore_order: std::option::Option<crate::model::restore_config::RestoreOrder>,
9311
9312 /// Specifies the namespaced resources to restore from the Backup.
9313 /// Only one of the entries may be specified. If not specified, NO namespaced
9314 /// resources will be restored.
9315 ///
9316 /// Note: Resources will never be restored into *managed* namespaces such as
9317 /// `kube-system`, `kube-public`, or `kube-node-lease`. These namespaces
9318 /// are silently skipped when
9319 /// [all_namespaces][google.cloud.gkebackup.v1.RestoreConfig.all_namespaces] is
9320 /// selected. Listing them explicitly will result in an error.
9321 ///
9322 /// [google.cloud.gkebackup.v1.RestoreConfig.all_namespaces]: crate::model::RestoreConfig::namespaced_resource_restore_scope
9323 pub namespaced_resource_restore_scope:
9324 std::option::Option<crate::model::restore_config::NamespacedResourceRestoreScope>,
9325
9326 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
9327}
9328
9329impl RestoreConfig {
9330 pub fn new() -> Self {
9331 std::default::Default::default()
9332 }
9333
9334 /// Sets the value of [volume_data_restore_policy][crate::model::RestoreConfig::volume_data_restore_policy].
9335 ///
9336 /// # Example
9337 /// ```ignore,no_run
9338 /// # use google_cloud_gkebackup_v1::model::RestoreConfig;
9339 /// use google_cloud_gkebackup_v1::model::restore_config::VolumeDataRestorePolicy;
9340 /// let x0 = RestoreConfig::new().set_volume_data_restore_policy(VolumeDataRestorePolicy::RestoreVolumeDataFromBackup);
9341 /// let x1 = RestoreConfig::new().set_volume_data_restore_policy(VolumeDataRestorePolicy::ReuseVolumeHandleFromBackup);
9342 /// let x2 = RestoreConfig::new().set_volume_data_restore_policy(VolumeDataRestorePolicy::NoVolumeDataRestoration);
9343 /// ```
9344 pub fn set_volume_data_restore_policy<
9345 T: std::convert::Into<crate::model::restore_config::VolumeDataRestorePolicy>,
9346 >(
9347 mut self,
9348 v: T,
9349 ) -> Self {
9350 self.volume_data_restore_policy = v.into();
9351 self
9352 }
9353
9354 /// Sets the value of [cluster_resource_conflict_policy][crate::model::RestoreConfig::cluster_resource_conflict_policy].
9355 ///
9356 /// # Example
9357 /// ```ignore,no_run
9358 /// # use google_cloud_gkebackup_v1::model::RestoreConfig;
9359 /// use google_cloud_gkebackup_v1::model::restore_config::ClusterResourceConflictPolicy;
9360 /// let x0 = RestoreConfig::new().set_cluster_resource_conflict_policy(ClusterResourceConflictPolicy::UseExistingVersion);
9361 /// let x1 = RestoreConfig::new().set_cluster_resource_conflict_policy(ClusterResourceConflictPolicy::UseBackupVersion);
9362 /// ```
9363 pub fn set_cluster_resource_conflict_policy<
9364 T: std::convert::Into<crate::model::restore_config::ClusterResourceConflictPolicy>,
9365 >(
9366 mut self,
9367 v: T,
9368 ) -> Self {
9369 self.cluster_resource_conflict_policy = v.into();
9370 self
9371 }
9372
9373 /// Sets the value of [namespaced_resource_restore_mode][crate::model::RestoreConfig::namespaced_resource_restore_mode].
9374 ///
9375 /// # Example
9376 /// ```ignore,no_run
9377 /// # use google_cloud_gkebackup_v1::model::RestoreConfig;
9378 /// use google_cloud_gkebackup_v1::model::restore_config::NamespacedResourceRestoreMode;
9379 /// let x0 = RestoreConfig::new().set_namespaced_resource_restore_mode(NamespacedResourceRestoreMode::DeleteAndRestore);
9380 /// let x1 = RestoreConfig::new().set_namespaced_resource_restore_mode(NamespacedResourceRestoreMode::FailOnConflict);
9381 /// let x2 = RestoreConfig::new().set_namespaced_resource_restore_mode(NamespacedResourceRestoreMode::MergeSkipOnConflict);
9382 /// ```
9383 pub fn set_namespaced_resource_restore_mode<
9384 T: std::convert::Into<crate::model::restore_config::NamespacedResourceRestoreMode>,
9385 >(
9386 mut self,
9387 v: T,
9388 ) -> Self {
9389 self.namespaced_resource_restore_mode = v.into();
9390 self
9391 }
9392
9393 /// Sets the value of [cluster_resource_restore_scope][crate::model::RestoreConfig::cluster_resource_restore_scope].
9394 ///
9395 /// # Example
9396 /// ```ignore,no_run
9397 /// # use google_cloud_gkebackup_v1::model::RestoreConfig;
9398 /// use google_cloud_gkebackup_v1::model::restore_config::ClusterResourceRestoreScope;
9399 /// let x = RestoreConfig::new().set_cluster_resource_restore_scope(ClusterResourceRestoreScope::default()/* use setters */);
9400 /// ```
9401 pub fn set_cluster_resource_restore_scope<T>(mut self, v: T) -> Self
9402 where
9403 T: std::convert::Into<crate::model::restore_config::ClusterResourceRestoreScope>,
9404 {
9405 self.cluster_resource_restore_scope = std::option::Option::Some(v.into());
9406 self
9407 }
9408
9409 /// Sets or clears the value of [cluster_resource_restore_scope][crate::model::RestoreConfig::cluster_resource_restore_scope].
9410 ///
9411 /// # Example
9412 /// ```ignore,no_run
9413 /// # use google_cloud_gkebackup_v1::model::RestoreConfig;
9414 /// use google_cloud_gkebackup_v1::model::restore_config::ClusterResourceRestoreScope;
9415 /// let x = RestoreConfig::new().set_or_clear_cluster_resource_restore_scope(Some(ClusterResourceRestoreScope::default()/* use setters */));
9416 /// let x = RestoreConfig::new().set_or_clear_cluster_resource_restore_scope(None::<ClusterResourceRestoreScope>);
9417 /// ```
9418 pub fn set_or_clear_cluster_resource_restore_scope<T>(
9419 mut self,
9420 v: std::option::Option<T>,
9421 ) -> Self
9422 where
9423 T: std::convert::Into<crate::model::restore_config::ClusterResourceRestoreScope>,
9424 {
9425 self.cluster_resource_restore_scope = v.map(|x| x.into());
9426 self
9427 }
9428
9429 /// Sets the value of [substitution_rules][crate::model::RestoreConfig::substitution_rules].
9430 ///
9431 /// # Example
9432 /// ```ignore,no_run
9433 /// # use google_cloud_gkebackup_v1::model::RestoreConfig;
9434 /// use google_cloud_gkebackup_v1::model::restore_config::SubstitutionRule;
9435 /// let x = RestoreConfig::new()
9436 /// .set_substitution_rules([
9437 /// SubstitutionRule::default()/* use setters */,
9438 /// SubstitutionRule::default()/* use (different) setters */,
9439 /// ]);
9440 /// ```
9441 pub fn set_substitution_rules<T, V>(mut self, v: T) -> Self
9442 where
9443 T: std::iter::IntoIterator<Item = V>,
9444 V: std::convert::Into<crate::model::restore_config::SubstitutionRule>,
9445 {
9446 use std::iter::Iterator;
9447 self.substitution_rules = v.into_iter().map(|i| i.into()).collect();
9448 self
9449 }
9450
9451 /// Sets the value of [transformation_rules][crate::model::RestoreConfig::transformation_rules].
9452 ///
9453 /// # Example
9454 /// ```ignore,no_run
9455 /// # use google_cloud_gkebackup_v1::model::RestoreConfig;
9456 /// use google_cloud_gkebackup_v1::model::restore_config::TransformationRule;
9457 /// let x = RestoreConfig::new()
9458 /// .set_transformation_rules([
9459 /// TransformationRule::default()/* use setters */,
9460 /// TransformationRule::default()/* use (different) setters */,
9461 /// ]);
9462 /// ```
9463 pub fn set_transformation_rules<T, V>(mut self, v: T) -> Self
9464 where
9465 T: std::iter::IntoIterator<Item = V>,
9466 V: std::convert::Into<crate::model::restore_config::TransformationRule>,
9467 {
9468 use std::iter::Iterator;
9469 self.transformation_rules = v.into_iter().map(|i| i.into()).collect();
9470 self
9471 }
9472
9473 /// Sets the value of [volume_data_restore_policy_bindings][crate::model::RestoreConfig::volume_data_restore_policy_bindings].
9474 ///
9475 /// # Example
9476 /// ```ignore,no_run
9477 /// # use google_cloud_gkebackup_v1::model::RestoreConfig;
9478 /// use google_cloud_gkebackup_v1::model::restore_config::VolumeDataRestorePolicyBinding;
9479 /// let x = RestoreConfig::new()
9480 /// .set_volume_data_restore_policy_bindings([
9481 /// VolumeDataRestorePolicyBinding::default()/* use setters */,
9482 /// VolumeDataRestorePolicyBinding::default()/* use (different) setters */,
9483 /// ]);
9484 /// ```
9485 pub fn set_volume_data_restore_policy_bindings<T, V>(mut self, v: T) -> Self
9486 where
9487 T: std::iter::IntoIterator<Item = V>,
9488 V: std::convert::Into<crate::model::restore_config::VolumeDataRestorePolicyBinding>,
9489 {
9490 use std::iter::Iterator;
9491 self.volume_data_restore_policy_bindings = v.into_iter().map(|i| i.into()).collect();
9492 self
9493 }
9494
9495 /// Sets the value of [restore_order][crate::model::RestoreConfig::restore_order].
9496 ///
9497 /// # Example
9498 /// ```ignore,no_run
9499 /// # use google_cloud_gkebackup_v1::model::RestoreConfig;
9500 /// use google_cloud_gkebackup_v1::model::restore_config::RestoreOrder;
9501 /// let x = RestoreConfig::new().set_restore_order(RestoreOrder::default()/* use setters */);
9502 /// ```
9503 pub fn set_restore_order<T>(mut self, v: T) -> Self
9504 where
9505 T: std::convert::Into<crate::model::restore_config::RestoreOrder>,
9506 {
9507 self.restore_order = std::option::Option::Some(v.into());
9508 self
9509 }
9510
9511 /// Sets or clears the value of [restore_order][crate::model::RestoreConfig::restore_order].
9512 ///
9513 /// # Example
9514 /// ```ignore,no_run
9515 /// # use google_cloud_gkebackup_v1::model::RestoreConfig;
9516 /// use google_cloud_gkebackup_v1::model::restore_config::RestoreOrder;
9517 /// let x = RestoreConfig::new().set_or_clear_restore_order(Some(RestoreOrder::default()/* use setters */));
9518 /// let x = RestoreConfig::new().set_or_clear_restore_order(None::<RestoreOrder>);
9519 /// ```
9520 pub fn set_or_clear_restore_order<T>(mut self, v: std::option::Option<T>) -> Self
9521 where
9522 T: std::convert::Into<crate::model::restore_config::RestoreOrder>,
9523 {
9524 self.restore_order = v.map(|x| x.into());
9525 self
9526 }
9527
9528 /// Sets the value of [namespaced_resource_restore_scope][crate::model::RestoreConfig::namespaced_resource_restore_scope].
9529 ///
9530 /// Note that all the setters affecting `namespaced_resource_restore_scope` are mutually
9531 /// exclusive.
9532 ///
9533 /// # Example
9534 /// ```ignore,no_run
9535 /// # use google_cloud_gkebackup_v1::model::RestoreConfig;
9536 /// use google_cloud_gkebackup_v1::model::restore_config::NamespacedResourceRestoreScope;
9537 /// let x = RestoreConfig::new().set_namespaced_resource_restore_scope(Some(NamespacedResourceRestoreScope::AllNamespaces(true)));
9538 /// ```
9539 pub fn set_namespaced_resource_restore_scope<
9540 T: std::convert::Into<
9541 std::option::Option<crate::model::restore_config::NamespacedResourceRestoreScope>,
9542 >,
9543 >(
9544 mut self,
9545 v: T,
9546 ) -> Self {
9547 self.namespaced_resource_restore_scope = v.into();
9548 self
9549 }
9550
9551 /// The value of [namespaced_resource_restore_scope][crate::model::RestoreConfig::namespaced_resource_restore_scope]
9552 /// if it holds a `AllNamespaces`, `None` if the field is not set or
9553 /// holds a different branch.
9554 pub fn all_namespaces(&self) -> std::option::Option<&bool> {
9555 #[allow(unreachable_patterns)]
9556 self.namespaced_resource_restore_scope
9557 .as_ref()
9558 .and_then(|v| match v {
9559 crate::model::restore_config::NamespacedResourceRestoreScope::AllNamespaces(v) => {
9560 std::option::Option::Some(v)
9561 }
9562 _ => std::option::Option::None,
9563 })
9564 }
9565
9566 /// Sets the value of [namespaced_resource_restore_scope][crate::model::RestoreConfig::namespaced_resource_restore_scope]
9567 /// to hold a `AllNamespaces`.
9568 ///
9569 /// Note that all the setters affecting `namespaced_resource_restore_scope` are
9570 /// mutually exclusive.
9571 ///
9572 /// # Example
9573 /// ```ignore,no_run
9574 /// # use google_cloud_gkebackup_v1::model::RestoreConfig;
9575 /// let x = RestoreConfig::new().set_all_namespaces(true);
9576 /// assert!(x.all_namespaces().is_some());
9577 /// assert!(x.selected_namespaces().is_none());
9578 /// assert!(x.selected_applications().is_none());
9579 /// assert!(x.no_namespaces().is_none());
9580 /// assert!(x.excluded_namespaces().is_none());
9581 /// ```
9582 pub fn set_all_namespaces<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
9583 self.namespaced_resource_restore_scope = std::option::Option::Some(
9584 crate::model::restore_config::NamespacedResourceRestoreScope::AllNamespaces(v.into()),
9585 );
9586 self
9587 }
9588
9589 /// The value of [namespaced_resource_restore_scope][crate::model::RestoreConfig::namespaced_resource_restore_scope]
9590 /// if it holds a `SelectedNamespaces`, `None` if the field is not set or
9591 /// holds a different branch.
9592 pub fn selected_namespaces(
9593 &self,
9594 ) -> std::option::Option<&std::boxed::Box<crate::model::Namespaces>> {
9595 #[allow(unreachable_patterns)]
9596 self.namespaced_resource_restore_scope.as_ref().and_then(|v| match v {
9597 crate::model::restore_config::NamespacedResourceRestoreScope::SelectedNamespaces(v) => std::option::Option::Some(v),
9598 _ => std::option::Option::None,
9599 })
9600 }
9601
9602 /// Sets the value of [namespaced_resource_restore_scope][crate::model::RestoreConfig::namespaced_resource_restore_scope]
9603 /// to hold a `SelectedNamespaces`.
9604 ///
9605 /// Note that all the setters affecting `namespaced_resource_restore_scope` are
9606 /// mutually exclusive.
9607 ///
9608 /// # Example
9609 /// ```ignore,no_run
9610 /// # use google_cloud_gkebackup_v1::model::RestoreConfig;
9611 /// use google_cloud_gkebackup_v1::model::Namespaces;
9612 /// let x = RestoreConfig::new().set_selected_namespaces(Namespaces::default()/* use setters */);
9613 /// assert!(x.selected_namespaces().is_some());
9614 /// assert!(x.all_namespaces().is_none());
9615 /// assert!(x.selected_applications().is_none());
9616 /// assert!(x.no_namespaces().is_none());
9617 /// assert!(x.excluded_namespaces().is_none());
9618 /// ```
9619 pub fn set_selected_namespaces<
9620 T: std::convert::Into<std::boxed::Box<crate::model::Namespaces>>,
9621 >(
9622 mut self,
9623 v: T,
9624 ) -> Self {
9625 self.namespaced_resource_restore_scope = std::option::Option::Some(
9626 crate::model::restore_config::NamespacedResourceRestoreScope::SelectedNamespaces(
9627 v.into(),
9628 ),
9629 );
9630 self
9631 }
9632
9633 /// The value of [namespaced_resource_restore_scope][crate::model::RestoreConfig::namespaced_resource_restore_scope]
9634 /// if it holds a `SelectedApplications`, `None` if the field is not set or
9635 /// holds a different branch.
9636 pub fn selected_applications(
9637 &self,
9638 ) -> std::option::Option<&std::boxed::Box<crate::model::NamespacedNames>> {
9639 #[allow(unreachable_patterns)]
9640 self.namespaced_resource_restore_scope.as_ref().and_then(|v| match v {
9641 crate::model::restore_config::NamespacedResourceRestoreScope::SelectedApplications(v) => std::option::Option::Some(v),
9642 _ => std::option::Option::None,
9643 })
9644 }
9645
9646 /// Sets the value of [namespaced_resource_restore_scope][crate::model::RestoreConfig::namespaced_resource_restore_scope]
9647 /// to hold a `SelectedApplications`.
9648 ///
9649 /// Note that all the setters affecting `namespaced_resource_restore_scope` are
9650 /// mutually exclusive.
9651 ///
9652 /// # Example
9653 /// ```ignore,no_run
9654 /// # use google_cloud_gkebackup_v1::model::RestoreConfig;
9655 /// use google_cloud_gkebackup_v1::model::NamespacedNames;
9656 /// let x = RestoreConfig::new().set_selected_applications(NamespacedNames::default()/* use setters */);
9657 /// assert!(x.selected_applications().is_some());
9658 /// assert!(x.all_namespaces().is_none());
9659 /// assert!(x.selected_namespaces().is_none());
9660 /// assert!(x.no_namespaces().is_none());
9661 /// assert!(x.excluded_namespaces().is_none());
9662 /// ```
9663 pub fn set_selected_applications<
9664 T: std::convert::Into<std::boxed::Box<crate::model::NamespacedNames>>,
9665 >(
9666 mut self,
9667 v: T,
9668 ) -> Self {
9669 self.namespaced_resource_restore_scope = std::option::Option::Some(
9670 crate::model::restore_config::NamespacedResourceRestoreScope::SelectedApplications(
9671 v.into(),
9672 ),
9673 );
9674 self
9675 }
9676
9677 /// The value of [namespaced_resource_restore_scope][crate::model::RestoreConfig::namespaced_resource_restore_scope]
9678 /// if it holds a `NoNamespaces`, `None` if the field is not set or
9679 /// holds a different branch.
9680 pub fn no_namespaces(&self) -> std::option::Option<&bool> {
9681 #[allow(unreachable_patterns)]
9682 self.namespaced_resource_restore_scope
9683 .as_ref()
9684 .and_then(|v| match v {
9685 crate::model::restore_config::NamespacedResourceRestoreScope::NoNamespaces(v) => {
9686 std::option::Option::Some(v)
9687 }
9688 _ => std::option::Option::None,
9689 })
9690 }
9691
9692 /// Sets the value of [namespaced_resource_restore_scope][crate::model::RestoreConfig::namespaced_resource_restore_scope]
9693 /// to hold a `NoNamespaces`.
9694 ///
9695 /// Note that all the setters affecting `namespaced_resource_restore_scope` are
9696 /// mutually exclusive.
9697 ///
9698 /// # Example
9699 /// ```ignore,no_run
9700 /// # use google_cloud_gkebackup_v1::model::RestoreConfig;
9701 /// let x = RestoreConfig::new().set_no_namespaces(true);
9702 /// assert!(x.no_namespaces().is_some());
9703 /// assert!(x.all_namespaces().is_none());
9704 /// assert!(x.selected_namespaces().is_none());
9705 /// assert!(x.selected_applications().is_none());
9706 /// assert!(x.excluded_namespaces().is_none());
9707 /// ```
9708 pub fn set_no_namespaces<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
9709 self.namespaced_resource_restore_scope = std::option::Option::Some(
9710 crate::model::restore_config::NamespacedResourceRestoreScope::NoNamespaces(v.into()),
9711 );
9712 self
9713 }
9714
9715 /// The value of [namespaced_resource_restore_scope][crate::model::RestoreConfig::namespaced_resource_restore_scope]
9716 /// if it holds a `ExcludedNamespaces`, `None` if the field is not set or
9717 /// holds a different branch.
9718 pub fn excluded_namespaces(
9719 &self,
9720 ) -> std::option::Option<&std::boxed::Box<crate::model::Namespaces>> {
9721 #[allow(unreachable_patterns)]
9722 self.namespaced_resource_restore_scope.as_ref().and_then(|v| match v {
9723 crate::model::restore_config::NamespacedResourceRestoreScope::ExcludedNamespaces(v) => std::option::Option::Some(v),
9724 _ => std::option::Option::None,
9725 })
9726 }
9727
9728 /// Sets the value of [namespaced_resource_restore_scope][crate::model::RestoreConfig::namespaced_resource_restore_scope]
9729 /// to hold a `ExcludedNamespaces`.
9730 ///
9731 /// Note that all the setters affecting `namespaced_resource_restore_scope` are
9732 /// mutually exclusive.
9733 ///
9734 /// # Example
9735 /// ```ignore,no_run
9736 /// # use google_cloud_gkebackup_v1::model::RestoreConfig;
9737 /// use google_cloud_gkebackup_v1::model::Namespaces;
9738 /// let x = RestoreConfig::new().set_excluded_namespaces(Namespaces::default()/* use setters */);
9739 /// assert!(x.excluded_namespaces().is_some());
9740 /// assert!(x.all_namespaces().is_none());
9741 /// assert!(x.selected_namespaces().is_none());
9742 /// assert!(x.selected_applications().is_none());
9743 /// assert!(x.no_namespaces().is_none());
9744 /// ```
9745 pub fn set_excluded_namespaces<
9746 T: std::convert::Into<std::boxed::Box<crate::model::Namespaces>>,
9747 >(
9748 mut self,
9749 v: T,
9750 ) -> Self {
9751 self.namespaced_resource_restore_scope = std::option::Option::Some(
9752 crate::model::restore_config::NamespacedResourceRestoreScope::ExcludedNamespaces(
9753 v.into(),
9754 ),
9755 );
9756 self
9757 }
9758}
9759
9760impl wkt::message::Message for RestoreConfig {
9761 fn typename() -> &'static str {
9762 "type.googleapis.com/google.cloud.gkebackup.v1.RestoreConfig"
9763 }
9764}
9765
9766/// Defines additional types related to [RestoreConfig].
9767pub mod restore_config {
9768 #[allow(unused_imports)]
9769 use super::*;
9770
9771 /// This is a direct map to the Kubernetes GroupKind type
9772 /// [GroupKind](https://godoc.org/k8s.io/apimachinery/pkg/runtime/schema#GroupKind)
9773 /// and is used for identifying specific "types" of resources to restore.
9774 #[derive(Clone, Default, PartialEq)]
9775 #[non_exhaustive]
9776 pub struct GroupKind {
9777 /// Optional. API group string of a Kubernetes resource, e.g.
9778 /// "apiextensions.k8s.io", "storage.k8s.io", etc.
9779 /// Note: use empty string for core API group.
9780 pub resource_group: std::string::String,
9781
9782 /// Optional. Kind of a Kubernetes resource, must be in UpperCamelCase
9783 /// (PascalCase) and singular form. E.g. "CustomResourceDefinition",
9784 /// "StorageClass", etc.
9785 pub resource_kind: std::string::String,
9786
9787 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
9788 }
9789
9790 impl GroupKind {
9791 pub fn new() -> Self {
9792 std::default::Default::default()
9793 }
9794
9795 /// Sets the value of [resource_group][crate::model::restore_config::GroupKind::resource_group].
9796 ///
9797 /// # Example
9798 /// ```ignore,no_run
9799 /// # use google_cloud_gkebackup_v1::model::restore_config::GroupKind;
9800 /// let x = GroupKind::new().set_resource_group("example");
9801 /// ```
9802 pub fn set_resource_group<T: std::convert::Into<std::string::String>>(
9803 mut self,
9804 v: T,
9805 ) -> Self {
9806 self.resource_group = v.into();
9807 self
9808 }
9809
9810 /// Sets the value of [resource_kind][crate::model::restore_config::GroupKind::resource_kind].
9811 ///
9812 /// # Example
9813 /// ```ignore,no_run
9814 /// # use google_cloud_gkebackup_v1::model::restore_config::GroupKind;
9815 /// let x = GroupKind::new().set_resource_kind("example");
9816 /// ```
9817 pub fn set_resource_kind<T: std::convert::Into<std::string::String>>(
9818 mut self,
9819 v: T,
9820 ) -> Self {
9821 self.resource_kind = v.into();
9822 self
9823 }
9824 }
9825
9826 impl wkt::message::Message for GroupKind {
9827 fn typename() -> &'static str {
9828 "type.googleapis.com/google.cloud.gkebackup.v1.RestoreConfig.GroupKind"
9829 }
9830 }
9831
9832 /// Defines the scope of cluster-scoped resources to restore.
9833 ///
9834 /// Some group kinds are not reasonable choices for a restore, and will cause
9835 /// an error if selected here. Any scope selection that would restore
9836 /// "all valid" resources automatically excludes these group kinds.
9837 ///
9838 /// - Node
9839 /// - ComponentStatus
9840 /// - gkebackup.gke.io/BackupJob
9841 /// - gkebackup.gke.io/RestoreJob
9842 /// - metrics.k8s.io/NodeMetrics
9843 /// - migration.k8s.io/StorageState
9844 /// - migration.k8s.io/StorageVersionMigration
9845 /// - snapshot.storage.k8s.io/VolumeSnapshotContent
9846 /// - storage.k8s.io/CSINode
9847 /// - storage.k8s.io/VolumeAttachment
9848 ///
9849 /// Some group kinds are driven by restore configuration elsewhere,
9850 /// and will cause an error if selected here.
9851 ///
9852 /// - Namespace
9853 /// - PersistentVolume
9854 #[derive(Clone, Default, PartialEq)]
9855 #[non_exhaustive]
9856 pub struct ClusterResourceRestoreScope {
9857 /// Optional. A list of cluster-scoped resource group kinds to restore from
9858 /// the backup. If specified, only the selected resources will be restored.
9859 /// Mutually exclusive to any other field in the message.
9860 pub selected_group_kinds: std::vec::Vec<crate::model::restore_config::GroupKind>,
9861
9862 /// Optional. A list of cluster-scoped resource group kinds to NOT restore
9863 /// from the backup. If specified, all valid cluster-scoped resources will be
9864 /// restored except for those specified in the list.
9865 /// Mutually exclusive to any other field in the message.
9866 pub excluded_group_kinds: std::vec::Vec<crate::model::restore_config::GroupKind>,
9867
9868 /// Optional. If True, all valid cluster-scoped resources will be restored.
9869 /// Mutually exclusive to any other field in the message.
9870 pub all_group_kinds: bool,
9871
9872 /// Optional. If True, no cluster-scoped resources will be restored.
9873 /// This has the same restore scope as if the message is not defined.
9874 /// Mutually exclusive to any other field in the message.
9875 pub no_group_kinds: bool,
9876
9877 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
9878 }
9879
9880 impl ClusterResourceRestoreScope {
9881 pub fn new() -> Self {
9882 std::default::Default::default()
9883 }
9884
9885 /// Sets the value of [selected_group_kinds][crate::model::restore_config::ClusterResourceRestoreScope::selected_group_kinds].
9886 ///
9887 /// # Example
9888 /// ```ignore,no_run
9889 /// # use google_cloud_gkebackup_v1::model::restore_config::ClusterResourceRestoreScope;
9890 /// use google_cloud_gkebackup_v1::model::restore_config::GroupKind;
9891 /// let x = ClusterResourceRestoreScope::new()
9892 /// .set_selected_group_kinds([
9893 /// GroupKind::default()/* use setters */,
9894 /// GroupKind::default()/* use (different) setters */,
9895 /// ]);
9896 /// ```
9897 pub fn set_selected_group_kinds<T, V>(mut self, v: T) -> Self
9898 where
9899 T: std::iter::IntoIterator<Item = V>,
9900 V: std::convert::Into<crate::model::restore_config::GroupKind>,
9901 {
9902 use std::iter::Iterator;
9903 self.selected_group_kinds = v.into_iter().map(|i| i.into()).collect();
9904 self
9905 }
9906
9907 /// Sets the value of [excluded_group_kinds][crate::model::restore_config::ClusterResourceRestoreScope::excluded_group_kinds].
9908 ///
9909 /// # Example
9910 /// ```ignore,no_run
9911 /// # use google_cloud_gkebackup_v1::model::restore_config::ClusterResourceRestoreScope;
9912 /// use google_cloud_gkebackup_v1::model::restore_config::GroupKind;
9913 /// let x = ClusterResourceRestoreScope::new()
9914 /// .set_excluded_group_kinds([
9915 /// GroupKind::default()/* use setters */,
9916 /// GroupKind::default()/* use (different) setters */,
9917 /// ]);
9918 /// ```
9919 pub fn set_excluded_group_kinds<T, V>(mut self, v: T) -> Self
9920 where
9921 T: std::iter::IntoIterator<Item = V>,
9922 V: std::convert::Into<crate::model::restore_config::GroupKind>,
9923 {
9924 use std::iter::Iterator;
9925 self.excluded_group_kinds = v.into_iter().map(|i| i.into()).collect();
9926 self
9927 }
9928
9929 /// Sets the value of [all_group_kinds][crate::model::restore_config::ClusterResourceRestoreScope::all_group_kinds].
9930 ///
9931 /// # Example
9932 /// ```ignore,no_run
9933 /// # use google_cloud_gkebackup_v1::model::restore_config::ClusterResourceRestoreScope;
9934 /// let x = ClusterResourceRestoreScope::new().set_all_group_kinds(true);
9935 /// ```
9936 pub fn set_all_group_kinds<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
9937 self.all_group_kinds = v.into();
9938 self
9939 }
9940
9941 /// Sets the value of [no_group_kinds][crate::model::restore_config::ClusterResourceRestoreScope::no_group_kinds].
9942 ///
9943 /// # Example
9944 /// ```ignore,no_run
9945 /// # use google_cloud_gkebackup_v1::model::restore_config::ClusterResourceRestoreScope;
9946 /// let x = ClusterResourceRestoreScope::new().set_no_group_kinds(true);
9947 /// ```
9948 pub fn set_no_group_kinds<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
9949 self.no_group_kinds = v.into();
9950 self
9951 }
9952 }
9953
9954 impl wkt::message::Message for ClusterResourceRestoreScope {
9955 fn typename() -> &'static str {
9956 "type.googleapis.com/google.cloud.gkebackup.v1.RestoreConfig.ClusterResourceRestoreScope"
9957 }
9958 }
9959
9960 /// A transformation rule to be applied against Kubernetes resources as they
9961 /// are selected for restoration from a Backup. A rule contains both filtering
9962 /// logic (which resources are subject to substitution) and substitution logic.
9963 #[derive(Clone, Default, PartialEq)]
9964 #[non_exhaustive]
9965 pub struct SubstitutionRule {
9966 /// Optional. (Filtering parameter) Any resource subject to substitution must
9967 /// be contained within one of the listed Kubernetes Namespace in the Backup.
9968 /// If this field is not provided, no namespace filtering will be performed
9969 /// (all resources in all Namespaces, including all cluster-scoped resources,
9970 /// will be candidates for substitution).
9971 /// To mix cluster-scoped and namespaced resources in the same rule, use an
9972 /// empty string ("") as one of the target namespaces.
9973 pub target_namespaces: std::vec::Vec<std::string::String>,
9974
9975 /// Optional. (Filtering parameter) Any resource subject to substitution must
9976 /// belong to one of the listed "types". If this field is not provided, no
9977 /// type filtering will be performed (all resources of all types matching
9978 /// previous filtering parameters will be candidates for substitution).
9979 pub target_group_kinds: std::vec::Vec<crate::model::restore_config::GroupKind>,
9980
9981 /// Required. This is a [JSONPath]
9982 /// (<https://kubernetes.io/docs/reference/kubectl/jsonpath/>)
9983 /// expression that matches specific fields of candidate
9984 /// resources and it operates as both a filtering parameter (resources that
9985 /// are not matched with this expression will not be candidates for
9986 /// substitution) as well as a field identifier (identifies exactly which
9987 /// fields out of the candidate resources will be modified).
9988 pub target_json_path: std::string::String,
9989
9990 /// Optional. (Filtering parameter) This is a [regular expression]
9991 /// (<https://en.wikipedia.org/wiki/Regular_expression>)
9992 /// that is compared against the fields matched by the target_json_path
9993 /// expression (and must also have passed the previous filters).
9994 /// Substitution will not be performed against fields whose
9995 /// value does not match this expression. If this field is NOT specified,
9996 /// then ALL fields matched by the target_json_path expression will undergo
9997 /// substitution. Note that an empty (e.g., "", rather than unspecified)
9998 /// value for this field will only match empty fields.
9999 pub original_value_pattern: std::string::String,
10000
10001 /// Optional. This is the new value to set for any fields that pass the
10002 /// filtering and selection criteria. To remove a value from a Kubernetes
10003 /// resource, either leave this field unspecified, or set it to the empty
10004 /// string ("").
10005 pub new_value: std::string::String,
10006
10007 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
10008 }
10009
10010 impl SubstitutionRule {
10011 pub fn new() -> Self {
10012 std::default::Default::default()
10013 }
10014
10015 /// Sets the value of [target_namespaces][crate::model::restore_config::SubstitutionRule::target_namespaces].
10016 ///
10017 /// # Example
10018 /// ```ignore,no_run
10019 /// # use google_cloud_gkebackup_v1::model::restore_config::SubstitutionRule;
10020 /// let x = SubstitutionRule::new().set_target_namespaces(["a", "b", "c"]);
10021 /// ```
10022 pub fn set_target_namespaces<T, V>(mut self, v: T) -> Self
10023 where
10024 T: std::iter::IntoIterator<Item = V>,
10025 V: std::convert::Into<std::string::String>,
10026 {
10027 use std::iter::Iterator;
10028 self.target_namespaces = v.into_iter().map(|i| i.into()).collect();
10029 self
10030 }
10031
10032 /// Sets the value of [target_group_kinds][crate::model::restore_config::SubstitutionRule::target_group_kinds].
10033 ///
10034 /// # Example
10035 /// ```ignore,no_run
10036 /// # use google_cloud_gkebackup_v1::model::restore_config::SubstitutionRule;
10037 /// use google_cloud_gkebackup_v1::model::restore_config::GroupKind;
10038 /// let x = SubstitutionRule::new()
10039 /// .set_target_group_kinds([
10040 /// GroupKind::default()/* use setters */,
10041 /// GroupKind::default()/* use (different) setters */,
10042 /// ]);
10043 /// ```
10044 pub fn set_target_group_kinds<T, V>(mut self, v: T) -> Self
10045 where
10046 T: std::iter::IntoIterator<Item = V>,
10047 V: std::convert::Into<crate::model::restore_config::GroupKind>,
10048 {
10049 use std::iter::Iterator;
10050 self.target_group_kinds = v.into_iter().map(|i| i.into()).collect();
10051 self
10052 }
10053
10054 /// Sets the value of [target_json_path][crate::model::restore_config::SubstitutionRule::target_json_path].
10055 ///
10056 /// # Example
10057 /// ```ignore,no_run
10058 /// # use google_cloud_gkebackup_v1::model::restore_config::SubstitutionRule;
10059 /// let x = SubstitutionRule::new().set_target_json_path("example");
10060 /// ```
10061 pub fn set_target_json_path<T: std::convert::Into<std::string::String>>(
10062 mut self,
10063 v: T,
10064 ) -> Self {
10065 self.target_json_path = v.into();
10066 self
10067 }
10068
10069 /// Sets the value of [original_value_pattern][crate::model::restore_config::SubstitutionRule::original_value_pattern].
10070 ///
10071 /// # Example
10072 /// ```ignore,no_run
10073 /// # use google_cloud_gkebackup_v1::model::restore_config::SubstitutionRule;
10074 /// let x = SubstitutionRule::new().set_original_value_pattern("example");
10075 /// ```
10076 pub fn set_original_value_pattern<T: std::convert::Into<std::string::String>>(
10077 mut self,
10078 v: T,
10079 ) -> Self {
10080 self.original_value_pattern = v.into();
10081 self
10082 }
10083
10084 /// Sets the value of [new_value][crate::model::restore_config::SubstitutionRule::new_value].
10085 ///
10086 /// # Example
10087 /// ```ignore,no_run
10088 /// # use google_cloud_gkebackup_v1::model::restore_config::SubstitutionRule;
10089 /// let x = SubstitutionRule::new().set_new_value("example");
10090 /// ```
10091 pub fn set_new_value<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
10092 self.new_value = v.into();
10093 self
10094 }
10095 }
10096
10097 impl wkt::message::Message for SubstitutionRule {
10098 fn typename() -> &'static str {
10099 "type.googleapis.com/google.cloud.gkebackup.v1.RestoreConfig.SubstitutionRule"
10100 }
10101 }
10102
10103 /// TransformationRuleAction defines a TransformationRule action based on the
10104 /// JSON Patch RFC (<https://www.rfc-editor.org/rfc/rfc6902>)
10105 #[derive(Clone, Default, PartialEq)]
10106 #[non_exhaustive]
10107 pub struct TransformationRuleAction {
10108 /// Required. op specifies the operation to perform.
10109 pub op: crate::model::restore_config::transformation_rule_action::Op,
10110
10111 /// Optional. A string containing a JSON Pointer value that references the
10112 /// location in the target document to move the value from.
10113 pub from_path: std::string::String,
10114
10115 /// Optional. A string containing a JSON-Pointer value that references a
10116 /// location within the target document where the operation is performed.
10117 pub path: std::string::String,
10118
10119 /// Optional. A string that specifies the desired value in string format to
10120 /// use for transformation.
10121 pub value: std::string::String,
10122
10123 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
10124 }
10125
10126 impl TransformationRuleAction {
10127 pub fn new() -> Self {
10128 std::default::Default::default()
10129 }
10130
10131 /// Sets the value of [op][crate::model::restore_config::TransformationRuleAction::op].
10132 ///
10133 /// # Example
10134 /// ```ignore,no_run
10135 /// # use google_cloud_gkebackup_v1::model::restore_config::TransformationRuleAction;
10136 /// use google_cloud_gkebackup_v1::model::restore_config::transformation_rule_action::Op;
10137 /// let x0 = TransformationRuleAction::new().set_op(Op::Remove);
10138 /// let x1 = TransformationRuleAction::new().set_op(Op::Move);
10139 /// let x2 = TransformationRuleAction::new().set_op(Op::Copy);
10140 /// ```
10141 pub fn set_op<
10142 T: std::convert::Into<crate::model::restore_config::transformation_rule_action::Op>,
10143 >(
10144 mut self,
10145 v: T,
10146 ) -> Self {
10147 self.op = v.into();
10148 self
10149 }
10150
10151 /// Sets the value of [from_path][crate::model::restore_config::TransformationRuleAction::from_path].
10152 ///
10153 /// # Example
10154 /// ```ignore,no_run
10155 /// # use google_cloud_gkebackup_v1::model::restore_config::TransformationRuleAction;
10156 /// let x = TransformationRuleAction::new().set_from_path("example");
10157 /// ```
10158 pub fn set_from_path<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
10159 self.from_path = v.into();
10160 self
10161 }
10162
10163 /// Sets the value of [path][crate::model::restore_config::TransformationRuleAction::path].
10164 ///
10165 /// # Example
10166 /// ```ignore,no_run
10167 /// # use google_cloud_gkebackup_v1::model::restore_config::TransformationRuleAction;
10168 /// let x = TransformationRuleAction::new().set_path("example");
10169 /// ```
10170 pub fn set_path<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
10171 self.path = v.into();
10172 self
10173 }
10174
10175 /// Sets the value of [value][crate::model::restore_config::TransformationRuleAction::value].
10176 ///
10177 /// # Example
10178 /// ```ignore,no_run
10179 /// # use google_cloud_gkebackup_v1::model::restore_config::TransformationRuleAction;
10180 /// let x = TransformationRuleAction::new().set_value("example");
10181 /// ```
10182 pub fn set_value<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
10183 self.value = v.into();
10184 self
10185 }
10186 }
10187
10188 impl wkt::message::Message for TransformationRuleAction {
10189 fn typename() -> &'static str {
10190 "type.googleapis.com/google.cloud.gkebackup.v1.RestoreConfig.TransformationRuleAction"
10191 }
10192 }
10193
10194 /// Defines additional types related to [TransformationRuleAction].
10195 pub mod transformation_rule_action {
10196 #[allow(unused_imports)]
10197 use super::*;
10198
10199 /// Possible values for operations of a transformation rule action.
10200 ///
10201 /// # Working with unknown values
10202 ///
10203 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
10204 /// additional enum variants at any time. Adding new variants is not considered
10205 /// a breaking change. Applications should write their code in anticipation of:
10206 ///
10207 /// - New values appearing in future releases of the client library, **and**
10208 /// - New values received dynamically, without application changes.
10209 ///
10210 /// Please consult the [Working with enums] section in the user guide for some
10211 /// guidelines.
10212 ///
10213 /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
10214 #[derive(Clone, Debug, PartialEq)]
10215 #[non_exhaustive]
10216 pub enum Op {
10217 /// Unspecified operation
10218 Unspecified,
10219 /// The "remove" operation removes the value at the target location.
10220 Remove,
10221 /// The "move" operation removes the value at a specified location and
10222 /// adds it to the target location.
10223 Move,
10224 /// The "copy" operation copies the value at a specified location to the
10225 /// target location.
10226 Copy,
10227 /// The "add" operation performs one of the following functions,
10228 /// depending upon what the target location references:
10229 ///
10230 /// 1. If the target location specifies an array index, a new value is
10231 /// inserted into the array at the specified index.
10232 /// 1. If the target location specifies an object member that does not
10233 /// already exist, a new member is added to the object.
10234 /// 1. If the target location specifies an object member that does exist,
10235 /// that member's value is replaced.
10236 Add,
10237 /// The "test" operation tests that a value at the target location is
10238 /// equal to a specified value.
10239 Test,
10240 /// The "replace" operation replaces the value at the target location
10241 /// with a new value. The operation object MUST contain a "value" member
10242 /// whose content specifies the replacement value.
10243 Replace,
10244 /// If set, the enum was initialized with an unknown value.
10245 ///
10246 /// Applications can examine the value using [Op::value] or
10247 /// [Op::name].
10248 UnknownValue(op::UnknownValue),
10249 }
10250
10251 #[doc(hidden)]
10252 pub mod op {
10253 #[allow(unused_imports)]
10254 use super::*;
10255 #[derive(Clone, Debug, PartialEq)]
10256 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
10257 }
10258
10259 impl Op {
10260 /// Gets the enum value.
10261 ///
10262 /// Returns `None` if the enum contains an unknown value deserialized from
10263 /// the string representation of enums.
10264 pub fn value(&self) -> std::option::Option<i32> {
10265 match self {
10266 Self::Unspecified => std::option::Option::Some(0),
10267 Self::Remove => std::option::Option::Some(1),
10268 Self::Move => std::option::Option::Some(2),
10269 Self::Copy => std::option::Option::Some(3),
10270 Self::Add => std::option::Option::Some(4),
10271 Self::Test => std::option::Option::Some(5),
10272 Self::Replace => std::option::Option::Some(6),
10273 Self::UnknownValue(u) => u.0.value(),
10274 }
10275 }
10276
10277 /// Gets the enum value as a string.
10278 ///
10279 /// Returns `None` if the enum contains an unknown value deserialized from
10280 /// the integer representation of enums.
10281 pub fn name(&self) -> std::option::Option<&str> {
10282 match self {
10283 Self::Unspecified => std::option::Option::Some("OP_UNSPECIFIED"),
10284 Self::Remove => std::option::Option::Some("REMOVE"),
10285 Self::Move => std::option::Option::Some("MOVE"),
10286 Self::Copy => std::option::Option::Some("COPY"),
10287 Self::Add => std::option::Option::Some("ADD"),
10288 Self::Test => std::option::Option::Some("TEST"),
10289 Self::Replace => std::option::Option::Some("REPLACE"),
10290 Self::UnknownValue(u) => u.0.name(),
10291 }
10292 }
10293 }
10294
10295 impl std::default::Default for Op {
10296 fn default() -> Self {
10297 use std::convert::From;
10298 Self::from(0)
10299 }
10300 }
10301
10302 impl std::fmt::Display for Op {
10303 fn fmt(
10304 &self,
10305 f: &mut std::fmt::Formatter<'_>,
10306 ) -> std::result::Result<(), std::fmt::Error> {
10307 wkt::internal::display_enum(f, self.name(), self.value())
10308 }
10309 }
10310
10311 impl std::convert::From<i32> for Op {
10312 fn from(value: i32) -> Self {
10313 match value {
10314 0 => Self::Unspecified,
10315 1 => Self::Remove,
10316 2 => Self::Move,
10317 3 => Self::Copy,
10318 4 => Self::Add,
10319 5 => Self::Test,
10320 6 => Self::Replace,
10321 _ => Self::UnknownValue(op::UnknownValue(
10322 wkt::internal::UnknownEnumValue::Integer(value),
10323 )),
10324 }
10325 }
10326 }
10327
10328 impl std::convert::From<&str> for Op {
10329 fn from(value: &str) -> Self {
10330 use std::string::ToString;
10331 match value {
10332 "OP_UNSPECIFIED" => Self::Unspecified,
10333 "REMOVE" => Self::Remove,
10334 "MOVE" => Self::Move,
10335 "COPY" => Self::Copy,
10336 "ADD" => Self::Add,
10337 "TEST" => Self::Test,
10338 "REPLACE" => Self::Replace,
10339 _ => Self::UnknownValue(op::UnknownValue(
10340 wkt::internal::UnknownEnumValue::String(value.to_string()),
10341 )),
10342 }
10343 }
10344 }
10345
10346 impl serde::ser::Serialize for Op {
10347 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
10348 where
10349 S: serde::Serializer,
10350 {
10351 match self {
10352 Self::Unspecified => serializer.serialize_i32(0),
10353 Self::Remove => serializer.serialize_i32(1),
10354 Self::Move => serializer.serialize_i32(2),
10355 Self::Copy => serializer.serialize_i32(3),
10356 Self::Add => serializer.serialize_i32(4),
10357 Self::Test => serializer.serialize_i32(5),
10358 Self::Replace => serializer.serialize_i32(6),
10359 Self::UnknownValue(u) => u.0.serialize(serializer),
10360 }
10361 }
10362 }
10363
10364 impl<'de> serde::de::Deserialize<'de> for Op {
10365 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
10366 where
10367 D: serde::Deserializer<'de>,
10368 {
10369 deserializer.deserialize_any(wkt::internal::EnumVisitor::<Op>::new(
10370 ".google.cloud.gkebackup.v1.RestoreConfig.TransformationRuleAction.Op",
10371 ))
10372 }
10373 }
10374 }
10375
10376 /// ResourceFilter specifies matching criteria to limit the scope of a
10377 /// change to a specific set of kubernetes resources that are selected for
10378 /// restoration from a backup.
10379 #[derive(Clone, Default, PartialEq)]
10380 #[non_exhaustive]
10381 pub struct ResourceFilter {
10382 /// Optional. (Filtering parameter) Any resource subject to transformation
10383 /// must be contained within one of the listed Kubernetes Namespace in the
10384 /// Backup. If this field is not provided, no namespace filtering will be
10385 /// performed (all resources in all Namespaces, including all cluster-scoped
10386 /// resources, will be candidates for transformation).
10387 pub namespaces: std::vec::Vec<std::string::String>,
10388
10389 /// Optional. (Filtering parameter) Any resource subject to transformation
10390 /// must belong to one of the listed "types". If this field is not provided,
10391 /// no type filtering will be performed (all resources of all types matching
10392 /// previous filtering parameters will be candidates for transformation).
10393 pub group_kinds: std::vec::Vec<crate::model::restore_config::GroupKind>,
10394
10395 /// Optional. This is a [JSONPath]
10396 /// (<https://github.com/json-path/JsonPath/blob/master/README.md>)
10397 /// expression that matches specific fields of candidate
10398 /// resources and it operates as a filtering parameter (resources that
10399 /// are not matched with this expression will not be candidates for
10400 /// transformation).
10401 pub json_path: std::string::String,
10402
10403 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
10404 }
10405
10406 impl ResourceFilter {
10407 pub fn new() -> Self {
10408 std::default::Default::default()
10409 }
10410
10411 /// Sets the value of [namespaces][crate::model::restore_config::ResourceFilter::namespaces].
10412 ///
10413 /// # Example
10414 /// ```ignore,no_run
10415 /// # use google_cloud_gkebackup_v1::model::restore_config::ResourceFilter;
10416 /// let x = ResourceFilter::new().set_namespaces(["a", "b", "c"]);
10417 /// ```
10418 pub fn set_namespaces<T, V>(mut self, v: T) -> Self
10419 where
10420 T: std::iter::IntoIterator<Item = V>,
10421 V: std::convert::Into<std::string::String>,
10422 {
10423 use std::iter::Iterator;
10424 self.namespaces = v.into_iter().map(|i| i.into()).collect();
10425 self
10426 }
10427
10428 /// Sets the value of [group_kinds][crate::model::restore_config::ResourceFilter::group_kinds].
10429 ///
10430 /// # Example
10431 /// ```ignore,no_run
10432 /// # use google_cloud_gkebackup_v1::model::restore_config::ResourceFilter;
10433 /// use google_cloud_gkebackup_v1::model::restore_config::GroupKind;
10434 /// let x = ResourceFilter::new()
10435 /// .set_group_kinds([
10436 /// GroupKind::default()/* use setters */,
10437 /// GroupKind::default()/* use (different) setters */,
10438 /// ]);
10439 /// ```
10440 pub fn set_group_kinds<T, V>(mut self, v: T) -> Self
10441 where
10442 T: std::iter::IntoIterator<Item = V>,
10443 V: std::convert::Into<crate::model::restore_config::GroupKind>,
10444 {
10445 use std::iter::Iterator;
10446 self.group_kinds = v.into_iter().map(|i| i.into()).collect();
10447 self
10448 }
10449
10450 /// Sets the value of [json_path][crate::model::restore_config::ResourceFilter::json_path].
10451 ///
10452 /// # Example
10453 /// ```ignore,no_run
10454 /// # use google_cloud_gkebackup_v1::model::restore_config::ResourceFilter;
10455 /// let x = ResourceFilter::new().set_json_path("example");
10456 /// ```
10457 pub fn set_json_path<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
10458 self.json_path = v.into();
10459 self
10460 }
10461 }
10462
10463 impl wkt::message::Message for ResourceFilter {
10464 fn typename() -> &'static str {
10465 "type.googleapis.com/google.cloud.gkebackup.v1.RestoreConfig.ResourceFilter"
10466 }
10467 }
10468
10469 /// A transformation rule to be applied against Kubernetes resources as they
10470 /// are selected for restoration from a Backup. A rule contains both filtering
10471 /// logic (which resources are subject to transform) and transformation logic.
10472 #[derive(Clone, Default, PartialEq)]
10473 #[non_exhaustive]
10474 pub struct TransformationRule {
10475 /// Required. A list of transformation rule actions to take against candidate
10476 /// resources. Actions are executed in order defined - this order matters, as
10477 /// they could potentially interfere with each other and the first operation
10478 /// could affect the outcome of the second operation.
10479 pub field_actions: std::vec::Vec<crate::model::restore_config::TransformationRuleAction>,
10480
10481 /// Optional. This field is used to specify a set of fields that should be
10482 /// used to determine which resources in backup should be acted upon by the
10483 /// supplied transformation rule actions, and this will ensure that only
10484 /// specific resources are affected by transformation rule actions.
10485 pub resource_filter: std::option::Option<crate::model::restore_config::ResourceFilter>,
10486
10487 /// Optional. The description is a user specified string description of the
10488 /// transformation rule.
10489 pub description: std::string::String,
10490
10491 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
10492 }
10493
10494 impl TransformationRule {
10495 pub fn new() -> Self {
10496 std::default::Default::default()
10497 }
10498
10499 /// Sets the value of [field_actions][crate::model::restore_config::TransformationRule::field_actions].
10500 ///
10501 /// # Example
10502 /// ```ignore,no_run
10503 /// # use google_cloud_gkebackup_v1::model::restore_config::TransformationRule;
10504 /// use google_cloud_gkebackup_v1::model::restore_config::TransformationRuleAction;
10505 /// let x = TransformationRule::new()
10506 /// .set_field_actions([
10507 /// TransformationRuleAction::default()/* use setters */,
10508 /// TransformationRuleAction::default()/* use (different) setters */,
10509 /// ]);
10510 /// ```
10511 pub fn set_field_actions<T, V>(mut self, v: T) -> Self
10512 where
10513 T: std::iter::IntoIterator<Item = V>,
10514 V: std::convert::Into<crate::model::restore_config::TransformationRuleAction>,
10515 {
10516 use std::iter::Iterator;
10517 self.field_actions = v.into_iter().map(|i| i.into()).collect();
10518 self
10519 }
10520
10521 /// Sets the value of [resource_filter][crate::model::restore_config::TransformationRule::resource_filter].
10522 ///
10523 /// # Example
10524 /// ```ignore,no_run
10525 /// # use google_cloud_gkebackup_v1::model::restore_config::TransformationRule;
10526 /// use google_cloud_gkebackup_v1::model::restore_config::ResourceFilter;
10527 /// let x = TransformationRule::new().set_resource_filter(ResourceFilter::default()/* use setters */);
10528 /// ```
10529 pub fn set_resource_filter<T>(mut self, v: T) -> Self
10530 where
10531 T: std::convert::Into<crate::model::restore_config::ResourceFilter>,
10532 {
10533 self.resource_filter = std::option::Option::Some(v.into());
10534 self
10535 }
10536
10537 /// Sets or clears the value of [resource_filter][crate::model::restore_config::TransformationRule::resource_filter].
10538 ///
10539 /// # Example
10540 /// ```ignore,no_run
10541 /// # use google_cloud_gkebackup_v1::model::restore_config::TransformationRule;
10542 /// use google_cloud_gkebackup_v1::model::restore_config::ResourceFilter;
10543 /// let x = TransformationRule::new().set_or_clear_resource_filter(Some(ResourceFilter::default()/* use setters */));
10544 /// let x = TransformationRule::new().set_or_clear_resource_filter(None::<ResourceFilter>);
10545 /// ```
10546 pub fn set_or_clear_resource_filter<T>(mut self, v: std::option::Option<T>) -> Self
10547 where
10548 T: std::convert::Into<crate::model::restore_config::ResourceFilter>,
10549 {
10550 self.resource_filter = v.map(|x| x.into());
10551 self
10552 }
10553
10554 /// Sets the value of [description][crate::model::restore_config::TransformationRule::description].
10555 ///
10556 /// # Example
10557 /// ```ignore,no_run
10558 /// # use google_cloud_gkebackup_v1::model::restore_config::TransformationRule;
10559 /// let x = TransformationRule::new().set_description("example");
10560 /// ```
10561 pub fn set_description<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
10562 self.description = v.into();
10563 self
10564 }
10565 }
10566
10567 impl wkt::message::Message for TransformationRule {
10568 fn typename() -> &'static str {
10569 "type.googleapis.com/google.cloud.gkebackup.v1.RestoreConfig.TransformationRule"
10570 }
10571 }
10572
10573 /// Binds resources in the scope to the given VolumeDataRestorePolicy.
10574 #[derive(Clone, Default, PartialEq)]
10575 #[non_exhaustive]
10576 pub struct VolumeDataRestorePolicyBinding {
10577 /// Required. The VolumeDataRestorePolicy to apply when restoring volumes in
10578 /// scope.
10579 pub policy: crate::model::restore_config::VolumeDataRestorePolicy,
10580
10581 pub scope: std::option::Option<
10582 crate::model::restore_config::volume_data_restore_policy_binding::Scope,
10583 >,
10584
10585 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
10586 }
10587
10588 impl VolumeDataRestorePolicyBinding {
10589 pub fn new() -> Self {
10590 std::default::Default::default()
10591 }
10592
10593 /// Sets the value of [policy][crate::model::restore_config::VolumeDataRestorePolicyBinding::policy].
10594 ///
10595 /// # Example
10596 /// ```ignore,no_run
10597 /// # use google_cloud_gkebackup_v1::model::restore_config::VolumeDataRestorePolicyBinding;
10598 /// use google_cloud_gkebackup_v1::model::restore_config::VolumeDataRestorePolicy;
10599 /// let x0 = VolumeDataRestorePolicyBinding::new().set_policy(VolumeDataRestorePolicy::RestoreVolumeDataFromBackup);
10600 /// let x1 = VolumeDataRestorePolicyBinding::new().set_policy(VolumeDataRestorePolicy::ReuseVolumeHandleFromBackup);
10601 /// let x2 = VolumeDataRestorePolicyBinding::new().set_policy(VolumeDataRestorePolicy::NoVolumeDataRestoration);
10602 /// ```
10603 pub fn set_policy<
10604 T: std::convert::Into<crate::model::restore_config::VolumeDataRestorePolicy>,
10605 >(
10606 mut self,
10607 v: T,
10608 ) -> Self {
10609 self.policy = v.into();
10610 self
10611 }
10612
10613 /// Sets the value of [scope][crate::model::restore_config::VolumeDataRestorePolicyBinding::scope].
10614 ///
10615 /// Note that all the setters affecting `scope` are mutually
10616 /// exclusive.
10617 ///
10618 /// # Example
10619 /// ```ignore,no_run
10620 /// # use google_cloud_gkebackup_v1::model::restore_config::VolumeDataRestorePolicyBinding;
10621 /// use google_cloud_gkebackup_v1::model::volume_type_enum::VolumeType;
10622 /// let x0 = VolumeDataRestorePolicyBinding::new().set_scope(Some(
10623 /// google_cloud_gkebackup_v1::model::restore_config::volume_data_restore_policy_binding::Scope::VolumeType(VolumeType::GcePersistentDisk)));
10624 /// ```
10625 pub fn set_scope<
10626 T: std::convert::Into<
10627 std::option::Option<
10628 crate::model::restore_config::volume_data_restore_policy_binding::Scope,
10629 >,
10630 >,
10631 >(
10632 mut self,
10633 v: T,
10634 ) -> Self {
10635 self.scope = v.into();
10636 self
10637 }
10638
10639 /// The value of [scope][crate::model::restore_config::VolumeDataRestorePolicyBinding::scope]
10640 /// if it holds a `VolumeType`, `None` if the field is not set or
10641 /// holds a different branch.
10642 pub fn volume_type(
10643 &self,
10644 ) -> std::option::Option<&crate::model::volume_type_enum::VolumeType> {
10645 #[allow(unreachable_patterns)]
10646 self.scope.as_ref().and_then(|v| match v {
10647 crate::model::restore_config::volume_data_restore_policy_binding::Scope::VolumeType(v) => std::option::Option::Some(v),
10648 _ => std::option::Option::None,
10649 })
10650 }
10651
10652 /// Sets the value of [scope][crate::model::restore_config::VolumeDataRestorePolicyBinding::scope]
10653 /// to hold a `VolumeType`.
10654 ///
10655 /// Note that all the setters affecting `scope` are
10656 /// mutually exclusive.
10657 ///
10658 /// # Example
10659 /// ```ignore,no_run
10660 /// # use google_cloud_gkebackup_v1::model::restore_config::VolumeDataRestorePolicyBinding;
10661 /// use google_cloud_gkebackup_v1::model::volume_type_enum::VolumeType;
10662 /// let x0 = VolumeDataRestorePolicyBinding::new().set_volume_type(VolumeType::GcePersistentDisk);
10663 /// assert!(x0.volume_type().is_some());
10664 /// ```
10665 pub fn set_volume_type<
10666 T: std::convert::Into<crate::model::volume_type_enum::VolumeType>,
10667 >(
10668 mut self,
10669 v: T,
10670 ) -> Self {
10671 self.scope = std::option::Option::Some(
10672 crate::model::restore_config::volume_data_restore_policy_binding::Scope::VolumeType(
10673 v.into(),
10674 ),
10675 );
10676 self
10677 }
10678 }
10679
10680 impl wkt::message::Message for VolumeDataRestorePolicyBinding {
10681 fn typename() -> &'static str {
10682 "type.googleapis.com/google.cloud.gkebackup.v1.RestoreConfig.VolumeDataRestorePolicyBinding"
10683 }
10684 }
10685
10686 /// Defines additional types related to [VolumeDataRestorePolicyBinding].
10687 pub mod volume_data_restore_policy_binding {
10688 #[allow(unused_imports)]
10689 use super::*;
10690
10691 #[derive(Clone, Debug, PartialEq)]
10692 #[non_exhaustive]
10693 pub enum Scope {
10694 /// The volume type, as determined by the PVC's bound PV,
10695 /// to apply the policy to.
10696 VolumeType(crate::model::volume_type_enum::VolumeType),
10697 }
10698 }
10699
10700 /// Allows customers to specify dependencies between resources
10701 /// that Backup for GKE can use to compute a resasonable restore order.
10702 #[derive(Clone, Default, PartialEq)]
10703 #[non_exhaustive]
10704 pub struct RestoreOrder {
10705 /// Optional. Contains a list of group kind dependency pairs provided
10706 /// by the customer, that is used by Backup for GKE to
10707 /// generate a group kind restore order.
10708 pub group_kind_dependencies:
10709 std::vec::Vec<crate::model::restore_config::restore_order::GroupKindDependency>,
10710
10711 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
10712 }
10713
10714 impl RestoreOrder {
10715 pub fn new() -> Self {
10716 std::default::Default::default()
10717 }
10718
10719 /// Sets the value of [group_kind_dependencies][crate::model::restore_config::RestoreOrder::group_kind_dependencies].
10720 ///
10721 /// # Example
10722 /// ```ignore,no_run
10723 /// # use google_cloud_gkebackup_v1::model::restore_config::RestoreOrder;
10724 /// use google_cloud_gkebackup_v1::model::restore_config::restore_order::GroupKindDependency;
10725 /// let x = RestoreOrder::new()
10726 /// .set_group_kind_dependencies([
10727 /// GroupKindDependency::default()/* use setters */,
10728 /// GroupKindDependency::default()/* use (different) setters */,
10729 /// ]);
10730 /// ```
10731 pub fn set_group_kind_dependencies<T, V>(mut self, v: T) -> Self
10732 where
10733 T: std::iter::IntoIterator<Item = V>,
10734 V: std::convert::Into<crate::model::restore_config::restore_order::GroupKindDependency>,
10735 {
10736 use std::iter::Iterator;
10737 self.group_kind_dependencies = v.into_iter().map(|i| i.into()).collect();
10738 self
10739 }
10740 }
10741
10742 impl wkt::message::Message for RestoreOrder {
10743 fn typename() -> &'static str {
10744 "type.googleapis.com/google.cloud.gkebackup.v1.RestoreConfig.RestoreOrder"
10745 }
10746 }
10747
10748 /// Defines additional types related to [RestoreOrder].
10749 pub mod restore_order {
10750 #[allow(unused_imports)]
10751 use super::*;
10752
10753 /// Defines a dependency between two group kinds.
10754 #[derive(Clone, Default, PartialEq)]
10755 #[non_exhaustive]
10756 pub struct GroupKindDependency {
10757 /// Required. The satisfying group kind must be restored first
10758 /// in order to satisfy the dependency.
10759 pub satisfying: std::option::Option<crate::model::restore_config::GroupKind>,
10760
10761 /// Required. The requiring group kind requires that the other
10762 /// group kind be restored first.
10763 pub requiring: std::option::Option<crate::model::restore_config::GroupKind>,
10764
10765 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
10766 }
10767
10768 impl GroupKindDependency {
10769 pub fn new() -> Self {
10770 std::default::Default::default()
10771 }
10772
10773 /// Sets the value of [satisfying][crate::model::restore_config::restore_order::GroupKindDependency::satisfying].
10774 ///
10775 /// # Example
10776 /// ```ignore,no_run
10777 /// # use google_cloud_gkebackup_v1::model::restore_config::restore_order::GroupKindDependency;
10778 /// use google_cloud_gkebackup_v1::model::restore_config::GroupKind;
10779 /// let x = GroupKindDependency::new().set_satisfying(GroupKind::default()/* use setters */);
10780 /// ```
10781 pub fn set_satisfying<T>(mut self, v: T) -> Self
10782 where
10783 T: std::convert::Into<crate::model::restore_config::GroupKind>,
10784 {
10785 self.satisfying = std::option::Option::Some(v.into());
10786 self
10787 }
10788
10789 /// Sets or clears the value of [satisfying][crate::model::restore_config::restore_order::GroupKindDependency::satisfying].
10790 ///
10791 /// # Example
10792 /// ```ignore,no_run
10793 /// # use google_cloud_gkebackup_v1::model::restore_config::restore_order::GroupKindDependency;
10794 /// use google_cloud_gkebackup_v1::model::restore_config::GroupKind;
10795 /// let x = GroupKindDependency::new().set_or_clear_satisfying(Some(GroupKind::default()/* use setters */));
10796 /// let x = GroupKindDependency::new().set_or_clear_satisfying(None::<GroupKind>);
10797 /// ```
10798 pub fn set_or_clear_satisfying<T>(mut self, v: std::option::Option<T>) -> Self
10799 where
10800 T: std::convert::Into<crate::model::restore_config::GroupKind>,
10801 {
10802 self.satisfying = v.map(|x| x.into());
10803 self
10804 }
10805
10806 /// Sets the value of [requiring][crate::model::restore_config::restore_order::GroupKindDependency::requiring].
10807 ///
10808 /// # Example
10809 /// ```ignore,no_run
10810 /// # use google_cloud_gkebackup_v1::model::restore_config::restore_order::GroupKindDependency;
10811 /// use google_cloud_gkebackup_v1::model::restore_config::GroupKind;
10812 /// let x = GroupKindDependency::new().set_requiring(GroupKind::default()/* use setters */);
10813 /// ```
10814 pub fn set_requiring<T>(mut self, v: T) -> Self
10815 where
10816 T: std::convert::Into<crate::model::restore_config::GroupKind>,
10817 {
10818 self.requiring = std::option::Option::Some(v.into());
10819 self
10820 }
10821
10822 /// Sets or clears the value of [requiring][crate::model::restore_config::restore_order::GroupKindDependency::requiring].
10823 ///
10824 /// # Example
10825 /// ```ignore,no_run
10826 /// # use google_cloud_gkebackup_v1::model::restore_config::restore_order::GroupKindDependency;
10827 /// use google_cloud_gkebackup_v1::model::restore_config::GroupKind;
10828 /// let x = GroupKindDependency::new().set_or_clear_requiring(Some(GroupKind::default()/* use setters */));
10829 /// let x = GroupKindDependency::new().set_or_clear_requiring(None::<GroupKind>);
10830 /// ```
10831 pub fn set_or_clear_requiring<T>(mut self, v: std::option::Option<T>) -> Self
10832 where
10833 T: std::convert::Into<crate::model::restore_config::GroupKind>,
10834 {
10835 self.requiring = v.map(|x| x.into());
10836 self
10837 }
10838 }
10839
10840 impl wkt::message::Message for GroupKindDependency {
10841 fn typename() -> &'static str {
10842 "type.googleapis.com/google.cloud.gkebackup.v1.RestoreConfig.RestoreOrder.GroupKindDependency"
10843 }
10844 }
10845 }
10846
10847 /// Defines how volume data should be restored.
10848 ///
10849 /// # Working with unknown values
10850 ///
10851 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
10852 /// additional enum variants at any time. Adding new variants is not considered
10853 /// a breaking change. Applications should write their code in anticipation of:
10854 ///
10855 /// - New values appearing in future releases of the client library, **and**
10856 /// - New values received dynamically, without application changes.
10857 ///
10858 /// Please consult the [Working with enums] section in the user guide for some
10859 /// guidelines.
10860 ///
10861 /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
10862 #[derive(Clone, Debug, PartialEq)]
10863 #[non_exhaustive]
10864 pub enum VolumeDataRestorePolicy {
10865 /// Unspecified (illegal).
10866 Unspecified,
10867 /// For each PVC to be restored, create a new underlying volume and PV
10868 /// from the corresponding VolumeBackup contained within the Backup.
10869 RestoreVolumeDataFromBackup,
10870 /// For each PVC to be restored, attempt to reuse the original PV contained
10871 /// in the Backup (with its original underlying volume). This option
10872 /// is likely only usable when restoring a workload to its original cluster.
10873 ReuseVolumeHandleFromBackup,
10874 /// For each PVC to be restored, create PVC without any particular
10875 /// action to restore data. In this case, the normal Kubernetes provisioning
10876 /// logic would kick in, and this would likely result in either dynamically
10877 /// provisioning blank PVs or binding to statically provisioned PVs.
10878 NoVolumeDataRestoration,
10879 /// If set, the enum was initialized with an unknown value.
10880 ///
10881 /// Applications can examine the value using [VolumeDataRestorePolicy::value] or
10882 /// [VolumeDataRestorePolicy::name].
10883 UnknownValue(volume_data_restore_policy::UnknownValue),
10884 }
10885
10886 #[doc(hidden)]
10887 pub mod volume_data_restore_policy {
10888 #[allow(unused_imports)]
10889 use super::*;
10890 #[derive(Clone, Debug, PartialEq)]
10891 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
10892 }
10893
10894 impl VolumeDataRestorePolicy {
10895 /// Gets the enum value.
10896 ///
10897 /// Returns `None` if the enum contains an unknown value deserialized from
10898 /// the string representation of enums.
10899 pub fn value(&self) -> std::option::Option<i32> {
10900 match self {
10901 Self::Unspecified => std::option::Option::Some(0),
10902 Self::RestoreVolumeDataFromBackup => std::option::Option::Some(1),
10903 Self::ReuseVolumeHandleFromBackup => std::option::Option::Some(2),
10904 Self::NoVolumeDataRestoration => std::option::Option::Some(3),
10905 Self::UnknownValue(u) => u.0.value(),
10906 }
10907 }
10908
10909 /// Gets the enum value as a string.
10910 ///
10911 /// Returns `None` if the enum contains an unknown value deserialized from
10912 /// the integer representation of enums.
10913 pub fn name(&self) -> std::option::Option<&str> {
10914 match self {
10915 Self::Unspecified => {
10916 std::option::Option::Some("VOLUME_DATA_RESTORE_POLICY_UNSPECIFIED")
10917 }
10918 Self::RestoreVolumeDataFromBackup => {
10919 std::option::Option::Some("RESTORE_VOLUME_DATA_FROM_BACKUP")
10920 }
10921 Self::ReuseVolumeHandleFromBackup => {
10922 std::option::Option::Some("REUSE_VOLUME_HANDLE_FROM_BACKUP")
10923 }
10924 Self::NoVolumeDataRestoration => {
10925 std::option::Option::Some("NO_VOLUME_DATA_RESTORATION")
10926 }
10927 Self::UnknownValue(u) => u.0.name(),
10928 }
10929 }
10930 }
10931
10932 impl std::default::Default for VolumeDataRestorePolicy {
10933 fn default() -> Self {
10934 use std::convert::From;
10935 Self::from(0)
10936 }
10937 }
10938
10939 impl std::fmt::Display for VolumeDataRestorePolicy {
10940 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
10941 wkt::internal::display_enum(f, self.name(), self.value())
10942 }
10943 }
10944
10945 impl std::convert::From<i32> for VolumeDataRestorePolicy {
10946 fn from(value: i32) -> Self {
10947 match value {
10948 0 => Self::Unspecified,
10949 1 => Self::RestoreVolumeDataFromBackup,
10950 2 => Self::ReuseVolumeHandleFromBackup,
10951 3 => Self::NoVolumeDataRestoration,
10952 _ => Self::UnknownValue(volume_data_restore_policy::UnknownValue(
10953 wkt::internal::UnknownEnumValue::Integer(value),
10954 )),
10955 }
10956 }
10957 }
10958
10959 impl std::convert::From<&str> for VolumeDataRestorePolicy {
10960 fn from(value: &str) -> Self {
10961 use std::string::ToString;
10962 match value {
10963 "VOLUME_DATA_RESTORE_POLICY_UNSPECIFIED" => Self::Unspecified,
10964 "RESTORE_VOLUME_DATA_FROM_BACKUP" => Self::RestoreVolumeDataFromBackup,
10965 "REUSE_VOLUME_HANDLE_FROM_BACKUP" => Self::ReuseVolumeHandleFromBackup,
10966 "NO_VOLUME_DATA_RESTORATION" => Self::NoVolumeDataRestoration,
10967 _ => Self::UnknownValue(volume_data_restore_policy::UnknownValue(
10968 wkt::internal::UnknownEnumValue::String(value.to_string()),
10969 )),
10970 }
10971 }
10972 }
10973
10974 impl serde::ser::Serialize for VolumeDataRestorePolicy {
10975 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
10976 where
10977 S: serde::Serializer,
10978 {
10979 match self {
10980 Self::Unspecified => serializer.serialize_i32(0),
10981 Self::RestoreVolumeDataFromBackup => serializer.serialize_i32(1),
10982 Self::ReuseVolumeHandleFromBackup => serializer.serialize_i32(2),
10983 Self::NoVolumeDataRestoration => serializer.serialize_i32(3),
10984 Self::UnknownValue(u) => u.0.serialize(serializer),
10985 }
10986 }
10987 }
10988
10989 impl<'de> serde::de::Deserialize<'de> for VolumeDataRestorePolicy {
10990 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
10991 where
10992 D: serde::Deserializer<'de>,
10993 {
10994 deserializer.deserialize_any(
10995 wkt::internal::EnumVisitor::<VolumeDataRestorePolicy>::new(
10996 ".google.cloud.gkebackup.v1.RestoreConfig.VolumeDataRestorePolicy",
10997 ),
10998 )
10999 }
11000 }
11001
11002 /// Defines the behavior for handling the situation where cluster-scoped
11003 /// resources being restored already exist in the target cluster.
11004 ///
11005 /// # Working with unknown values
11006 ///
11007 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
11008 /// additional enum variants at any time. Adding new variants is not considered
11009 /// a breaking change. Applications should write their code in anticipation of:
11010 ///
11011 /// - New values appearing in future releases of the client library, **and**
11012 /// - New values received dynamically, without application changes.
11013 ///
11014 /// Please consult the [Working with enums] section in the user guide for some
11015 /// guidelines.
11016 ///
11017 /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
11018 #[derive(Clone, Debug, PartialEq)]
11019 #[non_exhaustive]
11020 pub enum ClusterResourceConflictPolicy {
11021 /// Unspecified. Only allowed if no cluster-scoped resources will be
11022 /// restored.
11023 Unspecified,
11024 /// Do not attempt to restore the conflicting resource.
11025 UseExistingVersion,
11026 /// Delete the existing version before re-creating it from the Backup.
11027 /// This is a dangerous option which could cause unintentional
11028 /// data loss if used inappropriately. For example, deleting a CRD will
11029 /// cause Kubernetes to delete all CRs of that type.
11030 UseBackupVersion,
11031 /// If set, the enum was initialized with an unknown value.
11032 ///
11033 /// Applications can examine the value using [ClusterResourceConflictPolicy::value] or
11034 /// [ClusterResourceConflictPolicy::name].
11035 UnknownValue(cluster_resource_conflict_policy::UnknownValue),
11036 }
11037
11038 #[doc(hidden)]
11039 pub mod cluster_resource_conflict_policy {
11040 #[allow(unused_imports)]
11041 use super::*;
11042 #[derive(Clone, Debug, PartialEq)]
11043 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
11044 }
11045
11046 impl ClusterResourceConflictPolicy {
11047 /// Gets the enum value.
11048 ///
11049 /// Returns `None` if the enum contains an unknown value deserialized from
11050 /// the string representation of enums.
11051 pub fn value(&self) -> std::option::Option<i32> {
11052 match self {
11053 Self::Unspecified => std::option::Option::Some(0),
11054 Self::UseExistingVersion => std::option::Option::Some(1),
11055 Self::UseBackupVersion => std::option::Option::Some(2),
11056 Self::UnknownValue(u) => u.0.value(),
11057 }
11058 }
11059
11060 /// Gets the enum value as a string.
11061 ///
11062 /// Returns `None` if the enum contains an unknown value deserialized from
11063 /// the integer representation of enums.
11064 pub fn name(&self) -> std::option::Option<&str> {
11065 match self {
11066 Self::Unspecified => {
11067 std::option::Option::Some("CLUSTER_RESOURCE_CONFLICT_POLICY_UNSPECIFIED")
11068 }
11069 Self::UseExistingVersion => std::option::Option::Some("USE_EXISTING_VERSION"),
11070 Self::UseBackupVersion => std::option::Option::Some("USE_BACKUP_VERSION"),
11071 Self::UnknownValue(u) => u.0.name(),
11072 }
11073 }
11074 }
11075
11076 impl std::default::Default for ClusterResourceConflictPolicy {
11077 fn default() -> Self {
11078 use std::convert::From;
11079 Self::from(0)
11080 }
11081 }
11082
11083 impl std::fmt::Display for ClusterResourceConflictPolicy {
11084 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
11085 wkt::internal::display_enum(f, self.name(), self.value())
11086 }
11087 }
11088
11089 impl std::convert::From<i32> for ClusterResourceConflictPolicy {
11090 fn from(value: i32) -> Self {
11091 match value {
11092 0 => Self::Unspecified,
11093 1 => Self::UseExistingVersion,
11094 2 => Self::UseBackupVersion,
11095 _ => Self::UnknownValue(cluster_resource_conflict_policy::UnknownValue(
11096 wkt::internal::UnknownEnumValue::Integer(value),
11097 )),
11098 }
11099 }
11100 }
11101
11102 impl std::convert::From<&str> for ClusterResourceConflictPolicy {
11103 fn from(value: &str) -> Self {
11104 use std::string::ToString;
11105 match value {
11106 "CLUSTER_RESOURCE_CONFLICT_POLICY_UNSPECIFIED" => Self::Unspecified,
11107 "USE_EXISTING_VERSION" => Self::UseExistingVersion,
11108 "USE_BACKUP_VERSION" => Self::UseBackupVersion,
11109 _ => Self::UnknownValue(cluster_resource_conflict_policy::UnknownValue(
11110 wkt::internal::UnknownEnumValue::String(value.to_string()),
11111 )),
11112 }
11113 }
11114 }
11115
11116 impl serde::ser::Serialize for ClusterResourceConflictPolicy {
11117 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
11118 where
11119 S: serde::Serializer,
11120 {
11121 match self {
11122 Self::Unspecified => serializer.serialize_i32(0),
11123 Self::UseExistingVersion => serializer.serialize_i32(1),
11124 Self::UseBackupVersion => serializer.serialize_i32(2),
11125 Self::UnknownValue(u) => u.0.serialize(serializer),
11126 }
11127 }
11128 }
11129
11130 impl<'de> serde::de::Deserialize<'de> for ClusterResourceConflictPolicy {
11131 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
11132 where
11133 D: serde::Deserializer<'de>,
11134 {
11135 deserializer.deserialize_any(
11136 wkt::internal::EnumVisitor::<ClusterResourceConflictPolicy>::new(
11137 ".google.cloud.gkebackup.v1.RestoreConfig.ClusterResourceConflictPolicy",
11138 ),
11139 )
11140 }
11141 }
11142
11143 /// Defines the behavior for handling the situation where sets of namespaced
11144 /// resources being restored already exist in the target cluster.
11145 ///
11146 /// # Working with unknown values
11147 ///
11148 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
11149 /// additional enum variants at any time. Adding new variants is not considered
11150 /// a breaking change. Applications should write their code in anticipation of:
11151 ///
11152 /// - New values appearing in future releases of the client library, **and**
11153 /// - New values received dynamically, without application changes.
11154 ///
11155 /// Please consult the [Working with enums] section in the user guide for some
11156 /// guidelines.
11157 ///
11158 /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
11159 #[derive(Clone, Debug, PartialEq)]
11160 #[non_exhaustive]
11161 pub enum NamespacedResourceRestoreMode {
11162 /// Unspecified (invalid).
11163 Unspecified,
11164 /// When conflicting top-level resources (either Namespaces or
11165 /// ProtectedApplications, depending upon the scope) are encountered, this
11166 /// will first trigger a delete of the conflicting resource AND ALL OF ITS
11167 /// REFERENCED RESOURCES (e.g., all resources in the Namespace or all
11168 /// resources referenced by the ProtectedApplication) before restoring the
11169 /// resources from the Backup. This mode should only be used when you are
11170 /// intending to revert some portion of a cluster to an earlier state.
11171 DeleteAndRestore,
11172 /// If conflicting top-level resources (either Namespaces or
11173 /// ProtectedApplications, depending upon the scope) are encountered at the
11174 /// beginning of a restore process, the Restore will fail. If a conflict
11175 /// occurs during the restore process itself (e.g., because an out of band
11176 /// process creates conflicting resources), a conflict will be reported.
11177 FailOnConflict,
11178 /// This mode merges the backup and the target cluster and skips the
11179 /// conflicting resources. If a single resource to restore exists in the
11180 /// cluster before restoration, the resource will be skipped, otherwise it
11181 /// will be restored.
11182 MergeSkipOnConflict,
11183 /// This mode merges the backup and the target cluster and skips the
11184 /// conflicting resources except volume data. If a PVC to restore already
11185 /// exists, this mode will restore/reconnect the volume without overwriting
11186 /// the PVC. It is similar to MERGE_SKIP_ON_CONFLICT except that it will
11187 /// apply the volume data policy for the conflicting PVCs:
11188 ///
11189 /// - RESTORE_VOLUME_DATA_FROM_BACKUP: restore data only and respect the
11190 /// reclaim policy of the original PV;
11191 /// - REUSE_VOLUME_HANDLE_FROM_BACKUP: reconnect and respect the reclaim
11192 /// policy of the original PV;
11193 /// - NO_VOLUME_DATA_RESTORATION: new provision and respect the reclaim
11194 /// policy of the original PV.
11195 /// Note that this mode could cause data loss as the original PV can be
11196 /// retained or deleted depending on its reclaim policy.
11197 MergeReplaceVolumeOnConflict,
11198 /// This mode merges the backup and the target cluster and replaces the
11199 /// conflicting resources with the ones in the backup. If a single resource
11200 /// to restore exists in the cluster before restoration, the resource will be
11201 /// replaced with the one from the backup. To replace an existing resource,
11202 /// the first attempt is to update the resource to match the one from the
11203 /// backup; if the update fails, the second attempt is to delete the resource
11204 /// and restore it from the backup.
11205 /// Note that this mode could cause data loss as it replaces the existing
11206 /// resources in the target cluster, and the original PV can be retained or
11207 /// deleted depending on its reclaim policy.
11208 MergeReplaceOnConflict,
11209 /// If set, the enum was initialized with an unknown value.
11210 ///
11211 /// Applications can examine the value using [NamespacedResourceRestoreMode::value] or
11212 /// [NamespacedResourceRestoreMode::name].
11213 UnknownValue(namespaced_resource_restore_mode::UnknownValue),
11214 }
11215
11216 #[doc(hidden)]
11217 pub mod namespaced_resource_restore_mode {
11218 #[allow(unused_imports)]
11219 use super::*;
11220 #[derive(Clone, Debug, PartialEq)]
11221 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
11222 }
11223
11224 impl NamespacedResourceRestoreMode {
11225 /// Gets the enum value.
11226 ///
11227 /// Returns `None` if the enum contains an unknown value deserialized from
11228 /// the string representation of enums.
11229 pub fn value(&self) -> std::option::Option<i32> {
11230 match self {
11231 Self::Unspecified => std::option::Option::Some(0),
11232 Self::DeleteAndRestore => std::option::Option::Some(1),
11233 Self::FailOnConflict => std::option::Option::Some(2),
11234 Self::MergeSkipOnConflict => std::option::Option::Some(3),
11235 Self::MergeReplaceVolumeOnConflict => std::option::Option::Some(4),
11236 Self::MergeReplaceOnConflict => std::option::Option::Some(5),
11237 Self::UnknownValue(u) => u.0.value(),
11238 }
11239 }
11240
11241 /// Gets the enum value as a string.
11242 ///
11243 /// Returns `None` if the enum contains an unknown value deserialized from
11244 /// the integer representation of enums.
11245 pub fn name(&self) -> std::option::Option<&str> {
11246 match self {
11247 Self::Unspecified => {
11248 std::option::Option::Some("NAMESPACED_RESOURCE_RESTORE_MODE_UNSPECIFIED")
11249 }
11250 Self::DeleteAndRestore => std::option::Option::Some("DELETE_AND_RESTORE"),
11251 Self::FailOnConflict => std::option::Option::Some("FAIL_ON_CONFLICT"),
11252 Self::MergeSkipOnConflict => std::option::Option::Some("MERGE_SKIP_ON_CONFLICT"),
11253 Self::MergeReplaceVolumeOnConflict => {
11254 std::option::Option::Some("MERGE_REPLACE_VOLUME_ON_CONFLICT")
11255 }
11256 Self::MergeReplaceOnConflict => {
11257 std::option::Option::Some("MERGE_REPLACE_ON_CONFLICT")
11258 }
11259 Self::UnknownValue(u) => u.0.name(),
11260 }
11261 }
11262 }
11263
11264 impl std::default::Default for NamespacedResourceRestoreMode {
11265 fn default() -> Self {
11266 use std::convert::From;
11267 Self::from(0)
11268 }
11269 }
11270
11271 impl std::fmt::Display for NamespacedResourceRestoreMode {
11272 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
11273 wkt::internal::display_enum(f, self.name(), self.value())
11274 }
11275 }
11276
11277 impl std::convert::From<i32> for NamespacedResourceRestoreMode {
11278 fn from(value: i32) -> Self {
11279 match value {
11280 0 => Self::Unspecified,
11281 1 => Self::DeleteAndRestore,
11282 2 => Self::FailOnConflict,
11283 3 => Self::MergeSkipOnConflict,
11284 4 => Self::MergeReplaceVolumeOnConflict,
11285 5 => Self::MergeReplaceOnConflict,
11286 _ => Self::UnknownValue(namespaced_resource_restore_mode::UnknownValue(
11287 wkt::internal::UnknownEnumValue::Integer(value),
11288 )),
11289 }
11290 }
11291 }
11292
11293 impl std::convert::From<&str> for NamespacedResourceRestoreMode {
11294 fn from(value: &str) -> Self {
11295 use std::string::ToString;
11296 match value {
11297 "NAMESPACED_RESOURCE_RESTORE_MODE_UNSPECIFIED" => Self::Unspecified,
11298 "DELETE_AND_RESTORE" => Self::DeleteAndRestore,
11299 "FAIL_ON_CONFLICT" => Self::FailOnConflict,
11300 "MERGE_SKIP_ON_CONFLICT" => Self::MergeSkipOnConflict,
11301 "MERGE_REPLACE_VOLUME_ON_CONFLICT" => Self::MergeReplaceVolumeOnConflict,
11302 "MERGE_REPLACE_ON_CONFLICT" => Self::MergeReplaceOnConflict,
11303 _ => Self::UnknownValue(namespaced_resource_restore_mode::UnknownValue(
11304 wkt::internal::UnknownEnumValue::String(value.to_string()),
11305 )),
11306 }
11307 }
11308 }
11309
11310 impl serde::ser::Serialize for NamespacedResourceRestoreMode {
11311 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
11312 where
11313 S: serde::Serializer,
11314 {
11315 match self {
11316 Self::Unspecified => serializer.serialize_i32(0),
11317 Self::DeleteAndRestore => serializer.serialize_i32(1),
11318 Self::FailOnConflict => serializer.serialize_i32(2),
11319 Self::MergeSkipOnConflict => serializer.serialize_i32(3),
11320 Self::MergeReplaceVolumeOnConflict => serializer.serialize_i32(4),
11321 Self::MergeReplaceOnConflict => serializer.serialize_i32(5),
11322 Self::UnknownValue(u) => u.0.serialize(serializer),
11323 }
11324 }
11325 }
11326
11327 impl<'de> serde::de::Deserialize<'de> for NamespacedResourceRestoreMode {
11328 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
11329 where
11330 D: serde::Deserializer<'de>,
11331 {
11332 deserializer.deserialize_any(
11333 wkt::internal::EnumVisitor::<NamespacedResourceRestoreMode>::new(
11334 ".google.cloud.gkebackup.v1.RestoreConfig.NamespacedResourceRestoreMode",
11335 ),
11336 )
11337 }
11338 }
11339
11340 /// Specifies the namespaced resources to restore from the Backup.
11341 /// Only one of the entries may be specified. If not specified, NO namespaced
11342 /// resources will be restored.
11343 ///
11344 /// Note: Resources will never be restored into *managed* namespaces such as
11345 /// `kube-system`, `kube-public`, or `kube-node-lease`. These namespaces
11346 /// are silently skipped when
11347 /// [all_namespaces][google.cloud.gkebackup.v1.RestoreConfig.all_namespaces] is
11348 /// selected. Listing them explicitly will result in an error.
11349 ///
11350 /// [google.cloud.gkebackup.v1.RestoreConfig.all_namespaces]: crate::model::RestoreConfig::namespaced_resource_restore_scope
11351 #[derive(Clone, Debug, PartialEq)]
11352 #[non_exhaustive]
11353 pub enum NamespacedResourceRestoreScope {
11354 /// Restore all namespaced resources in the Backup if set to "True".
11355 /// Specifying this field to "False" is an error.
11356 AllNamespaces(bool),
11357 /// A list of selected Namespaces to restore from the Backup. The listed
11358 /// Namespaces and all resources contained in them will be restored.
11359 SelectedNamespaces(std::boxed::Box<crate::model::Namespaces>),
11360 /// A list of selected ProtectedApplications to restore. The listed
11361 /// ProtectedApplications and all the resources to which they refer will be
11362 /// restored.
11363 SelectedApplications(std::boxed::Box<crate::model::NamespacedNames>),
11364 /// Do not restore any namespaced resources if set to "True".
11365 /// Specifying this field to "False" is not allowed.
11366 NoNamespaces(bool),
11367 /// A list of selected namespaces excluded from restoration. All
11368 /// namespaces except those in this list will be restored.
11369 ExcludedNamespaces(std::boxed::Box<crate::model::Namespaces>),
11370 }
11371}
11372
11373/// Defines a selector to identify a single or a group of resources.
11374/// Conditions in the selector are optional, but at least one field
11375/// should be set to a non-empty value. If a condition is not specified,
11376/// no restrictions will be applied on that dimension.
11377/// If more than one condition is specified, a resource will be selected
11378/// if and only if all conditions are met.
11379#[derive(Clone, Default, PartialEq)]
11380#[non_exhaustive]
11381pub struct ResourceSelector {
11382 /// Optional. Selects resources using their Kubernetes GroupKinds. If
11383 /// specified, only resources of provided GroupKind will be selected.
11384 pub group_kind: std::option::Option<crate::model::restore_config::GroupKind>,
11385
11386 /// Optional. Selects resources using their resource names. If specified,
11387 /// only resources with the provided name will be selected.
11388 pub name: std::string::String,
11389
11390 /// Optional. Selects resources using their namespaces. This only applies to
11391 /// namespace scoped resources and cannot be used for selecting
11392 /// cluster scoped resources. If specified, only resources in the provided
11393 /// namespace will be selected. If not specified, the filter will apply to
11394 /// both cluster scoped and namespace scoped resources (e.g. name or label).
11395 /// The [Namespace](https://pkg.go.dev/k8s.io/api/core/v1#Namespace) resource
11396 /// itself will be restored if and only if any resources within the namespace
11397 /// are restored.
11398 pub namespace: std::string::String,
11399
11400 /// Optional. Selects resources using Kubernetes
11401 /// [labels](https://kubernetes.io/docs/concepts/overview/working-with-objects/labels/).
11402 /// If specified, a resource will be selected if and only if the resource
11403 /// has all of the provided labels and all the label values match.
11404 pub labels: std::collections::HashMap<std::string::String, std::string::String>,
11405
11406 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
11407}
11408
11409impl ResourceSelector {
11410 pub fn new() -> Self {
11411 std::default::Default::default()
11412 }
11413
11414 /// Sets the value of [group_kind][crate::model::ResourceSelector::group_kind].
11415 ///
11416 /// # Example
11417 /// ```ignore,no_run
11418 /// # use google_cloud_gkebackup_v1::model::ResourceSelector;
11419 /// use google_cloud_gkebackup_v1::model::restore_config::GroupKind;
11420 /// let x = ResourceSelector::new().set_group_kind(GroupKind::default()/* use setters */);
11421 /// ```
11422 pub fn set_group_kind<T>(mut self, v: T) -> Self
11423 where
11424 T: std::convert::Into<crate::model::restore_config::GroupKind>,
11425 {
11426 self.group_kind = std::option::Option::Some(v.into());
11427 self
11428 }
11429
11430 /// Sets or clears the value of [group_kind][crate::model::ResourceSelector::group_kind].
11431 ///
11432 /// # Example
11433 /// ```ignore,no_run
11434 /// # use google_cloud_gkebackup_v1::model::ResourceSelector;
11435 /// use google_cloud_gkebackup_v1::model::restore_config::GroupKind;
11436 /// let x = ResourceSelector::new().set_or_clear_group_kind(Some(GroupKind::default()/* use setters */));
11437 /// let x = ResourceSelector::new().set_or_clear_group_kind(None::<GroupKind>);
11438 /// ```
11439 pub fn set_or_clear_group_kind<T>(mut self, v: std::option::Option<T>) -> Self
11440 where
11441 T: std::convert::Into<crate::model::restore_config::GroupKind>,
11442 {
11443 self.group_kind = v.map(|x| x.into());
11444 self
11445 }
11446
11447 /// Sets the value of [name][crate::model::ResourceSelector::name].
11448 ///
11449 /// # Example
11450 /// ```ignore,no_run
11451 /// # use google_cloud_gkebackup_v1::model::ResourceSelector;
11452 /// let x = ResourceSelector::new().set_name("example");
11453 /// ```
11454 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
11455 self.name = v.into();
11456 self
11457 }
11458
11459 /// Sets the value of [namespace][crate::model::ResourceSelector::namespace].
11460 ///
11461 /// # Example
11462 /// ```ignore,no_run
11463 /// # use google_cloud_gkebackup_v1::model::ResourceSelector;
11464 /// let x = ResourceSelector::new().set_namespace("example");
11465 /// ```
11466 pub fn set_namespace<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
11467 self.namespace = v.into();
11468 self
11469 }
11470
11471 /// Sets the value of [labels][crate::model::ResourceSelector::labels].
11472 ///
11473 /// # Example
11474 /// ```ignore,no_run
11475 /// # use google_cloud_gkebackup_v1::model::ResourceSelector;
11476 /// let x = ResourceSelector::new().set_labels([
11477 /// ("key0", "abc"),
11478 /// ("key1", "xyz"),
11479 /// ]);
11480 /// ```
11481 pub fn set_labels<T, K, V>(mut self, v: T) -> Self
11482 where
11483 T: std::iter::IntoIterator<Item = (K, V)>,
11484 K: std::convert::Into<std::string::String>,
11485 V: std::convert::Into<std::string::String>,
11486 {
11487 use std::iter::Iterator;
11488 self.labels = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
11489 self
11490 }
11491}
11492
11493impl wkt::message::Message for ResourceSelector {
11494 fn typename() -> &'static str {
11495 "type.googleapis.com/google.cloud.gkebackup.v1.ResourceSelector"
11496 }
11497}
11498
11499/// Defines an override to apply a VolumeDataRestorePolicy for scoped resources.
11500#[derive(Clone, Default, PartialEq)]
11501#[non_exhaustive]
11502pub struct VolumeDataRestorePolicyOverride {
11503 /// Required. The VolumeDataRestorePolicy to apply when restoring volumes in
11504 /// scope.
11505 pub policy: crate::model::restore_config::VolumeDataRestorePolicy,
11506
11507 pub scope: std::option::Option<crate::model::volume_data_restore_policy_override::Scope>,
11508
11509 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
11510}
11511
11512impl VolumeDataRestorePolicyOverride {
11513 pub fn new() -> Self {
11514 std::default::Default::default()
11515 }
11516
11517 /// Sets the value of [policy][crate::model::VolumeDataRestorePolicyOverride::policy].
11518 ///
11519 /// # Example
11520 /// ```ignore,no_run
11521 /// # use google_cloud_gkebackup_v1::model::VolumeDataRestorePolicyOverride;
11522 /// use google_cloud_gkebackup_v1::model::restore_config::VolumeDataRestorePolicy;
11523 /// let x0 = VolumeDataRestorePolicyOverride::new().set_policy(VolumeDataRestorePolicy::RestoreVolumeDataFromBackup);
11524 /// let x1 = VolumeDataRestorePolicyOverride::new().set_policy(VolumeDataRestorePolicy::ReuseVolumeHandleFromBackup);
11525 /// let x2 = VolumeDataRestorePolicyOverride::new().set_policy(VolumeDataRestorePolicy::NoVolumeDataRestoration);
11526 /// ```
11527 pub fn set_policy<
11528 T: std::convert::Into<crate::model::restore_config::VolumeDataRestorePolicy>,
11529 >(
11530 mut self,
11531 v: T,
11532 ) -> Self {
11533 self.policy = v.into();
11534 self
11535 }
11536
11537 /// Sets the value of [scope][crate::model::VolumeDataRestorePolicyOverride::scope].
11538 ///
11539 /// Note that all the setters affecting `scope` are mutually
11540 /// exclusive.
11541 ///
11542 /// # Example
11543 /// ```ignore,no_run
11544 /// # use google_cloud_gkebackup_v1::model::VolumeDataRestorePolicyOverride;
11545 /// use google_cloud_gkebackup_v1::model::NamespacedNames;
11546 /// let x = VolumeDataRestorePolicyOverride::new().set_scope(Some(
11547 /// google_cloud_gkebackup_v1::model::volume_data_restore_policy_override::Scope::SelectedPvcs(NamespacedNames::default().into())));
11548 /// ```
11549 pub fn set_scope<
11550 T: std::convert::Into<
11551 std::option::Option<crate::model::volume_data_restore_policy_override::Scope>,
11552 >,
11553 >(
11554 mut self,
11555 v: T,
11556 ) -> Self {
11557 self.scope = v.into();
11558 self
11559 }
11560
11561 /// The value of [scope][crate::model::VolumeDataRestorePolicyOverride::scope]
11562 /// if it holds a `SelectedPvcs`, `None` if the field is not set or
11563 /// holds a different branch.
11564 pub fn selected_pvcs(
11565 &self,
11566 ) -> std::option::Option<&std::boxed::Box<crate::model::NamespacedNames>> {
11567 #[allow(unreachable_patterns)]
11568 self.scope.as_ref().and_then(|v| match v {
11569 crate::model::volume_data_restore_policy_override::Scope::SelectedPvcs(v) => {
11570 std::option::Option::Some(v)
11571 }
11572 _ => std::option::Option::None,
11573 })
11574 }
11575
11576 /// Sets the value of [scope][crate::model::VolumeDataRestorePolicyOverride::scope]
11577 /// to hold a `SelectedPvcs`.
11578 ///
11579 /// Note that all the setters affecting `scope` are
11580 /// mutually exclusive.
11581 ///
11582 /// # Example
11583 /// ```ignore,no_run
11584 /// # use google_cloud_gkebackup_v1::model::VolumeDataRestorePolicyOverride;
11585 /// use google_cloud_gkebackup_v1::model::NamespacedNames;
11586 /// let x = VolumeDataRestorePolicyOverride::new().set_selected_pvcs(NamespacedNames::default()/* use setters */);
11587 /// assert!(x.selected_pvcs().is_some());
11588 /// ```
11589 pub fn set_selected_pvcs<
11590 T: std::convert::Into<std::boxed::Box<crate::model::NamespacedNames>>,
11591 >(
11592 mut self,
11593 v: T,
11594 ) -> Self {
11595 self.scope = std::option::Option::Some(
11596 crate::model::volume_data_restore_policy_override::Scope::SelectedPvcs(v.into()),
11597 );
11598 self
11599 }
11600}
11601
11602impl wkt::message::Message for VolumeDataRestorePolicyOverride {
11603 fn typename() -> &'static str {
11604 "type.googleapis.com/google.cloud.gkebackup.v1.VolumeDataRestorePolicyOverride"
11605 }
11606}
11607
11608/// Defines additional types related to [VolumeDataRestorePolicyOverride].
11609pub mod volume_data_restore_policy_override {
11610 #[allow(unused_imports)]
11611 use super::*;
11612
11613 #[derive(Clone, Debug, PartialEq)]
11614 #[non_exhaustive]
11615 pub enum Scope {
11616 /// A list of PVCs to apply the policy override to.
11617 SelectedPvcs(std::boxed::Box<crate::model::NamespacedNames>),
11618 }
11619}
11620
11621/// A RestoreChannel imposes constraints on where backups can be restored.
11622/// The RestoreChannel should be in the same project and region
11623/// as the backups. The backups can only be restored in the
11624/// `destination_project`.
11625#[derive(Clone, Default, PartialEq)]
11626#[non_exhaustive]
11627pub struct RestoreChannel {
11628 /// Identifier. The fully qualified name of the RestoreChannel.
11629 /// `projects/*/locations/*/restoreChannels/*`
11630 pub name: std::string::String,
11631
11632 /// Required. Immutable. The project into which the backups will be restored.
11633 /// The format is `projects/{projectId}` or `projects/{projectNumber}`.
11634 pub destination_project: std::string::String,
11635
11636 /// Output only. Server generated global unique identifier of
11637 /// [UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier) format.
11638 pub uid: std::string::String,
11639
11640 /// Output only. The timestamp when this RestoreChannel was created.
11641 pub create_time: std::option::Option<wkt::Timestamp>,
11642
11643 /// Output only. The timestamp when this RestoreChannel was last updated.
11644 pub update_time: std::option::Option<wkt::Timestamp>,
11645
11646 /// Optional. A set of custom labels supplied by user.
11647 pub labels: std::collections::HashMap<std::string::String, std::string::String>,
11648
11649 /// Optional. User specified descriptive string for this RestoreChannel.
11650 pub description: std::string::String,
11651
11652 /// Output only. `etag` is used for optimistic concurrency control as a way to
11653 /// help prevent simultaneous updates of a RestoreChannel from overwriting each
11654 /// other. It is strongly suggested that systems make use of the 'etag' in the
11655 /// read-modify-write cycle to perform RestoreChannel updates in order to
11656 /// avoid race conditions: An `etag` is returned in the response to
11657 /// `GetRestoreChannel`, and systems are expected to put that etag in the
11658 /// request to `UpdateRestoreChannel` or `DeleteRestoreChannel` to
11659 /// ensure that their change will be applied to the same version of the
11660 /// resource.
11661 pub etag: std::string::String,
11662
11663 /// Output only. The project_id where backups will be restored.
11664 /// Example Project ID: "my-project-id".
11665 /// This will be an OUTPUT_ONLY field to return the project_id of the
11666 /// destination project.
11667 pub destination_project_id: std::string::String,
11668
11669 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
11670}
11671
11672impl RestoreChannel {
11673 pub fn new() -> Self {
11674 std::default::Default::default()
11675 }
11676
11677 /// Sets the value of [name][crate::model::RestoreChannel::name].
11678 ///
11679 /// # Example
11680 /// ```ignore,no_run
11681 /// # use google_cloud_gkebackup_v1::model::RestoreChannel;
11682 /// let x = RestoreChannel::new().set_name("example");
11683 /// ```
11684 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
11685 self.name = v.into();
11686 self
11687 }
11688
11689 /// Sets the value of [destination_project][crate::model::RestoreChannel::destination_project].
11690 ///
11691 /// # Example
11692 /// ```ignore,no_run
11693 /// # use google_cloud_gkebackup_v1::model::RestoreChannel;
11694 /// let x = RestoreChannel::new().set_destination_project("example");
11695 /// ```
11696 pub fn set_destination_project<T: std::convert::Into<std::string::String>>(
11697 mut self,
11698 v: T,
11699 ) -> Self {
11700 self.destination_project = v.into();
11701 self
11702 }
11703
11704 /// Sets the value of [uid][crate::model::RestoreChannel::uid].
11705 ///
11706 /// # Example
11707 /// ```ignore,no_run
11708 /// # use google_cloud_gkebackup_v1::model::RestoreChannel;
11709 /// let x = RestoreChannel::new().set_uid("example");
11710 /// ```
11711 pub fn set_uid<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
11712 self.uid = v.into();
11713 self
11714 }
11715
11716 /// Sets the value of [create_time][crate::model::RestoreChannel::create_time].
11717 ///
11718 /// # Example
11719 /// ```ignore,no_run
11720 /// # use google_cloud_gkebackup_v1::model::RestoreChannel;
11721 /// use wkt::Timestamp;
11722 /// let x = RestoreChannel::new().set_create_time(Timestamp::default()/* use setters */);
11723 /// ```
11724 pub fn set_create_time<T>(mut self, v: T) -> Self
11725 where
11726 T: std::convert::Into<wkt::Timestamp>,
11727 {
11728 self.create_time = std::option::Option::Some(v.into());
11729 self
11730 }
11731
11732 /// Sets or clears the value of [create_time][crate::model::RestoreChannel::create_time].
11733 ///
11734 /// # Example
11735 /// ```ignore,no_run
11736 /// # use google_cloud_gkebackup_v1::model::RestoreChannel;
11737 /// use wkt::Timestamp;
11738 /// let x = RestoreChannel::new().set_or_clear_create_time(Some(Timestamp::default()/* use setters */));
11739 /// let x = RestoreChannel::new().set_or_clear_create_time(None::<Timestamp>);
11740 /// ```
11741 pub fn set_or_clear_create_time<T>(mut self, v: std::option::Option<T>) -> Self
11742 where
11743 T: std::convert::Into<wkt::Timestamp>,
11744 {
11745 self.create_time = v.map(|x| x.into());
11746 self
11747 }
11748
11749 /// Sets the value of [update_time][crate::model::RestoreChannel::update_time].
11750 ///
11751 /// # Example
11752 /// ```ignore,no_run
11753 /// # use google_cloud_gkebackup_v1::model::RestoreChannel;
11754 /// use wkt::Timestamp;
11755 /// let x = RestoreChannel::new().set_update_time(Timestamp::default()/* use setters */);
11756 /// ```
11757 pub fn set_update_time<T>(mut self, v: T) -> Self
11758 where
11759 T: std::convert::Into<wkt::Timestamp>,
11760 {
11761 self.update_time = std::option::Option::Some(v.into());
11762 self
11763 }
11764
11765 /// Sets or clears the value of [update_time][crate::model::RestoreChannel::update_time].
11766 ///
11767 /// # Example
11768 /// ```ignore,no_run
11769 /// # use google_cloud_gkebackup_v1::model::RestoreChannel;
11770 /// use wkt::Timestamp;
11771 /// let x = RestoreChannel::new().set_or_clear_update_time(Some(Timestamp::default()/* use setters */));
11772 /// let x = RestoreChannel::new().set_or_clear_update_time(None::<Timestamp>);
11773 /// ```
11774 pub fn set_or_clear_update_time<T>(mut self, v: std::option::Option<T>) -> Self
11775 where
11776 T: std::convert::Into<wkt::Timestamp>,
11777 {
11778 self.update_time = v.map(|x| x.into());
11779 self
11780 }
11781
11782 /// Sets the value of [labels][crate::model::RestoreChannel::labels].
11783 ///
11784 /// # Example
11785 /// ```ignore,no_run
11786 /// # use google_cloud_gkebackup_v1::model::RestoreChannel;
11787 /// let x = RestoreChannel::new().set_labels([
11788 /// ("key0", "abc"),
11789 /// ("key1", "xyz"),
11790 /// ]);
11791 /// ```
11792 pub fn set_labels<T, K, V>(mut self, v: T) -> Self
11793 where
11794 T: std::iter::IntoIterator<Item = (K, V)>,
11795 K: std::convert::Into<std::string::String>,
11796 V: std::convert::Into<std::string::String>,
11797 {
11798 use std::iter::Iterator;
11799 self.labels = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
11800 self
11801 }
11802
11803 /// Sets the value of [description][crate::model::RestoreChannel::description].
11804 ///
11805 /// # Example
11806 /// ```ignore,no_run
11807 /// # use google_cloud_gkebackup_v1::model::RestoreChannel;
11808 /// let x = RestoreChannel::new().set_description("example");
11809 /// ```
11810 pub fn set_description<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
11811 self.description = v.into();
11812 self
11813 }
11814
11815 /// Sets the value of [etag][crate::model::RestoreChannel::etag].
11816 ///
11817 /// # Example
11818 /// ```ignore,no_run
11819 /// # use google_cloud_gkebackup_v1::model::RestoreChannel;
11820 /// let x = RestoreChannel::new().set_etag("example");
11821 /// ```
11822 pub fn set_etag<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
11823 self.etag = v.into();
11824 self
11825 }
11826
11827 /// Sets the value of [destination_project_id][crate::model::RestoreChannel::destination_project_id].
11828 ///
11829 /// # Example
11830 /// ```ignore,no_run
11831 /// # use google_cloud_gkebackup_v1::model::RestoreChannel;
11832 /// let x = RestoreChannel::new().set_destination_project_id("example");
11833 /// ```
11834 pub fn set_destination_project_id<T: std::convert::Into<std::string::String>>(
11835 mut self,
11836 v: T,
11837 ) -> Self {
11838 self.destination_project_id = v.into();
11839 self
11840 }
11841}
11842
11843impl wkt::message::Message for RestoreChannel {
11844 fn typename() -> &'static str {
11845 "type.googleapis.com/google.cloud.gkebackup.v1.RestoreChannel"
11846 }
11847}
11848
11849/// The configuration of a potential series of Restore operations to be performed
11850/// against Backups belong to a particular BackupPlan.
11851#[derive(Clone, Default, PartialEq)]
11852#[non_exhaustive]
11853pub struct RestorePlan {
11854 /// Output only. The full name of the RestorePlan resource.
11855 /// Format: `projects/*/locations/*/restorePlans/*`.
11856 pub name: std::string::String,
11857
11858 /// Output only. Server generated global unique identifier of
11859 /// [UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier) format.
11860 pub uid: std::string::String,
11861
11862 /// Output only. The timestamp when this RestorePlan resource was
11863 /// created.
11864 pub create_time: std::option::Option<wkt::Timestamp>,
11865
11866 /// Output only. The timestamp when this RestorePlan resource was last
11867 /// updated.
11868 pub update_time: std::option::Option<wkt::Timestamp>,
11869
11870 /// Optional. User specified descriptive string for this RestorePlan.
11871 pub description: std::string::String,
11872
11873 /// Required. Immutable. A reference to the
11874 /// [BackupPlan][google.cloud.gkebackup.v1.BackupPlan] from which Backups may
11875 /// be used as the source for Restores created via this RestorePlan. Format:
11876 /// `projects/*/locations/*/backupPlans/*`.
11877 ///
11878 /// [google.cloud.gkebackup.v1.BackupPlan]: crate::model::BackupPlan
11879 pub backup_plan: std::string::String,
11880
11881 /// Required. Immutable. The target cluster into which Restores created via
11882 /// this RestorePlan will restore data. NOTE: the cluster's region must be the
11883 /// same as the RestorePlan. Valid formats:
11884 ///
11885 /// - `projects/*/locations/*/clusters/*`
11886 /// - `projects/*/zones/*/clusters/*`
11887 pub cluster: std::string::String,
11888
11889 /// Required. Configuration of Restores created via this RestorePlan.
11890 pub restore_config: std::option::Option<crate::model::RestoreConfig>,
11891
11892 /// Optional. A set of custom labels supplied by user.
11893 pub labels: std::collections::HashMap<std::string::String, std::string::String>,
11894
11895 /// Output only. `etag` is used for optimistic concurrency control as a way to
11896 /// help prevent simultaneous updates of a restore from overwriting each other.
11897 /// It is strongly suggested that systems make use of the `etag` in the
11898 /// read-modify-write cycle to perform restore updates in order to avoid
11899 /// race conditions: An `etag` is returned in the response to `GetRestorePlan`,
11900 /// and systems are expected to put that etag in the request to
11901 /// `UpdateRestorePlan` or `DeleteRestorePlan` to ensure that their change
11902 /// will be applied to the same version of the resource.
11903 pub etag: std::string::String,
11904
11905 /// Output only. State of the RestorePlan. This State field reflects the
11906 /// various stages a RestorePlan can be in
11907 /// during the Create operation.
11908 pub state: crate::model::restore_plan::State,
11909
11910 /// Output only. Human-readable description of why RestorePlan is in the
11911 /// current `state`. This field is only meant for human readability and should
11912 /// not be used programmatically as this field is not guaranteed to be
11913 /// consistent.
11914 pub state_reason: std::string::String,
11915
11916 /// Output only. The fully qualified name of the RestoreChannel to be used to
11917 /// create a RestorePlan. This field is set only if the `backup_plan` is in a
11918 /// different project than the RestorePlan. Format:
11919 /// `projects/*/locations/*/restoreChannels/*`
11920 pub restore_channel: std::string::String,
11921
11922 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
11923}
11924
11925impl RestorePlan {
11926 pub fn new() -> Self {
11927 std::default::Default::default()
11928 }
11929
11930 /// Sets the value of [name][crate::model::RestorePlan::name].
11931 ///
11932 /// # Example
11933 /// ```ignore,no_run
11934 /// # use google_cloud_gkebackup_v1::model::RestorePlan;
11935 /// let x = RestorePlan::new().set_name("example");
11936 /// ```
11937 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
11938 self.name = v.into();
11939 self
11940 }
11941
11942 /// Sets the value of [uid][crate::model::RestorePlan::uid].
11943 ///
11944 /// # Example
11945 /// ```ignore,no_run
11946 /// # use google_cloud_gkebackup_v1::model::RestorePlan;
11947 /// let x = RestorePlan::new().set_uid("example");
11948 /// ```
11949 pub fn set_uid<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
11950 self.uid = v.into();
11951 self
11952 }
11953
11954 /// Sets the value of [create_time][crate::model::RestorePlan::create_time].
11955 ///
11956 /// # Example
11957 /// ```ignore,no_run
11958 /// # use google_cloud_gkebackup_v1::model::RestorePlan;
11959 /// use wkt::Timestamp;
11960 /// let x = RestorePlan::new().set_create_time(Timestamp::default()/* use setters */);
11961 /// ```
11962 pub fn set_create_time<T>(mut self, v: T) -> Self
11963 where
11964 T: std::convert::Into<wkt::Timestamp>,
11965 {
11966 self.create_time = std::option::Option::Some(v.into());
11967 self
11968 }
11969
11970 /// Sets or clears the value of [create_time][crate::model::RestorePlan::create_time].
11971 ///
11972 /// # Example
11973 /// ```ignore,no_run
11974 /// # use google_cloud_gkebackup_v1::model::RestorePlan;
11975 /// use wkt::Timestamp;
11976 /// let x = RestorePlan::new().set_or_clear_create_time(Some(Timestamp::default()/* use setters */));
11977 /// let x = RestorePlan::new().set_or_clear_create_time(None::<Timestamp>);
11978 /// ```
11979 pub fn set_or_clear_create_time<T>(mut self, v: std::option::Option<T>) -> Self
11980 where
11981 T: std::convert::Into<wkt::Timestamp>,
11982 {
11983 self.create_time = v.map(|x| x.into());
11984 self
11985 }
11986
11987 /// Sets the value of [update_time][crate::model::RestorePlan::update_time].
11988 ///
11989 /// # Example
11990 /// ```ignore,no_run
11991 /// # use google_cloud_gkebackup_v1::model::RestorePlan;
11992 /// use wkt::Timestamp;
11993 /// let x = RestorePlan::new().set_update_time(Timestamp::default()/* use setters */);
11994 /// ```
11995 pub fn set_update_time<T>(mut self, v: T) -> Self
11996 where
11997 T: std::convert::Into<wkt::Timestamp>,
11998 {
11999 self.update_time = std::option::Option::Some(v.into());
12000 self
12001 }
12002
12003 /// Sets or clears the value of [update_time][crate::model::RestorePlan::update_time].
12004 ///
12005 /// # Example
12006 /// ```ignore,no_run
12007 /// # use google_cloud_gkebackup_v1::model::RestorePlan;
12008 /// use wkt::Timestamp;
12009 /// let x = RestorePlan::new().set_or_clear_update_time(Some(Timestamp::default()/* use setters */));
12010 /// let x = RestorePlan::new().set_or_clear_update_time(None::<Timestamp>);
12011 /// ```
12012 pub fn set_or_clear_update_time<T>(mut self, v: std::option::Option<T>) -> Self
12013 where
12014 T: std::convert::Into<wkt::Timestamp>,
12015 {
12016 self.update_time = v.map(|x| x.into());
12017 self
12018 }
12019
12020 /// Sets the value of [description][crate::model::RestorePlan::description].
12021 ///
12022 /// # Example
12023 /// ```ignore,no_run
12024 /// # use google_cloud_gkebackup_v1::model::RestorePlan;
12025 /// let x = RestorePlan::new().set_description("example");
12026 /// ```
12027 pub fn set_description<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
12028 self.description = v.into();
12029 self
12030 }
12031
12032 /// Sets the value of [backup_plan][crate::model::RestorePlan::backup_plan].
12033 ///
12034 /// # Example
12035 /// ```ignore,no_run
12036 /// # use google_cloud_gkebackup_v1::model::RestorePlan;
12037 /// let x = RestorePlan::new().set_backup_plan("example");
12038 /// ```
12039 pub fn set_backup_plan<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
12040 self.backup_plan = v.into();
12041 self
12042 }
12043
12044 /// Sets the value of [cluster][crate::model::RestorePlan::cluster].
12045 ///
12046 /// # Example
12047 /// ```ignore,no_run
12048 /// # use google_cloud_gkebackup_v1::model::RestorePlan;
12049 /// let x = RestorePlan::new().set_cluster("example");
12050 /// ```
12051 pub fn set_cluster<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
12052 self.cluster = v.into();
12053 self
12054 }
12055
12056 /// Sets the value of [restore_config][crate::model::RestorePlan::restore_config].
12057 ///
12058 /// # Example
12059 /// ```ignore,no_run
12060 /// # use google_cloud_gkebackup_v1::model::RestorePlan;
12061 /// use google_cloud_gkebackup_v1::model::RestoreConfig;
12062 /// let x = RestorePlan::new().set_restore_config(RestoreConfig::default()/* use setters */);
12063 /// ```
12064 pub fn set_restore_config<T>(mut self, v: T) -> Self
12065 where
12066 T: std::convert::Into<crate::model::RestoreConfig>,
12067 {
12068 self.restore_config = std::option::Option::Some(v.into());
12069 self
12070 }
12071
12072 /// Sets or clears the value of [restore_config][crate::model::RestorePlan::restore_config].
12073 ///
12074 /// # Example
12075 /// ```ignore,no_run
12076 /// # use google_cloud_gkebackup_v1::model::RestorePlan;
12077 /// use google_cloud_gkebackup_v1::model::RestoreConfig;
12078 /// let x = RestorePlan::new().set_or_clear_restore_config(Some(RestoreConfig::default()/* use setters */));
12079 /// let x = RestorePlan::new().set_or_clear_restore_config(None::<RestoreConfig>);
12080 /// ```
12081 pub fn set_or_clear_restore_config<T>(mut self, v: std::option::Option<T>) -> Self
12082 where
12083 T: std::convert::Into<crate::model::RestoreConfig>,
12084 {
12085 self.restore_config = v.map(|x| x.into());
12086 self
12087 }
12088
12089 /// Sets the value of [labels][crate::model::RestorePlan::labels].
12090 ///
12091 /// # Example
12092 /// ```ignore,no_run
12093 /// # use google_cloud_gkebackup_v1::model::RestorePlan;
12094 /// let x = RestorePlan::new().set_labels([
12095 /// ("key0", "abc"),
12096 /// ("key1", "xyz"),
12097 /// ]);
12098 /// ```
12099 pub fn set_labels<T, K, V>(mut self, v: T) -> Self
12100 where
12101 T: std::iter::IntoIterator<Item = (K, V)>,
12102 K: std::convert::Into<std::string::String>,
12103 V: std::convert::Into<std::string::String>,
12104 {
12105 use std::iter::Iterator;
12106 self.labels = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
12107 self
12108 }
12109
12110 /// Sets the value of [etag][crate::model::RestorePlan::etag].
12111 ///
12112 /// # Example
12113 /// ```ignore,no_run
12114 /// # use google_cloud_gkebackup_v1::model::RestorePlan;
12115 /// let x = RestorePlan::new().set_etag("example");
12116 /// ```
12117 pub fn set_etag<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
12118 self.etag = v.into();
12119 self
12120 }
12121
12122 /// Sets the value of [state][crate::model::RestorePlan::state].
12123 ///
12124 /// # Example
12125 /// ```ignore,no_run
12126 /// # use google_cloud_gkebackup_v1::model::RestorePlan;
12127 /// use google_cloud_gkebackup_v1::model::restore_plan::State;
12128 /// let x0 = RestorePlan::new().set_state(State::ClusterPending);
12129 /// let x1 = RestorePlan::new().set_state(State::Ready);
12130 /// let x2 = RestorePlan::new().set_state(State::Failed);
12131 /// ```
12132 pub fn set_state<T: std::convert::Into<crate::model::restore_plan::State>>(
12133 mut self,
12134 v: T,
12135 ) -> Self {
12136 self.state = v.into();
12137 self
12138 }
12139
12140 /// Sets the value of [state_reason][crate::model::RestorePlan::state_reason].
12141 ///
12142 /// # Example
12143 /// ```ignore,no_run
12144 /// # use google_cloud_gkebackup_v1::model::RestorePlan;
12145 /// let x = RestorePlan::new().set_state_reason("example");
12146 /// ```
12147 pub fn set_state_reason<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
12148 self.state_reason = v.into();
12149 self
12150 }
12151
12152 /// Sets the value of [restore_channel][crate::model::RestorePlan::restore_channel].
12153 ///
12154 /// # Example
12155 /// ```ignore,no_run
12156 /// # use google_cloud_gkebackup_v1::model::RestorePlan;
12157 /// let x = RestorePlan::new().set_restore_channel("example");
12158 /// ```
12159 pub fn set_restore_channel<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
12160 self.restore_channel = v.into();
12161 self
12162 }
12163}
12164
12165impl wkt::message::Message for RestorePlan {
12166 fn typename() -> &'static str {
12167 "type.googleapis.com/google.cloud.gkebackup.v1.RestorePlan"
12168 }
12169}
12170
12171/// Defines additional types related to [RestorePlan].
12172pub mod restore_plan {
12173 #[allow(unused_imports)]
12174 use super::*;
12175
12176 /// State
12177 ///
12178 /// # Working with unknown values
12179 ///
12180 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
12181 /// additional enum variants at any time. Adding new variants is not considered
12182 /// a breaking change. Applications should write their code in anticipation of:
12183 ///
12184 /// - New values appearing in future releases of the client library, **and**
12185 /// - New values received dynamically, without application changes.
12186 ///
12187 /// Please consult the [Working with enums] section in the user guide for some
12188 /// guidelines.
12189 ///
12190 /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
12191 #[derive(Clone, Debug, PartialEq)]
12192 #[non_exhaustive]
12193 pub enum State {
12194 /// Default first value for Enums.
12195 Unspecified,
12196 /// Waiting for cluster state to be RUNNING.
12197 ClusterPending,
12198 /// The RestorePlan has successfully been created and is ready for Restores.
12199 Ready,
12200 /// RestorePlan creation has failed.
12201 Failed,
12202 /// The RestorePlan is in the process of being deleted.
12203 Deleting,
12204 /// If set, the enum was initialized with an unknown value.
12205 ///
12206 /// Applications can examine the value using [State::value] or
12207 /// [State::name].
12208 UnknownValue(state::UnknownValue),
12209 }
12210
12211 #[doc(hidden)]
12212 pub mod state {
12213 #[allow(unused_imports)]
12214 use super::*;
12215 #[derive(Clone, Debug, PartialEq)]
12216 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
12217 }
12218
12219 impl State {
12220 /// Gets the enum value.
12221 ///
12222 /// Returns `None` if the enum contains an unknown value deserialized from
12223 /// the string representation of enums.
12224 pub fn value(&self) -> std::option::Option<i32> {
12225 match self {
12226 Self::Unspecified => std::option::Option::Some(0),
12227 Self::ClusterPending => std::option::Option::Some(1),
12228 Self::Ready => std::option::Option::Some(2),
12229 Self::Failed => std::option::Option::Some(3),
12230 Self::Deleting => std::option::Option::Some(4),
12231 Self::UnknownValue(u) => u.0.value(),
12232 }
12233 }
12234
12235 /// Gets the enum value as a string.
12236 ///
12237 /// Returns `None` if the enum contains an unknown value deserialized from
12238 /// the integer representation of enums.
12239 pub fn name(&self) -> std::option::Option<&str> {
12240 match self {
12241 Self::Unspecified => std::option::Option::Some("STATE_UNSPECIFIED"),
12242 Self::ClusterPending => std::option::Option::Some("CLUSTER_PENDING"),
12243 Self::Ready => std::option::Option::Some("READY"),
12244 Self::Failed => std::option::Option::Some("FAILED"),
12245 Self::Deleting => std::option::Option::Some("DELETING"),
12246 Self::UnknownValue(u) => u.0.name(),
12247 }
12248 }
12249 }
12250
12251 impl std::default::Default for State {
12252 fn default() -> Self {
12253 use std::convert::From;
12254 Self::from(0)
12255 }
12256 }
12257
12258 impl std::fmt::Display for State {
12259 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
12260 wkt::internal::display_enum(f, self.name(), self.value())
12261 }
12262 }
12263
12264 impl std::convert::From<i32> for State {
12265 fn from(value: i32) -> Self {
12266 match value {
12267 0 => Self::Unspecified,
12268 1 => Self::ClusterPending,
12269 2 => Self::Ready,
12270 3 => Self::Failed,
12271 4 => Self::Deleting,
12272 _ => Self::UnknownValue(state::UnknownValue(
12273 wkt::internal::UnknownEnumValue::Integer(value),
12274 )),
12275 }
12276 }
12277 }
12278
12279 impl std::convert::From<&str> for State {
12280 fn from(value: &str) -> Self {
12281 use std::string::ToString;
12282 match value {
12283 "STATE_UNSPECIFIED" => Self::Unspecified,
12284 "CLUSTER_PENDING" => Self::ClusterPending,
12285 "READY" => Self::Ready,
12286 "FAILED" => Self::Failed,
12287 "DELETING" => Self::Deleting,
12288 _ => Self::UnknownValue(state::UnknownValue(
12289 wkt::internal::UnknownEnumValue::String(value.to_string()),
12290 )),
12291 }
12292 }
12293 }
12294
12295 impl serde::ser::Serialize for State {
12296 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
12297 where
12298 S: serde::Serializer,
12299 {
12300 match self {
12301 Self::Unspecified => serializer.serialize_i32(0),
12302 Self::ClusterPending => serializer.serialize_i32(1),
12303 Self::Ready => serializer.serialize_i32(2),
12304 Self::Failed => serializer.serialize_i32(3),
12305 Self::Deleting => serializer.serialize_i32(4),
12306 Self::UnknownValue(u) => u.0.serialize(serializer),
12307 }
12308 }
12309 }
12310
12311 impl<'de> serde::de::Deserialize<'de> for State {
12312 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
12313 where
12314 D: serde::Deserializer<'de>,
12315 {
12316 deserializer.deserialize_any(wkt::internal::EnumVisitor::<State>::new(
12317 ".google.cloud.gkebackup.v1.RestorePlan.State",
12318 ))
12319 }
12320 }
12321}
12322
12323/// A RestorePlanBinding binds a RestorePlan with a RestoreChannel.
12324/// This resource is created automatically when a RestorePlan is created using a
12325/// RestoreChannel. This also serves as a holder for cross-project fields
12326/// that need to be displayed in the current project.
12327#[derive(Clone, Default, PartialEq)]
12328#[non_exhaustive]
12329pub struct RestorePlanBinding {
12330 /// Identifier. The fully qualified name of the RestorePlanBinding.
12331 /// `projects/*/locations/*/restoreChannels/*/restorePlanBindings/*`
12332 pub name: std::string::String,
12333
12334 /// Output only. Server generated global unique identifier of
12335 /// [UUID4](https://en.wikipedia.org/wiki/Universally_unique_identifier)
12336 pub uid: std::string::String,
12337
12338 /// Output only. The timestamp when this binding was created.
12339 pub create_time: std::option::Option<wkt::Timestamp>,
12340
12341 /// Output only. The timestamp when this binding was created.
12342 pub update_time: std::option::Option<wkt::Timestamp>,
12343
12344 /// Output only. The fully qualified name of the RestorePlan bound to this
12345 /// RestoreChannel. `projects/*/locations/*/restorePlans/{restore_plan}`
12346 pub restore_plan: std::string::String,
12347
12348 /// Output only. `etag` is used for optimistic concurrency control as a way to
12349 /// help prevent simultaneous updates of a RestorePlanBinding from overwriting
12350 /// each other. It is strongly suggested that systems make use of the 'etag' in
12351 /// the read-modify-write cycle to perform RestorePlanBinding updates in
12352 /// order to avoid race conditions: An `etag` is returned in the response to
12353 /// `GetRestorePlanBinding`, and systems are expected to put that etag in
12354 /// the request to `UpdateRestorePlanBinding` or
12355 /// `DeleteRestorePlanBinding` to ensure that their change will be applied
12356 /// to the same version of the resource.
12357 pub etag: std::string::String,
12358
12359 /// Output only. The fully qualified name of the BackupPlan bound to the
12360 /// specified RestorePlan. `projects/*/locations/*/backukpPlans/{backup_plan}`
12361 pub backup_plan: std::string::String,
12362
12363 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
12364}
12365
12366impl RestorePlanBinding {
12367 pub fn new() -> Self {
12368 std::default::Default::default()
12369 }
12370
12371 /// Sets the value of [name][crate::model::RestorePlanBinding::name].
12372 ///
12373 /// # Example
12374 /// ```ignore,no_run
12375 /// # use google_cloud_gkebackup_v1::model::RestorePlanBinding;
12376 /// let x = RestorePlanBinding::new().set_name("example");
12377 /// ```
12378 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
12379 self.name = v.into();
12380 self
12381 }
12382
12383 /// Sets the value of [uid][crate::model::RestorePlanBinding::uid].
12384 ///
12385 /// # Example
12386 /// ```ignore,no_run
12387 /// # use google_cloud_gkebackup_v1::model::RestorePlanBinding;
12388 /// let x = RestorePlanBinding::new().set_uid("example");
12389 /// ```
12390 pub fn set_uid<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
12391 self.uid = v.into();
12392 self
12393 }
12394
12395 /// Sets the value of [create_time][crate::model::RestorePlanBinding::create_time].
12396 ///
12397 /// # Example
12398 /// ```ignore,no_run
12399 /// # use google_cloud_gkebackup_v1::model::RestorePlanBinding;
12400 /// use wkt::Timestamp;
12401 /// let x = RestorePlanBinding::new().set_create_time(Timestamp::default()/* use setters */);
12402 /// ```
12403 pub fn set_create_time<T>(mut self, v: T) -> Self
12404 where
12405 T: std::convert::Into<wkt::Timestamp>,
12406 {
12407 self.create_time = std::option::Option::Some(v.into());
12408 self
12409 }
12410
12411 /// Sets or clears the value of [create_time][crate::model::RestorePlanBinding::create_time].
12412 ///
12413 /// # Example
12414 /// ```ignore,no_run
12415 /// # use google_cloud_gkebackup_v1::model::RestorePlanBinding;
12416 /// use wkt::Timestamp;
12417 /// let x = RestorePlanBinding::new().set_or_clear_create_time(Some(Timestamp::default()/* use setters */));
12418 /// let x = RestorePlanBinding::new().set_or_clear_create_time(None::<Timestamp>);
12419 /// ```
12420 pub fn set_or_clear_create_time<T>(mut self, v: std::option::Option<T>) -> Self
12421 where
12422 T: std::convert::Into<wkt::Timestamp>,
12423 {
12424 self.create_time = v.map(|x| x.into());
12425 self
12426 }
12427
12428 /// Sets the value of [update_time][crate::model::RestorePlanBinding::update_time].
12429 ///
12430 /// # Example
12431 /// ```ignore,no_run
12432 /// # use google_cloud_gkebackup_v1::model::RestorePlanBinding;
12433 /// use wkt::Timestamp;
12434 /// let x = RestorePlanBinding::new().set_update_time(Timestamp::default()/* use setters */);
12435 /// ```
12436 pub fn set_update_time<T>(mut self, v: T) -> Self
12437 where
12438 T: std::convert::Into<wkt::Timestamp>,
12439 {
12440 self.update_time = std::option::Option::Some(v.into());
12441 self
12442 }
12443
12444 /// Sets or clears the value of [update_time][crate::model::RestorePlanBinding::update_time].
12445 ///
12446 /// # Example
12447 /// ```ignore,no_run
12448 /// # use google_cloud_gkebackup_v1::model::RestorePlanBinding;
12449 /// use wkt::Timestamp;
12450 /// let x = RestorePlanBinding::new().set_or_clear_update_time(Some(Timestamp::default()/* use setters */));
12451 /// let x = RestorePlanBinding::new().set_or_clear_update_time(None::<Timestamp>);
12452 /// ```
12453 pub fn set_or_clear_update_time<T>(mut self, v: std::option::Option<T>) -> Self
12454 where
12455 T: std::convert::Into<wkt::Timestamp>,
12456 {
12457 self.update_time = v.map(|x| x.into());
12458 self
12459 }
12460
12461 /// Sets the value of [restore_plan][crate::model::RestorePlanBinding::restore_plan].
12462 ///
12463 /// # Example
12464 /// ```ignore,no_run
12465 /// # use google_cloud_gkebackup_v1::model::RestorePlanBinding;
12466 /// let x = RestorePlanBinding::new().set_restore_plan("example");
12467 /// ```
12468 pub fn set_restore_plan<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
12469 self.restore_plan = v.into();
12470 self
12471 }
12472
12473 /// Sets the value of [etag][crate::model::RestorePlanBinding::etag].
12474 ///
12475 /// # Example
12476 /// ```ignore,no_run
12477 /// # use google_cloud_gkebackup_v1::model::RestorePlanBinding;
12478 /// let x = RestorePlanBinding::new().set_etag("example");
12479 /// ```
12480 pub fn set_etag<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
12481 self.etag = v.into();
12482 self
12483 }
12484
12485 /// Sets the value of [backup_plan][crate::model::RestorePlanBinding::backup_plan].
12486 ///
12487 /// # Example
12488 /// ```ignore,no_run
12489 /// # use google_cloud_gkebackup_v1::model::RestorePlanBinding;
12490 /// let x = RestorePlanBinding::new().set_backup_plan("example");
12491 /// ```
12492 pub fn set_backup_plan<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
12493 self.backup_plan = v.into();
12494 self
12495 }
12496}
12497
12498impl wkt::message::Message for RestorePlanBinding {
12499 fn typename() -> &'static str {
12500 "type.googleapis.com/google.cloud.gkebackup.v1.RestorePlanBinding"
12501 }
12502}
12503
12504/// Represents the backup of a specific persistent volume as a component of a
12505/// Backup - both the record of the operation and a pointer to the underlying
12506/// storage-specific artifacts.
12507#[derive(Clone, Default, PartialEq)]
12508#[non_exhaustive]
12509pub struct VolumeBackup {
12510 /// Output only. The full name of the VolumeBackup resource.
12511 /// Format: `projects/*/locations/*/backupPlans/*/backups/*/volumeBackups/*`.
12512 pub name: std::string::String,
12513
12514 /// Output only. Server generated global unique identifier of
12515 /// [UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier) format.
12516 pub uid: std::string::String,
12517
12518 /// Output only. The timestamp when this VolumeBackup resource was
12519 /// created.
12520 pub create_time: std::option::Option<wkt::Timestamp>,
12521
12522 /// Output only. The timestamp when this VolumeBackup resource was last
12523 /// updated.
12524 pub update_time: std::option::Option<wkt::Timestamp>,
12525
12526 /// Output only. A reference to the source Kubernetes PVC from which this
12527 /// VolumeBackup was created.
12528 pub source_pvc: std::option::Option<crate::model::NamespacedName>,
12529
12530 /// Output only. A storage system-specific opaque handle to the underlying
12531 /// volume backup.
12532 pub volume_backup_handle: std::string::String,
12533
12534 /// Output only. The format used for the volume backup.
12535 pub format: crate::model::volume_backup::VolumeBackupFormat,
12536
12537 /// Output only. The aggregate size of the underlying artifacts associated with
12538 /// this VolumeBackup in the backup storage. This may change over time when
12539 /// multiple backups of the same volume share the same backup storage
12540 /// location. In particular, this is likely to increase in size when
12541 /// the immediately preceding backup of the same volume is deleted.
12542 pub storage_bytes: i64,
12543
12544 /// Output only. The minimum size of the disk to which this VolumeBackup can be
12545 /// restored.
12546 pub disk_size_bytes: i64,
12547
12548 /// Output only. The timestamp when the associated underlying volume backup
12549 /// operation completed.
12550 pub complete_time: std::option::Option<wkt::Timestamp>,
12551
12552 /// Output only. The current state of this VolumeBackup.
12553 pub state: crate::model::volume_backup::State,
12554
12555 /// Output only. A human readable message explaining why the VolumeBackup is in
12556 /// its current state. This field is only meant for human consumption and
12557 /// should not be used programmatically as this field is not guaranteed to be
12558 /// consistent.
12559 pub state_message: std::string::String,
12560
12561 /// Output only. `etag` is used for optimistic concurrency control as a way to
12562 /// help prevent simultaneous updates of a volume backup from overwriting each
12563 /// other. It is strongly suggested that systems make use of the `etag` in the
12564 /// read-modify-write cycle to perform volume backup updates in order to avoid
12565 /// race conditions.
12566 pub etag: std::string::String,
12567
12568 /// Output only. [Output Only] Reserved for future use.
12569 pub satisfies_pzs: bool,
12570
12571 /// Output only. [Output Only] Reserved for future use.
12572 pub satisfies_pzi: bool,
12573
12574 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
12575}
12576
12577impl VolumeBackup {
12578 pub fn new() -> Self {
12579 std::default::Default::default()
12580 }
12581
12582 /// Sets the value of [name][crate::model::VolumeBackup::name].
12583 ///
12584 /// # Example
12585 /// ```ignore,no_run
12586 /// # use google_cloud_gkebackup_v1::model::VolumeBackup;
12587 /// let x = VolumeBackup::new().set_name("example");
12588 /// ```
12589 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
12590 self.name = v.into();
12591 self
12592 }
12593
12594 /// Sets the value of [uid][crate::model::VolumeBackup::uid].
12595 ///
12596 /// # Example
12597 /// ```ignore,no_run
12598 /// # use google_cloud_gkebackup_v1::model::VolumeBackup;
12599 /// let x = VolumeBackup::new().set_uid("example");
12600 /// ```
12601 pub fn set_uid<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
12602 self.uid = v.into();
12603 self
12604 }
12605
12606 /// Sets the value of [create_time][crate::model::VolumeBackup::create_time].
12607 ///
12608 /// # Example
12609 /// ```ignore,no_run
12610 /// # use google_cloud_gkebackup_v1::model::VolumeBackup;
12611 /// use wkt::Timestamp;
12612 /// let x = VolumeBackup::new().set_create_time(Timestamp::default()/* use setters */);
12613 /// ```
12614 pub fn set_create_time<T>(mut self, v: T) -> Self
12615 where
12616 T: std::convert::Into<wkt::Timestamp>,
12617 {
12618 self.create_time = std::option::Option::Some(v.into());
12619 self
12620 }
12621
12622 /// Sets or clears the value of [create_time][crate::model::VolumeBackup::create_time].
12623 ///
12624 /// # Example
12625 /// ```ignore,no_run
12626 /// # use google_cloud_gkebackup_v1::model::VolumeBackup;
12627 /// use wkt::Timestamp;
12628 /// let x = VolumeBackup::new().set_or_clear_create_time(Some(Timestamp::default()/* use setters */));
12629 /// let x = VolumeBackup::new().set_or_clear_create_time(None::<Timestamp>);
12630 /// ```
12631 pub fn set_or_clear_create_time<T>(mut self, v: std::option::Option<T>) -> Self
12632 where
12633 T: std::convert::Into<wkt::Timestamp>,
12634 {
12635 self.create_time = v.map(|x| x.into());
12636 self
12637 }
12638
12639 /// Sets the value of [update_time][crate::model::VolumeBackup::update_time].
12640 ///
12641 /// # Example
12642 /// ```ignore,no_run
12643 /// # use google_cloud_gkebackup_v1::model::VolumeBackup;
12644 /// use wkt::Timestamp;
12645 /// let x = VolumeBackup::new().set_update_time(Timestamp::default()/* use setters */);
12646 /// ```
12647 pub fn set_update_time<T>(mut self, v: T) -> Self
12648 where
12649 T: std::convert::Into<wkt::Timestamp>,
12650 {
12651 self.update_time = std::option::Option::Some(v.into());
12652 self
12653 }
12654
12655 /// Sets or clears the value of [update_time][crate::model::VolumeBackup::update_time].
12656 ///
12657 /// # Example
12658 /// ```ignore,no_run
12659 /// # use google_cloud_gkebackup_v1::model::VolumeBackup;
12660 /// use wkt::Timestamp;
12661 /// let x = VolumeBackup::new().set_or_clear_update_time(Some(Timestamp::default()/* use setters */));
12662 /// let x = VolumeBackup::new().set_or_clear_update_time(None::<Timestamp>);
12663 /// ```
12664 pub fn set_or_clear_update_time<T>(mut self, v: std::option::Option<T>) -> Self
12665 where
12666 T: std::convert::Into<wkt::Timestamp>,
12667 {
12668 self.update_time = v.map(|x| x.into());
12669 self
12670 }
12671
12672 /// Sets the value of [source_pvc][crate::model::VolumeBackup::source_pvc].
12673 ///
12674 /// # Example
12675 /// ```ignore,no_run
12676 /// # use google_cloud_gkebackup_v1::model::VolumeBackup;
12677 /// use google_cloud_gkebackup_v1::model::NamespacedName;
12678 /// let x = VolumeBackup::new().set_source_pvc(NamespacedName::default()/* use setters */);
12679 /// ```
12680 pub fn set_source_pvc<T>(mut self, v: T) -> Self
12681 where
12682 T: std::convert::Into<crate::model::NamespacedName>,
12683 {
12684 self.source_pvc = std::option::Option::Some(v.into());
12685 self
12686 }
12687
12688 /// Sets or clears the value of [source_pvc][crate::model::VolumeBackup::source_pvc].
12689 ///
12690 /// # Example
12691 /// ```ignore,no_run
12692 /// # use google_cloud_gkebackup_v1::model::VolumeBackup;
12693 /// use google_cloud_gkebackup_v1::model::NamespacedName;
12694 /// let x = VolumeBackup::new().set_or_clear_source_pvc(Some(NamespacedName::default()/* use setters */));
12695 /// let x = VolumeBackup::new().set_or_clear_source_pvc(None::<NamespacedName>);
12696 /// ```
12697 pub fn set_or_clear_source_pvc<T>(mut self, v: std::option::Option<T>) -> Self
12698 where
12699 T: std::convert::Into<crate::model::NamespacedName>,
12700 {
12701 self.source_pvc = v.map(|x| x.into());
12702 self
12703 }
12704
12705 /// Sets the value of [volume_backup_handle][crate::model::VolumeBackup::volume_backup_handle].
12706 ///
12707 /// # Example
12708 /// ```ignore,no_run
12709 /// # use google_cloud_gkebackup_v1::model::VolumeBackup;
12710 /// let x = VolumeBackup::new().set_volume_backup_handle("example");
12711 /// ```
12712 pub fn set_volume_backup_handle<T: std::convert::Into<std::string::String>>(
12713 mut self,
12714 v: T,
12715 ) -> Self {
12716 self.volume_backup_handle = v.into();
12717 self
12718 }
12719
12720 /// Sets the value of [format][crate::model::VolumeBackup::format].
12721 ///
12722 /// # Example
12723 /// ```ignore,no_run
12724 /// # use google_cloud_gkebackup_v1::model::VolumeBackup;
12725 /// use google_cloud_gkebackup_v1::model::volume_backup::VolumeBackupFormat;
12726 /// let x0 = VolumeBackup::new().set_format(VolumeBackupFormat::GcePersistentDisk);
12727 /// ```
12728 pub fn set_format<T: std::convert::Into<crate::model::volume_backup::VolumeBackupFormat>>(
12729 mut self,
12730 v: T,
12731 ) -> Self {
12732 self.format = v.into();
12733 self
12734 }
12735
12736 /// Sets the value of [storage_bytes][crate::model::VolumeBackup::storage_bytes].
12737 ///
12738 /// # Example
12739 /// ```ignore,no_run
12740 /// # use google_cloud_gkebackup_v1::model::VolumeBackup;
12741 /// let x = VolumeBackup::new().set_storage_bytes(42);
12742 /// ```
12743 pub fn set_storage_bytes<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
12744 self.storage_bytes = v.into();
12745 self
12746 }
12747
12748 /// Sets the value of [disk_size_bytes][crate::model::VolumeBackup::disk_size_bytes].
12749 ///
12750 /// # Example
12751 /// ```ignore,no_run
12752 /// # use google_cloud_gkebackup_v1::model::VolumeBackup;
12753 /// let x = VolumeBackup::new().set_disk_size_bytes(42);
12754 /// ```
12755 pub fn set_disk_size_bytes<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
12756 self.disk_size_bytes = v.into();
12757 self
12758 }
12759
12760 /// Sets the value of [complete_time][crate::model::VolumeBackup::complete_time].
12761 ///
12762 /// # Example
12763 /// ```ignore,no_run
12764 /// # use google_cloud_gkebackup_v1::model::VolumeBackup;
12765 /// use wkt::Timestamp;
12766 /// let x = VolumeBackup::new().set_complete_time(Timestamp::default()/* use setters */);
12767 /// ```
12768 pub fn set_complete_time<T>(mut self, v: T) -> Self
12769 where
12770 T: std::convert::Into<wkt::Timestamp>,
12771 {
12772 self.complete_time = std::option::Option::Some(v.into());
12773 self
12774 }
12775
12776 /// Sets or clears the value of [complete_time][crate::model::VolumeBackup::complete_time].
12777 ///
12778 /// # Example
12779 /// ```ignore,no_run
12780 /// # use google_cloud_gkebackup_v1::model::VolumeBackup;
12781 /// use wkt::Timestamp;
12782 /// let x = VolumeBackup::new().set_or_clear_complete_time(Some(Timestamp::default()/* use setters */));
12783 /// let x = VolumeBackup::new().set_or_clear_complete_time(None::<Timestamp>);
12784 /// ```
12785 pub fn set_or_clear_complete_time<T>(mut self, v: std::option::Option<T>) -> Self
12786 where
12787 T: std::convert::Into<wkt::Timestamp>,
12788 {
12789 self.complete_time = v.map(|x| x.into());
12790 self
12791 }
12792
12793 /// Sets the value of [state][crate::model::VolumeBackup::state].
12794 ///
12795 /// # Example
12796 /// ```ignore,no_run
12797 /// # use google_cloud_gkebackup_v1::model::VolumeBackup;
12798 /// use google_cloud_gkebackup_v1::model::volume_backup::State;
12799 /// let x0 = VolumeBackup::new().set_state(State::Creating);
12800 /// let x1 = VolumeBackup::new().set_state(State::Snapshotting);
12801 /// let x2 = VolumeBackup::new().set_state(State::Uploading);
12802 /// ```
12803 pub fn set_state<T: std::convert::Into<crate::model::volume_backup::State>>(
12804 mut self,
12805 v: T,
12806 ) -> Self {
12807 self.state = v.into();
12808 self
12809 }
12810
12811 /// Sets the value of [state_message][crate::model::VolumeBackup::state_message].
12812 ///
12813 /// # Example
12814 /// ```ignore,no_run
12815 /// # use google_cloud_gkebackup_v1::model::VolumeBackup;
12816 /// let x = VolumeBackup::new().set_state_message("example");
12817 /// ```
12818 pub fn set_state_message<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
12819 self.state_message = v.into();
12820 self
12821 }
12822
12823 /// Sets the value of [etag][crate::model::VolumeBackup::etag].
12824 ///
12825 /// # Example
12826 /// ```ignore,no_run
12827 /// # use google_cloud_gkebackup_v1::model::VolumeBackup;
12828 /// let x = VolumeBackup::new().set_etag("example");
12829 /// ```
12830 pub fn set_etag<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
12831 self.etag = v.into();
12832 self
12833 }
12834
12835 /// Sets the value of [satisfies_pzs][crate::model::VolumeBackup::satisfies_pzs].
12836 ///
12837 /// # Example
12838 /// ```ignore,no_run
12839 /// # use google_cloud_gkebackup_v1::model::VolumeBackup;
12840 /// let x = VolumeBackup::new().set_satisfies_pzs(true);
12841 /// ```
12842 pub fn set_satisfies_pzs<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
12843 self.satisfies_pzs = v.into();
12844 self
12845 }
12846
12847 /// Sets the value of [satisfies_pzi][crate::model::VolumeBackup::satisfies_pzi].
12848 ///
12849 /// # Example
12850 /// ```ignore,no_run
12851 /// # use google_cloud_gkebackup_v1::model::VolumeBackup;
12852 /// let x = VolumeBackup::new().set_satisfies_pzi(true);
12853 /// ```
12854 pub fn set_satisfies_pzi<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
12855 self.satisfies_pzi = v.into();
12856 self
12857 }
12858}
12859
12860impl wkt::message::Message for VolumeBackup {
12861 fn typename() -> &'static str {
12862 "type.googleapis.com/google.cloud.gkebackup.v1.VolumeBackup"
12863 }
12864}
12865
12866/// Defines additional types related to [VolumeBackup].
12867pub mod volume_backup {
12868 #[allow(unused_imports)]
12869 use super::*;
12870
12871 /// Identifies the format used for the volume backup.
12872 ///
12873 /// # Working with unknown values
12874 ///
12875 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
12876 /// additional enum variants at any time. Adding new variants is not considered
12877 /// a breaking change. Applications should write their code in anticipation of:
12878 ///
12879 /// - New values appearing in future releases of the client library, **and**
12880 /// - New values received dynamically, without application changes.
12881 ///
12882 /// Please consult the [Working with enums] section in the user guide for some
12883 /// guidelines.
12884 ///
12885 /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
12886 #[derive(Clone, Debug, PartialEq)]
12887 #[non_exhaustive]
12888 pub enum VolumeBackupFormat {
12889 /// Default value, not specified.
12890 Unspecified,
12891 /// Compute Engine Persistent Disk snapshot based volume backup.
12892 GcePersistentDisk,
12893 /// If set, the enum was initialized with an unknown value.
12894 ///
12895 /// Applications can examine the value using [VolumeBackupFormat::value] or
12896 /// [VolumeBackupFormat::name].
12897 UnknownValue(volume_backup_format::UnknownValue),
12898 }
12899
12900 #[doc(hidden)]
12901 pub mod volume_backup_format {
12902 #[allow(unused_imports)]
12903 use super::*;
12904 #[derive(Clone, Debug, PartialEq)]
12905 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
12906 }
12907
12908 impl VolumeBackupFormat {
12909 /// Gets the enum value.
12910 ///
12911 /// Returns `None` if the enum contains an unknown value deserialized from
12912 /// the string representation of enums.
12913 pub fn value(&self) -> std::option::Option<i32> {
12914 match self {
12915 Self::Unspecified => std::option::Option::Some(0),
12916 Self::GcePersistentDisk => std::option::Option::Some(1),
12917 Self::UnknownValue(u) => u.0.value(),
12918 }
12919 }
12920
12921 /// Gets the enum value as a string.
12922 ///
12923 /// Returns `None` if the enum contains an unknown value deserialized from
12924 /// the integer representation of enums.
12925 pub fn name(&self) -> std::option::Option<&str> {
12926 match self {
12927 Self::Unspecified => std::option::Option::Some("VOLUME_BACKUP_FORMAT_UNSPECIFIED"),
12928 Self::GcePersistentDisk => std::option::Option::Some("GCE_PERSISTENT_DISK"),
12929 Self::UnknownValue(u) => u.0.name(),
12930 }
12931 }
12932 }
12933
12934 impl std::default::Default for VolumeBackupFormat {
12935 fn default() -> Self {
12936 use std::convert::From;
12937 Self::from(0)
12938 }
12939 }
12940
12941 impl std::fmt::Display for VolumeBackupFormat {
12942 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
12943 wkt::internal::display_enum(f, self.name(), self.value())
12944 }
12945 }
12946
12947 impl std::convert::From<i32> for VolumeBackupFormat {
12948 fn from(value: i32) -> Self {
12949 match value {
12950 0 => Self::Unspecified,
12951 1 => Self::GcePersistentDisk,
12952 _ => Self::UnknownValue(volume_backup_format::UnknownValue(
12953 wkt::internal::UnknownEnumValue::Integer(value),
12954 )),
12955 }
12956 }
12957 }
12958
12959 impl std::convert::From<&str> for VolumeBackupFormat {
12960 fn from(value: &str) -> Self {
12961 use std::string::ToString;
12962 match value {
12963 "VOLUME_BACKUP_FORMAT_UNSPECIFIED" => Self::Unspecified,
12964 "GCE_PERSISTENT_DISK" => Self::GcePersistentDisk,
12965 _ => Self::UnknownValue(volume_backup_format::UnknownValue(
12966 wkt::internal::UnknownEnumValue::String(value.to_string()),
12967 )),
12968 }
12969 }
12970 }
12971
12972 impl serde::ser::Serialize for VolumeBackupFormat {
12973 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
12974 where
12975 S: serde::Serializer,
12976 {
12977 match self {
12978 Self::Unspecified => serializer.serialize_i32(0),
12979 Self::GcePersistentDisk => serializer.serialize_i32(1),
12980 Self::UnknownValue(u) => u.0.serialize(serializer),
12981 }
12982 }
12983 }
12984
12985 impl<'de> serde::de::Deserialize<'de> for VolumeBackupFormat {
12986 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
12987 where
12988 D: serde::Deserializer<'de>,
12989 {
12990 deserializer.deserialize_any(wkt::internal::EnumVisitor::<VolumeBackupFormat>::new(
12991 ".google.cloud.gkebackup.v1.VolumeBackup.VolumeBackupFormat",
12992 ))
12993 }
12994 }
12995
12996 /// The current state of a VolumeBackup
12997 ///
12998 /// # Working with unknown values
12999 ///
13000 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
13001 /// additional enum variants at any time. Adding new variants is not considered
13002 /// a breaking change. Applications should write their code in anticipation of:
13003 ///
13004 /// - New values appearing in future releases of the client library, **and**
13005 /// - New values received dynamically, without application changes.
13006 ///
13007 /// Please consult the [Working with enums] section in the user guide for some
13008 /// guidelines.
13009 ///
13010 /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
13011 #[derive(Clone, Debug, PartialEq)]
13012 #[non_exhaustive]
13013 pub enum State {
13014 /// This is an illegal state and should not be encountered.
13015 Unspecified,
13016 /// A volume for the backup was identified and backup process is about to
13017 /// start.
13018 Creating,
13019 /// The volume backup operation has begun and is in the initial "snapshot"
13020 /// phase of the process. Any defined ProtectedApplication "pre" hooks will
13021 /// be executed before entering this state and "post" hooks will be executed
13022 /// upon leaving this state.
13023 Snapshotting,
13024 /// The snapshot phase of the volume backup operation has completed and
13025 /// the snapshot is now being uploaded to backup storage.
13026 Uploading,
13027 /// The volume backup operation has completed successfully.
13028 Succeeded,
13029 /// The volume backup operation has failed.
13030 Failed,
13031 /// This VolumeBackup resource (and its associated artifacts) is in the
13032 /// process of being deleted.
13033 Deleting,
13034 /// The underlying artifacts of a volume backup (eg: persistent disk
13035 /// snapshots) are deleted.
13036 CleanedUp,
13037 /// If set, the enum was initialized with an unknown value.
13038 ///
13039 /// Applications can examine the value using [State::value] or
13040 /// [State::name].
13041 UnknownValue(state::UnknownValue),
13042 }
13043
13044 #[doc(hidden)]
13045 pub mod state {
13046 #[allow(unused_imports)]
13047 use super::*;
13048 #[derive(Clone, Debug, PartialEq)]
13049 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
13050 }
13051
13052 impl State {
13053 /// Gets the enum value.
13054 ///
13055 /// Returns `None` if the enum contains an unknown value deserialized from
13056 /// the string representation of enums.
13057 pub fn value(&self) -> std::option::Option<i32> {
13058 match self {
13059 Self::Unspecified => std::option::Option::Some(0),
13060 Self::Creating => std::option::Option::Some(1),
13061 Self::Snapshotting => std::option::Option::Some(2),
13062 Self::Uploading => std::option::Option::Some(3),
13063 Self::Succeeded => std::option::Option::Some(4),
13064 Self::Failed => std::option::Option::Some(5),
13065 Self::Deleting => std::option::Option::Some(6),
13066 Self::CleanedUp => std::option::Option::Some(7),
13067 Self::UnknownValue(u) => u.0.value(),
13068 }
13069 }
13070
13071 /// Gets the enum value as a string.
13072 ///
13073 /// Returns `None` if the enum contains an unknown value deserialized from
13074 /// the integer representation of enums.
13075 pub fn name(&self) -> std::option::Option<&str> {
13076 match self {
13077 Self::Unspecified => std::option::Option::Some("STATE_UNSPECIFIED"),
13078 Self::Creating => std::option::Option::Some("CREATING"),
13079 Self::Snapshotting => std::option::Option::Some("SNAPSHOTTING"),
13080 Self::Uploading => std::option::Option::Some("UPLOADING"),
13081 Self::Succeeded => std::option::Option::Some("SUCCEEDED"),
13082 Self::Failed => std::option::Option::Some("FAILED"),
13083 Self::Deleting => std::option::Option::Some("DELETING"),
13084 Self::CleanedUp => std::option::Option::Some("CLEANED_UP"),
13085 Self::UnknownValue(u) => u.0.name(),
13086 }
13087 }
13088 }
13089
13090 impl std::default::Default for State {
13091 fn default() -> Self {
13092 use std::convert::From;
13093 Self::from(0)
13094 }
13095 }
13096
13097 impl std::fmt::Display for State {
13098 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
13099 wkt::internal::display_enum(f, self.name(), self.value())
13100 }
13101 }
13102
13103 impl std::convert::From<i32> for State {
13104 fn from(value: i32) -> Self {
13105 match value {
13106 0 => Self::Unspecified,
13107 1 => Self::Creating,
13108 2 => Self::Snapshotting,
13109 3 => Self::Uploading,
13110 4 => Self::Succeeded,
13111 5 => Self::Failed,
13112 6 => Self::Deleting,
13113 7 => Self::CleanedUp,
13114 _ => Self::UnknownValue(state::UnknownValue(
13115 wkt::internal::UnknownEnumValue::Integer(value),
13116 )),
13117 }
13118 }
13119 }
13120
13121 impl std::convert::From<&str> for State {
13122 fn from(value: &str) -> Self {
13123 use std::string::ToString;
13124 match value {
13125 "STATE_UNSPECIFIED" => Self::Unspecified,
13126 "CREATING" => Self::Creating,
13127 "SNAPSHOTTING" => Self::Snapshotting,
13128 "UPLOADING" => Self::Uploading,
13129 "SUCCEEDED" => Self::Succeeded,
13130 "FAILED" => Self::Failed,
13131 "DELETING" => Self::Deleting,
13132 "CLEANED_UP" => Self::CleanedUp,
13133 _ => Self::UnknownValue(state::UnknownValue(
13134 wkt::internal::UnknownEnumValue::String(value.to_string()),
13135 )),
13136 }
13137 }
13138 }
13139
13140 impl serde::ser::Serialize for State {
13141 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
13142 where
13143 S: serde::Serializer,
13144 {
13145 match self {
13146 Self::Unspecified => serializer.serialize_i32(0),
13147 Self::Creating => serializer.serialize_i32(1),
13148 Self::Snapshotting => serializer.serialize_i32(2),
13149 Self::Uploading => serializer.serialize_i32(3),
13150 Self::Succeeded => serializer.serialize_i32(4),
13151 Self::Failed => serializer.serialize_i32(5),
13152 Self::Deleting => serializer.serialize_i32(6),
13153 Self::CleanedUp => serializer.serialize_i32(7),
13154 Self::UnknownValue(u) => u.0.serialize(serializer),
13155 }
13156 }
13157 }
13158
13159 impl<'de> serde::de::Deserialize<'de> for State {
13160 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
13161 where
13162 D: serde::Deserializer<'de>,
13163 {
13164 deserializer.deserialize_any(wkt::internal::EnumVisitor::<State>::new(
13165 ".google.cloud.gkebackup.v1.VolumeBackup.State",
13166 ))
13167 }
13168 }
13169}
13170
13171/// Represents the operation of restoring a volume from a VolumeBackup.
13172#[derive(Clone, Default, PartialEq)]
13173#[non_exhaustive]
13174pub struct VolumeRestore {
13175 /// Output only. Full name of the VolumeRestore resource.
13176 /// Format: `projects/*/locations/*/restorePlans/*/restores/*/volumeRestores/*`
13177 pub name: std::string::String,
13178
13179 /// Output only. Server generated global unique identifier of
13180 /// [UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier) format.
13181 pub uid: std::string::String,
13182
13183 /// Output only. The timestamp when this VolumeRestore resource was
13184 /// created.
13185 pub create_time: std::option::Option<wkt::Timestamp>,
13186
13187 /// Output only. The timestamp when this VolumeRestore resource was last
13188 /// updated.
13189 pub update_time: std::option::Option<wkt::Timestamp>,
13190
13191 /// Output only. The full name of the VolumeBackup from which the volume will
13192 /// be restored. Format:
13193 /// `projects/*/locations/*/backupPlans/*/backups/*/volumeBackups/*`.
13194 pub volume_backup: std::string::String,
13195
13196 /// Output only. The reference to the target Kubernetes PVC to be restored.
13197 pub target_pvc: std::option::Option<crate::model::NamespacedName>,
13198
13199 /// Output only. A storage system-specific opaque handler to the underlying
13200 /// volume created for the target PVC from the volume backup.
13201 pub volume_handle: std::string::String,
13202
13203 /// Output only. The type of volume provisioned
13204 pub volume_type: crate::model::volume_restore::VolumeType,
13205
13206 /// Output only. The timestamp when the associated underlying volume
13207 /// restoration completed.
13208 pub complete_time: std::option::Option<wkt::Timestamp>,
13209
13210 /// Output only. The current state of this VolumeRestore.
13211 pub state: crate::model::volume_restore::State,
13212
13213 /// Output only. A human readable message explaining why the VolumeRestore is
13214 /// in its current state.
13215 pub state_message: std::string::String,
13216
13217 /// Output only. `etag` is used for optimistic concurrency control as a way to
13218 /// help prevent simultaneous updates of a volume restore from overwriting each
13219 /// other. It is strongly suggested that systems make use of the `etag` in the
13220 /// read-modify-write cycle to perform volume restore updates in order to avoid
13221 /// race conditions.
13222 pub etag: std::string::String,
13223
13224 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
13225}
13226
13227impl VolumeRestore {
13228 pub fn new() -> Self {
13229 std::default::Default::default()
13230 }
13231
13232 /// Sets the value of [name][crate::model::VolumeRestore::name].
13233 ///
13234 /// # Example
13235 /// ```ignore,no_run
13236 /// # use google_cloud_gkebackup_v1::model::VolumeRestore;
13237 /// let x = VolumeRestore::new().set_name("example");
13238 /// ```
13239 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
13240 self.name = v.into();
13241 self
13242 }
13243
13244 /// Sets the value of [uid][crate::model::VolumeRestore::uid].
13245 ///
13246 /// # Example
13247 /// ```ignore,no_run
13248 /// # use google_cloud_gkebackup_v1::model::VolumeRestore;
13249 /// let x = VolumeRestore::new().set_uid("example");
13250 /// ```
13251 pub fn set_uid<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
13252 self.uid = v.into();
13253 self
13254 }
13255
13256 /// Sets the value of [create_time][crate::model::VolumeRestore::create_time].
13257 ///
13258 /// # Example
13259 /// ```ignore,no_run
13260 /// # use google_cloud_gkebackup_v1::model::VolumeRestore;
13261 /// use wkt::Timestamp;
13262 /// let x = VolumeRestore::new().set_create_time(Timestamp::default()/* use setters */);
13263 /// ```
13264 pub fn set_create_time<T>(mut self, v: T) -> Self
13265 where
13266 T: std::convert::Into<wkt::Timestamp>,
13267 {
13268 self.create_time = std::option::Option::Some(v.into());
13269 self
13270 }
13271
13272 /// Sets or clears the value of [create_time][crate::model::VolumeRestore::create_time].
13273 ///
13274 /// # Example
13275 /// ```ignore,no_run
13276 /// # use google_cloud_gkebackup_v1::model::VolumeRestore;
13277 /// use wkt::Timestamp;
13278 /// let x = VolumeRestore::new().set_or_clear_create_time(Some(Timestamp::default()/* use setters */));
13279 /// let x = VolumeRestore::new().set_or_clear_create_time(None::<Timestamp>);
13280 /// ```
13281 pub fn set_or_clear_create_time<T>(mut self, v: std::option::Option<T>) -> Self
13282 where
13283 T: std::convert::Into<wkt::Timestamp>,
13284 {
13285 self.create_time = v.map(|x| x.into());
13286 self
13287 }
13288
13289 /// Sets the value of [update_time][crate::model::VolumeRestore::update_time].
13290 ///
13291 /// # Example
13292 /// ```ignore,no_run
13293 /// # use google_cloud_gkebackup_v1::model::VolumeRestore;
13294 /// use wkt::Timestamp;
13295 /// let x = VolumeRestore::new().set_update_time(Timestamp::default()/* use setters */);
13296 /// ```
13297 pub fn set_update_time<T>(mut self, v: T) -> Self
13298 where
13299 T: std::convert::Into<wkt::Timestamp>,
13300 {
13301 self.update_time = std::option::Option::Some(v.into());
13302 self
13303 }
13304
13305 /// Sets or clears the value of [update_time][crate::model::VolumeRestore::update_time].
13306 ///
13307 /// # Example
13308 /// ```ignore,no_run
13309 /// # use google_cloud_gkebackup_v1::model::VolumeRestore;
13310 /// use wkt::Timestamp;
13311 /// let x = VolumeRestore::new().set_or_clear_update_time(Some(Timestamp::default()/* use setters */));
13312 /// let x = VolumeRestore::new().set_or_clear_update_time(None::<Timestamp>);
13313 /// ```
13314 pub fn set_or_clear_update_time<T>(mut self, v: std::option::Option<T>) -> Self
13315 where
13316 T: std::convert::Into<wkt::Timestamp>,
13317 {
13318 self.update_time = v.map(|x| x.into());
13319 self
13320 }
13321
13322 /// Sets the value of [volume_backup][crate::model::VolumeRestore::volume_backup].
13323 ///
13324 /// # Example
13325 /// ```ignore,no_run
13326 /// # use google_cloud_gkebackup_v1::model::VolumeRestore;
13327 /// let x = VolumeRestore::new().set_volume_backup("example");
13328 /// ```
13329 pub fn set_volume_backup<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
13330 self.volume_backup = v.into();
13331 self
13332 }
13333
13334 /// Sets the value of [target_pvc][crate::model::VolumeRestore::target_pvc].
13335 ///
13336 /// # Example
13337 /// ```ignore,no_run
13338 /// # use google_cloud_gkebackup_v1::model::VolumeRestore;
13339 /// use google_cloud_gkebackup_v1::model::NamespacedName;
13340 /// let x = VolumeRestore::new().set_target_pvc(NamespacedName::default()/* use setters */);
13341 /// ```
13342 pub fn set_target_pvc<T>(mut self, v: T) -> Self
13343 where
13344 T: std::convert::Into<crate::model::NamespacedName>,
13345 {
13346 self.target_pvc = std::option::Option::Some(v.into());
13347 self
13348 }
13349
13350 /// Sets or clears the value of [target_pvc][crate::model::VolumeRestore::target_pvc].
13351 ///
13352 /// # Example
13353 /// ```ignore,no_run
13354 /// # use google_cloud_gkebackup_v1::model::VolumeRestore;
13355 /// use google_cloud_gkebackup_v1::model::NamespacedName;
13356 /// let x = VolumeRestore::new().set_or_clear_target_pvc(Some(NamespacedName::default()/* use setters */));
13357 /// let x = VolumeRestore::new().set_or_clear_target_pvc(None::<NamespacedName>);
13358 /// ```
13359 pub fn set_or_clear_target_pvc<T>(mut self, v: std::option::Option<T>) -> Self
13360 where
13361 T: std::convert::Into<crate::model::NamespacedName>,
13362 {
13363 self.target_pvc = v.map(|x| x.into());
13364 self
13365 }
13366
13367 /// Sets the value of [volume_handle][crate::model::VolumeRestore::volume_handle].
13368 ///
13369 /// # Example
13370 /// ```ignore,no_run
13371 /// # use google_cloud_gkebackup_v1::model::VolumeRestore;
13372 /// let x = VolumeRestore::new().set_volume_handle("example");
13373 /// ```
13374 pub fn set_volume_handle<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
13375 self.volume_handle = v.into();
13376 self
13377 }
13378
13379 /// Sets the value of [volume_type][crate::model::VolumeRestore::volume_type].
13380 ///
13381 /// # Example
13382 /// ```ignore,no_run
13383 /// # use google_cloud_gkebackup_v1::model::VolumeRestore;
13384 /// use google_cloud_gkebackup_v1::model::volume_restore::VolumeType;
13385 /// let x0 = VolumeRestore::new().set_volume_type(VolumeType::GcePersistentDisk);
13386 /// ```
13387 pub fn set_volume_type<T: std::convert::Into<crate::model::volume_restore::VolumeType>>(
13388 mut self,
13389 v: T,
13390 ) -> Self {
13391 self.volume_type = v.into();
13392 self
13393 }
13394
13395 /// Sets the value of [complete_time][crate::model::VolumeRestore::complete_time].
13396 ///
13397 /// # Example
13398 /// ```ignore,no_run
13399 /// # use google_cloud_gkebackup_v1::model::VolumeRestore;
13400 /// use wkt::Timestamp;
13401 /// let x = VolumeRestore::new().set_complete_time(Timestamp::default()/* use setters */);
13402 /// ```
13403 pub fn set_complete_time<T>(mut self, v: T) -> Self
13404 where
13405 T: std::convert::Into<wkt::Timestamp>,
13406 {
13407 self.complete_time = std::option::Option::Some(v.into());
13408 self
13409 }
13410
13411 /// Sets or clears the value of [complete_time][crate::model::VolumeRestore::complete_time].
13412 ///
13413 /// # Example
13414 /// ```ignore,no_run
13415 /// # use google_cloud_gkebackup_v1::model::VolumeRestore;
13416 /// use wkt::Timestamp;
13417 /// let x = VolumeRestore::new().set_or_clear_complete_time(Some(Timestamp::default()/* use setters */));
13418 /// let x = VolumeRestore::new().set_or_clear_complete_time(None::<Timestamp>);
13419 /// ```
13420 pub fn set_or_clear_complete_time<T>(mut self, v: std::option::Option<T>) -> Self
13421 where
13422 T: std::convert::Into<wkt::Timestamp>,
13423 {
13424 self.complete_time = v.map(|x| x.into());
13425 self
13426 }
13427
13428 /// Sets the value of [state][crate::model::VolumeRestore::state].
13429 ///
13430 /// # Example
13431 /// ```ignore,no_run
13432 /// # use google_cloud_gkebackup_v1::model::VolumeRestore;
13433 /// use google_cloud_gkebackup_v1::model::volume_restore::State;
13434 /// let x0 = VolumeRestore::new().set_state(State::Creating);
13435 /// let x1 = VolumeRestore::new().set_state(State::Restoring);
13436 /// let x2 = VolumeRestore::new().set_state(State::Succeeded);
13437 /// ```
13438 pub fn set_state<T: std::convert::Into<crate::model::volume_restore::State>>(
13439 mut self,
13440 v: T,
13441 ) -> Self {
13442 self.state = v.into();
13443 self
13444 }
13445
13446 /// Sets the value of [state_message][crate::model::VolumeRestore::state_message].
13447 ///
13448 /// # Example
13449 /// ```ignore,no_run
13450 /// # use google_cloud_gkebackup_v1::model::VolumeRestore;
13451 /// let x = VolumeRestore::new().set_state_message("example");
13452 /// ```
13453 pub fn set_state_message<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
13454 self.state_message = v.into();
13455 self
13456 }
13457
13458 /// Sets the value of [etag][crate::model::VolumeRestore::etag].
13459 ///
13460 /// # Example
13461 /// ```ignore,no_run
13462 /// # use google_cloud_gkebackup_v1::model::VolumeRestore;
13463 /// let x = VolumeRestore::new().set_etag("example");
13464 /// ```
13465 pub fn set_etag<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
13466 self.etag = v.into();
13467 self
13468 }
13469}
13470
13471impl wkt::message::Message for VolumeRestore {
13472 fn typename() -> &'static str {
13473 "type.googleapis.com/google.cloud.gkebackup.v1.VolumeRestore"
13474 }
13475}
13476
13477/// Defines additional types related to [VolumeRestore].
13478pub mod volume_restore {
13479 #[allow(unused_imports)]
13480 use super::*;
13481
13482 /// Supported volume types.
13483 ///
13484 /// # Working with unknown values
13485 ///
13486 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
13487 /// additional enum variants at any time. Adding new variants is not considered
13488 /// a breaking change. Applications should write their code in anticipation of:
13489 ///
13490 /// - New values appearing in future releases of the client library, **and**
13491 /// - New values received dynamically, without application changes.
13492 ///
13493 /// Please consult the [Working with enums] section in the user guide for some
13494 /// guidelines.
13495 ///
13496 /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
13497 #[derive(Clone, Debug, PartialEq)]
13498 #[non_exhaustive]
13499 pub enum VolumeType {
13500 /// Default
13501 Unspecified,
13502 /// Compute Engine Persistent Disk volume
13503 GcePersistentDisk,
13504 /// If set, the enum was initialized with an unknown value.
13505 ///
13506 /// Applications can examine the value using [VolumeType::value] or
13507 /// [VolumeType::name].
13508 UnknownValue(volume_type::UnknownValue),
13509 }
13510
13511 #[doc(hidden)]
13512 pub mod volume_type {
13513 #[allow(unused_imports)]
13514 use super::*;
13515 #[derive(Clone, Debug, PartialEq)]
13516 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
13517 }
13518
13519 impl VolumeType {
13520 /// Gets the enum value.
13521 ///
13522 /// Returns `None` if the enum contains an unknown value deserialized from
13523 /// the string representation of enums.
13524 pub fn value(&self) -> std::option::Option<i32> {
13525 match self {
13526 Self::Unspecified => std::option::Option::Some(0),
13527 Self::GcePersistentDisk => std::option::Option::Some(1),
13528 Self::UnknownValue(u) => u.0.value(),
13529 }
13530 }
13531
13532 /// Gets the enum value as a string.
13533 ///
13534 /// Returns `None` if the enum contains an unknown value deserialized from
13535 /// the integer representation of enums.
13536 pub fn name(&self) -> std::option::Option<&str> {
13537 match self {
13538 Self::Unspecified => std::option::Option::Some("VOLUME_TYPE_UNSPECIFIED"),
13539 Self::GcePersistentDisk => std::option::Option::Some("GCE_PERSISTENT_DISK"),
13540 Self::UnknownValue(u) => u.0.name(),
13541 }
13542 }
13543 }
13544
13545 impl std::default::Default for VolumeType {
13546 fn default() -> Self {
13547 use std::convert::From;
13548 Self::from(0)
13549 }
13550 }
13551
13552 impl std::fmt::Display for VolumeType {
13553 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
13554 wkt::internal::display_enum(f, self.name(), self.value())
13555 }
13556 }
13557
13558 impl std::convert::From<i32> for VolumeType {
13559 fn from(value: i32) -> Self {
13560 match value {
13561 0 => Self::Unspecified,
13562 1 => Self::GcePersistentDisk,
13563 _ => Self::UnknownValue(volume_type::UnknownValue(
13564 wkt::internal::UnknownEnumValue::Integer(value),
13565 )),
13566 }
13567 }
13568 }
13569
13570 impl std::convert::From<&str> for VolumeType {
13571 fn from(value: &str) -> Self {
13572 use std::string::ToString;
13573 match value {
13574 "VOLUME_TYPE_UNSPECIFIED" => Self::Unspecified,
13575 "GCE_PERSISTENT_DISK" => Self::GcePersistentDisk,
13576 _ => Self::UnknownValue(volume_type::UnknownValue(
13577 wkt::internal::UnknownEnumValue::String(value.to_string()),
13578 )),
13579 }
13580 }
13581 }
13582
13583 impl serde::ser::Serialize for VolumeType {
13584 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
13585 where
13586 S: serde::Serializer,
13587 {
13588 match self {
13589 Self::Unspecified => serializer.serialize_i32(0),
13590 Self::GcePersistentDisk => serializer.serialize_i32(1),
13591 Self::UnknownValue(u) => u.0.serialize(serializer),
13592 }
13593 }
13594 }
13595
13596 impl<'de> serde::de::Deserialize<'de> for VolumeType {
13597 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
13598 where
13599 D: serde::Deserializer<'de>,
13600 {
13601 deserializer.deserialize_any(wkt::internal::EnumVisitor::<VolumeType>::new(
13602 ".google.cloud.gkebackup.v1.VolumeRestore.VolumeType",
13603 ))
13604 }
13605 }
13606
13607 /// The current state of a VolumeRestore
13608 ///
13609 /// # Working with unknown values
13610 ///
13611 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
13612 /// additional enum variants at any time. Adding new variants is not considered
13613 /// a breaking change. Applications should write their code in anticipation of:
13614 ///
13615 /// - New values appearing in future releases of the client library, **and**
13616 /// - New values received dynamically, without application changes.
13617 ///
13618 /// Please consult the [Working with enums] section in the user guide for some
13619 /// guidelines.
13620 ///
13621 /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
13622 #[derive(Clone, Debug, PartialEq)]
13623 #[non_exhaustive]
13624 pub enum State {
13625 /// This is an illegal state and should not be encountered.
13626 Unspecified,
13627 /// A volume for the restore was identified and restore process is about to
13628 /// start.
13629 Creating,
13630 /// The volume is currently being restored.
13631 Restoring,
13632 /// The volume has been successfully restored.
13633 Succeeded,
13634 /// The volume restoration process failed.
13635 Failed,
13636 /// This VolumeRestore resource is in the process of being deleted.
13637 Deleting,
13638 /// If set, the enum was initialized with an unknown value.
13639 ///
13640 /// Applications can examine the value using [State::value] or
13641 /// [State::name].
13642 UnknownValue(state::UnknownValue),
13643 }
13644
13645 #[doc(hidden)]
13646 pub mod state {
13647 #[allow(unused_imports)]
13648 use super::*;
13649 #[derive(Clone, Debug, PartialEq)]
13650 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
13651 }
13652
13653 impl State {
13654 /// Gets the enum value.
13655 ///
13656 /// Returns `None` if the enum contains an unknown value deserialized from
13657 /// the string representation of enums.
13658 pub fn value(&self) -> std::option::Option<i32> {
13659 match self {
13660 Self::Unspecified => std::option::Option::Some(0),
13661 Self::Creating => std::option::Option::Some(1),
13662 Self::Restoring => std::option::Option::Some(2),
13663 Self::Succeeded => std::option::Option::Some(3),
13664 Self::Failed => std::option::Option::Some(4),
13665 Self::Deleting => std::option::Option::Some(5),
13666 Self::UnknownValue(u) => u.0.value(),
13667 }
13668 }
13669
13670 /// Gets the enum value as a string.
13671 ///
13672 /// Returns `None` if the enum contains an unknown value deserialized from
13673 /// the integer representation of enums.
13674 pub fn name(&self) -> std::option::Option<&str> {
13675 match self {
13676 Self::Unspecified => std::option::Option::Some("STATE_UNSPECIFIED"),
13677 Self::Creating => std::option::Option::Some("CREATING"),
13678 Self::Restoring => std::option::Option::Some("RESTORING"),
13679 Self::Succeeded => std::option::Option::Some("SUCCEEDED"),
13680 Self::Failed => std::option::Option::Some("FAILED"),
13681 Self::Deleting => std::option::Option::Some("DELETING"),
13682 Self::UnknownValue(u) => u.0.name(),
13683 }
13684 }
13685 }
13686
13687 impl std::default::Default for State {
13688 fn default() -> Self {
13689 use std::convert::From;
13690 Self::from(0)
13691 }
13692 }
13693
13694 impl std::fmt::Display for State {
13695 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
13696 wkt::internal::display_enum(f, self.name(), self.value())
13697 }
13698 }
13699
13700 impl std::convert::From<i32> for State {
13701 fn from(value: i32) -> Self {
13702 match value {
13703 0 => Self::Unspecified,
13704 1 => Self::Creating,
13705 2 => Self::Restoring,
13706 3 => Self::Succeeded,
13707 4 => Self::Failed,
13708 5 => Self::Deleting,
13709 _ => Self::UnknownValue(state::UnknownValue(
13710 wkt::internal::UnknownEnumValue::Integer(value),
13711 )),
13712 }
13713 }
13714 }
13715
13716 impl std::convert::From<&str> for State {
13717 fn from(value: &str) -> Self {
13718 use std::string::ToString;
13719 match value {
13720 "STATE_UNSPECIFIED" => Self::Unspecified,
13721 "CREATING" => Self::Creating,
13722 "RESTORING" => Self::Restoring,
13723 "SUCCEEDED" => Self::Succeeded,
13724 "FAILED" => Self::Failed,
13725 "DELETING" => Self::Deleting,
13726 _ => Self::UnknownValue(state::UnknownValue(
13727 wkt::internal::UnknownEnumValue::String(value.to_string()),
13728 )),
13729 }
13730 }
13731 }
13732
13733 impl serde::ser::Serialize for State {
13734 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
13735 where
13736 S: serde::Serializer,
13737 {
13738 match self {
13739 Self::Unspecified => serializer.serialize_i32(0),
13740 Self::Creating => serializer.serialize_i32(1),
13741 Self::Restoring => serializer.serialize_i32(2),
13742 Self::Succeeded => serializer.serialize_i32(3),
13743 Self::Failed => serializer.serialize_i32(4),
13744 Self::Deleting => serializer.serialize_i32(5),
13745 Self::UnknownValue(u) => u.0.serialize(serializer),
13746 }
13747 }
13748 }
13749
13750 impl<'de> serde::de::Deserialize<'de> for State {
13751 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
13752 where
13753 D: serde::Deserializer<'de>,
13754 {
13755 deserializer.deserialize_any(wkt::internal::EnumVisitor::<State>::new(
13756 ".google.cloud.gkebackup.v1.VolumeRestore.State",
13757 ))
13758 }
13759 }
13760}