google_cloud_storagebatchoperations_v1/model.rs
1// Copyright 2025 Google LLC
2//
3// Licensed under the Apache License, Version 2.0 (the "License");
4// you may not use this file except in compliance with the License.
5// You may obtain a copy of the License at
6//
7// https://www.apache.org/licenses/LICENSE-2.0
8//
9// Unless required by applicable law or agreed to in writing, software
10// distributed under the License is distributed on an "AS IS" BASIS,
11// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12// See the License for the specific language governing permissions and
13// limitations under the License.
14//
15// Code generated by sidekick. DO NOT EDIT.
16
17#![allow(rustdoc::redundant_explicit_links)]
18#![allow(rustdoc::broken_intra_doc_links)]
19#![no_implicit_prelude]
20extern crate async_trait;
21extern crate bytes;
22extern crate gaxi;
23extern crate google_cloud_gax;
24extern crate google_cloud_location;
25extern crate google_cloud_longrunning;
26extern crate google_cloud_lro;
27extern crate google_cloud_rpc;
28extern crate serde;
29extern crate serde_json;
30extern crate serde_with;
31extern crate std;
32extern crate tracing;
33extern crate wkt;
34
35mod debug;
36mod deserialize;
37mod serialize;
38
39/// Message for request to list Jobs
40#[derive(Clone, Default, PartialEq)]
41#[non_exhaustive]
42pub struct ListJobsRequest {
43 /// Required. Format: projects/{project_id}/locations/global.
44 pub parent: std::string::String,
45
46 /// Optional. Filters results as defined by <https://google.aip.dev/160>.
47 pub filter: std::string::String,
48
49 /// Optional. The list page size. default page size is 100.
50 pub page_size: i32,
51
52 /// Optional. The list page token.
53 pub page_token: std::string::String,
54
55 /// Optional. Field to sort by. Supported fields are name, create_time.
56 pub order_by: std::string::String,
57
58 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
59}
60
61impl ListJobsRequest {
62 pub fn new() -> Self {
63 std::default::Default::default()
64 }
65
66 /// Sets the value of [parent][crate::model::ListJobsRequest::parent].
67 ///
68 /// # Example
69 /// ```ignore,no_run
70 /// # use google_cloud_storagebatchoperations_v1::model::ListJobsRequest;
71 /// let x = ListJobsRequest::new().set_parent("example");
72 /// ```
73 pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
74 self.parent = v.into();
75 self
76 }
77
78 /// Sets the value of [filter][crate::model::ListJobsRequest::filter].
79 ///
80 /// # Example
81 /// ```ignore,no_run
82 /// # use google_cloud_storagebatchoperations_v1::model::ListJobsRequest;
83 /// let x = ListJobsRequest::new().set_filter("example");
84 /// ```
85 pub fn set_filter<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
86 self.filter = v.into();
87 self
88 }
89
90 /// Sets the value of [page_size][crate::model::ListJobsRequest::page_size].
91 ///
92 /// # Example
93 /// ```ignore,no_run
94 /// # use google_cloud_storagebatchoperations_v1::model::ListJobsRequest;
95 /// let x = ListJobsRequest::new().set_page_size(42);
96 /// ```
97 pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
98 self.page_size = v.into();
99 self
100 }
101
102 /// Sets the value of [page_token][crate::model::ListJobsRequest::page_token].
103 ///
104 /// # Example
105 /// ```ignore,no_run
106 /// # use google_cloud_storagebatchoperations_v1::model::ListJobsRequest;
107 /// let x = ListJobsRequest::new().set_page_token("example");
108 /// ```
109 pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
110 self.page_token = v.into();
111 self
112 }
113
114 /// Sets the value of [order_by][crate::model::ListJobsRequest::order_by].
115 ///
116 /// # Example
117 /// ```ignore,no_run
118 /// # use google_cloud_storagebatchoperations_v1::model::ListJobsRequest;
119 /// let x = ListJobsRequest::new().set_order_by("example");
120 /// ```
121 pub fn set_order_by<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
122 self.order_by = v.into();
123 self
124 }
125}
126
127impl wkt::message::Message for ListJobsRequest {
128 fn typename() -> &'static str {
129 "type.googleapis.com/google.cloud.storagebatchoperations.v1.ListJobsRequest"
130 }
131}
132
133/// Message for response to listing Jobs
134#[derive(Clone, Default, PartialEq)]
135#[non_exhaustive]
136pub struct ListJobsResponse {
137 /// A list of storage batch jobs.
138 pub jobs: std::vec::Vec<crate::model::Job>,
139
140 /// A token identifying a page of results.
141 pub next_page_token: std::string::String,
142
143 /// Locations that could not be reached.
144 pub unreachable: std::vec::Vec<std::string::String>,
145
146 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
147}
148
149impl ListJobsResponse {
150 pub fn new() -> Self {
151 std::default::Default::default()
152 }
153
154 /// Sets the value of [jobs][crate::model::ListJobsResponse::jobs].
155 ///
156 /// # Example
157 /// ```ignore,no_run
158 /// # use google_cloud_storagebatchoperations_v1::model::ListJobsResponse;
159 /// use google_cloud_storagebatchoperations_v1::model::Job;
160 /// let x = ListJobsResponse::new()
161 /// .set_jobs([
162 /// Job::default()/* use setters */,
163 /// Job::default()/* use (different) setters */,
164 /// ]);
165 /// ```
166 pub fn set_jobs<T, V>(mut self, v: T) -> Self
167 where
168 T: std::iter::IntoIterator<Item = V>,
169 V: std::convert::Into<crate::model::Job>,
170 {
171 use std::iter::Iterator;
172 self.jobs = v.into_iter().map(|i| i.into()).collect();
173 self
174 }
175
176 /// Sets the value of [next_page_token][crate::model::ListJobsResponse::next_page_token].
177 ///
178 /// # Example
179 /// ```ignore,no_run
180 /// # use google_cloud_storagebatchoperations_v1::model::ListJobsResponse;
181 /// let x = ListJobsResponse::new().set_next_page_token("example");
182 /// ```
183 pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
184 self.next_page_token = v.into();
185 self
186 }
187
188 /// Sets the value of [unreachable][crate::model::ListJobsResponse::unreachable].
189 ///
190 /// # Example
191 /// ```ignore,no_run
192 /// # use google_cloud_storagebatchoperations_v1::model::ListJobsResponse;
193 /// let x = ListJobsResponse::new().set_unreachable(["a", "b", "c"]);
194 /// ```
195 pub fn set_unreachable<T, V>(mut self, v: T) -> Self
196 where
197 T: std::iter::IntoIterator<Item = V>,
198 V: std::convert::Into<std::string::String>,
199 {
200 use std::iter::Iterator;
201 self.unreachable = v.into_iter().map(|i| i.into()).collect();
202 self
203 }
204}
205
206impl wkt::message::Message for ListJobsResponse {
207 fn typename() -> &'static str {
208 "type.googleapis.com/google.cloud.storagebatchoperations.v1.ListJobsResponse"
209 }
210}
211
212#[doc(hidden)]
213impl google_cloud_gax::paginator::internal::PageableResponse for ListJobsResponse {
214 type PageItem = crate::model::Job;
215
216 fn items(self) -> std::vec::Vec<Self::PageItem> {
217 self.jobs
218 }
219
220 fn next_page_token(&self) -> std::string::String {
221 use std::clone::Clone;
222 self.next_page_token.clone()
223 }
224}
225
226/// Message for getting a Job
227#[derive(Clone, Default, PartialEq)]
228#[non_exhaustive]
229pub struct GetJobRequest {
230 /// Required. `name` of the job to retrieve.
231 /// Format: projects/{project_id}/locations/global/jobs/{job_id} .
232 pub name: std::string::String,
233
234 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
235}
236
237impl GetJobRequest {
238 pub fn new() -> Self {
239 std::default::Default::default()
240 }
241
242 /// Sets the value of [name][crate::model::GetJobRequest::name].
243 ///
244 /// # Example
245 /// ```ignore,no_run
246 /// # use google_cloud_storagebatchoperations_v1::model::GetJobRequest;
247 /// let x = GetJobRequest::new().set_name("example");
248 /// ```
249 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
250 self.name = v.into();
251 self
252 }
253}
254
255impl wkt::message::Message for GetJobRequest {
256 fn typename() -> &'static str {
257 "type.googleapis.com/google.cloud.storagebatchoperations.v1.GetJobRequest"
258 }
259}
260
261/// Message for creating a Job
262#[derive(Clone, Default, PartialEq)]
263#[non_exhaustive]
264pub struct CreateJobRequest {
265 /// Required. Value for parent.
266 pub parent: std::string::String,
267
268 /// Required. The optional `job_id` for this Job . If not
269 /// specified, an id is generated. `job_id` should be no more than 128
270 /// characters and must include only characters available in DNS names, as
271 /// defined by RFC-1123.
272 pub job_id: std::string::String,
273
274 /// Required. The resource being created
275 pub job: std::option::Option<crate::model::Job>,
276
277 /// Optional. An optional request ID to identify requests. Specify a unique
278 /// request ID in case you need to retry your request. Requests with same
279 /// `request_id` will be ignored for at least 60 minutes since the first
280 /// request. The request ID must be a valid UUID with the exception that zero
281 /// UUID is not supported (00000000-0000-0000-0000-000000000000).
282 pub request_id: std::string::String,
283
284 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
285}
286
287impl CreateJobRequest {
288 pub fn new() -> Self {
289 std::default::Default::default()
290 }
291
292 /// Sets the value of [parent][crate::model::CreateJobRequest::parent].
293 ///
294 /// # Example
295 /// ```ignore,no_run
296 /// # use google_cloud_storagebatchoperations_v1::model::CreateJobRequest;
297 /// let x = CreateJobRequest::new().set_parent("example");
298 /// ```
299 pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
300 self.parent = v.into();
301 self
302 }
303
304 /// Sets the value of [job_id][crate::model::CreateJobRequest::job_id].
305 ///
306 /// # Example
307 /// ```ignore,no_run
308 /// # use google_cloud_storagebatchoperations_v1::model::CreateJobRequest;
309 /// let x = CreateJobRequest::new().set_job_id("example");
310 /// ```
311 pub fn set_job_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
312 self.job_id = v.into();
313 self
314 }
315
316 /// Sets the value of [job][crate::model::CreateJobRequest::job].
317 ///
318 /// # Example
319 /// ```ignore,no_run
320 /// # use google_cloud_storagebatchoperations_v1::model::CreateJobRequest;
321 /// use google_cloud_storagebatchoperations_v1::model::Job;
322 /// let x = CreateJobRequest::new().set_job(Job::default()/* use setters */);
323 /// ```
324 pub fn set_job<T>(mut self, v: T) -> Self
325 where
326 T: std::convert::Into<crate::model::Job>,
327 {
328 self.job = std::option::Option::Some(v.into());
329 self
330 }
331
332 /// Sets or clears the value of [job][crate::model::CreateJobRequest::job].
333 ///
334 /// # Example
335 /// ```ignore,no_run
336 /// # use google_cloud_storagebatchoperations_v1::model::CreateJobRequest;
337 /// use google_cloud_storagebatchoperations_v1::model::Job;
338 /// let x = CreateJobRequest::new().set_or_clear_job(Some(Job::default()/* use setters */));
339 /// let x = CreateJobRequest::new().set_or_clear_job(None::<Job>);
340 /// ```
341 pub fn set_or_clear_job<T>(mut self, v: std::option::Option<T>) -> Self
342 where
343 T: std::convert::Into<crate::model::Job>,
344 {
345 self.job = v.map(|x| x.into());
346 self
347 }
348
349 /// Sets the value of [request_id][crate::model::CreateJobRequest::request_id].
350 ///
351 /// # Example
352 /// ```ignore,no_run
353 /// # use google_cloud_storagebatchoperations_v1::model::CreateJobRequest;
354 /// let x = CreateJobRequest::new().set_request_id("example");
355 /// ```
356 pub fn set_request_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
357 self.request_id = v.into();
358 self
359 }
360}
361
362impl wkt::message::Message for CreateJobRequest {
363 fn typename() -> &'static str {
364 "type.googleapis.com/google.cloud.storagebatchoperations.v1.CreateJobRequest"
365 }
366}
367
368/// Message for Job to Cancel
369#[derive(Clone, Default, PartialEq)]
370#[non_exhaustive]
371pub struct CancelJobRequest {
372 /// Required. The `name` of the job to cancel.
373 /// Format: projects/{project_id}/locations/global/jobs/{job_id}.
374 pub name: std::string::String,
375
376 /// Optional. An optional request ID to identify requests. Specify a unique
377 /// request ID in case you need to retry your request. Requests with same
378 /// `request_id` will be ignored for at least 60 minutes since the first
379 /// request. The request ID must be a valid UUID with the exception that zero
380 /// UUID is not supported (00000000-0000-0000-0000-000000000000).
381 pub request_id: std::string::String,
382
383 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
384}
385
386impl CancelJobRequest {
387 pub fn new() -> Self {
388 std::default::Default::default()
389 }
390
391 /// Sets the value of [name][crate::model::CancelJobRequest::name].
392 ///
393 /// # Example
394 /// ```ignore,no_run
395 /// # use google_cloud_storagebatchoperations_v1::model::CancelJobRequest;
396 /// let x = CancelJobRequest::new().set_name("example");
397 /// ```
398 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
399 self.name = v.into();
400 self
401 }
402
403 /// Sets the value of [request_id][crate::model::CancelJobRequest::request_id].
404 ///
405 /// # Example
406 /// ```ignore,no_run
407 /// # use google_cloud_storagebatchoperations_v1::model::CancelJobRequest;
408 /// let x = CancelJobRequest::new().set_request_id("example");
409 /// ```
410 pub fn set_request_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
411 self.request_id = v.into();
412 self
413 }
414}
415
416impl wkt::message::Message for CancelJobRequest {
417 fn typename() -> &'static str {
418 "type.googleapis.com/google.cloud.storagebatchoperations.v1.CancelJobRequest"
419 }
420}
421
422/// Message for deleting a Job
423#[derive(Clone, Default, PartialEq)]
424#[non_exhaustive]
425pub struct DeleteJobRequest {
426 /// Required. The `name` of the job to delete.
427 /// Format: projects/{project_id}/locations/global/jobs/{job_id} .
428 pub name: std::string::String,
429
430 /// Optional. An optional request ID to identify requests. Specify a unique
431 /// request ID in case you need to retry your request. Requests with same
432 /// `request_id` will be ignored for at least 60 minutes since the first
433 /// request. The request ID must be a valid UUID with the exception that zero
434 /// UUID is not supported (00000000-0000-0000-0000-000000000000).
435 pub request_id: std::string::String,
436
437 /// Optional. If set to true, any child bucket operations of the job will also
438 /// be deleted. Highly recommended to be set to true by all clients. Users
439 /// cannot mutate bucket operations directly, so only the jobs.delete
440 /// permission is required to delete a job (and its child bucket operations).
441 pub force: bool,
442
443 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
444}
445
446impl DeleteJobRequest {
447 pub fn new() -> Self {
448 std::default::Default::default()
449 }
450
451 /// Sets the value of [name][crate::model::DeleteJobRequest::name].
452 ///
453 /// # Example
454 /// ```ignore,no_run
455 /// # use google_cloud_storagebatchoperations_v1::model::DeleteJobRequest;
456 /// let x = DeleteJobRequest::new().set_name("example");
457 /// ```
458 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
459 self.name = v.into();
460 self
461 }
462
463 /// Sets the value of [request_id][crate::model::DeleteJobRequest::request_id].
464 ///
465 /// # Example
466 /// ```ignore,no_run
467 /// # use google_cloud_storagebatchoperations_v1::model::DeleteJobRequest;
468 /// let x = DeleteJobRequest::new().set_request_id("example");
469 /// ```
470 pub fn set_request_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
471 self.request_id = v.into();
472 self
473 }
474
475 /// Sets the value of [force][crate::model::DeleteJobRequest::force].
476 ///
477 /// # Example
478 /// ```ignore,no_run
479 /// # use google_cloud_storagebatchoperations_v1::model::DeleteJobRequest;
480 /// let x = DeleteJobRequest::new().set_force(true);
481 /// ```
482 pub fn set_force<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
483 self.force = v.into();
484 self
485 }
486}
487
488impl wkt::message::Message for DeleteJobRequest {
489 fn typename() -> &'static str {
490 "type.googleapis.com/google.cloud.storagebatchoperations.v1.DeleteJobRequest"
491 }
492}
493
494/// Message for response to cancel Job.
495#[derive(Clone, Default, PartialEq)]
496#[non_exhaustive]
497pub struct CancelJobResponse {
498 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
499}
500
501impl CancelJobResponse {
502 pub fn new() -> Self {
503 std::default::Default::default()
504 }
505}
506
507impl wkt::message::Message for CancelJobResponse {
508 fn typename() -> &'static str {
509 "type.googleapis.com/google.cloud.storagebatchoperations.v1.CancelJobResponse"
510 }
511}
512
513/// Message for request to list BucketOperations
514#[derive(Clone, Default, PartialEq)]
515#[non_exhaustive]
516pub struct ListBucketOperationsRequest {
517 /// Required. Format: projects/{project_id}/locations/global/jobs/{job_id}.
518 pub parent: std::string::String,
519
520 /// Optional. Filters results as defined by <https://google.aip.dev/160>.
521 pub filter: std::string::String,
522
523 /// Optional. The list page size. Default page size is 100.
524 pub page_size: i32,
525
526 /// Optional. The list page token.
527 pub page_token: std::string::String,
528
529 /// Optional. Field to sort by. Supported fields are name, create_time.
530 pub order_by: std::string::String,
531
532 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
533}
534
535impl ListBucketOperationsRequest {
536 pub fn new() -> Self {
537 std::default::Default::default()
538 }
539
540 /// Sets the value of [parent][crate::model::ListBucketOperationsRequest::parent].
541 ///
542 /// # Example
543 /// ```ignore,no_run
544 /// # use google_cloud_storagebatchoperations_v1::model::ListBucketOperationsRequest;
545 /// let x = ListBucketOperationsRequest::new().set_parent("example");
546 /// ```
547 pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
548 self.parent = v.into();
549 self
550 }
551
552 /// Sets the value of [filter][crate::model::ListBucketOperationsRequest::filter].
553 ///
554 /// # Example
555 /// ```ignore,no_run
556 /// # use google_cloud_storagebatchoperations_v1::model::ListBucketOperationsRequest;
557 /// let x = ListBucketOperationsRequest::new().set_filter("example");
558 /// ```
559 pub fn set_filter<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
560 self.filter = v.into();
561 self
562 }
563
564 /// Sets the value of [page_size][crate::model::ListBucketOperationsRequest::page_size].
565 ///
566 /// # Example
567 /// ```ignore,no_run
568 /// # use google_cloud_storagebatchoperations_v1::model::ListBucketOperationsRequest;
569 /// let x = ListBucketOperationsRequest::new().set_page_size(42);
570 /// ```
571 pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
572 self.page_size = v.into();
573 self
574 }
575
576 /// Sets the value of [page_token][crate::model::ListBucketOperationsRequest::page_token].
577 ///
578 /// # Example
579 /// ```ignore,no_run
580 /// # use google_cloud_storagebatchoperations_v1::model::ListBucketOperationsRequest;
581 /// let x = ListBucketOperationsRequest::new().set_page_token("example");
582 /// ```
583 pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
584 self.page_token = v.into();
585 self
586 }
587
588 /// Sets the value of [order_by][crate::model::ListBucketOperationsRequest::order_by].
589 ///
590 /// # Example
591 /// ```ignore,no_run
592 /// # use google_cloud_storagebatchoperations_v1::model::ListBucketOperationsRequest;
593 /// let x = ListBucketOperationsRequest::new().set_order_by("example");
594 /// ```
595 pub fn set_order_by<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
596 self.order_by = v.into();
597 self
598 }
599}
600
601impl wkt::message::Message for ListBucketOperationsRequest {
602 fn typename() -> &'static str {
603 "type.googleapis.com/google.cloud.storagebatchoperations.v1.ListBucketOperationsRequest"
604 }
605}
606
607/// Message for response to listing BucketOperations
608#[derive(Clone, Default, PartialEq)]
609#[non_exhaustive]
610pub struct ListBucketOperationsResponse {
611 /// A list of storage batch bucket operations.
612 pub bucket_operations: std::vec::Vec<crate::model::BucketOperation>,
613
614 /// A token identifying a page of results.
615 pub next_page_token: std::string::String,
616
617 /// Locations that could not be reached.
618 pub unreachable: std::vec::Vec<std::string::String>,
619
620 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
621}
622
623impl ListBucketOperationsResponse {
624 pub fn new() -> Self {
625 std::default::Default::default()
626 }
627
628 /// Sets the value of [bucket_operations][crate::model::ListBucketOperationsResponse::bucket_operations].
629 ///
630 /// # Example
631 /// ```ignore,no_run
632 /// # use google_cloud_storagebatchoperations_v1::model::ListBucketOperationsResponse;
633 /// use google_cloud_storagebatchoperations_v1::model::BucketOperation;
634 /// let x = ListBucketOperationsResponse::new()
635 /// .set_bucket_operations([
636 /// BucketOperation::default()/* use setters */,
637 /// BucketOperation::default()/* use (different) setters */,
638 /// ]);
639 /// ```
640 pub fn set_bucket_operations<T, V>(mut self, v: T) -> Self
641 where
642 T: std::iter::IntoIterator<Item = V>,
643 V: std::convert::Into<crate::model::BucketOperation>,
644 {
645 use std::iter::Iterator;
646 self.bucket_operations = v.into_iter().map(|i| i.into()).collect();
647 self
648 }
649
650 /// Sets the value of [next_page_token][crate::model::ListBucketOperationsResponse::next_page_token].
651 ///
652 /// # Example
653 /// ```ignore,no_run
654 /// # use google_cloud_storagebatchoperations_v1::model::ListBucketOperationsResponse;
655 /// let x = ListBucketOperationsResponse::new().set_next_page_token("example");
656 /// ```
657 pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
658 self.next_page_token = v.into();
659 self
660 }
661
662 /// Sets the value of [unreachable][crate::model::ListBucketOperationsResponse::unreachable].
663 ///
664 /// # Example
665 /// ```ignore,no_run
666 /// # use google_cloud_storagebatchoperations_v1::model::ListBucketOperationsResponse;
667 /// let x = ListBucketOperationsResponse::new().set_unreachable(["a", "b", "c"]);
668 /// ```
669 pub fn set_unreachable<T, V>(mut self, v: T) -> Self
670 where
671 T: std::iter::IntoIterator<Item = V>,
672 V: std::convert::Into<std::string::String>,
673 {
674 use std::iter::Iterator;
675 self.unreachable = v.into_iter().map(|i| i.into()).collect();
676 self
677 }
678}
679
680impl wkt::message::Message for ListBucketOperationsResponse {
681 fn typename() -> &'static str {
682 "type.googleapis.com/google.cloud.storagebatchoperations.v1.ListBucketOperationsResponse"
683 }
684}
685
686#[doc(hidden)]
687impl google_cloud_gax::paginator::internal::PageableResponse for ListBucketOperationsResponse {
688 type PageItem = crate::model::BucketOperation;
689
690 fn items(self) -> std::vec::Vec<Self::PageItem> {
691 self.bucket_operations
692 }
693
694 fn next_page_token(&self) -> std::string::String {
695 use std::clone::Clone;
696 self.next_page_token.clone()
697 }
698}
699
700/// Message for getting a BucketOperation.
701#[derive(Clone, Default, PartialEq)]
702#[non_exhaustive]
703pub struct GetBucketOperationRequest {
704 /// Required. `name` of the bucket operation to retrieve.
705 /// Format:
706 /// projects/{project_id}/locations/global/jobs/{job_id}/bucketOperations/{bucket_operation_id}.
707 pub name: std::string::String,
708
709 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
710}
711
712impl GetBucketOperationRequest {
713 pub fn new() -> Self {
714 std::default::Default::default()
715 }
716
717 /// Sets the value of [name][crate::model::GetBucketOperationRequest::name].
718 ///
719 /// # Example
720 /// ```ignore,no_run
721 /// # use google_cloud_storagebatchoperations_v1::model::GetBucketOperationRequest;
722 /// let x = GetBucketOperationRequest::new().set_name("example");
723 /// ```
724 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
725 self.name = v.into();
726 self
727 }
728}
729
730impl wkt::message::Message for GetBucketOperationRequest {
731 fn typename() -> &'static str {
732 "type.googleapis.com/google.cloud.storagebatchoperations.v1.GetBucketOperationRequest"
733 }
734}
735
736/// Represents the metadata of the long-running operation.
737#[derive(Clone, Default, PartialEq)]
738#[non_exhaustive]
739pub struct OperationMetadata {
740 /// Output only. The unique operation resource name.
741 /// Format: projects/{project}/locations/global/operations/{operation}.
742 pub operation: std::string::String,
743
744 /// Output only. The time the operation was created.
745 pub create_time: std::option::Option<wkt::Timestamp>,
746
747 /// Output only. The time the operation finished running.
748 pub end_time: std::option::Option<wkt::Timestamp>,
749
750 /// Output only. Identifies whether the user has requested cancellation
751 /// of the operation. Operations that have been cancelled successfully
752 /// have
753 /// [google.longrunning.Operation.error][google.longrunning.Operation.error]
754 /// value with a [google.rpc.Status.code][google.rpc.Status.code] of 1,
755 /// corresponding to
756 /// `[Code.CANCELLED][google.rpc.Code.CANCELLED]`.
757 ///
758 /// [google.longrunning.Operation.error]: google_cloud_longrunning::model::Operation::result
759 /// [google.rpc.Code.CANCELLED]: google_cloud_rpc::model::Code::Cancelled
760 /// [google.rpc.Status.code]: google_cloud_rpc::model::Status::code
761 pub requested_cancellation: bool,
762
763 /// Output only. API version used to start the operation.
764 pub api_version: std::string::String,
765
766 /// Output only. The Job associated with the operation.
767 pub job: std::option::Option<crate::model::Job>,
768
769 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
770}
771
772impl OperationMetadata {
773 pub fn new() -> Self {
774 std::default::Default::default()
775 }
776
777 /// Sets the value of [operation][crate::model::OperationMetadata::operation].
778 ///
779 /// # Example
780 /// ```ignore,no_run
781 /// # use google_cloud_storagebatchoperations_v1::model::OperationMetadata;
782 /// let x = OperationMetadata::new().set_operation("example");
783 /// ```
784 pub fn set_operation<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
785 self.operation = v.into();
786 self
787 }
788
789 /// Sets the value of [create_time][crate::model::OperationMetadata::create_time].
790 ///
791 /// # Example
792 /// ```ignore,no_run
793 /// # use google_cloud_storagebatchoperations_v1::model::OperationMetadata;
794 /// use wkt::Timestamp;
795 /// let x = OperationMetadata::new().set_create_time(Timestamp::default()/* use setters */);
796 /// ```
797 pub fn set_create_time<T>(mut self, v: T) -> Self
798 where
799 T: std::convert::Into<wkt::Timestamp>,
800 {
801 self.create_time = std::option::Option::Some(v.into());
802 self
803 }
804
805 /// Sets or clears the value of [create_time][crate::model::OperationMetadata::create_time].
806 ///
807 /// # Example
808 /// ```ignore,no_run
809 /// # use google_cloud_storagebatchoperations_v1::model::OperationMetadata;
810 /// use wkt::Timestamp;
811 /// let x = OperationMetadata::new().set_or_clear_create_time(Some(Timestamp::default()/* use setters */));
812 /// let x = OperationMetadata::new().set_or_clear_create_time(None::<Timestamp>);
813 /// ```
814 pub fn set_or_clear_create_time<T>(mut self, v: std::option::Option<T>) -> Self
815 where
816 T: std::convert::Into<wkt::Timestamp>,
817 {
818 self.create_time = v.map(|x| x.into());
819 self
820 }
821
822 /// Sets the value of [end_time][crate::model::OperationMetadata::end_time].
823 ///
824 /// # Example
825 /// ```ignore,no_run
826 /// # use google_cloud_storagebatchoperations_v1::model::OperationMetadata;
827 /// use wkt::Timestamp;
828 /// let x = OperationMetadata::new().set_end_time(Timestamp::default()/* use setters */);
829 /// ```
830 pub fn set_end_time<T>(mut self, v: T) -> Self
831 where
832 T: std::convert::Into<wkt::Timestamp>,
833 {
834 self.end_time = std::option::Option::Some(v.into());
835 self
836 }
837
838 /// Sets or clears the value of [end_time][crate::model::OperationMetadata::end_time].
839 ///
840 /// # Example
841 /// ```ignore,no_run
842 /// # use google_cloud_storagebatchoperations_v1::model::OperationMetadata;
843 /// use wkt::Timestamp;
844 /// let x = OperationMetadata::new().set_or_clear_end_time(Some(Timestamp::default()/* use setters */));
845 /// let x = OperationMetadata::new().set_or_clear_end_time(None::<Timestamp>);
846 /// ```
847 pub fn set_or_clear_end_time<T>(mut self, v: std::option::Option<T>) -> Self
848 where
849 T: std::convert::Into<wkt::Timestamp>,
850 {
851 self.end_time = v.map(|x| x.into());
852 self
853 }
854
855 /// Sets the value of [requested_cancellation][crate::model::OperationMetadata::requested_cancellation].
856 ///
857 /// # Example
858 /// ```ignore,no_run
859 /// # use google_cloud_storagebatchoperations_v1::model::OperationMetadata;
860 /// let x = OperationMetadata::new().set_requested_cancellation(true);
861 /// ```
862 pub fn set_requested_cancellation<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
863 self.requested_cancellation = v.into();
864 self
865 }
866
867 /// Sets the value of [api_version][crate::model::OperationMetadata::api_version].
868 ///
869 /// # Example
870 /// ```ignore,no_run
871 /// # use google_cloud_storagebatchoperations_v1::model::OperationMetadata;
872 /// let x = OperationMetadata::new().set_api_version("example");
873 /// ```
874 pub fn set_api_version<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
875 self.api_version = v.into();
876 self
877 }
878
879 /// Sets the value of [job][crate::model::OperationMetadata::job].
880 ///
881 /// # Example
882 /// ```ignore,no_run
883 /// # use google_cloud_storagebatchoperations_v1::model::OperationMetadata;
884 /// use google_cloud_storagebatchoperations_v1::model::Job;
885 /// let x = OperationMetadata::new().set_job(Job::default()/* use setters */);
886 /// ```
887 pub fn set_job<T>(mut self, v: T) -> Self
888 where
889 T: std::convert::Into<crate::model::Job>,
890 {
891 self.job = std::option::Option::Some(v.into());
892 self
893 }
894
895 /// Sets or clears the value of [job][crate::model::OperationMetadata::job].
896 ///
897 /// # Example
898 /// ```ignore,no_run
899 /// # use google_cloud_storagebatchoperations_v1::model::OperationMetadata;
900 /// use google_cloud_storagebatchoperations_v1::model::Job;
901 /// let x = OperationMetadata::new().set_or_clear_job(Some(Job::default()/* use setters */));
902 /// let x = OperationMetadata::new().set_or_clear_job(None::<Job>);
903 /// ```
904 pub fn set_or_clear_job<T>(mut self, v: std::option::Option<T>) -> Self
905 where
906 T: std::convert::Into<crate::model::Job>,
907 {
908 self.job = v.map(|x| x.into());
909 self
910 }
911}
912
913impl wkt::message::Message for OperationMetadata {
914 fn typename() -> &'static str {
915 "type.googleapis.com/google.cloud.storagebatchoperations.v1.OperationMetadata"
916 }
917}
918
919/// The Storage Batch Operations Job description.
920#[derive(Clone, Default, PartialEq)]
921#[non_exhaustive]
922pub struct Job {
923 /// Identifier. The resource name of the Job. job_id is unique
924 /// within the project, that is either set by the customer or
925 /// defined by the service. Format:
926 /// projects/{project}/locations/global/jobs/{job_id} .
927 /// For example: "projects/123456/locations/global/jobs/job01".
928 pub name: std::string::String,
929
930 /// Optional. A description provided by the user for the job. Its max length is
931 /// 1024 bytes when Unicode-encoded.
932 pub description: std::string::String,
933
934 /// Optional. Logging configuration.
935 pub logging_config: std::option::Option<crate::model::LoggingConfig>,
936
937 /// Output only. The time that the job was created.
938 pub create_time: std::option::Option<wkt::Timestamp>,
939
940 /// Output only. The time that the job was scheduled.
941 pub schedule_time: std::option::Option<wkt::Timestamp>,
942
943 /// Output only. The time that the job was completed.
944 pub complete_time: std::option::Option<wkt::Timestamp>,
945
946 /// Output only. Information about the progress of the job.
947 pub counters: std::option::Option<crate::model::Counters>,
948
949 /// Output only. Summarizes errors encountered with sample error log entries.
950 pub error_summaries: std::vec::Vec<crate::model::ErrorSummary>,
951
952 /// Output only. State of the job.
953 pub state: crate::model::job::State,
954
955 /// Optional. If true, the job will run in dry run mode, returning the total
956 /// object count and, if the object configuration is a prefix list, the bytes
957 /// found from source. No transformations will be performed.
958 pub dry_run: bool,
959
960 /// Output only. If true, this Job operates on multiple buckets. Multibucket
961 /// jobs are subject to different quota limits than single-bucket jobs.
962 pub is_multi_bucket_job: bool,
963
964 /// Specifies objects to be transformed.
965 pub source: std::option::Option<crate::model::job::Source>,
966
967 /// Operation to be performed on the objects.
968 pub transformation: std::option::Option<crate::model::job::Transformation>,
969
970 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
971}
972
973impl Job {
974 pub fn new() -> Self {
975 std::default::Default::default()
976 }
977
978 /// Sets the value of [name][crate::model::Job::name].
979 ///
980 /// # Example
981 /// ```ignore,no_run
982 /// # use google_cloud_storagebatchoperations_v1::model::Job;
983 /// let x = Job::new().set_name("example");
984 /// ```
985 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
986 self.name = v.into();
987 self
988 }
989
990 /// Sets the value of [description][crate::model::Job::description].
991 ///
992 /// # Example
993 /// ```ignore,no_run
994 /// # use google_cloud_storagebatchoperations_v1::model::Job;
995 /// let x = Job::new().set_description("example");
996 /// ```
997 pub fn set_description<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
998 self.description = v.into();
999 self
1000 }
1001
1002 /// Sets the value of [logging_config][crate::model::Job::logging_config].
1003 ///
1004 /// # Example
1005 /// ```ignore,no_run
1006 /// # use google_cloud_storagebatchoperations_v1::model::Job;
1007 /// use google_cloud_storagebatchoperations_v1::model::LoggingConfig;
1008 /// let x = Job::new().set_logging_config(LoggingConfig::default()/* use setters */);
1009 /// ```
1010 pub fn set_logging_config<T>(mut self, v: T) -> Self
1011 where
1012 T: std::convert::Into<crate::model::LoggingConfig>,
1013 {
1014 self.logging_config = std::option::Option::Some(v.into());
1015 self
1016 }
1017
1018 /// Sets or clears the value of [logging_config][crate::model::Job::logging_config].
1019 ///
1020 /// # Example
1021 /// ```ignore,no_run
1022 /// # use google_cloud_storagebatchoperations_v1::model::Job;
1023 /// use google_cloud_storagebatchoperations_v1::model::LoggingConfig;
1024 /// let x = Job::new().set_or_clear_logging_config(Some(LoggingConfig::default()/* use setters */));
1025 /// let x = Job::new().set_or_clear_logging_config(None::<LoggingConfig>);
1026 /// ```
1027 pub fn set_or_clear_logging_config<T>(mut self, v: std::option::Option<T>) -> Self
1028 where
1029 T: std::convert::Into<crate::model::LoggingConfig>,
1030 {
1031 self.logging_config = v.map(|x| x.into());
1032 self
1033 }
1034
1035 /// Sets the value of [create_time][crate::model::Job::create_time].
1036 ///
1037 /// # Example
1038 /// ```ignore,no_run
1039 /// # use google_cloud_storagebatchoperations_v1::model::Job;
1040 /// use wkt::Timestamp;
1041 /// let x = Job::new().set_create_time(Timestamp::default()/* use setters */);
1042 /// ```
1043 pub fn set_create_time<T>(mut self, v: T) -> Self
1044 where
1045 T: std::convert::Into<wkt::Timestamp>,
1046 {
1047 self.create_time = std::option::Option::Some(v.into());
1048 self
1049 }
1050
1051 /// Sets or clears the value of [create_time][crate::model::Job::create_time].
1052 ///
1053 /// # Example
1054 /// ```ignore,no_run
1055 /// # use google_cloud_storagebatchoperations_v1::model::Job;
1056 /// use wkt::Timestamp;
1057 /// let x = Job::new().set_or_clear_create_time(Some(Timestamp::default()/* use setters */));
1058 /// let x = Job::new().set_or_clear_create_time(None::<Timestamp>);
1059 /// ```
1060 pub fn set_or_clear_create_time<T>(mut self, v: std::option::Option<T>) -> Self
1061 where
1062 T: std::convert::Into<wkt::Timestamp>,
1063 {
1064 self.create_time = v.map(|x| x.into());
1065 self
1066 }
1067
1068 /// Sets the value of [schedule_time][crate::model::Job::schedule_time].
1069 ///
1070 /// # Example
1071 /// ```ignore,no_run
1072 /// # use google_cloud_storagebatchoperations_v1::model::Job;
1073 /// use wkt::Timestamp;
1074 /// let x = Job::new().set_schedule_time(Timestamp::default()/* use setters */);
1075 /// ```
1076 pub fn set_schedule_time<T>(mut self, v: T) -> Self
1077 where
1078 T: std::convert::Into<wkt::Timestamp>,
1079 {
1080 self.schedule_time = std::option::Option::Some(v.into());
1081 self
1082 }
1083
1084 /// Sets or clears the value of [schedule_time][crate::model::Job::schedule_time].
1085 ///
1086 /// # Example
1087 /// ```ignore,no_run
1088 /// # use google_cloud_storagebatchoperations_v1::model::Job;
1089 /// use wkt::Timestamp;
1090 /// let x = Job::new().set_or_clear_schedule_time(Some(Timestamp::default()/* use setters */));
1091 /// let x = Job::new().set_or_clear_schedule_time(None::<Timestamp>);
1092 /// ```
1093 pub fn set_or_clear_schedule_time<T>(mut self, v: std::option::Option<T>) -> Self
1094 where
1095 T: std::convert::Into<wkt::Timestamp>,
1096 {
1097 self.schedule_time = v.map(|x| x.into());
1098 self
1099 }
1100
1101 /// Sets the value of [complete_time][crate::model::Job::complete_time].
1102 ///
1103 /// # Example
1104 /// ```ignore,no_run
1105 /// # use google_cloud_storagebatchoperations_v1::model::Job;
1106 /// use wkt::Timestamp;
1107 /// let x = Job::new().set_complete_time(Timestamp::default()/* use setters */);
1108 /// ```
1109 pub fn set_complete_time<T>(mut self, v: T) -> Self
1110 where
1111 T: std::convert::Into<wkt::Timestamp>,
1112 {
1113 self.complete_time = std::option::Option::Some(v.into());
1114 self
1115 }
1116
1117 /// Sets or clears the value of [complete_time][crate::model::Job::complete_time].
1118 ///
1119 /// # Example
1120 /// ```ignore,no_run
1121 /// # use google_cloud_storagebatchoperations_v1::model::Job;
1122 /// use wkt::Timestamp;
1123 /// let x = Job::new().set_or_clear_complete_time(Some(Timestamp::default()/* use setters */));
1124 /// let x = Job::new().set_or_clear_complete_time(None::<Timestamp>);
1125 /// ```
1126 pub fn set_or_clear_complete_time<T>(mut self, v: std::option::Option<T>) -> Self
1127 where
1128 T: std::convert::Into<wkt::Timestamp>,
1129 {
1130 self.complete_time = v.map(|x| x.into());
1131 self
1132 }
1133
1134 /// Sets the value of [counters][crate::model::Job::counters].
1135 ///
1136 /// # Example
1137 /// ```ignore,no_run
1138 /// # use google_cloud_storagebatchoperations_v1::model::Job;
1139 /// use google_cloud_storagebatchoperations_v1::model::Counters;
1140 /// let x = Job::new().set_counters(Counters::default()/* use setters */);
1141 /// ```
1142 pub fn set_counters<T>(mut self, v: T) -> Self
1143 where
1144 T: std::convert::Into<crate::model::Counters>,
1145 {
1146 self.counters = std::option::Option::Some(v.into());
1147 self
1148 }
1149
1150 /// Sets or clears the value of [counters][crate::model::Job::counters].
1151 ///
1152 /// # Example
1153 /// ```ignore,no_run
1154 /// # use google_cloud_storagebatchoperations_v1::model::Job;
1155 /// use google_cloud_storagebatchoperations_v1::model::Counters;
1156 /// let x = Job::new().set_or_clear_counters(Some(Counters::default()/* use setters */));
1157 /// let x = Job::new().set_or_clear_counters(None::<Counters>);
1158 /// ```
1159 pub fn set_or_clear_counters<T>(mut self, v: std::option::Option<T>) -> Self
1160 where
1161 T: std::convert::Into<crate::model::Counters>,
1162 {
1163 self.counters = v.map(|x| x.into());
1164 self
1165 }
1166
1167 /// Sets the value of [error_summaries][crate::model::Job::error_summaries].
1168 ///
1169 /// # Example
1170 /// ```ignore,no_run
1171 /// # use google_cloud_storagebatchoperations_v1::model::Job;
1172 /// use google_cloud_storagebatchoperations_v1::model::ErrorSummary;
1173 /// let x = Job::new()
1174 /// .set_error_summaries([
1175 /// ErrorSummary::default()/* use setters */,
1176 /// ErrorSummary::default()/* use (different) setters */,
1177 /// ]);
1178 /// ```
1179 pub fn set_error_summaries<T, V>(mut self, v: T) -> Self
1180 where
1181 T: std::iter::IntoIterator<Item = V>,
1182 V: std::convert::Into<crate::model::ErrorSummary>,
1183 {
1184 use std::iter::Iterator;
1185 self.error_summaries = v.into_iter().map(|i| i.into()).collect();
1186 self
1187 }
1188
1189 /// Sets the value of [state][crate::model::Job::state].
1190 ///
1191 /// # Example
1192 /// ```ignore,no_run
1193 /// # use google_cloud_storagebatchoperations_v1::model::Job;
1194 /// use google_cloud_storagebatchoperations_v1::model::job::State;
1195 /// let x0 = Job::new().set_state(State::Running);
1196 /// let x1 = Job::new().set_state(State::Succeeded);
1197 /// let x2 = Job::new().set_state(State::Canceled);
1198 /// ```
1199 pub fn set_state<T: std::convert::Into<crate::model::job::State>>(mut self, v: T) -> Self {
1200 self.state = v.into();
1201 self
1202 }
1203
1204 /// Sets the value of [dry_run][crate::model::Job::dry_run].
1205 ///
1206 /// # Example
1207 /// ```ignore,no_run
1208 /// # use google_cloud_storagebatchoperations_v1::model::Job;
1209 /// let x = Job::new().set_dry_run(true);
1210 /// ```
1211 pub fn set_dry_run<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
1212 self.dry_run = v.into();
1213 self
1214 }
1215
1216 /// Sets the value of [is_multi_bucket_job][crate::model::Job::is_multi_bucket_job].
1217 ///
1218 /// # Example
1219 /// ```ignore,no_run
1220 /// # use google_cloud_storagebatchoperations_v1::model::Job;
1221 /// let x = Job::new().set_is_multi_bucket_job(true);
1222 /// ```
1223 pub fn set_is_multi_bucket_job<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
1224 self.is_multi_bucket_job = v.into();
1225 self
1226 }
1227
1228 /// Sets the value of [source][crate::model::Job::source].
1229 ///
1230 /// Note that all the setters affecting `source` are mutually
1231 /// exclusive.
1232 ///
1233 /// # Example
1234 /// ```ignore,no_run
1235 /// # use google_cloud_storagebatchoperations_v1::model::Job;
1236 /// use google_cloud_storagebatchoperations_v1::model::BucketList;
1237 /// let x = Job::new().set_source(Some(
1238 /// google_cloud_storagebatchoperations_v1::model::job::Source::BucketList(BucketList::default().into())));
1239 /// ```
1240 pub fn set_source<T: std::convert::Into<std::option::Option<crate::model::job::Source>>>(
1241 mut self,
1242 v: T,
1243 ) -> Self {
1244 self.source = v.into();
1245 self
1246 }
1247
1248 /// The value of [source][crate::model::Job::source]
1249 /// if it holds a `BucketList`, `None` if the field is not set or
1250 /// holds a different branch.
1251 pub fn bucket_list(&self) -> std::option::Option<&std::boxed::Box<crate::model::BucketList>> {
1252 #[allow(unreachable_patterns)]
1253 self.source.as_ref().and_then(|v| match v {
1254 crate::model::job::Source::BucketList(v) => std::option::Option::Some(v),
1255 _ => std::option::Option::None,
1256 })
1257 }
1258
1259 /// Sets the value of [source][crate::model::Job::source]
1260 /// to hold a `BucketList`.
1261 ///
1262 /// Note that all the setters affecting `source` are
1263 /// mutually exclusive.
1264 ///
1265 /// # Example
1266 /// ```ignore,no_run
1267 /// # use google_cloud_storagebatchoperations_v1::model::Job;
1268 /// use google_cloud_storagebatchoperations_v1::model::BucketList;
1269 /// let x = Job::new().set_bucket_list(BucketList::default()/* use setters */);
1270 /// assert!(x.bucket_list().is_some());
1271 /// ```
1272 pub fn set_bucket_list<T: std::convert::Into<std::boxed::Box<crate::model::BucketList>>>(
1273 mut self,
1274 v: T,
1275 ) -> Self {
1276 self.source = std::option::Option::Some(crate::model::job::Source::BucketList(v.into()));
1277 self
1278 }
1279
1280 /// Sets the value of [transformation][crate::model::Job::transformation].
1281 ///
1282 /// Note that all the setters affecting `transformation` are mutually
1283 /// exclusive.
1284 ///
1285 /// # Example
1286 /// ```ignore,no_run
1287 /// # use google_cloud_storagebatchoperations_v1::model::Job;
1288 /// use google_cloud_storagebatchoperations_v1::model::PutObjectHold;
1289 /// let x = Job::new().set_transformation(Some(
1290 /// google_cloud_storagebatchoperations_v1::model::job::Transformation::PutObjectHold(PutObjectHold::default().into())));
1291 /// ```
1292 pub fn set_transformation<
1293 T: std::convert::Into<std::option::Option<crate::model::job::Transformation>>,
1294 >(
1295 mut self,
1296 v: T,
1297 ) -> Self {
1298 self.transformation = v.into();
1299 self
1300 }
1301
1302 /// The value of [transformation][crate::model::Job::transformation]
1303 /// if it holds a `PutObjectHold`, `None` if the field is not set or
1304 /// holds a different branch.
1305 pub fn put_object_hold(
1306 &self,
1307 ) -> std::option::Option<&std::boxed::Box<crate::model::PutObjectHold>> {
1308 #[allow(unreachable_patterns)]
1309 self.transformation.as_ref().and_then(|v| match v {
1310 crate::model::job::Transformation::PutObjectHold(v) => std::option::Option::Some(v),
1311 _ => std::option::Option::None,
1312 })
1313 }
1314
1315 /// Sets the value of [transformation][crate::model::Job::transformation]
1316 /// to hold a `PutObjectHold`.
1317 ///
1318 /// Note that all the setters affecting `transformation` are
1319 /// mutually exclusive.
1320 ///
1321 /// # Example
1322 /// ```ignore,no_run
1323 /// # use google_cloud_storagebatchoperations_v1::model::Job;
1324 /// use google_cloud_storagebatchoperations_v1::model::PutObjectHold;
1325 /// let x = Job::new().set_put_object_hold(PutObjectHold::default()/* use setters */);
1326 /// assert!(x.put_object_hold().is_some());
1327 /// assert!(x.delete_object().is_none());
1328 /// assert!(x.put_metadata().is_none());
1329 /// assert!(x.rewrite_object().is_none());
1330 /// assert!(x.update_object_custom_context().is_none());
1331 /// ```
1332 pub fn set_put_object_hold<
1333 T: std::convert::Into<std::boxed::Box<crate::model::PutObjectHold>>,
1334 >(
1335 mut self,
1336 v: T,
1337 ) -> Self {
1338 self.transformation =
1339 std::option::Option::Some(crate::model::job::Transformation::PutObjectHold(v.into()));
1340 self
1341 }
1342
1343 /// The value of [transformation][crate::model::Job::transformation]
1344 /// if it holds a `DeleteObject`, `None` if the field is not set or
1345 /// holds a different branch.
1346 pub fn delete_object(
1347 &self,
1348 ) -> std::option::Option<&std::boxed::Box<crate::model::DeleteObject>> {
1349 #[allow(unreachable_patterns)]
1350 self.transformation.as_ref().and_then(|v| match v {
1351 crate::model::job::Transformation::DeleteObject(v) => std::option::Option::Some(v),
1352 _ => std::option::Option::None,
1353 })
1354 }
1355
1356 /// Sets the value of [transformation][crate::model::Job::transformation]
1357 /// to hold a `DeleteObject`.
1358 ///
1359 /// Note that all the setters affecting `transformation` are
1360 /// mutually exclusive.
1361 ///
1362 /// # Example
1363 /// ```ignore,no_run
1364 /// # use google_cloud_storagebatchoperations_v1::model::Job;
1365 /// use google_cloud_storagebatchoperations_v1::model::DeleteObject;
1366 /// let x = Job::new().set_delete_object(DeleteObject::default()/* use setters */);
1367 /// assert!(x.delete_object().is_some());
1368 /// assert!(x.put_object_hold().is_none());
1369 /// assert!(x.put_metadata().is_none());
1370 /// assert!(x.rewrite_object().is_none());
1371 /// assert!(x.update_object_custom_context().is_none());
1372 /// ```
1373 pub fn set_delete_object<T: std::convert::Into<std::boxed::Box<crate::model::DeleteObject>>>(
1374 mut self,
1375 v: T,
1376 ) -> Self {
1377 self.transformation =
1378 std::option::Option::Some(crate::model::job::Transformation::DeleteObject(v.into()));
1379 self
1380 }
1381
1382 /// The value of [transformation][crate::model::Job::transformation]
1383 /// if it holds a `PutMetadata`, `None` if the field is not set or
1384 /// holds a different branch.
1385 pub fn put_metadata(&self) -> std::option::Option<&std::boxed::Box<crate::model::PutMetadata>> {
1386 #[allow(unreachable_patterns)]
1387 self.transformation.as_ref().and_then(|v| match v {
1388 crate::model::job::Transformation::PutMetadata(v) => std::option::Option::Some(v),
1389 _ => std::option::Option::None,
1390 })
1391 }
1392
1393 /// Sets the value of [transformation][crate::model::Job::transformation]
1394 /// to hold a `PutMetadata`.
1395 ///
1396 /// Note that all the setters affecting `transformation` are
1397 /// mutually exclusive.
1398 ///
1399 /// # Example
1400 /// ```ignore,no_run
1401 /// # use google_cloud_storagebatchoperations_v1::model::Job;
1402 /// use google_cloud_storagebatchoperations_v1::model::PutMetadata;
1403 /// let x = Job::new().set_put_metadata(PutMetadata::default()/* use setters */);
1404 /// assert!(x.put_metadata().is_some());
1405 /// assert!(x.put_object_hold().is_none());
1406 /// assert!(x.delete_object().is_none());
1407 /// assert!(x.rewrite_object().is_none());
1408 /// assert!(x.update_object_custom_context().is_none());
1409 /// ```
1410 pub fn set_put_metadata<T: std::convert::Into<std::boxed::Box<crate::model::PutMetadata>>>(
1411 mut self,
1412 v: T,
1413 ) -> Self {
1414 self.transformation =
1415 std::option::Option::Some(crate::model::job::Transformation::PutMetadata(v.into()));
1416 self
1417 }
1418
1419 /// The value of [transformation][crate::model::Job::transformation]
1420 /// if it holds a `RewriteObject`, `None` if the field is not set or
1421 /// holds a different branch.
1422 pub fn rewrite_object(
1423 &self,
1424 ) -> std::option::Option<&std::boxed::Box<crate::model::RewriteObject>> {
1425 #[allow(unreachable_patterns)]
1426 self.transformation.as_ref().and_then(|v| match v {
1427 crate::model::job::Transformation::RewriteObject(v) => std::option::Option::Some(v),
1428 _ => std::option::Option::None,
1429 })
1430 }
1431
1432 /// Sets the value of [transformation][crate::model::Job::transformation]
1433 /// to hold a `RewriteObject`.
1434 ///
1435 /// Note that all the setters affecting `transformation` are
1436 /// mutually exclusive.
1437 ///
1438 /// # Example
1439 /// ```ignore,no_run
1440 /// # use google_cloud_storagebatchoperations_v1::model::Job;
1441 /// use google_cloud_storagebatchoperations_v1::model::RewriteObject;
1442 /// let x = Job::new().set_rewrite_object(RewriteObject::default()/* use setters */);
1443 /// assert!(x.rewrite_object().is_some());
1444 /// assert!(x.put_object_hold().is_none());
1445 /// assert!(x.delete_object().is_none());
1446 /// assert!(x.put_metadata().is_none());
1447 /// assert!(x.update_object_custom_context().is_none());
1448 /// ```
1449 pub fn set_rewrite_object<
1450 T: std::convert::Into<std::boxed::Box<crate::model::RewriteObject>>,
1451 >(
1452 mut self,
1453 v: T,
1454 ) -> Self {
1455 self.transformation =
1456 std::option::Option::Some(crate::model::job::Transformation::RewriteObject(v.into()));
1457 self
1458 }
1459
1460 /// The value of [transformation][crate::model::Job::transformation]
1461 /// if it holds a `UpdateObjectCustomContext`, `None` if the field is not set or
1462 /// holds a different branch.
1463 pub fn update_object_custom_context(
1464 &self,
1465 ) -> std::option::Option<&std::boxed::Box<crate::model::UpdateObjectCustomContext>> {
1466 #[allow(unreachable_patterns)]
1467 self.transformation.as_ref().and_then(|v| match v {
1468 crate::model::job::Transformation::UpdateObjectCustomContext(v) => {
1469 std::option::Option::Some(v)
1470 }
1471 _ => std::option::Option::None,
1472 })
1473 }
1474
1475 /// Sets the value of [transformation][crate::model::Job::transformation]
1476 /// to hold a `UpdateObjectCustomContext`.
1477 ///
1478 /// Note that all the setters affecting `transformation` are
1479 /// mutually exclusive.
1480 ///
1481 /// # Example
1482 /// ```ignore,no_run
1483 /// # use google_cloud_storagebatchoperations_v1::model::Job;
1484 /// use google_cloud_storagebatchoperations_v1::model::UpdateObjectCustomContext;
1485 /// let x = Job::new().set_update_object_custom_context(UpdateObjectCustomContext::default()/* use setters */);
1486 /// assert!(x.update_object_custom_context().is_some());
1487 /// assert!(x.put_object_hold().is_none());
1488 /// assert!(x.delete_object().is_none());
1489 /// assert!(x.put_metadata().is_none());
1490 /// assert!(x.rewrite_object().is_none());
1491 /// ```
1492 pub fn set_update_object_custom_context<
1493 T: std::convert::Into<std::boxed::Box<crate::model::UpdateObjectCustomContext>>,
1494 >(
1495 mut self,
1496 v: T,
1497 ) -> Self {
1498 self.transformation = std::option::Option::Some(
1499 crate::model::job::Transformation::UpdateObjectCustomContext(v.into()),
1500 );
1501 self
1502 }
1503}
1504
1505impl wkt::message::Message for Job {
1506 fn typename() -> &'static str {
1507 "type.googleapis.com/google.cloud.storagebatchoperations.v1.Job"
1508 }
1509}
1510
1511/// Defines additional types related to [Job].
1512pub mod job {
1513 #[allow(unused_imports)]
1514 use super::*;
1515
1516 /// Describes state of a job.
1517 ///
1518 /// # Working with unknown values
1519 ///
1520 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
1521 /// additional enum variants at any time. Adding new variants is not considered
1522 /// a breaking change. Applications should write their code in anticipation of:
1523 ///
1524 /// - New values appearing in future releases of the client library, **and**
1525 /// - New values received dynamically, without application changes.
1526 ///
1527 /// Please consult the [Working with enums] section in the user guide for some
1528 /// guidelines.
1529 ///
1530 /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
1531 #[derive(Clone, Debug, PartialEq)]
1532 #[non_exhaustive]
1533 pub enum State {
1534 /// Default value. This value is unused.
1535 Unspecified,
1536 /// In progress.
1537 Running,
1538 /// Completed successfully.
1539 Succeeded,
1540 /// Cancelled by the user.
1541 Canceled,
1542 /// Terminated due to an unrecoverable failure.
1543 Failed,
1544 /// Queued but not yet started.
1545 Queued,
1546 /// If set, the enum was initialized with an unknown value.
1547 ///
1548 /// Applications can examine the value using [State::value] or
1549 /// [State::name].
1550 UnknownValue(state::UnknownValue),
1551 }
1552
1553 #[doc(hidden)]
1554 pub mod state {
1555 #[allow(unused_imports)]
1556 use super::*;
1557 #[derive(Clone, Debug, PartialEq)]
1558 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
1559 }
1560
1561 impl State {
1562 /// Gets the enum value.
1563 ///
1564 /// Returns `None` if the enum contains an unknown value deserialized from
1565 /// the string representation of enums.
1566 pub fn value(&self) -> std::option::Option<i32> {
1567 match self {
1568 Self::Unspecified => std::option::Option::Some(0),
1569 Self::Running => std::option::Option::Some(1),
1570 Self::Succeeded => std::option::Option::Some(2),
1571 Self::Canceled => std::option::Option::Some(3),
1572 Self::Failed => std::option::Option::Some(4),
1573 Self::Queued => std::option::Option::Some(5),
1574 Self::UnknownValue(u) => u.0.value(),
1575 }
1576 }
1577
1578 /// Gets the enum value as a string.
1579 ///
1580 /// Returns `None` if the enum contains an unknown value deserialized from
1581 /// the integer representation of enums.
1582 pub fn name(&self) -> std::option::Option<&str> {
1583 match self {
1584 Self::Unspecified => std::option::Option::Some("STATE_UNSPECIFIED"),
1585 Self::Running => std::option::Option::Some("RUNNING"),
1586 Self::Succeeded => std::option::Option::Some("SUCCEEDED"),
1587 Self::Canceled => std::option::Option::Some("CANCELED"),
1588 Self::Failed => std::option::Option::Some("FAILED"),
1589 Self::Queued => std::option::Option::Some("QUEUED"),
1590 Self::UnknownValue(u) => u.0.name(),
1591 }
1592 }
1593 }
1594
1595 impl std::default::Default for State {
1596 fn default() -> Self {
1597 use std::convert::From;
1598 Self::from(0)
1599 }
1600 }
1601
1602 impl std::fmt::Display for State {
1603 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
1604 wkt::internal::display_enum(f, self.name(), self.value())
1605 }
1606 }
1607
1608 impl std::convert::From<i32> for State {
1609 fn from(value: i32) -> Self {
1610 match value {
1611 0 => Self::Unspecified,
1612 1 => Self::Running,
1613 2 => Self::Succeeded,
1614 3 => Self::Canceled,
1615 4 => Self::Failed,
1616 5 => Self::Queued,
1617 _ => Self::UnknownValue(state::UnknownValue(
1618 wkt::internal::UnknownEnumValue::Integer(value),
1619 )),
1620 }
1621 }
1622 }
1623
1624 impl std::convert::From<&str> for State {
1625 fn from(value: &str) -> Self {
1626 use std::string::ToString;
1627 match value {
1628 "STATE_UNSPECIFIED" => Self::Unspecified,
1629 "RUNNING" => Self::Running,
1630 "SUCCEEDED" => Self::Succeeded,
1631 "CANCELED" => Self::Canceled,
1632 "FAILED" => Self::Failed,
1633 "QUEUED" => Self::Queued,
1634 _ => Self::UnknownValue(state::UnknownValue(
1635 wkt::internal::UnknownEnumValue::String(value.to_string()),
1636 )),
1637 }
1638 }
1639 }
1640
1641 impl serde::ser::Serialize for State {
1642 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
1643 where
1644 S: serde::Serializer,
1645 {
1646 match self {
1647 Self::Unspecified => serializer.serialize_i32(0),
1648 Self::Running => serializer.serialize_i32(1),
1649 Self::Succeeded => serializer.serialize_i32(2),
1650 Self::Canceled => serializer.serialize_i32(3),
1651 Self::Failed => serializer.serialize_i32(4),
1652 Self::Queued => serializer.serialize_i32(5),
1653 Self::UnknownValue(u) => u.0.serialize(serializer),
1654 }
1655 }
1656 }
1657
1658 impl<'de> serde::de::Deserialize<'de> for State {
1659 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
1660 where
1661 D: serde::Deserializer<'de>,
1662 {
1663 deserializer.deserialize_any(wkt::internal::EnumVisitor::<State>::new(
1664 ".google.cloud.storagebatchoperations.v1.Job.State",
1665 ))
1666 }
1667 }
1668
1669 /// Specifies objects to be transformed.
1670 #[derive(Clone, Debug, PartialEq)]
1671 #[non_exhaustive]
1672 pub enum Source {
1673 /// Specifies a list of buckets and their objects to be transformed.
1674 BucketList(std::boxed::Box<crate::model::BucketList>),
1675 }
1676
1677 /// Operation to be performed on the objects.
1678 #[derive(Clone, Debug, PartialEq)]
1679 #[non_exhaustive]
1680 pub enum Transformation {
1681 /// Changes object hold status.
1682 PutObjectHold(std::boxed::Box<crate::model::PutObjectHold>),
1683 /// Delete objects.
1684 DeleteObject(std::boxed::Box<crate::model::DeleteObject>),
1685 /// Updates object metadata. Allows updating fixed-key and custom metadata
1686 /// and fixed-key metadata i.e. Cache-Control, Content-Disposition,
1687 /// Content-Encoding, Content-Language, Content-Type, Custom-Time.
1688 PutMetadata(std::boxed::Box<crate::model::PutMetadata>),
1689 /// Rewrite the object and updates metadata like KMS key.
1690 RewriteObject(std::boxed::Box<crate::model::RewriteObject>),
1691 /// Update object custom context.
1692 UpdateObjectCustomContext(std::boxed::Box<crate::model::UpdateObjectCustomContext>),
1693 }
1694}
1695
1696/// BucketOperation represents a bucket-level breakdown of a Job.
1697#[derive(Clone, Default, PartialEq)]
1698#[non_exhaustive]
1699pub struct BucketOperation {
1700 /// Identifier. The resource name of the BucketOperation. This is defined by
1701 /// the service. Format:
1702 /// projects/{project}/locations/global/jobs/{job_id}/bucketOperations/{bucket_operation}.
1703 pub name: std::string::String,
1704
1705 /// The bucket name of the objects to be transformed in the BucketOperation.
1706 pub bucket_name: std::string::String,
1707
1708 /// Output only. The time that the BucketOperation was created.
1709 pub create_time: std::option::Option<wkt::Timestamp>,
1710
1711 /// Output only. The time that the BucketOperation was started.
1712 pub start_time: std::option::Option<wkt::Timestamp>,
1713
1714 /// Output only. The time that the BucketOperation was completed.
1715 pub complete_time: std::option::Option<wkt::Timestamp>,
1716
1717 /// Output only. Information about the progress of the bucket operation.
1718 pub counters: std::option::Option<crate::model::Counters>,
1719
1720 /// Output only. Summarizes errors encountered with sample error log entries.
1721 pub error_summaries: std::vec::Vec<crate::model::ErrorSummary>,
1722
1723 /// Output only. State of the BucketOperation.
1724 pub state: crate::model::bucket_operation::State,
1725
1726 /// Specifies objects to be transformed in the BucketOperation.
1727 pub object_configuration:
1728 std::option::Option<crate::model::bucket_operation::ObjectConfiguration>,
1729
1730 /// Action to be performed on the objects.
1731 pub transformation: std::option::Option<crate::model::bucket_operation::Transformation>,
1732
1733 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1734}
1735
1736impl BucketOperation {
1737 pub fn new() -> Self {
1738 std::default::Default::default()
1739 }
1740
1741 /// Sets the value of [name][crate::model::BucketOperation::name].
1742 ///
1743 /// # Example
1744 /// ```ignore,no_run
1745 /// # use google_cloud_storagebatchoperations_v1::model::BucketOperation;
1746 /// let x = BucketOperation::new().set_name("example");
1747 /// ```
1748 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1749 self.name = v.into();
1750 self
1751 }
1752
1753 /// Sets the value of [bucket_name][crate::model::BucketOperation::bucket_name].
1754 ///
1755 /// # Example
1756 /// ```ignore,no_run
1757 /// # use google_cloud_storagebatchoperations_v1::model::BucketOperation;
1758 /// let x = BucketOperation::new().set_bucket_name("example");
1759 /// ```
1760 pub fn set_bucket_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1761 self.bucket_name = v.into();
1762 self
1763 }
1764
1765 /// Sets the value of [create_time][crate::model::BucketOperation::create_time].
1766 ///
1767 /// # Example
1768 /// ```ignore,no_run
1769 /// # use google_cloud_storagebatchoperations_v1::model::BucketOperation;
1770 /// use wkt::Timestamp;
1771 /// let x = BucketOperation::new().set_create_time(Timestamp::default()/* use setters */);
1772 /// ```
1773 pub fn set_create_time<T>(mut self, v: T) -> Self
1774 where
1775 T: std::convert::Into<wkt::Timestamp>,
1776 {
1777 self.create_time = std::option::Option::Some(v.into());
1778 self
1779 }
1780
1781 /// Sets or clears the value of [create_time][crate::model::BucketOperation::create_time].
1782 ///
1783 /// # Example
1784 /// ```ignore,no_run
1785 /// # use google_cloud_storagebatchoperations_v1::model::BucketOperation;
1786 /// use wkt::Timestamp;
1787 /// let x = BucketOperation::new().set_or_clear_create_time(Some(Timestamp::default()/* use setters */));
1788 /// let x = BucketOperation::new().set_or_clear_create_time(None::<Timestamp>);
1789 /// ```
1790 pub fn set_or_clear_create_time<T>(mut self, v: std::option::Option<T>) -> Self
1791 where
1792 T: std::convert::Into<wkt::Timestamp>,
1793 {
1794 self.create_time = v.map(|x| x.into());
1795 self
1796 }
1797
1798 /// Sets the value of [start_time][crate::model::BucketOperation::start_time].
1799 ///
1800 /// # Example
1801 /// ```ignore,no_run
1802 /// # use google_cloud_storagebatchoperations_v1::model::BucketOperation;
1803 /// use wkt::Timestamp;
1804 /// let x = BucketOperation::new().set_start_time(Timestamp::default()/* use setters */);
1805 /// ```
1806 pub fn set_start_time<T>(mut self, v: T) -> Self
1807 where
1808 T: std::convert::Into<wkt::Timestamp>,
1809 {
1810 self.start_time = std::option::Option::Some(v.into());
1811 self
1812 }
1813
1814 /// Sets or clears the value of [start_time][crate::model::BucketOperation::start_time].
1815 ///
1816 /// # Example
1817 /// ```ignore,no_run
1818 /// # use google_cloud_storagebatchoperations_v1::model::BucketOperation;
1819 /// use wkt::Timestamp;
1820 /// let x = BucketOperation::new().set_or_clear_start_time(Some(Timestamp::default()/* use setters */));
1821 /// let x = BucketOperation::new().set_or_clear_start_time(None::<Timestamp>);
1822 /// ```
1823 pub fn set_or_clear_start_time<T>(mut self, v: std::option::Option<T>) -> Self
1824 where
1825 T: std::convert::Into<wkt::Timestamp>,
1826 {
1827 self.start_time = v.map(|x| x.into());
1828 self
1829 }
1830
1831 /// Sets the value of [complete_time][crate::model::BucketOperation::complete_time].
1832 ///
1833 /// # Example
1834 /// ```ignore,no_run
1835 /// # use google_cloud_storagebatchoperations_v1::model::BucketOperation;
1836 /// use wkt::Timestamp;
1837 /// let x = BucketOperation::new().set_complete_time(Timestamp::default()/* use setters */);
1838 /// ```
1839 pub fn set_complete_time<T>(mut self, v: T) -> Self
1840 where
1841 T: std::convert::Into<wkt::Timestamp>,
1842 {
1843 self.complete_time = std::option::Option::Some(v.into());
1844 self
1845 }
1846
1847 /// Sets or clears the value of [complete_time][crate::model::BucketOperation::complete_time].
1848 ///
1849 /// # Example
1850 /// ```ignore,no_run
1851 /// # use google_cloud_storagebatchoperations_v1::model::BucketOperation;
1852 /// use wkt::Timestamp;
1853 /// let x = BucketOperation::new().set_or_clear_complete_time(Some(Timestamp::default()/* use setters */));
1854 /// let x = BucketOperation::new().set_or_clear_complete_time(None::<Timestamp>);
1855 /// ```
1856 pub fn set_or_clear_complete_time<T>(mut self, v: std::option::Option<T>) -> Self
1857 where
1858 T: std::convert::Into<wkt::Timestamp>,
1859 {
1860 self.complete_time = v.map(|x| x.into());
1861 self
1862 }
1863
1864 /// Sets the value of [counters][crate::model::BucketOperation::counters].
1865 ///
1866 /// # Example
1867 /// ```ignore,no_run
1868 /// # use google_cloud_storagebatchoperations_v1::model::BucketOperation;
1869 /// use google_cloud_storagebatchoperations_v1::model::Counters;
1870 /// let x = BucketOperation::new().set_counters(Counters::default()/* use setters */);
1871 /// ```
1872 pub fn set_counters<T>(mut self, v: T) -> Self
1873 where
1874 T: std::convert::Into<crate::model::Counters>,
1875 {
1876 self.counters = std::option::Option::Some(v.into());
1877 self
1878 }
1879
1880 /// Sets or clears the value of [counters][crate::model::BucketOperation::counters].
1881 ///
1882 /// # Example
1883 /// ```ignore,no_run
1884 /// # use google_cloud_storagebatchoperations_v1::model::BucketOperation;
1885 /// use google_cloud_storagebatchoperations_v1::model::Counters;
1886 /// let x = BucketOperation::new().set_or_clear_counters(Some(Counters::default()/* use setters */));
1887 /// let x = BucketOperation::new().set_or_clear_counters(None::<Counters>);
1888 /// ```
1889 pub fn set_or_clear_counters<T>(mut self, v: std::option::Option<T>) -> Self
1890 where
1891 T: std::convert::Into<crate::model::Counters>,
1892 {
1893 self.counters = v.map(|x| x.into());
1894 self
1895 }
1896
1897 /// Sets the value of [error_summaries][crate::model::BucketOperation::error_summaries].
1898 ///
1899 /// # Example
1900 /// ```ignore,no_run
1901 /// # use google_cloud_storagebatchoperations_v1::model::BucketOperation;
1902 /// use google_cloud_storagebatchoperations_v1::model::ErrorSummary;
1903 /// let x = BucketOperation::new()
1904 /// .set_error_summaries([
1905 /// ErrorSummary::default()/* use setters */,
1906 /// ErrorSummary::default()/* use (different) setters */,
1907 /// ]);
1908 /// ```
1909 pub fn set_error_summaries<T, V>(mut self, v: T) -> Self
1910 where
1911 T: std::iter::IntoIterator<Item = V>,
1912 V: std::convert::Into<crate::model::ErrorSummary>,
1913 {
1914 use std::iter::Iterator;
1915 self.error_summaries = v.into_iter().map(|i| i.into()).collect();
1916 self
1917 }
1918
1919 /// Sets the value of [state][crate::model::BucketOperation::state].
1920 ///
1921 /// # Example
1922 /// ```ignore,no_run
1923 /// # use google_cloud_storagebatchoperations_v1::model::BucketOperation;
1924 /// use google_cloud_storagebatchoperations_v1::model::bucket_operation::State;
1925 /// let x0 = BucketOperation::new().set_state(State::Queued);
1926 /// let x1 = BucketOperation::new().set_state(State::Running);
1927 /// let x2 = BucketOperation::new().set_state(State::Succeeded);
1928 /// ```
1929 pub fn set_state<T: std::convert::Into<crate::model::bucket_operation::State>>(
1930 mut self,
1931 v: T,
1932 ) -> Self {
1933 self.state = v.into();
1934 self
1935 }
1936
1937 /// Sets the value of [object_configuration][crate::model::BucketOperation::object_configuration].
1938 ///
1939 /// Note that all the setters affecting `object_configuration` are mutually
1940 /// exclusive.
1941 ///
1942 /// # Example
1943 /// ```ignore,no_run
1944 /// # use google_cloud_storagebatchoperations_v1::model::BucketOperation;
1945 /// use google_cloud_storagebatchoperations_v1::model::PrefixList;
1946 /// let x = BucketOperation::new().set_object_configuration(Some(
1947 /// google_cloud_storagebatchoperations_v1::model::bucket_operation::ObjectConfiguration::PrefixList(PrefixList::default().into())));
1948 /// ```
1949 pub fn set_object_configuration<
1950 T: std::convert::Into<
1951 std::option::Option<crate::model::bucket_operation::ObjectConfiguration>,
1952 >,
1953 >(
1954 mut self,
1955 v: T,
1956 ) -> Self {
1957 self.object_configuration = v.into();
1958 self
1959 }
1960
1961 /// The value of [object_configuration][crate::model::BucketOperation::object_configuration]
1962 /// if it holds a `PrefixList`, `None` if the field is not set or
1963 /// holds a different branch.
1964 pub fn prefix_list(&self) -> std::option::Option<&std::boxed::Box<crate::model::PrefixList>> {
1965 #[allow(unreachable_patterns)]
1966 self.object_configuration.as_ref().and_then(|v| match v {
1967 crate::model::bucket_operation::ObjectConfiguration::PrefixList(v) => {
1968 std::option::Option::Some(v)
1969 }
1970 _ => std::option::Option::None,
1971 })
1972 }
1973
1974 /// Sets the value of [object_configuration][crate::model::BucketOperation::object_configuration]
1975 /// to hold a `PrefixList`.
1976 ///
1977 /// Note that all the setters affecting `object_configuration` are
1978 /// mutually exclusive.
1979 ///
1980 /// # Example
1981 /// ```ignore,no_run
1982 /// # use google_cloud_storagebatchoperations_v1::model::BucketOperation;
1983 /// use google_cloud_storagebatchoperations_v1::model::PrefixList;
1984 /// let x = BucketOperation::new().set_prefix_list(PrefixList::default()/* use setters */);
1985 /// assert!(x.prefix_list().is_some());
1986 /// assert!(x.manifest().is_none());
1987 /// ```
1988 pub fn set_prefix_list<T: std::convert::Into<std::boxed::Box<crate::model::PrefixList>>>(
1989 mut self,
1990 v: T,
1991 ) -> Self {
1992 self.object_configuration = std::option::Option::Some(
1993 crate::model::bucket_operation::ObjectConfiguration::PrefixList(v.into()),
1994 );
1995 self
1996 }
1997
1998 /// The value of [object_configuration][crate::model::BucketOperation::object_configuration]
1999 /// if it holds a `Manifest`, `None` if the field is not set or
2000 /// holds a different branch.
2001 pub fn manifest(&self) -> std::option::Option<&std::boxed::Box<crate::model::Manifest>> {
2002 #[allow(unreachable_patterns)]
2003 self.object_configuration.as_ref().and_then(|v| match v {
2004 crate::model::bucket_operation::ObjectConfiguration::Manifest(v) => {
2005 std::option::Option::Some(v)
2006 }
2007 _ => std::option::Option::None,
2008 })
2009 }
2010
2011 /// Sets the value of [object_configuration][crate::model::BucketOperation::object_configuration]
2012 /// to hold a `Manifest`.
2013 ///
2014 /// Note that all the setters affecting `object_configuration` are
2015 /// mutually exclusive.
2016 ///
2017 /// # Example
2018 /// ```ignore,no_run
2019 /// # use google_cloud_storagebatchoperations_v1::model::BucketOperation;
2020 /// use google_cloud_storagebatchoperations_v1::model::Manifest;
2021 /// let x = BucketOperation::new().set_manifest(Manifest::default()/* use setters */);
2022 /// assert!(x.manifest().is_some());
2023 /// assert!(x.prefix_list().is_none());
2024 /// ```
2025 pub fn set_manifest<T: std::convert::Into<std::boxed::Box<crate::model::Manifest>>>(
2026 mut self,
2027 v: T,
2028 ) -> Self {
2029 self.object_configuration = std::option::Option::Some(
2030 crate::model::bucket_operation::ObjectConfiguration::Manifest(v.into()),
2031 );
2032 self
2033 }
2034
2035 /// Sets the value of [transformation][crate::model::BucketOperation::transformation].
2036 ///
2037 /// Note that all the setters affecting `transformation` are mutually
2038 /// exclusive.
2039 ///
2040 /// # Example
2041 /// ```ignore,no_run
2042 /// # use google_cloud_storagebatchoperations_v1::model::BucketOperation;
2043 /// use google_cloud_storagebatchoperations_v1::model::PutObjectHold;
2044 /// let x = BucketOperation::new().set_transformation(Some(
2045 /// google_cloud_storagebatchoperations_v1::model::bucket_operation::Transformation::PutObjectHold(PutObjectHold::default().into())));
2046 /// ```
2047 pub fn set_transformation<
2048 T: std::convert::Into<std::option::Option<crate::model::bucket_operation::Transformation>>,
2049 >(
2050 mut self,
2051 v: T,
2052 ) -> Self {
2053 self.transformation = v.into();
2054 self
2055 }
2056
2057 /// The value of [transformation][crate::model::BucketOperation::transformation]
2058 /// if it holds a `PutObjectHold`, `None` if the field is not set or
2059 /// holds a different branch.
2060 pub fn put_object_hold(
2061 &self,
2062 ) -> std::option::Option<&std::boxed::Box<crate::model::PutObjectHold>> {
2063 #[allow(unreachable_patterns)]
2064 self.transformation.as_ref().and_then(|v| match v {
2065 crate::model::bucket_operation::Transformation::PutObjectHold(v) => {
2066 std::option::Option::Some(v)
2067 }
2068 _ => std::option::Option::None,
2069 })
2070 }
2071
2072 /// Sets the value of [transformation][crate::model::BucketOperation::transformation]
2073 /// to hold a `PutObjectHold`.
2074 ///
2075 /// Note that all the setters affecting `transformation` are
2076 /// mutually exclusive.
2077 ///
2078 /// # Example
2079 /// ```ignore,no_run
2080 /// # use google_cloud_storagebatchoperations_v1::model::BucketOperation;
2081 /// use google_cloud_storagebatchoperations_v1::model::PutObjectHold;
2082 /// let x = BucketOperation::new().set_put_object_hold(PutObjectHold::default()/* use setters */);
2083 /// assert!(x.put_object_hold().is_some());
2084 /// assert!(x.delete_object().is_none());
2085 /// assert!(x.put_metadata().is_none());
2086 /// assert!(x.rewrite_object().is_none());
2087 /// assert!(x.update_object_custom_context().is_none());
2088 /// ```
2089 pub fn set_put_object_hold<
2090 T: std::convert::Into<std::boxed::Box<crate::model::PutObjectHold>>,
2091 >(
2092 mut self,
2093 v: T,
2094 ) -> Self {
2095 self.transformation = std::option::Option::Some(
2096 crate::model::bucket_operation::Transformation::PutObjectHold(v.into()),
2097 );
2098 self
2099 }
2100
2101 /// The value of [transformation][crate::model::BucketOperation::transformation]
2102 /// if it holds a `DeleteObject`, `None` if the field is not set or
2103 /// holds a different branch.
2104 pub fn delete_object(
2105 &self,
2106 ) -> std::option::Option<&std::boxed::Box<crate::model::DeleteObject>> {
2107 #[allow(unreachable_patterns)]
2108 self.transformation.as_ref().and_then(|v| match v {
2109 crate::model::bucket_operation::Transformation::DeleteObject(v) => {
2110 std::option::Option::Some(v)
2111 }
2112 _ => std::option::Option::None,
2113 })
2114 }
2115
2116 /// Sets the value of [transformation][crate::model::BucketOperation::transformation]
2117 /// to hold a `DeleteObject`.
2118 ///
2119 /// Note that all the setters affecting `transformation` are
2120 /// mutually exclusive.
2121 ///
2122 /// # Example
2123 /// ```ignore,no_run
2124 /// # use google_cloud_storagebatchoperations_v1::model::BucketOperation;
2125 /// use google_cloud_storagebatchoperations_v1::model::DeleteObject;
2126 /// let x = BucketOperation::new().set_delete_object(DeleteObject::default()/* use setters */);
2127 /// assert!(x.delete_object().is_some());
2128 /// assert!(x.put_object_hold().is_none());
2129 /// assert!(x.put_metadata().is_none());
2130 /// assert!(x.rewrite_object().is_none());
2131 /// assert!(x.update_object_custom_context().is_none());
2132 /// ```
2133 pub fn set_delete_object<T: std::convert::Into<std::boxed::Box<crate::model::DeleteObject>>>(
2134 mut self,
2135 v: T,
2136 ) -> Self {
2137 self.transformation = std::option::Option::Some(
2138 crate::model::bucket_operation::Transformation::DeleteObject(v.into()),
2139 );
2140 self
2141 }
2142
2143 /// The value of [transformation][crate::model::BucketOperation::transformation]
2144 /// if it holds a `PutMetadata`, `None` if the field is not set or
2145 /// holds a different branch.
2146 pub fn put_metadata(&self) -> std::option::Option<&std::boxed::Box<crate::model::PutMetadata>> {
2147 #[allow(unreachable_patterns)]
2148 self.transformation.as_ref().and_then(|v| match v {
2149 crate::model::bucket_operation::Transformation::PutMetadata(v) => {
2150 std::option::Option::Some(v)
2151 }
2152 _ => std::option::Option::None,
2153 })
2154 }
2155
2156 /// Sets the value of [transformation][crate::model::BucketOperation::transformation]
2157 /// to hold a `PutMetadata`.
2158 ///
2159 /// Note that all the setters affecting `transformation` are
2160 /// mutually exclusive.
2161 ///
2162 /// # Example
2163 /// ```ignore,no_run
2164 /// # use google_cloud_storagebatchoperations_v1::model::BucketOperation;
2165 /// use google_cloud_storagebatchoperations_v1::model::PutMetadata;
2166 /// let x = BucketOperation::new().set_put_metadata(PutMetadata::default()/* use setters */);
2167 /// assert!(x.put_metadata().is_some());
2168 /// assert!(x.put_object_hold().is_none());
2169 /// assert!(x.delete_object().is_none());
2170 /// assert!(x.rewrite_object().is_none());
2171 /// assert!(x.update_object_custom_context().is_none());
2172 /// ```
2173 pub fn set_put_metadata<T: std::convert::Into<std::boxed::Box<crate::model::PutMetadata>>>(
2174 mut self,
2175 v: T,
2176 ) -> Self {
2177 self.transformation = std::option::Option::Some(
2178 crate::model::bucket_operation::Transformation::PutMetadata(v.into()),
2179 );
2180 self
2181 }
2182
2183 /// The value of [transformation][crate::model::BucketOperation::transformation]
2184 /// if it holds a `RewriteObject`, `None` if the field is not set or
2185 /// holds a different branch.
2186 pub fn rewrite_object(
2187 &self,
2188 ) -> std::option::Option<&std::boxed::Box<crate::model::RewriteObject>> {
2189 #[allow(unreachable_patterns)]
2190 self.transformation.as_ref().and_then(|v| match v {
2191 crate::model::bucket_operation::Transformation::RewriteObject(v) => {
2192 std::option::Option::Some(v)
2193 }
2194 _ => std::option::Option::None,
2195 })
2196 }
2197
2198 /// Sets the value of [transformation][crate::model::BucketOperation::transformation]
2199 /// to hold a `RewriteObject`.
2200 ///
2201 /// Note that all the setters affecting `transformation` are
2202 /// mutually exclusive.
2203 ///
2204 /// # Example
2205 /// ```ignore,no_run
2206 /// # use google_cloud_storagebatchoperations_v1::model::BucketOperation;
2207 /// use google_cloud_storagebatchoperations_v1::model::RewriteObject;
2208 /// let x = BucketOperation::new().set_rewrite_object(RewriteObject::default()/* use setters */);
2209 /// assert!(x.rewrite_object().is_some());
2210 /// assert!(x.put_object_hold().is_none());
2211 /// assert!(x.delete_object().is_none());
2212 /// assert!(x.put_metadata().is_none());
2213 /// assert!(x.update_object_custom_context().is_none());
2214 /// ```
2215 pub fn set_rewrite_object<
2216 T: std::convert::Into<std::boxed::Box<crate::model::RewriteObject>>,
2217 >(
2218 mut self,
2219 v: T,
2220 ) -> Self {
2221 self.transformation = std::option::Option::Some(
2222 crate::model::bucket_operation::Transformation::RewriteObject(v.into()),
2223 );
2224 self
2225 }
2226
2227 /// The value of [transformation][crate::model::BucketOperation::transformation]
2228 /// if it holds a `UpdateObjectCustomContext`, `None` if the field is not set or
2229 /// holds a different branch.
2230 pub fn update_object_custom_context(
2231 &self,
2232 ) -> std::option::Option<&std::boxed::Box<crate::model::UpdateObjectCustomContext>> {
2233 #[allow(unreachable_patterns)]
2234 self.transformation.as_ref().and_then(|v| match v {
2235 crate::model::bucket_operation::Transformation::UpdateObjectCustomContext(v) => {
2236 std::option::Option::Some(v)
2237 }
2238 _ => std::option::Option::None,
2239 })
2240 }
2241
2242 /// Sets the value of [transformation][crate::model::BucketOperation::transformation]
2243 /// to hold a `UpdateObjectCustomContext`.
2244 ///
2245 /// Note that all the setters affecting `transformation` are
2246 /// mutually exclusive.
2247 ///
2248 /// # Example
2249 /// ```ignore,no_run
2250 /// # use google_cloud_storagebatchoperations_v1::model::BucketOperation;
2251 /// use google_cloud_storagebatchoperations_v1::model::UpdateObjectCustomContext;
2252 /// let x = BucketOperation::new().set_update_object_custom_context(UpdateObjectCustomContext::default()/* use setters */);
2253 /// assert!(x.update_object_custom_context().is_some());
2254 /// assert!(x.put_object_hold().is_none());
2255 /// assert!(x.delete_object().is_none());
2256 /// assert!(x.put_metadata().is_none());
2257 /// assert!(x.rewrite_object().is_none());
2258 /// ```
2259 pub fn set_update_object_custom_context<
2260 T: std::convert::Into<std::boxed::Box<crate::model::UpdateObjectCustomContext>>,
2261 >(
2262 mut self,
2263 v: T,
2264 ) -> Self {
2265 self.transformation = std::option::Option::Some(
2266 crate::model::bucket_operation::Transformation::UpdateObjectCustomContext(v.into()),
2267 );
2268 self
2269 }
2270}
2271
2272impl wkt::message::Message for BucketOperation {
2273 fn typename() -> &'static str {
2274 "type.googleapis.com/google.cloud.storagebatchoperations.v1.BucketOperation"
2275 }
2276}
2277
2278/// Defines additional types related to [BucketOperation].
2279pub mod bucket_operation {
2280 #[allow(unused_imports)]
2281 use super::*;
2282
2283 /// Describes state of the BucketOperation.
2284 ///
2285 /// # Working with unknown values
2286 ///
2287 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
2288 /// additional enum variants at any time. Adding new variants is not considered
2289 /// a breaking change. Applications should write their code in anticipation of:
2290 ///
2291 /// - New values appearing in future releases of the client library, **and**
2292 /// - New values received dynamically, without application changes.
2293 ///
2294 /// Please consult the [Working with enums] section in the user guide for some
2295 /// guidelines.
2296 ///
2297 /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
2298 #[derive(Clone, Debug, PartialEq)]
2299 #[non_exhaustive]
2300 pub enum State {
2301 /// Default value. This value is unused.
2302 Unspecified,
2303 /// Created but not yet started.
2304 Queued,
2305 /// In progress.
2306 Running,
2307 /// Completed successfully.
2308 Succeeded,
2309 /// Cancelled by the user.
2310 Canceled,
2311 /// Terminated due to an unrecoverable failure.
2312 Failed,
2313 /// If set, the enum was initialized with an unknown value.
2314 ///
2315 /// Applications can examine the value using [State::value] or
2316 /// [State::name].
2317 UnknownValue(state::UnknownValue),
2318 }
2319
2320 #[doc(hidden)]
2321 pub mod state {
2322 #[allow(unused_imports)]
2323 use super::*;
2324 #[derive(Clone, Debug, PartialEq)]
2325 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
2326 }
2327
2328 impl State {
2329 /// Gets the enum value.
2330 ///
2331 /// Returns `None` if the enum contains an unknown value deserialized from
2332 /// the string representation of enums.
2333 pub fn value(&self) -> std::option::Option<i32> {
2334 match self {
2335 Self::Unspecified => std::option::Option::Some(0),
2336 Self::Queued => std::option::Option::Some(1),
2337 Self::Running => std::option::Option::Some(2),
2338 Self::Succeeded => std::option::Option::Some(3),
2339 Self::Canceled => std::option::Option::Some(4),
2340 Self::Failed => std::option::Option::Some(5),
2341 Self::UnknownValue(u) => u.0.value(),
2342 }
2343 }
2344
2345 /// Gets the enum value as a string.
2346 ///
2347 /// Returns `None` if the enum contains an unknown value deserialized from
2348 /// the integer representation of enums.
2349 pub fn name(&self) -> std::option::Option<&str> {
2350 match self {
2351 Self::Unspecified => std::option::Option::Some("STATE_UNSPECIFIED"),
2352 Self::Queued => std::option::Option::Some("QUEUED"),
2353 Self::Running => std::option::Option::Some("RUNNING"),
2354 Self::Succeeded => std::option::Option::Some("SUCCEEDED"),
2355 Self::Canceled => std::option::Option::Some("CANCELED"),
2356 Self::Failed => std::option::Option::Some("FAILED"),
2357 Self::UnknownValue(u) => u.0.name(),
2358 }
2359 }
2360 }
2361
2362 impl std::default::Default for State {
2363 fn default() -> Self {
2364 use std::convert::From;
2365 Self::from(0)
2366 }
2367 }
2368
2369 impl std::fmt::Display for State {
2370 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
2371 wkt::internal::display_enum(f, self.name(), self.value())
2372 }
2373 }
2374
2375 impl std::convert::From<i32> for State {
2376 fn from(value: i32) -> Self {
2377 match value {
2378 0 => Self::Unspecified,
2379 1 => Self::Queued,
2380 2 => Self::Running,
2381 3 => Self::Succeeded,
2382 4 => Self::Canceled,
2383 5 => Self::Failed,
2384 _ => Self::UnknownValue(state::UnknownValue(
2385 wkt::internal::UnknownEnumValue::Integer(value),
2386 )),
2387 }
2388 }
2389 }
2390
2391 impl std::convert::From<&str> for State {
2392 fn from(value: &str) -> Self {
2393 use std::string::ToString;
2394 match value {
2395 "STATE_UNSPECIFIED" => Self::Unspecified,
2396 "QUEUED" => Self::Queued,
2397 "RUNNING" => Self::Running,
2398 "SUCCEEDED" => Self::Succeeded,
2399 "CANCELED" => Self::Canceled,
2400 "FAILED" => Self::Failed,
2401 _ => Self::UnknownValue(state::UnknownValue(
2402 wkt::internal::UnknownEnumValue::String(value.to_string()),
2403 )),
2404 }
2405 }
2406 }
2407
2408 impl serde::ser::Serialize for State {
2409 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
2410 where
2411 S: serde::Serializer,
2412 {
2413 match self {
2414 Self::Unspecified => serializer.serialize_i32(0),
2415 Self::Queued => serializer.serialize_i32(1),
2416 Self::Running => serializer.serialize_i32(2),
2417 Self::Succeeded => serializer.serialize_i32(3),
2418 Self::Canceled => serializer.serialize_i32(4),
2419 Self::Failed => serializer.serialize_i32(5),
2420 Self::UnknownValue(u) => u.0.serialize(serializer),
2421 }
2422 }
2423 }
2424
2425 impl<'de> serde::de::Deserialize<'de> for State {
2426 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
2427 where
2428 D: serde::Deserializer<'de>,
2429 {
2430 deserializer.deserialize_any(wkt::internal::EnumVisitor::<State>::new(
2431 ".google.cloud.storagebatchoperations.v1.BucketOperation.State",
2432 ))
2433 }
2434 }
2435
2436 /// Specifies objects to be transformed in the BucketOperation.
2437 #[derive(Clone, Debug, PartialEq)]
2438 #[non_exhaustive]
2439 pub enum ObjectConfiguration {
2440 /// Specifies objects matching a prefix set.
2441 PrefixList(std::boxed::Box<crate::model::PrefixList>),
2442 /// Specifies objects in a manifest file.
2443 Manifest(std::boxed::Box<crate::model::Manifest>),
2444 }
2445
2446 /// Action to be performed on the objects.
2447 #[derive(Clone, Debug, PartialEq)]
2448 #[non_exhaustive]
2449 pub enum Transformation {
2450 /// Changes object hold status.
2451 PutObjectHold(std::boxed::Box<crate::model::PutObjectHold>),
2452 /// Delete objects.
2453 DeleteObject(std::boxed::Box<crate::model::DeleteObject>),
2454 /// Updates object metadata. Allows updating fixed-key and custom metadata
2455 /// and fixed-key metadata i.e. Cache-Control, Content-Disposition,
2456 /// Content-Encoding, Content-Language, Content-Type, Custom-Time.
2457 PutMetadata(std::boxed::Box<crate::model::PutMetadata>),
2458 /// Rewrite the object and updates metadata like KMS key.
2459 RewriteObject(std::boxed::Box<crate::model::RewriteObject>),
2460 /// Update object custom context.
2461 UpdateObjectCustomContext(std::boxed::Box<crate::model::UpdateObjectCustomContext>),
2462 }
2463}
2464
2465/// Describes list of buckets and their objects to be transformed.
2466#[derive(Clone, Default, PartialEq)]
2467#[non_exhaustive]
2468pub struct BucketList {
2469 /// Required. List of buckets and their objects to be transformed. Currently,
2470 /// only one bucket configuration is supported. If multiple buckets are
2471 /// specified, an error will be returned.
2472 pub buckets: std::vec::Vec<crate::model::bucket_list::Bucket>,
2473
2474 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2475}
2476
2477impl BucketList {
2478 pub fn new() -> Self {
2479 std::default::Default::default()
2480 }
2481
2482 /// Sets the value of [buckets][crate::model::BucketList::buckets].
2483 ///
2484 /// # Example
2485 /// ```ignore,no_run
2486 /// # use google_cloud_storagebatchoperations_v1::model::BucketList;
2487 /// use google_cloud_storagebatchoperations_v1::model::bucket_list::Bucket;
2488 /// let x = BucketList::new()
2489 /// .set_buckets([
2490 /// Bucket::default()/* use setters */,
2491 /// Bucket::default()/* use (different) setters */,
2492 /// ]);
2493 /// ```
2494 pub fn set_buckets<T, V>(mut self, v: T) -> Self
2495 where
2496 T: std::iter::IntoIterator<Item = V>,
2497 V: std::convert::Into<crate::model::bucket_list::Bucket>,
2498 {
2499 use std::iter::Iterator;
2500 self.buckets = v.into_iter().map(|i| i.into()).collect();
2501 self
2502 }
2503}
2504
2505impl wkt::message::Message for BucketList {
2506 fn typename() -> &'static str {
2507 "type.googleapis.com/google.cloud.storagebatchoperations.v1.BucketList"
2508 }
2509}
2510
2511/// Defines additional types related to [BucketList].
2512pub mod bucket_list {
2513 #[allow(unused_imports)]
2514 use super::*;
2515
2516 /// Describes configuration of a single bucket and its objects to be
2517 /// transformed.
2518 #[derive(Clone, Default, PartialEq)]
2519 #[non_exhaustive]
2520 pub struct Bucket {
2521 /// Required. Bucket name for the objects to be transformed.
2522 pub bucket: std::string::String,
2523
2524 /// Specifies objects to be transformed.
2525 pub object_configuration:
2526 std::option::Option<crate::model::bucket_list::bucket::ObjectConfiguration>,
2527
2528 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2529 }
2530
2531 impl Bucket {
2532 pub fn new() -> Self {
2533 std::default::Default::default()
2534 }
2535
2536 /// Sets the value of [bucket][crate::model::bucket_list::Bucket::bucket].
2537 ///
2538 /// # Example
2539 /// ```ignore,no_run
2540 /// # use google_cloud_storagebatchoperations_v1::model::bucket_list::Bucket;
2541 /// let x = Bucket::new().set_bucket("example");
2542 /// ```
2543 pub fn set_bucket<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2544 self.bucket = v.into();
2545 self
2546 }
2547
2548 /// Sets the value of [object_configuration][crate::model::bucket_list::Bucket::object_configuration].
2549 ///
2550 /// Note that all the setters affecting `object_configuration` are mutually
2551 /// exclusive.
2552 ///
2553 /// # Example
2554 /// ```ignore,no_run
2555 /// # use google_cloud_storagebatchoperations_v1::model::bucket_list::Bucket;
2556 /// use google_cloud_storagebatchoperations_v1::model::PrefixList;
2557 /// let x = Bucket::new().set_object_configuration(Some(
2558 /// google_cloud_storagebatchoperations_v1::model::bucket_list::bucket::ObjectConfiguration::PrefixList(PrefixList::default().into())));
2559 /// ```
2560 pub fn set_object_configuration<
2561 T: std::convert::Into<
2562 std::option::Option<crate::model::bucket_list::bucket::ObjectConfiguration>,
2563 >,
2564 >(
2565 mut self,
2566 v: T,
2567 ) -> Self {
2568 self.object_configuration = v.into();
2569 self
2570 }
2571
2572 /// The value of [object_configuration][crate::model::bucket_list::Bucket::object_configuration]
2573 /// if it holds a `PrefixList`, `None` if the field is not set or
2574 /// holds a different branch.
2575 pub fn prefix_list(
2576 &self,
2577 ) -> std::option::Option<&std::boxed::Box<crate::model::PrefixList>> {
2578 #[allow(unreachable_patterns)]
2579 self.object_configuration.as_ref().and_then(|v| match v {
2580 crate::model::bucket_list::bucket::ObjectConfiguration::PrefixList(v) => {
2581 std::option::Option::Some(v)
2582 }
2583 _ => std::option::Option::None,
2584 })
2585 }
2586
2587 /// Sets the value of [object_configuration][crate::model::bucket_list::Bucket::object_configuration]
2588 /// to hold a `PrefixList`.
2589 ///
2590 /// Note that all the setters affecting `object_configuration` are
2591 /// mutually exclusive.
2592 ///
2593 /// # Example
2594 /// ```ignore,no_run
2595 /// # use google_cloud_storagebatchoperations_v1::model::bucket_list::Bucket;
2596 /// use google_cloud_storagebatchoperations_v1::model::PrefixList;
2597 /// let x = Bucket::new().set_prefix_list(PrefixList::default()/* use setters */);
2598 /// assert!(x.prefix_list().is_some());
2599 /// assert!(x.manifest().is_none());
2600 /// ```
2601 pub fn set_prefix_list<T: std::convert::Into<std::boxed::Box<crate::model::PrefixList>>>(
2602 mut self,
2603 v: T,
2604 ) -> Self {
2605 self.object_configuration = std::option::Option::Some(
2606 crate::model::bucket_list::bucket::ObjectConfiguration::PrefixList(v.into()),
2607 );
2608 self
2609 }
2610
2611 /// The value of [object_configuration][crate::model::bucket_list::Bucket::object_configuration]
2612 /// if it holds a `Manifest`, `None` if the field is not set or
2613 /// holds a different branch.
2614 pub fn manifest(&self) -> std::option::Option<&std::boxed::Box<crate::model::Manifest>> {
2615 #[allow(unreachable_patterns)]
2616 self.object_configuration.as_ref().and_then(|v| match v {
2617 crate::model::bucket_list::bucket::ObjectConfiguration::Manifest(v) => {
2618 std::option::Option::Some(v)
2619 }
2620 _ => std::option::Option::None,
2621 })
2622 }
2623
2624 /// Sets the value of [object_configuration][crate::model::bucket_list::Bucket::object_configuration]
2625 /// to hold a `Manifest`.
2626 ///
2627 /// Note that all the setters affecting `object_configuration` are
2628 /// mutually exclusive.
2629 ///
2630 /// # Example
2631 /// ```ignore,no_run
2632 /// # use google_cloud_storagebatchoperations_v1::model::bucket_list::Bucket;
2633 /// use google_cloud_storagebatchoperations_v1::model::Manifest;
2634 /// let x = Bucket::new().set_manifest(Manifest::default()/* use setters */);
2635 /// assert!(x.manifest().is_some());
2636 /// assert!(x.prefix_list().is_none());
2637 /// ```
2638 pub fn set_manifest<T: std::convert::Into<std::boxed::Box<crate::model::Manifest>>>(
2639 mut self,
2640 v: T,
2641 ) -> Self {
2642 self.object_configuration = std::option::Option::Some(
2643 crate::model::bucket_list::bucket::ObjectConfiguration::Manifest(v.into()),
2644 );
2645 self
2646 }
2647 }
2648
2649 impl wkt::message::Message for Bucket {
2650 fn typename() -> &'static str {
2651 "type.googleapis.com/google.cloud.storagebatchoperations.v1.BucketList.Bucket"
2652 }
2653 }
2654
2655 /// Defines additional types related to [Bucket].
2656 pub mod bucket {
2657 #[allow(unused_imports)]
2658 use super::*;
2659
2660 /// Specifies objects to be transformed.
2661 #[derive(Clone, Debug, PartialEq)]
2662 #[non_exhaustive]
2663 pub enum ObjectConfiguration {
2664 /// Specifies objects matching a prefix set.
2665 PrefixList(std::boxed::Box<crate::model::PrefixList>),
2666 /// Specifies objects in a manifest file.
2667 Manifest(std::boxed::Box<crate::model::Manifest>),
2668 }
2669 }
2670}
2671
2672/// Describes list of objects to be transformed.
2673#[derive(Clone, Default, PartialEq)]
2674#[non_exhaustive]
2675pub struct Manifest {
2676 /// Required. `manifest_location` must contain the manifest source file that is
2677 /// a CSV file in a Google Cloud Storage bucket. Each row in the file must
2678 /// include the object details i.e. BucketId and Name. Generation may
2679 /// optionally be specified. When it is not specified the live object is acted
2680 /// upon. `manifest_location` should either be 1) An absolute path to the
2681 /// object in the format of `gs://bucket_name/path/file_name.csv`. 2) An
2682 /// absolute path with a single wildcard character in the file name, for
2683 /// example `gs://bucket_name/path/file_name*.csv`.
2684 /// If manifest location is specified with a wildcard, objects in all manifest
2685 /// files matching the pattern will be acted upon.
2686 pub manifest_location: std::string::String,
2687
2688 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2689}
2690
2691impl Manifest {
2692 pub fn new() -> Self {
2693 std::default::Default::default()
2694 }
2695
2696 /// Sets the value of [manifest_location][crate::model::Manifest::manifest_location].
2697 ///
2698 /// # Example
2699 /// ```ignore,no_run
2700 /// # use google_cloud_storagebatchoperations_v1::model::Manifest;
2701 /// let x = Manifest::new().set_manifest_location("example");
2702 /// ```
2703 pub fn set_manifest_location<T: std::convert::Into<std::string::String>>(
2704 mut self,
2705 v: T,
2706 ) -> Self {
2707 self.manifest_location = v.into();
2708 self
2709 }
2710}
2711
2712impl wkt::message::Message for Manifest {
2713 fn typename() -> &'static str {
2714 "type.googleapis.com/google.cloud.storagebatchoperations.v1.Manifest"
2715 }
2716}
2717
2718/// Describes prefixes of objects to be transformed.
2719#[derive(Clone, Default, PartialEq)]
2720#[non_exhaustive]
2721pub struct PrefixList {
2722 /// Optional. Include prefixes of the objects to be transformed.
2723 ///
2724 /// * Supports full object name
2725 /// * Supports prefix of the object name
2726 /// * Wildcards are not supported
2727 /// * Supports empty string for all objects in a bucket.
2728 pub included_object_prefixes: std::vec::Vec<std::string::String>,
2729
2730 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2731}
2732
2733impl PrefixList {
2734 pub fn new() -> Self {
2735 std::default::Default::default()
2736 }
2737
2738 /// Sets the value of [included_object_prefixes][crate::model::PrefixList::included_object_prefixes].
2739 ///
2740 /// # Example
2741 /// ```ignore,no_run
2742 /// # use google_cloud_storagebatchoperations_v1::model::PrefixList;
2743 /// let x = PrefixList::new().set_included_object_prefixes(["a", "b", "c"]);
2744 /// ```
2745 pub fn set_included_object_prefixes<T, V>(mut self, v: T) -> Self
2746 where
2747 T: std::iter::IntoIterator<Item = V>,
2748 V: std::convert::Into<std::string::String>,
2749 {
2750 use std::iter::Iterator;
2751 self.included_object_prefixes = v.into_iter().map(|i| i.into()).collect();
2752 self
2753 }
2754}
2755
2756impl wkt::message::Message for PrefixList {
2757 fn typename() -> &'static str {
2758 "type.googleapis.com/google.cloud.storagebatchoperations.v1.PrefixList"
2759 }
2760}
2761
2762/// Describes options to update object hold.
2763#[derive(Clone, Default, PartialEq)]
2764#[non_exhaustive]
2765pub struct PutObjectHold {
2766 /// Required. Updates object temporary holds state. When object temporary hold
2767 /// is set, object cannot be deleted or replaced.
2768 pub temporary_hold: crate::model::put_object_hold::HoldStatus,
2769
2770 /// Required. Updates object event based holds state. When object event based
2771 /// hold is set, object cannot be deleted or replaced. Resets object's time in
2772 /// the bucket for the purposes of the retention period.
2773 pub event_based_hold: crate::model::put_object_hold::HoldStatus,
2774
2775 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2776}
2777
2778impl PutObjectHold {
2779 pub fn new() -> Self {
2780 std::default::Default::default()
2781 }
2782
2783 /// Sets the value of [temporary_hold][crate::model::PutObjectHold::temporary_hold].
2784 ///
2785 /// # Example
2786 /// ```ignore,no_run
2787 /// # use google_cloud_storagebatchoperations_v1::model::PutObjectHold;
2788 /// use google_cloud_storagebatchoperations_v1::model::put_object_hold::HoldStatus;
2789 /// let x0 = PutObjectHold::new().set_temporary_hold(HoldStatus::Set);
2790 /// let x1 = PutObjectHold::new().set_temporary_hold(HoldStatus::Unset);
2791 /// ```
2792 pub fn set_temporary_hold<T: std::convert::Into<crate::model::put_object_hold::HoldStatus>>(
2793 mut self,
2794 v: T,
2795 ) -> Self {
2796 self.temporary_hold = v.into();
2797 self
2798 }
2799
2800 /// Sets the value of [event_based_hold][crate::model::PutObjectHold::event_based_hold].
2801 ///
2802 /// # Example
2803 /// ```ignore,no_run
2804 /// # use google_cloud_storagebatchoperations_v1::model::PutObjectHold;
2805 /// use google_cloud_storagebatchoperations_v1::model::put_object_hold::HoldStatus;
2806 /// let x0 = PutObjectHold::new().set_event_based_hold(HoldStatus::Set);
2807 /// let x1 = PutObjectHold::new().set_event_based_hold(HoldStatus::Unset);
2808 /// ```
2809 pub fn set_event_based_hold<
2810 T: std::convert::Into<crate::model::put_object_hold::HoldStatus>,
2811 >(
2812 mut self,
2813 v: T,
2814 ) -> Self {
2815 self.event_based_hold = v.into();
2816 self
2817 }
2818}
2819
2820impl wkt::message::Message for PutObjectHold {
2821 fn typename() -> &'static str {
2822 "type.googleapis.com/google.cloud.storagebatchoperations.v1.PutObjectHold"
2823 }
2824}
2825
2826/// Defines additional types related to [PutObjectHold].
2827pub mod put_object_hold {
2828 #[allow(unused_imports)]
2829 use super::*;
2830
2831 /// Describes the status of the hold.
2832 ///
2833 /// # Working with unknown values
2834 ///
2835 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
2836 /// additional enum variants at any time. Adding new variants is not considered
2837 /// a breaking change. Applications should write their code in anticipation of:
2838 ///
2839 /// - New values appearing in future releases of the client library, **and**
2840 /// - New values received dynamically, without application changes.
2841 ///
2842 /// Please consult the [Working with enums] section in the user guide for some
2843 /// guidelines.
2844 ///
2845 /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
2846 #[derive(Clone, Debug, PartialEq)]
2847 #[non_exhaustive]
2848 pub enum HoldStatus {
2849 /// Default value, Object hold status will not be changed.
2850 Unspecified,
2851 /// Places the hold.
2852 Set,
2853 /// Releases the hold.
2854 Unset,
2855 /// If set, the enum was initialized with an unknown value.
2856 ///
2857 /// Applications can examine the value using [HoldStatus::value] or
2858 /// [HoldStatus::name].
2859 UnknownValue(hold_status::UnknownValue),
2860 }
2861
2862 #[doc(hidden)]
2863 pub mod hold_status {
2864 #[allow(unused_imports)]
2865 use super::*;
2866 #[derive(Clone, Debug, PartialEq)]
2867 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
2868 }
2869
2870 impl HoldStatus {
2871 /// Gets the enum value.
2872 ///
2873 /// Returns `None` if the enum contains an unknown value deserialized from
2874 /// the string representation of enums.
2875 pub fn value(&self) -> std::option::Option<i32> {
2876 match self {
2877 Self::Unspecified => std::option::Option::Some(0),
2878 Self::Set => std::option::Option::Some(1),
2879 Self::Unset => std::option::Option::Some(2),
2880 Self::UnknownValue(u) => u.0.value(),
2881 }
2882 }
2883
2884 /// Gets the enum value as a string.
2885 ///
2886 /// Returns `None` if the enum contains an unknown value deserialized from
2887 /// the integer representation of enums.
2888 pub fn name(&self) -> std::option::Option<&str> {
2889 match self {
2890 Self::Unspecified => std::option::Option::Some("HOLD_STATUS_UNSPECIFIED"),
2891 Self::Set => std::option::Option::Some("SET"),
2892 Self::Unset => std::option::Option::Some("UNSET"),
2893 Self::UnknownValue(u) => u.0.name(),
2894 }
2895 }
2896 }
2897
2898 impl std::default::Default for HoldStatus {
2899 fn default() -> Self {
2900 use std::convert::From;
2901 Self::from(0)
2902 }
2903 }
2904
2905 impl std::fmt::Display for HoldStatus {
2906 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
2907 wkt::internal::display_enum(f, self.name(), self.value())
2908 }
2909 }
2910
2911 impl std::convert::From<i32> for HoldStatus {
2912 fn from(value: i32) -> Self {
2913 match value {
2914 0 => Self::Unspecified,
2915 1 => Self::Set,
2916 2 => Self::Unset,
2917 _ => Self::UnknownValue(hold_status::UnknownValue(
2918 wkt::internal::UnknownEnumValue::Integer(value),
2919 )),
2920 }
2921 }
2922 }
2923
2924 impl std::convert::From<&str> for HoldStatus {
2925 fn from(value: &str) -> Self {
2926 use std::string::ToString;
2927 match value {
2928 "HOLD_STATUS_UNSPECIFIED" => Self::Unspecified,
2929 "SET" => Self::Set,
2930 "UNSET" => Self::Unset,
2931 _ => Self::UnknownValue(hold_status::UnknownValue(
2932 wkt::internal::UnknownEnumValue::String(value.to_string()),
2933 )),
2934 }
2935 }
2936 }
2937
2938 impl serde::ser::Serialize for HoldStatus {
2939 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
2940 where
2941 S: serde::Serializer,
2942 {
2943 match self {
2944 Self::Unspecified => serializer.serialize_i32(0),
2945 Self::Set => serializer.serialize_i32(1),
2946 Self::Unset => serializer.serialize_i32(2),
2947 Self::UnknownValue(u) => u.0.serialize(serializer),
2948 }
2949 }
2950 }
2951
2952 impl<'de> serde::de::Deserialize<'de> for HoldStatus {
2953 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
2954 where
2955 D: serde::Deserializer<'de>,
2956 {
2957 deserializer.deserialize_any(wkt::internal::EnumVisitor::<HoldStatus>::new(
2958 ".google.cloud.storagebatchoperations.v1.PutObjectHold.HoldStatus",
2959 ))
2960 }
2961 }
2962}
2963
2964/// Describes options to delete an object.
2965#[derive(Clone, Default, PartialEq)]
2966#[non_exhaustive]
2967pub struct DeleteObject {
2968 /// Required. Controls deletion behavior when versioning is enabled for the
2969 /// object's bucket. If true both live and noncurrent objects will be
2970 /// permanently deleted. Otherwise live objects in versioned buckets will
2971 /// become noncurrent and objects that were already noncurrent will be skipped.
2972 /// This setting doesn't have any impact on the Soft Delete feature. All
2973 /// objects deleted by this service can be be restored for the duration of the
2974 /// Soft Delete retention duration if enabled. If enabled and the manifest
2975 /// doesn't specify an object's generation, a GetObjectMetadata call (a Class B
2976 /// operation) will be made to determine the live object generation.
2977 pub permanent_object_deletion_enabled: bool,
2978
2979 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2980}
2981
2982impl DeleteObject {
2983 pub fn new() -> Self {
2984 std::default::Default::default()
2985 }
2986
2987 /// Sets the value of [permanent_object_deletion_enabled][crate::model::DeleteObject::permanent_object_deletion_enabled].
2988 ///
2989 /// # Example
2990 /// ```ignore,no_run
2991 /// # use google_cloud_storagebatchoperations_v1::model::DeleteObject;
2992 /// let x = DeleteObject::new().set_permanent_object_deletion_enabled(true);
2993 /// ```
2994 pub fn set_permanent_object_deletion_enabled<T: std::convert::Into<bool>>(
2995 mut self,
2996 v: T,
2997 ) -> Self {
2998 self.permanent_object_deletion_enabled = v.into();
2999 self
3000 }
3001}
3002
3003impl wkt::message::Message for DeleteObject {
3004 fn typename() -> &'static str {
3005 "type.googleapis.com/google.cloud.storagebatchoperations.v1.DeleteObject"
3006 }
3007}
3008
3009/// Describes options for object rewrite.
3010#[derive(Clone, Default, PartialEq)]
3011#[non_exhaustive]
3012pub struct RewriteObject {
3013 /// Required. Resource name of the Cloud KMS key that will be used to encrypt
3014 /// the object. The Cloud KMS key must be located in same location as the
3015 /// object. Refer to
3016 /// <https://cloud.google.com/storage/docs/encryption/using-customer-managed-keys#add-object-key>
3017 /// for additional documentation. Format:
3018 /// projects/{project}/locations/{location}/keyRings/{keyring}/cryptoKeys/{key}
3019 /// For example:
3020 /// "projects/123456/locations/us-central1/keyRings/my-keyring/cryptoKeys/my-key".
3021 /// The object will be rewritten and set with the specified KMS key.
3022 pub kms_key: std::option::Option<std::string::String>,
3023
3024 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3025}
3026
3027impl RewriteObject {
3028 pub fn new() -> Self {
3029 std::default::Default::default()
3030 }
3031
3032 /// Sets the value of [kms_key][crate::model::RewriteObject::kms_key].
3033 ///
3034 /// # Example
3035 /// ```ignore,no_run
3036 /// # use google_cloud_storagebatchoperations_v1::model::RewriteObject;
3037 /// let x = RewriteObject::new().set_kms_key("example");
3038 /// ```
3039 pub fn set_kms_key<T>(mut self, v: T) -> Self
3040 where
3041 T: std::convert::Into<std::string::String>,
3042 {
3043 self.kms_key = std::option::Option::Some(v.into());
3044 self
3045 }
3046
3047 /// Sets or clears the value of [kms_key][crate::model::RewriteObject::kms_key].
3048 ///
3049 /// # Example
3050 /// ```ignore,no_run
3051 /// # use google_cloud_storagebatchoperations_v1::model::RewriteObject;
3052 /// let x = RewriteObject::new().set_or_clear_kms_key(Some("example"));
3053 /// let x = RewriteObject::new().set_or_clear_kms_key(None::<String>);
3054 /// ```
3055 pub fn set_or_clear_kms_key<T>(mut self, v: std::option::Option<T>) -> Self
3056 where
3057 T: std::convert::Into<std::string::String>,
3058 {
3059 self.kms_key = v.map(|x| x.into());
3060 self
3061 }
3062}
3063
3064impl wkt::message::Message for RewriteObject {
3065 fn typename() -> &'static str {
3066 "type.googleapis.com/google.cloud.storagebatchoperations.v1.RewriteObject"
3067 }
3068}
3069
3070/// Describes options for object retention update.
3071#[derive(Clone, Default, PartialEq)]
3072#[non_exhaustive]
3073pub struct ObjectRetention {
3074 /// Required. The time when the object will be retained until. UNSET will clear
3075 /// the retention. Must be specified in RFC 3339 format e.g.
3076 /// YYYY-MM-DD'T'HH:MM:SS.SS'Z' or YYYY-MM-DD'T'HH:MM:SS'Z'.
3077 pub retain_until_time: std::option::Option<std::string::String>,
3078
3079 /// Required. The retention mode of the object.
3080 pub retention_mode: std::option::Option<crate::model::object_retention::RetentionMode>,
3081
3082 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3083}
3084
3085impl ObjectRetention {
3086 pub fn new() -> Self {
3087 std::default::Default::default()
3088 }
3089
3090 /// Sets the value of [retain_until_time][crate::model::ObjectRetention::retain_until_time].
3091 ///
3092 /// # Example
3093 /// ```ignore,no_run
3094 /// # use google_cloud_storagebatchoperations_v1::model::ObjectRetention;
3095 /// let x = ObjectRetention::new().set_retain_until_time("example");
3096 /// ```
3097 pub fn set_retain_until_time<T>(mut self, v: T) -> Self
3098 where
3099 T: std::convert::Into<std::string::String>,
3100 {
3101 self.retain_until_time = std::option::Option::Some(v.into());
3102 self
3103 }
3104
3105 /// Sets or clears the value of [retain_until_time][crate::model::ObjectRetention::retain_until_time].
3106 ///
3107 /// # Example
3108 /// ```ignore,no_run
3109 /// # use google_cloud_storagebatchoperations_v1::model::ObjectRetention;
3110 /// let x = ObjectRetention::new().set_or_clear_retain_until_time(Some("example"));
3111 /// let x = ObjectRetention::new().set_or_clear_retain_until_time(None::<String>);
3112 /// ```
3113 pub fn set_or_clear_retain_until_time<T>(mut self, v: std::option::Option<T>) -> Self
3114 where
3115 T: std::convert::Into<std::string::String>,
3116 {
3117 self.retain_until_time = v.map(|x| x.into());
3118 self
3119 }
3120
3121 /// Sets the value of [retention_mode][crate::model::ObjectRetention::retention_mode].
3122 ///
3123 /// # Example
3124 /// ```ignore,no_run
3125 /// # use google_cloud_storagebatchoperations_v1::model::ObjectRetention;
3126 /// use google_cloud_storagebatchoperations_v1::model::object_retention::RetentionMode;
3127 /// let x0 = ObjectRetention::new().set_retention_mode(RetentionMode::Locked);
3128 /// let x1 = ObjectRetention::new().set_retention_mode(RetentionMode::Unlocked);
3129 /// ```
3130 pub fn set_retention_mode<T>(mut self, v: T) -> Self
3131 where
3132 T: std::convert::Into<crate::model::object_retention::RetentionMode>,
3133 {
3134 self.retention_mode = std::option::Option::Some(v.into());
3135 self
3136 }
3137
3138 /// Sets or clears the value of [retention_mode][crate::model::ObjectRetention::retention_mode].
3139 ///
3140 /// # Example
3141 /// ```ignore,no_run
3142 /// # use google_cloud_storagebatchoperations_v1::model::ObjectRetention;
3143 /// use google_cloud_storagebatchoperations_v1::model::object_retention::RetentionMode;
3144 /// let x0 = ObjectRetention::new().set_or_clear_retention_mode(Some(RetentionMode::Locked));
3145 /// let x1 = ObjectRetention::new().set_or_clear_retention_mode(Some(RetentionMode::Unlocked));
3146 /// let x_none = ObjectRetention::new().set_or_clear_retention_mode(None::<RetentionMode>);
3147 /// ```
3148 pub fn set_or_clear_retention_mode<T>(mut self, v: std::option::Option<T>) -> Self
3149 where
3150 T: std::convert::Into<crate::model::object_retention::RetentionMode>,
3151 {
3152 self.retention_mode = v.map(|x| x.into());
3153 self
3154 }
3155}
3156
3157impl wkt::message::Message for ObjectRetention {
3158 fn typename() -> &'static str {
3159 "type.googleapis.com/google.cloud.storagebatchoperations.v1.ObjectRetention"
3160 }
3161}
3162
3163/// Defines additional types related to [ObjectRetention].
3164pub mod object_retention {
3165 #[allow(unused_imports)]
3166 use super::*;
3167
3168 /// Describes the retention mode.
3169 ///
3170 /// # Working with unknown values
3171 ///
3172 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
3173 /// additional enum variants at any time. Adding new variants is not considered
3174 /// a breaking change. Applications should write their code in anticipation of:
3175 ///
3176 /// - New values appearing in future releases of the client library, **and**
3177 /// - New values received dynamically, without application changes.
3178 ///
3179 /// Please consult the [Working with enums] section in the user guide for some
3180 /// guidelines.
3181 ///
3182 /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
3183 #[derive(Clone, Debug, PartialEq)]
3184 #[non_exhaustive]
3185 pub enum RetentionMode {
3186 /// If set and retain_until_time is empty, clears the retention.
3187 Unspecified,
3188 /// Sets the retention mode to locked.
3189 Locked,
3190 /// Sets the retention mode to unlocked.
3191 Unlocked,
3192 /// If set, the enum was initialized with an unknown value.
3193 ///
3194 /// Applications can examine the value using [RetentionMode::value] or
3195 /// [RetentionMode::name].
3196 UnknownValue(retention_mode::UnknownValue),
3197 }
3198
3199 #[doc(hidden)]
3200 pub mod retention_mode {
3201 #[allow(unused_imports)]
3202 use super::*;
3203 #[derive(Clone, Debug, PartialEq)]
3204 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
3205 }
3206
3207 impl RetentionMode {
3208 /// Gets the enum value.
3209 ///
3210 /// Returns `None` if the enum contains an unknown value deserialized from
3211 /// the string representation of enums.
3212 pub fn value(&self) -> std::option::Option<i32> {
3213 match self {
3214 Self::Unspecified => std::option::Option::Some(0),
3215 Self::Locked => std::option::Option::Some(1),
3216 Self::Unlocked => std::option::Option::Some(2),
3217 Self::UnknownValue(u) => u.0.value(),
3218 }
3219 }
3220
3221 /// Gets the enum value as a string.
3222 ///
3223 /// Returns `None` if the enum contains an unknown value deserialized from
3224 /// the integer representation of enums.
3225 pub fn name(&self) -> std::option::Option<&str> {
3226 match self {
3227 Self::Unspecified => std::option::Option::Some("RETENTION_MODE_UNSPECIFIED"),
3228 Self::Locked => std::option::Option::Some("LOCKED"),
3229 Self::Unlocked => std::option::Option::Some("UNLOCKED"),
3230 Self::UnknownValue(u) => u.0.name(),
3231 }
3232 }
3233 }
3234
3235 impl std::default::Default for RetentionMode {
3236 fn default() -> Self {
3237 use std::convert::From;
3238 Self::from(0)
3239 }
3240 }
3241
3242 impl std::fmt::Display for RetentionMode {
3243 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
3244 wkt::internal::display_enum(f, self.name(), self.value())
3245 }
3246 }
3247
3248 impl std::convert::From<i32> for RetentionMode {
3249 fn from(value: i32) -> Self {
3250 match value {
3251 0 => Self::Unspecified,
3252 1 => Self::Locked,
3253 2 => Self::Unlocked,
3254 _ => Self::UnknownValue(retention_mode::UnknownValue(
3255 wkt::internal::UnknownEnumValue::Integer(value),
3256 )),
3257 }
3258 }
3259 }
3260
3261 impl std::convert::From<&str> for RetentionMode {
3262 fn from(value: &str) -> Self {
3263 use std::string::ToString;
3264 match value {
3265 "RETENTION_MODE_UNSPECIFIED" => Self::Unspecified,
3266 "LOCKED" => Self::Locked,
3267 "UNLOCKED" => Self::Unlocked,
3268 _ => Self::UnknownValue(retention_mode::UnknownValue(
3269 wkt::internal::UnknownEnumValue::String(value.to_string()),
3270 )),
3271 }
3272 }
3273 }
3274
3275 impl serde::ser::Serialize for RetentionMode {
3276 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
3277 where
3278 S: serde::Serializer,
3279 {
3280 match self {
3281 Self::Unspecified => serializer.serialize_i32(0),
3282 Self::Locked => serializer.serialize_i32(1),
3283 Self::Unlocked => serializer.serialize_i32(2),
3284 Self::UnknownValue(u) => u.0.serialize(serializer),
3285 }
3286 }
3287 }
3288
3289 impl<'de> serde::de::Deserialize<'de> for RetentionMode {
3290 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
3291 where
3292 D: serde::Deserializer<'de>,
3293 {
3294 deserializer.deserialize_any(wkt::internal::EnumVisitor::<RetentionMode>::new(
3295 ".google.cloud.storagebatchoperations.v1.ObjectRetention.RetentionMode",
3296 ))
3297 }
3298 }
3299}
3300
3301/// Describes options for object metadata update.
3302#[derive(Clone, Default, PartialEq)]
3303#[non_exhaustive]
3304pub struct PutMetadata {
3305 /// Optional. Updates objects Content-Disposition fixed metadata. Unset values
3306 /// will be ignored. Set empty values to clear the metadata. Refer
3307 /// <https://cloud.google.com/storage/docs/metadata#content-disposition> for
3308 /// additional documentation.
3309 pub content_disposition: std::option::Option<std::string::String>,
3310
3311 /// Optional. Updates objects Content-Encoding fixed metadata. Unset values
3312 /// will be ignored. Set empty values to clear the metadata. Refer to
3313 /// documentation in
3314 /// <https://cloud.google.com/storage/docs/metadata#content-encoding>.
3315 pub content_encoding: std::option::Option<std::string::String>,
3316
3317 /// Optional. Updates objects Content-Language fixed metadata. Refer to ISO
3318 /// 639-1 language codes for typical values of this metadata. Max length 100
3319 /// characters. Unset values will be ignored. Set empty values to clear the
3320 /// metadata. Refer to documentation in
3321 /// <https://cloud.google.com/storage/docs/metadata#content-language>.
3322 pub content_language: std::option::Option<std::string::String>,
3323
3324 /// Optional. Updates objects Content-Type fixed metadata. Unset values will be
3325 /// ignored. Set empty values to clear the metadata. Refer to documentation in
3326 /// <https://cloud.google.com/storage/docs/metadata#content-type>
3327 pub content_type: std::option::Option<std::string::String>,
3328
3329 /// Optional. Updates objects Cache-Control fixed metadata. Unset values will
3330 /// be ignored. Set empty values to clear the metadata. Additionally, the value
3331 /// for Custom-Time cannot decrease. Refer to documentation in
3332 /// <https://cloud.google.com/storage/docs/metadata#caching_data>.
3333 pub cache_control: std::option::Option<std::string::String>,
3334
3335 /// Optional. Updates objects Custom-Time fixed metadata. Unset values will be
3336 /// ignored. Set empty values to clear the metadata. Refer to documentation in
3337 /// <https://cloud.google.com/storage/docs/metadata#custom-time>.
3338 pub custom_time: std::option::Option<std::string::String>,
3339
3340 /// Optional. Updates objects custom metadata. Adds or sets individual custom
3341 /// metadata key value pairs on objects. Keys that are set with empty custom
3342 /// metadata values will have its value cleared. Existing custom metadata not
3343 /// specified with this flag is not changed. Refer to documentation in
3344 /// <https://cloud.google.com/storage/docs/metadata#custom-metadata>
3345 pub custom_metadata: std::collections::HashMap<std::string::String, std::string::String>,
3346
3347 /// Optional. Updates objects retention lock configuration. Unset values will
3348 /// be ignored. Set empty values to clear the retention for the object with
3349 /// existing `Unlocked` retention mode. Object with existing `Locked` retention
3350 /// mode cannot be cleared or reduce retain_until_time. Refer to documentation
3351 /// in <https://cloud.google.com/storage/docs/object-lock>
3352 pub object_retention: std::option::Option<crate::model::ObjectRetention>,
3353
3354 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3355}
3356
3357impl PutMetadata {
3358 pub fn new() -> Self {
3359 std::default::Default::default()
3360 }
3361
3362 /// Sets the value of [content_disposition][crate::model::PutMetadata::content_disposition].
3363 ///
3364 /// # Example
3365 /// ```ignore,no_run
3366 /// # use google_cloud_storagebatchoperations_v1::model::PutMetadata;
3367 /// let x = PutMetadata::new().set_content_disposition("example");
3368 /// ```
3369 pub fn set_content_disposition<T>(mut self, v: T) -> Self
3370 where
3371 T: std::convert::Into<std::string::String>,
3372 {
3373 self.content_disposition = std::option::Option::Some(v.into());
3374 self
3375 }
3376
3377 /// Sets or clears the value of [content_disposition][crate::model::PutMetadata::content_disposition].
3378 ///
3379 /// # Example
3380 /// ```ignore,no_run
3381 /// # use google_cloud_storagebatchoperations_v1::model::PutMetadata;
3382 /// let x = PutMetadata::new().set_or_clear_content_disposition(Some("example"));
3383 /// let x = PutMetadata::new().set_or_clear_content_disposition(None::<String>);
3384 /// ```
3385 pub fn set_or_clear_content_disposition<T>(mut self, v: std::option::Option<T>) -> Self
3386 where
3387 T: std::convert::Into<std::string::String>,
3388 {
3389 self.content_disposition = v.map(|x| x.into());
3390 self
3391 }
3392
3393 /// Sets the value of [content_encoding][crate::model::PutMetadata::content_encoding].
3394 ///
3395 /// # Example
3396 /// ```ignore,no_run
3397 /// # use google_cloud_storagebatchoperations_v1::model::PutMetadata;
3398 /// let x = PutMetadata::new().set_content_encoding("example");
3399 /// ```
3400 pub fn set_content_encoding<T>(mut self, v: T) -> Self
3401 where
3402 T: std::convert::Into<std::string::String>,
3403 {
3404 self.content_encoding = std::option::Option::Some(v.into());
3405 self
3406 }
3407
3408 /// Sets or clears the value of [content_encoding][crate::model::PutMetadata::content_encoding].
3409 ///
3410 /// # Example
3411 /// ```ignore,no_run
3412 /// # use google_cloud_storagebatchoperations_v1::model::PutMetadata;
3413 /// let x = PutMetadata::new().set_or_clear_content_encoding(Some("example"));
3414 /// let x = PutMetadata::new().set_or_clear_content_encoding(None::<String>);
3415 /// ```
3416 pub fn set_or_clear_content_encoding<T>(mut self, v: std::option::Option<T>) -> Self
3417 where
3418 T: std::convert::Into<std::string::String>,
3419 {
3420 self.content_encoding = v.map(|x| x.into());
3421 self
3422 }
3423
3424 /// Sets the value of [content_language][crate::model::PutMetadata::content_language].
3425 ///
3426 /// # Example
3427 /// ```ignore,no_run
3428 /// # use google_cloud_storagebatchoperations_v1::model::PutMetadata;
3429 /// let x = PutMetadata::new().set_content_language("example");
3430 /// ```
3431 pub fn set_content_language<T>(mut self, v: T) -> Self
3432 where
3433 T: std::convert::Into<std::string::String>,
3434 {
3435 self.content_language = std::option::Option::Some(v.into());
3436 self
3437 }
3438
3439 /// Sets or clears the value of [content_language][crate::model::PutMetadata::content_language].
3440 ///
3441 /// # Example
3442 /// ```ignore,no_run
3443 /// # use google_cloud_storagebatchoperations_v1::model::PutMetadata;
3444 /// let x = PutMetadata::new().set_or_clear_content_language(Some("example"));
3445 /// let x = PutMetadata::new().set_or_clear_content_language(None::<String>);
3446 /// ```
3447 pub fn set_or_clear_content_language<T>(mut self, v: std::option::Option<T>) -> Self
3448 where
3449 T: std::convert::Into<std::string::String>,
3450 {
3451 self.content_language = v.map(|x| x.into());
3452 self
3453 }
3454
3455 /// Sets the value of [content_type][crate::model::PutMetadata::content_type].
3456 ///
3457 /// # Example
3458 /// ```ignore,no_run
3459 /// # use google_cloud_storagebatchoperations_v1::model::PutMetadata;
3460 /// let x = PutMetadata::new().set_content_type("example");
3461 /// ```
3462 pub fn set_content_type<T>(mut self, v: T) -> Self
3463 where
3464 T: std::convert::Into<std::string::String>,
3465 {
3466 self.content_type = std::option::Option::Some(v.into());
3467 self
3468 }
3469
3470 /// Sets or clears the value of [content_type][crate::model::PutMetadata::content_type].
3471 ///
3472 /// # Example
3473 /// ```ignore,no_run
3474 /// # use google_cloud_storagebatchoperations_v1::model::PutMetadata;
3475 /// let x = PutMetadata::new().set_or_clear_content_type(Some("example"));
3476 /// let x = PutMetadata::new().set_or_clear_content_type(None::<String>);
3477 /// ```
3478 pub fn set_or_clear_content_type<T>(mut self, v: std::option::Option<T>) -> Self
3479 where
3480 T: std::convert::Into<std::string::String>,
3481 {
3482 self.content_type = v.map(|x| x.into());
3483 self
3484 }
3485
3486 /// Sets the value of [cache_control][crate::model::PutMetadata::cache_control].
3487 ///
3488 /// # Example
3489 /// ```ignore,no_run
3490 /// # use google_cloud_storagebatchoperations_v1::model::PutMetadata;
3491 /// let x = PutMetadata::new().set_cache_control("example");
3492 /// ```
3493 pub fn set_cache_control<T>(mut self, v: T) -> Self
3494 where
3495 T: std::convert::Into<std::string::String>,
3496 {
3497 self.cache_control = std::option::Option::Some(v.into());
3498 self
3499 }
3500
3501 /// Sets or clears the value of [cache_control][crate::model::PutMetadata::cache_control].
3502 ///
3503 /// # Example
3504 /// ```ignore,no_run
3505 /// # use google_cloud_storagebatchoperations_v1::model::PutMetadata;
3506 /// let x = PutMetadata::new().set_or_clear_cache_control(Some("example"));
3507 /// let x = PutMetadata::new().set_or_clear_cache_control(None::<String>);
3508 /// ```
3509 pub fn set_or_clear_cache_control<T>(mut self, v: std::option::Option<T>) -> Self
3510 where
3511 T: std::convert::Into<std::string::String>,
3512 {
3513 self.cache_control = v.map(|x| x.into());
3514 self
3515 }
3516
3517 /// Sets the value of [custom_time][crate::model::PutMetadata::custom_time].
3518 ///
3519 /// # Example
3520 /// ```ignore,no_run
3521 /// # use google_cloud_storagebatchoperations_v1::model::PutMetadata;
3522 /// let x = PutMetadata::new().set_custom_time("example");
3523 /// ```
3524 pub fn set_custom_time<T>(mut self, v: T) -> Self
3525 where
3526 T: std::convert::Into<std::string::String>,
3527 {
3528 self.custom_time = std::option::Option::Some(v.into());
3529 self
3530 }
3531
3532 /// Sets or clears the value of [custom_time][crate::model::PutMetadata::custom_time].
3533 ///
3534 /// # Example
3535 /// ```ignore,no_run
3536 /// # use google_cloud_storagebatchoperations_v1::model::PutMetadata;
3537 /// let x = PutMetadata::new().set_or_clear_custom_time(Some("example"));
3538 /// let x = PutMetadata::new().set_or_clear_custom_time(None::<String>);
3539 /// ```
3540 pub fn set_or_clear_custom_time<T>(mut self, v: std::option::Option<T>) -> Self
3541 where
3542 T: std::convert::Into<std::string::String>,
3543 {
3544 self.custom_time = v.map(|x| x.into());
3545 self
3546 }
3547
3548 /// Sets the value of [custom_metadata][crate::model::PutMetadata::custom_metadata].
3549 ///
3550 /// # Example
3551 /// ```ignore,no_run
3552 /// # use google_cloud_storagebatchoperations_v1::model::PutMetadata;
3553 /// let x = PutMetadata::new().set_custom_metadata([
3554 /// ("key0", "abc"),
3555 /// ("key1", "xyz"),
3556 /// ]);
3557 /// ```
3558 pub fn set_custom_metadata<T, K, V>(mut self, v: T) -> Self
3559 where
3560 T: std::iter::IntoIterator<Item = (K, V)>,
3561 K: std::convert::Into<std::string::String>,
3562 V: std::convert::Into<std::string::String>,
3563 {
3564 use std::iter::Iterator;
3565 self.custom_metadata = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
3566 self
3567 }
3568
3569 /// Sets the value of [object_retention][crate::model::PutMetadata::object_retention].
3570 ///
3571 /// # Example
3572 /// ```ignore,no_run
3573 /// # use google_cloud_storagebatchoperations_v1::model::PutMetadata;
3574 /// use google_cloud_storagebatchoperations_v1::model::ObjectRetention;
3575 /// let x = PutMetadata::new().set_object_retention(ObjectRetention::default()/* use setters */);
3576 /// ```
3577 pub fn set_object_retention<T>(mut self, v: T) -> Self
3578 where
3579 T: std::convert::Into<crate::model::ObjectRetention>,
3580 {
3581 self.object_retention = std::option::Option::Some(v.into());
3582 self
3583 }
3584
3585 /// Sets or clears the value of [object_retention][crate::model::PutMetadata::object_retention].
3586 ///
3587 /// # Example
3588 /// ```ignore,no_run
3589 /// # use google_cloud_storagebatchoperations_v1::model::PutMetadata;
3590 /// use google_cloud_storagebatchoperations_v1::model::ObjectRetention;
3591 /// let x = PutMetadata::new().set_or_clear_object_retention(Some(ObjectRetention::default()/* use setters */));
3592 /// let x = PutMetadata::new().set_or_clear_object_retention(None::<ObjectRetention>);
3593 /// ```
3594 pub fn set_or_clear_object_retention<T>(mut self, v: std::option::Option<T>) -> Self
3595 where
3596 T: std::convert::Into<crate::model::ObjectRetention>,
3597 {
3598 self.object_retention = v.map(|x| x.into());
3599 self
3600 }
3601}
3602
3603impl wkt::message::Message for PutMetadata {
3604 fn typename() -> &'static str {
3605 "type.googleapis.com/google.cloud.storagebatchoperations.v1.PutMetadata"
3606 }
3607}
3608
3609/// Describes the payload of a user defined object custom context.
3610#[derive(Clone, Default, PartialEq)]
3611#[non_exhaustive]
3612pub struct ObjectCustomContextPayload {
3613 /// The value of the object custom context.
3614 /// If set, `value` must NOT be an empty string since it is a required field in
3615 /// custom context. If unset, `value` will be ignored and no changes will be
3616 /// made to the `value` field of the custom context payload.
3617 pub value: std::option::Option<std::string::String>,
3618
3619 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3620}
3621
3622impl ObjectCustomContextPayload {
3623 pub fn new() -> Self {
3624 std::default::Default::default()
3625 }
3626
3627 /// Sets the value of [value][crate::model::ObjectCustomContextPayload::value].
3628 ///
3629 /// # Example
3630 /// ```ignore,no_run
3631 /// # use google_cloud_storagebatchoperations_v1::model::ObjectCustomContextPayload;
3632 /// let x = ObjectCustomContextPayload::new().set_value("example");
3633 /// ```
3634 pub fn set_value<T>(mut self, v: T) -> Self
3635 where
3636 T: std::convert::Into<std::string::String>,
3637 {
3638 self.value = std::option::Option::Some(v.into());
3639 self
3640 }
3641
3642 /// Sets or clears the value of [value][crate::model::ObjectCustomContextPayload::value].
3643 ///
3644 /// # Example
3645 /// ```ignore,no_run
3646 /// # use google_cloud_storagebatchoperations_v1::model::ObjectCustomContextPayload;
3647 /// let x = ObjectCustomContextPayload::new().set_or_clear_value(Some("example"));
3648 /// let x = ObjectCustomContextPayload::new().set_or_clear_value(None::<String>);
3649 /// ```
3650 pub fn set_or_clear_value<T>(mut self, v: std::option::Option<T>) -> Self
3651 where
3652 T: std::convert::Into<std::string::String>,
3653 {
3654 self.value = v.map(|x| x.into());
3655 self
3656 }
3657}
3658
3659impl wkt::message::Message for ObjectCustomContextPayload {
3660 fn typename() -> &'static str {
3661 "type.googleapis.com/google.cloud.storagebatchoperations.v1.ObjectCustomContextPayload"
3662 }
3663}
3664
3665/// Describes a collection of updates to apply to custom contexts identified
3666/// by key.
3667#[derive(Clone, Default, PartialEq)]
3668#[non_exhaustive]
3669pub struct CustomContextUpdates {
3670 /// Optional. Insert or update the existing custom contexts.
3671 pub updates:
3672 std::collections::HashMap<std::string::String, crate::model::ObjectCustomContextPayload>,
3673
3674 /// Optional. Custom contexts to clear by key.
3675 /// A key cannot be present in both `updates` and `keys_to_clear`.
3676 pub keys_to_clear: std::vec::Vec<std::string::String>,
3677
3678 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3679}
3680
3681impl CustomContextUpdates {
3682 pub fn new() -> Self {
3683 std::default::Default::default()
3684 }
3685
3686 /// Sets the value of [updates][crate::model::CustomContextUpdates::updates].
3687 ///
3688 /// # Example
3689 /// ```ignore,no_run
3690 /// # use google_cloud_storagebatchoperations_v1::model::CustomContextUpdates;
3691 /// use google_cloud_storagebatchoperations_v1::model::ObjectCustomContextPayload;
3692 /// let x = CustomContextUpdates::new().set_updates([
3693 /// ("key0", ObjectCustomContextPayload::default()/* use setters */),
3694 /// ("key1", ObjectCustomContextPayload::default()/* use (different) setters */),
3695 /// ]);
3696 /// ```
3697 pub fn set_updates<T, K, V>(mut self, v: T) -> Self
3698 where
3699 T: std::iter::IntoIterator<Item = (K, V)>,
3700 K: std::convert::Into<std::string::String>,
3701 V: std::convert::Into<crate::model::ObjectCustomContextPayload>,
3702 {
3703 use std::iter::Iterator;
3704 self.updates = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
3705 self
3706 }
3707
3708 /// Sets the value of [keys_to_clear][crate::model::CustomContextUpdates::keys_to_clear].
3709 ///
3710 /// # Example
3711 /// ```ignore,no_run
3712 /// # use google_cloud_storagebatchoperations_v1::model::CustomContextUpdates;
3713 /// let x = CustomContextUpdates::new().set_keys_to_clear(["a", "b", "c"]);
3714 /// ```
3715 pub fn set_keys_to_clear<T, V>(mut self, v: T) -> Self
3716 where
3717 T: std::iter::IntoIterator<Item = V>,
3718 V: std::convert::Into<std::string::String>,
3719 {
3720 use std::iter::Iterator;
3721 self.keys_to_clear = v.into_iter().map(|i| i.into()).collect();
3722 self
3723 }
3724}
3725
3726impl wkt::message::Message for CustomContextUpdates {
3727 fn typename() -> &'static str {
3728 "type.googleapis.com/google.cloud.storagebatchoperations.v1.CustomContextUpdates"
3729 }
3730}
3731
3732/// Describes options to update object custom contexts.
3733#[derive(Clone, Default, PartialEq)]
3734#[non_exhaustive]
3735pub struct UpdateObjectCustomContext {
3736 /// One of the actions must be set.
3737 pub action: std::option::Option<crate::model::update_object_custom_context::Action>,
3738
3739 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3740}
3741
3742impl UpdateObjectCustomContext {
3743 pub fn new() -> Self {
3744 std::default::Default::default()
3745 }
3746
3747 /// Sets the value of [action][crate::model::UpdateObjectCustomContext::action].
3748 ///
3749 /// Note that all the setters affecting `action` are mutually
3750 /// exclusive.
3751 ///
3752 /// # Example
3753 /// ```ignore,no_run
3754 /// # use google_cloud_storagebatchoperations_v1::model::UpdateObjectCustomContext;
3755 /// use google_cloud_storagebatchoperations_v1::model::update_object_custom_context::Action;
3756 /// let x = UpdateObjectCustomContext::new().set_action(Some(Action::ClearAll(true)));
3757 /// ```
3758 pub fn set_action<
3759 T: std::convert::Into<std::option::Option<crate::model::update_object_custom_context::Action>>,
3760 >(
3761 mut self,
3762 v: T,
3763 ) -> Self {
3764 self.action = v.into();
3765 self
3766 }
3767
3768 /// The value of [action][crate::model::UpdateObjectCustomContext::action]
3769 /// if it holds a `CustomContextUpdates`, `None` if the field is not set or
3770 /// holds a different branch.
3771 pub fn custom_context_updates(
3772 &self,
3773 ) -> std::option::Option<&std::boxed::Box<crate::model::CustomContextUpdates>> {
3774 #[allow(unreachable_patterns)]
3775 self.action.as_ref().and_then(|v| match v {
3776 crate::model::update_object_custom_context::Action::CustomContextUpdates(v) => {
3777 std::option::Option::Some(v)
3778 }
3779 _ => std::option::Option::None,
3780 })
3781 }
3782
3783 /// Sets the value of [action][crate::model::UpdateObjectCustomContext::action]
3784 /// to hold a `CustomContextUpdates`.
3785 ///
3786 /// Note that all the setters affecting `action` are
3787 /// mutually exclusive.
3788 ///
3789 /// # Example
3790 /// ```ignore,no_run
3791 /// # use google_cloud_storagebatchoperations_v1::model::UpdateObjectCustomContext;
3792 /// use google_cloud_storagebatchoperations_v1::model::CustomContextUpdates;
3793 /// let x = UpdateObjectCustomContext::new().set_custom_context_updates(CustomContextUpdates::default()/* use setters */);
3794 /// assert!(x.custom_context_updates().is_some());
3795 /// assert!(x.clear_all().is_none());
3796 /// ```
3797 pub fn set_custom_context_updates<
3798 T: std::convert::Into<std::boxed::Box<crate::model::CustomContextUpdates>>,
3799 >(
3800 mut self,
3801 v: T,
3802 ) -> Self {
3803 self.action = std::option::Option::Some(
3804 crate::model::update_object_custom_context::Action::CustomContextUpdates(v.into()),
3805 );
3806 self
3807 }
3808
3809 /// The value of [action][crate::model::UpdateObjectCustomContext::action]
3810 /// if it holds a `ClearAll`, `None` if the field is not set or
3811 /// holds a different branch.
3812 pub fn clear_all(&self) -> std::option::Option<&bool> {
3813 #[allow(unreachable_patterns)]
3814 self.action.as_ref().and_then(|v| match v {
3815 crate::model::update_object_custom_context::Action::ClearAll(v) => {
3816 std::option::Option::Some(v)
3817 }
3818 _ => std::option::Option::None,
3819 })
3820 }
3821
3822 /// Sets the value of [action][crate::model::UpdateObjectCustomContext::action]
3823 /// to hold a `ClearAll`.
3824 ///
3825 /// Note that all the setters affecting `action` are
3826 /// mutually exclusive.
3827 ///
3828 /// # Example
3829 /// ```ignore,no_run
3830 /// # use google_cloud_storagebatchoperations_v1::model::UpdateObjectCustomContext;
3831 /// let x = UpdateObjectCustomContext::new().set_clear_all(true);
3832 /// assert!(x.clear_all().is_some());
3833 /// assert!(x.custom_context_updates().is_none());
3834 /// ```
3835 pub fn set_clear_all<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
3836 self.action = std::option::Option::Some(
3837 crate::model::update_object_custom_context::Action::ClearAll(v.into()),
3838 );
3839 self
3840 }
3841}
3842
3843impl wkt::message::Message for UpdateObjectCustomContext {
3844 fn typename() -> &'static str {
3845 "type.googleapis.com/google.cloud.storagebatchoperations.v1.UpdateObjectCustomContext"
3846 }
3847}
3848
3849/// Defines additional types related to [UpdateObjectCustomContext].
3850pub mod update_object_custom_context {
3851 #[allow(unused_imports)]
3852 use super::*;
3853
3854 /// One of the actions must be set.
3855 #[derive(Clone, Debug, PartialEq)]
3856 #[non_exhaustive]
3857 pub enum Action {
3858 /// A collection of updates to apply to specific custom contexts.
3859 /// Use this to add, update or delete individual contexts by key.
3860 CustomContextUpdates(std::boxed::Box<crate::model::CustomContextUpdates>),
3861 /// If set, must be set to true and all existing object custom contexts will
3862 /// be deleted.
3863 ClearAll(bool),
3864 }
3865}
3866
3867/// A summary of errors by error code, plus a count and sample error log
3868/// entries.
3869#[derive(Clone, Default, PartialEq)]
3870#[non_exhaustive]
3871pub struct ErrorSummary {
3872 /// Required. The canonical error code.
3873 pub error_code: google_cloud_rpc::model::Code,
3874
3875 /// Required. Number of errors encountered per `error_code`.
3876 pub error_count: i64,
3877
3878 /// Required. Sample error logs.
3879 pub error_log_entries: std::vec::Vec<crate::model::ErrorLogEntry>,
3880
3881 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3882}
3883
3884impl ErrorSummary {
3885 pub fn new() -> Self {
3886 std::default::Default::default()
3887 }
3888
3889 /// Sets the value of [error_code][crate::model::ErrorSummary::error_code].
3890 ///
3891 /// # Example
3892 /// ```ignore,no_run
3893 /// # use google_cloud_storagebatchoperations_v1::model::ErrorSummary;
3894 /// use google_cloud_rpc::model::Code;
3895 /// let x0 = ErrorSummary::new().set_error_code(Code::Cancelled);
3896 /// let x1 = ErrorSummary::new().set_error_code(Code::Unknown);
3897 /// let x2 = ErrorSummary::new().set_error_code(Code::InvalidArgument);
3898 /// ```
3899 pub fn set_error_code<T: std::convert::Into<google_cloud_rpc::model::Code>>(
3900 mut self,
3901 v: T,
3902 ) -> Self {
3903 self.error_code = v.into();
3904 self
3905 }
3906
3907 /// Sets the value of [error_count][crate::model::ErrorSummary::error_count].
3908 ///
3909 /// # Example
3910 /// ```ignore,no_run
3911 /// # use google_cloud_storagebatchoperations_v1::model::ErrorSummary;
3912 /// let x = ErrorSummary::new().set_error_count(42);
3913 /// ```
3914 pub fn set_error_count<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
3915 self.error_count = v.into();
3916 self
3917 }
3918
3919 /// Sets the value of [error_log_entries][crate::model::ErrorSummary::error_log_entries].
3920 ///
3921 /// # Example
3922 /// ```ignore,no_run
3923 /// # use google_cloud_storagebatchoperations_v1::model::ErrorSummary;
3924 /// use google_cloud_storagebatchoperations_v1::model::ErrorLogEntry;
3925 /// let x = ErrorSummary::new()
3926 /// .set_error_log_entries([
3927 /// ErrorLogEntry::default()/* use setters */,
3928 /// ErrorLogEntry::default()/* use (different) setters */,
3929 /// ]);
3930 /// ```
3931 pub fn set_error_log_entries<T, V>(mut self, v: T) -> Self
3932 where
3933 T: std::iter::IntoIterator<Item = V>,
3934 V: std::convert::Into<crate::model::ErrorLogEntry>,
3935 {
3936 use std::iter::Iterator;
3937 self.error_log_entries = v.into_iter().map(|i| i.into()).collect();
3938 self
3939 }
3940}
3941
3942impl wkt::message::Message for ErrorSummary {
3943 fn typename() -> &'static str {
3944 "type.googleapis.com/google.cloud.storagebatchoperations.v1.ErrorSummary"
3945 }
3946}
3947
3948/// An entry describing an error that has occurred.
3949#[derive(Clone, Default, PartialEq)]
3950#[non_exhaustive]
3951pub struct ErrorLogEntry {
3952 /// Required. Output only. Object URL. e.g. gs://my_bucket/object.txt
3953 pub object_uri: std::string::String,
3954
3955 /// Optional. Output only. At most 5 error log entries are recorded for a given
3956 /// error code for a job.
3957 pub error_details: std::vec::Vec<std::string::String>,
3958
3959 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3960}
3961
3962impl ErrorLogEntry {
3963 pub fn new() -> Self {
3964 std::default::Default::default()
3965 }
3966
3967 /// Sets the value of [object_uri][crate::model::ErrorLogEntry::object_uri].
3968 ///
3969 /// # Example
3970 /// ```ignore,no_run
3971 /// # use google_cloud_storagebatchoperations_v1::model::ErrorLogEntry;
3972 /// let x = ErrorLogEntry::new().set_object_uri("example");
3973 /// ```
3974 pub fn set_object_uri<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3975 self.object_uri = v.into();
3976 self
3977 }
3978
3979 /// Sets the value of [error_details][crate::model::ErrorLogEntry::error_details].
3980 ///
3981 /// # Example
3982 /// ```ignore,no_run
3983 /// # use google_cloud_storagebatchoperations_v1::model::ErrorLogEntry;
3984 /// let x = ErrorLogEntry::new().set_error_details(["a", "b", "c"]);
3985 /// ```
3986 pub fn set_error_details<T, V>(mut self, v: T) -> Self
3987 where
3988 T: std::iter::IntoIterator<Item = V>,
3989 V: std::convert::Into<std::string::String>,
3990 {
3991 use std::iter::Iterator;
3992 self.error_details = v.into_iter().map(|i| i.into()).collect();
3993 self
3994 }
3995}
3996
3997impl wkt::message::Message for ErrorLogEntry {
3998 fn typename() -> &'static str {
3999 "type.googleapis.com/google.cloud.storagebatchoperations.v1.ErrorLogEntry"
4000 }
4001}
4002
4003/// Describes details about the progress of the job.
4004#[derive(Clone, Default, PartialEq)]
4005#[non_exhaustive]
4006pub struct Counters {
4007 /// Output only. Number of objects listed.
4008 pub total_object_count: i64,
4009
4010 /// Output only. Number of objects completed.
4011 pub succeeded_object_count: i64,
4012
4013 /// Output only. Number of objects failed.
4014 pub failed_object_count: i64,
4015
4016 /// Output only. Number of bytes found from source. This field is only
4017 /// populated for jobs with a prefix list object configuration.
4018 pub total_bytes_found: std::option::Option<i64>,
4019
4020 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4021}
4022
4023impl Counters {
4024 pub fn new() -> Self {
4025 std::default::Default::default()
4026 }
4027
4028 /// Sets the value of [total_object_count][crate::model::Counters::total_object_count].
4029 ///
4030 /// # Example
4031 /// ```ignore,no_run
4032 /// # use google_cloud_storagebatchoperations_v1::model::Counters;
4033 /// let x = Counters::new().set_total_object_count(42);
4034 /// ```
4035 pub fn set_total_object_count<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
4036 self.total_object_count = v.into();
4037 self
4038 }
4039
4040 /// Sets the value of [succeeded_object_count][crate::model::Counters::succeeded_object_count].
4041 ///
4042 /// # Example
4043 /// ```ignore,no_run
4044 /// # use google_cloud_storagebatchoperations_v1::model::Counters;
4045 /// let x = Counters::new().set_succeeded_object_count(42);
4046 /// ```
4047 pub fn set_succeeded_object_count<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
4048 self.succeeded_object_count = v.into();
4049 self
4050 }
4051
4052 /// Sets the value of [failed_object_count][crate::model::Counters::failed_object_count].
4053 ///
4054 /// # Example
4055 /// ```ignore,no_run
4056 /// # use google_cloud_storagebatchoperations_v1::model::Counters;
4057 /// let x = Counters::new().set_failed_object_count(42);
4058 /// ```
4059 pub fn set_failed_object_count<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
4060 self.failed_object_count = v.into();
4061 self
4062 }
4063
4064 /// Sets the value of [total_bytes_found][crate::model::Counters::total_bytes_found].
4065 ///
4066 /// # Example
4067 /// ```ignore,no_run
4068 /// # use google_cloud_storagebatchoperations_v1::model::Counters;
4069 /// let x = Counters::new().set_total_bytes_found(42);
4070 /// ```
4071 pub fn set_total_bytes_found<T>(mut self, v: T) -> Self
4072 where
4073 T: std::convert::Into<i64>,
4074 {
4075 self.total_bytes_found = std::option::Option::Some(v.into());
4076 self
4077 }
4078
4079 /// Sets or clears the value of [total_bytes_found][crate::model::Counters::total_bytes_found].
4080 ///
4081 /// # Example
4082 /// ```ignore,no_run
4083 /// # use google_cloud_storagebatchoperations_v1::model::Counters;
4084 /// let x = Counters::new().set_or_clear_total_bytes_found(Some(42));
4085 /// let x = Counters::new().set_or_clear_total_bytes_found(None::<i32>);
4086 /// ```
4087 pub fn set_or_clear_total_bytes_found<T>(mut self, v: std::option::Option<T>) -> Self
4088 where
4089 T: std::convert::Into<i64>,
4090 {
4091 self.total_bytes_found = v.map(|x| x.into());
4092 self
4093 }
4094}
4095
4096impl wkt::message::Message for Counters {
4097 fn typename() -> &'static str {
4098 "type.googleapis.com/google.cloud.storagebatchoperations.v1.Counters"
4099 }
4100}
4101
4102/// Specifies the Cloud Logging behavior.
4103#[derive(Clone, Default, PartialEq)]
4104#[non_exhaustive]
4105pub struct LoggingConfig {
4106 /// Required. Specifies the actions to be logged.
4107 pub log_actions: std::vec::Vec<crate::model::logging_config::LoggableAction>,
4108
4109 /// Required. States in which Action are logged.If empty, no logs are
4110 /// generated.
4111 pub log_action_states: std::vec::Vec<crate::model::logging_config::LoggableActionState>,
4112
4113 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4114}
4115
4116impl LoggingConfig {
4117 pub fn new() -> Self {
4118 std::default::Default::default()
4119 }
4120
4121 /// Sets the value of [log_actions][crate::model::LoggingConfig::log_actions].
4122 ///
4123 /// # Example
4124 /// ```ignore,no_run
4125 /// # use google_cloud_storagebatchoperations_v1::model::LoggingConfig;
4126 /// use google_cloud_storagebatchoperations_v1::model::logging_config::LoggableAction;
4127 /// let x = LoggingConfig::new().set_log_actions([
4128 /// LoggableAction::Transform,
4129 /// ]);
4130 /// ```
4131 pub fn set_log_actions<T, V>(mut self, v: T) -> Self
4132 where
4133 T: std::iter::IntoIterator<Item = V>,
4134 V: std::convert::Into<crate::model::logging_config::LoggableAction>,
4135 {
4136 use std::iter::Iterator;
4137 self.log_actions = v.into_iter().map(|i| i.into()).collect();
4138 self
4139 }
4140
4141 /// Sets the value of [log_action_states][crate::model::LoggingConfig::log_action_states].
4142 ///
4143 /// # Example
4144 /// ```ignore,no_run
4145 /// # use google_cloud_storagebatchoperations_v1::model::LoggingConfig;
4146 /// use google_cloud_storagebatchoperations_v1::model::logging_config::LoggableActionState;
4147 /// let x = LoggingConfig::new().set_log_action_states([
4148 /// LoggableActionState::Succeeded,
4149 /// LoggableActionState::Failed,
4150 /// ]);
4151 /// ```
4152 pub fn set_log_action_states<T, V>(mut self, v: T) -> Self
4153 where
4154 T: std::iter::IntoIterator<Item = V>,
4155 V: std::convert::Into<crate::model::logging_config::LoggableActionState>,
4156 {
4157 use std::iter::Iterator;
4158 self.log_action_states = v.into_iter().map(|i| i.into()).collect();
4159 self
4160 }
4161}
4162
4163impl wkt::message::Message for LoggingConfig {
4164 fn typename() -> &'static str {
4165 "type.googleapis.com/google.cloud.storagebatchoperations.v1.LoggingConfig"
4166 }
4167}
4168
4169/// Defines additional types related to [LoggingConfig].
4170pub mod logging_config {
4171 #[allow(unused_imports)]
4172 use super::*;
4173
4174 /// Loggable actions types.
4175 ///
4176 /// # Working with unknown values
4177 ///
4178 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
4179 /// additional enum variants at any time. Adding new variants is not considered
4180 /// a breaking change. Applications should write their code in anticipation of:
4181 ///
4182 /// - New values appearing in future releases of the client library, **and**
4183 /// - New values received dynamically, without application changes.
4184 ///
4185 /// Please consult the [Working with enums] section in the user guide for some
4186 /// guidelines.
4187 ///
4188 /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
4189 #[derive(Clone, Debug, PartialEq)]
4190 #[non_exhaustive]
4191 pub enum LoggableAction {
4192 /// Illegal value, to avoid allowing a default.
4193 Unspecified,
4194 /// The corresponding transform action in this job.
4195 Transform,
4196 /// If set, the enum was initialized with an unknown value.
4197 ///
4198 /// Applications can examine the value using [LoggableAction::value] or
4199 /// [LoggableAction::name].
4200 UnknownValue(loggable_action::UnknownValue),
4201 }
4202
4203 #[doc(hidden)]
4204 pub mod loggable_action {
4205 #[allow(unused_imports)]
4206 use super::*;
4207 #[derive(Clone, Debug, PartialEq)]
4208 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
4209 }
4210
4211 impl LoggableAction {
4212 /// Gets the enum value.
4213 ///
4214 /// Returns `None` if the enum contains an unknown value deserialized from
4215 /// the string representation of enums.
4216 pub fn value(&self) -> std::option::Option<i32> {
4217 match self {
4218 Self::Unspecified => std::option::Option::Some(0),
4219 Self::Transform => std::option::Option::Some(6),
4220 Self::UnknownValue(u) => u.0.value(),
4221 }
4222 }
4223
4224 /// Gets the enum value as a string.
4225 ///
4226 /// Returns `None` if the enum contains an unknown value deserialized from
4227 /// the integer representation of enums.
4228 pub fn name(&self) -> std::option::Option<&str> {
4229 match self {
4230 Self::Unspecified => std::option::Option::Some("LOGGABLE_ACTION_UNSPECIFIED"),
4231 Self::Transform => std::option::Option::Some("TRANSFORM"),
4232 Self::UnknownValue(u) => u.0.name(),
4233 }
4234 }
4235 }
4236
4237 impl std::default::Default for LoggableAction {
4238 fn default() -> Self {
4239 use std::convert::From;
4240 Self::from(0)
4241 }
4242 }
4243
4244 impl std::fmt::Display for LoggableAction {
4245 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
4246 wkt::internal::display_enum(f, self.name(), self.value())
4247 }
4248 }
4249
4250 impl std::convert::From<i32> for LoggableAction {
4251 fn from(value: i32) -> Self {
4252 match value {
4253 0 => Self::Unspecified,
4254 6 => Self::Transform,
4255 _ => Self::UnknownValue(loggable_action::UnknownValue(
4256 wkt::internal::UnknownEnumValue::Integer(value),
4257 )),
4258 }
4259 }
4260 }
4261
4262 impl std::convert::From<&str> for LoggableAction {
4263 fn from(value: &str) -> Self {
4264 use std::string::ToString;
4265 match value {
4266 "LOGGABLE_ACTION_UNSPECIFIED" => Self::Unspecified,
4267 "TRANSFORM" => Self::Transform,
4268 _ => Self::UnknownValue(loggable_action::UnknownValue(
4269 wkt::internal::UnknownEnumValue::String(value.to_string()),
4270 )),
4271 }
4272 }
4273 }
4274
4275 impl serde::ser::Serialize for LoggableAction {
4276 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
4277 where
4278 S: serde::Serializer,
4279 {
4280 match self {
4281 Self::Unspecified => serializer.serialize_i32(0),
4282 Self::Transform => serializer.serialize_i32(6),
4283 Self::UnknownValue(u) => u.0.serialize(serializer),
4284 }
4285 }
4286 }
4287
4288 impl<'de> serde::de::Deserialize<'de> for LoggableAction {
4289 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
4290 where
4291 D: serde::Deserializer<'de>,
4292 {
4293 deserializer.deserialize_any(wkt::internal::EnumVisitor::<LoggableAction>::new(
4294 ".google.cloud.storagebatchoperations.v1.LoggingConfig.LoggableAction",
4295 ))
4296 }
4297 }
4298
4299 /// Loggable action states filter.
4300 ///
4301 /// # Working with unknown values
4302 ///
4303 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
4304 /// additional enum variants at any time. Adding new variants is not considered
4305 /// a breaking change. Applications should write their code in anticipation of:
4306 ///
4307 /// - New values appearing in future releases of the client library, **and**
4308 /// - New values received dynamically, without application changes.
4309 ///
4310 /// Please consult the [Working with enums] section in the user guide for some
4311 /// guidelines.
4312 ///
4313 /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
4314 #[derive(Clone, Debug, PartialEq)]
4315 #[non_exhaustive]
4316 pub enum LoggableActionState {
4317 /// Illegal value, to avoid allowing a default.
4318 Unspecified,
4319 /// `LoggableAction` completed successfully. `SUCCEEDED` actions are
4320 /// logged as [INFO][google.logging.type.LogSeverity.INFO].
4321 Succeeded,
4322 /// `LoggableAction` terminated in an error state. `FAILED` actions
4323 /// are logged as [ERROR][google.logging.type.LogSeverity.ERROR].
4324 Failed,
4325 /// If set, the enum was initialized with an unknown value.
4326 ///
4327 /// Applications can examine the value using [LoggableActionState::value] or
4328 /// [LoggableActionState::name].
4329 UnknownValue(loggable_action_state::UnknownValue),
4330 }
4331
4332 #[doc(hidden)]
4333 pub mod loggable_action_state {
4334 #[allow(unused_imports)]
4335 use super::*;
4336 #[derive(Clone, Debug, PartialEq)]
4337 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
4338 }
4339
4340 impl LoggableActionState {
4341 /// Gets the enum value.
4342 ///
4343 /// Returns `None` if the enum contains an unknown value deserialized from
4344 /// the string representation of enums.
4345 pub fn value(&self) -> std::option::Option<i32> {
4346 match self {
4347 Self::Unspecified => std::option::Option::Some(0),
4348 Self::Succeeded => std::option::Option::Some(1),
4349 Self::Failed => std::option::Option::Some(2),
4350 Self::UnknownValue(u) => u.0.value(),
4351 }
4352 }
4353
4354 /// Gets the enum value as a string.
4355 ///
4356 /// Returns `None` if the enum contains an unknown value deserialized from
4357 /// the integer representation of enums.
4358 pub fn name(&self) -> std::option::Option<&str> {
4359 match self {
4360 Self::Unspecified => std::option::Option::Some("LOGGABLE_ACTION_STATE_UNSPECIFIED"),
4361 Self::Succeeded => std::option::Option::Some("SUCCEEDED"),
4362 Self::Failed => std::option::Option::Some("FAILED"),
4363 Self::UnknownValue(u) => u.0.name(),
4364 }
4365 }
4366 }
4367
4368 impl std::default::Default for LoggableActionState {
4369 fn default() -> Self {
4370 use std::convert::From;
4371 Self::from(0)
4372 }
4373 }
4374
4375 impl std::fmt::Display for LoggableActionState {
4376 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
4377 wkt::internal::display_enum(f, self.name(), self.value())
4378 }
4379 }
4380
4381 impl std::convert::From<i32> for LoggableActionState {
4382 fn from(value: i32) -> Self {
4383 match value {
4384 0 => Self::Unspecified,
4385 1 => Self::Succeeded,
4386 2 => Self::Failed,
4387 _ => Self::UnknownValue(loggable_action_state::UnknownValue(
4388 wkt::internal::UnknownEnumValue::Integer(value),
4389 )),
4390 }
4391 }
4392 }
4393
4394 impl std::convert::From<&str> for LoggableActionState {
4395 fn from(value: &str) -> Self {
4396 use std::string::ToString;
4397 match value {
4398 "LOGGABLE_ACTION_STATE_UNSPECIFIED" => Self::Unspecified,
4399 "SUCCEEDED" => Self::Succeeded,
4400 "FAILED" => Self::Failed,
4401 _ => Self::UnknownValue(loggable_action_state::UnknownValue(
4402 wkt::internal::UnknownEnumValue::String(value.to_string()),
4403 )),
4404 }
4405 }
4406 }
4407
4408 impl serde::ser::Serialize for LoggableActionState {
4409 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
4410 where
4411 S: serde::Serializer,
4412 {
4413 match self {
4414 Self::Unspecified => serializer.serialize_i32(0),
4415 Self::Succeeded => serializer.serialize_i32(1),
4416 Self::Failed => serializer.serialize_i32(2),
4417 Self::UnknownValue(u) => u.0.serialize(serializer),
4418 }
4419 }
4420 }
4421
4422 impl<'de> serde::de::Deserialize<'de> for LoggableActionState {
4423 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
4424 where
4425 D: serde::Deserializer<'de>,
4426 {
4427 deserializer.deserialize_any(wkt::internal::EnumVisitor::<LoggableActionState>::new(
4428 ".google.cloud.storagebatchoperations.v1.LoggingConfig.LoggableActionState",
4429 ))
4430 }
4431 }
4432}