Skip to main content

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