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