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