Skip to main content

google_cloud_storagebatchoperations_v1/
model.rs

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