google_cloud_storage/generated/gapic_control/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::bare_urls)]
18#![allow(rustdoc::broken_intra_doc_links)]
19#![allow(rustdoc::invalid_html_tags)]
20#![allow(rustdoc::redundant_explicit_links)]
21
22mod debug;
23mod deserialize;
24mod serialize;
25
26/// Contains information about a pending rename operation.
27#[derive(Clone, Default, PartialEq)]
28#[non_exhaustive]
29pub struct PendingRenameInfo {
30 /// Output only. The name of the rename operation.
31 pub operation: std::string::String,
32
33 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
34}
35
36impl PendingRenameInfo {
37 /// Creates a new default instance.
38 pub fn new() -> Self {
39 std::default::Default::default()
40 }
41
42 /// Sets the value of [operation][crate::model::PendingRenameInfo::operation].
43 ///
44 /// # Example
45 /// ```ignore,no_run
46 /// # use google_cloud_storage::model::PendingRenameInfo;
47 /// let x = PendingRenameInfo::new().set_operation("example");
48 /// ```
49 pub fn set_operation<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
50 self.operation = v.into();
51 self
52 }
53}
54
55impl wkt::message::Message for PendingRenameInfo {
56 fn typename() -> &'static str {
57 "type.googleapis.com/google.storage.control.v2.PendingRenameInfo"
58 }
59}
60
61/// A folder resource. This resource can only exist in a hierarchical namespace
62/// enabled bucket.
63#[derive(Clone, Default, PartialEq)]
64#[non_exhaustive]
65pub struct Folder {
66 /// Identifier. The name of this folder.
67 /// Format: `projects/{project}/buckets/{bucket}/folders/{folder}`
68 pub name: std::string::String,
69
70 /// Output only. The version of the metadata for this folder. Used for
71 /// preconditions and for detecting changes in metadata.
72 pub metageneration: i64,
73
74 /// Output only. The creation time of the folder.
75 pub create_time: std::option::Option<wkt::Timestamp>,
76
77 /// Output only. The modification time of the folder.
78 pub update_time: std::option::Option<wkt::Timestamp>,
79
80 /// Output only. Only present if the folder is part of an ongoing RenameFolder
81 /// operation. Contains information which can be used to query the operation
82 /// status. The presence of this field also indicates all write operations are
83 /// blocked for this folder, including folder, managed folder, and object
84 /// operations.
85 pub pending_rename_info: std::option::Option<crate::model::PendingRenameInfo>,
86
87 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
88}
89
90impl Folder {
91 /// Creates a new default instance.
92 pub fn new() -> Self {
93 std::default::Default::default()
94 }
95
96 /// Sets the value of [name][crate::model::Folder::name].
97 ///
98 /// # Example
99 /// ```ignore,no_run
100 /// # use google_cloud_storage::model::Folder;
101 /// # let project_id = "project_id";
102 /// # let bucket_id = "bucket_id";
103 /// # let folder_id = "folder_id";
104 /// let x = Folder::new().set_name(format!("projects/{project_id}/buckets/{bucket_id}/folders/{folder_id}"));
105 /// ```
106 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
107 self.name = v.into();
108 self
109 }
110
111 /// Sets the value of [metageneration][crate::model::Folder::metageneration].
112 ///
113 /// # Example
114 /// ```ignore,no_run
115 /// # use google_cloud_storage::model::Folder;
116 /// let x = Folder::new().set_metageneration(42);
117 /// ```
118 pub fn set_metageneration<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
119 self.metageneration = v.into();
120 self
121 }
122
123 /// Sets the value of [create_time][crate::model::Folder::create_time].
124 ///
125 /// # Example
126 /// ```ignore,no_run
127 /// # use google_cloud_storage::model::Folder;
128 /// use wkt::Timestamp;
129 /// let x = Folder::new().set_create_time(Timestamp::default()/* use setters */);
130 /// ```
131 pub fn set_create_time<T>(mut self, v: T) -> Self
132 where
133 T: std::convert::Into<wkt::Timestamp>,
134 {
135 self.create_time = std::option::Option::Some(v.into());
136 self
137 }
138
139 /// Sets or clears the value of [create_time][crate::model::Folder::create_time].
140 ///
141 /// # Example
142 /// ```ignore,no_run
143 /// # use google_cloud_storage::model::Folder;
144 /// use wkt::Timestamp;
145 /// let x = Folder::new().set_or_clear_create_time(Some(Timestamp::default()/* use setters */));
146 /// let x = Folder::new().set_or_clear_create_time(None::<Timestamp>);
147 /// ```
148 pub fn set_or_clear_create_time<T>(mut self, v: std::option::Option<T>) -> Self
149 where
150 T: std::convert::Into<wkt::Timestamp>,
151 {
152 self.create_time = v.map(|x| x.into());
153 self
154 }
155
156 /// Sets the value of [update_time][crate::model::Folder::update_time].
157 ///
158 /// # Example
159 /// ```ignore,no_run
160 /// # use google_cloud_storage::model::Folder;
161 /// use wkt::Timestamp;
162 /// let x = Folder::new().set_update_time(Timestamp::default()/* use setters */);
163 /// ```
164 pub fn set_update_time<T>(mut self, v: T) -> Self
165 where
166 T: std::convert::Into<wkt::Timestamp>,
167 {
168 self.update_time = std::option::Option::Some(v.into());
169 self
170 }
171
172 /// Sets or clears the value of [update_time][crate::model::Folder::update_time].
173 ///
174 /// # Example
175 /// ```ignore,no_run
176 /// # use google_cloud_storage::model::Folder;
177 /// use wkt::Timestamp;
178 /// let x = Folder::new().set_or_clear_update_time(Some(Timestamp::default()/* use setters */));
179 /// let x = Folder::new().set_or_clear_update_time(None::<Timestamp>);
180 /// ```
181 pub fn set_or_clear_update_time<T>(mut self, v: std::option::Option<T>) -> Self
182 where
183 T: std::convert::Into<wkt::Timestamp>,
184 {
185 self.update_time = v.map(|x| x.into());
186 self
187 }
188
189 /// Sets the value of [pending_rename_info][crate::model::Folder::pending_rename_info].
190 ///
191 /// # Example
192 /// ```ignore,no_run
193 /// # use google_cloud_storage::model::Folder;
194 /// use google_cloud_storage::model::PendingRenameInfo;
195 /// let x = Folder::new().set_pending_rename_info(PendingRenameInfo::default()/* use setters */);
196 /// ```
197 pub fn set_pending_rename_info<T>(mut self, v: T) -> Self
198 where
199 T: std::convert::Into<crate::model::PendingRenameInfo>,
200 {
201 self.pending_rename_info = std::option::Option::Some(v.into());
202 self
203 }
204
205 /// Sets or clears the value of [pending_rename_info][crate::model::Folder::pending_rename_info].
206 ///
207 /// # Example
208 /// ```ignore,no_run
209 /// # use google_cloud_storage::model::Folder;
210 /// use google_cloud_storage::model::PendingRenameInfo;
211 /// let x = Folder::new().set_or_clear_pending_rename_info(Some(PendingRenameInfo::default()/* use setters */));
212 /// let x = Folder::new().set_or_clear_pending_rename_info(None::<PendingRenameInfo>);
213 /// ```
214 pub fn set_or_clear_pending_rename_info<T>(mut self, v: std::option::Option<T>) -> Self
215 where
216 T: std::convert::Into<crate::model::PendingRenameInfo>,
217 {
218 self.pending_rename_info = v.map(|x| x.into());
219 self
220 }
221}
222
223impl wkt::message::Message for Folder {
224 fn typename() -> &'static str {
225 "type.googleapis.com/google.storage.control.v2.Folder"
226 }
227}
228
229/// Request message for GetFolder. This operation is only applicable to a
230/// hierarchical namespace enabled bucket.
231#[derive(Clone, Default, PartialEq)]
232#[non_exhaustive]
233pub struct GetFolderRequest {
234 /// Required. Name of the folder.
235 /// Format: `projects/{project}/buckets/{bucket}/folders/{folder}`
236 pub name: std::string::String,
237
238 /// Makes the operation only succeed conditional on whether the folder's
239 /// current metageneration matches the given value.
240 pub if_metageneration_match: std::option::Option<i64>,
241
242 /// Makes the operation only succeed conditional on whether the folder's
243 /// current metageneration does not match the given value.
244 pub if_metageneration_not_match: std::option::Option<i64>,
245
246 /// Optional. A unique identifier for this request. UUID is the recommended
247 /// format, but other formats are still accepted.
248 pub request_id: std::string::String,
249
250 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
251}
252
253impl GetFolderRequest {
254 /// Creates a new default instance.
255 pub fn new() -> Self {
256 std::default::Default::default()
257 }
258
259 /// Sets the value of [name][crate::model::GetFolderRequest::name].
260 ///
261 /// # Example
262 /// ```ignore,no_run
263 /// # use google_cloud_storage::model::GetFolderRequest;
264 /// # let project_id = "project_id";
265 /// # let bucket_id = "bucket_id";
266 /// # let folder_id = "folder_id";
267 /// let x = GetFolderRequest::new().set_name(format!("projects/{project_id}/buckets/{bucket_id}/folders/{folder_id}"));
268 /// ```
269 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
270 self.name = v.into();
271 self
272 }
273
274 /// Sets the value of [if_metageneration_match][crate::model::GetFolderRequest::if_metageneration_match].
275 ///
276 /// # Example
277 /// ```ignore,no_run
278 /// # use google_cloud_storage::model::GetFolderRequest;
279 /// let x = GetFolderRequest::new().set_if_metageneration_match(42);
280 /// ```
281 pub fn set_if_metageneration_match<T>(mut self, v: T) -> Self
282 where
283 T: std::convert::Into<i64>,
284 {
285 self.if_metageneration_match = std::option::Option::Some(v.into());
286 self
287 }
288
289 /// Sets or clears the value of [if_metageneration_match][crate::model::GetFolderRequest::if_metageneration_match].
290 ///
291 /// # Example
292 /// ```ignore,no_run
293 /// # use google_cloud_storage::model::GetFolderRequest;
294 /// let x = GetFolderRequest::new().set_or_clear_if_metageneration_match(Some(42));
295 /// let x = GetFolderRequest::new().set_or_clear_if_metageneration_match(None::<i32>);
296 /// ```
297 pub fn set_or_clear_if_metageneration_match<T>(mut self, v: std::option::Option<T>) -> Self
298 where
299 T: std::convert::Into<i64>,
300 {
301 self.if_metageneration_match = v.map(|x| x.into());
302 self
303 }
304
305 /// Sets the value of [if_metageneration_not_match][crate::model::GetFolderRequest::if_metageneration_not_match].
306 ///
307 /// # Example
308 /// ```ignore,no_run
309 /// # use google_cloud_storage::model::GetFolderRequest;
310 /// let x = GetFolderRequest::new().set_if_metageneration_not_match(42);
311 /// ```
312 pub fn set_if_metageneration_not_match<T>(mut self, v: T) -> Self
313 where
314 T: std::convert::Into<i64>,
315 {
316 self.if_metageneration_not_match = std::option::Option::Some(v.into());
317 self
318 }
319
320 /// Sets or clears the value of [if_metageneration_not_match][crate::model::GetFolderRequest::if_metageneration_not_match].
321 ///
322 /// # Example
323 /// ```ignore,no_run
324 /// # use google_cloud_storage::model::GetFolderRequest;
325 /// let x = GetFolderRequest::new().set_or_clear_if_metageneration_not_match(Some(42));
326 /// let x = GetFolderRequest::new().set_or_clear_if_metageneration_not_match(None::<i32>);
327 /// ```
328 pub fn set_or_clear_if_metageneration_not_match<T>(mut self, v: std::option::Option<T>) -> Self
329 where
330 T: std::convert::Into<i64>,
331 {
332 self.if_metageneration_not_match = v.map(|x| x.into());
333 self
334 }
335
336 /// Sets the value of [request_id][crate::model::GetFolderRequest::request_id].
337 ///
338 /// # Example
339 /// ```ignore,no_run
340 /// # use google_cloud_storage::model::GetFolderRequest;
341 /// let x = GetFolderRequest::new().set_request_id("example");
342 /// ```
343 pub fn set_request_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
344 self.request_id = v.into();
345 self
346 }
347}
348
349impl wkt::message::Message for GetFolderRequest {
350 fn typename() -> &'static str {
351 "type.googleapis.com/google.storage.control.v2.GetFolderRequest"
352 }
353}
354
355/// Request message for CreateFolder. This operation is only applicable to a
356/// hierarchical namespace enabled bucket.
357#[derive(Clone, Default, PartialEq)]
358#[non_exhaustive]
359pub struct CreateFolderRequest {
360 /// Required. Name of the bucket in which the folder will reside. The bucket
361 /// must be a hierarchical namespace enabled bucket.
362 pub parent: std::string::String,
363
364 /// Required. Properties of the new folder being created.
365 /// The bucket and name of the folder are specified in the parent and folder_id
366 /// fields, respectively. Populating those fields in `folder` will result in an
367 /// error.
368 pub folder: std::option::Option<crate::model::Folder>,
369
370 /// Required. The full name of a folder, including all its parent folders.
371 /// Folders use single '/' characters as a delimiter.
372 /// The folder_id must end with a slash.
373 /// For example, the folder_id of "books/biographies/" would create a new
374 /// "biographies/" folder under the "books/" folder.
375 pub folder_id: std::string::String,
376
377 /// Optional. If true, parent folder doesn't have to be present and all missing
378 /// ancestor folders will be created atomically.
379 pub recursive: bool,
380
381 /// Optional. A unique identifier for this request. UUID is the recommended
382 /// format, but other formats are still accepted.
383 pub request_id: std::string::String,
384
385 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
386}
387
388impl CreateFolderRequest {
389 /// Creates a new default instance.
390 pub fn new() -> Self {
391 std::default::Default::default()
392 }
393
394 /// Sets the value of [parent][crate::model::CreateFolderRequest::parent].
395 ///
396 /// # Example
397 /// ```ignore,no_run
398 /// # use google_cloud_storage::model::CreateFolderRequest;
399 /// # let project_id = "project_id";
400 /// # let bucket_id = "bucket_id";
401 /// let x = CreateFolderRequest::new().set_parent(format!("projects/{project_id}/buckets/{bucket_id}"));
402 /// ```
403 pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
404 self.parent = v.into();
405 self
406 }
407
408 /// Sets the value of [folder][crate::model::CreateFolderRequest::folder].
409 ///
410 /// # Example
411 /// ```ignore,no_run
412 /// # use google_cloud_storage::model::CreateFolderRequest;
413 /// use google_cloud_storage::model::Folder;
414 /// let x = CreateFolderRequest::new().set_folder(Folder::default()/* use setters */);
415 /// ```
416 pub fn set_folder<T>(mut self, v: T) -> Self
417 where
418 T: std::convert::Into<crate::model::Folder>,
419 {
420 self.folder = std::option::Option::Some(v.into());
421 self
422 }
423
424 /// Sets or clears the value of [folder][crate::model::CreateFolderRequest::folder].
425 ///
426 /// # Example
427 /// ```ignore,no_run
428 /// # use google_cloud_storage::model::CreateFolderRequest;
429 /// use google_cloud_storage::model::Folder;
430 /// let x = CreateFolderRequest::new().set_or_clear_folder(Some(Folder::default()/* use setters */));
431 /// let x = CreateFolderRequest::new().set_or_clear_folder(None::<Folder>);
432 /// ```
433 pub fn set_or_clear_folder<T>(mut self, v: std::option::Option<T>) -> Self
434 where
435 T: std::convert::Into<crate::model::Folder>,
436 {
437 self.folder = v.map(|x| x.into());
438 self
439 }
440
441 /// Sets the value of [folder_id][crate::model::CreateFolderRequest::folder_id].
442 ///
443 /// # Example
444 /// ```ignore,no_run
445 /// # use google_cloud_storage::model::CreateFolderRequest;
446 /// let x = CreateFolderRequest::new().set_folder_id("example");
447 /// ```
448 pub fn set_folder_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
449 self.folder_id = v.into();
450 self
451 }
452
453 /// Sets the value of [recursive][crate::model::CreateFolderRequest::recursive].
454 ///
455 /// # Example
456 /// ```ignore,no_run
457 /// # use google_cloud_storage::model::CreateFolderRequest;
458 /// let x = CreateFolderRequest::new().set_recursive(true);
459 /// ```
460 pub fn set_recursive<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
461 self.recursive = v.into();
462 self
463 }
464
465 /// Sets the value of [request_id][crate::model::CreateFolderRequest::request_id].
466 ///
467 /// # Example
468 /// ```ignore,no_run
469 /// # use google_cloud_storage::model::CreateFolderRequest;
470 /// let x = CreateFolderRequest::new().set_request_id("example");
471 /// ```
472 pub fn set_request_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
473 self.request_id = v.into();
474 self
475 }
476}
477
478impl wkt::message::Message for CreateFolderRequest {
479 fn typename() -> &'static str {
480 "type.googleapis.com/google.storage.control.v2.CreateFolderRequest"
481 }
482}
483
484/// Request message for DeleteFolder. This operation is only applicable to a
485/// hierarchical namespace enabled bucket.
486#[derive(Clone, Default, PartialEq)]
487#[non_exhaustive]
488pub struct DeleteFolderRequest {
489 /// Required. Name of the folder.
490 /// Format: `projects/{project}/buckets/{bucket}/folders/{folder}`
491 pub name: std::string::String,
492
493 /// Makes the operation only succeed conditional on whether the folder's
494 /// current metageneration matches the given value.
495 pub if_metageneration_match: std::option::Option<i64>,
496
497 /// Makes the operation only succeed conditional on whether the folder's
498 /// current metageneration does not match the given value.
499 pub if_metageneration_not_match: std::option::Option<i64>,
500
501 /// Optional. A unique identifier for this request. UUID is the recommended
502 /// format, but other formats are still accepted.
503 pub request_id: std::string::String,
504
505 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
506}
507
508impl DeleteFolderRequest {
509 /// Creates a new default instance.
510 pub fn new() -> Self {
511 std::default::Default::default()
512 }
513
514 /// Sets the value of [name][crate::model::DeleteFolderRequest::name].
515 ///
516 /// # Example
517 /// ```ignore,no_run
518 /// # use google_cloud_storage::model::DeleteFolderRequest;
519 /// # let project_id = "project_id";
520 /// # let bucket_id = "bucket_id";
521 /// # let folder_id = "folder_id";
522 /// let x = DeleteFolderRequest::new().set_name(format!("projects/{project_id}/buckets/{bucket_id}/folders/{folder_id}"));
523 /// ```
524 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
525 self.name = v.into();
526 self
527 }
528
529 /// Sets the value of [if_metageneration_match][crate::model::DeleteFolderRequest::if_metageneration_match].
530 ///
531 /// # Example
532 /// ```ignore,no_run
533 /// # use google_cloud_storage::model::DeleteFolderRequest;
534 /// let x = DeleteFolderRequest::new().set_if_metageneration_match(42);
535 /// ```
536 pub fn set_if_metageneration_match<T>(mut self, v: T) -> Self
537 where
538 T: std::convert::Into<i64>,
539 {
540 self.if_metageneration_match = std::option::Option::Some(v.into());
541 self
542 }
543
544 /// Sets or clears the value of [if_metageneration_match][crate::model::DeleteFolderRequest::if_metageneration_match].
545 ///
546 /// # Example
547 /// ```ignore,no_run
548 /// # use google_cloud_storage::model::DeleteFolderRequest;
549 /// let x = DeleteFolderRequest::new().set_or_clear_if_metageneration_match(Some(42));
550 /// let x = DeleteFolderRequest::new().set_or_clear_if_metageneration_match(None::<i32>);
551 /// ```
552 pub fn set_or_clear_if_metageneration_match<T>(mut self, v: std::option::Option<T>) -> Self
553 where
554 T: std::convert::Into<i64>,
555 {
556 self.if_metageneration_match = v.map(|x| x.into());
557 self
558 }
559
560 /// Sets the value of [if_metageneration_not_match][crate::model::DeleteFolderRequest::if_metageneration_not_match].
561 ///
562 /// # Example
563 /// ```ignore,no_run
564 /// # use google_cloud_storage::model::DeleteFolderRequest;
565 /// let x = DeleteFolderRequest::new().set_if_metageneration_not_match(42);
566 /// ```
567 pub fn set_if_metageneration_not_match<T>(mut self, v: T) -> Self
568 where
569 T: std::convert::Into<i64>,
570 {
571 self.if_metageneration_not_match = std::option::Option::Some(v.into());
572 self
573 }
574
575 /// Sets or clears the value of [if_metageneration_not_match][crate::model::DeleteFolderRequest::if_metageneration_not_match].
576 ///
577 /// # Example
578 /// ```ignore,no_run
579 /// # use google_cloud_storage::model::DeleteFolderRequest;
580 /// let x = DeleteFolderRequest::new().set_or_clear_if_metageneration_not_match(Some(42));
581 /// let x = DeleteFolderRequest::new().set_or_clear_if_metageneration_not_match(None::<i32>);
582 /// ```
583 pub fn set_or_clear_if_metageneration_not_match<T>(mut self, v: std::option::Option<T>) -> Self
584 where
585 T: std::convert::Into<i64>,
586 {
587 self.if_metageneration_not_match = v.map(|x| x.into());
588 self
589 }
590
591 /// Sets the value of [request_id][crate::model::DeleteFolderRequest::request_id].
592 ///
593 /// # Example
594 /// ```ignore,no_run
595 /// # use google_cloud_storage::model::DeleteFolderRequest;
596 /// let x = DeleteFolderRequest::new().set_request_id("example");
597 /// ```
598 pub fn set_request_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
599 self.request_id = v.into();
600 self
601 }
602}
603
604impl wkt::message::Message for DeleteFolderRequest {
605 fn typename() -> &'static str {
606 "type.googleapis.com/google.storage.control.v2.DeleteFolderRequest"
607 }
608}
609
610/// Request message for ListFolders. This operation is only applicable to a
611/// hierarchical namespace enabled bucket.
612#[derive(Clone, Default, PartialEq)]
613#[non_exhaustive]
614pub struct ListFoldersRequest {
615 /// Required. Name of the bucket in which to look for folders. The bucket must
616 /// be a hierarchical namespace enabled bucket.
617 pub parent: std::string::String,
618
619 /// Optional. Maximum number of folders to return in a single response. The
620 /// service will use this parameter or 1,000 items, whichever is smaller.
621 pub page_size: i32,
622
623 /// Optional. A previously-returned page token representing part of the larger
624 /// set of results to view.
625 pub page_token: std::string::String,
626
627 /// Optional. Filter results to folders whose names begin with this prefix.
628 /// If set, the value must either be an empty string or end with a '/'.
629 pub prefix: std::string::String,
630
631 /// Optional. If set, returns results in a directory-like mode. The results
632 /// will only include folders that either exactly match the above prefix, or
633 /// are one level below the prefix. The only supported value is '/'.
634 pub delimiter: std::string::String,
635
636 /// Optional. Filter results to folders whose names are lexicographically equal
637 /// to or after lexicographic_start. If lexicographic_end is also set, the
638 /// folders listed have names between lexicographic_start (inclusive) and
639 /// lexicographic_end (exclusive).
640 pub lexicographic_start: std::string::String,
641
642 /// Optional. Filter results to folders whose names are lexicographically
643 /// before lexicographic_end. If lexicographic_start is also set, the folders
644 /// listed have names between lexicographic_start (inclusive) and
645 /// lexicographic_end (exclusive).
646 pub lexicographic_end: std::string::String,
647
648 /// Optional. A unique identifier for this request. UUID is the recommended
649 /// format, but other formats are still accepted.
650 pub request_id: std::string::String,
651
652 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
653}
654
655impl ListFoldersRequest {
656 /// Creates a new default instance.
657 pub fn new() -> Self {
658 std::default::Default::default()
659 }
660
661 /// Sets the value of [parent][crate::model::ListFoldersRequest::parent].
662 ///
663 /// # Example
664 /// ```ignore,no_run
665 /// # use google_cloud_storage::model::ListFoldersRequest;
666 /// # let project_id = "project_id";
667 /// # let bucket_id = "bucket_id";
668 /// let x = ListFoldersRequest::new().set_parent(format!("projects/{project_id}/buckets/{bucket_id}"));
669 /// ```
670 pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
671 self.parent = v.into();
672 self
673 }
674
675 /// Sets the value of [page_size][crate::model::ListFoldersRequest::page_size].
676 ///
677 /// # Example
678 /// ```ignore,no_run
679 /// # use google_cloud_storage::model::ListFoldersRequest;
680 /// let x = ListFoldersRequest::new().set_page_size(42);
681 /// ```
682 pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
683 self.page_size = v.into();
684 self
685 }
686
687 /// Sets the value of [page_token][crate::model::ListFoldersRequest::page_token].
688 ///
689 /// # Example
690 /// ```ignore,no_run
691 /// # use google_cloud_storage::model::ListFoldersRequest;
692 /// let x = ListFoldersRequest::new().set_page_token("example");
693 /// ```
694 pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
695 self.page_token = v.into();
696 self
697 }
698
699 /// Sets the value of [prefix][crate::model::ListFoldersRequest::prefix].
700 ///
701 /// # Example
702 /// ```ignore,no_run
703 /// # use google_cloud_storage::model::ListFoldersRequest;
704 /// let x = ListFoldersRequest::new().set_prefix("example");
705 /// ```
706 pub fn set_prefix<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
707 self.prefix = v.into();
708 self
709 }
710
711 /// Sets the value of [delimiter][crate::model::ListFoldersRequest::delimiter].
712 ///
713 /// # Example
714 /// ```ignore,no_run
715 /// # use google_cloud_storage::model::ListFoldersRequest;
716 /// let x = ListFoldersRequest::new().set_delimiter("example");
717 /// ```
718 pub fn set_delimiter<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
719 self.delimiter = v.into();
720 self
721 }
722
723 /// Sets the value of [lexicographic_start][crate::model::ListFoldersRequest::lexicographic_start].
724 ///
725 /// # Example
726 /// ```ignore,no_run
727 /// # use google_cloud_storage::model::ListFoldersRequest;
728 /// let x = ListFoldersRequest::new().set_lexicographic_start("example");
729 /// ```
730 pub fn set_lexicographic_start<T: std::convert::Into<std::string::String>>(
731 mut self,
732 v: T,
733 ) -> Self {
734 self.lexicographic_start = v.into();
735 self
736 }
737
738 /// Sets the value of [lexicographic_end][crate::model::ListFoldersRequest::lexicographic_end].
739 ///
740 /// # Example
741 /// ```ignore,no_run
742 /// # use google_cloud_storage::model::ListFoldersRequest;
743 /// let x = ListFoldersRequest::new().set_lexicographic_end("example");
744 /// ```
745 pub fn set_lexicographic_end<T: std::convert::Into<std::string::String>>(
746 mut self,
747 v: T,
748 ) -> Self {
749 self.lexicographic_end = v.into();
750 self
751 }
752
753 /// Sets the value of [request_id][crate::model::ListFoldersRequest::request_id].
754 ///
755 /// # Example
756 /// ```ignore,no_run
757 /// # use google_cloud_storage::model::ListFoldersRequest;
758 /// let x = ListFoldersRequest::new().set_request_id("example");
759 /// ```
760 pub fn set_request_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
761 self.request_id = v.into();
762 self
763 }
764}
765
766impl wkt::message::Message for ListFoldersRequest {
767 fn typename() -> &'static str {
768 "type.googleapis.com/google.storage.control.v2.ListFoldersRequest"
769 }
770}
771
772/// Response message for ListFolders.
773#[derive(Clone, Default, PartialEq)]
774#[non_exhaustive]
775pub struct ListFoldersResponse {
776 /// The list of child folders
777 pub folders: std::vec::Vec<crate::model::Folder>,
778
779 /// The continuation token, used to page through large result sets. Provide
780 /// this value in a subsequent request to return the next page of results.
781 pub next_page_token: std::string::String,
782
783 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
784}
785
786impl ListFoldersResponse {
787 /// Creates a new default instance.
788 pub fn new() -> Self {
789 std::default::Default::default()
790 }
791
792 /// Sets the value of [folders][crate::model::ListFoldersResponse::folders].
793 ///
794 /// # Example
795 /// ```ignore,no_run
796 /// # use google_cloud_storage::model::ListFoldersResponse;
797 /// use google_cloud_storage::model::Folder;
798 /// let x = ListFoldersResponse::new()
799 /// .set_folders([
800 /// Folder::default()/* use setters */,
801 /// Folder::default()/* use (different) setters */,
802 /// ]);
803 /// ```
804 pub fn set_folders<T, V>(mut self, v: T) -> Self
805 where
806 T: std::iter::IntoIterator<Item = V>,
807 V: std::convert::Into<crate::model::Folder>,
808 {
809 use std::iter::Iterator;
810 self.folders = v.into_iter().map(|i| i.into()).collect();
811 self
812 }
813
814 /// Sets the value of [next_page_token][crate::model::ListFoldersResponse::next_page_token].
815 ///
816 /// # Example
817 /// ```ignore,no_run
818 /// # use google_cloud_storage::model::ListFoldersResponse;
819 /// let x = ListFoldersResponse::new().set_next_page_token("example");
820 /// ```
821 pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
822 self.next_page_token = v.into();
823 self
824 }
825}
826
827impl wkt::message::Message for ListFoldersResponse {
828 fn typename() -> &'static str {
829 "type.googleapis.com/google.storage.control.v2.ListFoldersResponse"
830 }
831}
832
833#[doc(hidden)]
834impl google_cloud_gax::paginator::internal::PageableResponse for ListFoldersResponse {
835 type PageItem = crate::model::Folder;
836
837 fn items(self) -> std::vec::Vec<Self::PageItem> {
838 self.folders
839 }
840
841 fn next_page_token(&self) -> std::string::String {
842 use std::clone::Clone;
843 self.next_page_token.clone()
844 }
845}
846
847/// Request message for RenameFolder. This operation is only applicable to a
848/// hierarchical namespace enabled bucket.
849#[derive(Clone, Default, PartialEq)]
850#[non_exhaustive]
851pub struct RenameFolderRequest {
852 /// Required. Name of the source folder being renamed.
853 /// Format: `projects/{project}/buckets/{bucket}/folders/{folder}`
854 pub name: std::string::String,
855
856 /// Required. The destination folder ID, e.g. `foo/bar/`.
857 pub destination_folder_id: std::string::String,
858
859 /// Makes the operation only succeed conditional on whether the source
860 /// folder's current metageneration matches the given value.
861 pub if_metageneration_match: std::option::Option<i64>,
862
863 /// Makes the operation only succeed conditional on whether the source
864 /// folder's current metageneration does not match the given value.
865 pub if_metageneration_not_match: std::option::Option<i64>,
866
867 /// Optional. A unique identifier for this request. UUID is the recommended
868 /// format, but other formats are still accepted. This request is only
869 /// idempotent if a `request_id` is provided.
870 pub request_id: std::string::String,
871
872 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
873}
874
875impl RenameFolderRequest {
876 /// Creates a new default instance.
877 pub fn new() -> Self {
878 std::default::Default::default()
879 }
880
881 /// Sets the value of [name][crate::model::RenameFolderRequest::name].
882 ///
883 /// # Example
884 /// ```ignore,no_run
885 /// # use google_cloud_storage::model::RenameFolderRequest;
886 /// # let project_id = "project_id";
887 /// # let bucket_id = "bucket_id";
888 /// # let folder_id = "folder_id";
889 /// let x = RenameFolderRequest::new().set_name(format!("projects/{project_id}/buckets/{bucket_id}/folders/{folder_id}"));
890 /// ```
891 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
892 self.name = v.into();
893 self
894 }
895
896 /// Sets the value of [destination_folder_id][crate::model::RenameFolderRequest::destination_folder_id].
897 ///
898 /// # Example
899 /// ```ignore,no_run
900 /// # use google_cloud_storage::model::RenameFolderRequest;
901 /// let x = RenameFolderRequest::new().set_destination_folder_id("example");
902 /// ```
903 pub fn set_destination_folder_id<T: std::convert::Into<std::string::String>>(
904 mut self,
905 v: T,
906 ) -> Self {
907 self.destination_folder_id = v.into();
908 self
909 }
910
911 /// Sets the value of [if_metageneration_match][crate::model::RenameFolderRequest::if_metageneration_match].
912 ///
913 /// # Example
914 /// ```ignore,no_run
915 /// # use google_cloud_storage::model::RenameFolderRequest;
916 /// let x = RenameFolderRequest::new().set_if_metageneration_match(42);
917 /// ```
918 pub fn set_if_metageneration_match<T>(mut self, v: T) -> Self
919 where
920 T: std::convert::Into<i64>,
921 {
922 self.if_metageneration_match = std::option::Option::Some(v.into());
923 self
924 }
925
926 /// Sets or clears the value of [if_metageneration_match][crate::model::RenameFolderRequest::if_metageneration_match].
927 ///
928 /// # Example
929 /// ```ignore,no_run
930 /// # use google_cloud_storage::model::RenameFolderRequest;
931 /// let x = RenameFolderRequest::new().set_or_clear_if_metageneration_match(Some(42));
932 /// let x = RenameFolderRequest::new().set_or_clear_if_metageneration_match(None::<i32>);
933 /// ```
934 pub fn set_or_clear_if_metageneration_match<T>(mut self, v: std::option::Option<T>) -> Self
935 where
936 T: std::convert::Into<i64>,
937 {
938 self.if_metageneration_match = v.map(|x| x.into());
939 self
940 }
941
942 /// Sets the value of [if_metageneration_not_match][crate::model::RenameFolderRequest::if_metageneration_not_match].
943 ///
944 /// # Example
945 /// ```ignore,no_run
946 /// # use google_cloud_storage::model::RenameFolderRequest;
947 /// let x = RenameFolderRequest::new().set_if_metageneration_not_match(42);
948 /// ```
949 pub fn set_if_metageneration_not_match<T>(mut self, v: T) -> Self
950 where
951 T: std::convert::Into<i64>,
952 {
953 self.if_metageneration_not_match = std::option::Option::Some(v.into());
954 self
955 }
956
957 /// Sets or clears the value of [if_metageneration_not_match][crate::model::RenameFolderRequest::if_metageneration_not_match].
958 ///
959 /// # Example
960 /// ```ignore,no_run
961 /// # use google_cloud_storage::model::RenameFolderRequest;
962 /// let x = RenameFolderRequest::new().set_or_clear_if_metageneration_not_match(Some(42));
963 /// let x = RenameFolderRequest::new().set_or_clear_if_metageneration_not_match(None::<i32>);
964 /// ```
965 pub fn set_or_clear_if_metageneration_not_match<T>(mut self, v: std::option::Option<T>) -> Self
966 where
967 T: std::convert::Into<i64>,
968 {
969 self.if_metageneration_not_match = v.map(|x| x.into());
970 self
971 }
972
973 /// Sets the value of [request_id][crate::model::RenameFolderRequest::request_id].
974 ///
975 /// # Example
976 /// ```ignore,no_run
977 /// # use google_cloud_storage::model::RenameFolderRequest;
978 /// let x = RenameFolderRequest::new().set_request_id("example");
979 /// ```
980 pub fn set_request_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
981 self.request_id = v.into();
982 self
983 }
984}
985
986impl wkt::message::Message for RenameFolderRequest {
987 fn typename() -> &'static str {
988 "type.googleapis.com/google.storage.control.v2.RenameFolderRequest"
989 }
990}
991
992/// Request message for DeleteFolderRecursive.
993#[derive(Clone, Default, PartialEq)]
994#[non_exhaustive]
995pub struct DeleteFolderRecursiveRequest {
996 /// Required. Name of the folder being deleted, however all of its contents
997 /// will be deleted too. Format:
998 /// `projects/{project}/buckets/{bucket}/folders/{folder}`
999 pub name: std::string::String,
1000
1001 /// Optional. Makes the operation only succeed conditional on whether the root
1002 /// folder's current metageneration matches the given value.
1003 pub if_metageneration_match: std::option::Option<i64>,
1004
1005 /// Optional. Makes the operation only succeed conditional on whether the root
1006 /// folder's current metageneration does not match the given value.
1007 pub if_metageneration_not_match: std::option::Option<i64>,
1008
1009 /// Optional. A unique identifier for this request. UUID is the recommended
1010 /// format, but other formats are still accepted.
1011 pub request_id: std::string::String,
1012
1013 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1014}
1015
1016impl DeleteFolderRecursiveRequest {
1017 /// Creates a new default instance.
1018 pub fn new() -> Self {
1019 std::default::Default::default()
1020 }
1021
1022 /// Sets the value of [name][crate::model::DeleteFolderRecursiveRequest::name].
1023 ///
1024 /// # Example
1025 /// ```ignore,no_run
1026 /// # use google_cloud_storage::model::DeleteFolderRecursiveRequest;
1027 /// # let project_id = "project_id";
1028 /// # let bucket_id = "bucket_id";
1029 /// # let folder_id = "folder_id";
1030 /// let x = DeleteFolderRecursiveRequest::new().set_name(format!("projects/{project_id}/buckets/{bucket_id}/folders/{folder_id}"));
1031 /// ```
1032 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1033 self.name = v.into();
1034 self
1035 }
1036
1037 /// Sets the value of [if_metageneration_match][crate::model::DeleteFolderRecursiveRequest::if_metageneration_match].
1038 ///
1039 /// # Example
1040 /// ```ignore,no_run
1041 /// # use google_cloud_storage::model::DeleteFolderRecursiveRequest;
1042 /// let x = DeleteFolderRecursiveRequest::new().set_if_metageneration_match(42);
1043 /// ```
1044 pub fn set_if_metageneration_match<T>(mut self, v: T) -> Self
1045 where
1046 T: std::convert::Into<i64>,
1047 {
1048 self.if_metageneration_match = std::option::Option::Some(v.into());
1049 self
1050 }
1051
1052 /// Sets or clears the value of [if_metageneration_match][crate::model::DeleteFolderRecursiveRequest::if_metageneration_match].
1053 ///
1054 /// # Example
1055 /// ```ignore,no_run
1056 /// # use google_cloud_storage::model::DeleteFolderRecursiveRequest;
1057 /// let x = DeleteFolderRecursiveRequest::new().set_or_clear_if_metageneration_match(Some(42));
1058 /// let x = DeleteFolderRecursiveRequest::new().set_or_clear_if_metageneration_match(None::<i32>);
1059 /// ```
1060 pub fn set_or_clear_if_metageneration_match<T>(mut self, v: std::option::Option<T>) -> Self
1061 where
1062 T: std::convert::Into<i64>,
1063 {
1064 self.if_metageneration_match = v.map(|x| x.into());
1065 self
1066 }
1067
1068 /// Sets the value of [if_metageneration_not_match][crate::model::DeleteFolderRecursiveRequest::if_metageneration_not_match].
1069 ///
1070 /// # Example
1071 /// ```ignore,no_run
1072 /// # use google_cloud_storage::model::DeleteFolderRecursiveRequest;
1073 /// let x = DeleteFolderRecursiveRequest::new().set_if_metageneration_not_match(42);
1074 /// ```
1075 pub fn set_if_metageneration_not_match<T>(mut self, v: T) -> Self
1076 where
1077 T: std::convert::Into<i64>,
1078 {
1079 self.if_metageneration_not_match = std::option::Option::Some(v.into());
1080 self
1081 }
1082
1083 /// Sets or clears the value of [if_metageneration_not_match][crate::model::DeleteFolderRecursiveRequest::if_metageneration_not_match].
1084 ///
1085 /// # Example
1086 /// ```ignore,no_run
1087 /// # use google_cloud_storage::model::DeleteFolderRecursiveRequest;
1088 /// let x = DeleteFolderRecursiveRequest::new().set_or_clear_if_metageneration_not_match(Some(42));
1089 /// let x = DeleteFolderRecursiveRequest::new().set_or_clear_if_metageneration_not_match(None::<i32>);
1090 /// ```
1091 pub fn set_or_clear_if_metageneration_not_match<T>(mut self, v: std::option::Option<T>) -> Self
1092 where
1093 T: std::convert::Into<i64>,
1094 {
1095 self.if_metageneration_not_match = v.map(|x| x.into());
1096 self
1097 }
1098
1099 /// Sets the value of [request_id][crate::model::DeleteFolderRecursiveRequest::request_id].
1100 ///
1101 /// # Example
1102 /// ```ignore,no_run
1103 /// # use google_cloud_storage::model::DeleteFolderRecursiveRequest;
1104 /// let x = DeleteFolderRecursiveRequest::new().set_request_id("example");
1105 /// ```
1106 pub fn set_request_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1107 self.request_id = v.into();
1108 self
1109 }
1110}
1111
1112impl wkt::message::Message for DeleteFolderRecursiveRequest {
1113 fn typename() -> &'static str {
1114 "type.googleapis.com/google.storage.control.v2.DeleteFolderRecursiveRequest"
1115 }
1116}
1117
1118/// The message contains metadata that is common to all Storage Control
1119/// long-running operations, present in its `google.longrunning.Operation`
1120/// messages, and accessible via `metadata.common_metadata`.
1121#[derive(Clone, Default, PartialEq)]
1122#[non_exhaustive]
1123pub struct CommonLongRunningOperationMetadata {
1124 /// Output only. The time the operation was created.
1125 pub create_time: std::option::Option<wkt::Timestamp>,
1126
1127 /// Output only. The time the operation finished running.
1128 pub end_time: std::option::Option<wkt::Timestamp>,
1129
1130 /// Output only. The time the operation was last modified.
1131 pub update_time: std::option::Option<wkt::Timestamp>,
1132
1133 /// Output only. The type of operation invoked.
1134 pub r#type: std::string::String,
1135
1136 /// Output only. Identifies whether the user has requested cancellation.
1137 pub requested_cancellation: bool,
1138
1139 /// Output only. The estimated progress of the operation in percentage [0,
1140 /// 100]. The value -1 means the progress is unknown.
1141 pub progress_percent: i32,
1142
1143 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1144}
1145
1146impl CommonLongRunningOperationMetadata {
1147 /// Creates a new default instance.
1148 pub fn new() -> Self {
1149 std::default::Default::default()
1150 }
1151
1152 /// Sets the value of [create_time][crate::model::CommonLongRunningOperationMetadata::create_time].
1153 ///
1154 /// # Example
1155 /// ```ignore,no_run
1156 /// # use google_cloud_storage::model::CommonLongRunningOperationMetadata;
1157 /// use wkt::Timestamp;
1158 /// let x = CommonLongRunningOperationMetadata::new().set_create_time(Timestamp::default()/* use setters */);
1159 /// ```
1160 pub fn set_create_time<T>(mut self, v: T) -> Self
1161 where
1162 T: std::convert::Into<wkt::Timestamp>,
1163 {
1164 self.create_time = std::option::Option::Some(v.into());
1165 self
1166 }
1167
1168 /// Sets or clears the value of [create_time][crate::model::CommonLongRunningOperationMetadata::create_time].
1169 ///
1170 /// # Example
1171 /// ```ignore,no_run
1172 /// # use google_cloud_storage::model::CommonLongRunningOperationMetadata;
1173 /// use wkt::Timestamp;
1174 /// let x = CommonLongRunningOperationMetadata::new().set_or_clear_create_time(Some(Timestamp::default()/* use setters */));
1175 /// let x = CommonLongRunningOperationMetadata::new().set_or_clear_create_time(None::<Timestamp>);
1176 /// ```
1177 pub fn set_or_clear_create_time<T>(mut self, v: std::option::Option<T>) -> Self
1178 where
1179 T: std::convert::Into<wkt::Timestamp>,
1180 {
1181 self.create_time = v.map(|x| x.into());
1182 self
1183 }
1184
1185 /// Sets the value of [end_time][crate::model::CommonLongRunningOperationMetadata::end_time].
1186 ///
1187 /// # Example
1188 /// ```ignore,no_run
1189 /// # use google_cloud_storage::model::CommonLongRunningOperationMetadata;
1190 /// use wkt::Timestamp;
1191 /// let x = CommonLongRunningOperationMetadata::new().set_end_time(Timestamp::default()/* use setters */);
1192 /// ```
1193 pub fn set_end_time<T>(mut self, v: T) -> Self
1194 where
1195 T: std::convert::Into<wkt::Timestamp>,
1196 {
1197 self.end_time = std::option::Option::Some(v.into());
1198 self
1199 }
1200
1201 /// Sets or clears the value of [end_time][crate::model::CommonLongRunningOperationMetadata::end_time].
1202 ///
1203 /// # Example
1204 /// ```ignore,no_run
1205 /// # use google_cloud_storage::model::CommonLongRunningOperationMetadata;
1206 /// use wkt::Timestamp;
1207 /// let x = CommonLongRunningOperationMetadata::new().set_or_clear_end_time(Some(Timestamp::default()/* use setters */));
1208 /// let x = CommonLongRunningOperationMetadata::new().set_or_clear_end_time(None::<Timestamp>);
1209 /// ```
1210 pub fn set_or_clear_end_time<T>(mut self, v: std::option::Option<T>) -> Self
1211 where
1212 T: std::convert::Into<wkt::Timestamp>,
1213 {
1214 self.end_time = v.map(|x| x.into());
1215 self
1216 }
1217
1218 /// Sets the value of [update_time][crate::model::CommonLongRunningOperationMetadata::update_time].
1219 ///
1220 /// # Example
1221 /// ```ignore,no_run
1222 /// # use google_cloud_storage::model::CommonLongRunningOperationMetadata;
1223 /// use wkt::Timestamp;
1224 /// let x = CommonLongRunningOperationMetadata::new().set_update_time(Timestamp::default()/* use setters */);
1225 /// ```
1226 pub fn set_update_time<T>(mut self, v: T) -> Self
1227 where
1228 T: std::convert::Into<wkt::Timestamp>,
1229 {
1230 self.update_time = std::option::Option::Some(v.into());
1231 self
1232 }
1233
1234 /// Sets or clears the value of [update_time][crate::model::CommonLongRunningOperationMetadata::update_time].
1235 ///
1236 /// # Example
1237 /// ```ignore,no_run
1238 /// # use google_cloud_storage::model::CommonLongRunningOperationMetadata;
1239 /// use wkt::Timestamp;
1240 /// let x = CommonLongRunningOperationMetadata::new().set_or_clear_update_time(Some(Timestamp::default()/* use setters */));
1241 /// let x = CommonLongRunningOperationMetadata::new().set_or_clear_update_time(None::<Timestamp>);
1242 /// ```
1243 pub fn set_or_clear_update_time<T>(mut self, v: std::option::Option<T>) -> Self
1244 where
1245 T: std::convert::Into<wkt::Timestamp>,
1246 {
1247 self.update_time = v.map(|x| x.into());
1248 self
1249 }
1250
1251 /// Sets the value of [r#type][crate::model::CommonLongRunningOperationMetadata::type].
1252 ///
1253 /// # Example
1254 /// ```ignore,no_run
1255 /// # use google_cloud_storage::model::CommonLongRunningOperationMetadata;
1256 /// let x = CommonLongRunningOperationMetadata::new().set_type("example");
1257 /// ```
1258 pub fn set_type<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1259 self.r#type = v.into();
1260 self
1261 }
1262
1263 /// Sets the value of [requested_cancellation][crate::model::CommonLongRunningOperationMetadata::requested_cancellation].
1264 ///
1265 /// # Example
1266 /// ```ignore,no_run
1267 /// # use google_cloud_storage::model::CommonLongRunningOperationMetadata;
1268 /// let x = CommonLongRunningOperationMetadata::new().set_requested_cancellation(true);
1269 /// ```
1270 pub fn set_requested_cancellation<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
1271 self.requested_cancellation = v.into();
1272 self
1273 }
1274
1275 /// Sets the value of [progress_percent][crate::model::CommonLongRunningOperationMetadata::progress_percent].
1276 ///
1277 /// # Example
1278 /// ```ignore,no_run
1279 /// # use google_cloud_storage::model::CommonLongRunningOperationMetadata;
1280 /// let x = CommonLongRunningOperationMetadata::new().set_progress_percent(42);
1281 /// ```
1282 pub fn set_progress_percent<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
1283 self.progress_percent = v.into();
1284 self
1285 }
1286}
1287
1288impl wkt::message::Message for CommonLongRunningOperationMetadata {
1289 fn typename() -> &'static str {
1290 "type.googleapis.com/google.storage.control.v2.CommonLongRunningOperationMetadata"
1291 }
1292}
1293
1294/// Message returned in the metadata field of the Operation resource for
1295/// RenameFolder operations.
1296#[derive(Clone, Default, PartialEq)]
1297#[non_exhaustive]
1298pub struct RenameFolderMetadata {
1299 /// Generic metadata for the long running operation.
1300 pub common_metadata: std::option::Option<crate::model::CommonLongRunningOperationMetadata>,
1301
1302 /// The path of the source folder.
1303 pub source_folder_id: std::string::String,
1304
1305 /// The path of the destination folder.
1306 pub destination_folder_id: std::string::String,
1307
1308 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1309}
1310
1311impl RenameFolderMetadata {
1312 /// Creates a new default instance.
1313 pub fn new() -> Self {
1314 std::default::Default::default()
1315 }
1316
1317 /// Sets the value of [common_metadata][crate::model::RenameFolderMetadata::common_metadata].
1318 ///
1319 /// # Example
1320 /// ```ignore,no_run
1321 /// # use google_cloud_storage::model::RenameFolderMetadata;
1322 /// use google_cloud_storage::model::CommonLongRunningOperationMetadata;
1323 /// let x = RenameFolderMetadata::new().set_common_metadata(CommonLongRunningOperationMetadata::default()/* use setters */);
1324 /// ```
1325 pub fn set_common_metadata<T>(mut self, v: T) -> Self
1326 where
1327 T: std::convert::Into<crate::model::CommonLongRunningOperationMetadata>,
1328 {
1329 self.common_metadata = std::option::Option::Some(v.into());
1330 self
1331 }
1332
1333 /// Sets or clears the value of [common_metadata][crate::model::RenameFolderMetadata::common_metadata].
1334 ///
1335 /// # Example
1336 /// ```ignore,no_run
1337 /// # use google_cloud_storage::model::RenameFolderMetadata;
1338 /// use google_cloud_storage::model::CommonLongRunningOperationMetadata;
1339 /// let x = RenameFolderMetadata::new().set_or_clear_common_metadata(Some(CommonLongRunningOperationMetadata::default()/* use setters */));
1340 /// let x = RenameFolderMetadata::new().set_or_clear_common_metadata(None::<CommonLongRunningOperationMetadata>);
1341 /// ```
1342 pub fn set_or_clear_common_metadata<T>(mut self, v: std::option::Option<T>) -> Self
1343 where
1344 T: std::convert::Into<crate::model::CommonLongRunningOperationMetadata>,
1345 {
1346 self.common_metadata = v.map(|x| x.into());
1347 self
1348 }
1349
1350 /// Sets the value of [source_folder_id][crate::model::RenameFolderMetadata::source_folder_id].
1351 ///
1352 /// # Example
1353 /// ```ignore,no_run
1354 /// # use google_cloud_storage::model::RenameFolderMetadata;
1355 /// let x = RenameFolderMetadata::new().set_source_folder_id("example");
1356 /// ```
1357 pub fn set_source_folder_id<T: std::convert::Into<std::string::String>>(
1358 mut self,
1359 v: T,
1360 ) -> Self {
1361 self.source_folder_id = v.into();
1362 self
1363 }
1364
1365 /// Sets the value of [destination_folder_id][crate::model::RenameFolderMetadata::destination_folder_id].
1366 ///
1367 /// # Example
1368 /// ```ignore,no_run
1369 /// # use google_cloud_storage::model::RenameFolderMetadata;
1370 /// let x = RenameFolderMetadata::new().set_destination_folder_id("example");
1371 /// ```
1372 pub fn set_destination_folder_id<T: std::convert::Into<std::string::String>>(
1373 mut self,
1374 v: T,
1375 ) -> Self {
1376 self.destination_folder_id = v.into();
1377 self
1378 }
1379}
1380
1381impl wkt::message::Message for RenameFolderMetadata {
1382 fn typename() -> &'static str {
1383 "type.googleapis.com/google.storage.control.v2.RenameFolderMetadata"
1384 }
1385}
1386
1387/// Message returned in the metadata field of the Operation resource for
1388/// DeleteFolderRecursive operations.
1389#[derive(Clone, Default, PartialEq)]
1390#[non_exhaustive]
1391pub struct DeleteFolderRecursiveMetadata {
1392 /// Generic metadata for the long running operation.
1393 pub common_metadata: std::option::Option<crate::model::CommonLongRunningOperationMetadata>,
1394
1395 /// The path of the folder recursively deleted.
1396 pub folder_id: std::string::String,
1397
1398 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1399}
1400
1401impl DeleteFolderRecursiveMetadata {
1402 /// Creates a new default instance.
1403 pub fn new() -> Self {
1404 std::default::Default::default()
1405 }
1406
1407 /// Sets the value of [common_metadata][crate::model::DeleteFolderRecursiveMetadata::common_metadata].
1408 ///
1409 /// # Example
1410 /// ```ignore,no_run
1411 /// # use google_cloud_storage::model::DeleteFolderRecursiveMetadata;
1412 /// use google_cloud_storage::model::CommonLongRunningOperationMetadata;
1413 /// let x = DeleteFolderRecursiveMetadata::new().set_common_metadata(CommonLongRunningOperationMetadata::default()/* use setters */);
1414 /// ```
1415 pub fn set_common_metadata<T>(mut self, v: T) -> Self
1416 where
1417 T: std::convert::Into<crate::model::CommonLongRunningOperationMetadata>,
1418 {
1419 self.common_metadata = std::option::Option::Some(v.into());
1420 self
1421 }
1422
1423 /// Sets or clears the value of [common_metadata][crate::model::DeleteFolderRecursiveMetadata::common_metadata].
1424 ///
1425 /// # Example
1426 /// ```ignore,no_run
1427 /// # use google_cloud_storage::model::DeleteFolderRecursiveMetadata;
1428 /// use google_cloud_storage::model::CommonLongRunningOperationMetadata;
1429 /// let x = DeleteFolderRecursiveMetadata::new().set_or_clear_common_metadata(Some(CommonLongRunningOperationMetadata::default()/* use setters */));
1430 /// let x = DeleteFolderRecursiveMetadata::new().set_or_clear_common_metadata(None::<CommonLongRunningOperationMetadata>);
1431 /// ```
1432 pub fn set_or_clear_common_metadata<T>(mut self, v: std::option::Option<T>) -> Self
1433 where
1434 T: std::convert::Into<crate::model::CommonLongRunningOperationMetadata>,
1435 {
1436 self.common_metadata = v.map(|x| x.into());
1437 self
1438 }
1439
1440 /// Sets the value of [folder_id][crate::model::DeleteFolderRecursiveMetadata::folder_id].
1441 ///
1442 /// # Example
1443 /// ```ignore,no_run
1444 /// # use google_cloud_storage::model::DeleteFolderRecursiveMetadata;
1445 /// let x = DeleteFolderRecursiveMetadata::new().set_folder_id("example");
1446 /// ```
1447 pub fn set_folder_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1448 self.folder_id = v.into();
1449 self
1450 }
1451}
1452
1453impl wkt::message::Message for DeleteFolderRecursiveMetadata {
1454 fn typename() -> &'static str {
1455 "type.googleapis.com/google.storage.control.v2.DeleteFolderRecursiveMetadata"
1456 }
1457}
1458
1459/// The storage layout configuration of a bucket.
1460#[derive(Clone, Default, PartialEq)]
1461#[non_exhaustive]
1462pub struct StorageLayout {
1463 /// Output only. The name of the StorageLayout resource.
1464 /// Format: `projects/{project}/buckets/{bucket}/storageLayout`
1465 pub name: std::string::String,
1466
1467 /// Output only. The location of the bucket.
1468 pub location: std::string::String,
1469
1470 /// Output only. The location type of the bucket (region, dual-region,
1471 /// multi-region, etc).
1472 pub location_type: std::string::String,
1473
1474 /// Output only. The data placement configuration for custom dual region. If
1475 /// there is no configuration, this is not a custom dual region bucket.
1476 pub custom_placement_config:
1477 std::option::Option<crate::model::storage_layout::CustomPlacementConfig>,
1478
1479 /// Output only. The bucket's hierarchical namespace configuration. If there is
1480 /// no configuration, the hierarchical namespace is disabled.
1481 pub hierarchical_namespace:
1482 std::option::Option<crate::model::storage_layout::HierarchicalNamespace>,
1483
1484 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1485}
1486
1487impl StorageLayout {
1488 /// Creates a new default instance.
1489 pub fn new() -> Self {
1490 std::default::Default::default()
1491 }
1492
1493 /// Sets the value of [name][crate::model::StorageLayout::name].
1494 ///
1495 /// # Example
1496 /// ```ignore,no_run
1497 /// # use google_cloud_storage::model::StorageLayout;
1498 /// # let project_id = "project_id";
1499 /// # let bucket_id = "bucket_id";
1500 /// let x = StorageLayout::new().set_name(format!("projects/{project_id}/buckets/{bucket_id}/storageLayout"));
1501 /// ```
1502 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1503 self.name = v.into();
1504 self
1505 }
1506
1507 /// Sets the value of [location][crate::model::StorageLayout::location].
1508 ///
1509 /// # Example
1510 /// ```ignore,no_run
1511 /// # use google_cloud_storage::model::StorageLayout;
1512 /// let x = StorageLayout::new().set_location("example");
1513 /// ```
1514 pub fn set_location<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1515 self.location = v.into();
1516 self
1517 }
1518
1519 /// Sets the value of [location_type][crate::model::StorageLayout::location_type].
1520 ///
1521 /// # Example
1522 /// ```ignore,no_run
1523 /// # use google_cloud_storage::model::StorageLayout;
1524 /// let x = StorageLayout::new().set_location_type("example");
1525 /// ```
1526 pub fn set_location_type<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1527 self.location_type = v.into();
1528 self
1529 }
1530
1531 /// Sets the value of [custom_placement_config][crate::model::StorageLayout::custom_placement_config].
1532 ///
1533 /// # Example
1534 /// ```ignore,no_run
1535 /// # use google_cloud_storage::model::StorageLayout;
1536 /// use google_cloud_storage::model::storage_layout::CustomPlacementConfig;
1537 /// let x = StorageLayout::new().set_custom_placement_config(CustomPlacementConfig::default()/* use setters */);
1538 /// ```
1539 pub fn set_custom_placement_config<T>(mut self, v: T) -> Self
1540 where
1541 T: std::convert::Into<crate::model::storage_layout::CustomPlacementConfig>,
1542 {
1543 self.custom_placement_config = std::option::Option::Some(v.into());
1544 self
1545 }
1546
1547 /// Sets or clears the value of [custom_placement_config][crate::model::StorageLayout::custom_placement_config].
1548 ///
1549 /// # Example
1550 /// ```ignore,no_run
1551 /// # use google_cloud_storage::model::StorageLayout;
1552 /// use google_cloud_storage::model::storage_layout::CustomPlacementConfig;
1553 /// let x = StorageLayout::new().set_or_clear_custom_placement_config(Some(CustomPlacementConfig::default()/* use setters */));
1554 /// let x = StorageLayout::new().set_or_clear_custom_placement_config(None::<CustomPlacementConfig>);
1555 /// ```
1556 pub fn set_or_clear_custom_placement_config<T>(mut self, v: std::option::Option<T>) -> Self
1557 where
1558 T: std::convert::Into<crate::model::storage_layout::CustomPlacementConfig>,
1559 {
1560 self.custom_placement_config = v.map(|x| x.into());
1561 self
1562 }
1563
1564 /// Sets the value of [hierarchical_namespace][crate::model::StorageLayout::hierarchical_namespace].
1565 ///
1566 /// # Example
1567 /// ```ignore,no_run
1568 /// # use google_cloud_storage::model::StorageLayout;
1569 /// use google_cloud_storage::model::storage_layout::HierarchicalNamespace;
1570 /// let x = StorageLayout::new().set_hierarchical_namespace(HierarchicalNamespace::default()/* use setters */);
1571 /// ```
1572 pub fn set_hierarchical_namespace<T>(mut self, v: T) -> Self
1573 where
1574 T: std::convert::Into<crate::model::storage_layout::HierarchicalNamespace>,
1575 {
1576 self.hierarchical_namespace = std::option::Option::Some(v.into());
1577 self
1578 }
1579
1580 /// Sets or clears the value of [hierarchical_namespace][crate::model::StorageLayout::hierarchical_namespace].
1581 ///
1582 /// # Example
1583 /// ```ignore,no_run
1584 /// # use google_cloud_storage::model::StorageLayout;
1585 /// use google_cloud_storage::model::storage_layout::HierarchicalNamespace;
1586 /// let x = StorageLayout::new().set_or_clear_hierarchical_namespace(Some(HierarchicalNamespace::default()/* use setters */));
1587 /// let x = StorageLayout::new().set_or_clear_hierarchical_namespace(None::<HierarchicalNamespace>);
1588 /// ```
1589 pub fn set_or_clear_hierarchical_namespace<T>(mut self, v: std::option::Option<T>) -> Self
1590 where
1591 T: std::convert::Into<crate::model::storage_layout::HierarchicalNamespace>,
1592 {
1593 self.hierarchical_namespace = v.map(|x| x.into());
1594 self
1595 }
1596}
1597
1598impl wkt::message::Message for StorageLayout {
1599 fn typename() -> &'static str {
1600 "type.googleapis.com/google.storage.control.v2.StorageLayout"
1601 }
1602}
1603
1604/// Defines additional types related to [StorageLayout].
1605pub mod storage_layout {
1606 #[allow(unused_imports)]
1607 use super::*;
1608
1609 /// Configuration for Custom Dual Regions. It should specify precisely two
1610 /// eligible regions within the same Multiregion. More information on regions
1611 /// may be found [here](https://cloud.google.com/storage/docs/locations).
1612 #[derive(Clone, Default, PartialEq)]
1613 #[non_exhaustive]
1614 pub struct CustomPlacementConfig {
1615 /// List of locations to use for data placement.
1616 pub data_locations: std::vec::Vec<std::string::String>,
1617
1618 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1619 }
1620
1621 impl CustomPlacementConfig {
1622 /// Creates a new default instance.
1623 pub fn new() -> Self {
1624 std::default::Default::default()
1625 }
1626
1627 /// Sets the value of [data_locations][crate::model::storage_layout::CustomPlacementConfig::data_locations].
1628 ///
1629 /// # Example
1630 /// ```ignore,no_run
1631 /// # use google_cloud_storage::model::storage_layout::CustomPlacementConfig;
1632 /// let x = CustomPlacementConfig::new().set_data_locations(["a", "b", "c"]);
1633 /// ```
1634 pub fn set_data_locations<T, V>(mut self, v: T) -> Self
1635 where
1636 T: std::iter::IntoIterator<Item = V>,
1637 V: std::convert::Into<std::string::String>,
1638 {
1639 use std::iter::Iterator;
1640 self.data_locations = v.into_iter().map(|i| i.into()).collect();
1641 self
1642 }
1643 }
1644
1645 impl wkt::message::Message for CustomPlacementConfig {
1646 fn typename() -> &'static str {
1647 "type.googleapis.com/google.storage.control.v2.StorageLayout.CustomPlacementConfig"
1648 }
1649 }
1650
1651 /// Configuration for a bucket's hierarchical namespace feature.
1652 #[derive(Clone, Default, PartialEq)]
1653 #[non_exhaustive]
1654 pub struct HierarchicalNamespace {
1655 /// Enables the hierarchical namespace feature.
1656 pub enabled: bool,
1657
1658 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1659 }
1660
1661 impl HierarchicalNamespace {
1662 /// Creates a new default instance.
1663 pub fn new() -> Self {
1664 std::default::Default::default()
1665 }
1666
1667 /// Sets the value of [enabled][crate::model::storage_layout::HierarchicalNamespace::enabled].
1668 ///
1669 /// # Example
1670 /// ```ignore,no_run
1671 /// # use google_cloud_storage::model::storage_layout::HierarchicalNamespace;
1672 /// let x = HierarchicalNamespace::new().set_enabled(true);
1673 /// ```
1674 pub fn set_enabled<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
1675 self.enabled = v.into();
1676 self
1677 }
1678 }
1679
1680 impl wkt::message::Message for HierarchicalNamespace {
1681 fn typename() -> &'static str {
1682 "type.googleapis.com/google.storage.control.v2.StorageLayout.HierarchicalNamespace"
1683 }
1684 }
1685}
1686
1687/// Request message for GetStorageLayout.
1688#[derive(Clone, Default, PartialEq)]
1689#[non_exhaustive]
1690pub struct GetStorageLayoutRequest {
1691 /// Required. The name of the StorageLayout resource.
1692 /// Format: `projects/{project}/buckets/{bucket}/storageLayout`
1693 pub name: std::string::String,
1694
1695 /// An optional prefix used for permission check. It is useful when the caller
1696 /// only has limited permissions under a specific prefix.
1697 pub prefix: std::string::String,
1698
1699 /// Optional. A unique identifier for this request. UUID is the recommended
1700 /// format, but other formats are still accepted.
1701 pub request_id: std::string::String,
1702
1703 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1704}
1705
1706impl GetStorageLayoutRequest {
1707 /// Creates a new default instance.
1708 pub fn new() -> Self {
1709 std::default::Default::default()
1710 }
1711
1712 /// Sets the value of [name][crate::model::GetStorageLayoutRequest::name].
1713 ///
1714 /// # Example
1715 /// ```ignore,no_run
1716 /// # use google_cloud_storage::model::GetStorageLayoutRequest;
1717 /// # let project_id = "project_id";
1718 /// # let bucket_id = "bucket_id";
1719 /// let x = GetStorageLayoutRequest::new().set_name(format!("projects/{project_id}/buckets/{bucket_id}/storageLayout"));
1720 /// ```
1721 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1722 self.name = v.into();
1723 self
1724 }
1725
1726 /// Sets the value of [prefix][crate::model::GetStorageLayoutRequest::prefix].
1727 ///
1728 /// # Example
1729 /// ```ignore,no_run
1730 /// # use google_cloud_storage::model::GetStorageLayoutRequest;
1731 /// let x = GetStorageLayoutRequest::new().set_prefix("example");
1732 /// ```
1733 pub fn set_prefix<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1734 self.prefix = v.into();
1735 self
1736 }
1737
1738 /// Sets the value of [request_id][crate::model::GetStorageLayoutRequest::request_id].
1739 ///
1740 /// # Example
1741 /// ```ignore,no_run
1742 /// # use google_cloud_storage::model::GetStorageLayoutRequest;
1743 /// let x = GetStorageLayoutRequest::new().set_request_id("example");
1744 /// ```
1745 pub fn set_request_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1746 self.request_id = v.into();
1747 self
1748 }
1749}
1750
1751impl wkt::message::Message for GetStorageLayoutRequest {
1752 fn typename() -> &'static str {
1753 "type.googleapis.com/google.storage.control.v2.GetStorageLayoutRequest"
1754 }
1755}
1756
1757/// A managed folder.
1758#[derive(Clone, Default, PartialEq)]
1759#[non_exhaustive]
1760pub struct ManagedFolder {
1761 /// Identifier. The name of this managed folder.
1762 /// Format:
1763 /// `projects/{project}/buckets/{bucket}/managedFolders/{managedFolder}`
1764 pub name: std::string::String,
1765
1766 /// Output only. The metadata version of this managed folder. It increases
1767 /// whenever the metadata is updated. Used for preconditions and for detecting
1768 /// changes in metadata. Managed folders don't have a generation number.
1769 pub metageneration: i64,
1770
1771 /// Output only. The creation time of the managed folder.
1772 pub create_time: std::option::Option<wkt::Timestamp>,
1773
1774 /// Output only. The modification time of the managed folder.
1775 pub update_time: std::option::Option<wkt::Timestamp>,
1776
1777 /// Rapid Cache configuration for a managed prefix.
1778 pub rapid_cache_config: std::option::Option<crate::model::managed_folder::RapidCacheConfig>,
1779
1780 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1781}
1782
1783impl ManagedFolder {
1784 /// Creates a new default instance.
1785 pub fn new() -> Self {
1786 std::default::Default::default()
1787 }
1788
1789 /// Sets the value of [name][crate::model::ManagedFolder::name].
1790 ///
1791 /// # Example
1792 /// ```ignore,no_run
1793 /// # use google_cloud_storage::model::ManagedFolder;
1794 /// # let project_id = "project_id";
1795 /// # let bucket_id = "bucket_id";
1796 /// # let managed_folder_id = "managed_folder_id";
1797 /// let x = ManagedFolder::new().set_name(format!("projects/{project_id}/buckets/{bucket_id}/managedFolders/{managed_folder_id}"));
1798 /// ```
1799 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1800 self.name = v.into();
1801 self
1802 }
1803
1804 /// Sets the value of [metageneration][crate::model::ManagedFolder::metageneration].
1805 ///
1806 /// # Example
1807 /// ```ignore,no_run
1808 /// # use google_cloud_storage::model::ManagedFolder;
1809 /// let x = ManagedFolder::new().set_metageneration(42);
1810 /// ```
1811 pub fn set_metageneration<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
1812 self.metageneration = v.into();
1813 self
1814 }
1815
1816 /// Sets the value of [create_time][crate::model::ManagedFolder::create_time].
1817 ///
1818 /// # Example
1819 /// ```ignore,no_run
1820 /// # use google_cloud_storage::model::ManagedFolder;
1821 /// use wkt::Timestamp;
1822 /// let x = ManagedFolder::new().set_create_time(Timestamp::default()/* use setters */);
1823 /// ```
1824 pub fn set_create_time<T>(mut self, v: T) -> Self
1825 where
1826 T: std::convert::Into<wkt::Timestamp>,
1827 {
1828 self.create_time = std::option::Option::Some(v.into());
1829 self
1830 }
1831
1832 /// Sets or clears the value of [create_time][crate::model::ManagedFolder::create_time].
1833 ///
1834 /// # Example
1835 /// ```ignore,no_run
1836 /// # use google_cloud_storage::model::ManagedFolder;
1837 /// use wkt::Timestamp;
1838 /// let x = ManagedFolder::new().set_or_clear_create_time(Some(Timestamp::default()/* use setters */));
1839 /// let x = ManagedFolder::new().set_or_clear_create_time(None::<Timestamp>);
1840 /// ```
1841 pub fn set_or_clear_create_time<T>(mut self, v: std::option::Option<T>) -> Self
1842 where
1843 T: std::convert::Into<wkt::Timestamp>,
1844 {
1845 self.create_time = v.map(|x| x.into());
1846 self
1847 }
1848
1849 /// Sets the value of [update_time][crate::model::ManagedFolder::update_time].
1850 ///
1851 /// # Example
1852 /// ```ignore,no_run
1853 /// # use google_cloud_storage::model::ManagedFolder;
1854 /// use wkt::Timestamp;
1855 /// let x = ManagedFolder::new().set_update_time(Timestamp::default()/* use setters */);
1856 /// ```
1857 pub fn set_update_time<T>(mut self, v: T) -> Self
1858 where
1859 T: std::convert::Into<wkt::Timestamp>,
1860 {
1861 self.update_time = std::option::Option::Some(v.into());
1862 self
1863 }
1864
1865 /// Sets or clears the value of [update_time][crate::model::ManagedFolder::update_time].
1866 ///
1867 /// # Example
1868 /// ```ignore,no_run
1869 /// # use google_cloud_storage::model::ManagedFolder;
1870 /// use wkt::Timestamp;
1871 /// let x = ManagedFolder::new().set_or_clear_update_time(Some(Timestamp::default()/* use setters */));
1872 /// let x = ManagedFolder::new().set_or_clear_update_time(None::<Timestamp>);
1873 /// ```
1874 pub fn set_or_clear_update_time<T>(mut self, v: std::option::Option<T>) -> Self
1875 where
1876 T: std::convert::Into<wkt::Timestamp>,
1877 {
1878 self.update_time = v.map(|x| x.into());
1879 self
1880 }
1881
1882 /// Sets the value of [rapid_cache_config][crate::model::ManagedFolder::rapid_cache_config].
1883 ///
1884 /// # Example
1885 /// ```ignore,no_run
1886 /// # use google_cloud_storage::model::ManagedFolder;
1887 /// use google_cloud_storage::model::managed_folder::RapidCacheConfig;
1888 /// let x = ManagedFolder::new().set_rapid_cache_config(RapidCacheConfig::default()/* use setters */);
1889 /// ```
1890 pub fn set_rapid_cache_config<T>(mut self, v: T) -> Self
1891 where
1892 T: std::convert::Into<crate::model::managed_folder::RapidCacheConfig>,
1893 {
1894 self.rapid_cache_config = std::option::Option::Some(v.into());
1895 self
1896 }
1897
1898 /// Sets or clears the value of [rapid_cache_config][crate::model::ManagedFolder::rapid_cache_config].
1899 ///
1900 /// # Example
1901 /// ```ignore,no_run
1902 /// # use google_cloud_storage::model::ManagedFolder;
1903 /// use google_cloud_storage::model::managed_folder::RapidCacheConfig;
1904 /// let x = ManagedFolder::new().set_or_clear_rapid_cache_config(Some(RapidCacheConfig::default()/* use setters */));
1905 /// let x = ManagedFolder::new().set_or_clear_rapid_cache_config(None::<RapidCacheConfig>);
1906 /// ```
1907 pub fn set_or_clear_rapid_cache_config<T>(mut self, v: std::option::Option<T>) -> Self
1908 where
1909 T: std::convert::Into<crate::model::managed_folder::RapidCacheConfig>,
1910 {
1911 self.rapid_cache_config = v.map(|x| x.into());
1912 self
1913 }
1914}
1915
1916impl wkt::message::Message for ManagedFolder {
1917 fn typename() -> &'static str {
1918 "type.googleapis.com/google.storage.control.v2.ManagedFolder"
1919 }
1920}
1921
1922/// Defines additional types related to [ManagedFolder].
1923pub mod managed_folder {
1924 #[allow(unused_imports)]
1925 use super::*;
1926
1927 /// Rapid Cache configuration for a managed prefix. This configuration is used
1928 /// to determine how the rapid cache behaves for objects under the managed
1929 /// folder.
1930 #[derive(Clone, Default, PartialEq)]
1931 #[non_exhaustive]
1932 pub struct RapidCacheConfig {
1933 /// Optional. A map of rapid_cache_id to RapidCachePolicy for this prefix.
1934 /// Currently, the key rapid_cache_id is the zone. However, the
1935 /// field is generalized as rapid_cache_id to align the policy lifetime
1936 /// with the cache instance lifetime. This allows for a future transition
1937 /// from zone to a cache id if required.
1938 pub policies: std::collections::HashMap<
1939 std::string::String,
1940 crate::model::managed_folder::rapid_cache_config::RapidCachePolicy,
1941 >,
1942
1943 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1944 }
1945
1946 impl RapidCacheConfig {
1947 /// Creates a new default instance.
1948 pub fn new() -> Self {
1949 std::default::Default::default()
1950 }
1951
1952 /// Sets the value of [policies][crate::model::managed_folder::RapidCacheConfig::policies].
1953 ///
1954 /// # Example
1955 /// ```ignore,no_run
1956 /// # use google_cloud_storage::model::managed_folder::RapidCacheConfig;
1957 /// use google_cloud_storage::model::managed_folder::rapid_cache_config::RapidCachePolicy;
1958 /// let x = RapidCacheConfig::new().set_policies([
1959 /// ("key0", RapidCachePolicy::default()/* use setters */),
1960 /// ("key1", RapidCachePolicy::default()/* use (different) setters */),
1961 /// ]);
1962 /// ```
1963 pub fn set_policies<T, K, V>(mut self, v: T) -> Self
1964 where
1965 T: std::iter::IntoIterator<Item = (K, V)>,
1966 K: std::convert::Into<std::string::String>,
1967 V: std::convert::Into<
1968 crate::model::managed_folder::rapid_cache_config::RapidCachePolicy,
1969 >,
1970 {
1971 use std::iter::Iterator;
1972 self.policies = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
1973 self
1974 }
1975 }
1976
1977 impl wkt::message::Message for RapidCacheConfig {
1978 fn typename() -> &'static str {
1979 "type.googleapis.com/google.storage.control.v2.ManagedFolder.RapidCacheConfig"
1980 }
1981 }
1982
1983 /// Defines additional types related to [RapidCacheConfig].
1984 pub mod rapid_cache_config {
1985 #[allow(unused_imports)]
1986 use super::*;
1987
1988 /// Rapid Cache policy for a managed folder.
1989 #[derive(Clone, Default, PartialEq)]
1990 #[non_exhaustive]
1991 pub struct RapidCachePolicy {
1992 /// Required. The identifier for the rapid cache.
1993 pub rapid_cache_id: std::string::String,
1994
1995 /// Required. If enabled, objects in the Managed Folder will be ingested
1996 /// into the cache when they are written.
1997 pub ingest_on_write:
1998 crate::model::managed_folder::rapid_cache_config::rapid_cache_policy::IngestOnWrite,
1999
2000 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2001 }
2002
2003 impl RapidCachePolicy {
2004 /// Creates a new default instance.
2005 pub fn new() -> Self {
2006 std::default::Default::default()
2007 }
2008
2009 /// Sets the value of [rapid_cache_id][crate::model::managed_folder::rapid_cache_config::RapidCachePolicy::rapid_cache_id].
2010 ///
2011 /// # Example
2012 /// ```ignore,no_run
2013 /// # use google_cloud_storage::model::managed_folder::rapid_cache_config::RapidCachePolicy;
2014 /// let x = RapidCachePolicy::new().set_rapid_cache_id("example");
2015 /// ```
2016 pub fn set_rapid_cache_id<T: std::convert::Into<std::string::String>>(
2017 mut self,
2018 v: T,
2019 ) -> Self {
2020 self.rapid_cache_id = v.into();
2021 self
2022 }
2023
2024 /// Sets the value of [ingest_on_write][crate::model::managed_folder::rapid_cache_config::RapidCachePolicy::ingest_on_write].
2025 ///
2026 /// # Example
2027 /// ```ignore,no_run
2028 /// # use google_cloud_storage::model::managed_folder::rapid_cache_config::RapidCachePolicy;
2029 /// use google_cloud_storage::model::managed_folder::rapid_cache_config::rapid_cache_policy::IngestOnWrite;
2030 /// let x0 = RapidCachePolicy::new().set_ingest_on_write(IngestOnWrite::Enabled);
2031 /// ```
2032 pub fn set_ingest_on_write<T: std::convert::Into<crate::model::managed_folder::rapid_cache_config::rapid_cache_policy::IngestOnWrite>>(mut self, v: T) -> Self{
2033 self.ingest_on_write = v.into();
2034 self
2035 }
2036 }
2037
2038 impl wkt::message::Message for RapidCachePolicy {
2039 fn typename() -> &'static str {
2040 "type.googleapis.com/google.storage.control.v2.ManagedFolder.RapidCacheConfig.RapidCachePolicy"
2041 }
2042 }
2043
2044 /// Defines additional types related to [RapidCachePolicy].
2045 pub mod rapid_cache_policy {
2046 #[allow(unused_imports)]
2047 use super::*;
2048
2049 /// The behavior of the rapid cache when an object is written.
2050 ///
2051 /// # Working with unknown values
2052 ///
2053 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
2054 /// additional enum variants at any time. Adding new variants is not considered
2055 /// a breaking change. Applications should write their code in anticipation of:
2056 ///
2057 /// - New values appearing in future releases of the client library, **and**
2058 /// - New values received dynamically, without application changes.
2059 ///
2060 /// Please consult the [Working with enums] section in the user guide for some
2061 /// guidelines.
2062 ///
2063 /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
2064 #[derive(Clone, Debug, PartialEq)]
2065 #[non_exhaustive]
2066 pub enum IngestOnWrite {
2067 /// The behavior is not specified at this resource level.
2068 /// It should be inherited from the parent resource's configuration.
2069 /// This is the default value.
2070 Unspecified,
2071 /// Ingestion on write is explicitly enabled for this resource.
2072 Enabled,
2073 /// If set, the enum was initialized with an unknown value.
2074 ///
2075 /// Applications can examine the value using [IngestOnWrite::value] or
2076 /// [IngestOnWrite::name].
2077 UnknownValue(ingest_on_write::UnknownValue),
2078 }
2079
2080 #[doc(hidden)]
2081 pub mod ingest_on_write {
2082 #[allow(unused_imports)]
2083 use super::*;
2084 #[derive(Clone, Debug, PartialEq)]
2085 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
2086 }
2087
2088 impl IngestOnWrite {
2089 /// Gets the enum value.
2090 ///
2091 /// Returns `None` if the enum contains an unknown value deserialized from
2092 /// the string representation of enums.
2093 pub fn value(&self) -> std::option::Option<i32> {
2094 match self {
2095 Self::Unspecified => std::option::Option::Some(0),
2096 Self::Enabled => std::option::Option::Some(1),
2097 Self::UnknownValue(u) => u.0.value(),
2098 }
2099 }
2100
2101 /// Gets the enum value as a string.
2102 ///
2103 /// Returns `None` if the enum contains an unknown value deserialized from
2104 /// the integer representation of enums.
2105 pub fn name(&self) -> std::option::Option<&str> {
2106 match self {
2107 Self::Unspecified => {
2108 std::option::Option::Some("INGEST_ON_WRITE_UNSPECIFIED")
2109 }
2110 Self::Enabled => std::option::Option::Some("INGEST_ON_WRITE_ENABLED"),
2111 Self::UnknownValue(u) => u.0.name(),
2112 }
2113 }
2114 }
2115
2116 impl std::default::Default for IngestOnWrite {
2117 fn default() -> Self {
2118 use std::convert::From;
2119 Self::from(0)
2120 }
2121 }
2122
2123 impl std::fmt::Display for IngestOnWrite {
2124 fn fmt(
2125 &self,
2126 f: &mut std::fmt::Formatter<'_>,
2127 ) -> std::result::Result<(), std::fmt::Error> {
2128 wkt::internal::display_enum(f, self.name(), self.value())
2129 }
2130 }
2131
2132 impl std::convert::From<i32> for IngestOnWrite {
2133 fn from(value: i32) -> Self {
2134 match value {
2135 0 => Self::Unspecified,
2136 1 => Self::Enabled,
2137 _ => Self::UnknownValue(ingest_on_write::UnknownValue(
2138 wkt::internal::UnknownEnumValue::Integer(value),
2139 )),
2140 }
2141 }
2142 }
2143
2144 impl std::convert::From<&str> for IngestOnWrite {
2145 fn from(value: &str) -> Self {
2146 use std::string::ToString;
2147 match value {
2148 "INGEST_ON_WRITE_UNSPECIFIED" => Self::Unspecified,
2149 "INGEST_ON_WRITE_ENABLED" => Self::Enabled,
2150 _ => Self::UnknownValue(ingest_on_write::UnknownValue(
2151 wkt::internal::UnknownEnumValue::String(value.to_string()),
2152 )),
2153 }
2154 }
2155 }
2156
2157 impl serde::ser::Serialize for IngestOnWrite {
2158 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
2159 where
2160 S: serde::Serializer,
2161 {
2162 match self {
2163 Self::Unspecified => serializer.serialize_i32(0),
2164 Self::Enabled => serializer.serialize_i32(1),
2165 Self::UnknownValue(u) => u.0.serialize(serializer),
2166 }
2167 }
2168 }
2169
2170 impl<'de> serde::de::Deserialize<'de> for IngestOnWrite {
2171 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
2172 where
2173 D: serde::Deserializer<'de>,
2174 {
2175 deserializer.deserialize_any(wkt::internal::EnumVisitor::<IngestOnWrite>::new(
2176 ".google.storage.control.v2.ManagedFolder.RapidCacheConfig.RapidCachePolicy.IngestOnWrite"))
2177 }
2178 }
2179 }
2180 }
2181}
2182
2183/// Request message for GetManagedFolder.
2184#[derive(Clone, Default, PartialEq)]
2185#[non_exhaustive]
2186pub struct GetManagedFolderRequest {
2187 /// Required. Name of the managed folder.
2188 /// Format:
2189 /// `projects/{project}/buckets/{bucket}/managedFolders/{managedFolder}`
2190 pub name: std::string::String,
2191
2192 /// The operation succeeds conditional on the managed folder's current
2193 /// metageneration matching the value here specified.
2194 pub if_metageneration_match: std::option::Option<i64>,
2195
2196 /// The operation succeeds conditional on the managed folder's current
2197 /// metageneration NOT matching the value here specified.
2198 pub if_metageneration_not_match: std::option::Option<i64>,
2199
2200 /// Optional. A unique identifier for this request. UUID is the recommended
2201 /// format, but other formats are still accepted.
2202 pub request_id: std::string::String,
2203
2204 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2205}
2206
2207impl GetManagedFolderRequest {
2208 /// Creates a new default instance.
2209 pub fn new() -> Self {
2210 std::default::Default::default()
2211 }
2212
2213 /// Sets the value of [name][crate::model::GetManagedFolderRequest::name].
2214 ///
2215 /// # Example
2216 /// ```ignore,no_run
2217 /// # use google_cloud_storage::model::GetManagedFolderRequest;
2218 /// # let project_id = "project_id";
2219 /// # let bucket_id = "bucket_id";
2220 /// # let managed_folder_id = "managed_folder_id";
2221 /// let x = GetManagedFolderRequest::new().set_name(format!("projects/{project_id}/buckets/{bucket_id}/managedFolders/{managed_folder_id}"));
2222 /// ```
2223 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2224 self.name = v.into();
2225 self
2226 }
2227
2228 /// Sets the value of [if_metageneration_match][crate::model::GetManagedFolderRequest::if_metageneration_match].
2229 ///
2230 /// # Example
2231 /// ```ignore,no_run
2232 /// # use google_cloud_storage::model::GetManagedFolderRequest;
2233 /// let x = GetManagedFolderRequest::new().set_if_metageneration_match(42);
2234 /// ```
2235 pub fn set_if_metageneration_match<T>(mut self, v: T) -> Self
2236 where
2237 T: std::convert::Into<i64>,
2238 {
2239 self.if_metageneration_match = std::option::Option::Some(v.into());
2240 self
2241 }
2242
2243 /// Sets or clears the value of [if_metageneration_match][crate::model::GetManagedFolderRequest::if_metageneration_match].
2244 ///
2245 /// # Example
2246 /// ```ignore,no_run
2247 /// # use google_cloud_storage::model::GetManagedFolderRequest;
2248 /// let x = GetManagedFolderRequest::new().set_or_clear_if_metageneration_match(Some(42));
2249 /// let x = GetManagedFolderRequest::new().set_or_clear_if_metageneration_match(None::<i32>);
2250 /// ```
2251 pub fn set_or_clear_if_metageneration_match<T>(mut self, v: std::option::Option<T>) -> Self
2252 where
2253 T: std::convert::Into<i64>,
2254 {
2255 self.if_metageneration_match = v.map(|x| x.into());
2256 self
2257 }
2258
2259 /// Sets the value of [if_metageneration_not_match][crate::model::GetManagedFolderRequest::if_metageneration_not_match].
2260 ///
2261 /// # Example
2262 /// ```ignore,no_run
2263 /// # use google_cloud_storage::model::GetManagedFolderRequest;
2264 /// let x = GetManagedFolderRequest::new().set_if_metageneration_not_match(42);
2265 /// ```
2266 pub fn set_if_metageneration_not_match<T>(mut self, v: T) -> Self
2267 where
2268 T: std::convert::Into<i64>,
2269 {
2270 self.if_metageneration_not_match = std::option::Option::Some(v.into());
2271 self
2272 }
2273
2274 /// Sets or clears the value of [if_metageneration_not_match][crate::model::GetManagedFolderRequest::if_metageneration_not_match].
2275 ///
2276 /// # Example
2277 /// ```ignore,no_run
2278 /// # use google_cloud_storage::model::GetManagedFolderRequest;
2279 /// let x = GetManagedFolderRequest::new().set_or_clear_if_metageneration_not_match(Some(42));
2280 /// let x = GetManagedFolderRequest::new().set_or_clear_if_metageneration_not_match(None::<i32>);
2281 /// ```
2282 pub fn set_or_clear_if_metageneration_not_match<T>(mut self, v: std::option::Option<T>) -> Self
2283 where
2284 T: std::convert::Into<i64>,
2285 {
2286 self.if_metageneration_not_match = v.map(|x| x.into());
2287 self
2288 }
2289
2290 /// Sets the value of [request_id][crate::model::GetManagedFolderRequest::request_id].
2291 ///
2292 /// # Example
2293 /// ```ignore,no_run
2294 /// # use google_cloud_storage::model::GetManagedFolderRequest;
2295 /// let x = GetManagedFolderRequest::new().set_request_id("example");
2296 /// ```
2297 pub fn set_request_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2298 self.request_id = v.into();
2299 self
2300 }
2301}
2302
2303impl wkt::message::Message for GetManagedFolderRequest {
2304 fn typename() -> &'static str {
2305 "type.googleapis.com/google.storage.control.v2.GetManagedFolderRequest"
2306 }
2307}
2308
2309/// Request message for CreateManagedFolder.
2310#[derive(Clone, Default, PartialEq)]
2311#[non_exhaustive]
2312pub struct CreateManagedFolderRequest {
2313 /// Required. Name of the bucket this managed folder belongs to.
2314 pub parent: std::string::String,
2315
2316 /// Required. Properties of the managed folder being created.
2317 /// The bucket and managed folder names are specified in the `parent` and
2318 /// `managed_folder_id` fields. Populating these fields in `managed_folder`
2319 /// will result in an error.
2320 pub managed_folder: std::option::Option<crate::model::ManagedFolder>,
2321
2322 /// Required. The name of the managed folder. It uses a single `/` as delimiter
2323 /// and leading and trailing `/` are allowed.
2324 pub managed_folder_id: std::string::String,
2325
2326 /// Optional. A unique identifier for this request. UUID is the recommended
2327 /// format, but other formats are still accepted.
2328 pub request_id: std::string::String,
2329
2330 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2331}
2332
2333impl CreateManagedFolderRequest {
2334 /// Creates a new default instance.
2335 pub fn new() -> Self {
2336 std::default::Default::default()
2337 }
2338
2339 /// Sets the value of [parent][crate::model::CreateManagedFolderRequest::parent].
2340 ///
2341 /// # Example
2342 /// ```ignore,no_run
2343 /// # use google_cloud_storage::model::CreateManagedFolderRequest;
2344 /// # let project_id = "project_id";
2345 /// # let bucket_id = "bucket_id";
2346 /// let x = CreateManagedFolderRequest::new().set_parent(format!("projects/{project_id}/buckets/{bucket_id}"));
2347 /// ```
2348 pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2349 self.parent = v.into();
2350 self
2351 }
2352
2353 /// Sets the value of [managed_folder][crate::model::CreateManagedFolderRequest::managed_folder].
2354 ///
2355 /// # Example
2356 /// ```ignore,no_run
2357 /// # use google_cloud_storage::model::CreateManagedFolderRequest;
2358 /// use google_cloud_storage::model::ManagedFolder;
2359 /// let x = CreateManagedFolderRequest::new().set_managed_folder(ManagedFolder::default()/* use setters */);
2360 /// ```
2361 pub fn set_managed_folder<T>(mut self, v: T) -> Self
2362 where
2363 T: std::convert::Into<crate::model::ManagedFolder>,
2364 {
2365 self.managed_folder = std::option::Option::Some(v.into());
2366 self
2367 }
2368
2369 /// Sets or clears the value of [managed_folder][crate::model::CreateManagedFolderRequest::managed_folder].
2370 ///
2371 /// # Example
2372 /// ```ignore,no_run
2373 /// # use google_cloud_storage::model::CreateManagedFolderRequest;
2374 /// use google_cloud_storage::model::ManagedFolder;
2375 /// let x = CreateManagedFolderRequest::new().set_or_clear_managed_folder(Some(ManagedFolder::default()/* use setters */));
2376 /// let x = CreateManagedFolderRequest::new().set_or_clear_managed_folder(None::<ManagedFolder>);
2377 /// ```
2378 pub fn set_or_clear_managed_folder<T>(mut self, v: std::option::Option<T>) -> Self
2379 where
2380 T: std::convert::Into<crate::model::ManagedFolder>,
2381 {
2382 self.managed_folder = v.map(|x| x.into());
2383 self
2384 }
2385
2386 /// Sets the value of [managed_folder_id][crate::model::CreateManagedFolderRequest::managed_folder_id].
2387 ///
2388 /// # Example
2389 /// ```ignore,no_run
2390 /// # use google_cloud_storage::model::CreateManagedFolderRequest;
2391 /// let x = CreateManagedFolderRequest::new().set_managed_folder_id("example");
2392 /// ```
2393 pub fn set_managed_folder_id<T: std::convert::Into<std::string::String>>(
2394 mut self,
2395 v: T,
2396 ) -> Self {
2397 self.managed_folder_id = v.into();
2398 self
2399 }
2400
2401 /// Sets the value of [request_id][crate::model::CreateManagedFolderRequest::request_id].
2402 ///
2403 /// # Example
2404 /// ```ignore,no_run
2405 /// # use google_cloud_storage::model::CreateManagedFolderRequest;
2406 /// let x = CreateManagedFolderRequest::new().set_request_id("example");
2407 /// ```
2408 pub fn set_request_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2409 self.request_id = v.into();
2410 self
2411 }
2412}
2413
2414impl wkt::message::Message for CreateManagedFolderRequest {
2415 fn typename() -> &'static str {
2416 "type.googleapis.com/google.storage.control.v2.CreateManagedFolderRequest"
2417 }
2418}
2419
2420/// DeleteManagedFolder RPC request message.
2421#[derive(Clone, Default, PartialEq)]
2422#[non_exhaustive]
2423pub struct DeleteManagedFolderRequest {
2424 /// Required. Name of the managed folder.
2425 /// Format:
2426 /// `projects/{project}/buckets/{bucket}/managedFolders/{managedFolder}`
2427 pub name: std::string::String,
2428
2429 /// The operation succeeds conditional on the managed folder's current
2430 /// metageneration matching the value here specified.
2431 pub if_metageneration_match: std::option::Option<i64>,
2432
2433 /// The operation succeeds conditional on the managed folder's current
2434 /// metageneration NOT matching the value here specified.
2435 pub if_metageneration_not_match: std::option::Option<i64>,
2436
2437 /// Allows deletion of a managed folder even if it is not empty.
2438 /// A managed folder is empty if it manages no child managed folders or
2439 /// objects. Caller must have permission for
2440 /// storage.managedFolders.setIamPolicy.
2441 pub allow_non_empty: bool,
2442
2443 /// Optional. A unique identifier for this request. UUID is the recommended
2444 /// format, but other formats are still accepted.
2445 pub request_id: std::string::String,
2446
2447 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2448}
2449
2450impl DeleteManagedFolderRequest {
2451 /// Creates a new default instance.
2452 pub fn new() -> Self {
2453 std::default::Default::default()
2454 }
2455
2456 /// Sets the value of [name][crate::model::DeleteManagedFolderRequest::name].
2457 ///
2458 /// # Example
2459 /// ```ignore,no_run
2460 /// # use google_cloud_storage::model::DeleteManagedFolderRequest;
2461 /// # let project_id = "project_id";
2462 /// # let bucket_id = "bucket_id";
2463 /// # let managed_folder_id = "managed_folder_id";
2464 /// let x = DeleteManagedFolderRequest::new().set_name(format!("projects/{project_id}/buckets/{bucket_id}/managedFolders/{managed_folder_id}"));
2465 /// ```
2466 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2467 self.name = v.into();
2468 self
2469 }
2470
2471 /// Sets the value of [if_metageneration_match][crate::model::DeleteManagedFolderRequest::if_metageneration_match].
2472 ///
2473 /// # Example
2474 /// ```ignore,no_run
2475 /// # use google_cloud_storage::model::DeleteManagedFolderRequest;
2476 /// let x = DeleteManagedFolderRequest::new().set_if_metageneration_match(42);
2477 /// ```
2478 pub fn set_if_metageneration_match<T>(mut self, v: T) -> Self
2479 where
2480 T: std::convert::Into<i64>,
2481 {
2482 self.if_metageneration_match = std::option::Option::Some(v.into());
2483 self
2484 }
2485
2486 /// Sets or clears the value of [if_metageneration_match][crate::model::DeleteManagedFolderRequest::if_metageneration_match].
2487 ///
2488 /// # Example
2489 /// ```ignore,no_run
2490 /// # use google_cloud_storage::model::DeleteManagedFolderRequest;
2491 /// let x = DeleteManagedFolderRequest::new().set_or_clear_if_metageneration_match(Some(42));
2492 /// let x = DeleteManagedFolderRequest::new().set_or_clear_if_metageneration_match(None::<i32>);
2493 /// ```
2494 pub fn set_or_clear_if_metageneration_match<T>(mut self, v: std::option::Option<T>) -> Self
2495 where
2496 T: std::convert::Into<i64>,
2497 {
2498 self.if_metageneration_match = v.map(|x| x.into());
2499 self
2500 }
2501
2502 /// Sets the value of [if_metageneration_not_match][crate::model::DeleteManagedFolderRequest::if_metageneration_not_match].
2503 ///
2504 /// # Example
2505 /// ```ignore,no_run
2506 /// # use google_cloud_storage::model::DeleteManagedFolderRequest;
2507 /// let x = DeleteManagedFolderRequest::new().set_if_metageneration_not_match(42);
2508 /// ```
2509 pub fn set_if_metageneration_not_match<T>(mut self, v: T) -> Self
2510 where
2511 T: std::convert::Into<i64>,
2512 {
2513 self.if_metageneration_not_match = std::option::Option::Some(v.into());
2514 self
2515 }
2516
2517 /// Sets or clears the value of [if_metageneration_not_match][crate::model::DeleteManagedFolderRequest::if_metageneration_not_match].
2518 ///
2519 /// # Example
2520 /// ```ignore,no_run
2521 /// # use google_cloud_storage::model::DeleteManagedFolderRequest;
2522 /// let x = DeleteManagedFolderRequest::new().set_or_clear_if_metageneration_not_match(Some(42));
2523 /// let x = DeleteManagedFolderRequest::new().set_or_clear_if_metageneration_not_match(None::<i32>);
2524 /// ```
2525 pub fn set_or_clear_if_metageneration_not_match<T>(mut self, v: std::option::Option<T>) -> Self
2526 where
2527 T: std::convert::Into<i64>,
2528 {
2529 self.if_metageneration_not_match = v.map(|x| x.into());
2530 self
2531 }
2532
2533 /// Sets the value of [allow_non_empty][crate::model::DeleteManagedFolderRequest::allow_non_empty].
2534 ///
2535 /// # Example
2536 /// ```ignore,no_run
2537 /// # use google_cloud_storage::model::DeleteManagedFolderRequest;
2538 /// let x = DeleteManagedFolderRequest::new().set_allow_non_empty(true);
2539 /// ```
2540 pub fn set_allow_non_empty<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
2541 self.allow_non_empty = v.into();
2542 self
2543 }
2544
2545 /// Sets the value of [request_id][crate::model::DeleteManagedFolderRequest::request_id].
2546 ///
2547 /// # Example
2548 /// ```ignore,no_run
2549 /// # use google_cloud_storage::model::DeleteManagedFolderRequest;
2550 /// let x = DeleteManagedFolderRequest::new().set_request_id("example");
2551 /// ```
2552 pub fn set_request_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2553 self.request_id = v.into();
2554 self
2555 }
2556}
2557
2558impl wkt::message::Message for DeleteManagedFolderRequest {
2559 fn typename() -> &'static str {
2560 "type.googleapis.com/google.storage.control.v2.DeleteManagedFolderRequest"
2561 }
2562}
2563
2564/// Request message for ListManagedFolders.
2565#[derive(Clone, Default, PartialEq)]
2566#[non_exhaustive]
2567pub struct ListManagedFoldersRequest {
2568 /// Required. Name of the bucket this managed folder belongs to.
2569 pub parent: std::string::String,
2570
2571 /// Optional. Maximum number of managed folders to return in a single response.
2572 /// The service will use this parameter or 1,000 items, whichever is smaller.
2573 pub page_size: i32,
2574
2575 /// Optional. A previously-returned page token representing part of the larger
2576 /// set of results to view.
2577 pub page_token: std::string::String,
2578
2579 /// Optional. Filter results to match managed folders with name starting with
2580 /// this prefix.
2581 pub prefix: std::string::String,
2582
2583 /// Optional. A unique identifier for this request. UUID is the recommended
2584 /// format, but other formats are still accepted.
2585 pub request_id: std::string::String,
2586
2587 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2588}
2589
2590impl ListManagedFoldersRequest {
2591 /// Creates a new default instance.
2592 pub fn new() -> Self {
2593 std::default::Default::default()
2594 }
2595
2596 /// Sets the value of [parent][crate::model::ListManagedFoldersRequest::parent].
2597 ///
2598 /// # Example
2599 /// ```ignore,no_run
2600 /// # use google_cloud_storage::model::ListManagedFoldersRequest;
2601 /// # let project_id = "project_id";
2602 /// # let bucket_id = "bucket_id";
2603 /// let x = ListManagedFoldersRequest::new().set_parent(format!("projects/{project_id}/buckets/{bucket_id}"));
2604 /// ```
2605 pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2606 self.parent = v.into();
2607 self
2608 }
2609
2610 /// Sets the value of [page_size][crate::model::ListManagedFoldersRequest::page_size].
2611 ///
2612 /// # Example
2613 /// ```ignore,no_run
2614 /// # use google_cloud_storage::model::ListManagedFoldersRequest;
2615 /// let x = ListManagedFoldersRequest::new().set_page_size(42);
2616 /// ```
2617 pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
2618 self.page_size = v.into();
2619 self
2620 }
2621
2622 /// Sets the value of [page_token][crate::model::ListManagedFoldersRequest::page_token].
2623 ///
2624 /// # Example
2625 /// ```ignore,no_run
2626 /// # use google_cloud_storage::model::ListManagedFoldersRequest;
2627 /// let x = ListManagedFoldersRequest::new().set_page_token("example");
2628 /// ```
2629 pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2630 self.page_token = v.into();
2631 self
2632 }
2633
2634 /// Sets the value of [prefix][crate::model::ListManagedFoldersRequest::prefix].
2635 ///
2636 /// # Example
2637 /// ```ignore,no_run
2638 /// # use google_cloud_storage::model::ListManagedFoldersRequest;
2639 /// let x = ListManagedFoldersRequest::new().set_prefix("example");
2640 /// ```
2641 pub fn set_prefix<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2642 self.prefix = v.into();
2643 self
2644 }
2645
2646 /// Sets the value of [request_id][crate::model::ListManagedFoldersRequest::request_id].
2647 ///
2648 /// # Example
2649 /// ```ignore,no_run
2650 /// # use google_cloud_storage::model::ListManagedFoldersRequest;
2651 /// let x = ListManagedFoldersRequest::new().set_request_id("example");
2652 /// ```
2653 pub fn set_request_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2654 self.request_id = v.into();
2655 self
2656 }
2657}
2658
2659impl wkt::message::Message for ListManagedFoldersRequest {
2660 fn typename() -> &'static str {
2661 "type.googleapis.com/google.storage.control.v2.ListManagedFoldersRequest"
2662 }
2663}
2664
2665/// Response message for ListManagedFolders.
2666#[derive(Clone, Default, PartialEq)]
2667#[non_exhaustive]
2668pub struct ListManagedFoldersResponse {
2669 /// The list of matching managed folders
2670 pub managed_folders: std::vec::Vec<crate::model::ManagedFolder>,
2671
2672 /// The continuation token, used to page through large result sets. Provide
2673 /// this value in a subsequent request to return the next page of results.
2674 pub next_page_token: std::string::String,
2675
2676 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2677}
2678
2679impl ListManagedFoldersResponse {
2680 /// Creates a new default instance.
2681 pub fn new() -> Self {
2682 std::default::Default::default()
2683 }
2684
2685 /// Sets the value of [managed_folders][crate::model::ListManagedFoldersResponse::managed_folders].
2686 ///
2687 /// # Example
2688 /// ```ignore,no_run
2689 /// # use google_cloud_storage::model::ListManagedFoldersResponse;
2690 /// use google_cloud_storage::model::ManagedFolder;
2691 /// let x = ListManagedFoldersResponse::new()
2692 /// .set_managed_folders([
2693 /// ManagedFolder::default()/* use setters */,
2694 /// ManagedFolder::default()/* use (different) setters */,
2695 /// ]);
2696 /// ```
2697 pub fn set_managed_folders<T, V>(mut self, v: T) -> Self
2698 where
2699 T: std::iter::IntoIterator<Item = V>,
2700 V: std::convert::Into<crate::model::ManagedFolder>,
2701 {
2702 use std::iter::Iterator;
2703 self.managed_folders = v.into_iter().map(|i| i.into()).collect();
2704 self
2705 }
2706
2707 /// Sets the value of [next_page_token][crate::model::ListManagedFoldersResponse::next_page_token].
2708 ///
2709 /// # Example
2710 /// ```ignore,no_run
2711 /// # use google_cloud_storage::model::ListManagedFoldersResponse;
2712 /// let x = ListManagedFoldersResponse::new().set_next_page_token("example");
2713 /// ```
2714 pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2715 self.next_page_token = v.into();
2716 self
2717 }
2718}
2719
2720impl wkt::message::Message for ListManagedFoldersResponse {
2721 fn typename() -> &'static str {
2722 "type.googleapis.com/google.storage.control.v2.ListManagedFoldersResponse"
2723 }
2724}
2725
2726#[doc(hidden)]
2727impl google_cloud_gax::paginator::internal::PageableResponse for ListManagedFoldersResponse {
2728 type PageItem = crate::model::ManagedFolder;
2729
2730 fn items(self) -> std::vec::Vec<Self::PageItem> {
2731 self.managed_folders
2732 }
2733
2734 fn next_page_token(&self) -> std::string::String {
2735 use std::clone::Clone;
2736 self.next_page_token.clone()
2737 }
2738}
2739
2740/// Request message for UpdateManagedFolder.
2741#[derive(Clone, Default, PartialEq)]
2742#[non_exhaustive]
2743pub struct UpdateManagedFolderRequest {
2744 /// Required. Properties of the managed folder being updated. Currently, this
2745 /// RPC only supports updating the `rapid_cache_config` field in
2746 /// `managed_folder`.
2747 pub managed_folder: std::option::Option<crate::model::ManagedFolder>,
2748
2749 /// Optional. Update mask for managed_folder.
2750 /// Currently, this RPC only supports updating the `rapid_cache_config`
2751 /// field in `managed_folder`. This field also supports update mask for the
2752 /// subfields in the map of `rapid_cache_config`. The user can specify the
2753 /// update mask for `rapid_cache_config.policies` and
2754 /// `rapid_cache_config.policies.<key>`, but patching is not supported for
2755 /// a field within `RapidCachePolicy.policies.<key>`, like
2756 /// rapid_cache_config.policies.[key].ingest_on_write.
2757 pub update_mask: std::option::Option<wkt::FieldMask>,
2758
2759 /// Optional. The operation succeeds conditional on the managed folder's
2760 /// current metageneration matching the value here specified.
2761 pub if_metageneration_match: std::option::Option<i64>,
2762
2763 /// Optional. The operation succeeds conditional on the managed folder's
2764 /// current metageneration NOT matching the value here specified.
2765 pub if_metageneration_not_match: std::option::Option<i64>,
2766
2767 /// Optional. A unique identifier for this request. UUID is the recommended
2768 /// format, but other formats are still accepted.
2769 pub request_id: std::string::String,
2770
2771 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2772}
2773
2774impl UpdateManagedFolderRequest {
2775 /// Creates a new default instance.
2776 pub fn new() -> Self {
2777 std::default::Default::default()
2778 }
2779
2780 /// Sets the value of [managed_folder][crate::model::UpdateManagedFolderRequest::managed_folder].
2781 ///
2782 /// # Example
2783 /// ```ignore,no_run
2784 /// # use google_cloud_storage::model::UpdateManagedFolderRequest;
2785 /// use google_cloud_storage::model::ManagedFolder;
2786 /// let x = UpdateManagedFolderRequest::new().set_managed_folder(ManagedFolder::default()/* use setters */);
2787 /// ```
2788 pub fn set_managed_folder<T>(mut self, v: T) -> Self
2789 where
2790 T: std::convert::Into<crate::model::ManagedFolder>,
2791 {
2792 self.managed_folder = std::option::Option::Some(v.into());
2793 self
2794 }
2795
2796 /// Sets or clears the value of [managed_folder][crate::model::UpdateManagedFolderRequest::managed_folder].
2797 ///
2798 /// # Example
2799 /// ```ignore,no_run
2800 /// # use google_cloud_storage::model::UpdateManagedFolderRequest;
2801 /// use google_cloud_storage::model::ManagedFolder;
2802 /// let x = UpdateManagedFolderRequest::new().set_or_clear_managed_folder(Some(ManagedFolder::default()/* use setters */));
2803 /// let x = UpdateManagedFolderRequest::new().set_or_clear_managed_folder(None::<ManagedFolder>);
2804 /// ```
2805 pub fn set_or_clear_managed_folder<T>(mut self, v: std::option::Option<T>) -> Self
2806 where
2807 T: std::convert::Into<crate::model::ManagedFolder>,
2808 {
2809 self.managed_folder = v.map(|x| x.into());
2810 self
2811 }
2812
2813 /// Sets the value of [update_mask][crate::model::UpdateManagedFolderRequest::update_mask].
2814 ///
2815 /// # Example
2816 /// ```ignore,no_run
2817 /// # use google_cloud_storage::model::UpdateManagedFolderRequest;
2818 /// use wkt::FieldMask;
2819 /// let x = UpdateManagedFolderRequest::new().set_update_mask(FieldMask::default()/* use setters */);
2820 /// ```
2821 pub fn set_update_mask<T>(mut self, v: T) -> Self
2822 where
2823 T: std::convert::Into<wkt::FieldMask>,
2824 {
2825 self.update_mask = std::option::Option::Some(v.into());
2826 self
2827 }
2828
2829 /// Sets or clears the value of [update_mask][crate::model::UpdateManagedFolderRequest::update_mask].
2830 ///
2831 /// # Example
2832 /// ```ignore,no_run
2833 /// # use google_cloud_storage::model::UpdateManagedFolderRequest;
2834 /// use wkt::FieldMask;
2835 /// let x = UpdateManagedFolderRequest::new().set_or_clear_update_mask(Some(FieldMask::default()/* use setters */));
2836 /// let x = UpdateManagedFolderRequest::new().set_or_clear_update_mask(None::<FieldMask>);
2837 /// ```
2838 pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
2839 where
2840 T: std::convert::Into<wkt::FieldMask>,
2841 {
2842 self.update_mask = v.map(|x| x.into());
2843 self
2844 }
2845
2846 /// Sets the value of [if_metageneration_match][crate::model::UpdateManagedFolderRequest::if_metageneration_match].
2847 ///
2848 /// # Example
2849 /// ```ignore,no_run
2850 /// # use google_cloud_storage::model::UpdateManagedFolderRequest;
2851 /// let x = UpdateManagedFolderRequest::new().set_if_metageneration_match(42);
2852 /// ```
2853 pub fn set_if_metageneration_match<T>(mut self, v: T) -> Self
2854 where
2855 T: std::convert::Into<i64>,
2856 {
2857 self.if_metageneration_match = std::option::Option::Some(v.into());
2858 self
2859 }
2860
2861 /// Sets or clears the value of [if_metageneration_match][crate::model::UpdateManagedFolderRequest::if_metageneration_match].
2862 ///
2863 /// # Example
2864 /// ```ignore,no_run
2865 /// # use google_cloud_storage::model::UpdateManagedFolderRequest;
2866 /// let x = UpdateManagedFolderRequest::new().set_or_clear_if_metageneration_match(Some(42));
2867 /// let x = UpdateManagedFolderRequest::new().set_or_clear_if_metageneration_match(None::<i32>);
2868 /// ```
2869 pub fn set_or_clear_if_metageneration_match<T>(mut self, v: std::option::Option<T>) -> Self
2870 where
2871 T: std::convert::Into<i64>,
2872 {
2873 self.if_metageneration_match = v.map(|x| x.into());
2874 self
2875 }
2876
2877 /// Sets the value of [if_metageneration_not_match][crate::model::UpdateManagedFolderRequest::if_metageneration_not_match].
2878 ///
2879 /// # Example
2880 /// ```ignore,no_run
2881 /// # use google_cloud_storage::model::UpdateManagedFolderRequest;
2882 /// let x = UpdateManagedFolderRequest::new().set_if_metageneration_not_match(42);
2883 /// ```
2884 pub fn set_if_metageneration_not_match<T>(mut self, v: T) -> Self
2885 where
2886 T: std::convert::Into<i64>,
2887 {
2888 self.if_metageneration_not_match = std::option::Option::Some(v.into());
2889 self
2890 }
2891
2892 /// Sets or clears the value of [if_metageneration_not_match][crate::model::UpdateManagedFolderRequest::if_metageneration_not_match].
2893 ///
2894 /// # Example
2895 /// ```ignore,no_run
2896 /// # use google_cloud_storage::model::UpdateManagedFolderRequest;
2897 /// let x = UpdateManagedFolderRequest::new().set_or_clear_if_metageneration_not_match(Some(42));
2898 /// let x = UpdateManagedFolderRequest::new().set_or_clear_if_metageneration_not_match(None::<i32>);
2899 /// ```
2900 pub fn set_or_clear_if_metageneration_not_match<T>(mut self, v: std::option::Option<T>) -> Self
2901 where
2902 T: std::convert::Into<i64>,
2903 {
2904 self.if_metageneration_not_match = v.map(|x| x.into());
2905 self
2906 }
2907
2908 /// Sets the value of [request_id][crate::model::UpdateManagedFolderRequest::request_id].
2909 ///
2910 /// # Example
2911 /// ```ignore,no_run
2912 /// # use google_cloud_storage::model::UpdateManagedFolderRequest;
2913 /// let x = UpdateManagedFolderRequest::new().set_request_id("example");
2914 /// ```
2915 pub fn set_request_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2916 self.request_id = v.into();
2917 self
2918 }
2919}
2920
2921impl wkt::message::Message for UpdateManagedFolderRequest {
2922 fn typename() -> &'static str {
2923 "type.googleapis.com/google.storage.control.v2.UpdateManagedFolderRequest"
2924 }
2925}
2926
2927/// Message returned in the metadata field of the Operation resource for
2928/// CreateAnywhereCache operations.
2929#[derive(Clone, Default, PartialEq)]
2930#[non_exhaustive]
2931pub struct CreateAnywhereCacheMetadata {
2932 /// Generic metadata for the long running operation.
2933 pub common_metadata: std::option::Option<crate::model::CommonLongRunningOperationMetadata>,
2934
2935 /// Anywhere Cache ID.
2936 pub anywhere_cache_id: std::option::Option<std::string::String>,
2937
2938 /// The zone in which the cache instance is running. For example,
2939 /// us-central1-a.
2940 pub zone: std::option::Option<std::string::String>,
2941
2942 /// Anywhere Cache entry's TTL. A cache-level config that is applied to all new
2943 /// cache entries on admission. Default ttl value (24hrs) is applied if not
2944 /// specified in the create request.
2945 pub ttl: std::option::Option<wkt::Duration>,
2946
2947 /// Anywhere Cache entry Admission Policy in kebab-case (e.g.,
2948 /// "admit-on-first-miss"). Default admission policy (admit-on-first-miss) is
2949 /// applied if not specified in the create request.
2950 pub admission_policy: std::option::Option<std::string::String>,
2951
2952 /// Optional. Specifies whether objects are ingested into the cache upon write.
2953 /// Defaults to false.
2954 pub ingest_on_write: std::option::Option<bool>,
2955
2956 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2957}
2958
2959impl CreateAnywhereCacheMetadata {
2960 /// Creates a new default instance.
2961 pub fn new() -> Self {
2962 std::default::Default::default()
2963 }
2964
2965 /// Sets the value of [common_metadata][crate::model::CreateAnywhereCacheMetadata::common_metadata].
2966 ///
2967 /// # Example
2968 /// ```ignore,no_run
2969 /// # use google_cloud_storage::model::CreateAnywhereCacheMetadata;
2970 /// use google_cloud_storage::model::CommonLongRunningOperationMetadata;
2971 /// let x = CreateAnywhereCacheMetadata::new().set_common_metadata(CommonLongRunningOperationMetadata::default()/* use setters */);
2972 /// ```
2973 pub fn set_common_metadata<T>(mut self, v: T) -> Self
2974 where
2975 T: std::convert::Into<crate::model::CommonLongRunningOperationMetadata>,
2976 {
2977 self.common_metadata = std::option::Option::Some(v.into());
2978 self
2979 }
2980
2981 /// Sets or clears the value of [common_metadata][crate::model::CreateAnywhereCacheMetadata::common_metadata].
2982 ///
2983 /// # Example
2984 /// ```ignore,no_run
2985 /// # use google_cloud_storage::model::CreateAnywhereCacheMetadata;
2986 /// use google_cloud_storage::model::CommonLongRunningOperationMetadata;
2987 /// let x = CreateAnywhereCacheMetadata::new().set_or_clear_common_metadata(Some(CommonLongRunningOperationMetadata::default()/* use setters */));
2988 /// let x = CreateAnywhereCacheMetadata::new().set_or_clear_common_metadata(None::<CommonLongRunningOperationMetadata>);
2989 /// ```
2990 pub fn set_or_clear_common_metadata<T>(mut self, v: std::option::Option<T>) -> Self
2991 where
2992 T: std::convert::Into<crate::model::CommonLongRunningOperationMetadata>,
2993 {
2994 self.common_metadata = v.map(|x| x.into());
2995 self
2996 }
2997
2998 /// Sets the value of [anywhere_cache_id][crate::model::CreateAnywhereCacheMetadata::anywhere_cache_id].
2999 ///
3000 /// # Example
3001 /// ```ignore,no_run
3002 /// # use google_cloud_storage::model::CreateAnywhereCacheMetadata;
3003 /// let x = CreateAnywhereCacheMetadata::new().set_anywhere_cache_id("example");
3004 /// ```
3005 pub fn set_anywhere_cache_id<T>(mut self, v: T) -> Self
3006 where
3007 T: std::convert::Into<std::string::String>,
3008 {
3009 self.anywhere_cache_id = std::option::Option::Some(v.into());
3010 self
3011 }
3012
3013 /// Sets or clears the value of [anywhere_cache_id][crate::model::CreateAnywhereCacheMetadata::anywhere_cache_id].
3014 ///
3015 /// # Example
3016 /// ```ignore,no_run
3017 /// # use google_cloud_storage::model::CreateAnywhereCacheMetadata;
3018 /// let x = CreateAnywhereCacheMetadata::new().set_or_clear_anywhere_cache_id(Some("example"));
3019 /// let x = CreateAnywhereCacheMetadata::new().set_or_clear_anywhere_cache_id(None::<String>);
3020 /// ```
3021 pub fn set_or_clear_anywhere_cache_id<T>(mut self, v: std::option::Option<T>) -> Self
3022 where
3023 T: std::convert::Into<std::string::String>,
3024 {
3025 self.anywhere_cache_id = v.map(|x| x.into());
3026 self
3027 }
3028
3029 /// Sets the value of [zone][crate::model::CreateAnywhereCacheMetadata::zone].
3030 ///
3031 /// # Example
3032 /// ```ignore,no_run
3033 /// # use google_cloud_storage::model::CreateAnywhereCacheMetadata;
3034 /// let x = CreateAnywhereCacheMetadata::new().set_zone("example");
3035 /// ```
3036 pub fn set_zone<T>(mut self, v: T) -> Self
3037 where
3038 T: std::convert::Into<std::string::String>,
3039 {
3040 self.zone = std::option::Option::Some(v.into());
3041 self
3042 }
3043
3044 /// Sets or clears the value of [zone][crate::model::CreateAnywhereCacheMetadata::zone].
3045 ///
3046 /// # Example
3047 /// ```ignore,no_run
3048 /// # use google_cloud_storage::model::CreateAnywhereCacheMetadata;
3049 /// let x = CreateAnywhereCacheMetadata::new().set_or_clear_zone(Some("example"));
3050 /// let x = CreateAnywhereCacheMetadata::new().set_or_clear_zone(None::<String>);
3051 /// ```
3052 pub fn set_or_clear_zone<T>(mut self, v: std::option::Option<T>) -> Self
3053 where
3054 T: std::convert::Into<std::string::String>,
3055 {
3056 self.zone = v.map(|x| x.into());
3057 self
3058 }
3059
3060 /// Sets the value of [ttl][crate::model::CreateAnywhereCacheMetadata::ttl].
3061 ///
3062 /// # Example
3063 /// ```ignore,no_run
3064 /// # use google_cloud_storage::model::CreateAnywhereCacheMetadata;
3065 /// use wkt::Duration;
3066 /// let x = CreateAnywhereCacheMetadata::new().set_ttl(Duration::default()/* use setters */);
3067 /// ```
3068 pub fn set_ttl<T>(mut self, v: T) -> Self
3069 where
3070 T: std::convert::Into<wkt::Duration>,
3071 {
3072 self.ttl = std::option::Option::Some(v.into());
3073 self
3074 }
3075
3076 /// Sets or clears the value of [ttl][crate::model::CreateAnywhereCacheMetadata::ttl].
3077 ///
3078 /// # Example
3079 /// ```ignore,no_run
3080 /// # use google_cloud_storage::model::CreateAnywhereCacheMetadata;
3081 /// use wkt::Duration;
3082 /// let x = CreateAnywhereCacheMetadata::new().set_or_clear_ttl(Some(Duration::default()/* use setters */));
3083 /// let x = CreateAnywhereCacheMetadata::new().set_or_clear_ttl(None::<Duration>);
3084 /// ```
3085 pub fn set_or_clear_ttl<T>(mut self, v: std::option::Option<T>) -> Self
3086 where
3087 T: std::convert::Into<wkt::Duration>,
3088 {
3089 self.ttl = v.map(|x| x.into());
3090 self
3091 }
3092
3093 /// Sets the value of [admission_policy][crate::model::CreateAnywhereCacheMetadata::admission_policy].
3094 ///
3095 /// # Example
3096 /// ```ignore,no_run
3097 /// # use google_cloud_storage::model::CreateAnywhereCacheMetadata;
3098 /// let x = CreateAnywhereCacheMetadata::new().set_admission_policy("example");
3099 /// ```
3100 pub fn set_admission_policy<T>(mut self, v: T) -> Self
3101 where
3102 T: std::convert::Into<std::string::String>,
3103 {
3104 self.admission_policy = std::option::Option::Some(v.into());
3105 self
3106 }
3107
3108 /// Sets or clears the value of [admission_policy][crate::model::CreateAnywhereCacheMetadata::admission_policy].
3109 ///
3110 /// # Example
3111 /// ```ignore,no_run
3112 /// # use google_cloud_storage::model::CreateAnywhereCacheMetadata;
3113 /// let x = CreateAnywhereCacheMetadata::new().set_or_clear_admission_policy(Some("example"));
3114 /// let x = CreateAnywhereCacheMetadata::new().set_or_clear_admission_policy(None::<String>);
3115 /// ```
3116 pub fn set_or_clear_admission_policy<T>(mut self, v: std::option::Option<T>) -> Self
3117 where
3118 T: std::convert::Into<std::string::String>,
3119 {
3120 self.admission_policy = v.map(|x| x.into());
3121 self
3122 }
3123
3124 /// Sets the value of [ingest_on_write][crate::model::CreateAnywhereCacheMetadata::ingest_on_write].
3125 ///
3126 /// # Example
3127 /// ```ignore,no_run
3128 /// # use google_cloud_storage::model::CreateAnywhereCacheMetadata;
3129 /// let x = CreateAnywhereCacheMetadata::new().set_ingest_on_write(true);
3130 /// ```
3131 pub fn set_ingest_on_write<T>(mut self, v: T) -> Self
3132 where
3133 T: std::convert::Into<bool>,
3134 {
3135 self.ingest_on_write = std::option::Option::Some(v.into());
3136 self
3137 }
3138
3139 /// Sets or clears the value of [ingest_on_write][crate::model::CreateAnywhereCacheMetadata::ingest_on_write].
3140 ///
3141 /// # Example
3142 /// ```ignore,no_run
3143 /// # use google_cloud_storage::model::CreateAnywhereCacheMetadata;
3144 /// let x = CreateAnywhereCacheMetadata::new().set_or_clear_ingest_on_write(Some(false));
3145 /// let x = CreateAnywhereCacheMetadata::new().set_or_clear_ingest_on_write(None::<bool>);
3146 /// ```
3147 pub fn set_or_clear_ingest_on_write<T>(mut self, v: std::option::Option<T>) -> Self
3148 where
3149 T: std::convert::Into<bool>,
3150 {
3151 self.ingest_on_write = v.map(|x| x.into());
3152 self
3153 }
3154}
3155
3156impl wkt::message::Message for CreateAnywhereCacheMetadata {
3157 fn typename() -> &'static str {
3158 "type.googleapis.com/google.storage.control.v2.CreateAnywhereCacheMetadata"
3159 }
3160}
3161
3162/// Message returned in the metadata field of the Operation resource for
3163/// CreateRapidCache operations.
3164#[derive(Clone, Default, PartialEq)]
3165#[non_exhaustive]
3166pub struct CreateRapidCacheMetadata {
3167 /// Generic metadata for the long running operation.
3168 pub common_metadata: std::option::Option<crate::model::CommonLongRunningOperationMetadata>,
3169
3170 /// Rapid Cache ID.
3171 pub rapid_cache_id: std::option::Option<std::string::String>,
3172
3173 /// The zone in which the cache instance is running. For example,
3174 /// us-central1-a.
3175 pub zone: std::option::Option<std::string::String>,
3176
3177 /// Rapid Cache entry's TTL. A cache-level config that is applied to all new
3178 /// cache entries on admission. Default ttl value (24hrs) is applied if not
3179 /// specified in the create request.
3180 pub ttl: std::option::Option<wkt::Duration>,
3181
3182 /// Anywhere Cache entry Admission Policy in kebab-case (e.g.,
3183 /// "admit-on-first-miss"). Default admission policy (admit-on-first-miss) is
3184 /// applied if not specified in the create request.
3185 pub admission_policy: std::option::Option<std::string::String>,
3186
3187 /// Optional. Specifies whether objects are ingested into the cache upon write.
3188 /// Defaults to false.
3189 pub ingest_on_write: std::option::Option<bool>,
3190
3191 /// Optional. The type of cache. Either rapid cache or rapid cache ultra.
3192 pub cache_type: std::option::Option<std::string::String>,
3193
3194 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3195}
3196
3197impl CreateRapidCacheMetadata {
3198 /// Creates a new default instance.
3199 pub fn new() -> Self {
3200 std::default::Default::default()
3201 }
3202
3203 /// Sets the value of [common_metadata][crate::model::CreateRapidCacheMetadata::common_metadata].
3204 ///
3205 /// # Example
3206 /// ```ignore,no_run
3207 /// # use google_cloud_storage::model::CreateRapidCacheMetadata;
3208 /// use google_cloud_storage::model::CommonLongRunningOperationMetadata;
3209 /// let x = CreateRapidCacheMetadata::new().set_common_metadata(CommonLongRunningOperationMetadata::default()/* use setters */);
3210 /// ```
3211 pub fn set_common_metadata<T>(mut self, v: T) -> Self
3212 where
3213 T: std::convert::Into<crate::model::CommonLongRunningOperationMetadata>,
3214 {
3215 self.common_metadata = std::option::Option::Some(v.into());
3216 self
3217 }
3218
3219 /// Sets or clears the value of [common_metadata][crate::model::CreateRapidCacheMetadata::common_metadata].
3220 ///
3221 /// # Example
3222 /// ```ignore,no_run
3223 /// # use google_cloud_storage::model::CreateRapidCacheMetadata;
3224 /// use google_cloud_storage::model::CommonLongRunningOperationMetadata;
3225 /// let x = CreateRapidCacheMetadata::new().set_or_clear_common_metadata(Some(CommonLongRunningOperationMetadata::default()/* use setters */));
3226 /// let x = CreateRapidCacheMetadata::new().set_or_clear_common_metadata(None::<CommonLongRunningOperationMetadata>);
3227 /// ```
3228 pub fn set_or_clear_common_metadata<T>(mut self, v: std::option::Option<T>) -> Self
3229 where
3230 T: std::convert::Into<crate::model::CommonLongRunningOperationMetadata>,
3231 {
3232 self.common_metadata = v.map(|x| x.into());
3233 self
3234 }
3235
3236 /// Sets the value of [rapid_cache_id][crate::model::CreateRapidCacheMetadata::rapid_cache_id].
3237 ///
3238 /// # Example
3239 /// ```ignore,no_run
3240 /// # use google_cloud_storage::model::CreateRapidCacheMetadata;
3241 /// let x = CreateRapidCacheMetadata::new().set_rapid_cache_id("example");
3242 /// ```
3243 pub fn set_rapid_cache_id<T>(mut self, v: T) -> Self
3244 where
3245 T: std::convert::Into<std::string::String>,
3246 {
3247 self.rapid_cache_id = std::option::Option::Some(v.into());
3248 self
3249 }
3250
3251 /// Sets or clears the value of [rapid_cache_id][crate::model::CreateRapidCacheMetadata::rapid_cache_id].
3252 ///
3253 /// # Example
3254 /// ```ignore,no_run
3255 /// # use google_cloud_storage::model::CreateRapidCacheMetadata;
3256 /// let x = CreateRapidCacheMetadata::new().set_or_clear_rapid_cache_id(Some("example"));
3257 /// let x = CreateRapidCacheMetadata::new().set_or_clear_rapid_cache_id(None::<String>);
3258 /// ```
3259 pub fn set_or_clear_rapid_cache_id<T>(mut self, v: std::option::Option<T>) -> Self
3260 where
3261 T: std::convert::Into<std::string::String>,
3262 {
3263 self.rapid_cache_id = v.map(|x| x.into());
3264 self
3265 }
3266
3267 /// Sets the value of [zone][crate::model::CreateRapidCacheMetadata::zone].
3268 ///
3269 /// # Example
3270 /// ```ignore,no_run
3271 /// # use google_cloud_storage::model::CreateRapidCacheMetadata;
3272 /// let x = CreateRapidCacheMetadata::new().set_zone("example");
3273 /// ```
3274 pub fn set_zone<T>(mut self, v: T) -> Self
3275 where
3276 T: std::convert::Into<std::string::String>,
3277 {
3278 self.zone = std::option::Option::Some(v.into());
3279 self
3280 }
3281
3282 /// Sets or clears the value of [zone][crate::model::CreateRapidCacheMetadata::zone].
3283 ///
3284 /// # Example
3285 /// ```ignore,no_run
3286 /// # use google_cloud_storage::model::CreateRapidCacheMetadata;
3287 /// let x = CreateRapidCacheMetadata::new().set_or_clear_zone(Some("example"));
3288 /// let x = CreateRapidCacheMetadata::new().set_or_clear_zone(None::<String>);
3289 /// ```
3290 pub fn set_or_clear_zone<T>(mut self, v: std::option::Option<T>) -> Self
3291 where
3292 T: std::convert::Into<std::string::String>,
3293 {
3294 self.zone = v.map(|x| x.into());
3295 self
3296 }
3297
3298 /// Sets the value of [ttl][crate::model::CreateRapidCacheMetadata::ttl].
3299 ///
3300 /// # Example
3301 /// ```ignore,no_run
3302 /// # use google_cloud_storage::model::CreateRapidCacheMetadata;
3303 /// use wkt::Duration;
3304 /// let x = CreateRapidCacheMetadata::new().set_ttl(Duration::default()/* use setters */);
3305 /// ```
3306 pub fn set_ttl<T>(mut self, v: T) -> Self
3307 where
3308 T: std::convert::Into<wkt::Duration>,
3309 {
3310 self.ttl = std::option::Option::Some(v.into());
3311 self
3312 }
3313
3314 /// Sets or clears the value of [ttl][crate::model::CreateRapidCacheMetadata::ttl].
3315 ///
3316 /// # Example
3317 /// ```ignore,no_run
3318 /// # use google_cloud_storage::model::CreateRapidCacheMetadata;
3319 /// use wkt::Duration;
3320 /// let x = CreateRapidCacheMetadata::new().set_or_clear_ttl(Some(Duration::default()/* use setters */));
3321 /// let x = CreateRapidCacheMetadata::new().set_or_clear_ttl(None::<Duration>);
3322 /// ```
3323 pub fn set_or_clear_ttl<T>(mut self, v: std::option::Option<T>) -> Self
3324 where
3325 T: std::convert::Into<wkt::Duration>,
3326 {
3327 self.ttl = v.map(|x| x.into());
3328 self
3329 }
3330
3331 /// Sets the value of [admission_policy][crate::model::CreateRapidCacheMetadata::admission_policy].
3332 ///
3333 /// # Example
3334 /// ```ignore,no_run
3335 /// # use google_cloud_storage::model::CreateRapidCacheMetadata;
3336 /// let x = CreateRapidCacheMetadata::new().set_admission_policy("example");
3337 /// ```
3338 pub fn set_admission_policy<T>(mut self, v: T) -> Self
3339 where
3340 T: std::convert::Into<std::string::String>,
3341 {
3342 self.admission_policy = std::option::Option::Some(v.into());
3343 self
3344 }
3345
3346 /// Sets or clears the value of [admission_policy][crate::model::CreateRapidCacheMetadata::admission_policy].
3347 ///
3348 /// # Example
3349 /// ```ignore,no_run
3350 /// # use google_cloud_storage::model::CreateRapidCacheMetadata;
3351 /// let x = CreateRapidCacheMetadata::new().set_or_clear_admission_policy(Some("example"));
3352 /// let x = CreateRapidCacheMetadata::new().set_or_clear_admission_policy(None::<String>);
3353 /// ```
3354 pub fn set_or_clear_admission_policy<T>(mut self, v: std::option::Option<T>) -> Self
3355 where
3356 T: std::convert::Into<std::string::String>,
3357 {
3358 self.admission_policy = v.map(|x| x.into());
3359 self
3360 }
3361
3362 /// Sets the value of [ingest_on_write][crate::model::CreateRapidCacheMetadata::ingest_on_write].
3363 ///
3364 /// # Example
3365 /// ```ignore,no_run
3366 /// # use google_cloud_storage::model::CreateRapidCacheMetadata;
3367 /// let x = CreateRapidCacheMetadata::new().set_ingest_on_write(true);
3368 /// ```
3369 pub fn set_ingest_on_write<T>(mut self, v: T) -> Self
3370 where
3371 T: std::convert::Into<bool>,
3372 {
3373 self.ingest_on_write = std::option::Option::Some(v.into());
3374 self
3375 }
3376
3377 /// Sets or clears the value of [ingest_on_write][crate::model::CreateRapidCacheMetadata::ingest_on_write].
3378 ///
3379 /// # Example
3380 /// ```ignore,no_run
3381 /// # use google_cloud_storage::model::CreateRapidCacheMetadata;
3382 /// let x = CreateRapidCacheMetadata::new().set_or_clear_ingest_on_write(Some(false));
3383 /// let x = CreateRapidCacheMetadata::new().set_or_clear_ingest_on_write(None::<bool>);
3384 /// ```
3385 pub fn set_or_clear_ingest_on_write<T>(mut self, v: std::option::Option<T>) -> Self
3386 where
3387 T: std::convert::Into<bool>,
3388 {
3389 self.ingest_on_write = v.map(|x| x.into());
3390 self
3391 }
3392
3393 /// Sets the value of [cache_type][crate::model::CreateRapidCacheMetadata::cache_type].
3394 ///
3395 /// # Example
3396 /// ```ignore,no_run
3397 /// # use google_cloud_storage::model::CreateRapidCacheMetadata;
3398 /// let x = CreateRapidCacheMetadata::new().set_cache_type("example");
3399 /// ```
3400 pub fn set_cache_type<T>(mut self, v: T) -> Self
3401 where
3402 T: std::convert::Into<std::string::String>,
3403 {
3404 self.cache_type = std::option::Option::Some(v.into());
3405 self
3406 }
3407
3408 /// Sets or clears the value of [cache_type][crate::model::CreateRapidCacheMetadata::cache_type].
3409 ///
3410 /// # Example
3411 /// ```ignore,no_run
3412 /// # use google_cloud_storage::model::CreateRapidCacheMetadata;
3413 /// let x = CreateRapidCacheMetadata::new().set_or_clear_cache_type(Some("example"));
3414 /// let x = CreateRapidCacheMetadata::new().set_or_clear_cache_type(None::<String>);
3415 /// ```
3416 pub fn set_or_clear_cache_type<T>(mut self, v: std::option::Option<T>) -> Self
3417 where
3418 T: std::convert::Into<std::string::String>,
3419 {
3420 self.cache_type = v.map(|x| x.into());
3421 self
3422 }
3423}
3424
3425impl wkt::message::Message for CreateRapidCacheMetadata {
3426 fn typename() -> &'static str {
3427 "type.googleapis.com/google.storage.control.v2.CreateRapidCacheMetadata"
3428 }
3429}
3430
3431/// Message returned in the metadata field of the Operation resource for
3432/// UpdateAnywhereCache operation.
3433#[derive(Clone, Default, PartialEq)]
3434#[non_exhaustive]
3435pub struct UpdateAnywhereCacheMetadata {
3436 /// Generic metadata for the long running operation.
3437 pub common_metadata: std::option::Option<crate::model::CommonLongRunningOperationMetadata>,
3438
3439 /// Anywhere Cache ID.
3440 pub anywhere_cache_id: std::option::Option<std::string::String>,
3441
3442 /// The zone in which the cache instance is running. For example,
3443 /// us-central1-a.
3444 pub zone: std::option::Option<std::string::String>,
3445
3446 /// Anywhere Cache entry's TTL between 1h and 7days. A cache-level config that
3447 /// is applied to all new cache entries on admission. If `ttl` is pending
3448 /// update, this field equals to the new value specified in the Update request.
3449 pub ttl: std::option::Option<wkt::Duration>,
3450
3451 /// Optional. Anywhere Cache entry Admission Policy in kebab-case (e.g.,
3452 /// "admit-on-first-miss"). If `admission_policy` is pending
3453 /// update, this field equals to the new value specified in the Update request.
3454 pub admission_policy: std::option::Option<std::string::String>,
3455
3456 /// Specifies whether objects are ingested into the cache upon write. If not
3457 /// set, it defaults to false.
3458 pub ingest_on_write: std::option::Option<bool>,
3459
3460 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3461}
3462
3463impl UpdateAnywhereCacheMetadata {
3464 /// Creates a new default instance.
3465 pub fn new() -> Self {
3466 std::default::Default::default()
3467 }
3468
3469 /// Sets the value of [common_metadata][crate::model::UpdateAnywhereCacheMetadata::common_metadata].
3470 ///
3471 /// # Example
3472 /// ```ignore,no_run
3473 /// # use google_cloud_storage::model::UpdateAnywhereCacheMetadata;
3474 /// use google_cloud_storage::model::CommonLongRunningOperationMetadata;
3475 /// let x = UpdateAnywhereCacheMetadata::new().set_common_metadata(CommonLongRunningOperationMetadata::default()/* use setters */);
3476 /// ```
3477 pub fn set_common_metadata<T>(mut self, v: T) -> Self
3478 where
3479 T: std::convert::Into<crate::model::CommonLongRunningOperationMetadata>,
3480 {
3481 self.common_metadata = std::option::Option::Some(v.into());
3482 self
3483 }
3484
3485 /// Sets or clears the value of [common_metadata][crate::model::UpdateAnywhereCacheMetadata::common_metadata].
3486 ///
3487 /// # Example
3488 /// ```ignore,no_run
3489 /// # use google_cloud_storage::model::UpdateAnywhereCacheMetadata;
3490 /// use google_cloud_storage::model::CommonLongRunningOperationMetadata;
3491 /// let x = UpdateAnywhereCacheMetadata::new().set_or_clear_common_metadata(Some(CommonLongRunningOperationMetadata::default()/* use setters */));
3492 /// let x = UpdateAnywhereCacheMetadata::new().set_or_clear_common_metadata(None::<CommonLongRunningOperationMetadata>);
3493 /// ```
3494 pub fn set_or_clear_common_metadata<T>(mut self, v: std::option::Option<T>) -> Self
3495 where
3496 T: std::convert::Into<crate::model::CommonLongRunningOperationMetadata>,
3497 {
3498 self.common_metadata = v.map(|x| x.into());
3499 self
3500 }
3501
3502 /// Sets the value of [anywhere_cache_id][crate::model::UpdateAnywhereCacheMetadata::anywhere_cache_id].
3503 ///
3504 /// # Example
3505 /// ```ignore,no_run
3506 /// # use google_cloud_storage::model::UpdateAnywhereCacheMetadata;
3507 /// let x = UpdateAnywhereCacheMetadata::new().set_anywhere_cache_id("example");
3508 /// ```
3509 pub fn set_anywhere_cache_id<T>(mut self, v: T) -> Self
3510 where
3511 T: std::convert::Into<std::string::String>,
3512 {
3513 self.anywhere_cache_id = std::option::Option::Some(v.into());
3514 self
3515 }
3516
3517 /// Sets or clears the value of [anywhere_cache_id][crate::model::UpdateAnywhereCacheMetadata::anywhere_cache_id].
3518 ///
3519 /// # Example
3520 /// ```ignore,no_run
3521 /// # use google_cloud_storage::model::UpdateAnywhereCacheMetadata;
3522 /// let x = UpdateAnywhereCacheMetadata::new().set_or_clear_anywhere_cache_id(Some("example"));
3523 /// let x = UpdateAnywhereCacheMetadata::new().set_or_clear_anywhere_cache_id(None::<String>);
3524 /// ```
3525 pub fn set_or_clear_anywhere_cache_id<T>(mut self, v: std::option::Option<T>) -> Self
3526 where
3527 T: std::convert::Into<std::string::String>,
3528 {
3529 self.anywhere_cache_id = v.map(|x| x.into());
3530 self
3531 }
3532
3533 /// Sets the value of [zone][crate::model::UpdateAnywhereCacheMetadata::zone].
3534 ///
3535 /// # Example
3536 /// ```ignore,no_run
3537 /// # use google_cloud_storage::model::UpdateAnywhereCacheMetadata;
3538 /// let x = UpdateAnywhereCacheMetadata::new().set_zone("example");
3539 /// ```
3540 pub fn set_zone<T>(mut self, v: T) -> Self
3541 where
3542 T: std::convert::Into<std::string::String>,
3543 {
3544 self.zone = std::option::Option::Some(v.into());
3545 self
3546 }
3547
3548 /// Sets or clears the value of [zone][crate::model::UpdateAnywhereCacheMetadata::zone].
3549 ///
3550 /// # Example
3551 /// ```ignore,no_run
3552 /// # use google_cloud_storage::model::UpdateAnywhereCacheMetadata;
3553 /// let x = UpdateAnywhereCacheMetadata::new().set_or_clear_zone(Some("example"));
3554 /// let x = UpdateAnywhereCacheMetadata::new().set_or_clear_zone(None::<String>);
3555 /// ```
3556 pub fn set_or_clear_zone<T>(mut self, v: std::option::Option<T>) -> Self
3557 where
3558 T: std::convert::Into<std::string::String>,
3559 {
3560 self.zone = v.map(|x| x.into());
3561 self
3562 }
3563
3564 /// Sets the value of [ttl][crate::model::UpdateAnywhereCacheMetadata::ttl].
3565 ///
3566 /// # Example
3567 /// ```ignore,no_run
3568 /// # use google_cloud_storage::model::UpdateAnywhereCacheMetadata;
3569 /// use wkt::Duration;
3570 /// let x = UpdateAnywhereCacheMetadata::new().set_ttl(Duration::default()/* use setters */);
3571 /// ```
3572 pub fn set_ttl<T>(mut self, v: T) -> Self
3573 where
3574 T: std::convert::Into<wkt::Duration>,
3575 {
3576 self.ttl = std::option::Option::Some(v.into());
3577 self
3578 }
3579
3580 /// Sets or clears the value of [ttl][crate::model::UpdateAnywhereCacheMetadata::ttl].
3581 ///
3582 /// # Example
3583 /// ```ignore,no_run
3584 /// # use google_cloud_storage::model::UpdateAnywhereCacheMetadata;
3585 /// use wkt::Duration;
3586 /// let x = UpdateAnywhereCacheMetadata::new().set_or_clear_ttl(Some(Duration::default()/* use setters */));
3587 /// let x = UpdateAnywhereCacheMetadata::new().set_or_clear_ttl(None::<Duration>);
3588 /// ```
3589 pub fn set_or_clear_ttl<T>(mut self, v: std::option::Option<T>) -> Self
3590 where
3591 T: std::convert::Into<wkt::Duration>,
3592 {
3593 self.ttl = v.map(|x| x.into());
3594 self
3595 }
3596
3597 /// Sets the value of [admission_policy][crate::model::UpdateAnywhereCacheMetadata::admission_policy].
3598 ///
3599 /// # Example
3600 /// ```ignore,no_run
3601 /// # use google_cloud_storage::model::UpdateAnywhereCacheMetadata;
3602 /// let x = UpdateAnywhereCacheMetadata::new().set_admission_policy("example");
3603 /// ```
3604 pub fn set_admission_policy<T>(mut self, v: T) -> Self
3605 where
3606 T: std::convert::Into<std::string::String>,
3607 {
3608 self.admission_policy = std::option::Option::Some(v.into());
3609 self
3610 }
3611
3612 /// Sets or clears the value of [admission_policy][crate::model::UpdateAnywhereCacheMetadata::admission_policy].
3613 ///
3614 /// # Example
3615 /// ```ignore,no_run
3616 /// # use google_cloud_storage::model::UpdateAnywhereCacheMetadata;
3617 /// let x = UpdateAnywhereCacheMetadata::new().set_or_clear_admission_policy(Some("example"));
3618 /// let x = UpdateAnywhereCacheMetadata::new().set_or_clear_admission_policy(None::<String>);
3619 /// ```
3620 pub fn set_or_clear_admission_policy<T>(mut self, v: std::option::Option<T>) -> Self
3621 where
3622 T: std::convert::Into<std::string::String>,
3623 {
3624 self.admission_policy = v.map(|x| x.into());
3625 self
3626 }
3627
3628 /// Sets the value of [ingest_on_write][crate::model::UpdateAnywhereCacheMetadata::ingest_on_write].
3629 ///
3630 /// # Example
3631 /// ```ignore,no_run
3632 /// # use google_cloud_storage::model::UpdateAnywhereCacheMetadata;
3633 /// let x = UpdateAnywhereCacheMetadata::new().set_ingest_on_write(true);
3634 /// ```
3635 pub fn set_ingest_on_write<T>(mut self, v: T) -> Self
3636 where
3637 T: std::convert::Into<bool>,
3638 {
3639 self.ingest_on_write = std::option::Option::Some(v.into());
3640 self
3641 }
3642
3643 /// Sets or clears the value of [ingest_on_write][crate::model::UpdateAnywhereCacheMetadata::ingest_on_write].
3644 ///
3645 /// # Example
3646 /// ```ignore,no_run
3647 /// # use google_cloud_storage::model::UpdateAnywhereCacheMetadata;
3648 /// let x = UpdateAnywhereCacheMetadata::new().set_or_clear_ingest_on_write(Some(false));
3649 /// let x = UpdateAnywhereCacheMetadata::new().set_or_clear_ingest_on_write(None::<bool>);
3650 /// ```
3651 pub fn set_or_clear_ingest_on_write<T>(mut self, v: std::option::Option<T>) -> Self
3652 where
3653 T: std::convert::Into<bool>,
3654 {
3655 self.ingest_on_write = v.map(|x| x.into());
3656 self
3657 }
3658}
3659
3660impl wkt::message::Message for UpdateAnywhereCacheMetadata {
3661 fn typename() -> &'static str {
3662 "type.googleapis.com/google.storage.control.v2.UpdateAnywhereCacheMetadata"
3663 }
3664}
3665
3666/// Message returned in the metadata field of the Operation resource for
3667/// UpdateRapidCache operation.
3668#[derive(Clone, Default, PartialEq)]
3669#[non_exhaustive]
3670pub struct UpdateRapidCacheMetadata {
3671 /// Generic metadata for the long running operation.
3672 pub common_metadata: std::option::Option<crate::model::CommonLongRunningOperationMetadata>,
3673
3674 /// Rapid Cache ID.
3675 pub rapid_cache_id: std::option::Option<std::string::String>,
3676
3677 /// The zone in which the cache instance is running. For example,
3678 /// us-central1-a.
3679 pub zone: std::option::Option<std::string::String>,
3680
3681 /// Rapid Cache entry's TTL between 1h and 7days. A cache-level config that
3682 /// is applied to all new cache entries on admission. If `ttl` is pending
3683 /// update, this field equals to the new value specified in the Update request.
3684 pub ttl: std::option::Option<wkt::Duration>,
3685
3686 /// Optional. Rapid Cache entry Admission Policy in kebab-case (e.g.,
3687 /// "admit-on-first-miss"). If `admission_policy` is pending
3688 /// update, this field equals to the new value specified in the Update request.
3689 pub admission_policy: std::option::Option<std::string::String>,
3690
3691 /// Specifies whether objects are ingested into the cache upon write. If not
3692 /// set, it defaults to false.
3693 pub ingest_on_write: std::option::Option<bool>,
3694
3695 /// Optional. The type of cache. Either rapid cache or rapid cache ultra.
3696 pub cache_type: std::option::Option<std::string::String>,
3697
3698 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3699}
3700
3701impl UpdateRapidCacheMetadata {
3702 /// Creates a new default instance.
3703 pub fn new() -> Self {
3704 std::default::Default::default()
3705 }
3706
3707 /// Sets the value of [common_metadata][crate::model::UpdateRapidCacheMetadata::common_metadata].
3708 ///
3709 /// # Example
3710 /// ```ignore,no_run
3711 /// # use google_cloud_storage::model::UpdateRapidCacheMetadata;
3712 /// use google_cloud_storage::model::CommonLongRunningOperationMetadata;
3713 /// let x = UpdateRapidCacheMetadata::new().set_common_metadata(CommonLongRunningOperationMetadata::default()/* use setters */);
3714 /// ```
3715 pub fn set_common_metadata<T>(mut self, v: T) -> Self
3716 where
3717 T: std::convert::Into<crate::model::CommonLongRunningOperationMetadata>,
3718 {
3719 self.common_metadata = std::option::Option::Some(v.into());
3720 self
3721 }
3722
3723 /// Sets or clears the value of [common_metadata][crate::model::UpdateRapidCacheMetadata::common_metadata].
3724 ///
3725 /// # Example
3726 /// ```ignore,no_run
3727 /// # use google_cloud_storage::model::UpdateRapidCacheMetadata;
3728 /// use google_cloud_storage::model::CommonLongRunningOperationMetadata;
3729 /// let x = UpdateRapidCacheMetadata::new().set_or_clear_common_metadata(Some(CommonLongRunningOperationMetadata::default()/* use setters */));
3730 /// let x = UpdateRapidCacheMetadata::new().set_or_clear_common_metadata(None::<CommonLongRunningOperationMetadata>);
3731 /// ```
3732 pub fn set_or_clear_common_metadata<T>(mut self, v: std::option::Option<T>) -> Self
3733 where
3734 T: std::convert::Into<crate::model::CommonLongRunningOperationMetadata>,
3735 {
3736 self.common_metadata = v.map(|x| x.into());
3737 self
3738 }
3739
3740 /// Sets the value of [rapid_cache_id][crate::model::UpdateRapidCacheMetadata::rapid_cache_id].
3741 ///
3742 /// # Example
3743 /// ```ignore,no_run
3744 /// # use google_cloud_storage::model::UpdateRapidCacheMetadata;
3745 /// let x = UpdateRapidCacheMetadata::new().set_rapid_cache_id("example");
3746 /// ```
3747 pub fn set_rapid_cache_id<T>(mut self, v: T) -> Self
3748 where
3749 T: std::convert::Into<std::string::String>,
3750 {
3751 self.rapid_cache_id = std::option::Option::Some(v.into());
3752 self
3753 }
3754
3755 /// Sets or clears the value of [rapid_cache_id][crate::model::UpdateRapidCacheMetadata::rapid_cache_id].
3756 ///
3757 /// # Example
3758 /// ```ignore,no_run
3759 /// # use google_cloud_storage::model::UpdateRapidCacheMetadata;
3760 /// let x = UpdateRapidCacheMetadata::new().set_or_clear_rapid_cache_id(Some("example"));
3761 /// let x = UpdateRapidCacheMetadata::new().set_or_clear_rapid_cache_id(None::<String>);
3762 /// ```
3763 pub fn set_or_clear_rapid_cache_id<T>(mut self, v: std::option::Option<T>) -> Self
3764 where
3765 T: std::convert::Into<std::string::String>,
3766 {
3767 self.rapid_cache_id = v.map(|x| x.into());
3768 self
3769 }
3770
3771 /// Sets the value of [zone][crate::model::UpdateRapidCacheMetadata::zone].
3772 ///
3773 /// # Example
3774 /// ```ignore,no_run
3775 /// # use google_cloud_storage::model::UpdateRapidCacheMetadata;
3776 /// let x = UpdateRapidCacheMetadata::new().set_zone("example");
3777 /// ```
3778 pub fn set_zone<T>(mut self, v: T) -> Self
3779 where
3780 T: std::convert::Into<std::string::String>,
3781 {
3782 self.zone = std::option::Option::Some(v.into());
3783 self
3784 }
3785
3786 /// Sets or clears the value of [zone][crate::model::UpdateRapidCacheMetadata::zone].
3787 ///
3788 /// # Example
3789 /// ```ignore,no_run
3790 /// # use google_cloud_storage::model::UpdateRapidCacheMetadata;
3791 /// let x = UpdateRapidCacheMetadata::new().set_or_clear_zone(Some("example"));
3792 /// let x = UpdateRapidCacheMetadata::new().set_or_clear_zone(None::<String>);
3793 /// ```
3794 pub fn set_or_clear_zone<T>(mut self, v: std::option::Option<T>) -> Self
3795 where
3796 T: std::convert::Into<std::string::String>,
3797 {
3798 self.zone = v.map(|x| x.into());
3799 self
3800 }
3801
3802 /// Sets the value of [ttl][crate::model::UpdateRapidCacheMetadata::ttl].
3803 ///
3804 /// # Example
3805 /// ```ignore,no_run
3806 /// # use google_cloud_storage::model::UpdateRapidCacheMetadata;
3807 /// use wkt::Duration;
3808 /// let x = UpdateRapidCacheMetadata::new().set_ttl(Duration::default()/* use setters */);
3809 /// ```
3810 pub fn set_ttl<T>(mut self, v: T) -> Self
3811 where
3812 T: std::convert::Into<wkt::Duration>,
3813 {
3814 self.ttl = std::option::Option::Some(v.into());
3815 self
3816 }
3817
3818 /// Sets or clears the value of [ttl][crate::model::UpdateRapidCacheMetadata::ttl].
3819 ///
3820 /// # Example
3821 /// ```ignore,no_run
3822 /// # use google_cloud_storage::model::UpdateRapidCacheMetadata;
3823 /// use wkt::Duration;
3824 /// let x = UpdateRapidCacheMetadata::new().set_or_clear_ttl(Some(Duration::default()/* use setters */));
3825 /// let x = UpdateRapidCacheMetadata::new().set_or_clear_ttl(None::<Duration>);
3826 /// ```
3827 pub fn set_or_clear_ttl<T>(mut self, v: std::option::Option<T>) -> Self
3828 where
3829 T: std::convert::Into<wkt::Duration>,
3830 {
3831 self.ttl = v.map(|x| x.into());
3832 self
3833 }
3834
3835 /// Sets the value of [admission_policy][crate::model::UpdateRapidCacheMetadata::admission_policy].
3836 ///
3837 /// # Example
3838 /// ```ignore,no_run
3839 /// # use google_cloud_storage::model::UpdateRapidCacheMetadata;
3840 /// let x = UpdateRapidCacheMetadata::new().set_admission_policy("example");
3841 /// ```
3842 pub fn set_admission_policy<T>(mut self, v: T) -> Self
3843 where
3844 T: std::convert::Into<std::string::String>,
3845 {
3846 self.admission_policy = std::option::Option::Some(v.into());
3847 self
3848 }
3849
3850 /// Sets or clears the value of [admission_policy][crate::model::UpdateRapidCacheMetadata::admission_policy].
3851 ///
3852 /// # Example
3853 /// ```ignore,no_run
3854 /// # use google_cloud_storage::model::UpdateRapidCacheMetadata;
3855 /// let x = UpdateRapidCacheMetadata::new().set_or_clear_admission_policy(Some("example"));
3856 /// let x = UpdateRapidCacheMetadata::new().set_or_clear_admission_policy(None::<String>);
3857 /// ```
3858 pub fn set_or_clear_admission_policy<T>(mut self, v: std::option::Option<T>) -> Self
3859 where
3860 T: std::convert::Into<std::string::String>,
3861 {
3862 self.admission_policy = v.map(|x| x.into());
3863 self
3864 }
3865
3866 /// Sets the value of [ingest_on_write][crate::model::UpdateRapidCacheMetadata::ingest_on_write].
3867 ///
3868 /// # Example
3869 /// ```ignore,no_run
3870 /// # use google_cloud_storage::model::UpdateRapidCacheMetadata;
3871 /// let x = UpdateRapidCacheMetadata::new().set_ingest_on_write(true);
3872 /// ```
3873 pub fn set_ingest_on_write<T>(mut self, v: T) -> Self
3874 where
3875 T: std::convert::Into<bool>,
3876 {
3877 self.ingest_on_write = std::option::Option::Some(v.into());
3878 self
3879 }
3880
3881 /// Sets or clears the value of [ingest_on_write][crate::model::UpdateRapidCacheMetadata::ingest_on_write].
3882 ///
3883 /// # Example
3884 /// ```ignore,no_run
3885 /// # use google_cloud_storage::model::UpdateRapidCacheMetadata;
3886 /// let x = UpdateRapidCacheMetadata::new().set_or_clear_ingest_on_write(Some(false));
3887 /// let x = UpdateRapidCacheMetadata::new().set_or_clear_ingest_on_write(None::<bool>);
3888 /// ```
3889 pub fn set_or_clear_ingest_on_write<T>(mut self, v: std::option::Option<T>) -> Self
3890 where
3891 T: std::convert::Into<bool>,
3892 {
3893 self.ingest_on_write = v.map(|x| x.into());
3894 self
3895 }
3896
3897 /// Sets the value of [cache_type][crate::model::UpdateRapidCacheMetadata::cache_type].
3898 ///
3899 /// # Example
3900 /// ```ignore,no_run
3901 /// # use google_cloud_storage::model::UpdateRapidCacheMetadata;
3902 /// let x = UpdateRapidCacheMetadata::new().set_cache_type("example");
3903 /// ```
3904 pub fn set_cache_type<T>(mut self, v: T) -> Self
3905 where
3906 T: std::convert::Into<std::string::String>,
3907 {
3908 self.cache_type = std::option::Option::Some(v.into());
3909 self
3910 }
3911
3912 /// Sets or clears the value of [cache_type][crate::model::UpdateRapidCacheMetadata::cache_type].
3913 ///
3914 /// # Example
3915 /// ```ignore,no_run
3916 /// # use google_cloud_storage::model::UpdateRapidCacheMetadata;
3917 /// let x = UpdateRapidCacheMetadata::new().set_or_clear_cache_type(Some("example"));
3918 /// let x = UpdateRapidCacheMetadata::new().set_or_clear_cache_type(None::<String>);
3919 /// ```
3920 pub fn set_or_clear_cache_type<T>(mut self, v: std::option::Option<T>) -> Self
3921 where
3922 T: std::convert::Into<std::string::String>,
3923 {
3924 self.cache_type = v.map(|x| x.into());
3925 self
3926 }
3927}
3928
3929impl wkt::message::Message for UpdateRapidCacheMetadata {
3930 fn typename() -> &'static str {
3931 "type.googleapis.com/google.storage.control.v2.UpdateRapidCacheMetadata"
3932 }
3933}
3934
3935/// An Anywhere Cache Instance.
3936#[derive(Clone, Default, PartialEq)]
3937#[non_exhaustive]
3938pub struct AnywhereCache {
3939 /// Immutable. The resource name of this AnywhereCache.
3940 /// Format:
3941 /// `projects/{project}/buckets/{bucket}/anywhereCaches/{anywhere_cache}`
3942 pub name: std::string::String,
3943
3944 /// Immutable. The zone in which the cache instance is running. For example,
3945 /// us-central1-a.
3946 pub zone: std::string::String,
3947
3948 /// Cache entry TTL (ranges between 1h to 7d). This is a cache-level config
3949 /// that defines how long a cache entry can live. Default ttl value (24hrs)
3950 /// is applied if not specified in the create request. TTL must be in whole
3951 /// seconds.
3952 pub ttl: std::option::Option<wkt::Duration>,
3953
3954 /// Cache admission policy. Valid policies includes:
3955 /// `admit-on-first-miss` and `admit-on-second-miss`. Defaults to
3956 /// `admit-on-first-miss`. Default value is applied if not specified in the
3957 /// create request.
3958 pub admission_policy: std::string::String,
3959
3960 /// Output only. Cache state including `running`, `creating`, `disabled` and
3961 /// `paused`.
3962 pub state: std::string::String,
3963
3964 /// Output only. Time when Anywhere cache instance is allocated.
3965 pub create_time: std::option::Option<wkt::Timestamp>,
3966
3967 /// Output only. Time when Anywhere cache instance is last updated, including
3968 /// creation.
3969 pub update_time: std::option::Option<wkt::Timestamp>,
3970
3971 /// Output only. True if there is an active update operation against this cache
3972 /// instance. Subsequential update requests will be rejected if this field is
3973 /// true. Output only.
3974 pub pending_update: bool,
3975
3976 /// Optional. Specifies whether objects are ingested into the cache upon write.
3977 /// Defaults to false.
3978 pub ingest_on_write: std::option::Option<bool>,
3979
3980 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3981}
3982
3983impl AnywhereCache {
3984 /// Creates a new default instance.
3985 pub fn new() -> Self {
3986 std::default::Default::default()
3987 }
3988
3989 /// Sets the value of [name][crate::model::AnywhereCache::name].
3990 ///
3991 /// # Example
3992 /// ```ignore,no_run
3993 /// # use google_cloud_storage::model::AnywhereCache;
3994 /// # let project_id = "project_id";
3995 /// # let bucket_id = "bucket_id";
3996 /// # let anywhere_cache_id = "anywhere_cache_id";
3997 /// let x = AnywhereCache::new().set_name(format!("projects/{project_id}/buckets/{bucket_id}/anywhereCaches/{anywhere_cache_id}"));
3998 /// ```
3999 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4000 self.name = v.into();
4001 self
4002 }
4003
4004 /// Sets the value of [zone][crate::model::AnywhereCache::zone].
4005 ///
4006 /// # Example
4007 /// ```ignore,no_run
4008 /// # use google_cloud_storage::model::AnywhereCache;
4009 /// let x = AnywhereCache::new().set_zone("example");
4010 /// ```
4011 pub fn set_zone<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4012 self.zone = v.into();
4013 self
4014 }
4015
4016 /// Sets the value of [ttl][crate::model::AnywhereCache::ttl].
4017 ///
4018 /// # Example
4019 /// ```ignore,no_run
4020 /// # use google_cloud_storage::model::AnywhereCache;
4021 /// use wkt::Duration;
4022 /// let x = AnywhereCache::new().set_ttl(Duration::default()/* use setters */);
4023 /// ```
4024 pub fn set_ttl<T>(mut self, v: T) -> Self
4025 where
4026 T: std::convert::Into<wkt::Duration>,
4027 {
4028 self.ttl = std::option::Option::Some(v.into());
4029 self
4030 }
4031
4032 /// Sets or clears the value of [ttl][crate::model::AnywhereCache::ttl].
4033 ///
4034 /// # Example
4035 /// ```ignore,no_run
4036 /// # use google_cloud_storage::model::AnywhereCache;
4037 /// use wkt::Duration;
4038 /// let x = AnywhereCache::new().set_or_clear_ttl(Some(Duration::default()/* use setters */));
4039 /// let x = AnywhereCache::new().set_or_clear_ttl(None::<Duration>);
4040 /// ```
4041 pub fn set_or_clear_ttl<T>(mut self, v: std::option::Option<T>) -> Self
4042 where
4043 T: std::convert::Into<wkt::Duration>,
4044 {
4045 self.ttl = v.map(|x| x.into());
4046 self
4047 }
4048
4049 /// Sets the value of [admission_policy][crate::model::AnywhereCache::admission_policy].
4050 ///
4051 /// # Example
4052 /// ```ignore,no_run
4053 /// # use google_cloud_storage::model::AnywhereCache;
4054 /// let x = AnywhereCache::new().set_admission_policy("example");
4055 /// ```
4056 pub fn set_admission_policy<T: std::convert::Into<std::string::String>>(
4057 mut self,
4058 v: T,
4059 ) -> Self {
4060 self.admission_policy = v.into();
4061 self
4062 }
4063
4064 /// Sets the value of [state][crate::model::AnywhereCache::state].
4065 ///
4066 /// # Example
4067 /// ```ignore,no_run
4068 /// # use google_cloud_storage::model::AnywhereCache;
4069 /// let x = AnywhereCache::new().set_state("example");
4070 /// ```
4071 pub fn set_state<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4072 self.state = v.into();
4073 self
4074 }
4075
4076 /// Sets the value of [create_time][crate::model::AnywhereCache::create_time].
4077 ///
4078 /// # Example
4079 /// ```ignore,no_run
4080 /// # use google_cloud_storage::model::AnywhereCache;
4081 /// use wkt::Timestamp;
4082 /// let x = AnywhereCache::new().set_create_time(Timestamp::default()/* use setters */);
4083 /// ```
4084 pub fn set_create_time<T>(mut self, v: T) -> Self
4085 where
4086 T: std::convert::Into<wkt::Timestamp>,
4087 {
4088 self.create_time = std::option::Option::Some(v.into());
4089 self
4090 }
4091
4092 /// Sets or clears the value of [create_time][crate::model::AnywhereCache::create_time].
4093 ///
4094 /// # Example
4095 /// ```ignore,no_run
4096 /// # use google_cloud_storage::model::AnywhereCache;
4097 /// use wkt::Timestamp;
4098 /// let x = AnywhereCache::new().set_or_clear_create_time(Some(Timestamp::default()/* use setters */));
4099 /// let x = AnywhereCache::new().set_or_clear_create_time(None::<Timestamp>);
4100 /// ```
4101 pub fn set_or_clear_create_time<T>(mut self, v: std::option::Option<T>) -> Self
4102 where
4103 T: std::convert::Into<wkt::Timestamp>,
4104 {
4105 self.create_time = v.map(|x| x.into());
4106 self
4107 }
4108
4109 /// Sets the value of [update_time][crate::model::AnywhereCache::update_time].
4110 ///
4111 /// # Example
4112 /// ```ignore,no_run
4113 /// # use google_cloud_storage::model::AnywhereCache;
4114 /// use wkt::Timestamp;
4115 /// let x = AnywhereCache::new().set_update_time(Timestamp::default()/* use setters */);
4116 /// ```
4117 pub fn set_update_time<T>(mut self, v: T) -> Self
4118 where
4119 T: std::convert::Into<wkt::Timestamp>,
4120 {
4121 self.update_time = std::option::Option::Some(v.into());
4122 self
4123 }
4124
4125 /// Sets or clears the value of [update_time][crate::model::AnywhereCache::update_time].
4126 ///
4127 /// # Example
4128 /// ```ignore,no_run
4129 /// # use google_cloud_storage::model::AnywhereCache;
4130 /// use wkt::Timestamp;
4131 /// let x = AnywhereCache::new().set_or_clear_update_time(Some(Timestamp::default()/* use setters */));
4132 /// let x = AnywhereCache::new().set_or_clear_update_time(None::<Timestamp>);
4133 /// ```
4134 pub fn set_or_clear_update_time<T>(mut self, v: std::option::Option<T>) -> Self
4135 where
4136 T: std::convert::Into<wkt::Timestamp>,
4137 {
4138 self.update_time = v.map(|x| x.into());
4139 self
4140 }
4141
4142 /// Sets the value of [pending_update][crate::model::AnywhereCache::pending_update].
4143 ///
4144 /// # Example
4145 /// ```ignore,no_run
4146 /// # use google_cloud_storage::model::AnywhereCache;
4147 /// let x = AnywhereCache::new().set_pending_update(true);
4148 /// ```
4149 pub fn set_pending_update<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
4150 self.pending_update = v.into();
4151 self
4152 }
4153
4154 /// Sets the value of [ingest_on_write][crate::model::AnywhereCache::ingest_on_write].
4155 ///
4156 /// # Example
4157 /// ```ignore,no_run
4158 /// # use google_cloud_storage::model::AnywhereCache;
4159 /// let x = AnywhereCache::new().set_ingest_on_write(true);
4160 /// ```
4161 pub fn set_ingest_on_write<T>(mut self, v: T) -> Self
4162 where
4163 T: std::convert::Into<bool>,
4164 {
4165 self.ingest_on_write = std::option::Option::Some(v.into());
4166 self
4167 }
4168
4169 /// Sets or clears the value of [ingest_on_write][crate::model::AnywhereCache::ingest_on_write].
4170 ///
4171 /// # Example
4172 /// ```ignore,no_run
4173 /// # use google_cloud_storage::model::AnywhereCache;
4174 /// let x = AnywhereCache::new().set_or_clear_ingest_on_write(Some(false));
4175 /// let x = AnywhereCache::new().set_or_clear_ingest_on_write(None::<bool>);
4176 /// ```
4177 pub fn set_or_clear_ingest_on_write<T>(mut self, v: std::option::Option<T>) -> Self
4178 where
4179 T: std::convert::Into<bool>,
4180 {
4181 self.ingest_on_write = v.map(|x| x.into());
4182 self
4183 }
4184}
4185
4186impl wkt::message::Message for AnywhereCache {
4187 fn typename() -> &'static str {
4188 "type.googleapis.com/google.storage.control.v2.AnywhereCache"
4189 }
4190}
4191
4192/// Request message for CreateAnywhereCache.
4193#[derive(Clone, Default, PartialEq)]
4194#[non_exhaustive]
4195pub struct CreateAnywhereCacheRequest {
4196 /// Required. The bucket to which this cache belongs.
4197 /// Format: `projects/{project}/buckets/{bucket}`
4198 pub parent: std::string::String,
4199
4200 /// Required. Properties of the Anywhere Cache instance being created.
4201 /// The parent bucket name is specified in the `parent` field. Server uses the
4202 /// default value of `ttl` or `admission_policy` if not specified in
4203 /// request.
4204 pub anywhere_cache: std::option::Option<crate::model::AnywhereCache>,
4205
4206 /// Optional. A unique identifier for this request. UUID is the recommended
4207 /// format, but other formats are still accepted. This request is only
4208 /// idempotent if a `request_id` is provided.
4209 pub request_id: std::string::String,
4210
4211 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4212}
4213
4214impl CreateAnywhereCacheRequest {
4215 /// Creates a new default instance.
4216 pub fn new() -> Self {
4217 std::default::Default::default()
4218 }
4219
4220 /// Sets the value of [parent][crate::model::CreateAnywhereCacheRequest::parent].
4221 ///
4222 /// # Example
4223 /// ```ignore,no_run
4224 /// # use google_cloud_storage::model::CreateAnywhereCacheRequest;
4225 /// # let project_id = "project_id";
4226 /// # let bucket_id = "bucket_id";
4227 /// let x = CreateAnywhereCacheRequest::new().set_parent(format!("projects/{project_id}/buckets/{bucket_id}"));
4228 /// ```
4229 pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4230 self.parent = v.into();
4231 self
4232 }
4233
4234 /// Sets the value of [anywhere_cache][crate::model::CreateAnywhereCacheRequest::anywhere_cache].
4235 ///
4236 /// # Example
4237 /// ```ignore,no_run
4238 /// # use google_cloud_storage::model::CreateAnywhereCacheRequest;
4239 /// use google_cloud_storage::model::AnywhereCache;
4240 /// let x = CreateAnywhereCacheRequest::new().set_anywhere_cache(AnywhereCache::default()/* use setters */);
4241 /// ```
4242 pub fn set_anywhere_cache<T>(mut self, v: T) -> Self
4243 where
4244 T: std::convert::Into<crate::model::AnywhereCache>,
4245 {
4246 self.anywhere_cache = std::option::Option::Some(v.into());
4247 self
4248 }
4249
4250 /// Sets or clears the value of [anywhere_cache][crate::model::CreateAnywhereCacheRequest::anywhere_cache].
4251 ///
4252 /// # Example
4253 /// ```ignore,no_run
4254 /// # use google_cloud_storage::model::CreateAnywhereCacheRequest;
4255 /// use google_cloud_storage::model::AnywhereCache;
4256 /// let x = CreateAnywhereCacheRequest::new().set_or_clear_anywhere_cache(Some(AnywhereCache::default()/* use setters */));
4257 /// let x = CreateAnywhereCacheRequest::new().set_or_clear_anywhere_cache(None::<AnywhereCache>);
4258 /// ```
4259 pub fn set_or_clear_anywhere_cache<T>(mut self, v: std::option::Option<T>) -> Self
4260 where
4261 T: std::convert::Into<crate::model::AnywhereCache>,
4262 {
4263 self.anywhere_cache = v.map(|x| x.into());
4264 self
4265 }
4266
4267 /// Sets the value of [request_id][crate::model::CreateAnywhereCacheRequest::request_id].
4268 ///
4269 /// # Example
4270 /// ```ignore,no_run
4271 /// # use google_cloud_storage::model::CreateAnywhereCacheRequest;
4272 /// let x = CreateAnywhereCacheRequest::new().set_request_id("example");
4273 /// ```
4274 pub fn set_request_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4275 self.request_id = v.into();
4276 self
4277 }
4278}
4279
4280impl wkt::message::Message for CreateAnywhereCacheRequest {
4281 fn typename() -> &'static str {
4282 "type.googleapis.com/google.storage.control.v2.CreateAnywhereCacheRequest"
4283 }
4284}
4285
4286/// Request message for UpdateAnywhereCache.
4287#[derive(Clone, Default, PartialEq)]
4288#[non_exhaustive]
4289pub struct UpdateAnywhereCacheRequest {
4290 /// Required. The Anywhere Cache instance to be updated.
4291 pub anywhere_cache: std::option::Option<crate::model::AnywhereCache>,
4292
4293 /// Required. List of fields to be updated. Mutable fields of AnywhereCache
4294 /// include `ttl` and `admission_policy`.
4295 ///
4296 /// To specify ALL fields, specify a single field with the value `*`. Note: We
4297 /// recommend against doing this. If a new field is introduced at a later time,
4298 /// an older client updating with the `*` may accidentally reset the new
4299 /// field's value.
4300 ///
4301 /// Not specifying any fields is an error.
4302 pub update_mask: std::option::Option<wkt::FieldMask>,
4303
4304 /// Optional. A unique identifier for this request. UUID is the recommended
4305 /// format, but other formats are still accepted. This request is only
4306 /// idempotent if a `request_id` is provided.
4307 pub request_id: std::string::String,
4308
4309 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4310}
4311
4312impl UpdateAnywhereCacheRequest {
4313 /// Creates a new default instance.
4314 pub fn new() -> Self {
4315 std::default::Default::default()
4316 }
4317
4318 /// Sets the value of [anywhere_cache][crate::model::UpdateAnywhereCacheRequest::anywhere_cache].
4319 ///
4320 /// # Example
4321 /// ```ignore,no_run
4322 /// # use google_cloud_storage::model::UpdateAnywhereCacheRequest;
4323 /// use google_cloud_storage::model::AnywhereCache;
4324 /// let x = UpdateAnywhereCacheRequest::new().set_anywhere_cache(AnywhereCache::default()/* use setters */);
4325 /// ```
4326 pub fn set_anywhere_cache<T>(mut self, v: T) -> Self
4327 where
4328 T: std::convert::Into<crate::model::AnywhereCache>,
4329 {
4330 self.anywhere_cache = std::option::Option::Some(v.into());
4331 self
4332 }
4333
4334 /// Sets or clears the value of [anywhere_cache][crate::model::UpdateAnywhereCacheRequest::anywhere_cache].
4335 ///
4336 /// # Example
4337 /// ```ignore,no_run
4338 /// # use google_cloud_storage::model::UpdateAnywhereCacheRequest;
4339 /// use google_cloud_storage::model::AnywhereCache;
4340 /// let x = UpdateAnywhereCacheRequest::new().set_or_clear_anywhere_cache(Some(AnywhereCache::default()/* use setters */));
4341 /// let x = UpdateAnywhereCacheRequest::new().set_or_clear_anywhere_cache(None::<AnywhereCache>);
4342 /// ```
4343 pub fn set_or_clear_anywhere_cache<T>(mut self, v: std::option::Option<T>) -> Self
4344 where
4345 T: std::convert::Into<crate::model::AnywhereCache>,
4346 {
4347 self.anywhere_cache = v.map(|x| x.into());
4348 self
4349 }
4350
4351 /// Sets the value of [update_mask][crate::model::UpdateAnywhereCacheRequest::update_mask].
4352 ///
4353 /// # Example
4354 /// ```ignore,no_run
4355 /// # use google_cloud_storage::model::UpdateAnywhereCacheRequest;
4356 /// use wkt::FieldMask;
4357 /// let x = UpdateAnywhereCacheRequest::new().set_update_mask(FieldMask::default()/* use setters */);
4358 /// ```
4359 pub fn set_update_mask<T>(mut self, v: T) -> Self
4360 where
4361 T: std::convert::Into<wkt::FieldMask>,
4362 {
4363 self.update_mask = std::option::Option::Some(v.into());
4364 self
4365 }
4366
4367 /// Sets or clears the value of [update_mask][crate::model::UpdateAnywhereCacheRequest::update_mask].
4368 ///
4369 /// # Example
4370 /// ```ignore,no_run
4371 /// # use google_cloud_storage::model::UpdateAnywhereCacheRequest;
4372 /// use wkt::FieldMask;
4373 /// let x = UpdateAnywhereCacheRequest::new().set_or_clear_update_mask(Some(FieldMask::default()/* use setters */));
4374 /// let x = UpdateAnywhereCacheRequest::new().set_or_clear_update_mask(None::<FieldMask>);
4375 /// ```
4376 pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
4377 where
4378 T: std::convert::Into<wkt::FieldMask>,
4379 {
4380 self.update_mask = v.map(|x| x.into());
4381 self
4382 }
4383
4384 /// Sets the value of [request_id][crate::model::UpdateAnywhereCacheRequest::request_id].
4385 ///
4386 /// # Example
4387 /// ```ignore,no_run
4388 /// # use google_cloud_storage::model::UpdateAnywhereCacheRequest;
4389 /// let x = UpdateAnywhereCacheRequest::new().set_request_id("example");
4390 /// ```
4391 pub fn set_request_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4392 self.request_id = v.into();
4393 self
4394 }
4395}
4396
4397impl wkt::message::Message for UpdateAnywhereCacheRequest {
4398 fn typename() -> &'static str {
4399 "type.googleapis.com/google.storage.control.v2.UpdateAnywhereCacheRequest"
4400 }
4401}
4402
4403/// Request message for DisableAnywhereCache.
4404#[derive(Clone, Default, PartialEq)]
4405#[non_exhaustive]
4406pub struct DisableAnywhereCacheRequest {
4407 /// Required. The name field in the request should be:
4408 /// `projects/{project}/buckets/{bucket}/anywhereCaches/{anywhere_cache}`
4409 pub name: std::string::String,
4410
4411 /// Optional. A unique identifier for this request. UUID is the recommended
4412 /// format, but other formats are still accepted. This request is only
4413 /// idempotent if a `request_id` is provided.
4414 pub request_id: std::string::String,
4415
4416 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4417}
4418
4419impl DisableAnywhereCacheRequest {
4420 /// Creates a new default instance.
4421 pub fn new() -> Self {
4422 std::default::Default::default()
4423 }
4424
4425 /// Sets the value of [name][crate::model::DisableAnywhereCacheRequest::name].
4426 ///
4427 /// # Example
4428 /// ```ignore,no_run
4429 /// # use google_cloud_storage::model::DisableAnywhereCacheRequest;
4430 /// # let project_id = "project_id";
4431 /// # let bucket_id = "bucket_id";
4432 /// # let anywhere_cache_id = "anywhere_cache_id";
4433 /// let x = DisableAnywhereCacheRequest::new().set_name(format!("projects/{project_id}/buckets/{bucket_id}/anywhereCaches/{anywhere_cache_id}"));
4434 /// ```
4435 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4436 self.name = v.into();
4437 self
4438 }
4439
4440 /// Sets the value of [request_id][crate::model::DisableAnywhereCacheRequest::request_id].
4441 ///
4442 /// # Example
4443 /// ```ignore,no_run
4444 /// # use google_cloud_storage::model::DisableAnywhereCacheRequest;
4445 /// let x = DisableAnywhereCacheRequest::new().set_request_id("example");
4446 /// ```
4447 pub fn set_request_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4448 self.request_id = v.into();
4449 self
4450 }
4451}
4452
4453impl wkt::message::Message for DisableAnywhereCacheRequest {
4454 fn typename() -> &'static str {
4455 "type.googleapis.com/google.storage.control.v2.DisableAnywhereCacheRequest"
4456 }
4457}
4458
4459/// Request message for PauseAnywhereCache.
4460#[derive(Clone, Default, PartialEq)]
4461#[non_exhaustive]
4462pub struct PauseAnywhereCacheRequest {
4463 /// Required. The name field in the request should be:
4464 /// `projects/{project}/buckets/{bucket}/anywhereCaches/{anywhere_cache}`
4465 pub name: std::string::String,
4466
4467 /// Optional. A unique identifier for this request. UUID is the recommended
4468 /// format, but other formats are still accepted. This request is only
4469 /// idempotent if a `request_id` is provided.
4470 pub request_id: std::string::String,
4471
4472 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4473}
4474
4475impl PauseAnywhereCacheRequest {
4476 /// Creates a new default instance.
4477 pub fn new() -> Self {
4478 std::default::Default::default()
4479 }
4480
4481 /// Sets the value of [name][crate::model::PauseAnywhereCacheRequest::name].
4482 ///
4483 /// # Example
4484 /// ```ignore,no_run
4485 /// # use google_cloud_storage::model::PauseAnywhereCacheRequest;
4486 /// # let project_id = "project_id";
4487 /// # let bucket_id = "bucket_id";
4488 /// # let anywhere_cache_id = "anywhere_cache_id";
4489 /// let x = PauseAnywhereCacheRequest::new().set_name(format!("projects/{project_id}/buckets/{bucket_id}/anywhereCaches/{anywhere_cache_id}"));
4490 /// ```
4491 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4492 self.name = v.into();
4493 self
4494 }
4495
4496 /// Sets the value of [request_id][crate::model::PauseAnywhereCacheRequest::request_id].
4497 ///
4498 /// # Example
4499 /// ```ignore,no_run
4500 /// # use google_cloud_storage::model::PauseAnywhereCacheRequest;
4501 /// let x = PauseAnywhereCacheRequest::new().set_request_id("example");
4502 /// ```
4503 pub fn set_request_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4504 self.request_id = v.into();
4505 self
4506 }
4507}
4508
4509impl wkt::message::Message for PauseAnywhereCacheRequest {
4510 fn typename() -> &'static str {
4511 "type.googleapis.com/google.storage.control.v2.PauseAnywhereCacheRequest"
4512 }
4513}
4514
4515/// Request message for ResumeAnywhereCache.
4516#[derive(Clone, Default, PartialEq)]
4517#[non_exhaustive]
4518pub struct ResumeAnywhereCacheRequest {
4519 /// Required. The name field in the request should be:
4520 /// `projects/{project}/buckets/{bucket}/anywhereCaches/{anywhere_cache}`
4521 pub name: std::string::String,
4522
4523 /// Optional. A unique identifier for this request. UUID is the recommended
4524 /// format, but other formats are still accepted. This request is only
4525 /// idempotent if a `request_id` is provided.
4526 pub request_id: std::string::String,
4527
4528 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4529}
4530
4531impl ResumeAnywhereCacheRequest {
4532 /// Creates a new default instance.
4533 pub fn new() -> Self {
4534 std::default::Default::default()
4535 }
4536
4537 /// Sets the value of [name][crate::model::ResumeAnywhereCacheRequest::name].
4538 ///
4539 /// # Example
4540 /// ```ignore,no_run
4541 /// # use google_cloud_storage::model::ResumeAnywhereCacheRequest;
4542 /// # let project_id = "project_id";
4543 /// # let bucket_id = "bucket_id";
4544 /// # let anywhere_cache_id = "anywhere_cache_id";
4545 /// let x = ResumeAnywhereCacheRequest::new().set_name(format!("projects/{project_id}/buckets/{bucket_id}/anywhereCaches/{anywhere_cache_id}"));
4546 /// ```
4547 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4548 self.name = v.into();
4549 self
4550 }
4551
4552 /// Sets the value of [request_id][crate::model::ResumeAnywhereCacheRequest::request_id].
4553 ///
4554 /// # Example
4555 /// ```ignore,no_run
4556 /// # use google_cloud_storage::model::ResumeAnywhereCacheRequest;
4557 /// let x = ResumeAnywhereCacheRequest::new().set_request_id("example");
4558 /// ```
4559 pub fn set_request_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4560 self.request_id = v.into();
4561 self
4562 }
4563}
4564
4565impl wkt::message::Message for ResumeAnywhereCacheRequest {
4566 fn typename() -> &'static str {
4567 "type.googleapis.com/google.storage.control.v2.ResumeAnywhereCacheRequest"
4568 }
4569}
4570
4571/// Request message for GetAnywhereCache.
4572#[derive(Clone, Default, PartialEq)]
4573#[non_exhaustive]
4574pub struct GetAnywhereCacheRequest {
4575 /// Required. The name field in the request should be:
4576 /// `projects/{project}/buckets/{bucket}/anywhereCaches/{anywhere_cache}`
4577 pub name: std::string::String,
4578
4579 /// Optional. A unique identifier for this request. UUID is the recommended
4580 /// format, but other formats are still accepted.
4581 pub request_id: std::string::String,
4582
4583 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4584}
4585
4586impl GetAnywhereCacheRequest {
4587 /// Creates a new default instance.
4588 pub fn new() -> Self {
4589 std::default::Default::default()
4590 }
4591
4592 /// Sets the value of [name][crate::model::GetAnywhereCacheRequest::name].
4593 ///
4594 /// # Example
4595 /// ```ignore,no_run
4596 /// # use google_cloud_storage::model::GetAnywhereCacheRequest;
4597 /// # let project_id = "project_id";
4598 /// # let bucket_id = "bucket_id";
4599 /// # let anywhere_cache_id = "anywhere_cache_id";
4600 /// let x = GetAnywhereCacheRequest::new().set_name(format!("projects/{project_id}/buckets/{bucket_id}/anywhereCaches/{anywhere_cache_id}"));
4601 /// ```
4602 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4603 self.name = v.into();
4604 self
4605 }
4606
4607 /// Sets the value of [request_id][crate::model::GetAnywhereCacheRequest::request_id].
4608 ///
4609 /// # Example
4610 /// ```ignore,no_run
4611 /// # use google_cloud_storage::model::GetAnywhereCacheRequest;
4612 /// let x = GetAnywhereCacheRequest::new().set_request_id("example");
4613 /// ```
4614 pub fn set_request_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4615 self.request_id = v.into();
4616 self
4617 }
4618}
4619
4620impl wkt::message::Message for GetAnywhereCacheRequest {
4621 fn typename() -> &'static str {
4622 "type.googleapis.com/google.storage.control.v2.GetAnywhereCacheRequest"
4623 }
4624}
4625
4626/// Request message for ListAnywhereCaches.
4627#[derive(Clone, Default, PartialEq)]
4628#[non_exhaustive]
4629pub struct ListAnywhereCachesRequest {
4630 /// Required. The bucket to which this cache belongs.
4631 pub parent: std::string::String,
4632
4633 /// Maximum number of caches to return in a single response.
4634 /// The service will use this parameter or 1,000 items, whichever is smaller.
4635 pub page_size: i32,
4636
4637 /// A previously-returned page token representing part of the larger set of
4638 /// results to view.
4639 pub page_token: std::string::String,
4640
4641 /// Optional. A unique identifier for this request. UUID is the recommended
4642 /// format, but other formats are still accepted.
4643 pub request_id: std::string::String,
4644
4645 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4646}
4647
4648impl ListAnywhereCachesRequest {
4649 /// Creates a new default instance.
4650 pub fn new() -> Self {
4651 std::default::Default::default()
4652 }
4653
4654 /// Sets the value of [parent][crate::model::ListAnywhereCachesRequest::parent].
4655 ///
4656 /// # Example
4657 /// ```ignore,no_run
4658 /// # use google_cloud_storage::model::ListAnywhereCachesRequest;
4659 /// # let project_id = "project_id";
4660 /// # let bucket_id = "bucket_id";
4661 /// let x = ListAnywhereCachesRequest::new().set_parent(format!("projects/{project_id}/buckets/{bucket_id}"));
4662 /// ```
4663 pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4664 self.parent = v.into();
4665 self
4666 }
4667
4668 /// Sets the value of [page_size][crate::model::ListAnywhereCachesRequest::page_size].
4669 ///
4670 /// # Example
4671 /// ```ignore,no_run
4672 /// # use google_cloud_storage::model::ListAnywhereCachesRequest;
4673 /// let x = ListAnywhereCachesRequest::new().set_page_size(42);
4674 /// ```
4675 pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
4676 self.page_size = v.into();
4677 self
4678 }
4679
4680 /// Sets the value of [page_token][crate::model::ListAnywhereCachesRequest::page_token].
4681 ///
4682 /// # Example
4683 /// ```ignore,no_run
4684 /// # use google_cloud_storage::model::ListAnywhereCachesRequest;
4685 /// let x = ListAnywhereCachesRequest::new().set_page_token("example");
4686 /// ```
4687 pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4688 self.page_token = v.into();
4689 self
4690 }
4691
4692 /// Sets the value of [request_id][crate::model::ListAnywhereCachesRequest::request_id].
4693 ///
4694 /// # Example
4695 /// ```ignore,no_run
4696 /// # use google_cloud_storage::model::ListAnywhereCachesRequest;
4697 /// let x = ListAnywhereCachesRequest::new().set_request_id("example");
4698 /// ```
4699 pub fn set_request_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4700 self.request_id = v.into();
4701 self
4702 }
4703}
4704
4705impl wkt::message::Message for ListAnywhereCachesRequest {
4706 fn typename() -> &'static str {
4707 "type.googleapis.com/google.storage.control.v2.ListAnywhereCachesRequest"
4708 }
4709}
4710
4711/// Response message for ListAnywhereCaches.
4712#[derive(Clone, Default, PartialEq)]
4713#[non_exhaustive]
4714pub struct ListAnywhereCachesResponse {
4715 /// The list of items.
4716 pub anywhere_caches: std::vec::Vec<crate::model::AnywhereCache>,
4717
4718 /// A token, which can be sent as `page_token` to retrieve the next page.
4719 /// If this field is omitted, there are no subsequent pages.
4720 pub next_page_token: std::string::String,
4721
4722 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4723}
4724
4725impl ListAnywhereCachesResponse {
4726 /// Creates a new default instance.
4727 pub fn new() -> Self {
4728 std::default::Default::default()
4729 }
4730
4731 /// Sets the value of [anywhere_caches][crate::model::ListAnywhereCachesResponse::anywhere_caches].
4732 ///
4733 /// # Example
4734 /// ```ignore,no_run
4735 /// # use google_cloud_storage::model::ListAnywhereCachesResponse;
4736 /// use google_cloud_storage::model::AnywhereCache;
4737 /// let x = ListAnywhereCachesResponse::new()
4738 /// .set_anywhere_caches([
4739 /// AnywhereCache::default()/* use setters */,
4740 /// AnywhereCache::default()/* use (different) setters */,
4741 /// ]);
4742 /// ```
4743 pub fn set_anywhere_caches<T, V>(mut self, v: T) -> Self
4744 where
4745 T: std::iter::IntoIterator<Item = V>,
4746 V: std::convert::Into<crate::model::AnywhereCache>,
4747 {
4748 use std::iter::Iterator;
4749 self.anywhere_caches = v.into_iter().map(|i| i.into()).collect();
4750 self
4751 }
4752
4753 /// Sets the value of [next_page_token][crate::model::ListAnywhereCachesResponse::next_page_token].
4754 ///
4755 /// # Example
4756 /// ```ignore,no_run
4757 /// # use google_cloud_storage::model::ListAnywhereCachesResponse;
4758 /// let x = ListAnywhereCachesResponse::new().set_next_page_token("example");
4759 /// ```
4760 pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4761 self.next_page_token = v.into();
4762 self
4763 }
4764}
4765
4766impl wkt::message::Message for ListAnywhereCachesResponse {
4767 fn typename() -> &'static str {
4768 "type.googleapis.com/google.storage.control.v2.ListAnywhereCachesResponse"
4769 }
4770}
4771
4772#[doc(hidden)]
4773impl google_cloud_gax::paginator::internal::PageableResponse for ListAnywhereCachesResponse {
4774 type PageItem = crate::model::AnywhereCache;
4775
4776 fn items(self) -> std::vec::Vec<Self::PageItem> {
4777 self.anywhere_caches
4778 }
4779
4780 fn next_page_token(&self) -> std::string::String {
4781 use std::clone::Clone;
4782 self.next_page_token.clone()
4783 }
4784}
4785
4786/// A Rapid Cache Instance.
4787#[derive(Clone, Default, PartialEq)]
4788#[non_exhaustive]
4789pub struct RapidCache {
4790 /// Immutable. The resource name of this RapidCache.
4791 /// Format:
4792 /// projects/{project}/buckets/{bucket}/rapidCaches/{rapid_cache}
4793 pub name: std::string::String,
4794
4795 /// Immutable. The zone in which the cache instance is running. For example,
4796 /// us-central1-a.
4797 pub zone: std::string::String,
4798
4799 /// Immutable. The type of Rapid Cache this represents. Valid values include:
4800 /// 'rapid-cache' and 'rapid-cache-ultra'.
4801 pub cache_type: std::string::String,
4802
4803 /// Cache entry TTL (ranges between 1h to 7d). This is a cache-level config
4804 /// that defines how long a cache entry can live. Default ttl value (24hrs)
4805 /// is applied if not specified in the create request. TTL must be in whole
4806 /// seconds.
4807 pub ttl: std::option::Option<wkt::Duration>,
4808
4809 /// Cache admission policy. Valid policies includes:
4810 /// no_read_admission, admit-on-first-miss and admit-on-second-miss. Defaults
4811 /// to admit-on-first-miss for both AC and RCU. Default value is applied if not
4812 /// specified in the create request.
4813 pub admission_policy: std::string::String,
4814
4815 /// Output only. Cache state including running, creating, and disabled.
4816 pub state: std::string::String,
4817
4818 /// Output only. Time when Rapid cache instance is allocated.
4819 pub create_time: std::option::Option<wkt::Timestamp>,
4820
4821 /// Output only. Time when Rapid cache instance is last updated, including
4822 /// creation.
4823 pub update_time: std::option::Option<wkt::Timestamp>,
4824
4825 /// Output only. True if there is an active update operation against this cache
4826 /// instance. Subsequential update requests will be rejected if this field is
4827 /// true. Output only.
4828 pub pending_update: bool,
4829
4830 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4831}
4832
4833impl RapidCache {
4834 /// Creates a new default instance.
4835 pub fn new() -> Self {
4836 std::default::Default::default()
4837 }
4838
4839 /// Sets the value of [name][crate::model::RapidCache::name].
4840 ///
4841 /// # Example
4842 /// ```ignore,no_run
4843 /// # use google_cloud_storage::model::RapidCache;
4844 /// # let project_id = "project_id";
4845 /// # let bucket_id = "bucket_id";
4846 /// # let rapid_cache_id = "rapid_cache_id";
4847 /// let x = RapidCache::new().set_name(format!("projects/{project_id}/buckets/{bucket_id}/rapidCaches/{rapid_cache_id}"));
4848 /// ```
4849 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4850 self.name = v.into();
4851 self
4852 }
4853
4854 /// Sets the value of [zone][crate::model::RapidCache::zone].
4855 ///
4856 /// # Example
4857 /// ```ignore,no_run
4858 /// # use google_cloud_storage::model::RapidCache;
4859 /// let x = RapidCache::new().set_zone("example");
4860 /// ```
4861 pub fn set_zone<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4862 self.zone = v.into();
4863 self
4864 }
4865
4866 /// Sets the value of [cache_type][crate::model::RapidCache::cache_type].
4867 ///
4868 /// # Example
4869 /// ```ignore,no_run
4870 /// # use google_cloud_storage::model::RapidCache;
4871 /// let x = RapidCache::new().set_cache_type("example");
4872 /// ```
4873 pub fn set_cache_type<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4874 self.cache_type = v.into();
4875 self
4876 }
4877
4878 /// Sets the value of [ttl][crate::model::RapidCache::ttl].
4879 ///
4880 /// # Example
4881 /// ```ignore,no_run
4882 /// # use google_cloud_storage::model::RapidCache;
4883 /// use wkt::Duration;
4884 /// let x = RapidCache::new().set_ttl(Duration::default()/* use setters */);
4885 /// ```
4886 pub fn set_ttl<T>(mut self, v: T) -> Self
4887 where
4888 T: std::convert::Into<wkt::Duration>,
4889 {
4890 self.ttl = std::option::Option::Some(v.into());
4891 self
4892 }
4893
4894 /// Sets or clears the value of [ttl][crate::model::RapidCache::ttl].
4895 ///
4896 /// # Example
4897 /// ```ignore,no_run
4898 /// # use google_cloud_storage::model::RapidCache;
4899 /// use wkt::Duration;
4900 /// let x = RapidCache::new().set_or_clear_ttl(Some(Duration::default()/* use setters */));
4901 /// let x = RapidCache::new().set_or_clear_ttl(None::<Duration>);
4902 /// ```
4903 pub fn set_or_clear_ttl<T>(mut self, v: std::option::Option<T>) -> Self
4904 where
4905 T: std::convert::Into<wkt::Duration>,
4906 {
4907 self.ttl = v.map(|x| x.into());
4908 self
4909 }
4910
4911 /// Sets the value of [admission_policy][crate::model::RapidCache::admission_policy].
4912 ///
4913 /// # Example
4914 /// ```ignore,no_run
4915 /// # use google_cloud_storage::model::RapidCache;
4916 /// let x = RapidCache::new().set_admission_policy("example");
4917 /// ```
4918 pub fn set_admission_policy<T: std::convert::Into<std::string::String>>(
4919 mut self,
4920 v: T,
4921 ) -> Self {
4922 self.admission_policy = v.into();
4923 self
4924 }
4925
4926 /// Sets the value of [state][crate::model::RapidCache::state].
4927 ///
4928 /// # Example
4929 /// ```ignore,no_run
4930 /// # use google_cloud_storage::model::RapidCache;
4931 /// let x = RapidCache::new().set_state("example");
4932 /// ```
4933 pub fn set_state<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4934 self.state = v.into();
4935 self
4936 }
4937
4938 /// Sets the value of [create_time][crate::model::RapidCache::create_time].
4939 ///
4940 /// # Example
4941 /// ```ignore,no_run
4942 /// # use google_cloud_storage::model::RapidCache;
4943 /// use wkt::Timestamp;
4944 /// let x = RapidCache::new().set_create_time(Timestamp::default()/* use setters */);
4945 /// ```
4946 pub fn set_create_time<T>(mut self, v: T) -> Self
4947 where
4948 T: std::convert::Into<wkt::Timestamp>,
4949 {
4950 self.create_time = std::option::Option::Some(v.into());
4951 self
4952 }
4953
4954 /// Sets or clears the value of [create_time][crate::model::RapidCache::create_time].
4955 ///
4956 /// # Example
4957 /// ```ignore,no_run
4958 /// # use google_cloud_storage::model::RapidCache;
4959 /// use wkt::Timestamp;
4960 /// let x = RapidCache::new().set_or_clear_create_time(Some(Timestamp::default()/* use setters */));
4961 /// let x = RapidCache::new().set_or_clear_create_time(None::<Timestamp>);
4962 /// ```
4963 pub fn set_or_clear_create_time<T>(mut self, v: std::option::Option<T>) -> Self
4964 where
4965 T: std::convert::Into<wkt::Timestamp>,
4966 {
4967 self.create_time = v.map(|x| x.into());
4968 self
4969 }
4970
4971 /// Sets the value of [update_time][crate::model::RapidCache::update_time].
4972 ///
4973 /// # Example
4974 /// ```ignore,no_run
4975 /// # use google_cloud_storage::model::RapidCache;
4976 /// use wkt::Timestamp;
4977 /// let x = RapidCache::new().set_update_time(Timestamp::default()/* use setters */);
4978 /// ```
4979 pub fn set_update_time<T>(mut self, v: T) -> Self
4980 where
4981 T: std::convert::Into<wkt::Timestamp>,
4982 {
4983 self.update_time = std::option::Option::Some(v.into());
4984 self
4985 }
4986
4987 /// Sets or clears the value of [update_time][crate::model::RapidCache::update_time].
4988 ///
4989 /// # Example
4990 /// ```ignore,no_run
4991 /// # use google_cloud_storage::model::RapidCache;
4992 /// use wkt::Timestamp;
4993 /// let x = RapidCache::new().set_or_clear_update_time(Some(Timestamp::default()/* use setters */));
4994 /// let x = RapidCache::new().set_or_clear_update_time(None::<Timestamp>);
4995 /// ```
4996 pub fn set_or_clear_update_time<T>(mut self, v: std::option::Option<T>) -> Self
4997 where
4998 T: std::convert::Into<wkt::Timestamp>,
4999 {
5000 self.update_time = v.map(|x| x.into());
5001 self
5002 }
5003
5004 /// Sets the value of [pending_update][crate::model::RapidCache::pending_update].
5005 ///
5006 /// # Example
5007 /// ```ignore,no_run
5008 /// # use google_cloud_storage::model::RapidCache;
5009 /// let x = RapidCache::new().set_pending_update(true);
5010 /// ```
5011 pub fn set_pending_update<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
5012 self.pending_update = v.into();
5013 self
5014 }
5015}
5016
5017impl wkt::message::Message for RapidCache {
5018 fn typename() -> &'static str {
5019 "type.googleapis.com/google.storage.control.v2.RapidCache"
5020 }
5021}
5022
5023/// Request message for CreateRapidCache.
5024#[derive(Clone, Default, PartialEq)]
5025#[non_exhaustive]
5026pub struct CreateRapidCacheRequest {
5027 /// Required. The bucket to which this cache belongs.
5028 /// Format: `projects/{project}/buckets/{bucket}`
5029 pub parent: std::string::String,
5030
5031 /// Required. The RapidCache to create. Default values for ingest_on_write, ttl
5032 /// and admission_policy will be applied if not specified in the request.
5033 pub rapid_cache: std::option::Option<crate::model::RapidCache>,
5034
5035 /// Optional. A unique identifier for this request. UUID is the recommended
5036 /// format, but other formats are still accepted. This request is only
5037 /// idempotent if a `request_id` is provided.
5038 pub request_id: std::string::String,
5039
5040 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5041}
5042
5043impl CreateRapidCacheRequest {
5044 /// Creates a new default instance.
5045 pub fn new() -> Self {
5046 std::default::Default::default()
5047 }
5048
5049 /// Sets the value of [parent][crate::model::CreateRapidCacheRequest::parent].
5050 ///
5051 /// # Example
5052 /// ```ignore,no_run
5053 /// # use google_cloud_storage::model::CreateRapidCacheRequest;
5054 /// # let project_id = "project_id";
5055 /// # let bucket_id = "bucket_id";
5056 /// let x = CreateRapidCacheRequest::new().set_parent(format!("projects/{project_id}/buckets/{bucket_id}"));
5057 /// ```
5058 pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5059 self.parent = v.into();
5060 self
5061 }
5062
5063 /// Sets the value of [rapid_cache][crate::model::CreateRapidCacheRequest::rapid_cache].
5064 ///
5065 /// # Example
5066 /// ```ignore,no_run
5067 /// # use google_cloud_storage::model::CreateRapidCacheRequest;
5068 /// use google_cloud_storage::model::RapidCache;
5069 /// let x = CreateRapidCacheRequest::new().set_rapid_cache(RapidCache::default()/* use setters */);
5070 /// ```
5071 pub fn set_rapid_cache<T>(mut self, v: T) -> Self
5072 where
5073 T: std::convert::Into<crate::model::RapidCache>,
5074 {
5075 self.rapid_cache = std::option::Option::Some(v.into());
5076 self
5077 }
5078
5079 /// Sets or clears the value of [rapid_cache][crate::model::CreateRapidCacheRequest::rapid_cache].
5080 ///
5081 /// # Example
5082 /// ```ignore,no_run
5083 /// # use google_cloud_storage::model::CreateRapidCacheRequest;
5084 /// use google_cloud_storage::model::RapidCache;
5085 /// let x = CreateRapidCacheRequest::new().set_or_clear_rapid_cache(Some(RapidCache::default()/* use setters */));
5086 /// let x = CreateRapidCacheRequest::new().set_or_clear_rapid_cache(None::<RapidCache>);
5087 /// ```
5088 pub fn set_or_clear_rapid_cache<T>(mut self, v: std::option::Option<T>) -> Self
5089 where
5090 T: std::convert::Into<crate::model::RapidCache>,
5091 {
5092 self.rapid_cache = v.map(|x| x.into());
5093 self
5094 }
5095
5096 /// Sets the value of [request_id][crate::model::CreateRapidCacheRequest::request_id].
5097 ///
5098 /// # Example
5099 /// ```ignore,no_run
5100 /// # use google_cloud_storage::model::CreateRapidCacheRequest;
5101 /// let x = CreateRapidCacheRequest::new().set_request_id("example");
5102 /// ```
5103 pub fn set_request_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5104 self.request_id = v.into();
5105 self
5106 }
5107}
5108
5109impl wkt::message::Message for CreateRapidCacheRequest {
5110 fn typename() -> &'static str {
5111 "type.googleapis.com/google.storage.control.v2.CreateRapidCacheRequest"
5112 }
5113}
5114
5115/// Request message for UpdateRapidCache.
5116#[derive(Clone, Default, PartialEq)]
5117#[non_exhaustive]
5118pub struct UpdateRapidCacheRequest {
5119 /// Required. The RapidCache to update.
5120 pub rapid_cache: std::option::Option<crate::model::RapidCache>,
5121
5122 /// Required. List of fields to be updated. Mutable fields of RapidCache
5123 /// include `ttl`, `admission_policy` and `ingest_on_write`.
5124 ///
5125 /// To specify ALL fields, specify a single field with the value `*`. Note: We
5126 /// recommend against doing this. If a new field is introduced at a later time,
5127 /// an older client updating with the `*` may accidentally reset the new
5128 /// field's value.
5129 ///
5130 /// Not specifying any fields is an error.
5131 pub update_mask: std::option::Option<wkt::FieldMask>,
5132
5133 /// Optional. A unique identifier for this request. UUID is the recommended
5134 /// format, but other formats are still accepted. This request is only
5135 /// idempotent if a `request_id` is provided.
5136 pub request_id: std::string::String,
5137
5138 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5139}
5140
5141impl UpdateRapidCacheRequest {
5142 /// Creates a new default instance.
5143 pub fn new() -> Self {
5144 std::default::Default::default()
5145 }
5146
5147 /// Sets the value of [rapid_cache][crate::model::UpdateRapidCacheRequest::rapid_cache].
5148 ///
5149 /// # Example
5150 /// ```ignore,no_run
5151 /// # use google_cloud_storage::model::UpdateRapidCacheRequest;
5152 /// use google_cloud_storage::model::RapidCache;
5153 /// let x = UpdateRapidCacheRequest::new().set_rapid_cache(RapidCache::default()/* use setters */);
5154 /// ```
5155 pub fn set_rapid_cache<T>(mut self, v: T) -> Self
5156 where
5157 T: std::convert::Into<crate::model::RapidCache>,
5158 {
5159 self.rapid_cache = std::option::Option::Some(v.into());
5160 self
5161 }
5162
5163 /// Sets or clears the value of [rapid_cache][crate::model::UpdateRapidCacheRequest::rapid_cache].
5164 ///
5165 /// # Example
5166 /// ```ignore,no_run
5167 /// # use google_cloud_storage::model::UpdateRapidCacheRequest;
5168 /// use google_cloud_storage::model::RapidCache;
5169 /// let x = UpdateRapidCacheRequest::new().set_or_clear_rapid_cache(Some(RapidCache::default()/* use setters */));
5170 /// let x = UpdateRapidCacheRequest::new().set_or_clear_rapid_cache(None::<RapidCache>);
5171 /// ```
5172 pub fn set_or_clear_rapid_cache<T>(mut self, v: std::option::Option<T>) -> Self
5173 where
5174 T: std::convert::Into<crate::model::RapidCache>,
5175 {
5176 self.rapid_cache = v.map(|x| x.into());
5177 self
5178 }
5179
5180 /// Sets the value of [update_mask][crate::model::UpdateRapidCacheRequest::update_mask].
5181 ///
5182 /// # Example
5183 /// ```ignore,no_run
5184 /// # use google_cloud_storage::model::UpdateRapidCacheRequest;
5185 /// use wkt::FieldMask;
5186 /// let x = UpdateRapidCacheRequest::new().set_update_mask(FieldMask::default()/* use setters */);
5187 /// ```
5188 pub fn set_update_mask<T>(mut self, v: T) -> Self
5189 where
5190 T: std::convert::Into<wkt::FieldMask>,
5191 {
5192 self.update_mask = std::option::Option::Some(v.into());
5193 self
5194 }
5195
5196 /// Sets or clears the value of [update_mask][crate::model::UpdateRapidCacheRequest::update_mask].
5197 ///
5198 /// # Example
5199 /// ```ignore,no_run
5200 /// # use google_cloud_storage::model::UpdateRapidCacheRequest;
5201 /// use wkt::FieldMask;
5202 /// let x = UpdateRapidCacheRequest::new().set_or_clear_update_mask(Some(FieldMask::default()/* use setters */));
5203 /// let x = UpdateRapidCacheRequest::new().set_or_clear_update_mask(None::<FieldMask>);
5204 /// ```
5205 pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
5206 where
5207 T: std::convert::Into<wkt::FieldMask>,
5208 {
5209 self.update_mask = v.map(|x| x.into());
5210 self
5211 }
5212
5213 /// Sets the value of [request_id][crate::model::UpdateRapidCacheRequest::request_id].
5214 ///
5215 /// # Example
5216 /// ```ignore,no_run
5217 /// # use google_cloud_storage::model::UpdateRapidCacheRequest;
5218 /// let x = UpdateRapidCacheRequest::new().set_request_id("example");
5219 /// ```
5220 pub fn set_request_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5221 self.request_id = v.into();
5222 self
5223 }
5224}
5225
5226impl wkt::message::Message for UpdateRapidCacheRequest {
5227 fn typename() -> &'static str {
5228 "type.googleapis.com/google.storage.control.v2.UpdateRapidCacheRequest"
5229 }
5230}
5231
5232/// Request message for GetRapidCache.
5233#[derive(Clone, Default, PartialEq)]
5234#[non_exhaustive]
5235pub struct GetRapidCacheRequest {
5236 /// Required. The name field in the request should be:
5237 /// `projects/{project}/buckets/{bucket}/rapidCaches/{rapid_cache}`
5238 pub name: std::string::String,
5239
5240 /// Optional. A unique identifier for this request. UUID is the recommended
5241 /// format, but other formats are still accepted.
5242 pub request_id: std::string::String,
5243
5244 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5245}
5246
5247impl GetRapidCacheRequest {
5248 /// Creates a new default instance.
5249 pub fn new() -> Self {
5250 std::default::Default::default()
5251 }
5252
5253 /// Sets the value of [name][crate::model::GetRapidCacheRequest::name].
5254 ///
5255 /// # Example
5256 /// ```ignore,no_run
5257 /// # use google_cloud_storage::model::GetRapidCacheRequest;
5258 /// # let project_id = "project_id";
5259 /// # let bucket_id = "bucket_id";
5260 /// # let rapid_cache_id = "rapid_cache_id";
5261 /// let x = GetRapidCacheRequest::new().set_name(format!("projects/{project_id}/buckets/{bucket_id}/rapidCaches/{rapid_cache_id}"));
5262 /// ```
5263 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5264 self.name = v.into();
5265 self
5266 }
5267
5268 /// Sets the value of [request_id][crate::model::GetRapidCacheRequest::request_id].
5269 ///
5270 /// # Example
5271 /// ```ignore,no_run
5272 /// # use google_cloud_storage::model::GetRapidCacheRequest;
5273 /// let x = GetRapidCacheRequest::new().set_request_id("example");
5274 /// ```
5275 pub fn set_request_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5276 self.request_id = v.into();
5277 self
5278 }
5279}
5280
5281impl wkt::message::Message for GetRapidCacheRequest {
5282 fn typename() -> &'static str {
5283 "type.googleapis.com/google.storage.control.v2.GetRapidCacheRequest"
5284 }
5285}
5286
5287/// Request message for ListRapidCaches.
5288#[derive(Clone, Default, PartialEq)]
5289#[non_exhaustive]
5290pub struct ListRapidCachesRequest {
5291 /// Required. The bucket to which this cache belongs.
5292 pub parent: std::string::String,
5293
5294 /// Maximum number of caches to return in a single response.
5295 /// The service will use this parameter or 1,000 items, whichever is smaller.
5296 pub page_size: i32,
5297
5298 /// A previously-returned page token representing part of the larger set of
5299 /// results to view.
5300 pub page_token: std::string::String,
5301
5302 /// Optional. A unique identifier for this request. UUID is the recommended
5303 /// format, but other formats are still accepted.
5304 pub request_id: std::string::String,
5305
5306 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5307}
5308
5309impl ListRapidCachesRequest {
5310 /// Creates a new default instance.
5311 pub fn new() -> Self {
5312 std::default::Default::default()
5313 }
5314
5315 /// Sets the value of [parent][crate::model::ListRapidCachesRequest::parent].
5316 ///
5317 /// # Example
5318 /// ```ignore,no_run
5319 /// # use google_cloud_storage::model::ListRapidCachesRequest;
5320 /// # let project_id = "project_id";
5321 /// # let bucket_id = "bucket_id";
5322 /// let x = ListRapidCachesRequest::new().set_parent(format!("projects/{project_id}/buckets/{bucket_id}"));
5323 /// ```
5324 pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5325 self.parent = v.into();
5326 self
5327 }
5328
5329 /// Sets the value of [page_size][crate::model::ListRapidCachesRequest::page_size].
5330 ///
5331 /// # Example
5332 /// ```ignore,no_run
5333 /// # use google_cloud_storage::model::ListRapidCachesRequest;
5334 /// let x = ListRapidCachesRequest::new().set_page_size(42);
5335 /// ```
5336 pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
5337 self.page_size = v.into();
5338 self
5339 }
5340
5341 /// Sets the value of [page_token][crate::model::ListRapidCachesRequest::page_token].
5342 ///
5343 /// # Example
5344 /// ```ignore,no_run
5345 /// # use google_cloud_storage::model::ListRapidCachesRequest;
5346 /// let x = ListRapidCachesRequest::new().set_page_token("example");
5347 /// ```
5348 pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5349 self.page_token = v.into();
5350 self
5351 }
5352
5353 /// Sets the value of [request_id][crate::model::ListRapidCachesRequest::request_id].
5354 ///
5355 /// # Example
5356 /// ```ignore,no_run
5357 /// # use google_cloud_storage::model::ListRapidCachesRequest;
5358 /// let x = ListRapidCachesRequest::new().set_request_id("example");
5359 /// ```
5360 pub fn set_request_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5361 self.request_id = v.into();
5362 self
5363 }
5364}
5365
5366impl wkt::message::Message for ListRapidCachesRequest {
5367 fn typename() -> &'static str {
5368 "type.googleapis.com/google.storage.control.v2.ListRapidCachesRequest"
5369 }
5370}
5371
5372/// Response message for ListRapidCaches.
5373#[derive(Clone, Default, PartialEq)]
5374#[non_exhaustive]
5375pub struct ListRapidCachesResponse {
5376 /// The list of rapid caches.
5377 pub rapid_caches: std::vec::Vec<crate::model::RapidCache>,
5378
5379 /// A token, which can be sent as `page_token` to retrieve the next page.
5380 /// If this field is omitted, there are no subsequent pages.
5381 pub next_page_token: std::string::String,
5382
5383 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5384}
5385
5386impl ListRapidCachesResponse {
5387 /// Creates a new default instance.
5388 pub fn new() -> Self {
5389 std::default::Default::default()
5390 }
5391
5392 /// Sets the value of [rapid_caches][crate::model::ListRapidCachesResponse::rapid_caches].
5393 ///
5394 /// # Example
5395 /// ```ignore,no_run
5396 /// # use google_cloud_storage::model::ListRapidCachesResponse;
5397 /// use google_cloud_storage::model::RapidCache;
5398 /// let x = ListRapidCachesResponse::new()
5399 /// .set_rapid_caches([
5400 /// RapidCache::default()/* use setters */,
5401 /// RapidCache::default()/* use (different) setters */,
5402 /// ]);
5403 /// ```
5404 pub fn set_rapid_caches<T, V>(mut self, v: T) -> Self
5405 where
5406 T: std::iter::IntoIterator<Item = V>,
5407 V: std::convert::Into<crate::model::RapidCache>,
5408 {
5409 use std::iter::Iterator;
5410 self.rapid_caches = v.into_iter().map(|i| i.into()).collect();
5411 self
5412 }
5413
5414 /// Sets the value of [next_page_token][crate::model::ListRapidCachesResponse::next_page_token].
5415 ///
5416 /// # Example
5417 /// ```ignore,no_run
5418 /// # use google_cloud_storage::model::ListRapidCachesResponse;
5419 /// let x = ListRapidCachesResponse::new().set_next_page_token("example");
5420 /// ```
5421 pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5422 self.next_page_token = v.into();
5423 self
5424 }
5425}
5426
5427impl wkt::message::Message for ListRapidCachesResponse {
5428 fn typename() -> &'static str {
5429 "type.googleapis.com/google.storage.control.v2.ListRapidCachesResponse"
5430 }
5431}
5432
5433#[doc(hidden)]
5434impl google_cloud_gax::paginator::internal::PageableResponse for ListRapidCachesResponse {
5435 type PageItem = crate::model::RapidCache;
5436
5437 fn items(self) -> std::vec::Vec<Self::PageItem> {
5438 self.rapid_caches
5439 }
5440
5441 fn next_page_token(&self) -> std::string::String {
5442 use std::clone::Clone;
5443 self.next_page_token.clone()
5444 }
5445}
5446
5447/// The `IntelligenceConfig` resource associated with your organization, folder,
5448/// or project.
5449#[derive(Clone, Default, PartialEq)]
5450#[non_exhaustive]
5451pub struct IntelligenceConfig {
5452 /// Identifier. The name of the `IntelligenceConfig` resource associated with
5453 /// your organization, folder, or project.
5454 ///
5455 /// The name format varies based on the GCP resource hierarchy as follows:
5456 ///
5457 /// * For project:
5458 /// `projects/{project_number}/locations/global/intelligenceConfig`
5459 /// * For organization:
5460 /// `organizations/{org_id}/locations/global/intelligenceConfig`
5461 /// * For folder: `folders/{folder_id}/locations/global/intelligenceConfig`
5462 pub name: std::string::String,
5463
5464 /// Optional. The edition configuration of the `IntelligenceConfig` resource.
5465 pub edition_config: crate::model::intelligence_config::EditionConfig,
5466
5467 /// Output only. The time at which the `IntelligenceConfig` resource is last
5468 /// updated.
5469 pub update_time: std::option::Option<wkt::Timestamp>,
5470
5471 /// Optional. Filter over location and bucket.
5472 pub filter: std::option::Option<crate::model::intelligence_config::Filter>,
5473
5474 /// Output only. The `IntelligenceConfig` resource that is applicable for the
5475 /// resource.
5476 pub effective_intelligence_config:
5477 std::option::Option<crate::model::intelligence_config::EffectiveIntelligenceConfig>,
5478
5479 /// The trial configuration of the `IntelligenceConfig` resource.
5480 pub trial_config: std::option::Option<crate::model::intelligence_config::TrialConfig>,
5481
5482 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5483}
5484
5485impl IntelligenceConfig {
5486 /// Creates a new default instance.
5487 pub fn new() -> Self {
5488 std::default::Default::default()
5489 }
5490
5491 /// Sets the value of [name][crate::model::IntelligenceConfig::name].
5492 ///
5493 /// # Example
5494 /// ```ignore,no_run
5495 /// # use google_cloud_storage::model::IntelligenceConfig;
5496 /// # let folder_id = "folder_id";
5497 /// # let location_id = "location_id";
5498 /// let x = IntelligenceConfig::new().set_name(format!("folders/{folder_id}/locations/{location_id}/intelligenceConfig"));
5499 /// ```
5500 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5501 self.name = v.into();
5502 self
5503 }
5504
5505 /// Sets the value of [edition_config][crate::model::IntelligenceConfig::edition_config].
5506 ///
5507 /// # Example
5508 /// ```ignore,no_run
5509 /// # use google_cloud_storage::model::IntelligenceConfig;
5510 /// use google_cloud_storage::model::intelligence_config::EditionConfig;
5511 /// let x0 = IntelligenceConfig::new().set_edition_config(EditionConfig::Inherit);
5512 /// let x1 = IntelligenceConfig::new().set_edition_config(EditionConfig::Disabled);
5513 /// let x2 = IntelligenceConfig::new().set_edition_config(EditionConfig::Standard);
5514 /// ```
5515 pub fn set_edition_config<
5516 T: std::convert::Into<crate::model::intelligence_config::EditionConfig>,
5517 >(
5518 mut self,
5519 v: T,
5520 ) -> Self {
5521 self.edition_config = v.into();
5522 self
5523 }
5524
5525 /// Sets the value of [update_time][crate::model::IntelligenceConfig::update_time].
5526 ///
5527 /// # Example
5528 /// ```ignore,no_run
5529 /// # use google_cloud_storage::model::IntelligenceConfig;
5530 /// use wkt::Timestamp;
5531 /// let x = IntelligenceConfig::new().set_update_time(Timestamp::default()/* use setters */);
5532 /// ```
5533 pub fn set_update_time<T>(mut self, v: T) -> Self
5534 where
5535 T: std::convert::Into<wkt::Timestamp>,
5536 {
5537 self.update_time = std::option::Option::Some(v.into());
5538 self
5539 }
5540
5541 /// Sets or clears the value of [update_time][crate::model::IntelligenceConfig::update_time].
5542 ///
5543 /// # Example
5544 /// ```ignore,no_run
5545 /// # use google_cloud_storage::model::IntelligenceConfig;
5546 /// use wkt::Timestamp;
5547 /// let x = IntelligenceConfig::new().set_or_clear_update_time(Some(Timestamp::default()/* use setters */));
5548 /// let x = IntelligenceConfig::new().set_or_clear_update_time(None::<Timestamp>);
5549 /// ```
5550 pub fn set_or_clear_update_time<T>(mut self, v: std::option::Option<T>) -> Self
5551 where
5552 T: std::convert::Into<wkt::Timestamp>,
5553 {
5554 self.update_time = v.map(|x| x.into());
5555 self
5556 }
5557
5558 /// Sets the value of [filter][crate::model::IntelligenceConfig::filter].
5559 ///
5560 /// # Example
5561 /// ```ignore,no_run
5562 /// # use google_cloud_storage::model::IntelligenceConfig;
5563 /// use google_cloud_storage::model::intelligence_config::Filter;
5564 /// let x = IntelligenceConfig::new().set_filter(Filter::default()/* use setters */);
5565 /// ```
5566 pub fn set_filter<T>(mut self, v: T) -> Self
5567 where
5568 T: std::convert::Into<crate::model::intelligence_config::Filter>,
5569 {
5570 self.filter = std::option::Option::Some(v.into());
5571 self
5572 }
5573
5574 /// Sets or clears the value of [filter][crate::model::IntelligenceConfig::filter].
5575 ///
5576 /// # Example
5577 /// ```ignore,no_run
5578 /// # use google_cloud_storage::model::IntelligenceConfig;
5579 /// use google_cloud_storage::model::intelligence_config::Filter;
5580 /// let x = IntelligenceConfig::new().set_or_clear_filter(Some(Filter::default()/* use setters */));
5581 /// let x = IntelligenceConfig::new().set_or_clear_filter(None::<Filter>);
5582 /// ```
5583 pub fn set_or_clear_filter<T>(mut self, v: std::option::Option<T>) -> Self
5584 where
5585 T: std::convert::Into<crate::model::intelligence_config::Filter>,
5586 {
5587 self.filter = v.map(|x| x.into());
5588 self
5589 }
5590
5591 /// Sets the value of [effective_intelligence_config][crate::model::IntelligenceConfig::effective_intelligence_config].
5592 ///
5593 /// # Example
5594 /// ```ignore,no_run
5595 /// # use google_cloud_storage::model::IntelligenceConfig;
5596 /// use google_cloud_storage::model::intelligence_config::EffectiveIntelligenceConfig;
5597 /// let x = IntelligenceConfig::new().set_effective_intelligence_config(EffectiveIntelligenceConfig::default()/* use setters */);
5598 /// ```
5599 pub fn set_effective_intelligence_config<T>(mut self, v: T) -> Self
5600 where
5601 T: std::convert::Into<crate::model::intelligence_config::EffectiveIntelligenceConfig>,
5602 {
5603 self.effective_intelligence_config = std::option::Option::Some(v.into());
5604 self
5605 }
5606
5607 /// Sets or clears the value of [effective_intelligence_config][crate::model::IntelligenceConfig::effective_intelligence_config].
5608 ///
5609 /// # Example
5610 /// ```ignore,no_run
5611 /// # use google_cloud_storage::model::IntelligenceConfig;
5612 /// use google_cloud_storage::model::intelligence_config::EffectiveIntelligenceConfig;
5613 /// let x = IntelligenceConfig::new().set_or_clear_effective_intelligence_config(Some(EffectiveIntelligenceConfig::default()/* use setters */));
5614 /// let x = IntelligenceConfig::new().set_or_clear_effective_intelligence_config(None::<EffectiveIntelligenceConfig>);
5615 /// ```
5616 pub fn set_or_clear_effective_intelligence_config<T>(
5617 mut self,
5618 v: std::option::Option<T>,
5619 ) -> Self
5620 where
5621 T: std::convert::Into<crate::model::intelligence_config::EffectiveIntelligenceConfig>,
5622 {
5623 self.effective_intelligence_config = v.map(|x| x.into());
5624 self
5625 }
5626
5627 /// Sets the value of [trial_config][crate::model::IntelligenceConfig::trial_config].
5628 ///
5629 /// # Example
5630 /// ```ignore,no_run
5631 /// # use google_cloud_storage::model::IntelligenceConfig;
5632 /// use google_cloud_storage::model::intelligence_config::TrialConfig;
5633 /// let x = IntelligenceConfig::new().set_trial_config(TrialConfig::default()/* use setters */);
5634 /// ```
5635 pub fn set_trial_config<T>(mut self, v: T) -> Self
5636 where
5637 T: std::convert::Into<crate::model::intelligence_config::TrialConfig>,
5638 {
5639 self.trial_config = std::option::Option::Some(v.into());
5640 self
5641 }
5642
5643 /// Sets or clears the value of [trial_config][crate::model::IntelligenceConfig::trial_config].
5644 ///
5645 /// # Example
5646 /// ```ignore,no_run
5647 /// # use google_cloud_storage::model::IntelligenceConfig;
5648 /// use google_cloud_storage::model::intelligence_config::TrialConfig;
5649 /// let x = IntelligenceConfig::new().set_or_clear_trial_config(Some(TrialConfig::default()/* use setters */));
5650 /// let x = IntelligenceConfig::new().set_or_clear_trial_config(None::<TrialConfig>);
5651 /// ```
5652 pub fn set_or_clear_trial_config<T>(mut self, v: std::option::Option<T>) -> Self
5653 where
5654 T: std::convert::Into<crate::model::intelligence_config::TrialConfig>,
5655 {
5656 self.trial_config = v.map(|x| x.into());
5657 self
5658 }
5659}
5660
5661impl wkt::message::Message for IntelligenceConfig {
5662 fn typename() -> &'static str {
5663 "type.googleapis.com/google.storage.control.v2.IntelligenceConfig"
5664 }
5665}
5666
5667/// Defines additional types related to [IntelligenceConfig].
5668pub mod intelligence_config {
5669 #[allow(unused_imports)]
5670 use super::*;
5671
5672 /// Filter over location and bucket using include or exclude semantics.
5673 /// Resources that match the include or exclude filter are exclusively included
5674 /// or excluded from the Storage Intelligence plan.
5675 #[derive(Clone, Default, PartialEq)]
5676 #[non_exhaustive]
5677 pub struct Filter {
5678 /// Bucket locations to include or exclude.
5679 pub cloud_storage_locations: std::option::Option<
5680 crate::model::intelligence_config::filter::CloudStorageLocationsOneOf,
5681 >,
5682
5683 /// Buckets to include or exclude.
5684 pub cloud_storage_buckets: std::option::Option<
5685 crate::model::intelligence_config::filter::CloudStorageBucketsOneOf,
5686 >,
5687
5688 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5689 }
5690
5691 impl Filter {
5692 /// Creates a new default instance.
5693 pub fn new() -> Self {
5694 std::default::Default::default()
5695 }
5696
5697 /// Sets the value of [cloud_storage_locations][crate::model::intelligence_config::Filter::cloud_storage_locations].
5698 ///
5699 /// Note that all the setters affecting `cloud_storage_locations` are mutually
5700 /// exclusive.
5701 ///
5702 /// # Example
5703 /// ```ignore,no_run
5704 /// # use google_cloud_storage::model::intelligence_config::Filter;
5705 /// use google_cloud_storage::model::intelligence_config::filter::CloudStorageLocations;
5706 /// let x = Filter::new().set_cloud_storage_locations(Some(
5707 /// google_cloud_storage::model::intelligence_config::filter::CloudStorageLocationsOneOf::IncludedCloudStorageLocations(CloudStorageLocations::default().into())));
5708 /// ```
5709 pub fn set_cloud_storage_locations<
5710 T: std::convert::Into<
5711 std::option::Option<
5712 crate::model::intelligence_config::filter::CloudStorageLocationsOneOf,
5713 >,
5714 >,
5715 >(
5716 mut self,
5717 v: T,
5718 ) -> Self {
5719 self.cloud_storage_locations = v.into();
5720 self
5721 }
5722
5723 /// The value of [cloud_storage_locations][crate::model::intelligence_config::Filter::cloud_storage_locations]
5724 /// if it holds a `IncludedCloudStorageLocations`, `None` if the field is not set or
5725 /// holds a different branch.
5726 pub fn included_cloud_storage_locations(
5727 &self,
5728 ) -> std::option::Option<
5729 &std::boxed::Box<crate::model::intelligence_config::filter::CloudStorageLocations>,
5730 > {
5731 #[allow(unreachable_patterns)]
5732 self.cloud_storage_locations.as_ref().and_then(|v| match v {
5733 crate::model::intelligence_config::filter::CloudStorageLocationsOneOf::IncludedCloudStorageLocations(v) => std::option::Option::Some(v),
5734 _ => std::option::Option::None,
5735 })
5736 }
5737
5738 /// Sets the value of [cloud_storage_locations][crate::model::intelligence_config::Filter::cloud_storage_locations]
5739 /// to hold a `IncludedCloudStorageLocations`.
5740 ///
5741 /// Note that all the setters affecting `cloud_storage_locations` are
5742 /// mutually exclusive.
5743 ///
5744 /// # Example
5745 /// ```ignore,no_run
5746 /// # use google_cloud_storage::model::intelligence_config::Filter;
5747 /// use google_cloud_storage::model::intelligence_config::filter::CloudStorageLocations;
5748 /// let x = Filter::new().set_included_cloud_storage_locations(CloudStorageLocations::default()/* use setters */);
5749 /// assert!(x.included_cloud_storage_locations().is_some());
5750 /// assert!(x.excluded_cloud_storage_locations().is_none());
5751 /// ```
5752 pub fn set_included_cloud_storage_locations<
5753 T: std::convert::Into<
5754 std::boxed::Box<
5755 crate::model::intelligence_config::filter::CloudStorageLocations,
5756 >,
5757 >,
5758 >(
5759 mut self,
5760 v: T,
5761 ) -> Self {
5762 self.cloud_storage_locations = std::option::Option::Some(
5763 crate::model::intelligence_config::filter::CloudStorageLocationsOneOf::IncludedCloudStorageLocations(
5764 v.into()
5765 )
5766 );
5767 self
5768 }
5769
5770 /// The value of [cloud_storage_locations][crate::model::intelligence_config::Filter::cloud_storage_locations]
5771 /// if it holds a `ExcludedCloudStorageLocations`, `None` if the field is not set or
5772 /// holds a different branch.
5773 pub fn excluded_cloud_storage_locations(
5774 &self,
5775 ) -> std::option::Option<
5776 &std::boxed::Box<crate::model::intelligence_config::filter::CloudStorageLocations>,
5777 > {
5778 #[allow(unreachable_patterns)]
5779 self.cloud_storage_locations.as_ref().and_then(|v| match v {
5780 crate::model::intelligence_config::filter::CloudStorageLocationsOneOf::ExcludedCloudStorageLocations(v) => std::option::Option::Some(v),
5781 _ => std::option::Option::None,
5782 })
5783 }
5784
5785 /// Sets the value of [cloud_storage_locations][crate::model::intelligence_config::Filter::cloud_storage_locations]
5786 /// to hold a `ExcludedCloudStorageLocations`.
5787 ///
5788 /// Note that all the setters affecting `cloud_storage_locations` are
5789 /// mutually exclusive.
5790 ///
5791 /// # Example
5792 /// ```ignore,no_run
5793 /// # use google_cloud_storage::model::intelligence_config::Filter;
5794 /// use google_cloud_storage::model::intelligence_config::filter::CloudStorageLocations;
5795 /// let x = Filter::new().set_excluded_cloud_storage_locations(CloudStorageLocations::default()/* use setters */);
5796 /// assert!(x.excluded_cloud_storage_locations().is_some());
5797 /// assert!(x.included_cloud_storage_locations().is_none());
5798 /// ```
5799 pub fn set_excluded_cloud_storage_locations<
5800 T: std::convert::Into<
5801 std::boxed::Box<
5802 crate::model::intelligence_config::filter::CloudStorageLocations,
5803 >,
5804 >,
5805 >(
5806 mut self,
5807 v: T,
5808 ) -> Self {
5809 self.cloud_storage_locations = std::option::Option::Some(
5810 crate::model::intelligence_config::filter::CloudStorageLocationsOneOf::ExcludedCloudStorageLocations(
5811 v.into()
5812 )
5813 );
5814 self
5815 }
5816
5817 /// Sets the value of [cloud_storage_buckets][crate::model::intelligence_config::Filter::cloud_storage_buckets].
5818 ///
5819 /// Note that all the setters affecting `cloud_storage_buckets` are mutually
5820 /// exclusive.
5821 ///
5822 /// # Example
5823 /// ```ignore,no_run
5824 /// # use google_cloud_storage::model::intelligence_config::Filter;
5825 /// use google_cloud_storage::model::intelligence_config::filter::CloudStorageBuckets;
5826 /// let x = Filter::new().set_cloud_storage_buckets(Some(
5827 /// google_cloud_storage::model::intelligence_config::filter::CloudStorageBucketsOneOf::IncludedCloudStorageBuckets(CloudStorageBuckets::default().into())));
5828 /// ```
5829 pub fn set_cloud_storage_buckets<
5830 T: std::convert::Into<
5831 std::option::Option<
5832 crate::model::intelligence_config::filter::CloudStorageBucketsOneOf,
5833 >,
5834 >,
5835 >(
5836 mut self,
5837 v: T,
5838 ) -> Self {
5839 self.cloud_storage_buckets = v.into();
5840 self
5841 }
5842
5843 /// The value of [cloud_storage_buckets][crate::model::intelligence_config::Filter::cloud_storage_buckets]
5844 /// if it holds a `IncludedCloudStorageBuckets`, `None` if the field is not set or
5845 /// holds a different branch.
5846 pub fn included_cloud_storage_buckets(
5847 &self,
5848 ) -> std::option::Option<
5849 &std::boxed::Box<crate::model::intelligence_config::filter::CloudStorageBuckets>,
5850 > {
5851 #[allow(unreachable_patterns)]
5852 self.cloud_storage_buckets.as_ref().and_then(|v| match v {
5853 crate::model::intelligence_config::filter::CloudStorageBucketsOneOf::IncludedCloudStorageBuckets(v) => std::option::Option::Some(v),
5854 _ => std::option::Option::None,
5855 })
5856 }
5857
5858 /// Sets the value of [cloud_storage_buckets][crate::model::intelligence_config::Filter::cloud_storage_buckets]
5859 /// to hold a `IncludedCloudStorageBuckets`.
5860 ///
5861 /// Note that all the setters affecting `cloud_storage_buckets` are
5862 /// mutually exclusive.
5863 ///
5864 /// # Example
5865 /// ```ignore,no_run
5866 /// # use google_cloud_storage::model::intelligence_config::Filter;
5867 /// use google_cloud_storage::model::intelligence_config::filter::CloudStorageBuckets;
5868 /// let x = Filter::new().set_included_cloud_storage_buckets(CloudStorageBuckets::default()/* use setters */);
5869 /// assert!(x.included_cloud_storage_buckets().is_some());
5870 /// assert!(x.excluded_cloud_storage_buckets().is_none());
5871 /// ```
5872 pub fn set_included_cloud_storage_buckets<
5873 T: std::convert::Into<
5874 std::boxed::Box<crate::model::intelligence_config::filter::CloudStorageBuckets>,
5875 >,
5876 >(
5877 mut self,
5878 v: T,
5879 ) -> Self {
5880 self.cloud_storage_buckets = std::option::Option::Some(
5881 crate::model::intelligence_config::filter::CloudStorageBucketsOneOf::IncludedCloudStorageBuckets(
5882 v.into()
5883 )
5884 );
5885 self
5886 }
5887
5888 /// The value of [cloud_storage_buckets][crate::model::intelligence_config::Filter::cloud_storage_buckets]
5889 /// if it holds a `ExcludedCloudStorageBuckets`, `None` if the field is not set or
5890 /// holds a different branch.
5891 pub fn excluded_cloud_storage_buckets(
5892 &self,
5893 ) -> std::option::Option<
5894 &std::boxed::Box<crate::model::intelligence_config::filter::CloudStorageBuckets>,
5895 > {
5896 #[allow(unreachable_patterns)]
5897 self.cloud_storage_buckets.as_ref().and_then(|v| match v {
5898 crate::model::intelligence_config::filter::CloudStorageBucketsOneOf::ExcludedCloudStorageBuckets(v) => std::option::Option::Some(v),
5899 _ => std::option::Option::None,
5900 })
5901 }
5902
5903 /// Sets the value of [cloud_storage_buckets][crate::model::intelligence_config::Filter::cloud_storage_buckets]
5904 /// to hold a `ExcludedCloudStorageBuckets`.
5905 ///
5906 /// Note that all the setters affecting `cloud_storage_buckets` are
5907 /// mutually exclusive.
5908 ///
5909 /// # Example
5910 /// ```ignore,no_run
5911 /// # use google_cloud_storage::model::intelligence_config::Filter;
5912 /// use google_cloud_storage::model::intelligence_config::filter::CloudStorageBuckets;
5913 /// let x = Filter::new().set_excluded_cloud_storage_buckets(CloudStorageBuckets::default()/* use setters */);
5914 /// assert!(x.excluded_cloud_storage_buckets().is_some());
5915 /// assert!(x.included_cloud_storage_buckets().is_none());
5916 /// ```
5917 pub fn set_excluded_cloud_storage_buckets<
5918 T: std::convert::Into<
5919 std::boxed::Box<crate::model::intelligence_config::filter::CloudStorageBuckets>,
5920 >,
5921 >(
5922 mut self,
5923 v: T,
5924 ) -> Self {
5925 self.cloud_storage_buckets = std::option::Option::Some(
5926 crate::model::intelligence_config::filter::CloudStorageBucketsOneOf::ExcludedCloudStorageBuckets(
5927 v.into()
5928 )
5929 );
5930 self
5931 }
5932 }
5933
5934 impl wkt::message::Message for Filter {
5935 fn typename() -> &'static str {
5936 "type.googleapis.com/google.storage.control.v2.IntelligenceConfig.Filter"
5937 }
5938 }
5939
5940 /// Defines additional types related to [Filter].
5941 pub mod filter {
5942 #[allow(unused_imports)]
5943 use super::*;
5944
5945 /// Collection of bucket locations.
5946 #[derive(Clone, Default, PartialEq)]
5947 #[non_exhaustive]
5948 pub struct CloudStorageLocations {
5949 /// Optional. Bucket locations. Location can be any of the Cloud Storage
5950 /// regions specified in lower case format. For example, `us-east1`,
5951 /// `us-west1`.
5952 pub locations: std::vec::Vec<std::string::String>,
5953
5954 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5955 }
5956
5957 impl CloudStorageLocations {
5958 /// Creates a new default instance.
5959 pub fn new() -> Self {
5960 std::default::Default::default()
5961 }
5962
5963 /// Sets the value of [locations][crate::model::intelligence_config::filter::CloudStorageLocations::locations].
5964 ///
5965 /// # Example
5966 /// ```ignore,no_run
5967 /// # use google_cloud_storage::model::intelligence_config::filter::CloudStorageLocations;
5968 /// let x = CloudStorageLocations::new().set_locations(["a", "b", "c"]);
5969 /// ```
5970 pub fn set_locations<T, V>(mut self, v: T) -> Self
5971 where
5972 T: std::iter::IntoIterator<Item = V>,
5973 V: std::convert::Into<std::string::String>,
5974 {
5975 use std::iter::Iterator;
5976 self.locations = v.into_iter().map(|i| i.into()).collect();
5977 self
5978 }
5979 }
5980
5981 impl wkt::message::Message for CloudStorageLocations {
5982 fn typename() -> &'static str {
5983 "type.googleapis.com/google.storage.control.v2.IntelligenceConfig.Filter.CloudStorageLocations"
5984 }
5985 }
5986
5987 /// Collection of buckets.
5988 #[derive(Clone, Default, PartialEq)]
5989 #[non_exhaustive]
5990 pub struct CloudStorageBuckets {
5991 /// Optional. A regex pattern for matching bucket names. Regex should
5992 /// follow the syntax specified in
5993 /// [google/re2](https://github.com/google/re2). For example,
5994 /// `^sample_.*` matches all buckets of the form
5995 /// `gs://sample_bucket-1`, `gs://sample_bucket-2`,
5996 /// `gs://sample_bucket-n` but not `gs://test_sample_bucket`.
5997 /// If you want to match a single bucket, say `gs://sample_bucket`,
5998 /// use `sample_bucket`.
5999 pub bucket_id_regexes: std::vec::Vec<std::string::String>,
6000
6001 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
6002 }
6003
6004 impl CloudStorageBuckets {
6005 /// Creates a new default instance.
6006 pub fn new() -> Self {
6007 std::default::Default::default()
6008 }
6009
6010 /// Sets the value of [bucket_id_regexes][crate::model::intelligence_config::filter::CloudStorageBuckets::bucket_id_regexes].
6011 ///
6012 /// # Example
6013 /// ```ignore,no_run
6014 /// # use google_cloud_storage::model::intelligence_config::filter::CloudStorageBuckets;
6015 /// let x = CloudStorageBuckets::new().set_bucket_id_regexes(["a", "b", "c"]);
6016 /// ```
6017 pub fn set_bucket_id_regexes<T, V>(mut self, v: T) -> Self
6018 where
6019 T: std::iter::IntoIterator<Item = V>,
6020 V: std::convert::Into<std::string::String>,
6021 {
6022 use std::iter::Iterator;
6023 self.bucket_id_regexes = v.into_iter().map(|i| i.into()).collect();
6024 self
6025 }
6026 }
6027
6028 impl wkt::message::Message for CloudStorageBuckets {
6029 fn typename() -> &'static str {
6030 "type.googleapis.com/google.storage.control.v2.IntelligenceConfig.Filter.CloudStorageBuckets"
6031 }
6032 }
6033
6034 /// Bucket locations to include or exclude.
6035 #[derive(Clone, Debug, PartialEq)]
6036 #[non_exhaustive]
6037 pub enum CloudStorageLocationsOneOf {
6038 /// Bucket locations to include.
6039 IncludedCloudStorageLocations(
6040 std::boxed::Box<crate::model::intelligence_config::filter::CloudStorageLocations>,
6041 ),
6042 /// Bucket locations to exclude.
6043 ExcludedCloudStorageLocations(
6044 std::boxed::Box<crate::model::intelligence_config::filter::CloudStorageLocations>,
6045 ),
6046 }
6047
6048 impl CloudStorageLocationsOneOf {
6049 /// Initializes the enum to the [IncludedCloudStorageLocations](Self::IncludedCloudStorageLocations) branch.
6050 pub fn from_included_cloud_storage_locations(
6051 value: impl std::convert::Into<
6052 std::boxed::Box<
6053 crate::model::intelligence_config::filter::CloudStorageLocations,
6054 >,
6055 >,
6056 ) -> Self {
6057 Self::IncludedCloudStorageLocations(value.into())
6058 }
6059 /// Initializes the enum to the [ExcludedCloudStorageLocations](Self::ExcludedCloudStorageLocations) branch.
6060 pub fn from_excluded_cloud_storage_locations(
6061 value: impl std::convert::Into<
6062 std::boxed::Box<
6063 crate::model::intelligence_config::filter::CloudStorageLocations,
6064 >,
6065 >,
6066 ) -> Self {
6067 Self::ExcludedCloudStorageLocations(value.into())
6068 }
6069 }
6070
6071 /// Buckets to include or exclude.
6072 #[derive(Clone, Debug, PartialEq)]
6073 #[non_exhaustive]
6074 pub enum CloudStorageBucketsOneOf {
6075 /// Buckets to include.
6076 IncludedCloudStorageBuckets(
6077 std::boxed::Box<crate::model::intelligence_config::filter::CloudStorageBuckets>,
6078 ),
6079 /// Buckets to exclude.
6080 ExcludedCloudStorageBuckets(
6081 std::boxed::Box<crate::model::intelligence_config::filter::CloudStorageBuckets>,
6082 ),
6083 }
6084
6085 impl CloudStorageBucketsOneOf {
6086 /// Initializes the enum to the [IncludedCloudStorageBuckets](Self::IncludedCloudStorageBuckets) branch.
6087 pub fn from_included_cloud_storage_buckets(
6088 value: impl std::convert::Into<
6089 std::boxed::Box<crate::model::intelligence_config::filter::CloudStorageBuckets>,
6090 >,
6091 ) -> Self {
6092 Self::IncludedCloudStorageBuckets(value.into())
6093 }
6094 /// Initializes the enum to the [ExcludedCloudStorageBuckets](Self::ExcludedCloudStorageBuckets) branch.
6095 pub fn from_excluded_cloud_storage_buckets(
6096 value: impl std::convert::Into<
6097 std::boxed::Box<crate::model::intelligence_config::filter::CloudStorageBuckets>,
6098 >,
6099 ) -> Self {
6100 Self::ExcludedCloudStorageBuckets(value.into())
6101 }
6102 }
6103 }
6104
6105 /// The effective `IntelligenceConfig` for the resource.
6106 #[derive(Clone, Default, PartialEq)]
6107 #[non_exhaustive]
6108 pub struct EffectiveIntelligenceConfig {
6109 /// Output only. The `IntelligenceConfig` edition that is applicable for the
6110 /// resource.
6111 pub effective_edition:
6112 crate::model::intelligence_config::effective_intelligence_config::EffectiveEdition,
6113
6114 /// Output only. The `IntelligenceConfig` resource that is applied for the
6115 /// target resource. Format:
6116 /// `{organizations|folders|projects}/{id}/locations/{location}/intelligenceConfig`
6117 pub intelligence_config: std::string::String,
6118
6119 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
6120 }
6121
6122 impl EffectiveIntelligenceConfig {
6123 /// Creates a new default instance.
6124 pub fn new() -> Self {
6125 std::default::Default::default()
6126 }
6127
6128 /// Sets the value of [effective_edition][crate::model::intelligence_config::EffectiveIntelligenceConfig::effective_edition].
6129 ///
6130 /// # Example
6131 /// ```ignore,no_run
6132 /// # use google_cloud_storage::model::intelligence_config::EffectiveIntelligenceConfig;
6133 /// use google_cloud_storage::model::intelligence_config::effective_intelligence_config::EffectiveEdition;
6134 /// let x0 = EffectiveIntelligenceConfig::new().set_effective_edition(EffectiveEdition::None);
6135 /// let x1 = EffectiveIntelligenceConfig::new().set_effective_edition(EffectiveEdition::Standard);
6136 /// ```
6137 pub fn set_effective_edition<T: std::convert::Into<crate::model::intelligence_config::effective_intelligence_config::EffectiveEdition>>(mut self, v: T) -> Self{
6138 self.effective_edition = v.into();
6139 self
6140 }
6141
6142 /// Sets the value of [intelligence_config][crate::model::intelligence_config::EffectiveIntelligenceConfig::intelligence_config].
6143 ///
6144 /// # Example
6145 /// ```ignore,no_run
6146 /// # use google_cloud_storage::model::intelligence_config::EffectiveIntelligenceConfig;
6147 /// let x = EffectiveIntelligenceConfig::new().set_intelligence_config("example");
6148 /// ```
6149 pub fn set_intelligence_config<T: std::convert::Into<std::string::String>>(
6150 mut self,
6151 v: T,
6152 ) -> Self {
6153 self.intelligence_config = v.into();
6154 self
6155 }
6156 }
6157
6158 impl wkt::message::Message for EffectiveIntelligenceConfig {
6159 fn typename() -> &'static str {
6160 "type.googleapis.com/google.storage.control.v2.IntelligenceConfig.EffectiveIntelligenceConfig"
6161 }
6162 }
6163
6164 /// Defines additional types related to [EffectiveIntelligenceConfig].
6165 pub mod effective_intelligence_config {
6166 #[allow(unused_imports)]
6167 use super::*;
6168
6169 /// The effective edition of the `IntelligenceConfig` resource.
6170 ///
6171 /// # Working with unknown values
6172 ///
6173 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
6174 /// additional enum variants at any time. Adding new variants is not considered
6175 /// a breaking change. Applications should write their code in anticipation of:
6176 ///
6177 /// - New values appearing in future releases of the client library, **and**
6178 /// - New values received dynamically, without application changes.
6179 ///
6180 /// Please consult the [Working with enums] section in the user guide for some
6181 /// guidelines.
6182 ///
6183 /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
6184 #[derive(Clone, Debug, PartialEq)]
6185 #[non_exhaustive]
6186 pub enum EffectiveEdition {
6187 /// This is an unknown edition of the resource.
6188 Unspecified,
6189 /// No edition.
6190 None,
6191 /// The `IntelligenceConfig` resource is of STANDARD edition.
6192 Standard,
6193 /// If set, the enum was initialized with an unknown value.
6194 ///
6195 /// Applications can examine the value using [EffectiveEdition::value] or
6196 /// [EffectiveEdition::name].
6197 UnknownValue(effective_edition::UnknownValue),
6198 }
6199
6200 #[doc(hidden)]
6201 pub mod effective_edition {
6202 #[allow(unused_imports)]
6203 use super::*;
6204 #[derive(Clone, Debug, PartialEq)]
6205 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
6206 }
6207
6208 impl EffectiveEdition {
6209 /// Gets the enum value.
6210 ///
6211 /// Returns `None` if the enum contains an unknown value deserialized from
6212 /// the string representation of enums.
6213 pub fn value(&self) -> std::option::Option<i32> {
6214 match self {
6215 Self::Unspecified => std::option::Option::Some(0),
6216 Self::None => std::option::Option::Some(1),
6217 Self::Standard => std::option::Option::Some(2),
6218 Self::UnknownValue(u) => u.0.value(),
6219 }
6220 }
6221
6222 /// Gets the enum value as a string.
6223 ///
6224 /// Returns `None` if the enum contains an unknown value deserialized from
6225 /// the integer representation of enums.
6226 pub fn name(&self) -> std::option::Option<&str> {
6227 match self {
6228 Self::Unspecified => std::option::Option::Some("EFFECTIVE_EDITION_UNSPECIFIED"),
6229 Self::None => std::option::Option::Some("NONE"),
6230 Self::Standard => std::option::Option::Some("STANDARD"),
6231 Self::UnknownValue(u) => u.0.name(),
6232 }
6233 }
6234 }
6235
6236 impl std::default::Default for EffectiveEdition {
6237 fn default() -> Self {
6238 use std::convert::From;
6239 Self::from(0)
6240 }
6241 }
6242
6243 impl std::fmt::Display for EffectiveEdition {
6244 fn fmt(
6245 &self,
6246 f: &mut std::fmt::Formatter<'_>,
6247 ) -> std::result::Result<(), std::fmt::Error> {
6248 wkt::internal::display_enum(f, self.name(), self.value())
6249 }
6250 }
6251
6252 impl std::convert::From<i32> for EffectiveEdition {
6253 fn from(value: i32) -> Self {
6254 match value {
6255 0 => Self::Unspecified,
6256 1 => Self::None,
6257 2 => Self::Standard,
6258 _ => Self::UnknownValue(effective_edition::UnknownValue(
6259 wkt::internal::UnknownEnumValue::Integer(value),
6260 )),
6261 }
6262 }
6263 }
6264
6265 impl std::convert::From<&str> for EffectiveEdition {
6266 fn from(value: &str) -> Self {
6267 use std::string::ToString;
6268 match value {
6269 "EFFECTIVE_EDITION_UNSPECIFIED" => Self::Unspecified,
6270 "NONE" => Self::None,
6271 "STANDARD" => Self::Standard,
6272 _ => Self::UnknownValue(effective_edition::UnknownValue(
6273 wkt::internal::UnknownEnumValue::String(value.to_string()),
6274 )),
6275 }
6276 }
6277 }
6278
6279 impl serde::ser::Serialize for EffectiveEdition {
6280 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
6281 where
6282 S: serde::Serializer,
6283 {
6284 match self {
6285 Self::Unspecified => serializer.serialize_i32(0),
6286 Self::None => serializer.serialize_i32(1),
6287 Self::Standard => serializer.serialize_i32(2),
6288 Self::UnknownValue(u) => u.0.serialize(serializer),
6289 }
6290 }
6291 }
6292
6293 impl<'de> serde::de::Deserialize<'de> for EffectiveEdition {
6294 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
6295 where
6296 D: serde::Deserializer<'de>,
6297 {
6298 deserializer.deserialize_any(wkt::internal::EnumVisitor::<EffectiveEdition>::new(
6299 ".google.storage.control.v2.IntelligenceConfig.EffectiveIntelligenceConfig.EffectiveEdition"))
6300 }
6301 }
6302 }
6303
6304 /// The trial configuration of the `IntelligenceConfig` resource.
6305 #[derive(Clone, Default, PartialEq)]
6306 #[non_exhaustive]
6307 pub struct TrialConfig {
6308 /// Output only. The time at which the trial expires.
6309 pub expire_time: std::option::Option<wkt::Timestamp>,
6310
6311 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
6312 }
6313
6314 impl TrialConfig {
6315 /// Creates a new default instance.
6316 pub fn new() -> Self {
6317 std::default::Default::default()
6318 }
6319
6320 /// Sets the value of [expire_time][crate::model::intelligence_config::TrialConfig::expire_time].
6321 ///
6322 /// # Example
6323 /// ```ignore,no_run
6324 /// # use google_cloud_storage::model::intelligence_config::TrialConfig;
6325 /// use wkt::Timestamp;
6326 /// let x = TrialConfig::new().set_expire_time(Timestamp::default()/* use setters */);
6327 /// ```
6328 pub fn set_expire_time<T>(mut self, v: T) -> Self
6329 where
6330 T: std::convert::Into<wkt::Timestamp>,
6331 {
6332 self.expire_time = std::option::Option::Some(v.into());
6333 self
6334 }
6335
6336 /// Sets or clears the value of [expire_time][crate::model::intelligence_config::TrialConfig::expire_time].
6337 ///
6338 /// # Example
6339 /// ```ignore,no_run
6340 /// # use google_cloud_storage::model::intelligence_config::TrialConfig;
6341 /// use wkt::Timestamp;
6342 /// let x = TrialConfig::new().set_or_clear_expire_time(Some(Timestamp::default()/* use setters */));
6343 /// let x = TrialConfig::new().set_or_clear_expire_time(None::<Timestamp>);
6344 /// ```
6345 pub fn set_or_clear_expire_time<T>(mut self, v: std::option::Option<T>) -> Self
6346 where
6347 T: std::convert::Into<wkt::Timestamp>,
6348 {
6349 self.expire_time = v.map(|x| x.into());
6350 self
6351 }
6352 }
6353
6354 impl wkt::message::Message for TrialConfig {
6355 fn typename() -> &'static str {
6356 "type.googleapis.com/google.storage.control.v2.IntelligenceConfig.TrialConfig"
6357 }
6358 }
6359
6360 /// The edition configuration of the `IntelligenceConfig` resource. This
6361 /// signifies the edition used for configuring the `IntelligenceConfig`
6362 /// resource and can only take the following values:
6363 /// `EDITION_CONFIG_UNSPECIFIED`, `INHERIT`, `DISABLED`, `STANDARD` and
6364 /// `EVALUATE`.
6365 ///
6366 /// # Working with unknown values
6367 ///
6368 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
6369 /// additional enum variants at any time. Adding new variants is not considered
6370 /// a breaking change. Applications should write their code in anticipation of:
6371 ///
6372 /// - New values appearing in future releases of the client library, **and**
6373 /// - New values received dynamically, without application changes.
6374 ///
6375 /// Please consult the [Working with enums] section in the user guide for some
6376 /// guidelines.
6377 ///
6378 /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
6379 #[derive(Clone, Debug, PartialEq)]
6380 #[non_exhaustive]
6381 pub enum EditionConfig {
6382 /// This is an unknown edition of the resource.
6383 Unspecified,
6384 /// The inherited edition from the parent and filters. This is the default
6385 /// edition when there is no `IntelligenceConfig` setup for a GCP resource.
6386 Inherit,
6387 /// The edition configuration is disabled for the `IntelligenceConfig`
6388 /// resource and its children. Filters are not applicable.
6389 Disabled,
6390 /// The `IntelligenceConfig` resource is of STANDARD edition.
6391 Standard,
6392 /// The `IntelligenceConfig` resource is available in `TRIAL` edition. During
6393 /// the trial period, Cloud Storage does not charge for Storage Intelligence
6394 /// usage. You can specify the buckets to include in the trial period by
6395 /// using filters. At the end of the trial period, the `IntelligenceConfig`
6396 /// resource is upgraded to `STANDARD` edition.
6397 Trial,
6398 /// The `IntelligenceConfig` resource is of ESSENTIALS edition.
6399 Essentials,
6400 /// If set, the enum was initialized with an unknown value.
6401 ///
6402 /// Applications can examine the value using [EditionConfig::value] or
6403 /// [EditionConfig::name].
6404 UnknownValue(edition_config::UnknownValue),
6405 }
6406
6407 #[doc(hidden)]
6408 pub mod edition_config {
6409 #[allow(unused_imports)]
6410 use super::*;
6411 #[derive(Clone, Debug, PartialEq)]
6412 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
6413 }
6414
6415 impl EditionConfig {
6416 /// Gets the enum value.
6417 ///
6418 /// Returns `None` if the enum contains an unknown value deserialized from
6419 /// the string representation of enums.
6420 pub fn value(&self) -> std::option::Option<i32> {
6421 match self {
6422 Self::Unspecified => std::option::Option::Some(0),
6423 Self::Inherit => std::option::Option::Some(1),
6424 Self::Disabled => std::option::Option::Some(2),
6425 Self::Standard => std::option::Option::Some(3),
6426 Self::Trial => std::option::Option::Some(5),
6427 Self::Essentials => std::option::Option::Some(6),
6428 Self::UnknownValue(u) => u.0.value(),
6429 }
6430 }
6431
6432 /// Gets the enum value as a string.
6433 ///
6434 /// Returns `None` if the enum contains an unknown value deserialized from
6435 /// the integer representation of enums.
6436 pub fn name(&self) -> std::option::Option<&str> {
6437 match self {
6438 Self::Unspecified => std::option::Option::Some("EDITION_CONFIG_UNSPECIFIED"),
6439 Self::Inherit => std::option::Option::Some("INHERIT"),
6440 Self::Disabled => std::option::Option::Some("DISABLED"),
6441 Self::Standard => std::option::Option::Some("STANDARD"),
6442 Self::Trial => std::option::Option::Some("TRIAL"),
6443 Self::Essentials => std::option::Option::Some("ESSENTIALS"),
6444 Self::UnknownValue(u) => u.0.name(),
6445 }
6446 }
6447 }
6448
6449 impl std::default::Default for EditionConfig {
6450 fn default() -> Self {
6451 use std::convert::From;
6452 Self::from(0)
6453 }
6454 }
6455
6456 impl std::fmt::Display for EditionConfig {
6457 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
6458 wkt::internal::display_enum(f, self.name(), self.value())
6459 }
6460 }
6461
6462 impl std::convert::From<i32> for EditionConfig {
6463 fn from(value: i32) -> Self {
6464 match value {
6465 0 => Self::Unspecified,
6466 1 => Self::Inherit,
6467 2 => Self::Disabled,
6468 3 => Self::Standard,
6469 5 => Self::Trial,
6470 6 => Self::Essentials,
6471 _ => Self::UnknownValue(edition_config::UnknownValue(
6472 wkt::internal::UnknownEnumValue::Integer(value),
6473 )),
6474 }
6475 }
6476 }
6477
6478 impl std::convert::From<&str> for EditionConfig {
6479 fn from(value: &str) -> Self {
6480 use std::string::ToString;
6481 match value {
6482 "EDITION_CONFIG_UNSPECIFIED" => Self::Unspecified,
6483 "INHERIT" => Self::Inherit,
6484 "DISABLED" => Self::Disabled,
6485 "STANDARD" => Self::Standard,
6486 "TRIAL" => Self::Trial,
6487 "ESSENTIALS" => Self::Essentials,
6488 _ => Self::UnknownValue(edition_config::UnknownValue(
6489 wkt::internal::UnknownEnumValue::String(value.to_string()),
6490 )),
6491 }
6492 }
6493 }
6494
6495 impl serde::ser::Serialize for EditionConfig {
6496 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
6497 where
6498 S: serde::Serializer,
6499 {
6500 match self {
6501 Self::Unspecified => serializer.serialize_i32(0),
6502 Self::Inherit => serializer.serialize_i32(1),
6503 Self::Disabled => serializer.serialize_i32(2),
6504 Self::Standard => serializer.serialize_i32(3),
6505 Self::Trial => serializer.serialize_i32(5),
6506 Self::Essentials => serializer.serialize_i32(6),
6507 Self::UnknownValue(u) => u.0.serialize(serializer),
6508 }
6509 }
6510 }
6511
6512 impl<'de> serde::de::Deserialize<'de> for EditionConfig {
6513 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
6514 where
6515 D: serde::Deserializer<'de>,
6516 {
6517 deserializer.deserialize_any(wkt::internal::EnumVisitor::<EditionConfig>::new(
6518 ".google.storage.control.v2.IntelligenceConfig.EditionConfig",
6519 ))
6520 }
6521 }
6522}
6523
6524/// Request message to update the `IntelligenceConfig` resource associated with
6525/// your organization.
6526#[derive(Clone, Default, PartialEq)]
6527#[non_exhaustive]
6528pub struct UpdateOrganizationIntelligenceConfigRequest {
6529 /// Required. The `IntelligenceConfig` resource to be updated.
6530 pub intelligence_config: std::option::Option<crate::model::IntelligenceConfig>,
6531
6532 /// Required. The `update_mask` that specifies the fields within the
6533 /// `IntelligenceConfig` resource that should be modified by this update. Only
6534 /// the listed fields are updated.
6535 pub update_mask: std::option::Option<wkt::FieldMask>,
6536
6537 /// Optional. The ID that uniquely identifies the request, preventing duplicate
6538 /// processing.
6539 pub request_id: std::string::String,
6540
6541 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
6542}
6543
6544impl UpdateOrganizationIntelligenceConfigRequest {
6545 /// Creates a new default instance.
6546 pub fn new() -> Self {
6547 std::default::Default::default()
6548 }
6549
6550 /// Sets the value of [intelligence_config][crate::model::UpdateOrganizationIntelligenceConfigRequest::intelligence_config].
6551 ///
6552 /// # Example
6553 /// ```ignore,no_run
6554 /// # use google_cloud_storage::model::UpdateOrganizationIntelligenceConfigRequest;
6555 /// use google_cloud_storage::model::IntelligenceConfig;
6556 /// let x = UpdateOrganizationIntelligenceConfigRequest::new().set_intelligence_config(IntelligenceConfig::default()/* use setters */);
6557 /// ```
6558 pub fn set_intelligence_config<T>(mut self, v: T) -> Self
6559 where
6560 T: std::convert::Into<crate::model::IntelligenceConfig>,
6561 {
6562 self.intelligence_config = std::option::Option::Some(v.into());
6563 self
6564 }
6565
6566 /// Sets or clears the value of [intelligence_config][crate::model::UpdateOrganizationIntelligenceConfigRequest::intelligence_config].
6567 ///
6568 /// # Example
6569 /// ```ignore,no_run
6570 /// # use google_cloud_storage::model::UpdateOrganizationIntelligenceConfigRequest;
6571 /// use google_cloud_storage::model::IntelligenceConfig;
6572 /// let x = UpdateOrganizationIntelligenceConfigRequest::new().set_or_clear_intelligence_config(Some(IntelligenceConfig::default()/* use setters */));
6573 /// let x = UpdateOrganizationIntelligenceConfigRequest::new().set_or_clear_intelligence_config(None::<IntelligenceConfig>);
6574 /// ```
6575 pub fn set_or_clear_intelligence_config<T>(mut self, v: std::option::Option<T>) -> Self
6576 where
6577 T: std::convert::Into<crate::model::IntelligenceConfig>,
6578 {
6579 self.intelligence_config = v.map(|x| x.into());
6580 self
6581 }
6582
6583 /// Sets the value of [update_mask][crate::model::UpdateOrganizationIntelligenceConfigRequest::update_mask].
6584 ///
6585 /// # Example
6586 /// ```ignore,no_run
6587 /// # use google_cloud_storage::model::UpdateOrganizationIntelligenceConfigRequest;
6588 /// use wkt::FieldMask;
6589 /// let x = UpdateOrganizationIntelligenceConfigRequest::new().set_update_mask(FieldMask::default()/* use setters */);
6590 /// ```
6591 pub fn set_update_mask<T>(mut self, v: T) -> Self
6592 where
6593 T: std::convert::Into<wkt::FieldMask>,
6594 {
6595 self.update_mask = std::option::Option::Some(v.into());
6596 self
6597 }
6598
6599 /// Sets or clears the value of [update_mask][crate::model::UpdateOrganizationIntelligenceConfigRequest::update_mask].
6600 ///
6601 /// # Example
6602 /// ```ignore,no_run
6603 /// # use google_cloud_storage::model::UpdateOrganizationIntelligenceConfigRequest;
6604 /// use wkt::FieldMask;
6605 /// let x = UpdateOrganizationIntelligenceConfigRequest::new().set_or_clear_update_mask(Some(FieldMask::default()/* use setters */));
6606 /// let x = UpdateOrganizationIntelligenceConfigRequest::new().set_or_clear_update_mask(None::<FieldMask>);
6607 /// ```
6608 pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
6609 where
6610 T: std::convert::Into<wkt::FieldMask>,
6611 {
6612 self.update_mask = v.map(|x| x.into());
6613 self
6614 }
6615
6616 /// Sets the value of [request_id][crate::model::UpdateOrganizationIntelligenceConfigRequest::request_id].
6617 ///
6618 /// # Example
6619 /// ```ignore,no_run
6620 /// # use google_cloud_storage::model::UpdateOrganizationIntelligenceConfigRequest;
6621 /// let x = UpdateOrganizationIntelligenceConfigRequest::new().set_request_id("example");
6622 /// ```
6623 pub fn set_request_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6624 self.request_id = v.into();
6625 self
6626 }
6627}
6628
6629impl wkt::message::Message for UpdateOrganizationIntelligenceConfigRequest {
6630 fn typename() -> &'static str {
6631 "type.googleapis.com/google.storage.control.v2.UpdateOrganizationIntelligenceConfigRequest"
6632 }
6633}
6634
6635/// Request message to update the `IntelligenceConfig` resource associated with
6636/// your folder.
6637#[derive(Clone, Default, PartialEq)]
6638#[non_exhaustive]
6639pub struct UpdateFolderIntelligenceConfigRequest {
6640 /// Required. The `IntelligenceConfig` resource to be updated.
6641 pub intelligence_config: std::option::Option<crate::model::IntelligenceConfig>,
6642
6643 /// Required. The `update_mask` that specifies the fields within the
6644 /// `IntelligenceConfig` resource that should be modified by this update. Only
6645 /// the listed fields are updated.
6646 pub update_mask: std::option::Option<wkt::FieldMask>,
6647
6648 /// Optional. The ID that uniquely identifies the request, preventing duplicate
6649 /// processing.
6650 pub request_id: std::string::String,
6651
6652 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
6653}
6654
6655impl UpdateFolderIntelligenceConfigRequest {
6656 /// Creates a new default instance.
6657 pub fn new() -> Self {
6658 std::default::Default::default()
6659 }
6660
6661 /// Sets the value of [intelligence_config][crate::model::UpdateFolderIntelligenceConfigRequest::intelligence_config].
6662 ///
6663 /// # Example
6664 /// ```ignore,no_run
6665 /// # use google_cloud_storage::model::UpdateFolderIntelligenceConfigRequest;
6666 /// use google_cloud_storage::model::IntelligenceConfig;
6667 /// let x = UpdateFolderIntelligenceConfigRequest::new().set_intelligence_config(IntelligenceConfig::default()/* use setters */);
6668 /// ```
6669 pub fn set_intelligence_config<T>(mut self, v: T) -> Self
6670 where
6671 T: std::convert::Into<crate::model::IntelligenceConfig>,
6672 {
6673 self.intelligence_config = std::option::Option::Some(v.into());
6674 self
6675 }
6676
6677 /// Sets or clears the value of [intelligence_config][crate::model::UpdateFolderIntelligenceConfigRequest::intelligence_config].
6678 ///
6679 /// # Example
6680 /// ```ignore,no_run
6681 /// # use google_cloud_storage::model::UpdateFolderIntelligenceConfigRequest;
6682 /// use google_cloud_storage::model::IntelligenceConfig;
6683 /// let x = UpdateFolderIntelligenceConfigRequest::new().set_or_clear_intelligence_config(Some(IntelligenceConfig::default()/* use setters */));
6684 /// let x = UpdateFolderIntelligenceConfigRequest::new().set_or_clear_intelligence_config(None::<IntelligenceConfig>);
6685 /// ```
6686 pub fn set_or_clear_intelligence_config<T>(mut self, v: std::option::Option<T>) -> Self
6687 where
6688 T: std::convert::Into<crate::model::IntelligenceConfig>,
6689 {
6690 self.intelligence_config = v.map(|x| x.into());
6691 self
6692 }
6693
6694 /// Sets the value of [update_mask][crate::model::UpdateFolderIntelligenceConfigRequest::update_mask].
6695 ///
6696 /// # Example
6697 /// ```ignore,no_run
6698 /// # use google_cloud_storage::model::UpdateFolderIntelligenceConfigRequest;
6699 /// use wkt::FieldMask;
6700 /// let x = UpdateFolderIntelligenceConfigRequest::new().set_update_mask(FieldMask::default()/* use setters */);
6701 /// ```
6702 pub fn set_update_mask<T>(mut self, v: T) -> Self
6703 where
6704 T: std::convert::Into<wkt::FieldMask>,
6705 {
6706 self.update_mask = std::option::Option::Some(v.into());
6707 self
6708 }
6709
6710 /// Sets or clears the value of [update_mask][crate::model::UpdateFolderIntelligenceConfigRequest::update_mask].
6711 ///
6712 /// # Example
6713 /// ```ignore,no_run
6714 /// # use google_cloud_storage::model::UpdateFolderIntelligenceConfigRequest;
6715 /// use wkt::FieldMask;
6716 /// let x = UpdateFolderIntelligenceConfigRequest::new().set_or_clear_update_mask(Some(FieldMask::default()/* use setters */));
6717 /// let x = UpdateFolderIntelligenceConfigRequest::new().set_or_clear_update_mask(None::<FieldMask>);
6718 /// ```
6719 pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
6720 where
6721 T: std::convert::Into<wkt::FieldMask>,
6722 {
6723 self.update_mask = v.map(|x| x.into());
6724 self
6725 }
6726
6727 /// Sets the value of [request_id][crate::model::UpdateFolderIntelligenceConfigRequest::request_id].
6728 ///
6729 /// # Example
6730 /// ```ignore,no_run
6731 /// # use google_cloud_storage::model::UpdateFolderIntelligenceConfigRequest;
6732 /// let x = UpdateFolderIntelligenceConfigRequest::new().set_request_id("example");
6733 /// ```
6734 pub fn set_request_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6735 self.request_id = v.into();
6736 self
6737 }
6738}
6739
6740impl wkt::message::Message for UpdateFolderIntelligenceConfigRequest {
6741 fn typename() -> &'static str {
6742 "type.googleapis.com/google.storage.control.v2.UpdateFolderIntelligenceConfigRequest"
6743 }
6744}
6745
6746/// Request message to update the `IntelligenceConfig` resource associated with
6747/// your project.
6748#[derive(Clone, Default, PartialEq)]
6749#[non_exhaustive]
6750pub struct UpdateProjectIntelligenceConfigRequest {
6751 /// Required. The `IntelligenceConfig` resource to be updated.
6752 pub intelligence_config: std::option::Option<crate::model::IntelligenceConfig>,
6753
6754 /// Required. The `update_mask` that specifies the fields within the
6755 /// `IntelligenceConfig` resource that should be modified by this update. Only
6756 /// the listed fields are updated.
6757 pub update_mask: std::option::Option<wkt::FieldMask>,
6758
6759 /// Optional. The ID that uniquely identifies the request, preventing duplicate
6760 /// processing.
6761 pub request_id: std::string::String,
6762
6763 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
6764}
6765
6766impl UpdateProjectIntelligenceConfigRequest {
6767 /// Creates a new default instance.
6768 pub fn new() -> Self {
6769 std::default::Default::default()
6770 }
6771
6772 /// Sets the value of [intelligence_config][crate::model::UpdateProjectIntelligenceConfigRequest::intelligence_config].
6773 ///
6774 /// # Example
6775 /// ```ignore,no_run
6776 /// # use google_cloud_storage::model::UpdateProjectIntelligenceConfigRequest;
6777 /// use google_cloud_storage::model::IntelligenceConfig;
6778 /// let x = UpdateProjectIntelligenceConfigRequest::new().set_intelligence_config(IntelligenceConfig::default()/* use setters */);
6779 /// ```
6780 pub fn set_intelligence_config<T>(mut self, v: T) -> Self
6781 where
6782 T: std::convert::Into<crate::model::IntelligenceConfig>,
6783 {
6784 self.intelligence_config = std::option::Option::Some(v.into());
6785 self
6786 }
6787
6788 /// Sets or clears the value of [intelligence_config][crate::model::UpdateProjectIntelligenceConfigRequest::intelligence_config].
6789 ///
6790 /// # Example
6791 /// ```ignore,no_run
6792 /// # use google_cloud_storage::model::UpdateProjectIntelligenceConfigRequest;
6793 /// use google_cloud_storage::model::IntelligenceConfig;
6794 /// let x = UpdateProjectIntelligenceConfigRequest::new().set_or_clear_intelligence_config(Some(IntelligenceConfig::default()/* use setters */));
6795 /// let x = UpdateProjectIntelligenceConfigRequest::new().set_or_clear_intelligence_config(None::<IntelligenceConfig>);
6796 /// ```
6797 pub fn set_or_clear_intelligence_config<T>(mut self, v: std::option::Option<T>) -> Self
6798 where
6799 T: std::convert::Into<crate::model::IntelligenceConfig>,
6800 {
6801 self.intelligence_config = v.map(|x| x.into());
6802 self
6803 }
6804
6805 /// Sets the value of [update_mask][crate::model::UpdateProjectIntelligenceConfigRequest::update_mask].
6806 ///
6807 /// # Example
6808 /// ```ignore,no_run
6809 /// # use google_cloud_storage::model::UpdateProjectIntelligenceConfigRequest;
6810 /// use wkt::FieldMask;
6811 /// let x = UpdateProjectIntelligenceConfigRequest::new().set_update_mask(FieldMask::default()/* use setters */);
6812 /// ```
6813 pub fn set_update_mask<T>(mut self, v: T) -> Self
6814 where
6815 T: std::convert::Into<wkt::FieldMask>,
6816 {
6817 self.update_mask = std::option::Option::Some(v.into());
6818 self
6819 }
6820
6821 /// Sets or clears the value of [update_mask][crate::model::UpdateProjectIntelligenceConfigRequest::update_mask].
6822 ///
6823 /// # Example
6824 /// ```ignore,no_run
6825 /// # use google_cloud_storage::model::UpdateProjectIntelligenceConfigRequest;
6826 /// use wkt::FieldMask;
6827 /// let x = UpdateProjectIntelligenceConfigRequest::new().set_or_clear_update_mask(Some(FieldMask::default()/* use setters */));
6828 /// let x = UpdateProjectIntelligenceConfigRequest::new().set_or_clear_update_mask(None::<FieldMask>);
6829 /// ```
6830 pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
6831 where
6832 T: std::convert::Into<wkt::FieldMask>,
6833 {
6834 self.update_mask = v.map(|x| x.into());
6835 self
6836 }
6837
6838 /// Sets the value of [request_id][crate::model::UpdateProjectIntelligenceConfigRequest::request_id].
6839 ///
6840 /// # Example
6841 /// ```ignore,no_run
6842 /// # use google_cloud_storage::model::UpdateProjectIntelligenceConfigRequest;
6843 /// let x = UpdateProjectIntelligenceConfigRequest::new().set_request_id("example");
6844 /// ```
6845 pub fn set_request_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6846 self.request_id = v.into();
6847 self
6848 }
6849}
6850
6851impl wkt::message::Message for UpdateProjectIntelligenceConfigRequest {
6852 fn typename() -> &'static str {
6853 "type.googleapis.com/google.storage.control.v2.UpdateProjectIntelligenceConfigRequest"
6854 }
6855}
6856
6857/// Request message to get the `IntelligenceConfig` resource associated with your
6858/// organization.
6859#[derive(Clone, Default, PartialEq)]
6860#[non_exhaustive]
6861pub struct GetOrganizationIntelligenceConfigRequest {
6862 /// Required. The name of the `IntelligenceConfig` resource associated with
6863 /// your organization.
6864 ///
6865 /// Format: `organizations/{org_id}/locations/global/intelligenceConfig`
6866 pub name: std::string::String,
6867
6868 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
6869}
6870
6871impl GetOrganizationIntelligenceConfigRequest {
6872 /// Creates a new default instance.
6873 pub fn new() -> Self {
6874 std::default::Default::default()
6875 }
6876
6877 /// Sets the value of [name][crate::model::GetOrganizationIntelligenceConfigRequest::name].
6878 ///
6879 /// # Example
6880 /// ```ignore,no_run
6881 /// # use google_cloud_storage::model::GetOrganizationIntelligenceConfigRequest;
6882 /// # let folder_id = "folder_id";
6883 /// # let location_id = "location_id";
6884 /// let x = GetOrganizationIntelligenceConfigRequest::new().set_name(format!("folders/{folder_id}/locations/{location_id}/intelligenceConfig"));
6885 /// ```
6886 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6887 self.name = v.into();
6888 self
6889 }
6890}
6891
6892impl wkt::message::Message for GetOrganizationIntelligenceConfigRequest {
6893 fn typename() -> &'static str {
6894 "type.googleapis.com/google.storage.control.v2.GetOrganizationIntelligenceConfigRequest"
6895 }
6896}
6897
6898/// Request message to get the `IntelligenceConfig` resource associated with your
6899/// folder.
6900#[derive(Clone, Default, PartialEq)]
6901#[non_exhaustive]
6902pub struct GetFolderIntelligenceConfigRequest {
6903 /// Required. The name of the `IntelligenceConfig` resource associated with
6904 /// your folder.
6905 ///
6906 /// Format: `folders/{id}/locations/global/intelligenceConfig`
6907 pub name: std::string::String,
6908
6909 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
6910}
6911
6912impl GetFolderIntelligenceConfigRequest {
6913 /// Creates a new default instance.
6914 pub fn new() -> Self {
6915 std::default::Default::default()
6916 }
6917
6918 /// Sets the value of [name][crate::model::GetFolderIntelligenceConfigRequest::name].
6919 ///
6920 /// # Example
6921 /// ```ignore,no_run
6922 /// # use google_cloud_storage::model::GetFolderIntelligenceConfigRequest;
6923 /// # let folder_id = "folder_id";
6924 /// # let location_id = "location_id";
6925 /// let x = GetFolderIntelligenceConfigRequest::new().set_name(format!("folders/{folder_id}/locations/{location_id}/intelligenceConfig"));
6926 /// ```
6927 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6928 self.name = v.into();
6929 self
6930 }
6931}
6932
6933impl wkt::message::Message for GetFolderIntelligenceConfigRequest {
6934 fn typename() -> &'static str {
6935 "type.googleapis.com/google.storage.control.v2.GetFolderIntelligenceConfigRequest"
6936 }
6937}
6938
6939/// Request message to get the `IntelligenceConfig` resource associated with your
6940/// project.
6941#[derive(Clone, Default, PartialEq)]
6942#[non_exhaustive]
6943pub struct GetProjectIntelligenceConfigRequest {
6944 /// Required. The name of the `IntelligenceConfig` resource associated with
6945 /// your project.
6946 ///
6947 /// Format: `projects/{id}/locations/global/intelligenceConfig`
6948 pub name: std::string::String,
6949
6950 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
6951}
6952
6953impl GetProjectIntelligenceConfigRequest {
6954 /// Creates a new default instance.
6955 pub fn new() -> Self {
6956 std::default::Default::default()
6957 }
6958
6959 /// Sets the value of [name][crate::model::GetProjectIntelligenceConfigRequest::name].
6960 ///
6961 /// # Example
6962 /// ```ignore,no_run
6963 /// # use google_cloud_storage::model::GetProjectIntelligenceConfigRequest;
6964 /// # let folder_id = "folder_id";
6965 /// # let location_id = "location_id";
6966 /// let x = GetProjectIntelligenceConfigRequest::new().set_name(format!("folders/{folder_id}/locations/{location_id}/intelligenceConfig"));
6967 /// ```
6968 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6969 self.name = v.into();
6970 self
6971 }
6972}
6973
6974impl wkt::message::Message for GetProjectIntelligenceConfigRequest {
6975 fn typename() -> &'static str {
6976 "type.googleapis.com/google.storage.control.v2.GetProjectIntelligenceConfigRequest"
6977 }
6978}
6979
6980/// The `IntelligenceFinding` resource that represents a security, performance,
6981/// or cost-related finding about a project or bucket.
6982#[derive(Clone, Default, PartialEq)]
6983#[non_exhaustive]
6984pub struct IntelligenceFinding {
6985 /// Identifier. The resource name of `IntelligenceFinding`.
6986 /// Format:
6987 /// `projects/{project}/locations/{location}/intelligenceFindings/{intelligence_finding}`
6988 pub name: std::string::String,
6989
6990 /// Output only. A short description about the finding.
6991 pub description: std::string::String,
6992
6993 /// Output only. Type of this finding.
6994 pub r#type: crate::model::FindingType,
6995
6996 /// Output only. Category of this finding.
6997 pub category: crate::model::FindingCategory,
6998
6999 /// Output only. Severity of the finding.
7000 pub severity: crate::model::FindingSeverity,
7001
7002 /// Output only. The time at which the finding was created.
7003 pub create_time: std::option::Option<wkt::Timestamp>,
7004
7005 /// Output only. The time at which the finding was last updated.
7006 pub update_time: std::option::Option<wkt::Timestamp>,
7007
7008 /// Output only. The fully qualified resource name of the resource that this
7009 /// `IntelligenceFinding` applies to. eg:
7010 ///
7011 /// - `storage.googleapis.com/projects/_/buckets/b1`
7012 /// - `cloudresourecemanager.googleapis.com/projects/p1`
7013 pub target_resource: std::string::String,
7014
7015 /// Output only. Contains GCP resource names that are
7016 /// relevant to this `IntelligenceFinding`. The `target_resource` is also added
7017 /// as part of `associated_resources`. eg:
7018 ///
7019 /// - `storage.googleapis.com/projects/_/buckets/b1`
7020 /// - `cloudresourecemanager.googleapis.com/projects/p1`
7021 pub associated_resources: std::vec::Vec<std::string::String>,
7022
7023 /// Output only. The time interval during which the underlying data was used to
7024 /// generate this `IntelligenceFinding`.
7025 pub observation_period: std::option::Option<google_cloud_type::model::Interval>,
7026
7027 /// The specific details of the `IntelligenceFinding`.
7028 pub intelligence_finding_details:
7029 std::option::Option<crate::model::intelligence_finding::IntelligenceFindingDetails>,
7030
7031 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
7032}
7033
7034impl IntelligenceFinding {
7035 /// Creates a new default instance.
7036 pub fn new() -> Self {
7037 std::default::Default::default()
7038 }
7039
7040 /// Sets the value of [name][crate::model::IntelligenceFinding::name].
7041 ///
7042 /// # Example
7043 /// ```ignore,no_run
7044 /// # use google_cloud_storage::model::IntelligenceFinding;
7045 /// # let project_id = "project_id";
7046 /// # let location_id = "location_id";
7047 /// # let intelligence_finding_id = "intelligence_finding_id";
7048 /// let x = IntelligenceFinding::new().set_name(format!("projects/{project_id}/locations/{location_id}/intelligenceFindings/{intelligence_finding_id}"));
7049 /// ```
7050 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
7051 self.name = v.into();
7052 self
7053 }
7054
7055 /// Sets the value of [description][crate::model::IntelligenceFinding::description].
7056 ///
7057 /// # Example
7058 /// ```ignore,no_run
7059 /// # use google_cloud_storage::model::IntelligenceFinding;
7060 /// let x = IntelligenceFinding::new().set_description("example");
7061 /// ```
7062 pub fn set_description<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
7063 self.description = v.into();
7064 self
7065 }
7066
7067 /// Sets the value of [r#type][crate::model::IntelligenceFinding::type].
7068 ///
7069 /// # Example
7070 /// ```ignore,no_run
7071 /// # use google_cloud_storage::model::IntelligenceFinding;
7072 /// use google_cloud_storage::model::FindingType;
7073 /// let x0 = IntelligenceFinding::new().set_type(FindingType::ColdlineAndArchivalStorageOperationsSpike);
7074 /// let x1 = IntelligenceFinding::new().set_type(FindingType::ThrottledRequestSpike);
7075 /// let x2 = IntelligenceFinding::new().set_type(FindingType::CrossRegionEgressSpike);
7076 /// ```
7077 pub fn set_type<T: std::convert::Into<crate::model::FindingType>>(mut self, v: T) -> Self {
7078 self.r#type = v.into();
7079 self
7080 }
7081
7082 /// Sets the value of [category][crate::model::IntelligenceFinding::category].
7083 ///
7084 /// # Example
7085 /// ```ignore,no_run
7086 /// # use google_cloud_storage::model::IntelligenceFinding;
7087 /// use google_cloud_storage::model::FindingCategory;
7088 /// let x0 = IntelligenceFinding::new().set_category(FindingCategory::DataManagement);
7089 /// let x1 = IntelligenceFinding::new().set_category(FindingCategory::Performance);
7090 /// ```
7091 pub fn set_category<T: std::convert::Into<crate::model::FindingCategory>>(
7092 mut self,
7093 v: T,
7094 ) -> Self {
7095 self.category = v.into();
7096 self
7097 }
7098
7099 /// Sets the value of [severity][crate::model::IntelligenceFinding::severity].
7100 ///
7101 /// # Example
7102 /// ```ignore,no_run
7103 /// # use google_cloud_storage::model::IntelligenceFinding;
7104 /// use google_cloud_storage::model::FindingSeverity;
7105 /// let x0 = IntelligenceFinding::new().set_severity(FindingSeverity::Critical);
7106 /// ```
7107 pub fn set_severity<T: std::convert::Into<crate::model::FindingSeverity>>(
7108 mut self,
7109 v: T,
7110 ) -> Self {
7111 self.severity = v.into();
7112 self
7113 }
7114
7115 /// Sets the value of [create_time][crate::model::IntelligenceFinding::create_time].
7116 ///
7117 /// # Example
7118 /// ```ignore,no_run
7119 /// # use google_cloud_storage::model::IntelligenceFinding;
7120 /// use wkt::Timestamp;
7121 /// let x = IntelligenceFinding::new().set_create_time(Timestamp::default()/* use setters */);
7122 /// ```
7123 pub fn set_create_time<T>(mut self, v: T) -> Self
7124 where
7125 T: std::convert::Into<wkt::Timestamp>,
7126 {
7127 self.create_time = std::option::Option::Some(v.into());
7128 self
7129 }
7130
7131 /// Sets or clears the value of [create_time][crate::model::IntelligenceFinding::create_time].
7132 ///
7133 /// # Example
7134 /// ```ignore,no_run
7135 /// # use google_cloud_storage::model::IntelligenceFinding;
7136 /// use wkt::Timestamp;
7137 /// let x = IntelligenceFinding::new().set_or_clear_create_time(Some(Timestamp::default()/* use setters */));
7138 /// let x = IntelligenceFinding::new().set_or_clear_create_time(None::<Timestamp>);
7139 /// ```
7140 pub fn set_or_clear_create_time<T>(mut self, v: std::option::Option<T>) -> Self
7141 where
7142 T: std::convert::Into<wkt::Timestamp>,
7143 {
7144 self.create_time = v.map(|x| x.into());
7145 self
7146 }
7147
7148 /// Sets the value of [update_time][crate::model::IntelligenceFinding::update_time].
7149 ///
7150 /// # Example
7151 /// ```ignore,no_run
7152 /// # use google_cloud_storage::model::IntelligenceFinding;
7153 /// use wkt::Timestamp;
7154 /// let x = IntelligenceFinding::new().set_update_time(Timestamp::default()/* use setters */);
7155 /// ```
7156 pub fn set_update_time<T>(mut self, v: T) -> Self
7157 where
7158 T: std::convert::Into<wkt::Timestamp>,
7159 {
7160 self.update_time = std::option::Option::Some(v.into());
7161 self
7162 }
7163
7164 /// Sets or clears the value of [update_time][crate::model::IntelligenceFinding::update_time].
7165 ///
7166 /// # Example
7167 /// ```ignore,no_run
7168 /// # use google_cloud_storage::model::IntelligenceFinding;
7169 /// use wkt::Timestamp;
7170 /// let x = IntelligenceFinding::new().set_or_clear_update_time(Some(Timestamp::default()/* use setters */));
7171 /// let x = IntelligenceFinding::new().set_or_clear_update_time(None::<Timestamp>);
7172 /// ```
7173 pub fn set_or_clear_update_time<T>(mut self, v: std::option::Option<T>) -> Self
7174 where
7175 T: std::convert::Into<wkt::Timestamp>,
7176 {
7177 self.update_time = v.map(|x| x.into());
7178 self
7179 }
7180
7181 /// Sets the value of [target_resource][crate::model::IntelligenceFinding::target_resource].
7182 ///
7183 /// # Example
7184 /// ```ignore,no_run
7185 /// # use google_cloud_storage::model::IntelligenceFinding;
7186 /// let x = IntelligenceFinding::new().set_target_resource("example");
7187 /// ```
7188 pub fn set_target_resource<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
7189 self.target_resource = v.into();
7190 self
7191 }
7192
7193 /// Sets the value of [associated_resources][crate::model::IntelligenceFinding::associated_resources].
7194 ///
7195 /// # Example
7196 /// ```ignore,no_run
7197 /// # use google_cloud_storage::model::IntelligenceFinding;
7198 /// let x = IntelligenceFinding::new().set_associated_resources(["a", "b", "c"]);
7199 /// ```
7200 pub fn set_associated_resources<T, V>(mut self, v: T) -> Self
7201 where
7202 T: std::iter::IntoIterator<Item = V>,
7203 V: std::convert::Into<std::string::String>,
7204 {
7205 use std::iter::Iterator;
7206 self.associated_resources = v.into_iter().map(|i| i.into()).collect();
7207 self
7208 }
7209
7210 /// Sets the value of [observation_period][crate::model::IntelligenceFinding::observation_period].
7211 ///
7212 /// # Example
7213 /// ```ignore,no_run
7214 /// # use google_cloud_storage::model::IntelligenceFinding;
7215 /// use google_cloud_type::model::Interval;
7216 /// let x = IntelligenceFinding::new().set_observation_period(Interval::default()/* use setters */);
7217 /// ```
7218 pub fn set_observation_period<T>(mut self, v: T) -> Self
7219 where
7220 T: std::convert::Into<google_cloud_type::model::Interval>,
7221 {
7222 self.observation_period = std::option::Option::Some(v.into());
7223 self
7224 }
7225
7226 /// Sets or clears the value of [observation_period][crate::model::IntelligenceFinding::observation_period].
7227 ///
7228 /// # Example
7229 /// ```ignore,no_run
7230 /// # use google_cloud_storage::model::IntelligenceFinding;
7231 /// use google_cloud_type::model::Interval;
7232 /// let x = IntelligenceFinding::new().set_or_clear_observation_period(Some(Interval::default()/* use setters */));
7233 /// let x = IntelligenceFinding::new().set_or_clear_observation_period(None::<Interval>);
7234 /// ```
7235 pub fn set_or_clear_observation_period<T>(mut self, v: std::option::Option<T>) -> Self
7236 where
7237 T: std::convert::Into<google_cloud_type::model::Interval>,
7238 {
7239 self.observation_period = v.map(|x| x.into());
7240 self
7241 }
7242
7243 /// Sets the value of [intelligence_finding_details][crate::model::IntelligenceFinding::intelligence_finding_details].
7244 ///
7245 /// Note that all the setters affecting `intelligence_finding_details` are mutually
7246 /// exclusive.
7247 ///
7248 /// # Example
7249 /// ```ignore,no_run
7250 /// # use google_cloud_storage::model::IntelligenceFinding;
7251 /// use google_cloud_storage::model::intelligence_finding::ColdlineAndArchivalStorageOperationsSpike;
7252 /// let x = IntelligenceFinding::new().set_intelligence_finding_details(Some(
7253 /// google_cloud_storage::model::intelligence_finding::IntelligenceFindingDetails::ColdlineAndArchivalStorageOperationsSpike(ColdlineAndArchivalStorageOperationsSpike::default().into())));
7254 /// ```
7255 pub fn set_intelligence_finding_details<
7256 T: std::convert::Into<
7257 std::option::Option<crate::model::intelligence_finding::IntelligenceFindingDetails>,
7258 >,
7259 >(
7260 mut self,
7261 v: T,
7262 ) -> Self {
7263 self.intelligence_finding_details = v.into();
7264 self
7265 }
7266
7267 /// The value of [intelligence_finding_details][crate::model::IntelligenceFinding::intelligence_finding_details]
7268 /// if it holds a `ColdlineAndArchivalStorageOperationsSpike`, `None` if the field is not set or
7269 /// holds a different branch.
7270 pub fn coldline_and_archival_storage_operations_spike(
7271 &self,
7272 ) -> std::option::Option<
7273 &std::boxed::Box<
7274 crate::model::intelligence_finding::ColdlineAndArchivalStorageOperationsSpike,
7275 >,
7276 > {
7277 #[allow(unreachable_patterns)]
7278 self.intelligence_finding_details.as_ref().and_then(|v| match v {
7279 crate::model::intelligence_finding::IntelligenceFindingDetails::ColdlineAndArchivalStorageOperationsSpike(v) => std::option::Option::Some(v),
7280 _ => std::option::Option::None,
7281 })
7282 }
7283
7284 /// Sets the value of [intelligence_finding_details][crate::model::IntelligenceFinding::intelligence_finding_details]
7285 /// to hold a `ColdlineAndArchivalStorageOperationsSpike`.
7286 ///
7287 /// Note that all the setters affecting `intelligence_finding_details` are
7288 /// mutually exclusive.
7289 ///
7290 /// # Example
7291 /// ```ignore,no_run
7292 /// # use google_cloud_storage::model::IntelligenceFinding;
7293 /// use google_cloud_storage::model::intelligence_finding::ColdlineAndArchivalStorageOperationsSpike;
7294 /// let x = IntelligenceFinding::new().set_coldline_and_archival_storage_operations_spike(ColdlineAndArchivalStorageOperationsSpike::default()/* use setters */);
7295 /// assert!(x.coldline_and_archival_storage_operations_spike().is_some());
7296 /// assert!(x.throttled_requests_spike().is_none());
7297 /// assert!(x.cross_region_egress_spike().is_none());
7298 /// assert!(x.storage_growth_above_trend().is_none());
7299 /// ```
7300 pub fn set_coldline_and_archival_storage_operations_spike<
7301 T: std::convert::Into<
7302 std::boxed::Box<
7303 crate::model::intelligence_finding::ColdlineAndArchivalStorageOperationsSpike,
7304 >,
7305 >,
7306 >(
7307 mut self,
7308 v: T,
7309 ) -> Self {
7310 self.intelligence_finding_details = std::option::Option::Some(
7311 crate::model::intelligence_finding::IntelligenceFindingDetails::ColdlineAndArchivalStorageOperationsSpike(
7312 v.into()
7313 )
7314 );
7315 self
7316 }
7317
7318 /// The value of [intelligence_finding_details][crate::model::IntelligenceFinding::intelligence_finding_details]
7319 /// if it holds a `ThrottledRequestsSpike`, `None` if the field is not set or
7320 /// holds a different branch.
7321 pub fn throttled_requests_spike(
7322 &self,
7323 ) -> std::option::Option<
7324 &std::boxed::Box<crate::model::intelligence_finding::ThrottledRequestSpike>,
7325 > {
7326 #[allow(unreachable_patterns)]
7327 self.intelligence_finding_details.as_ref().and_then(|v| match v {
7328 crate::model::intelligence_finding::IntelligenceFindingDetails::ThrottledRequestsSpike(v) => std::option::Option::Some(v),
7329 _ => std::option::Option::None,
7330 })
7331 }
7332
7333 /// Sets the value of [intelligence_finding_details][crate::model::IntelligenceFinding::intelligence_finding_details]
7334 /// to hold a `ThrottledRequestsSpike`.
7335 ///
7336 /// Note that all the setters affecting `intelligence_finding_details` are
7337 /// mutually exclusive.
7338 ///
7339 /// # Example
7340 /// ```ignore,no_run
7341 /// # use google_cloud_storage::model::IntelligenceFinding;
7342 /// use google_cloud_storage::model::intelligence_finding::ThrottledRequestSpike;
7343 /// let x = IntelligenceFinding::new().set_throttled_requests_spike(ThrottledRequestSpike::default()/* use setters */);
7344 /// assert!(x.throttled_requests_spike().is_some());
7345 /// assert!(x.coldline_and_archival_storage_operations_spike().is_none());
7346 /// assert!(x.cross_region_egress_spike().is_none());
7347 /// assert!(x.storage_growth_above_trend().is_none());
7348 /// ```
7349 pub fn set_throttled_requests_spike<
7350 T: std::convert::Into<
7351 std::boxed::Box<crate::model::intelligence_finding::ThrottledRequestSpike>,
7352 >,
7353 >(
7354 mut self,
7355 v: T,
7356 ) -> Self {
7357 self.intelligence_finding_details = std::option::Option::Some(
7358 crate::model::intelligence_finding::IntelligenceFindingDetails::ThrottledRequestsSpike(
7359 v.into(),
7360 ),
7361 );
7362 self
7363 }
7364
7365 /// The value of [intelligence_finding_details][crate::model::IntelligenceFinding::intelligence_finding_details]
7366 /// if it holds a `CrossRegionEgressSpike`, `None` if the field is not set or
7367 /// holds a different branch.
7368 pub fn cross_region_egress_spike(
7369 &self,
7370 ) -> std::option::Option<
7371 &std::boxed::Box<crate::model::intelligence_finding::CrossRegionEgressSpike>,
7372 > {
7373 #[allow(unreachable_patterns)]
7374 self.intelligence_finding_details.as_ref().and_then(|v| match v {
7375 crate::model::intelligence_finding::IntelligenceFindingDetails::CrossRegionEgressSpike(v) => std::option::Option::Some(v),
7376 _ => std::option::Option::None,
7377 })
7378 }
7379
7380 /// Sets the value of [intelligence_finding_details][crate::model::IntelligenceFinding::intelligence_finding_details]
7381 /// to hold a `CrossRegionEgressSpike`.
7382 ///
7383 /// Note that all the setters affecting `intelligence_finding_details` are
7384 /// mutually exclusive.
7385 ///
7386 /// # Example
7387 /// ```ignore,no_run
7388 /// # use google_cloud_storage::model::IntelligenceFinding;
7389 /// use google_cloud_storage::model::intelligence_finding::CrossRegionEgressSpike;
7390 /// let x = IntelligenceFinding::new().set_cross_region_egress_spike(CrossRegionEgressSpike::default()/* use setters */);
7391 /// assert!(x.cross_region_egress_spike().is_some());
7392 /// assert!(x.coldline_and_archival_storage_operations_spike().is_none());
7393 /// assert!(x.throttled_requests_spike().is_none());
7394 /// assert!(x.storage_growth_above_trend().is_none());
7395 /// ```
7396 pub fn set_cross_region_egress_spike<
7397 T: std::convert::Into<
7398 std::boxed::Box<crate::model::intelligence_finding::CrossRegionEgressSpike>,
7399 >,
7400 >(
7401 mut self,
7402 v: T,
7403 ) -> Self {
7404 self.intelligence_finding_details = std::option::Option::Some(
7405 crate::model::intelligence_finding::IntelligenceFindingDetails::CrossRegionEgressSpike(
7406 v.into(),
7407 ),
7408 );
7409 self
7410 }
7411
7412 /// The value of [intelligence_finding_details][crate::model::IntelligenceFinding::intelligence_finding_details]
7413 /// if it holds a `StorageGrowthAboveTrend`, `None` if the field is not set or
7414 /// holds a different branch.
7415 pub fn storage_growth_above_trend(
7416 &self,
7417 ) -> std::option::Option<
7418 &std::boxed::Box<crate::model::intelligence_finding::StorageGrowthAboveTrend>,
7419 > {
7420 #[allow(unreachable_patterns)]
7421 self.intelligence_finding_details.as_ref().and_then(|v| match v {
7422 crate::model::intelligence_finding::IntelligenceFindingDetails::StorageGrowthAboveTrend(v) => std::option::Option::Some(v),
7423 _ => std::option::Option::None,
7424 })
7425 }
7426
7427 /// Sets the value of [intelligence_finding_details][crate::model::IntelligenceFinding::intelligence_finding_details]
7428 /// to hold a `StorageGrowthAboveTrend`.
7429 ///
7430 /// Note that all the setters affecting `intelligence_finding_details` are
7431 /// mutually exclusive.
7432 ///
7433 /// # Example
7434 /// ```ignore,no_run
7435 /// # use google_cloud_storage::model::IntelligenceFinding;
7436 /// use google_cloud_storage::model::intelligence_finding::StorageGrowthAboveTrend;
7437 /// let x = IntelligenceFinding::new().set_storage_growth_above_trend(StorageGrowthAboveTrend::default()/* use setters */);
7438 /// assert!(x.storage_growth_above_trend().is_some());
7439 /// assert!(x.coldline_and_archival_storage_operations_spike().is_none());
7440 /// assert!(x.throttled_requests_spike().is_none());
7441 /// assert!(x.cross_region_egress_spike().is_none());
7442 /// ```
7443 pub fn set_storage_growth_above_trend<
7444 T: std::convert::Into<
7445 std::boxed::Box<crate::model::intelligence_finding::StorageGrowthAboveTrend>,
7446 >,
7447 >(
7448 mut self,
7449 v: T,
7450 ) -> Self {
7451 self.intelligence_finding_details = std::option::Option::Some(
7452 crate::model::intelligence_finding::IntelligenceFindingDetails::StorageGrowthAboveTrend(
7453 v.into(),
7454 ),
7455 );
7456 self
7457 }
7458}
7459
7460impl wkt::message::Message for IntelligenceFinding {
7461 fn typename() -> &'static str {
7462 "type.googleapis.com/google.storage.control.v2.IntelligenceFinding"
7463 }
7464}
7465
7466/// Defines additional types related to [IntelligenceFinding].
7467pub mod intelligence_finding {
7468 #[allow(unused_imports)]
7469 use super::*;
7470
7471 /// Represents a finding about a spike in Class A/B operations on Coldline
7472 /// or Archive Cloud Storage objects.
7473 /// This corresponds to the `COLD_AND_ARCHIVAL_STORAGE_OPERATIONS_SPIKE`
7474 /// finding type.
7475 #[derive(Clone, Default, PartialEq)]
7476 #[non_exhaustive]
7477 pub struct ColdlineAndArchivalStorageOperationsSpike {
7478
7479 /// Output only. The percentage increase in operations across the project.
7480 pub percentage_increase: f64,
7481
7482 /// Output only. The total count of operations across the project.
7483 pub total_operations_count: i64,
7484
7485 /// Output only. A list of the top buckets driving the increase in
7486 /// operations.
7487 pub top_buckets: std::vec::Vec<crate::model::intelligence_finding::coldline_and_archival_storage_operations_spike::BucketContribution>,
7488
7489 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
7490 }
7491
7492 impl ColdlineAndArchivalStorageOperationsSpike {
7493 /// Creates a new default instance.
7494 pub fn new() -> Self {
7495 std::default::Default::default()
7496 }
7497
7498 /// Sets the value of [percentage_increase][crate::model::intelligence_finding::ColdlineAndArchivalStorageOperationsSpike::percentage_increase].
7499 ///
7500 /// # Example
7501 /// ```ignore,no_run
7502 /// # use google_cloud_storage::model::intelligence_finding::ColdlineAndArchivalStorageOperationsSpike;
7503 /// let x = ColdlineAndArchivalStorageOperationsSpike::new().set_percentage_increase(42.0);
7504 /// ```
7505 pub fn set_percentage_increase<T: std::convert::Into<f64>>(mut self, v: T) -> Self {
7506 self.percentage_increase = v.into();
7507 self
7508 }
7509
7510 /// Sets the value of [total_operations_count][crate::model::intelligence_finding::ColdlineAndArchivalStorageOperationsSpike::total_operations_count].
7511 ///
7512 /// # Example
7513 /// ```ignore,no_run
7514 /// # use google_cloud_storage::model::intelligence_finding::ColdlineAndArchivalStorageOperationsSpike;
7515 /// let x = ColdlineAndArchivalStorageOperationsSpike::new().set_total_operations_count(42);
7516 /// ```
7517 pub fn set_total_operations_count<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
7518 self.total_operations_count = v.into();
7519 self
7520 }
7521
7522 /// Sets the value of [top_buckets][crate::model::intelligence_finding::ColdlineAndArchivalStorageOperationsSpike::top_buckets].
7523 ///
7524 /// # Example
7525 /// ```ignore,no_run
7526 /// # use google_cloud_storage::model::intelligence_finding::ColdlineAndArchivalStorageOperationsSpike;
7527 /// use google_cloud_storage::model::intelligence_finding::coldline_and_archival_storage_operations_spike::BucketContribution;
7528 /// let x = ColdlineAndArchivalStorageOperationsSpike::new()
7529 /// .set_top_buckets([
7530 /// BucketContribution::default()/* use setters */,
7531 /// BucketContribution::default()/* use (different) setters */,
7532 /// ]);
7533 /// ```
7534 pub fn set_top_buckets<T, V>(mut self, v: T) -> Self
7535 where
7536 T: std::iter::IntoIterator<Item = V>,
7537 V: std::convert::Into<crate::model::intelligence_finding::coldline_and_archival_storage_operations_spike::BucketContribution>
7538 {
7539 use std::iter::Iterator;
7540 self.top_buckets = v.into_iter().map(|i| i.into()).collect();
7541 self
7542 }
7543 }
7544
7545 impl wkt::message::Message for ColdlineAndArchivalStorageOperationsSpike {
7546 fn typename() -> &'static str {
7547 "type.googleapis.com/google.storage.control.v2.IntelligenceFinding.ColdlineAndArchivalStorageOperationsSpike"
7548 }
7549 }
7550
7551 /// Defines additional types related to [ColdlineAndArchivalStorageOperationsSpike].
7552 pub mod coldline_and_archival_storage_operations_spike {
7553 #[allow(unused_imports)]
7554 use super::*;
7555
7556 /// Represents the operation spike details for a bucket.
7557 #[derive(Clone, Default, PartialEq)]
7558 #[non_exhaustive]
7559 pub struct BucketContribution {
7560
7561 /// Output only. The name of the bucket.
7562 pub bucket: std::string::String,
7563
7564 /// Output only. The percentage increase in operations for the bucket.
7565 pub percentage_increase: f64,
7566
7567 /// Output only. The total count of operations for the bucket.
7568 pub total_operations_count: i64,
7569
7570 /// The details of the bucket's contribution towards the
7571 /// `IntelligenceFinding`.
7572 pub details: std::option::Option<crate::model::intelligence_finding::coldline_and_archival_storage_operations_spike::bucket_contribution::Details>,
7573
7574 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
7575 }
7576
7577 impl BucketContribution {
7578 /// Creates a new default instance.
7579 pub fn new() -> Self {
7580 std::default::Default::default()
7581 }
7582
7583 /// Sets the value of [bucket][crate::model::intelligence_finding::coldline_and_archival_storage_operations_spike::BucketContribution::bucket].
7584 ///
7585 /// # Example
7586 /// ```ignore,no_run
7587 /// # use google_cloud_storage::model::intelligence_finding::coldline_and_archival_storage_operations_spike::BucketContribution;
7588 /// let x = BucketContribution::new().set_bucket("example");
7589 /// ```
7590 pub fn set_bucket<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
7591 self.bucket = v.into();
7592 self
7593 }
7594
7595 /// Sets the value of [percentage_increase][crate::model::intelligence_finding::coldline_and_archival_storage_operations_spike::BucketContribution::percentage_increase].
7596 ///
7597 /// # Example
7598 /// ```ignore,no_run
7599 /// # use google_cloud_storage::model::intelligence_finding::coldline_and_archival_storage_operations_spike::BucketContribution;
7600 /// let x = BucketContribution::new().set_percentage_increase(42.0);
7601 /// ```
7602 pub fn set_percentage_increase<T: std::convert::Into<f64>>(mut self, v: T) -> Self {
7603 self.percentage_increase = v.into();
7604 self
7605 }
7606
7607 /// Sets the value of [total_operations_count][crate::model::intelligence_finding::coldline_and_archival_storage_operations_spike::BucketContribution::total_operations_count].
7608 ///
7609 /// # Example
7610 /// ```ignore,no_run
7611 /// # use google_cloud_storage::model::intelligence_finding::coldline_and_archival_storage_operations_spike::BucketContribution;
7612 /// let x = BucketContribution::new().set_total_operations_count(42);
7613 /// ```
7614 pub fn set_total_operations_count<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
7615 self.total_operations_count = v.into();
7616 self
7617 }
7618
7619 /// Sets the value of [details][crate::model::intelligence_finding::coldline_and_archival_storage_operations_spike::BucketContribution::details].
7620 ///
7621 /// Note that all the setters affecting `details` are mutually
7622 /// exclusive.
7623 ///
7624 /// # Example
7625 /// ```ignore,no_run
7626 /// # use google_cloud_storage::model::intelligence_finding::coldline_and_archival_storage_operations_spike::BucketContribution;
7627 /// use google_cloud_storage::model::intelligence_finding::coldline_and_archival_storage_operations_spike::bucket_contribution::Contribution;
7628 /// let x = BucketContribution::new().set_details(Some(
7629 /// google_cloud_storage::model::intelligence_finding::coldline_and_archival_storage_operations_spike::bucket_contribution::Details::Contribution(Contribution::default().into())));
7630 /// ```
7631 pub fn set_details<T: std::convert::Into<std::option::Option<crate::model::intelligence_finding::coldline_and_archival_storage_operations_spike::bucket_contribution::Details>>>(mut self, v: T) -> Self
7632 {
7633 self.details = v.into();
7634 self
7635 }
7636
7637 /// The value of [details][crate::model::intelligence_finding::coldline_and_archival_storage_operations_spike::BucketContribution::details]
7638 /// if it holds a `Contribution`, `None` if the field is not set or
7639 /// holds a different branch.
7640 pub fn contribution(&self) -> std::option::Option<&std::boxed::Box<crate::model::intelligence_finding::coldline_and_archival_storage_operations_spike::bucket_contribution::Contribution>>{
7641 #[allow(unreachable_patterns)]
7642 self.details.as_ref().and_then(|v| match v {
7643 crate::model::intelligence_finding::coldline_and_archival_storage_operations_spike::bucket_contribution::Details::Contribution(v) => std::option::Option::Some(v),
7644 _ => std::option::Option::None,
7645 })
7646 }
7647
7648 /// Sets the value of [details][crate::model::intelligence_finding::coldline_and_archival_storage_operations_spike::BucketContribution::details]
7649 /// to hold a `Contribution`.
7650 ///
7651 /// Note that all the setters affecting `details` are
7652 /// mutually exclusive.
7653 ///
7654 /// # Example
7655 /// ```ignore,no_run
7656 /// # use google_cloud_storage::model::intelligence_finding::coldline_and_archival_storage_operations_spike::BucketContribution;
7657 /// use google_cloud_storage::model::intelligence_finding::coldline_and_archival_storage_operations_spike::bucket_contribution::Contribution;
7658 /// let x = BucketContribution::new().set_contribution(Contribution::default()/* use setters */);
7659 /// assert!(x.contribution().is_some());
7660 /// assert!(x.error().is_none());
7661 /// ```
7662 pub fn set_contribution<T: std::convert::Into<std::boxed::Box<crate::model::intelligence_finding::coldline_and_archival_storage_operations_spike::bucket_contribution::Contribution>>>(mut self, v: T) -> Self{
7663 self.details = std::option::Option::Some(
7664 crate::model::intelligence_finding::coldline_and_archival_storage_operations_spike::bucket_contribution::Details::Contribution(
7665 v.into()
7666 )
7667 );
7668 self
7669 }
7670
7671 /// The value of [details][crate::model::intelligence_finding::coldline_and_archival_storage_operations_spike::BucketContribution::details]
7672 /// if it holds a `Error`, `None` if the field is not set or
7673 /// holds a different branch.
7674 pub fn error(
7675 &self,
7676 ) -> std::option::Option<&std::boxed::Box<google_cloud_rpc::model::Status>>
7677 {
7678 #[allow(unreachable_patterns)]
7679 self.details.as_ref().and_then(|v| match v {
7680 crate::model::intelligence_finding::coldline_and_archival_storage_operations_spike::bucket_contribution::Details::Error(v) => std::option::Option::Some(v),
7681 _ => std::option::Option::None,
7682 })
7683 }
7684
7685 /// Sets the value of [details][crate::model::intelligence_finding::coldline_and_archival_storage_operations_spike::BucketContribution::details]
7686 /// to hold a `Error`.
7687 ///
7688 /// Note that all the setters affecting `details` are
7689 /// mutually exclusive.
7690 ///
7691 /// # Example
7692 /// ```ignore,no_run
7693 /// # use google_cloud_storage::model::intelligence_finding::coldline_and_archival_storage_operations_spike::BucketContribution;
7694 /// use google_cloud_rpc::model::Status;
7695 /// let x = BucketContribution::new().set_error(Status::default()/* use setters */);
7696 /// assert!(x.error().is_some());
7697 /// assert!(x.contribution().is_none());
7698 /// ```
7699 pub fn set_error<
7700 T: std::convert::Into<std::boxed::Box<google_cloud_rpc::model::Status>>,
7701 >(
7702 mut self,
7703 v: T,
7704 ) -> Self {
7705 self.details = std::option::Option::Some(
7706 crate::model::intelligence_finding::coldline_and_archival_storage_operations_spike::bucket_contribution::Details::Error(
7707 v.into()
7708 )
7709 );
7710 self
7711 }
7712 }
7713
7714 impl wkt::message::Message for BucketContribution {
7715 fn typename() -> &'static str {
7716 "type.googleapis.com/google.storage.control.v2.IntelligenceFinding.ColdlineAndArchivalStorageOperationsSpike.BucketContribution"
7717 }
7718 }
7719
7720 /// Defines additional types related to [BucketContribution].
7721 pub mod bucket_contribution {
7722 #[allow(unused_imports)]
7723 use super::*;
7724
7725 /// Represents the contribution of the bucket towards the
7726 /// `IntelligenceFinding`.
7727 #[derive(Clone, Default, PartialEq)]
7728 #[non_exhaustive]
7729 pub struct Contribution {
7730
7731 /// Output only. A list of the top object prefixes driving the increase
7732 /// in operations.
7733 pub top_prefixes: std::vec::Vec<crate::model::intelligence_finding::coldline_and_archival_storage_operations_spike::bucket_contribution::contribution::PrefixContribution>,
7734
7735 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
7736 }
7737
7738 impl Contribution {
7739 /// Creates a new default instance.
7740 pub fn new() -> Self {
7741 std::default::Default::default()
7742 }
7743
7744 /// Sets the value of [top_prefixes][crate::model::intelligence_finding::coldline_and_archival_storage_operations_spike::bucket_contribution::Contribution::top_prefixes].
7745 ///
7746 /// # Example
7747 /// ```ignore,no_run
7748 /// # use google_cloud_storage::model::intelligence_finding::coldline_and_archival_storage_operations_spike::bucket_contribution::Contribution;
7749 /// use google_cloud_storage::model::intelligence_finding::coldline_and_archival_storage_operations_spike::bucket_contribution::contribution::PrefixContribution;
7750 /// let x = Contribution::new()
7751 /// .set_top_prefixes([
7752 /// PrefixContribution::default()/* use setters */,
7753 /// PrefixContribution::default()/* use (different) setters */,
7754 /// ]);
7755 /// ```
7756 pub fn set_top_prefixes<T, V>(mut self, v: T) -> Self
7757 where
7758 T: std::iter::IntoIterator<Item = V>,
7759 V: std::convert::Into<crate::model::intelligence_finding::coldline_and_archival_storage_operations_spike::bucket_contribution::contribution::PrefixContribution>
7760 {
7761 use std::iter::Iterator;
7762 self.top_prefixes = v.into_iter().map(|i| i.into()).collect();
7763 self
7764 }
7765 }
7766
7767 impl wkt::message::Message for Contribution {
7768 fn typename() -> &'static str {
7769 "type.googleapis.com/google.storage.control.v2.IntelligenceFinding.ColdlineAndArchivalStorageOperationsSpike.BucketContribution.Contribution"
7770 }
7771 }
7772
7773 /// Defines additional types related to [Contribution].
7774 pub mod contribution {
7775 #[allow(unused_imports)]
7776 use super::*;
7777
7778 /// Represents the operation spike details for an object prefix.
7779 #[derive(Clone, Default, PartialEq)]
7780 #[non_exhaustive]
7781 pub struct PrefixContribution {
7782 /// Output only. The object prefix.
7783 /// Format: `a/b/c`, 'a/b/d', etc.
7784 pub prefix: std::string::String,
7785
7786 /// Output only. The percentage increase in operations for the object
7787 /// prefix.
7788 pub percentage_increase: f64,
7789
7790 /// Output only. The total count of operations for the object prefix.
7791 pub total_operations_count: i64,
7792
7793 pub(crate) _unknown_fields:
7794 serde_json::Map<std::string::String, serde_json::Value>,
7795 }
7796
7797 impl PrefixContribution {
7798 /// Creates a new default instance.
7799 pub fn new() -> Self {
7800 std::default::Default::default()
7801 }
7802
7803 /// Sets the value of [prefix][crate::model::intelligence_finding::coldline_and_archival_storage_operations_spike::bucket_contribution::contribution::PrefixContribution::prefix].
7804 ///
7805 /// # Example
7806 /// ```ignore,no_run
7807 /// # use google_cloud_storage::model::intelligence_finding::coldline_and_archival_storage_operations_spike::bucket_contribution::contribution::PrefixContribution;
7808 /// let x = PrefixContribution::new().set_prefix("example");
7809 /// ```
7810 pub fn set_prefix<T: std::convert::Into<std::string::String>>(
7811 mut self,
7812 v: T,
7813 ) -> Self {
7814 self.prefix = v.into();
7815 self
7816 }
7817
7818 /// Sets the value of [percentage_increase][crate::model::intelligence_finding::coldline_and_archival_storage_operations_spike::bucket_contribution::contribution::PrefixContribution::percentage_increase].
7819 ///
7820 /// # Example
7821 /// ```ignore,no_run
7822 /// # use google_cloud_storage::model::intelligence_finding::coldline_and_archival_storage_operations_spike::bucket_contribution::contribution::PrefixContribution;
7823 /// let x = PrefixContribution::new().set_percentage_increase(42.0);
7824 /// ```
7825 pub fn set_percentage_increase<T: std::convert::Into<f64>>(
7826 mut self,
7827 v: T,
7828 ) -> Self {
7829 self.percentage_increase = v.into();
7830 self
7831 }
7832
7833 /// Sets the value of [total_operations_count][crate::model::intelligence_finding::coldline_and_archival_storage_operations_spike::bucket_contribution::contribution::PrefixContribution::total_operations_count].
7834 ///
7835 /// # Example
7836 /// ```ignore,no_run
7837 /// # use google_cloud_storage::model::intelligence_finding::coldline_and_archival_storage_operations_spike::bucket_contribution::contribution::PrefixContribution;
7838 /// let x = PrefixContribution::new().set_total_operations_count(42);
7839 /// ```
7840 pub fn set_total_operations_count<T: std::convert::Into<i64>>(
7841 mut self,
7842 v: T,
7843 ) -> Self {
7844 self.total_operations_count = v.into();
7845 self
7846 }
7847 }
7848
7849 impl wkt::message::Message for PrefixContribution {
7850 fn typename() -> &'static str {
7851 "type.googleapis.com/google.storage.control.v2.IntelligenceFinding.ColdlineAndArchivalStorageOperationsSpike.BucketContribution.Contribution.PrefixContribution"
7852 }
7853 }
7854 }
7855
7856 /// The details of the bucket's contribution towards the
7857 /// `IntelligenceFinding`.
7858 #[derive(Clone, Debug, PartialEq)]
7859 #[non_exhaustive]
7860 pub enum Details {
7861 /// Output only. The details about the contribution of the bucket.
7862 Contribution(std::boxed::Box<crate::model::intelligence_finding::coldline_and_archival_storage_operations_spike::bucket_contribution::Contribution>),
7863 /// Output only. The error related to accessing the details about the
7864 /// contribution of the bucket.
7865 Error(std::boxed::Box<google_cloud_rpc::model::Status>),
7866 }
7867
7868 impl Details {
7869 /// Initializes the enum to the [Contribution](Self::Contribution) branch.
7870 pub fn from_contribution(
7871 value: impl std::convert::Into<std::boxed::Box<crate::model::intelligence_finding::coldline_and_archival_storage_operations_spike::bucket_contribution::Contribution>>,
7872 ) -> Self {
7873 Self::Contribution(value.into())
7874 }
7875 /// Initializes the enum to the [Error](Self::Error) branch.
7876 pub fn from_error(
7877 value: impl std::convert::Into<std::boxed::Box<google_cloud_rpc::model::Status>>,
7878 ) -> Self {
7879 Self::Error(value.into())
7880 }
7881 }
7882 }
7883 }
7884
7885 /// Represents a finding about a spike in cross-region egress from Cloud
7886 /// Storage.
7887 /// This corresponds to the `CROSS_REGION_EGRESS_SPIKE` finding type.
7888 #[derive(Clone, Default, PartialEq)]
7889 #[non_exhaustive]
7890 pub struct CrossRegionEgressSpike {
7891 /// Output only. The total cross-region egress volume in bytes across the
7892 /// project.
7893 pub total_egress_bytes: i64,
7894
7895 /// Output only. The percentage increase in cross-region egress across the
7896 /// project.
7897 pub percentage_increase: f64,
7898
7899 /// Output only. A list of top buckets driving the increase in cross-region
7900 /// egress.
7901 pub top_buckets: std::vec::Vec<
7902 crate::model::intelligence_finding::cross_region_egress_spike::BucketContribution,
7903 >,
7904
7905 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
7906 }
7907
7908 impl CrossRegionEgressSpike {
7909 /// Creates a new default instance.
7910 pub fn new() -> Self {
7911 std::default::Default::default()
7912 }
7913
7914 /// Sets the value of [total_egress_bytes][crate::model::intelligence_finding::CrossRegionEgressSpike::total_egress_bytes].
7915 ///
7916 /// # Example
7917 /// ```ignore,no_run
7918 /// # use google_cloud_storage::model::intelligence_finding::CrossRegionEgressSpike;
7919 /// let x = CrossRegionEgressSpike::new().set_total_egress_bytes(42);
7920 /// ```
7921 pub fn set_total_egress_bytes<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
7922 self.total_egress_bytes = v.into();
7923 self
7924 }
7925
7926 /// Sets the value of [percentage_increase][crate::model::intelligence_finding::CrossRegionEgressSpike::percentage_increase].
7927 ///
7928 /// # Example
7929 /// ```ignore,no_run
7930 /// # use google_cloud_storage::model::intelligence_finding::CrossRegionEgressSpike;
7931 /// let x = CrossRegionEgressSpike::new().set_percentage_increase(42.0);
7932 /// ```
7933 pub fn set_percentage_increase<T: std::convert::Into<f64>>(mut self, v: T) -> Self {
7934 self.percentage_increase = v.into();
7935 self
7936 }
7937
7938 /// Sets the value of [top_buckets][crate::model::intelligence_finding::CrossRegionEgressSpike::top_buckets].
7939 ///
7940 /// # Example
7941 /// ```ignore,no_run
7942 /// # use google_cloud_storage::model::intelligence_finding::CrossRegionEgressSpike;
7943 /// use google_cloud_storage::model::intelligence_finding::cross_region_egress_spike::BucketContribution;
7944 /// let x = CrossRegionEgressSpike::new()
7945 /// .set_top_buckets([
7946 /// BucketContribution::default()/* use setters */,
7947 /// BucketContribution::default()/* use (different) setters */,
7948 /// ]);
7949 /// ```
7950 pub fn set_top_buckets<T, V>(mut self, v: T) -> Self
7951 where
7952 T: std::iter::IntoIterator<Item = V>,
7953 V: std::convert::Into<crate::model::intelligence_finding::cross_region_egress_spike::BucketContribution>
7954 {
7955 use std::iter::Iterator;
7956 self.top_buckets = v.into_iter().map(|i| i.into()).collect();
7957 self
7958 }
7959 }
7960
7961 impl wkt::message::Message for CrossRegionEgressSpike {
7962 fn typename() -> &'static str {
7963 "type.googleapis.com/google.storage.control.v2.IntelligenceFinding.CrossRegionEgressSpike"
7964 }
7965 }
7966
7967 /// Defines additional types related to [CrossRegionEgressSpike].
7968 pub mod cross_region_egress_spike {
7969 #[allow(unused_imports)]
7970 use super::*;
7971
7972 /// Represents the cross-region egress spike details for a bucket.
7973 #[derive(Clone, Default, PartialEq)]
7974 #[non_exhaustive]
7975 pub struct BucketContribution {
7976
7977 /// Output only. The name of the bucket.
7978 pub bucket: std::string::String,
7979
7980 /// Output only. The total cross-region egress volume in bytes for the
7981 /// bucket.
7982 pub total_egress_bytes: i64,
7983
7984 /// Output only. The percentage increase in cross-region egress for the
7985 /// bucket.
7986 pub percentage_increase: f64,
7987
7988 /// The details of the bucket's contribution towards the
7989 /// `IntelligenceFinding`.
7990 pub details: std::option::Option<crate::model::intelligence_finding::cross_region_egress_spike::bucket_contribution::Details>,
7991
7992 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
7993 }
7994
7995 impl BucketContribution {
7996 /// Creates a new default instance.
7997 pub fn new() -> Self {
7998 std::default::Default::default()
7999 }
8000
8001 /// Sets the value of [bucket][crate::model::intelligence_finding::cross_region_egress_spike::BucketContribution::bucket].
8002 ///
8003 /// # Example
8004 /// ```ignore,no_run
8005 /// # use google_cloud_storage::model::intelligence_finding::cross_region_egress_spike::BucketContribution;
8006 /// let x = BucketContribution::new().set_bucket("example");
8007 /// ```
8008 pub fn set_bucket<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
8009 self.bucket = v.into();
8010 self
8011 }
8012
8013 /// Sets the value of [total_egress_bytes][crate::model::intelligence_finding::cross_region_egress_spike::BucketContribution::total_egress_bytes].
8014 ///
8015 /// # Example
8016 /// ```ignore,no_run
8017 /// # use google_cloud_storage::model::intelligence_finding::cross_region_egress_spike::BucketContribution;
8018 /// let x = BucketContribution::new().set_total_egress_bytes(42);
8019 /// ```
8020 pub fn set_total_egress_bytes<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
8021 self.total_egress_bytes = v.into();
8022 self
8023 }
8024
8025 /// Sets the value of [percentage_increase][crate::model::intelligence_finding::cross_region_egress_spike::BucketContribution::percentage_increase].
8026 ///
8027 /// # Example
8028 /// ```ignore,no_run
8029 /// # use google_cloud_storage::model::intelligence_finding::cross_region_egress_spike::BucketContribution;
8030 /// let x = BucketContribution::new().set_percentage_increase(42.0);
8031 /// ```
8032 pub fn set_percentage_increase<T: std::convert::Into<f64>>(mut self, v: T) -> Self {
8033 self.percentage_increase = v.into();
8034 self
8035 }
8036
8037 /// Sets the value of [details][crate::model::intelligence_finding::cross_region_egress_spike::BucketContribution::details].
8038 ///
8039 /// Note that all the setters affecting `details` are mutually
8040 /// exclusive.
8041 ///
8042 /// # Example
8043 /// ```ignore,no_run
8044 /// # use google_cloud_storage::model::intelligence_finding::cross_region_egress_spike::BucketContribution;
8045 /// use google_cloud_storage::model::intelligence_finding::cross_region_egress_spike::bucket_contribution::Contribution;
8046 /// let x = BucketContribution::new().set_details(Some(
8047 /// google_cloud_storage::model::intelligence_finding::cross_region_egress_spike::bucket_contribution::Details::Contribution(Contribution::default().into())));
8048 /// ```
8049 pub fn set_details<T: std::convert::Into<std::option::Option<crate::model::intelligence_finding::cross_region_egress_spike::bucket_contribution::Details>>>(mut self, v: T) -> Self
8050 {
8051 self.details = v.into();
8052 self
8053 }
8054
8055 /// The value of [details][crate::model::intelligence_finding::cross_region_egress_spike::BucketContribution::details]
8056 /// if it holds a `Contribution`, `None` if the field is not set or
8057 /// holds a different branch.
8058 pub fn contribution(&self) -> std::option::Option<&std::boxed::Box<crate::model::intelligence_finding::cross_region_egress_spike::bucket_contribution::Contribution>>{
8059 #[allow(unreachable_patterns)]
8060 self.details.as_ref().and_then(|v| match v {
8061 crate::model::intelligence_finding::cross_region_egress_spike::bucket_contribution::Details::Contribution(v) => std::option::Option::Some(v),
8062 _ => std::option::Option::None,
8063 })
8064 }
8065
8066 /// Sets the value of [details][crate::model::intelligence_finding::cross_region_egress_spike::BucketContribution::details]
8067 /// to hold a `Contribution`.
8068 ///
8069 /// Note that all the setters affecting `details` are
8070 /// mutually exclusive.
8071 ///
8072 /// # Example
8073 /// ```ignore,no_run
8074 /// # use google_cloud_storage::model::intelligence_finding::cross_region_egress_spike::BucketContribution;
8075 /// use google_cloud_storage::model::intelligence_finding::cross_region_egress_spike::bucket_contribution::Contribution;
8076 /// let x = BucketContribution::new().set_contribution(Contribution::default()/* use setters */);
8077 /// assert!(x.contribution().is_some());
8078 /// assert!(x.error().is_none());
8079 /// ```
8080 pub fn set_contribution<T: std::convert::Into<std::boxed::Box<crate::model::intelligence_finding::cross_region_egress_spike::bucket_contribution::Contribution>>>(mut self, v: T) -> Self{
8081 self.details = std::option::Option::Some(
8082 crate::model::intelligence_finding::cross_region_egress_spike::bucket_contribution::Details::Contribution(
8083 v.into()
8084 )
8085 );
8086 self
8087 }
8088
8089 /// The value of [details][crate::model::intelligence_finding::cross_region_egress_spike::BucketContribution::details]
8090 /// if it holds a `Error`, `None` if the field is not set or
8091 /// holds a different branch.
8092 pub fn error(
8093 &self,
8094 ) -> std::option::Option<&std::boxed::Box<google_cloud_rpc::model::Status>>
8095 {
8096 #[allow(unreachable_patterns)]
8097 self.details.as_ref().and_then(|v| match v {
8098 crate::model::intelligence_finding::cross_region_egress_spike::bucket_contribution::Details::Error(v) => std::option::Option::Some(v),
8099 _ => std::option::Option::None,
8100 })
8101 }
8102
8103 /// Sets the value of [details][crate::model::intelligence_finding::cross_region_egress_spike::BucketContribution::details]
8104 /// to hold a `Error`.
8105 ///
8106 /// Note that all the setters affecting `details` are
8107 /// mutually exclusive.
8108 ///
8109 /// # Example
8110 /// ```ignore,no_run
8111 /// # use google_cloud_storage::model::intelligence_finding::cross_region_egress_spike::BucketContribution;
8112 /// use google_cloud_rpc::model::Status;
8113 /// let x = BucketContribution::new().set_error(Status::default()/* use setters */);
8114 /// assert!(x.error().is_some());
8115 /// assert!(x.contribution().is_none());
8116 /// ```
8117 pub fn set_error<
8118 T: std::convert::Into<std::boxed::Box<google_cloud_rpc::model::Status>>,
8119 >(
8120 mut self,
8121 v: T,
8122 ) -> Self {
8123 self.details = std::option::Option::Some(
8124 crate::model::intelligence_finding::cross_region_egress_spike::bucket_contribution::Details::Error(
8125 v.into()
8126 )
8127 );
8128 self
8129 }
8130 }
8131
8132 impl wkt::message::Message for BucketContribution {
8133 fn typename() -> &'static str {
8134 "type.googleapis.com/google.storage.control.v2.IntelligenceFinding.CrossRegionEgressSpike.BucketContribution"
8135 }
8136 }
8137
8138 /// Defines additional types related to [BucketContribution].
8139 pub mod bucket_contribution {
8140 #[allow(unused_imports)]
8141 use super::*;
8142
8143 /// Represents the contribution of the bucket towards the
8144 /// `IntelligenceFinding`.
8145 #[derive(Clone, Default, PartialEq)]
8146 #[non_exhaustive]
8147 pub struct Contribution {
8148
8149 /// Output only. A list of the top object prefixes driving the increase
8150 /// in cross-region egress.
8151 pub top_prefixes: std::vec::Vec<crate::model::intelligence_finding::cross_region_egress_spike::bucket_contribution::contribution::PrefixContribution>,
8152
8153 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
8154 }
8155
8156 impl Contribution {
8157 /// Creates a new default instance.
8158 pub fn new() -> Self {
8159 std::default::Default::default()
8160 }
8161
8162 /// Sets the value of [top_prefixes][crate::model::intelligence_finding::cross_region_egress_spike::bucket_contribution::Contribution::top_prefixes].
8163 ///
8164 /// # Example
8165 /// ```ignore,no_run
8166 /// # use google_cloud_storage::model::intelligence_finding::cross_region_egress_spike::bucket_contribution::Contribution;
8167 /// use google_cloud_storage::model::intelligence_finding::cross_region_egress_spike::bucket_contribution::contribution::PrefixContribution;
8168 /// let x = Contribution::new()
8169 /// .set_top_prefixes([
8170 /// PrefixContribution::default()/* use setters */,
8171 /// PrefixContribution::default()/* use (different) setters */,
8172 /// ]);
8173 /// ```
8174 pub fn set_top_prefixes<T, V>(mut self, v: T) -> Self
8175 where
8176 T: std::iter::IntoIterator<Item = V>,
8177 V: std::convert::Into<crate::model::intelligence_finding::cross_region_egress_spike::bucket_contribution::contribution::PrefixContribution>
8178 {
8179 use std::iter::Iterator;
8180 self.top_prefixes = v.into_iter().map(|i| i.into()).collect();
8181 self
8182 }
8183 }
8184
8185 impl wkt::message::Message for Contribution {
8186 fn typename() -> &'static str {
8187 "type.googleapis.com/google.storage.control.v2.IntelligenceFinding.CrossRegionEgressSpike.BucketContribution.Contribution"
8188 }
8189 }
8190
8191 /// Defines additional types related to [Contribution].
8192 pub mod contribution {
8193 #[allow(unused_imports)]
8194 use super::*;
8195
8196 /// Represents the cross-region egress spike details for an object
8197 /// prefix.
8198 #[derive(Clone, Default, PartialEq)]
8199 #[non_exhaustive]
8200 pub struct PrefixContribution {
8201 /// Output only. The object prefix.
8202 /// Format: `a/b/c`, 'a/b/d', etc.
8203 pub prefix: std::string::String,
8204
8205 /// Output only. The total cross-region egress volume in bytes from the
8206 /// object prefix.
8207 pub total_egress_bytes: i64,
8208
8209 /// Output only. The percentage increase in cross-region egress for the
8210 /// object prefix.
8211 pub percentage_increase: f64,
8212
8213 pub(crate) _unknown_fields:
8214 serde_json::Map<std::string::String, serde_json::Value>,
8215 }
8216
8217 impl PrefixContribution {
8218 /// Creates a new default instance.
8219 pub fn new() -> Self {
8220 std::default::Default::default()
8221 }
8222
8223 /// Sets the value of [prefix][crate::model::intelligence_finding::cross_region_egress_spike::bucket_contribution::contribution::PrefixContribution::prefix].
8224 ///
8225 /// # Example
8226 /// ```ignore,no_run
8227 /// # use google_cloud_storage::model::intelligence_finding::cross_region_egress_spike::bucket_contribution::contribution::PrefixContribution;
8228 /// let x = PrefixContribution::new().set_prefix("example");
8229 /// ```
8230 pub fn set_prefix<T: std::convert::Into<std::string::String>>(
8231 mut self,
8232 v: T,
8233 ) -> Self {
8234 self.prefix = v.into();
8235 self
8236 }
8237
8238 /// Sets the value of [total_egress_bytes][crate::model::intelligence_finding::cross_region_egress_spike::bucket_contribution::contribution::PrefixContribution::total_egress_bytes].
8239 ///
8240 /// # Example
8241 /// ```ignore,no_run
8242 /// # use google_cloud_storage::model::intelligence_finding::cross_region_egress_spike::bucket_contribution::contribution::PrefixContribution;
8243 /// let x = PrefixContribution::new().set_total_egress_bytes(42);
8244 /// ```
8245 pub fn set_total_egress_bytes<T: std::convert::Into<i64>>(
8246 mut self,
8247 v: T,
8248 ) -> Self {
8249 self.total_egress_bytes = v.into();
8250 self
8251 }
8252
8253 /// Sets the value of [percentage_increase][crate::model::intelligence_finding::cross_region_egress_spike::bucket_contribution::contribution::PrefixContribution::percentage_increase].
8254 ///
8255 /// # Example
8256 /// ```ignore,no_run
8257 /// # use google_cloud_storage::model::intelligence_finding::cross_region_egress_spike::bucket_contribution::contribution::PrefixContribution;
8258 /// let x = PrefixContribution::new().set_percentage_increase(42.0);
8259 /// ```
8260 pub fn set_percentage_increase<T: std::convert::Into<f64>>(
8261 mut self,
8262 v: T,
8263 ) -> Self {
8264 self.percentage_increase = v.into();
8265 self
8266 }
8267 }
8268
8269 impl wkt::message::Message for PrefixContribution {
8270 fn typename() -> &'static str {
8271 "type.googleapis.com/google.storage.control.v2.IntelligenceFinding.CrossRegionEgressSpike.BucketContribution.Contribution.PrefixContribution"
8272 }
8273 }
8274 }
8275
8276 /// The details of the bucket's contribution towards the
8277 /// `IntelligenceFinding`.
8278 #[derive(Clone, Debug, PartialEq)]
8279 #[non_exhaustive]
8280 pub enum Details {
8281 /// Output only. The details about the contribution of the bucket.
8282 Contribution(std::boxed::Box<crate::model::intelligence_finding::cross_region_egress_spike::bucket_contribution::Contribution>),
8283 /// Output only. The error related to accessing the details about the
8284 /// contribution of the bucket.
8285 Error(std::boxed::Box<google_cloud_rpc::model::Status>),
8286 }
8287
8288 impl Details {
8289 /// Initializes the enum to the [Contribution](Self::Contribution) branch.
8290 pub fn from_contribution(
8291 value: impl std::convert::Into<std::boxed::Box<crate::model::intelligence_finding::cross_region_egress_spike::bucket_contribution::Contribution>>,
8292 ) -> Self {
8293 Self::Contribution(value.into())
8294 }
8295 /// Initializes the enum to the [Error](Self::Error) branch.
8296 pub fn from_error(
8297 value: impl std::convert::Into<std::boxed::Box<google_cloud_rpc::model::Status>>,
8298 ) -> Self {
8299 Self::Error(value.into())
8300 }
8301 }
8302 }
8303 }
8304
8305 /// Represents a finding about a spike in throttled requests (429 errors)
8306 /// within a project.
8307 /// This corresponds to the `THROTTLED_REQUEST_SPIKE` finding type.
8308 #[derive(Clone, Default, PartialEq)]
8309 #[non_exhaustive]
8310 pub struct ThrottledRequestSpike {
8311 /// Output only. The count of throttled requests across the project.
8312 pub throttled_requests: i64,
8313
8314 /// Output only. The percentage increase in throttled requests across the
8315 /// project.
8316 pub percentage_increase: f64,
8317
8318 /// Output only. A list of top buckets driving the increase in throttled
8319 /// requests.
8320 pub top_buckets: std::vec::Vec<
8321 crate::model::intelligence_finding::throttled_request_spike::BucketContribution,
8322 >,
8323
8324 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
8325 }
8326
8327 impl ThrottledRequestSpike {
8328 /// Creates a new default instance.
8329 pub fn new() -> Self {
8330 std::default::Default::default()
8331 }
8332
8333 /// Sets the value of [throttled_requests][crate::model::intelligence_finding::ThrottledRequestSpike::throttled_requests].
8334 ///
8335 /// # Example
8336 /// ```ignore,no_run
8337 /// # use google_cloud_storage::model::intelligence_finding::ThrottledRequestSpike;
8338 /// let x = ThrottledRequestSpike::new().set_throttled_requests(42);
8339 /// ```
8340 pub fn set_throttled_requests<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
8341 self.throttled_requests = v.into();
8342 self
8343 }
8344
8345 /// Sets the value of [percentage_increase][crate::model::intelligence_finding::ThrottledRequestSpike::percentage_increase].
8346 ///
8347 /// # Example
8348 /// ```ignore,no_run
8349 /// # use google_cloud_storage::model::intelligence_finding::ThrottledRequestSpike;
8350 /// let x = ThrottledRequestSpike::new().set_percentage_increase(42.0);
8351 /// ```
8352 pub fn set_percentage_increase<T: std::convert::Into<f64>>(mut self, v: T) -> Self {
8353 self.percentage_increase = v.into();
8354 self
8355 }
8356
8357 /// Sets the value of [top_buckets][crate::model::intelligence_finding::ThrottledRequestSpike::top_buckets].
8358 ///
8359 /// # Example
8360 /// ```ignore,no_run
8361 /// # use google_cloud_storage::model::intelligence_finding::ThrottledRequestSpike;
8362 /// use google_cloud_storage::model::intelligence_finding::throttled_request_spike::BucketContribution;
8363 /// let x = ThrottledRequestSpike::new()
8364 /// .set_top_buckets([
8365 /// BucketContribution::default()/* use setters */,
8366 /// BucketContribution::default()/* use (different) setters */,
8367 /// ]);
8368 /// ```
8369 pub fn set_top_buckets<T, V>(mut self, v: T) -> Self
8370 where
8371 T: std::iter::IntoIterator<Item = V>,
8372 V: std::convert::Into<
8373 crate::model::intelligence_finding::throttled_request_spike::BucketContribution,
8374 >,
8375 {
8376 use std::iter::Iterator;
8377 self.top_buckets = v.into_iter().map(|i| i.into()).collect();
8378 self
8379 }
8380 }
8381
8382 impl wkt::message::Message for ThrottledRequestSpike {
8383 fn typename() -> &'static str {
8384 "type.googleapis.com/google.storage.control.v2.IntelligenceFinding.ThrottledRequestSpike"
8385 }
8386 }
8387
8388 /// Defines additional types related to [ThrottledRequestSpike].
8389 pub mod throttled_request_spike {
8390 #[allow(unused_imports)]
8391 use super::*;
8392
8393 /// Represents the throttled requests details for a bucket.
8394 #[derive(Clone, Default, PartialEq)]
8395 #[non_exhaustive]
8396 pub struct BucketContribution {
8397
8398 /// Output only. The name of the bucket.
8399 pub bucket: std::string::String,
8400
8401 /// Output only. The count of throttled requests for the bucket.
8402 pub throttled_requests: i64,
8403
8404 /// Output only. The percentage increase in throttled requests for the
8405 /// bucket.
8406 pub percentage_increase: f64,
8407
8408 /// The details of the bucket's contribution towards the
8409 /// `IntelligenceFinding`.
8410 pub details: std::option::Option<crate::model::intelligence_finding::throttled_request_spike::bucket_contribution::Details>,
8411
8412 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
8413 }
8414
8415 impl BucketContribution {
8416 /// Creates a new default instance.
8417 pub fn new() -> Self {
8418 std::default::Default::default()
8419 }
8420
8421 /// Sets the value of [bucket][crate::model::intelligence_finding::throttled_request_spike::BucketContribution::bucket].
8422 ///
8423 /// # Example
8424 /// ```ignore,no_run
8425 /// # use google_cloud_storage::model::intelligence_finding::throttled_request_spike::BucketContribution;
8426 /// let x = BucketContribution::new().set_bucket("example");
8427 /// ```
8428 pub fn set_bucket<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
8429 self.bucket = v.into();
8430 self
8431 }
8432
8433 /// Sets the value of [throttled_requests][crate::model::intelligence_finding::throttled_request_spike::BucketContribution::throttled_requests].
8434 ///
8435 /// # Example
8436 /// ```ignore,no_run
8437 /// # use google_cloud_storage::model::intelligence_finding::throttled_request_spike::BucketContribution;
8438 /// let x = BucketContribution::new().set_throttled_requests(42);
8439 /// ```
8440 pub fn set_throttled_requests<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
8441 self.throttled_requests = v.into();
8442 self
8443 }
8444
8445 /// Sets the value of [percentage_increase][crate::model::intelligence_finding::throttled_request_spike::BucketContribution::percentage_increase].
8446 ///
8447 /// # Example
8448 /// ```ignore,no_run
8449 /// # use google_cloud_storage::model::intelligence_finding::throttled_request_spike::BucketContribution;
8450 /// let x = BucketContribution::new().set_percentage_increase(42.0);
8451 /// ```
8452 pub fn set_percentage_increase<T: std::convert::Into<f64>>(mut self, v: T) -> Self {
8453 self.percentage_increase = v.into();
8454 self
8455 }
8456
8457 /// Sets the value of [details][crate::model::intelligence_finding::throttled_request_spike::BucketContribution::details].
8458 ///
8459 /// Note that all the setters affecting `details` are mutually
8460 /// exclusive.
8461 ///
8462 /// # Example
8463 /// ```ignore,no_run
8464 /// # use google_cloud_storage::model::intelligence_finding::throttled_request_spike::BucketContribution;
8465 /// use google_cloud_storage::model::intelligence_finding::throttled_request_spike::bucket_contribution::Contribution;
8466 /// let x = BucketContribution::new().set_details(Some(
8467 /// google_cloud_storage::model::intelligence_finding::throttled_request_spike::bucket_contribution::Details::Contribution(Contribution::default().into())));
8468 /// ```
8469 pub fn set_details<T: std::convert::Into<std::option::Option<crate::model::intelligence_finding::throttled_request_spike::bucket_contribution::Details>>>(mut self, v: T) -> Self
8470 {
8471 self.details = v.into();
8472 self
8473 }
8474
8475 /// The value of [details][crate::model::intelligence_finding::throttled_request_spike::BucketContribution::details]
8476 /// if it holds a `Contribution`, `None` if the field is not set or
8477 /// holds a different branch.
8478 pub fn contribution(&self) -> std::option::Option<&std::boxed::Box<crate::model::intelligence_finding::throttled_request_spike::bucket_contribution::Contribution>>{
8479 #[allow(unreachable_patterns)]
8480 self.details.as_ref().and_then(|v| match v {
8481 crate::model::intelligence_finding::throttled_request_spike::bucket_contribution::Details::Contribution(v) => std::option::Option::Some(v),
8482 _ => std::option::Option::None,
8483 })
8484 }
8485
8486 /// Sets the value of [details][crate::model::intelligence_finding::throttled_request_spike::BucketContribution::details]
8487 /// to hold a `Contribution`.
8488 ///
8489 /// Note that all the setters affecting `details` are
8490 /// mutually exclusive.
8491 ///
8492 /// # Example
8493 /// ```ignore,no_run
8494 /// # use google_cloud_storage::model::intelligence_finding::throttled_request_spike::BucketContribution;
8495 /// use google_cloud_storage::model::intelligence_finding::throttled_request_spike::bucket_contribution::Contribution;
8496 /// let x = BucketContribution::new().set_contribution(Contribution::default()/* use setters */);
8497 /// assert!(x.contribution().is_some());
8498 /// assert!(x.error().is_none());
8499 /// ```
8500 pub fn set_contribution<T: std::convert::Into<std::boxed::Box<crate::model::intelligence_finding::throttled_request_spike::bucket_contribution::Contribution>>>(mut self, v: T) -> Self{
8501 self.details = std::option::Option::Some(
8502 crate::model::intelligence_finding::throttled_request_spike::bucket_contribution::Details::Contribution(
8503 v.into()
8504 )
8505 );
8506 self
8507 }
8508
8509 /// The value of [details][crate::model::intelligence_finding::throttled_request_spike::BucketContribution::details]
8510 /// if it holds a `Error`, `None` if the field is not set or
8511 /// holds a different branch.
8512 pub fn error(
8513 &self,
8514 ) -> std::option::Option<&std::boxed::Box<google_cloud_rpc::model::Status>>
8515 {
8516 #[allow(unreachable_patterns)]
8517 self.details.as_ref().and_then(|v| match v {
8518 crate::model::intelligence_finding::throttled_request_spike::bucket_contribution::Details::Error(v) => std::option::Option::Some(v),
8519 _ => std::option::Option::None,
8520 })
8521 }
8522
8523 /// Sets the value of [details][crate::model::intelligence_finding::throttled_request_spike::BucketContribution::details]
8524 /// to hold a `Error`.
8525 ///
8526 /// Note that all the setters affecting `details` are
8527 /// mutually exclusive.
8528 ///
8529 /// # Example
8530 /// ```ignore,no_run
8531 /// # use google_cloud_storage::model::intelligence_finding::throttled_request_spike::BucketContribution;
8532 /// use google_cloud_rpc::model::Status;
8533 /// let x = BucketContribution::new().set_error(Status::default()/* use setters */);
8534 /// assert!(x.error().is_some());
8535 /// assert!(x.contribution().is_none());
8536 /// ```
8537 pub fn set_error<
8538 T: std::convert::Into<std::boxed::Box<google_cloud_rpc::model::Status>>,
8539 >(
8540 mut self,
8541 v: T,
8542 ) -> Self {
8543 self.details = std::option::Option::Some(
8544 crate::model::intelligence_finding::throttled_request_spike::bucket_contribution::Details::Error(
8545 v.into()
8546 )
8547 );
8548 self
8549 }
8550 }
8551
8552 impl wkt::message::Message for BucketContribution {
8553 fn typename() -> &'static str {
8554 "type.googleapis.com/google.storage.control.v2.IntelligenceFinding.ThrottledRequestSpike.BucketContribution"
8555 }
8556 }
8557
8558 /// Defines additional types related to [BucketContribution].
8559 pub mod bucket_contribution {
8560 #[allow(unused_imports)]
8561 use super::*;
8562
8563 /// Represents the contribution of the bucket towards the
8564 /// `IntelligenceFinding`.
8565 #[derive(Clone, Default, PartialEq)]
8566 #[non_exhaustive]
8567 pub struct Contribution {
8568
8569 /// Output only. A list of top object prefixes driving the increase in
8570 /// throttled requests.
8571 pub top_prefixes: std::vec::Vec<crate::model::intelligence_finding::throttled_request_spike::bucket_contribution::contribution::PrefixContribution>,
8572
8573 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
8574 }
8575
8576 impl Contribution {
8577 /// Creates a new default instance.
8578 pub fn new() -> Self {
8579 std::default::Default::default()
8580 }
8581
8582 /// Sets the value of [top_prefixes][crate::model::intelligence_finding::throttled_request_spike::bucket_contribution::Contribution::top_prefixes].
8583 ///
8584 /// # Example
8585 /// ```ignore,no_run
8586 /// # use google_cloud_storage::model::intelligence_finding::throttled_request_spike::bucket_contribution::Contribution;
8587 /// use google_cloud_storage::model::intelligence_finding::throttled_request_spike::bucket_contribution::contribution::PrefixContribution;
8588 /// let x = Contribution::new()
8589 /// .set_top_prefixes([
8590 /// PrefixContribution::default()/* use setters */,
8591 /// PrefixContribution::default()/* use (different) setters */,
8592 /// ]);
8593 /// ```
8594 pub fn set_top_prefixes<T, V>(mut self, v: T) -> Self
8595 where
8596 T: std::iter::IntoIterator<Item = V>,
8597 V: std::convert::Into<crate::model::intelligence_finding::throttled_request_spike::bucket_contribution::contribution::PrefixContribution>
8598 {
8599 use std::iter::Iterator;
8600 self.top_prefixes = v.into_iter().map(|i| i.into()).collect();
8601 self
8602 }
8603 }
8604
8605 impl wkt::message::Message for Contribution {
8606 fn typename() -> &'static str {
8607 "type.googleapis.com/google.storage.control.v2.IntelligenceFinding.ThrottledRequestSpike.BucketContribution.Contribution"
8608 }
8609 }
8610
8611 /// Defines additional types related to [Contribution].
8612 pub mod contribution {
8613 #[allow(unused_imports)]
8614 use super::*;
8615
8616 /// Represents throttled requests details for an object prefix.
8617 #[derive(Clone, Default, PartialEq)]
8618 #[non_exhaustive]
8619 pub struct PrefixContribution {
8620 /// Output only. The object prefix.
8621 /// Format: `a/b/c`, 'a/b/d', etc.
8622 pub prefix: std::string::String,
8623
8624 /// Output only. The count of throttled requests for the object prefix.
8625 pub throttled_requests: i64,
8626
8627 /// Output only. The percentage increase in throttled requests for the
8628 /// object prefix.
8629 pub percentage_increase: f64,
8630
8631 pub(crate) _unknown_fields:
8632 serde_json::Map<std::string::String, serde_json::Value>,
8633 }
8634
8635 impl PrefixContribution {
8636 /// Creates a new default instance.
8637 pub fn new() -> Self {
8638 std::default::Default::default()
8639 }
8640
8641 /// Sets the value of [prefix][crate::model::intelligence_finding::throttled_request_spike::bucket_contribution::contribution::PrefixContribution::prefix].
8642 ///
8643 /// # Example
8644 /// ```ignore,no_run
8645 /// # use google_cloud_storage::model::intelligence_finding::throttled_request_spike::bucket_contribution::contribution::PrefixContribution;
8646 /// let x = PrefixContribution::new().set_prefix("example");
8647 /// ```
8648 pub fn set_prefix<T: std::convert::Into<std::string::String>>(
8649 mut self,
8650 v: T,
8651 ) -> Self {
8652 self.prefix = v.into();
8653 self
8654 }
8655
8656 /// Sets the value of [throttled_requests][crate::model::intelligence_finding::throttled_request_spike::bucket_contribution::contribution::PrefixContribution::throttled_requests].
8657 ///
8658 /// # Example
8659 /// ```ignore,no_run
8660 /// # use google_cloud_storage::model::intelligence_finding::throttled_request_spike::bucket_contribution::contribution::PrefixContribution;
8661 /// let x = PrefixContribution::new().set_throttled_requests(42);
8662 /// ```
8663 pub fn set_throttled_requests<T: std::convert::Into<i64>>(
8664 mut self,
8665 v: T,
8666 ) -> Self {
8667 self.throttled_requests = v.into();
8668 self
8669 }
8670
8671 /// Sets the value of [percentage_increase][crate::model::intelligence_finding::throttled_request_spike::bucket_contribution::contribution::PrefixContribution::percentage_increase].
8672 ///
8673 /// # Example
8674 /// ```ignore,no_run
8675 /// # use google_cloud_storage::model::intelligence_finding::throttled_request_spike::bucket_contribution::contribution::PrefixContribution;
8676 /// let x = PrefixContribution::new().set_percentage_increase(42.0);
8677 /// ```
8678 pub fn set_percentage_increase<T: std::convert::Into<f64>>(
8679 mut self,
8680 v: T,
8681 ) -> Self {
8682 self.percentage_increase = v.into();
8683 self
8684 }
8685 }
8686
8687 impl wkt::message::Message for PrefixContribution {
8688 fn typename() -> &'static str {
8689 "type.googleapis.com/google.storage.control.v2.IntelligenceFinding.ThrottledRequestSpike.BucketContribution.Contribution.PrefixContribution"
8690 }
8691 }
8692 }
8693
8694 /// The details of the bucket's contribution towards the
8695 /// `IntelligenceFinding`.
8696 #[derive(Clone, Debug, PartialEq)]
8697 #[non_exhaustive]
8698 pub enum Details {
8699 /// Output only. The details about the contribution of the bucket.
8700 Contribution(std::boxed::Box<crate::model::intelligence_finding::throttled_request_spike::bucket_contribution::Contribution>),
8701 /// Output only. The error related to accessing the details about the
8702 /// contribution of the bucket.
8703 Error(std::boxed::Box<google_cloud_rpc::model::Status>),
8704 }
8705
8706 impl Details {
8707 /// Initializes the enum to the [Contribution](Self::Contribution) branch.
8708 pub fn from_contribution(
8709 value: impl std::convert::Into<std::boxed::Box<crate::model::intelligence_finding::throttled_request_spike::bucket_contribution::Contribution>>,
8710 ) -> Self {
8711 Self::Contribution(value.into())
8712 }
8713 /// Initializes the enum to the [Error](Self::Error) branch.
8714 pub fn from_error(
8715 value: impl std::convert::Into<std::boxed::Box<google_cloud_rpc::model::Status>>,
8716 ) -> Self {
8717 Self::Error(value.into())
8718 }
8719 }
8720 }
8721 }
8722
8723 /// Represents a finding about a storage growth above the expected trend.
8724 /// This corresponds to the `STORAGE_GROWTH_ABOVE_TREND` finding type.
8725 #[derive(Clone, Default, PartialEq)]
8726 #[non_exhaustive]
8727 pub struct StorageGrowthAboveTrend {
8728 /// Output only. The total storage growth in bytes.
8729 pub total_storage_growth_bytes: i64,
8730
8731 /// Output only. The percentage increase in storage growth.
8732 pub percentage_increase: f64,
8733
8734 /// Output only. A list of top buckets driving the increase in storage
8735 /// growth.
8736 pub top_buckets: std::vec::Vec<
8737 crate::model::intelligence_finding::storage_growth_above_trend::BucketContribution,
8738 >,
8739
8740 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
8741 }
8742
8743 impl StorageGrowthAboveTrend {
8744 /// Creates a new default instance.
8745 pub fn new() -> Self {
8746 std::default::Default::default()
8747 }
8748
8749 /// Sets the value of [total_storage_growth_bytes][crate::model::intelligence_finding::StorageGrowthAboveTrend::total_storage_growth_bytes].
8750 ///
8751 /// # Example
8752 /// ```ignore,no_run
8753 /// # use google_cloud_storage::model::intelligence_finding::StorageGrowthAboveTrend;
8754 /// let x = StorageGrowthAboveTrend::new().set_total_storage_growth_bytes(42);
8755 /// ```
8756 pub fn set_total_storage_growth_bytes<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
8757 self.total_storage_growth_bytes = v.into();
8758 self
8759 }
8760
8761 /// Sets the value of [percentage_increase][crate::model::intelligence_finding::StorageGrowthAboveTrend::percentage_increase].
8762 ///
8763 /// # Example
8764 /// ```ignore,no_run
8765 /// # use google_cloud_storage::model::intelligence_finding::StorageGrowthAboveTrend;
8766 /// let x = StorageGrowthAboveTrend::new().set_percentage_increase(42.0);
8767 /// ```
8768 pub fn set_percentage_increase<T: std::convert::Into<f64>>(mut self, v: T) -> Self {
8769 self.percentage_increase = v.into();
8770 self
8771 }
8772
8773 /// Sets the value of [top_buckets][crate::model::intelligence_finding::StorageGrowthAboveTrend::top_buckets].
8774 ///
8775 /// # Example
8776 /// ```ignore,no_run
8777 /// # use google_cloud_storage::model::intelligence_finding::StorageGrowthAboveTrend;
8778 /// use google_cloud_storage::model::intelligence_finding::storage_growth_above_trend::BucketContribution;
8779 /// let x = StorageGrowthAboveTrend::new()
8780 /// .set_top_buckets([
8781 /// BucketContribution::default()/* use setters */,
8782 /// BucketContribution::default()/* use (different) setters */,
8783 /// ]);
8784 /// ```
8785 pub fn set_top_buckets<T, V>(mut self, v: T) -> Self
8786 where
8787 T: std::iter::IntoIterator<Item = V>,
8788 V: std::convert::Into<crate::model::intelligence_finding::storage_growth_above_trend::BucketContribution>
8789 {
8790 use std::iter::Iterator;
8791 self.top_buckets = v.into_iter().map(|i| i.into()).collect();
8792 self
8793 }
8794 }
8795
8796 impl wkt::message::Message for StorageGrowthAboveTrend {
8797 fn typename() -> &'static str {
8798 "type.googleapis.com/google.storage.control.v2.IntelligenceFinding.StorageGrowthAboveTrend"
8799 }
8800 }
8801
8802 /// Defines additional types related to [StorageGrowthAboveTrend].
8803 pub mod storage_growth_above_trend {
8804 #[allow(unused_imports)]
8805 use super::*;
8806
8807 /// Represents the storage growth details for a bucket.
8808 #[derive(Clone, Default, PartialEq)]
8809 #[non_exhaustive]
8810 pub struct BucketContribution {
8811
8812 /// Output only. The name of the bucket.
8813 pub bucket: std::string::String,
8814
8815 /// Output only. The total storage growth in bytes for the bucket.
8816 pub total_storage_growth_bytes: i64,
8817
8818 /// Output only. The percentage increase in storage growth for the bucket.
8819 pub percentage_increase: f64,
8820
8821 /// The details of the bucket's contribution towards the
8822 /// `IntelligenceFinding`.
8823 pub details: std::option::Option<crate::model::intelligence_finding::storage_growth_above_trend::bucket_contribution::Details>,
8824
8825 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
8826 }
8827
8828 impl BucketContribution {
8829 /// Creates a new default instance.
8830 pub fn new() -> Self {
8831 std::default::Default::default()
8832 }
8833
8834 /// Sets the value of [bucket][crate::model::intelligence_finding::storage_growth_above_trend::BucketContribution::bucket].
8835 ///
8836 /// # Example
8837 /// ```ignore,no_run
8838 /// # use google_cloud_storage::model::intelligence_finding::storage_growth_above_trend::BucketContribution;
8839 /// let x = BucketContribution::new().set_bucket("example");
8840 /// ```
8841 pub fn set_bucket<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
8842 self.bucket = v.into();
8843 self
8844 }
8845
8846 /// Sets the value of [total_storage_growth_bytes][crate::model::intelligence_finding::storage_growth_above_trend::BucketContribution::total_storage_growth_bytes].
8847 ///
8848 /// # Example
8849 /// ```ignore,no_run
8850 /// # use google_cloud_storage::model::intelligence_finding::storage_growth_above_trend::BucketContribution;
8851 /// let x = BucketContribution::new().set_total_storage_growth_bytes(42);
8852 /// ```
8853 pub fn set_total_storage_growth_bytes<T: std::convert::Into<i64>>(
8854 mut self,
8855 v: T,
8856 ) -> Self {
8857 self.total_storage_growth_bytes = v.into();
8858 self
8859 }
8860
8861 /// Sets the value of [percentage_increase][crate::model::intelligence_finding::storage_growth_above_trend::BucketContribution::percentage_increase].
8862 ///
8863 /// # Example
8864 /// ```ignore,no_run
8865 /// # use google_cloud_storage::model::intelligence_finding::storage_growth_above_trend::BucketContribution;
8866 /// let x = BucketContribution::new().set_percentage_increase(42.0);
8867 /// ```
8868 pub fn set_percentage_increase<T: std::convert::Into<f64>>(mut self, v: T) -> Self {
8869 self.percentage_increase = v.into();
8870 self
8871 }
8872
8873 /// Sets the value of [details][crate::model::intelligence_finding::storage_growth_above_trend::BucketContribution::details].
8874 ///
8875 /// Note that all the setters affecting `details` are mutually
8876 /// exclusive.
8877 ///
8878 /// # Example
8879 /// ```ignore,no_run
8880 /// # use google_cloud_storage::model::intelligence_finding::storage_growth_above_trend::BucketContribution;
8881 /// use google_cloud_rpc::model::Status;
8882 /// let x = BucketContribution::new().set_details(Some(
8883 /// google_cloud_storage::model::intelligence_finding::storage_growth_above_trend::bucket_contribution::Details::Error(Status::default().into())));
8884 /// ```
8885 pub fn set_details<T: std::convert::Into<std::option::Option<crate::model::intelligence_finding::storage_growth_above_trend::bucket_contribution::Details>>>(mut self, v: T) -> Self
8886 {
8887 self.details = v.into();
8888 self
8889 }
8890
8891 /// The value of [details][crate::model::intelligence_finding::storage_growth_above_trend::BucketContribution::details]
8892 /// if it holds a `Error`, `None` if the field is not set or
8893 /// holds a different branch.
8894 pub fn error(
8895 &self,
8896 ) -> std::option::Option<&std::boxed::Box<google_cloud_rpc::model::Status>>
8897 {
8898 #[allow(unreachable_patterns)]
8899 self.details.as_ref().and_then(|v| match v {
8900 crate::model::intelligence_finding::storage_growth_above_trend::bucket_contribution::Details::Error(v) => std::option::Option::Some(v),
8901 _ => std::option::Option::None,
8902 })
8903 }
8904
8905 /// Sets the value of [details][crate::model::intelligence_finding::storage_growth_above_trend::BucketContribution::details]
8906 /// to hold a `Error`.
8907 ///
8908 /// Note that all the setters affecting `details` are
8909 /// mutually exclusive.
8910 ///
8911 /// # Example
8912 /// ```ignore,no_run
8913 /// # use google_cloud_storage::model::intelligence_finding::storage_growth_above_trend::BucketContribution;
8914 /// use google_cloud_rpc::model::Status;
8915 /// let x = BucketContribution::new().set_error(Status::default()/* use setters */);
8916 /// assert!(x.error().is_some());
8917 /// ```
8918 pub fn set_error<
8919 T: std::convert::Into<std::boxed::Box<google_cloud_rpc::model::Status>>,
8920 >(
8921 mut self,
8922 v: T,
8923 ) -> Self {
8924 self.details = std::option::Option::Some(
8925 crate::model::intelligence_finding::storage_growth_above_trend::bucket_contribution::Details::Error(
8926 v.into()
8927 )
8928 );
8929 self
8930 }
8931 }
8932
8933 impl wkt::message::Message for BucketContribution {
8934 fn typename() -> &'static str {
8935 "type.googleapis.com/google.storage.control.v2.IntelligenceFinding.StorageGrowthAboveTrend.BucketContribution"
8936 }
8937 }
8938
8939 /// Defines additional types related to [BucketContribution].
8940 pub mod bucket_contribution {
8941 #[allow(unused_imports)]
8942 use super::*;
8943
8944 /// The details of the bucket's contribution towards the
8945 /// `IntelligenceFinding`.
8946 #[derive(Clone, Debug, PartialEq)]
8947 #[non_exhaustive]
8948 pub enum Details {
8949 /// Output only. The error related to accessing the details about the
8950 /// contribution of the bucket.
8951 Error(std::boxed::Box<google_cloud_rpc::model::Status>),
8952 }
8953
8954 impl Details {
8955 /// Initializes the enum to the [Error](Self::Error) branch.
8956 pub fn from_error(
8957 value: impl std::convert::Into<std::boxed::Box<google_cloud_rpc::model::Status>>,
8958 ) -> Self {
8959 Self::Error(value.into())
8960 }
8961 }
8962 }
8963 }
8964
8965 /// The specific details of the `IntelligenceFinding`.
8966 #[derive(Clone, Debug, PartialEq)]
8967 #[non_exhaustive]
8968 pub enum IntelligenceFindingDetails {
8969 /// Output only. `IntelligenceFinding` about a spike in Class A/B operations
8970 /// on Coldline or Archive Cloud Storage objects.
8971 ColdlineAndArchivalStorageOperationsSpike(
8972 std::boxed::Box<
8973 crate::model::intelligence_finding::ColdlineAndArchivalStorageOperationsSpike,
8974 >,
8975 ),
8976 /// Output only. `IntelligenceFinding` about a spike in throttled requests
8977 /// (429 errors) within a project.
8978 ThrottledRequestsSpike(
8979 std::boxed::Box<crate::model::intelligence_finding::ThrottledRequestSpike>,
8980 ),
8981 /// Output only. `IntelligenceFinding` about a spike in cross-region egress.
8982 CrossRegionEgressSpike(
8983 std::boxed::Box<crate::model::intelligence_finding::CrossRegionEgressSpike>,
8984 ),
8985 /// Output only. `IntelligenceFinding` about growth in storage above the
8986 /// expected trend.
8987 StorageGrowthAboveTrend(
8988 std::boxed::Box<crate::model::intelligence_finding::StorageGrowthAboveTrend>,
8989 ),
8990 }
8991
8992 impl IntelligenceFindingDetails {
8993 /// Initializes the enum to the [ColdlineAndArchivalStorageOperationsSpike](Self::ColdlineAndArchivalStorageOperationsSpike) branch.
8994 pub fn from_coldline_and_archival_storage_operations_spike(
8995 value: impl std::convert::Into<
8996 std::boxed::Box<
8997 crate::model::intelligence_finding::ColdlineAndArchivalStorageOperationsSpike,
8998 >,
8999 >,
9000 ) -> Self {
9001 Self::ColdlineAndArchivalStorageOperationsSpike(value.into())
9002 }
9003 /// Initializes the enum to the [ThrottledRequestsSpike](Self::ThrottledRequestsSpike) branch.
9004 pub fn from_throttled_requests_spike(
9005 value: impl std::convert::Into<
9006 std::boxed::Box<crate::model::intelligence_finding::ThrottledRequestSpike>,
9007 >,
9008 ) -> Self {
9009 Self::ThrottledRequestsSpike(value.into())
9010 }
9011 /// Initializes the enum to the [CrossRegionEgressSpike](Self::CrossRegionEgressSpike) branch.
9012 pub fn from_cross_region_egress_spike(
9013 value: impl std::convert::Into<
9014 std::boxed::Box<crate::model::intelligence_finding::CrossRegionEgressSpike>,
9015 >,
9016 ) -> Self {
9017 Self::CrossRegionEgressSpike(value.into())
9018 }
9019 /// Initializes the enum to the [StorageGrowthAboveTrend](Self::StorageGrowthAboveTrend) branch.
9020 pub fn from_storage_growth_above_trend(
9021 value: impl std::convert::Into<
9022 std::boxed::Box<crate::model::intelligence_finding::StorageGrowthAboveTrend>,
9023 >,
9024 ) -> Self {
9025 Self::StorageGrowthAboveTrend(value.into())
9026 }
9027 }
9028}
9029
9030/// An `IntelligenceFindingRevision` represents a specific revision of an
9031/// `IntelligenceFinding` resource.
9032#[derive(Clone, Default, PartialEq)]
9033#[non_exhaustive]
9034pub struct IntelligenceFindingRevision {
9035 /// Output only. The resource name of `IntelligenceFindingRevision`.
9036 /// Format:
9037 /// `projects/{project}/locations/{location}/intelligenceFindings/{intelligence_finding}/revisions/{revision}`
9038 pub name: std::string::String,
9039
9040 /// Output only. The snapshot of the `IntelligenceFinding` at the time the
9041 /// revision was created. This field contains the full finding details as they
9042 /// existed for the revision.
9043 pub snapshot: std::option::Option<crate::model::IntelligenceFinding>,
9044
9045 /// Output only. The timestamp when the revision was created.
9046 pub create_time: std::option::Option<wkt::Timestamp>,
9047
9048 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
9049}
9050
9051impl IntelligenceFindingRevision {
9052 /// Creates a new default instance.
9053 pub fn new() -> Self {
9054 std::default::Default::default()
9055 }
9056
9057 /// Sets the value of [name][crate::model::IntelligenceFindingRevision::name].
9058 ///
9059 /// # Example
9060 /// ```ignore,no_run
9061 /// # use google_cloud_storage::model::IntelligenceFindingRevision;
9062 /// # let project_id = "project_id";
9063 /// # let location_id = "location_id";
9064 /// # let intelligence_finding_id = "intelligence_finding_id";
9065 /// # let revision_id = "revision_id";
9066 /// let x = IntelligenceFindingRevision::new().set_name(format!("projects/{project_id}/locations/{location_id}/intelligenceFindings/{intelligence_finding_id}/revisions/{revision_id}"));
9067 /// ```
9068 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9069 self.name = v.into();
9070 self
9071 }
9072
9073 /// Sets the value of [snapshot][crate::model::IntelligenceFindingRevision::snapshot].
9074 ///
9075 /// # Example
9076 /// ```ignore,no_run
9077 /// # use google_cloud_storage::model::IntelligenceFindingRevision;
9078 /// use google_cloud_storage::model::IntelligenceFinding;
9079 /// let x = IntelligenceFindingRevision::new().set_snapshot(IntelligenceFinding::default()/* use setters */);
9080 /// ```
9081 pub fn set_snapshot<T>(mut self, v: T) -> Self
9082 where
9083 T: std::convert::Into<crate::model::IntelligenceFinding>,
9084 {
9085 self.snapshot = std::option::Option::Some(v.into());
9086 self
9087 }
9088
9089 /// Sets or clears the value of [snapshot][crate::model::IntelligenceFindingRevision::snapshot].
9090 ///
9091 /// # Example
9092 /// ```ignore,no_run
9093 /// # use google_cloud_storage::model::IntelligenceFindingRevision;
9094 /// use google_cloud_storage::model::IntelligenceFinding;
9095 /// let x = IntelligenceFindingRevision::new().set_or_clear_snapshot(Some(IntelligenceFinding::default()/* use setters */));
9096 /// let x = IntelligenceFindingRevision::new().set_or_clear_snapshot(None::<IntelligenceFinding>);
9097 /// ```
9098 pub fn set_or_clear_snapshot<T>(mut self, v: std::option::Option<T>) -> Self
9099 where
9100 T: std::convert::Into<crate::model::IntelligenceFinding>,
9101 {
9102 self.snapshot = v.map(|x| x.into());
9103 self
9104 }
9105
9106 /// Sets the value of [create_time][crate::model::IntelligenceFindingRevision::create_time].
9107 ///
9108 /// # Example
9109 /// ```ignore,no_run
9110 /// # use google_cloud_storage::model::IntelligenceFindingRevision;
9111 /// use wkt::Timestamp;
9112 /// let x = IntelligenceFindingRevision::new().set_create_time(Timestamp::default()/* use setters */);
9113 /// ```
9114 pub fn set_create_time<T>(mut self, v: T) -> Self
9115 where
9116 T: std::convert::Into<wkt::Timestamp>,
9117 {
9118 self.create_time = std::option::Option::Some(v.into());
9119 self
9120 }
9121
9122 /// Sets or clears the value of [create_time][crate::model::IntelligenceFindingRevision::create_time].
9123 ///
9124 /// # Example
9125 /// ```ignore,no_run
9126 /// # use google_cloud_storage::model::IntelligenceFindingRevision;
9127 /// use wkt::Timestamp;
9128 /// let x = IntelligenceFindingRevision::new().set_or_clear_create_time(Some(Timestamp::default()/* use setters */));
9129 /// let x = IntelligenceFindingRevision::new().set_or_clear_create_time(None::<Timestamp>);
9130 /// ```
9131 pub fn set_or_clear_create_time<T>(mut self, v: std::option::Option<T>) -> Self
9132 where
9133 T: std::convert::Into<wkt::Timestamp>,
9134 {
9135 self.create_time = v.map(|x| x.into());
9136 self
9137 }
9138}
9139
9140impl wkt::message::Message for IntelligenceFindingRevision {
9141 fn typename() -> &'static str {
9142 "type.googleapis.com/google.storage.control.v2.IntelligenceFindingRevision"
9143 }
9144}
9145
9146/// Request message to get the `IntelligenceFinding` resource associated with a
9147/// project.
9148#[derive(Clone, Default, PartialEq)]
9149#[non_exhaustive]
9150pub struct GetIntelligenceFindingRequest {
9151 /// Required. The name of the `IntelligenceFinding` resource.
9152 ///
9153 /// Format:
9154 /// `projects/{project}/locations/{location}/intelligenceFindings/{intelligence_finding}`
9155 pub name: std::string::String,
9156
9157 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
9158}
9159
9160impl GetIntelligenceFindingRequest {
9161 /// Creates a new default instance.
9162 pub fn new() -> Self {
9163 std::default::Default::default()
9164 }
9165
9166 /// Sets the value of [name][crate::model::GetIntelligenceFindingRequest::name].
9167 ///
9168 /// # Example
9169 /// ```ignore,no_run
9170 /// # use google_cloud_storage::model::GetIntelligenceFindingRequest;
9171 /// # let project_id = "project_id";
9172 /// # let location_id = "location_id";
9173 /// # let intelligence_finding_id = "intelligence_finding_id";
9174 /// let x = GetIntelligenceFindingRequest::new().set_name(format!("projects/{project_id}/locations/{location_id}/intelligenceFindings/{intelligence_finding_id}"));
9175 /// ```
9176 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9177 self.name = v.into();
9178 self
9179 }
9180}
9181
9182impl wkt::message::Message for GetIntelligenceFindingRequest {
9183 fn typename() -> &'static str {
9184 "type.googleapis.com/google.storage.control.v2.GetIntelligenceFindingRequest"
9185 }
9186}
9187
9188/// Request message to list `IntelligenceFinding` resources associated with
9189/// a project.
9190#[derive(Clone, Default, PartialEq)]
9191#[non_exhaustive]
9192pub struct ListIntelligenceFindingsRequest {
9193 /// Required. The parent of the `IntelligenceFinding` resource.
9194 ///
9195 /// Format: `projects/{project}/locations/{location}`
9196 pub parent: std::string::String,
9197
9198 /// Optional. The filter expression to be applied.
9199 /// Supports filtering by `type` and `associated_resources`.
9200 pub filter: std::string::String,
9201
9202 /// Optional. The maximum number of `IntelligenceFinding` resources to return.
9203 ///
9204 /// The maximum value is `100`; values above `100` will be coerced to `100`.
9205 /// The default value is `100`.
9206 pub page_size: i32,
9207
9208 /// Optional. A page token, received from a previous `ListIntelligenceFindings`
9209 /// call. Provide this to retrieve the subsequent page.
9210 ///
9211 /// When paginating, all other parameters provided to
9212 /// `ListIntelligenceFindings` must match the call that provided the page
9213 /// token.
9214 pub page_token: std::string::String,
9215
9216 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
9217}
9218
9219impl ListIntelligenceFindingsRequest {
9220 /// Creates a new default instance.
9221 pub fn new() -> Self {
9222 std::default::Default::default()
9223 }
9224
9225 /// Sets the value of [parent][crate::model::ListIntelligenceFindingsRequest::parent].
9226 ///
9227 /// # Example
9228 /// ```ignore,no_run
9229 /// # use google_cloud_storage::model::ListIntelligenceFindingsRequest;
9230 /// # let project_id = "project_id";
9231 /// # let location_id = "location_id";
9232 /// let x = ListIntelligenceFindingsRequest::new().set_parent(format!("projects/{project_id}/locations/{location_id}"));
9233 /// ```
9234 pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9235 self.parent = v.into();
9236 self
9237 }
9238
9239 /// Sets the value of [filter][crate::model::ListIntelligenceFindingsRequest::filter].
9240 ///
9241 /// # Example
9242 /// ```ignore,no_run
9243 /// # use google_cloud_storage::model::ListIntelligenceFindingsRequest;
9244 /// let x = ListIntelligenceFindingsRequest::new().set_filter("example");
9245 /// ```
9246 pub fn set_filter<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9247 self.filter = v.into();
9248 self
9249 }
9250
9251 /// Sets the value of [page_size][crate::model::ListIntelligenceFindingsRequest::page_size].
9252 ///
9253 /// # Example
9254 /// ```ignore,no_run
9255 /// # use google_cloud_storage::model::ListIntelligenceFindingsRequest;
9256 /// let x = ListIntelligenceFindingsRequest::new().set_page_size(42);
9257 /// ```
9258 pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
9259 self.page_size = v.into();
9260 self
9261 }
9262
9263 /// Sets the value of [page_token][crate::model::ListIntelligenceFindingsRequest::page_token].
9264 ///
9265 /// # Example
9266 /// ```ignore,no_run
9267 /// # use google_cloud_storage::model::ListIntelligenceFindingsRequest;
9268 /// let x = ListIntelligenceFindingsRequest::new().set_page_token("example");
9269 /// ```
9270 pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9271 self.page_token = v.into();
9272 self
9273 }
9274}
9275
9276impl wkt::message::Message for ListIntelligenceFindingsRequest {
9277 fn typename() -> &'static str {
9278 "type.googleapis.com/google.storage.control.v2.ListIntelligenceFindingsRequest"
9279 }
9280}
9281
9282/// Response message to list the `IntelligenceFinding` resources associated with
9283/// a project.
9284#[derive(Clone, Default, PartialEq)]
9285#[non_exhaustive]
9286pub struct ListIntelligenceFindingsResponse {
9287 /// The `IntelligenceFinding` resources from the specified project.
9288 pub intelligence_findings: std::vec::Vec<crate::model::IntelligenceFinding>,
9289
9290 /// A token to retrieve the next page of results.
9291 /// Pass this value in the `page_token` field in the subsequent call.
9292 pub next_page_token: std::string::String,
9293
9294 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
9295}
9296
9297impl ListIntelligenceFindingsResponse {
9298 /// Creates a new default instance.
9299 pub fn new() -> Self {
9300 std::default::Default::default()
9301 }
9302
9303 /// Sets the value of [intelligence_findings][crate::model::ListIntelligenceFindingsResponse::intelligence_findings].
9304 ///
9305 /// # Example
9306 /// ```ignore,no_run
9307 /// # use google_cloud_storage::model::ListIntelligenceFindingsResponse;
9308 /// use google_cloud_storage::model::IntelligenceFinding;
9309 /// let x = ListIntelligenceFindingsResponse::new()
9310 /// .set_intelligence_findings([
9311 /// IntelligenceFinding::default()/* use setters */,
9312 /// IntelligenceFinding::default()/* use (different) setters */,
9313 /// ]);
9314 /// ```
9315 pub fn set_intelligence_findings<T, V>(mut self, v: T) -> Self
9316 where
9317 T: std::iter::IntoIterator<Item = V>,
9318 V: std::convert::Into<crate::model::IntelligenceFinding>,
9319 {
9320 use std::iter::Iterator;
9321 self.intelligence_findings = v.into_iter().map(|i| i.into()).collect();
9322 self
9323 }
9324
9325 /// Sets the value of [next_page_token][crate::model::ListIntelligenceFindingsResponse::next_page_token].
9326 ///
9327 /// # Example
9328 /// ```ignore,no_run
9329 /// # use google_cloud_storage::model::ListIntelligenceFindingsResponse;
9330 /// let x = ListIntelligenceFindingsResponse::new().set_next_page_token("example");
9331 /// ```
9332 pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9333 self.next_page_token = v.into();
9334 self
9335 }
9336}
9337
9338impl wkt::message::Message for ListIntelligenceFindingsResponse {
9339 fn typename() -> &'static str {
9340 "type.googleapis.com/google.storage.control.v2.ListIntelligenceFindingsResponse"
9341 }
9342}
9343
9344#[doc(hidden)]
9345impl google_cloud_gax::paginator::internal::PageableResponse for ListIntelligenceFindingsResponse {
9346 type PageItem = crate::model::IntelligenceFinding;
9347
9348 fn items(self) -> std::vec::Vec<Self::PageItem> {
9349 self.intelligence_findings
9350 }
9351
9352 fn next_page_token(&self) -> std::string::String {
9353 use std::clone::Clone;
9354 self.next_page_token.clone()
9355 }
9356}
9357
9358/// Request message to summarize the intelligence findings for the specified
9359/// scope (organization, folder or project).
9360#[derive(Clone, Default, PartialEq)]
9361#[non_exhaustive]
9362pub struct SummarizeIntelligenceFindingsRequest {
9363 /// Required. The scope to summarize the findings for.
9364 /// Format:
9365 ///
9366 /// - `organizations/{organization}/locations/{location}`
9367 /// - `folders/{folder}/locations/{location}`
9368 /// - `projects/{project}/locations/{location}`
9369 pub parent: std::string::String,
9370
9371 /// Optional. Determines the granularity of the findings
9372 /// when the `parent` is an organization or folder.
9373 ///
9374 /// - `PARENT` (or not set): A single summary is
9375 /// returned for each insight type, aggregated across the entire `parent`
9376 /// scope.
9377 /// - `PROJECT`: A separate summary is returned for each
9378 /// insight type for every project within the `parent` scope.
9379 ///
9380 /// The only supported values are `PARENT` and `PROJECT`.
9381 /// If no value is specified, the API behaviour defaults to the `PARENT`.
9382 pub resource_scope: crate::model::summarize_intelligence_findings_request::ResourceScope,
9383
9384 /// Optional. The filter expression, following AIP-160.
9385 /// Supports filtering by FindingType.
9386 pub filter: std::string::String,
9387
9388 /// Optional. The maximum number of findings to return.
9389 ///
9390 /// The maximum value is `100`; values above `100` will be coerced to `100`.
9391 /// The default value is `100`.
9392 pub page_size: i32,
9393
9394 /// Optional. A page token, received from a previous
9395 /// `SummarizeIntelligenceFindings` call. Provide this to retrieve the
9396 /// subsequent page.
9397 ///
9398 /// When paginating, all other parameters provided to
9399 /// `SummarizeIntelligenceFindings` must match the call that provided the page
9400 /// token.
9401 pub page_token: std::string::String,
9402
9403 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
9404}
9405
9406impl SummarizeIntelligenceFindingsRequest {
9407 /// Creates a new default instance.
9408 pub fn new() -> Self {
9409 std::default::Default::default()
9410 }
9411
9412 /// Sets the value of [parent][crate::model::SummarizeIntelligenceFindingsRequest::parent].
9413 ///
9414 /// # Example
9415 /// ```ignore,no_run
9416 /// # use google_cloud_storage::model::SummarizeIntelligenceFindingsRequest;
9417 /// let x = SummarizeIntelligenceFindingsRequest::new().set_parent("example");
9418 /// ```
9419 pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9420 self.parent = v.into();
9421 self
9422 }
9423
9424 /// Sets the value of [resource_scope][crate::model::SummarizeIntelligenceFindingsRequest::resource_scope].
9425 ///
9426 /// # Example
9427 /// ```ignore,no_run
9428 /// # use google_cloud_storage::model::SummarizeIntelligenceFindingsRequest;
9429 /// use google_cloud_storage::model::summarize_intelligence_findings_request::ResourceScope;
9430 /// let x0 = SummarizeIntelligenceFindingsRequest::new().set_resource_scope(ResourceScope::Parent);
9431 /// let x1 = SummarizeIntelligenceFindingsRequest::new().set_resource_scope(ResourceScope::Project);
9432 /// ```
9433 pub fn set_resource_scope<
9434 T: std::convert::Into<crate::model::summarize_intelligence_findings_request::ResourceScope>,
9435 >(
9436 mut self,
9437 v: T,
9438 ) -> Self {
9439 self.resource_scope = v.into();
9440 self
9441 }
9442
9443 /// Sets the value of [filter][crate::model::SummarizeIntelligenceFindingsRequest::filter].
9444 ///
9445 /// # Example
9446 /// ```ignore,no_run
9447 /// # use google_cloud_storage::model::SummarizeIntelligenceFindingsRequest;
9448 /// let x = SummarizeIntelligenceFindingsRequest::new().set_filter("example");
9449 /// ```
9450 pub fn set_filter<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9451 self.filter = v.into();
9452 self
9453 }
9454
9455 /// Sets the value of [page_size][crate::model::SummarizeIntelligenceFindingsRequest::page_size].
9456 ///
9457 /// # Example
9458 /// ```ignore,no_run
9459 /// # use google_cloud_storage::model::SummarizeIntelligenceFindingsRequest;
9460 /// let x = SummarizeIntelligenceFindingsRequest::new().set_page_size(42);
9461 /// ```
9462 pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
9463 self.page_size = v.into();
9464 self
9465 }
9466
9467 /// Sets the value of [page_token][crate::model::SummarizeIntelligenceFindingsRequest::page_token].
9468 ///
9469 /// # Example
9470 /// ```ignore,no_run
9471 /// # use google_cloud_storage::model::SummarizeIntelligenceFindingsRequest;
9472 /// let x = SummarizeIntelligenceFindingsRequest::new().set_page_token("example");
9473 /// ```
9474 pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9475 self.page_token = v.into();
9476 self
9477 }
9478}
9479
9480impl wkt::message::Message for SummarizeIntelligenceFindingsRequest {
9481 fn typename() -> &'static str {
9482 "type.googleapis.com/google.storage.control.v2.SummarizeIntelligenceFindingsRequest"
9483 }
9484}
9485
9486/// Defines additional types related to [SummarizeIntelligenceFindingsRequest].
9487pub mod summarize_intelligence_findings_request {
9488 #[allow(unused_imports)]
9489 use super::*;
9490
9491 /// The list of resource scopes.
9492 ///
9493 /// # Working with unknown values
9494 ///
9495 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
9496 /// additional enum variants at any time. Adding new variants is not considered
9497 /// a breaking change. Applications should write their code in anticipation of:
9498 ///
9499 /// - New values appearing in future releases of the client library, **and**
9500 /// - New values received dynamically, without application changes.
9501 ///
9502 /// Please consult the [Working with enums] section in the user guide for some
9503 /// guidelines.
9504 ///
9505 /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
9506 #[derive(Clone, Debug, PartialEq)]
9507 #[non_exhaustive]
9508 pub enum ResourceScope {
9509 /// The default behavior. Falls back to PARENT behaviour
9510 Unspecified,
9511 /// Summaries are aggregated at the level of the `parent` resource.
9512 Parent,
9513 /// Summaries are broken down by each project within the `parent` scope.
9514 Project,
9515 /// If set, the enum was initialized with an unknown value.
9516 ///
9517 /// Applications can examine the value using [ResourceScope::value] or
9518 /// [ResourceScope::name].
9519 UnknownValue(resource_scope::UnknownValue),
9520 }
9521
9522 #[doc(hidden)]
9523 pub mod resource_scope {
9524 #[allow(unused_imports)]
9525 use super::*;
9526 #[derive(Clone, Debug, PartialEq)]
9527 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
9528 }
9529
9530 impl ResourceScope {
9531 /// Gets the enum value.
9532 ///
9533 /// Returns `None` if the enum contains an unknown value deserialized from
9534 /// the string representation of enums.
9535 pub fn value(&self) -> std::option::Option<i32> {
9536 match self {
9537 Self::Unspecified => std::option::Option::Some(0),
9538 Self::Parent => std::option::Option::Some(1),
9539 Self::Project => std::option::Option::Some(2),
9540 Self::UnknownValue(u) => u.0.value(),
9541 }
9542 }
9543
9544 /// Gets the enum value as a string.
9545 ///
9546 /// Returns `None` if the enum contains an unknown value deserialized from
9547 /// the integer representation of enums.
9548 pub fn name(&self) -> std::option::Option<&str> {
9549 match self {
9550 Self::Unspecified => std::option::Option::Some("RESOURCE_SCOPE_UNSPECIFIED"),
9551 Self::Parent => std::option::Option::Some("PARENT"),
9552 Self::Project => std::option::Option::Some("PROJECT"),
9553 Self::UnknownValue(u) => u.0.name(),
9554 }
9555 }
9556 }
9557
9558 impl std::default::Default for ResourceScope {
9559 fn default() -> Self {
9560 use std::convert::From;
9561 Self::from(0)
9562 }
9563 }
9564
9565 impl std::fmt::Display for ResourceScope {
9566 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
9567 wkt::internal::display_enum(f, self.name(), self.value())
9568 }
9569 }
9570
9571 impl std::convert::From<i32> for ResourceScope {
9572 fn from(value: i32) -> Self {
9573 match value {
9574 0 => Self::Unspecified,
9575 1 => Self::Parent,
9576 2 => Self::Project,
9577 _ => Self::UnknownValue(resource_scope::UnknownValue(
9578 wkt::internal::UnknownEnumValue::Integer(value),
9579 )),
9580 }
9581 }
9582 }
9583
9584 impl std::convert::From<&str> for ResourceScope {
9585 fn from(value: &str) -> Self {
9586 use std::string::ToString;
9587 match value {
9588 "RESOURCE_SCOPE_UNSPECIFIED" => Self::Unspecified,
9589 "PARENT" => Self::Parent,
9590 "PROJECT" => Self::Project,
9591 _ => Self::UnknownValue(resource_scope::UnknownValue(
9592 wkt::internal::UnknownEnumValue::String(value.to_string()),
9593 )),
9594 }
9595 }
9596 }
9597
9598 impl serde::ser::Serialize for ResourceScope {
9599 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
9600 where
9601 S: serde::Serializer,
9602 {
9603 match self {
9604 Self::Unspecified => serializer.serialize_i32(0),
9605 Self::Parent => serializer.serialize_i32(1),
9606 Self::Project => serializer.serialize_i32(2),
9607 Self::UnknownValue(u) => u.0.serialize(serializer),
9608 }
9609 }
9610 }
9611
9612 impl<'de> serde::de::Deserialize<'de> for ResourceScope {
9613 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
9614 where
9615 D: serde::Deserializer<'de>,
9616 {
9617 deserializer.deserialize_any(wkt::internal::EnumVisitor::<ResourceScope>::new(
9618 ".google.storage.control.v2.SummarizeIntelligenceFindingsRequest.ResourceScope",
9619 ))
9620 }
9621 }
9622}
9623
9624/// Response message to summarize the intelligence findings for a specified
9625/// scope (organization, folder or project).
9626#[derive(Clone, Default, PartialEq)]
9627#[non_exhaustive]
9628pub struct SummarizeIntelligenceFindingsResponse {
9629 /// The list of `FindingSummary` summaries.
9630 pub finding_summaries: std::vec::Vec<crate::model::FindingSummary>,
9631
9632 /// A token to retrieve the next page of results.
9633 /// Pass this value in the `page_token` field in the subsequent call to
9634 /// `SummarizeIntelligenceFindings` to retrieve the next page of results.
9635 pub next_page_token: std::string::String,
9636
9637 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
9638}
9639
9640impl SummarizeIntelligenceFindingsResponse {
9641 /// Creates a new default instance.
9642 pub fn new() -> Self {
9643 std::default::Default::default()
9644 }
9645
9646 /// Sets the value of [finding_summaries][crate::model::SummarizeIntelligenceFindingsResponse::finding_summaries].
9647 ///
9648 /// # Example
9649 /// ```ignore,no_run
9650 /// # use google_cloud_storage::model::SummarizeIntelligenceFindingsResponse;
9651 /// use google_cloud_storage::model::FindingSummary;
9652 /// let x = SummarizeIntelligenceFindingsResponse::new()
9653 /// .set_finding_summaries([
9654 /// FindingSummary::default()/* use setters */,
9655 /// FindingSummary::default()/* use (different) setters */,
9656 /// ]);
9657 /// ```
9658 pub fn set_finding_summaries<T, V>(mut self, v: T) -> Self
9659 where
9660 T: std::iter::IntoIterator<Item = V>,
9661 V: std::convert::Into<crate::model::FindingSummary>,
9662 {
9663 use std::iter::Iterator;
9664 self.finding_summaries = v.into_iter().map(|i| i.into()).collect();
9665 self
9666 }
9667
9668 /// Sets the value of [next_page_token][crate::model::SummarizeIntelligenceFindingsResponse::next_page_token].
9669 ///
9670 /// # Example
9671 /// ```ignore,no_run
9672 /// # use google_cloud_storage::model::SummarizeIntelligenceFindingsResponse;
9673 /// let x = SummarizeIntelligenceFindingsResponse::new().set_next_page_token("example");
9674 /// ```
9675 pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9676 self.next_page_token = v.into();
9677 self
9678 }
9679}
9680
9681impl wkt::message::Message for SummarizeIntelligenceFindingsResponse {
9682 fn typename() -> &'static str {
9683 "type.googleapis.com/google.storage.control.v2.SummarizeIntelligenceFindingsResponse"
9684 }
9685}
9686
9687#[doc(hidden)]
9688impl google_cloud_gax::paginator::internal::PageableResponse
9689 for SummarizeIntelligenceFindingsResponse
9690{
9691 type PageItem = crate::model::FindingSummary;
9692
9693 fn items(self) -> std::vec::Vec<Self::PageItem> {
9694 self.finding_summaries
9695 }
9696
9697 fn next_page_token(&self) -> std::string::String {
9698 use std::clone::Clone;
9699 self.next_page_token.clone()
9700 }
9701}
9702
9703/// Request message to get the `IntelligenceFindingRevision` resource associated
9704/// with a project.
9705#[derive(Clone, Default, PartialEq)]
9706#[non_exhaustive]
9707pub struct GetIntelligenceFindingRevisionRequest {
9708 /// Required. The name of the `IntelligenceFindingRevision` resource.
9709 ///
9710 /// ## Format:
9711 ///
9712 /// `projects/{project}/locations/{location}/intelligenceFindings/{intelligence_finding}/revisions/{revision}`
9713 pub name: std::string::String,
9714
9715 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
9716}
9717
9718impl GetIntelligenceFindingRevisionRequest {
9719 /// Creates a new default instance.
9720 pub fn new() -> Self {
9721 std::default::Default::default()
9722 }
9723
9724 /// Sets the value of [name][crate::model::GetIntelligenceFindingRevisionRequest::name].
9725 ///
9726 /// # Example
9727 /// ```ignore,no_run
9728 /// # use google_cloud_storage::model::GetIntelligenceFindingRevisionRequest;
9729 /// # let project_id = "project_id";
9730 /// # let location_id = "location_id";
9731 /// # let intelligence_finding_id = "intelligence_finding_id";
9732 /// # let revision_id = "revision_id";
9733 /// let x = GetIntelligenceFindingRevisionRequest::new().set_name(format!("projects/{project_id}/locations/{location_id}/intelligenceFindings/{intelligence_finding_id}/revisions/{revision_id}"));
9734 /// ```
9735 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9736 self.name = v.into();
9737 self
9738 }
9739}
9740
9741impl wkt::message::Message for GetIntelligenceFindingRevisionRequest {
9742 fn typename() -> &'static str {
9743 "type.googleapis.com/google.storage.control.v2.GetIntelligenceFindingRevisionRequest"
9744 }
9745}
9746
9747/// Request message to list `IntelligenceFindingRevision` resources associated
9748/// with a project.
9749#[derive(Clone, Default, PartialEq)]
9750#[non_exhaustive]
9751pub struct ListIntelligenceFindingRevisionsRequest {
9752 /// Required. The parent of the `IntelligenceFindingRevision` resource.
9753 ///
9754 /// ## Format:
9755 ///
9756 /// `projects/{project}/locations/{location}/intelligenceFindings/{intelligence_finding}`
9757 pub parent: std::string::String,
9758
9759 /// Optional. The maximum number of `IntelligenceFindingRevision` resources to
9760 /// return.
9761 ///
9762 /// The maximum value is `100`; values above `100` will be coerced to `100`.
9763 /// The default value is `100`.
9764 pub page_size: i32,
9765
9766 /// Optional. A page token, received from a previous
9767 /// `ListIntelligenceFindingRevisions` call. Provide this to retrieve the
9768 /// subsequent page.
9769 pub page_token: std::string::String,
9770
9771 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
9772}
9773
9774impl ListIntelligenceFindingRevisionsRequest {
9775 /// Creates a new default instance.
9776 pub fn new() -> Self {
9777 std::default::Default::default()
9778 }
9779
9780 /// Sets the value of [parent][crate::model::ListIntelligenceFindingRevisionsRequest::parent].
9781 ///
9782 /// # Example
9783 /// ```ignore,no_run
9784 /// # use google_cloud_storage::model::ListIntelligenceFindingRevisionsRequest;
9785 /// # let project_id = "project_id";
9786 /// # let location_id = "location_id";
9787 /// # let intelligence_finding_id = "intelligence_finding_id";
9788 /// let x = ListIntelligenceFindingRevisionsRequest::new().set_parent(format!("projects/{project_id}/locations/{location_id}/intelligenceFindings/{intelligence_finding_id}"));
9789 /// ```
9790 pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9791 self.parent = v.into();
9792 self
9793 }
9794
9795 /// Sets the value of [page_size][crate::model::ListIntelligenceFindingRevisionsRequest::page_size].
9796 ///
9797 /// # Example
9798 /// ```ignore,no_run
9799 /// # use google_cloud_storage::model::ListIntelligenceFindingRevisionsRequest;
9800 /// let x = ListIntelligenceFindingRevisionsRequest::new().set_page_size(42);
9801 /// ```
9802 pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
9803 self.page_size = v.into();
9804 self
9805 }
9806
9807 /// Sets the value of [page_token][crate::model::ListIntelligenceFindingRevisionsRequest::page_token].
9808 ///
9809 /// # Example
9810 /// ```ignore,no_run
9811 /// # use google_cloud_storage::model::ListIntelligenceFindingRevisionsRequest;
9812 /// let x = ListIntelligenceFindingRevisionsRequest::new().set_page_token("example");
9813 /// ```
9814 pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9815 self.page_token = v.into();
9816 self
9817 }
9818}
9819
9820impl wkt::message::Message for ListIntelligenceFindingRevisionsRequest {
9821 fn typename() -> &'static str {
9822 "type.googleapis.com/google.storage.control.v2.ListIntelligenceFindingRevisionsRequest"
9823 }
9824}
9825
9826/// Response message to list `IntelligenceFindingRevision` resources associated
9827/// with a project.
9828#[derive(Clone, Default, PartialEq)]
9829#[non_exhaustive]
9830pub struct ListIntelligenceFindingRevisionsResponse {
9831 /// The `IntelligenceFindingRevision` resources from the specified project.
9832 pub intelligence_finding_revisions: std::vec::Vec<crate::model::IntelligenceFindingRevision>,
9833
9834 /// A token that can be sent as `page_token` to retrieve the next page.
9835 pub next_page_token: std::string::String,
9836
9837 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
9838}
9839
9840impl ListIntelligenceFindingRevisionsResponse {
9841 /// Creates a new default instance.
9842 pub fn new() -> Self {
9843 std::default::Default::default()
9844 }
9845
9846 /// Sets the value of [intelligence_finding_revisions][crate::model::ListIntelligenceFindingRevisionsResponse::intelligence_finding_revisions].
9847 ///
9848 /// # Example
9849 /// ```ignore,no_run
9850 /// # use google_cloud_storage::model::ListIntelligenceFindingRevisionsResponse;
9851 /// use google_cloud_storage::model::IntelligenceFindingRevision;
9852 /// let x = ListIntelligenceFindingRevisionsResponse::new()
9853 /// .set_intelligence_finding_revisions([
9854 /// IntelligenceFindingRevision::default()/* use setters */,
9855 /// IntelligenceFindingRevision::default()/* use (different) setters */,
9856 /// ]);
9857 /// ```
9858 pub fn set_intelligence_finding_revisions<T, V>(mut self, v: T) -> Self
9859 where
9860 T: std::iter::IntoIterator<Item = V>,
9861 V: std::convert::Into<crate::model::IntelligenceFindingRevision>,
9862 {
9863 use std::iter::Iterator;
9864 self.intelligence_finding_revisions = v.into_iter().map(|i| i.into()).collect();
9865 self
9866 }
9867
9868 /// Sets the value of [next_page_token][crate::model::ListIntelligenceFindingRevisionsResponse::next_page_token].
9869 ///
9870 /// # Example
9871 /// ```ignore,no_run
9872 /// # use google_cloud_storage::model::ListIntelligenceFindingRevisionsResponse;
9873 /// let x = ListIntelligenceFindingRevisionsResponse::new().set_next_page_token("example");
9874 /// ```
9875 pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9876 self.next_page_token = v.into();
9877 self
9878 }
9879}
9880
9881impl wkt::message::Message for ListIntelligenceFindingRevisionsResponse {
9882 fn typename() -> &'static str {
9883 "type.googleapis.com/google.storage.control.v2.ListIntelligenceFindingRevisionsResponse"
9884 }
9885}
9886
9887#[doc(hidden)]
9888impl google_cloud_gax::paginator::internal::PageableResponse
9889 for ListIntelligenceFindingRevisionsResponse
9890{
9891 type PageItem = crate::model::IntelligenceFindingRevision;
9892
9893 fn items(self) -> std::vec::Vec<Self::PageItem> {
9894 self.intelligence_finding_revisions
9895 }
9896
9897 fn next_page_token(&self) -> std::string::String {
9898 use std::clone::Clone;
9899 self.next_page_token.clone()
9900 }
9901}
9902
9903/// A summary of findings generated for an organization, a folder, or a project.
9904#[derive(Clone, Default, PartialEq)]
9905#[non_exhaustive]
9906pub struct FindingSummary {
9907 /// Output only. The type of the finding.
9908 pub r#type: crate::model::FindingType,
9909
9910 /// Output only. The category of finding.
9911 pub category: crate::model::FindingCategory,
9912
9913 /// Output only. The fully qualified Cloud resource name for which this
9914 /// summary was generated.
9915 /// eg: `//cloudresourcemanager.googleapis.com/projects/p1`
9916 pub target_resource: std::string::String,
9917
9918 /// Output only. The creation time of the earliest finding that this summary is
9919 /// based on.
9920 pub create_time: std::option::Option<wkt::Timestamp>,
9921
9922 /// Output only. The time of the most recent update among all the findings that
9923 /// this summary is based on.
9924 pub update_time: std::option::Option<wkt::Timestamp>,
9925
9926 /// Severity of the finding.
9927 pub severity: crate::model::FindingSeverity,
9928
9929 /// Output only. List of `SummaryDetails`.
9930 pub summary_details: std::vec::Vec<crate::model::finding_summary::SummaryDetails>,
9931
9932 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
9933}
9934
9935impl FindingSummary {
9936 /// Creates a new default instance.
9937 pub fn new() -> Self {
9938 std::default::Default::default()
9939 }
9940
9941 /// Sets the value of [r#type][crate::model::FindingSummary::type].
9942 ///
9943 /// # Example
9944 /// ```ignore,no_run
9945 /// # use google_cloud_storage::model::FindingSummary;
9946 /// use google_cloud_storage::model::FindingType;
9947 /// let x0 = FindingSummary::new().set_type(FindingType::ColdlineAndArchivalStorageOperationsSpike);
9948 /// let x1 = FindingSummary::new().set_type(FindingType::ThrottledRequestSpike);
9949 /// let x2 = FindingSummary::new().set_type(FindingType::CrossRegionEgressSpike);
9950 /// ```
9951 pub fn set_type<T: std::convert::Into<crate::model::FindingType>>(mut self, v: T) -> Self {
9952 self.r#type = v.into();
9953 self
9954 }
9955
9956 /// Sets the value of [category][crate::model::FindingSummary::category].
9957 ///
9958 /// # Example
9959 /// ```ignore,no_run
9960 /// # use google_cloud_storage::model::FindingSummary;
9961 /// use google_cloud_storage::model::FindingCategory;
9962 /// let x0 = FindingSummary::new().set_category(FindingCategory::DataManagement);
9963 /// let x1 = FindingSummary::new().set_category(FindingCategory::Performance);
9964 /// ```
9965 pub fn set_category<T: std::convert::Into<crate::model::FindingCategory>>(
9966 mut self,
9967 v: T,
9968 ) -> Self {
9969 self.category = v.into();
9970 self
9971 }
9972
9973 /// Sets the value of [target_resource][crate::model::FindingSummary::target_resource].
9974 ///
9975 /// # Example
9976 /// ```ignore,no_run
9977 /// # use google_cloud_storage::model::FindingSummary;
9978 /// let x = FindingSummary::new().set_target_resource("example");
9979 /// ```
9980 pub fn set_target_resource<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9981 self.target_resource = v.into();
9982 self
9983 }
9984
9985 /// Sets the value of [create_time][crate::model::FindingSummary::create_time].
9986 ///
9987 /// # Example
9988 /// ```ignore,no_run
9989 /// # use google_cloud_storage::model::FindingSummary;
9990 /// use wkt::Timestamp;
9991 /// let x = FindingSummary::new().set_create_time(Timestamp::default()/* use setters */);
9992 /// ```
9993 pub fn set_create_time<T>(mut self, v: T) -> Self
9994 where
9995 T: std::convert::Into<wkt::Timestamp>,
9996 {
9997 self.create_time = std::option::Option::Some(v.into());
9998 self
9999 }
10000
10001 /// Sets or clears the value of [create_time][crate::model::FindingSummary::create_time].
10002 ///
10003 /// # Example
10004 /// ```ignore,no_run
10005 /// # use google_cloud_storage::model::FindingSummary;
10006 /// use wkt::Timestamp;
10007 /// let x = FindingSummary::new().set_or_clear_create_time(Some(Timestamp::default()/* use setters */));
10008 /// let x = FindingSummary::new().set_or_clear_create_time(None::<Timestamp>);
10009 /// ```
10010 pub fn set_or_clear_create_time<T>(mut self, v: std::option::Option<T>) -> Self
10011 where
10012 T: std::convert::Into<wkt::Timestamp>,
10013 {
10014 self.create_time = v.map(|x| x.into());
10015 self
10016 }
10017
10018 /// Sets the value of [update_time][crate::model::FindingSummary::update_time].
10019 ///
10020 /// # Example
10021 /// ```ignore,no_run
10022 /// # use google_cloud_storage::model::FindingSummary;
10023 /// use wkt::Timestamp;
10024 /// let x = FindingSummary::new().set_update_time(Timestamp::default()/* use setters */);
10025 /// ```
10026 pub fn set_update_time<T>(mut self, v: T) -> Self
10027 where
10028 T: std::convert::Into<wkt::Timestamp>,
10029 {
10030 self.update_time = std::option::Option::Some(v.into());
10031 self
10032 }
10033
10034 /// Sets or clears the value of [update_time][crate::model::FindingSummary::update_time].
10035 ///
10036 /// # Example
10037 /// ```ignore,no_run
10038 /// # use google_cloud_storage::model::FindingSummary;
10039 /// use wkt::Timestamp;
10040 /// let x = FindingSummary::new().set_or_clear_update_time(Some(Timestamp::default()/* use setters */));
10041 /// let x = FindingSummary::new().set_or_clear_update_time(None::<Timestamp>);
10042 /// ```
10043 pub fn set_or_clear_update_time<T>(mut self, v: std::option::Option<T>) -> Self
10044 where
10045 T: std::convert::Into<wkt::Timestamp>,
10046 {
10047 self.update_time = v.map(|x| x.into());
10048 self
10049 }
10050
10051 /// Sets the value of [severity][crate::model::FindingSummary::severity].
10052 ///
10053 /// # Example
10054 /// ```ignore,no_run
10055 /// # use google_cloud_storage::model::FindingSummary;
10056 /// use google_cloud_storage::model::FindingSeverity;
10057 /// let x0 = FindingSummary::new().set_severity(FindingSeverity::Critical);
10058 /// ```
10059 pub fn set_severity<T: std::convert::Into<crate::model::FindingSeverity>>(
10060 mut self,
10061 v: T,
10062 ) -> Self {
10063 self.severity = v.into();
10064 self
10065 }
10066
10067 /// Sets the value of [summary_details][crate::model::FindingSummary::summary_details].
10068 ///
10069 /// # Example
10070 /// ```ignore,no_run
10071 /// # use google_cloud_storage::model::FindingSummary;
10072 /// use google_cloud_storage::model::finding_summary::SummaryDetails;
10073 /// let x = FindingSummary::new()
10074 /// .set_summary_details([
10075 /// SummaryDetails::default()/* use setters */,
10076 /// SummaryDetails::default()/* use (different) setters */,
10077 /// ]);
10078 /// ```
10079 pub fn set_summary_details<T, V>(mut self, v: T) -> Self
10080 where
10081 T: std::iter::IntoIterator<Item = V>,
10082 V: std::convert::Into<crate::model::finding_summary::SummaryDetails>,
10083 {
10084 use std::iter::Iterator;
10085 self.summary_details = v.into_iter().map(|i| i.into()).collect();
10086 self
10087 }
10088}
10089
10090impl wkt::message::Message for FindingSummary {
10091 fn typename() -> &'static str {
10092 "type.googleapis.com/google.storage.control.v2.FindingSummary"
10093 }
10094}
10095
10096/// Defines additional types related to [FindingSummary].
10097pub mod finding_summary {
10098 #[allow(unused_imports)]
10099 use super::*;
10100
10101 /// Details about the `FindingSummary` resource.
10102 #[derive(Clone, Default, PartialEq)]
10103 #[non_exhaustive]
10104 pub struct SummaryDetails {
10105 /// Output only. The type of Cloud resource this summary detail applies to.
10106 pub resource_type: crate::model::finding_summary::summary_details::ResourceType,
10107
10108 /// Output only. A short description about the FindingSummary
10109 pub description: std::string::String,
10110
10111 /// The value of the summary.
10112 pub magnitude:
10113 std::option::Option<crate::model::finding_summary::summary_details::Magnitude>,
10114
10115 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
10116 }
10117
10118 impl SummaryDetails {
10119 /// Creates a new default instance.
10120 pub fn new() -> Self {
10121 std::default::Default::default()
10122 }
10123
10124 /// Sets the value of [resource_type][crate::model::finding_summary::SummaryDetails::resource_type].
10125 ///
10126 /// # Example
10127 /// ```ignore,no_run
10128 /// # use google_cloud_storage::model::finding_summary::SummaryDetails;
10129 /// use google_cloud_storage::model::finding_summary::summary_details::ResourceType;
10130 /// let x0 = SummaryDetails::new().set_resource_type(ResourceType::Project);
10131 /// let x1 = SummaryDetails::new().set_resource_type(ResourceType::Bucket);
10132 /// ```
10133 pub fn set_resource_type<
10134 T: std::convert::Into<crate::model::finding_summary::summary_details::ResourceType>,
10135 >(
10136 mut self,
10137 v: T,
10138 ) -> Self {
10139 self.resource_type = v.into();
10140 self
10141 }
10142
10143 /// Sets the value of [description][crate::model::finding_summary::SummaryDetails::description].
10144 ///
10145 /// # Example
10146 /// ```ignore,no_run
10147 /// # use google_cloud_storage::model::finding_summary::SummaryDetails;
10148 /// let x = SummaryDetails::new().set_description("example");
10149 /// ```
10150 pub fn set_description<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
10151 self.description = v.into();
10152 self
10153 }
10154
10155 /// Sets the value of [magnitude][crate::model::finding_summary::SummaryDetails::magnitude].
10156 ///
10157 /// Note that all the setters affecting `magnitude` are mutually
10158 /// exclusive.
10159 ///
10160 /// # Example
10161 /// ```ignore,no_run
10162 /// # use google_cloud_storage::model::finding_summary::SummaryDetails;
10163 /// use google_cloud_storage::model::finding_summary::summary_details::Magnitude;
10164 /// let x = SummaryDetails::new().set_magnitude(Some(Magnitude::Count(42)));
10165 /// ```
10166 pub fn set_magnitude<
10167 T: std::convert::Into<
10168 std::option::Option<crate::model::finding_summary::summary_details::Magnitude>,
10169 >,
10170 >(
10171 mut self,
10172 v: T,
10173 ) -> Self {
10174 self.magnitude = v.into();
10175 self
10176 }
10177
10178 /// The value of [magnitude][crate::model::finding_summary::SummaryDetails::magnitude]
10179 /// if it holds a `Count`, `None` if the field is not set or
10180 /// holds a different branch.
10181 pub fn count(&self) -> std::option::Option<&i64> {
10182 #[allow(unreachable_patterns)]
10183 self.magnitude.as_ref().and_then(|v| match v {
10184 crate::model::finding_summary::summary_details::Magnitude::Count(v) => {
10185 std::option::Option::Some(v)
10186 }
10187 _ => std::option::Option::None,
10188 })
10189 }
10190
10191 /// Sets the value of [magnitude][crate::model::finding_summary::SummaryDetails::magnitude]
10192 /// to hold a `Count`.
10193 ///
10194 /// Note that all the setters affecting `magnitude` are
10195 /// mutually exclusive.
10196 ///
10197 /// # Example
10198 /// ```ignore,no_run
10199 /// # use google_cloud_storage::model::finding_summary::SummaryDetails;
10200 /// let x = SummaryDetails::new().set_count(42);
10201 /// assert!(x.count().is_some());
10202 /// assert!(x.percentage().is_none());
10203 /// ```
10204 pub fn set_count<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
10205 self.magnitude = std::option::Option::Some(
10206 crate::model::finding_summary::summary_details::Magnitude::Count(v.into()),
10207 );
10208 self
10209 }
10210
10211 /// The value of [magnitude][crate::model::finding_summary::SummaryDetails::magnitude]
10212 /// if it holds a `Percentage`, `None` if the field is not set or
10213 /// holds a different branch.
10214 pub fn percentage(&self) -> std::option::Option<&f32> {
10215 #[allow(unreachable_patterns)]
10216 self.magnitude.as_ref().and_then(|v| match v {
10217 crate::model::finding_summary::summary_details::Magnitude::Percentage(v) => {
10218 std::option::Option::Some(v)
10219 }
10220 _ => std::option::Option::None,
10221 })
10222 }
10223
10224 /// Sets the value of [magnitude][crate::model::finding_summary::SummaryDetails::magnitude]
10225 /// to hold a `Percentage`.
10226 ///
10227 /// Note that all the setters affecting `magnitude` are
10228 /// mutually exclusive.
10229 ///
10230 /// # Example
10231 /// ```ignore,no_run
10232 /// # use google_cloud_storage::model::finding_summary::SummaryDetails;
10233 /// let x = SummaryDetails::new().set_percentage(42.0);
10234 /// assert!(x.percentage().is_some());
10235 /// assert!(x.count().is_none());
10236 /// ```
10237 pub fn set_percentage<T: std::convert::Into<f32>>(mut self, v: T) -> Self {
10238 self.magnitude = std::option::Option::Some(
10239 crate::model::finding_summary::summary_details::Magnitude::Percentage(v.into()),
10240 );
10241 self
10242 }
10243 }
10244
10245 impl wkt::message::Message for SummaryDetails {
10246 fn typename() -> &'static str {
10247 "type.googleapis.com/google.storage.control.v2.FindingSummary.SummaryDetails"
10248 }
10249 }
10250
10251 /// Defines additional types related to [SummaryDetails].
10252 pub mod summary_details {
10253 #[allow(unused_imports)]
10254 use super::*;
10255
10256 /// The list of resource types.
10257 ///
10258 /// # Working with unknown values
10259 ///
10260 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
10261 /// additional enum variants at any time. Adding new variants is not considered
10262 /// a breaking change. Applications should write their code in anticipation of:
10263 ///
10264 /// - New values appearing in future releases of the client library, **and**
10265 /// - New values received dynamically, without application changes.
10266 ///
10267 /// Please consult the [Working with enums] section in the user guide for some
10268 /// guidelines.
10269 ///
10270 /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
10271 #[derive(Clone, Debug, PartialEq)]
10272 #[non_exhaustive]
10273 pub enum ResourceType {
10274 /// Resource type is unspecified.
10275 Unspecified,
10276 /// Resource type is project.
10277 Project,
10278 /// Resource type is bucket.
10279 Bucket,
10280 /// If set, the enum was initialized with an unknown value.
10281 ///
10282 /// Applications can examine the value using [ResourceType::value] or
10283 /// [ResourceType::name].
10284 UnknownValue(resource_type::UnknownValue),
10285 }
10286
10287 #[doc(hidden)]
10288 pub mod resource_type {
10289 #[allow(unused_imports)]
10290 use super::*;
10291 #[derive(Clone, Debug, PartialEq)]
10292 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
10293 }
10294
10295 impl ResourceType {
10296 /// Gets the enum value.
10297 ///
10298 /// Returns `None` if the enum contains an unknown value deserialized from
10299 /// the string representation of enums.
10300 pub fn value(&self) -> std::option::Option<i32> {
10301 match self {
10302 Self::Unspecified => std::option::Option::Some(0),
10303 Self::Project => std::option::Option::Some(1),
10304 Self::Bucket => std::option::Option::Some(2),
10305 Self::UnknownValue(u) => u.0.value(),
10306 }
10307 }
10308
10309 /// Gets the enum value as a string.
10310 ///
10311 /// Returns `None` if the enum contains an unknown value deserialized from
10312 /// the integer representation of enums.
10313 pub fn name(&self) -> std::option::Option<&str> {
10314 match self {
10315 Self::Unspecified => std::option::Option::Some("RESOURCE_TYPE_UNSPECIFIED"),
10316 Self::Project => std::option::Option::Some("PROJECT"),
10317 Self::Bucket => std::option::Option::Some("BUCKET"),
10318 Self::UnknownValue(u) => u.0.name(),
10319 }
10320 }
10321 }
10322
10323 impl std::default::Default for ResourceType {
10324 fn default() -> Self {
10325 use std::convert::From;
10326 Self::from(0)
10327 }
10328 }
10329
10330 impl std::fmt::Display for ResourceType {
10331 fn fmt(
10332 &self,
10333 f: &mut std::fmt::Formatter<'_>,
10334 ) -> std::result::Result<(), std::fmt::Error> {
10335 wkt::internal::display_enum(f, self.name(), self.value())
10336 }
10337 }
10338
10339 impl std::convert::From<i32> for ResourceType {
10340 fn from(value: i32) -> Self {
10341 match value {
10342 0 => Self::Unspecified,
10343 1 => Self::Project,
10344 2 => Self::Bucket,
10345 _ => Self::UnknownValue(resource_type::UnknownValue(
10346 wkt::internal::UnknownEnumValue::Integer(value),
10347 )),
10348 }
10349 }
10350 }
10351
10352 impl std::convert::From<&str> for ResourceType {
10353 fn from(value: &str) -> Self {
10354 use std::string::ToString;
10355 match value {
10356 "RESOURCE_TYPE_UNSPECIFIED" => Self::Unspecified,
10357 "PROJECT" => Self::Project,
10358 "BUCKET" => Self::Bucket,
10359 _ => Self::UnknownValue(resource_type::UnknownValue(
10360 wkt::internal::UnknownEnumValue::String(value.to_string()),
10361 )),
10362 }
10363 }
10364 }
10365
10366 impl serde::ser::Serialize for ResourceType {
10367 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
10368 where
10369 S: serde::Serializer,
10370 {
10371 match self {
10372 Self::Unspecified => serializer.serialize_i32(0),
10373 Self::Project => serializer.serialize_i32(1),
10374 Self::Bucket => serializer.serialize_i32(2),
10375 Self::UnknownValue(u) => u.0.serialize(serializer),
10376 }
10377 }
10378 }
10379
10380 impl<'de> serde::de::Deserialize<'de> for ResourceType {
10381 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
10382 where
10383 D: serde::Deserializer<'de>,
10384 {
10385 deserializer.deserialize_any(wkt::internal::EnumVisitor::<ResourceType>::new(
10386 ".google.storage.control.v2.FindingSummary.SummaryDetails.ResourceType",
10387 ))
10388 }
10389 }
10390
10391 /// The value of the summary.
10392 #[derive(Clone, Debug, PartialEq)]
10393 #[non_exhaustive]
10394 pub enum Magnitude {
10395 /// The count of impacted resources.
10396 Count(i64),
10397 /// The percentage of impacted resources.
10398 Percentage(f32),
10399 }
10400
10401 impl Magnitude {
10402 /// Initializes the enum to the [Count](Self::Count) branch.
10403 pub fn from_count(value: impl std::convert::Into<i64>) -> Self {
10404 Self::Count(value.into())
10405 }
10406 /// Initializes the enum to the [Percentage](Self::Percentage) branch.
10407 pub fn from_percentage(value: impl std::convert::Into<f32>) -> Self {
10408 Self::Percentage(value.into())
10409 }
10410 }
10411 }
10412}
10413
10414/// List the finding types.
10415///
10416/// # Working with unknown values
10417///
10418/// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
10419/// additional enum variants at any time. Adding new variants is not considered
10420/// a breaking change. Applications should write their code in anticipation of:
10421///
10422/// - New values appearing in future releases of the client library, **and**
10423/// - New values received dynamically, without application changes.
10424///
10425/// Please consult the [Working with enums] section in the user guide for some
10426/// guidelines.
10427///
10428/// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
10429#[derive(Clone, Debug, PartialEq)]
10430#[non_exhaustive]
10431pub enum FindingType {
10432 /// Finding type is unspecified.
10433 Unspecified,
10434 /// Finding is about a spike in Class A/B operations on Coldline or Archive
10435 /// Cloud Storage objects.
10436 ColdlineAndArchivalStorageOperationsSpike,
10437 /// Finding is about a spike in throttled requests (429 errors) within a
10438 /// project.
10439 ThrottledRequestSpike,
10440 /// Finding is about a spike in cross region egress in Cloud Storage.
10441 CrossRegionEgressSpike,
10442 /// Finding is about growth in storage above the expected trend.
10443 StorageGrowthAboveTrend,
10444 /// If set, the enum was initialized with an unknown value.
10445 ///
10446 /// Applications can examine the value using [FindingType::value] or
10447 /// [FindingType::name].
10448 UnknownValue(finding_type::UnknownValue),
10449}
10450
10451#[doc(hidden)]
10452pub mod finding_type {
10453 #[allow(unused_imports)]
10454 use super::*;
10455 #[derive(Clone, Debug, PartialEq)]
10456 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
10457}
10458
10459impl FindingType {
10460 /// Gets the enum value.
10461 ///
10462 /// Returns `None` if the enum contains an unknown value deserialized from
10463 /// the string representation of enums.
10464 pub fn value(&self) -> std::option::Option<i32> {
10465 match self {
10466 Self::Unspecified => std::option::Option::Some(0),
10467 Self::ColdlineAndArchivalStorageOperationsSpike => std::option::Option::Some(1),
10468 Self::ThrottledRequestSpike => std::option::Option::Some(2),
10469 Self::CrossRegionEgressSpike => std::option::Option::Some(3),
10470 Self::StorageGrowthAboveTrend => std::option::Option::Some(4),
10471 Self::UnknownValue(u) => u.0.value(),
10472 }
10473 }
10474
10475 /// Gets the enum value as a string.
10476 ///
10477 /// Returns `None` if the enum contains an unknown value deserialized from
10478 /// the integer representation of enums.
10479 pub fn name(&self) -> std::option::Option<&str> {
10480 match self {
10481 Self::Unspecified => std::option::Option::Some("FINDING_TYPE_UNSPECIFIED"),
10482 Self::ColdlineAndArchivalStorageOperationsSpike => std::option::Option::Some(
10483 "FINDING_TYPE_COLDLINE_AND_ARCHIVAL_STORAGE_OPERATIONS_SPIKE",
10484 ),
10485 Self::ThrottledRequestSpike => {
10486 std::option::Option::Some("FINDING_TYPE_THROTTLED_REQUEST_SPIKE")
10487 }
10488 Self::CrossRegionEgressSpike => {
10489 std::option::Option::Some("FINDING_TYPE_CROSS_REGION_EGRESS_SPIKE")
10490 }
10491 Self::StorageGrowthAboveTrend => {
10492 std::option::Option::Some("FINDING_TYPE_STORAGE_GROWTH_ABOVE_TREND")
10493 }
10494 Self::UnknownValue(u) => u.0.name(),
10495 }
10496 }
10497}
10498
10499impl std::default::Default for FindingType {
10500 fn default() -> Self {
10501 use std::convert::From;
10502 Self::from(0)
10503 }
10504}
10505
10506impl std::fmt::Display for FindingType {
10507 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
10508 wkt::internal::display_enum(f, self.name(), self.value())
10509 }
10510}
10511
10512impl std::convert::From<i32> for FindingType {
10513 fn from(value: i32) -> Self {
10514 match value {
10515 0 => Self::Unspecified,
10516 1 => Self::ColdlineAndArchivalStorageOperationsSpike,
10517 2 => Self::ThrottledRequestSpike,
10518 3 => Self::CrossRegionEgressSpike,
10519 4 => Self::StorageGrowthAboveTrend,
10520 _ => Self::UnknownValue(finding_type::UnknownValue(
10521 wkt::internal::UnknownEnumValue::Integer(value),
10522 )),
10523 }
10524 }
10525}
10526
10527impl std::convert::From<&str> for FindingType {
10528 fn from(value: &str) -> Self {
10529 use std::string::ToString;
10530 match value {
10531 "FINDING_TYPE_UNSPECIFIED" => Self::Unspecified,
10532 "FINDING_TYPE_COLDLINE_AND_ARCHIVAL_STORAGE_OPERATIONS_SPIKE" => {
10533 Self::ColdlineAndArchivalStorageOperationsSpike
10534 }
10535 "FINDING_TYPE_THROTTLED_REQUEST_SPIKE" => Self::ThrottledRequestSpike,
10536 "FINDING_TYPE_CROSS_REGION_EGRESS_SPIKE" => Self::CrossRegionEgressSpike,
10537 "FINDING_TYPE_STORAGE_GROWTH_ABOVE_TREND" => Self::StorageGrowthAboveTrend,
10538 _ => Self::UnknownValue(finding_type::UnknownValue(
10539 wkt::internal::UnknownEnumValue::String(value.to_string()),
10540 )),
10541 }
10542 }
10543}
10544
10545impl serde::ser::Serialize for FindingType {
10546 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
10547 where
10548 S: serde::Serializer,
10549 {
10550 match self {
10551 Self::Unspecified => serializer.serialize_i32(0),
10552 Self::ColdlineAndArchivalStorageOperationsSpike => serializer.serialize_i32(1),
10553 Self::ThrottledRequestSpike => serializer.serialize_i32(2),
10554 Self::CrossRegionEgressSpike => serializer.serialize_i32(3),
10555 Self::StorageGrowthAboveTrend => serializer.serialize_i32(4),
10556 Self::UnknownValue(u) => u.0.serialize(serializer),
10557 }
10558 }
10559}
10560
10561impl<'de> serde::de::Deserialize<'de> for FindingType {
10562 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
10563 where
10564 D: serde::Deserializer<'de>,
10565 {
10566 deserializer.deserialize_any(wkt::internal::EnumVisitor::<FindingType>::new(
10567 ".google.storage.control.v2.FindingType",
10568 ))
10569 }
10570}
10571
10572/// List of categories a finding falls under.
10573///
10574/// # Working with unknown values
10575///
10576/// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
10577/// additional enum variants at any time. Adding new variants is not considered
10578/// a breaking change. Applications should write their code in anticipation of:
10579///
10580/// - New values appearing in future releases of the client library, **and**
10581/// - New values received dynamically, without application changes.
10582///
10583/// Please consult the [Working with enums] section in the user guide for some
10584/// guidelines.
10585///
10586/// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
10587#[derive(Clone, Debug, PartialEq)]
10588#[non_exhaustive]
10589pub enum FindingCategory {
10590 /// Category is unspecified.
10591 Unspecified,
10592 /// Category is 'Data Management'.
10593 DataManagement,
10594 /// Category is 'Performance'.
10595 Performance,
10596 /// If set, the enum was initialized with an unknown value.
10597 ///
10598 /// Applications can examine the value using [FindingCategory::value] or
10599 /// [FindingCategory::name].
10600 UnknownValue(finding_category::UnknownValue),
10601}
10602
10603#[doc(hidden)]
10604pub mod finding_category {
10605 #[allow(unused_imports)]
10606 use super::*;
10607 #[derive(Clone, Debug, PartialEq)]
10608 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
10609}
10610
10611impl FindingCategory {
10612 /// Gets the enum value.
10613 ///
10614 /// Returns `None` if the enum contains an unknown value deserialized from
10615 /// the string representation of enums.
10616 pub fn value(&self) -> std::option::Option<i32> {
10617 match self {
10618 Self::Unspecified => std::option::Option::Some(0),
10619 Self::DataManagement => std::option::Option::Some(1),
10620 Self::Performance => std::option::Option::Some(2),
10621 Self::UnknownValue(u) => u.0.value(),
10622 }
10623 }
10624
10625 /// Gets the enum value as a string.
10626 ///
10627 /// Returns `None` if the enum contains an unknown value deserialized from
10628 /// the integer representation of enums.
10629 pub fn name(&self) -> std::option::Option<&str> {
10630 match self {
10631 Self::Unspecified => std::option::Option::Some("FINDING_CATEGORY_UNSPECIFIED"),
10632 Self::DataManagement => std::option::Option::Some("FINDING_CATEGORY_DATA_MANAGEMENT"),
10633 Self::Performance => std::option::Option::Some("FINDING_CATEGORY_PERFORMANCE"),
10634 Self::UnknownValue(u) => u.0.name(),
10635 }
10636 }
10637}
10638
10639impl std::default::Default for FindingCategory {
10640 fn default() -> Self {
10641 use std::convert::From;
10642 Self::from(0)
10643 }
10644}
10645
10646impl std::fmt::Display for FindingCategory {
10647 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
10648 wkt::internal::display_enum(f, self.name(), self.value())
10649 }
10650}
10651
10652impl std::convert::From<i32> for FindingCategory {
10653 fn from(value: i32) -> Self {
10654 match value {
10655 0 => Self::Unspecified,
10656 1 => Self::DataManagement,
10657 2 => Self::Performance,
10658 _ => Self::UnknownValue(finding_category::UnknownValue(
10659 wkt::internal::UnknownEnumValue::Integer(value),
10660 )),
10661 }
10662 }
10663}
10664
10665impl std::convert::From<&str> for FindingCategory {
10666 fn from(value: &str) -> Self {
10667 use std::string::ToString;
10668 match value {
10669 "FINDING_CATEGORY_UNSPECIFIED" => Self::Unspecified,
10670 "FINDING_CATEGORY_DATA_MANAGEMENT" => Self::DataManagement,
10671 "FINDING_CATEGORY_PERFORMANCE" => Self::Performance,
10672 _ => Self::UnknownValue(finding_category::UnknownValue(
10673 wkt::internal::UnknownEnumValue::String(value.to_string()),
10674 )),
10675 }
10676 }
10677}
10678
10679impl serde::ser::Serialize for FindingCategory {
10680 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
10681 where
10682 S: serde::Serializer,
10683 {
10684 match self {
10685 Self::Unspecified => serializer.serialize_i32(0),
10686 Self::DataManagement => serializer.serialize_i32(1),
10687 Self::Performance => serializer.serialize_i32(2),
10688 Self::UnknownValue(u) => u.0.serialize(serializer),
10689 }
10690 }
10691}
10692
10693impl<'de> serde::de::Deserialize<'de> for FindingCategory {
10694 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
10695 where
10696 D: serde::Deserializer<'de>,
10697 {
10698 deserializer.deserialize_any(wkt::internal::EnumVisitor::<FindingCategory>::new(
10699 ".google.storage.control.v2.FindingCategory",
10700 ))
10701 }
10702}
10703
10704/// Severity of the `IntelligenceFinding` resource.
10705///
10706/// # Working with unknown values
10707///
10708/// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
10709/// additional enum variants at any time. Adding new variants is not considered
10710/// a breaking change. Applications should write their code in anticipation of:
10711///
10712/// - New values appearing in future releases of the client library, **and**
10713/// - New values received dynamically, without application changes.
10714///
10715/// Please consult the [Working with enums] section in the user guide for some
10716/// guidelines.
10717///
10718/// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
10719#[derive(Clone, Debug, PartialEq)]
10720#[non_exhaustive]
10721pub enum FindingSeverity {
10722 /// Severity is unspecified.
10723 Unspecified,
10724 /// Severity is critical.
10725 Critical,
10726 /// If set, the enum was initialized with an unknown value.
10727 ///
10728 /// Applications can examine the value using [FindingSeverity::value] or
10729 /// [FindingSeverity::name].
10730 UnknownValue(finding_severity::UnknownValue),
10731}
10732
10733#[doc(hidden)]
10734pub mod finding_severity {
10735 #[allow(unused_imports)]
10736 use super::*;
10737 #[derive(Clone, Debug, PartialEq)]
10738 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
10739}
10740
10741impl FindingSeverity {
10742 /// Gets the enum value.
10743 ///
10744 /// Returns `None` if the enum contains an unknown value deserialized from
10745 /// the string representation of enums.
10746 pub fn value(&self) -> std::option::Option<i32> {
10747 match self {
10748 Self::Unspecified => std::option::Option::Some(0),
10749 Self::Critical => std::option::Option::Some(1),
10750 Self::UnknownValue(u) => u.0.value(),
10751 }
10752 }
10753
10754 /// Gets the enum value as a string.
10755 ///
10756 /// Returns `None` if the enum contains an unknown value deserialized from
10757 /// the integer representation of enums.
10758 pub fn name(&self) -> std::option::Option<&str> {
10759 match self {
10760 Self::Unspecified => std::option::Option::Some("FINDING_SEVERITY_UNSPECIFIED"),
10761 Self::Critical => std::option::Option::Some("FINDING_SEVERITY_CRITICAL"),
10762 Self::UnknownValue(u) => u.0.name(),
10763 }
10764 }
10765}
10766
10767impl std::default::Default for FindingSeverity {
10768 fn default() -> Self {
10769 use std::convert::From;
10770 Self::from(0)
10771 }
10772}
10773
10774impl std::fmt::Display for FindingSeverity {
10775 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
10776 wkt::internal::display_enum(f, self.name(), self.value())
10777 }
10778}
10779
10780impl std::convert::From<i32> for FindingSeverity {
10781 fn from(value: i32) -> Self {
10782 match value {
10783 0 => Self::Unspecified,
10784 1 => Self::Critical,
10785 _ => Self::UnknownValue(finding_severity::UnknownValue(
10786 wkt::internal::UnknownEnumValue::Integer(value),
10787 )),
10788 }
10789 }
10790}
10791
10792impl std::convert::From<&str> for FindingSeverity {
10793 fn from(value: &str) -> Self {
10794 use std::string::ToString;
10795 match value {
10796 "FINDING_SEVERITY_UNSPECIFIED" => Self::Unspecified,
10797 "FINDING_SEVERITY_CRITICAL" => Self::Critical,
10798 _ => Self::UnknownValue(finding_severity::UnknownValue(
10799 wkt::internal::UnknownEnumValue::String(value.to_string()),
10800 )),
10801 }
10802 }
10803}
10804
10805impl serde::ser::Serialize for FindingSeverity {
10806 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
10807 where
10808 S: serde::Serializer,
10809 {
10810 match self {
10811 Self::Unspecified => serializer.serialize_i32(0),
10812 Self::Critical => serializer.serialize_i32(1),
10813 Self::UnknownValue(u) => u.0.serialize(serializer),
10814 }
10815 }
10816}
10817
10818impl<'de> serde::de::Deserialize<'de> for FindingSeverity {
10819 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
10820 where
10821 D: serde::Deserializer<'de>,
10822 {
10823 deserializer.deserialize_any(wkt::internal::EnumVisitor::<FindingSeverity>::new(
10824 ".google.storage.control.v2.FindingSeverity",
10825 ))
10826 }
10827}