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 gax;
23extern crate gaxi;
24extern crate lazy_static;
25extern crate location;
26extern crate longrunning;
27extern crate lro;
28extern crate reqwest;
29extern crate rpc;
30extern crate serde;
31extern crate serde_json;
32extern crate serde_with;
33extern crate std;
34extern crate tracing;
35extern crate wkt;
36
37mod debug;
38mod deserialize;
39mod serialize;
40
41/// Message for request to list Jobs
42#[derive(Clone, Default, PartialEq)]
43#[non_exhaustive]
44pub struct ListJobsRequest {
45    /// Required. Format: projects/{project_id}/locations/global.
46    pub parent: std::string::String,
47
48    /// Optional. Filters results as defined by <https://google.aip.dev/160>.
49    pub filter: std::string::String,
50
51    /// Optional. The list page size. default page size is 100.
52    pub page_size: i32,
53
54    /// Optional. The list page token.
55    pub page_token: std::string::String,
56
57    /// Optional. Field to sort by. Supported fields are name, create_time.
58    pub order_by: std::string::String,
59
60    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
61}
62
63impl ListJobsRequest {
64    pub fn new() -> Self {
65        std::default::Default::default()
66    }
67
68    /// Sets the value of [parent][crate::model::ListJobsRequest::parent].
69    ///
70    /// # Example
71    /// ```ignore,no_run
72    /// # use google_cloud_storagebatchoperations_v1::model::ListJobsRequest;
73    /// let x = ListJobsRequest::new().set_parent("example");
74    /// ```
75    pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
76        self.parent = v.into();
77        self
78    }
79
80    /// Sets the value of [filter][crate::model::ListJobsRequest::filter].
81    ///
82    /// # Example
83    /// ```ignore,no_run
84    /// # use google_cloud_storagebatchoperations_v1::model::ListJobsRequest;
85    /// let x = ListJobsRequest::new().set_filter("example");
86    /// ```
87    pub fn set_filter<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
88        self.filter = v.into();
89        self
90    }
91
92    /// Sets the value of [page_size][crate::model::ListJobsRequest::page_size].
93    ///
94    /// # Example
95    /// ```ignore,no_run
96    /// # use google_cloud_storagebatchoperations_v1::model::ListJobsRequest;
97    /// let x = ListJobsRequest::new().set_page_size(42);
98    /// ```
99    pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
100        self.page_size = v.into();
101        self
102    }
103
104    /// Sets the value of [page_token][crate::model::ListJobsRequest::page_token].
105    ///
106    /// # Example
107    /// ```ignore,no_run
108    /// # use google_cloud_storagebatchoperations_v1::model::ListJobsRequest;
109    /// let x = ListJobsRequest::new().set_page_token("example");
110    /// ```
111    pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
112        self.page_token = v.into();
113        self
114    }
115
116    /// Sets the value of [order_by][crate::model::ListJobsRequest::order_by].
117    ///
118    /// # Example
119    /// ```ignore,no_run
120    /// # use google_cloud_storagebatchoperations_v1::model::ListJobsRequest;
121    /// let x = ListJobsRequest::new().set_order_by("example");
122    /// ```
123    pub fn set_order_by<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
124        self.order_by = v.into();
125        self
126    }
127}
128
129impl wkt::message::Message for ListJobsRequest {
130    fn typename() -> &'static str {
131        "type.googleapis.com/google.cloud.storagebatchoperations.v1.ListJobsRequest"
132    }
133}
134
135/// Message for response to listing Jobs
136#[derive(Clone, Default, PartialEq)]
137#[non_exhaustive]
138pub struct ListJobsResponse {
139    /// A list of storage batch jobs.
140    pub jobs: std::vec::Vec<crate::model::Job>,
141
142    /// A token identifying a page of results.
143    pub next_page_token: std::string::String,
144
145    /// Locations that could not be reached.
146    pub unreachable: std::vec::Vec<std::string::String>,
147
148    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
149}
150
151impl ListJobsResponse {
152    pub fn new() -> Self {
153        std::default::Default::default()
154    }
155
156    /// Sets the value of [jobs][crate::model::ListJobsResponse::jobs].
157    ///
158    /// # Example
159    /// ```ignore,no_run
160    /// # use google_cloud_storagebatchoperations_v1::model::ListJobsResponse;
161    /// use google_cloud_storagebatchoperations_v1::model::Job;
162    /// let x = ListJobsResponse::new()
163    ///     .set_jobs([
164    ///         Job::default()/* use setters */,
165    ///         Job::default()/* use (different) setters */,
166    ///     ]);
167    /// ```
168    pub fn set_jobs<T, V>(mut self, v: T) -> Self
169    where
170        T: std::iter::IntoIterator<Item = V>,
171        V: std::convert::Into<crate::model::Job>,
172    {
173        use std::iter::Iterator;
174        self.jobs = v.into_iter().map(|i| i.into()).collect();
175        self
176    }
177
178    /// Sets the value of [next_page_token][crate::model::ListJobsResponse::next_page_token].
179    ///
180    /// # Example
181    /// ```ignore,no_run
182    /// # use google_cloud_storagebatchoperations_v1::model::ListJobsResponse;
183    /// let x = ListJobsResponse::new().set_next_page_token("example");
184    /// ```
185    pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
186        self.next_page_token = v.into();
187        self
188    }
189
190    /// Sets the value of [unreachable][crate::model::ListJobsResponse::unreachable].
191    ///
192    /// # Example
193    /// ```ignore,no_run
194    /// # use google_cloud_storagebatchoperations_v1::model::ListJobsResponse;
195    /// let x = ListJobsResponse::new().set_unreachable(["a", "b", "c"]);
196    /// ```
197    pub fn set_unreachable<T, V>(mut self, v: T) -> Self
198    where
199        T: std::iter::IntoIterator<Item = V>,
200        V: std::convert::Into<std::string::String>,
201    {
202        use std::iter::Iterator;
203        self.unreachable = v.into_iter().map(|i| i.into()).collect();
204        self
205    }
206}
207
208impl wkt::message::Message for ListJobsResponse {
209    fn typename() -> &'static str {
210        "type.googleapis.com/google.cloud.storagebatchoperations.v1.ListJobsResponse"
211    }
212}
213
214#[doc(hidden)]
215impl gax::paginator::internal::PageableResponse for ListJobsResponse {
216    type PageItem = crate::model::Job;
217
218    fn items(self) -> std::vec::Vec<Self::PageItem> {
219        self.jobs
220    }
221
222    fn next_page_token(&self) -> std::string::String {
223        use std::clone::Clone;
224        self.next_page_token.clone()
225    }
226}
227
228/// Message for getting a Job
229#[derive(Clone, Default, PartialEq)]
230#[non_exhaustive]
231pub struct GetJobRequest {
232    /// Required. `name` of the job to retrieve.
233    /// Format: projects/{project_id}/locations/global/jobs/{job_id} .
234    pub name: std::string::String,
235
236    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
237}
238
239impl GetJobRequest {
240    pub fn new() -> Self {
241        std::default::Default::default()
242    }
243
244    /// Sets the value of [name][crate::model::GetJobRequest::name].
245    ///
246    /// # Example
247    /// ```ignore,no_run
248    /// # use google_cloud_storagebatchoperations_v1::model::GetJobRequest;
249    /// let x = GetJobRequest::new().set_name("example");
250    /// ```
251    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
252        self.name = v.into();
253        self
254    }
255}
256
257impl wkt::message::Message for GetJobRequest {
258    fn typename() -> &'static str {
259        "type.googleapis.com/google.cloud.storagebatchoperations.v1.GetJobRequest"
260    }
261}
262
263/// Message for creating a Job
264#[derive(Clone, Default, PartialEq)]
265#[non_exhaustive]
266pub struct CreateJobRequest {
267    /// Required. Value for parent.
268    pub parent: std::string::String,
269
270    /// Required. The optional `job_id` for this Job . If not
271    /// specified, an id is generated. `job_id` should be no more than 128
272    /// characters and must include only characters available in DNS names, as
273    /// defined by RFC-1123.
274    pub job_id: std::string::String,
275
276    /// Required. The resource being created
277    pub job: std::option::Option<crate::model::Job>,
278
279    /// Optional. An optional request ID to identify requests. Specify a unique
280    /// request ID in case you need to retry your request. Requests with same
281    /// `request_id` will be ignored for at least 60 minutes since the first
282    /// request. The request ID must be a valid UUID with the exception that zero
283    /// UUID is not supported (00000000-0000-0000-0000-000000000000).
284    pub request_id: std::string::String,
285
286    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
287}
288
289impl CreateJobRequest {
290    pub fn new() -> Self {
291        std::default::Default::default()
292    }
293
294    /// Sets the value of [parent][crate::model::CreateJobRequest::parent].
295    ///
296    /// # Example
297    /// ```ignore,no_run
298    /// # use google_cloud_storagebatchoperations_v1::model::CreateJobRequest;
299    /// let x = CreateJobRequest::new().set_parent("example");
300    /// ```
301    pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
302        self.parent = v.into();
303        self
304    }
305
306    /// Sets the value of [job_id][crate::model::CreateJobRequest::job_id].
307    ///
308    /// # Example
309    /// ```ignore,no_run
310    /// # use google_cloud_storagebatchoperations_v1::model::CreateJobRequest;
311    /// let x = CreateJobRequest::new().set_job_id("example");
312    /// ```
313    pub fn set_job_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
314        self.job_id = v.into();
315        self
316    }
317
318    /// Sets the value of [job][crate::model::CreateJobRequest::job].
319    ///
320    /// # Example
321    /// ```ignore,no_run
322    /// # use google_cloud_storagebatchoperations_v1::model::CreateJobRequest;
323    /// use google_cloud_storagebatchoperations_v1::model::Job;
324    /// let x = CreateJobRequest::new().set_job(Job::default()/* use setters */);
325    /// ```
326    pub fn set_job<T>(mut self, v: T) -> Self
327    where
328        T: std::convert::Into<crate::model::Job>,
329    {
330        self.job = std::option::Option::Some(v.into());
331        self
332    }
333
334    /// Sets or clears the value of [job][crate::model::CreateJobRequest::job].
335    ///
336    /// # Example
337    /// ```ignore,no_run
338    /// # use google_cloud_storagebatchoperations_v1::model::CreateJobRequest;
339    /// use google_cloud_storagebatchoperations_v1::model::Job;
340    /// let x = CreateJobRequest::new().set_or_clear_job(Some(Job::default()/* use setters */));
341    /// let x = CreateJobRequest::new().set_or_clear_job(None::<Job>);
342    /// ```
343    pub fn set_or_clear_job<T>(mut self, v: std::option::Option<T>) -> Self
344    where
345        T: std::convert::Into<crate::model::Job>,
346    {
347        self.job = v.map(|x| x.into());
348        self
349    }
350
351    /// Sets the value of [request_id][crate::model::CreateJobRequest::request_id].
352    ///
353    /// # Example
354    /// ```ignore,no_run
355    /// # use google_cloud_storagebatchoperations_v1::model::CreateJobRequest;
356    /// let x = CreateJobRequest::new().set_request_id("example");
357    /// ```
358    pub fn set_request_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
359        self.request_id = v.into();
360        self
361    }
362}
363
364impl wkt::message::Message for CreateJobRequest {
365    fn typename() -> &'static str {
366        "type.googleapis.com/google.cloud.storagebatchoperations.v1.CreateJobRequest"
367    }
368}
369
370/// Message for Job to Cancel
371#[derive(Clone, Default, PartialEq)]
372#[non_exhaustive]
373pub struct CancelJobRequest {
374    /// Required. The `name` of the job to cancel.
375    /// Format: projects/{project_id}/locations/global/jobs/{job_id}.
376    pub name: std::string::String,
377
378    /// Optional. An optional request ID to identify requests. Specify a unique
379    /// request ID in case you need to retry your request. Requests with same
380    /// `request_id` will be ignored for at least 60 minutes since the first
381    /// request. The request ID must be a valid UUID with the exception that zero
382    /// UUID is not supported (00000000-0000-0000-0000-000000000000).
383    pub request_id: std::string::String,
384
385    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
386}
387
388impl CancelJobRequest {
389    pub fn new() -> Self {
390        std::default::Default::default()
391    }
392
393    /// Sets the value of [name][crate::model::CancelJobRequest::name].
394    ///
395    /// # Example
396    /// ```ignore,no_run
397    /// # use google_cloud_storagebatchoperations_v1::model::CancelJobRequest;
398    /// let x = CancelJobRequest::new().set_name("example");
399    /// ```
400    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
401        self.name = v.into();
402        self
403    }
404
405    /// Sets the value of [request_id][crate::model::CancelJobRequest::request_id].
406    ///
407    /// # Example
408    /// ```ignore,no_run
409    /// # use google_cloud_storagebatchoperations_v1::model::CancelJobRequest;
410    /// let x = CancelJobRequest::new().set_request_id("example");
411    /// ```
412    pub fn set_request_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
413        self.request_id = v.into();
414        self
415    }
416}
417
418impl wkt::message::Message for CancelJobRequest {
419    fn typename() -> &'static str {
420        "type.googleapis.com/google.cloud.storagebatchoperations.v1.CancelJobRequest"
421    }
422}
423
424/// Message for deleting a Job
425#[derive(Clone, Default, PartialEq)]
426#[non_exhaustive]
427pub struct DeleteJobRequest {
428    /// Required. The `name` of the job to delete.
429    /// Format: projects/{project_id}/locations/global/jobs/{job_id} .
430    pub name: std::string::String,
431
432    /// Optional. An optional request ID to identify requests. Specify a unique
433    /// request ID in case you need to retry your request. Requests with same
434    /// `request_id` will be ignored for at least 60 minutes since the first
435    /// request. The request ID must be a valid UUID with the exception that zero
436    /// UUID is not supported (00000000-0000-0000-0000-000000000000).
437    pub request_id: std::string::String,
438
439    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
440}
441
442impl DeleteJobRequest {
443    pub fn new() -> Self {
444        std::default::Default::default()
445    }
446
447    /// Sets the value of [name][crate::model::DeleteJobRequest::name].
448    ///
449    /// # Example
450    /// ```ignore,no_run
451    /// # use google_cloud_storagebatchoperations_v1::model::DeleteJobRequest;
452    /// let x = DeleteJobRequest::new().set_name("example");
453    /// ```
454    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
455        self.name = v.into();
456        self
457    }
458
459    /// Sets the value of [request_id][crate::model::DeleteJobRequest::request_id].
460    ///
461    /// # Example
462    /// ```ignore,no_run
463    /// # use google_cloud_storagebatchoperations_v1::model::DeleteJobRequest;
464    /// let x = DeleteJobRequest::new().set_request_id("example");
465    /// ```
466    pub fn set_request_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
467        self.request_id = v.into();
468        self
469    }
470}
471
472impl wkt::message::Message for DeleteJobRequest {
473    fn typename() -> &'static str {
474        "type.googleapis.com/google.cloud.storagebatchoperations.v1.DeleteJobRequest"
475    }
476}
477
478/// Message for response to cancel Job.
479#[derive(Clone, Default, PartialEq)]
480#[non_exhaustive]
481pub struct CancelJobResponse {
482    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
483}
484
485impl CancelJobResponse {
486    pub fn new() -> Self {
487        std::default::Default::default()
488    }
489}
490
491impl wkt::message::Message for CancelJobResponse {
492    fn typename() -> &'static str {
493        "type.googleapis.com/google.cloud.storagebatchoperations.v1.CancelJobResponse"
494    }
495}
496
497/// Represents the metadata of the long-running operation.
498#[derive(Clone, Default, PartialEq)]
499#[non_exhaustive]
500pub struct OperationMetadata {
501    /// Output only. The unique operation resource name.
502    /// Format: projects/{project}/locations/global/operations/{operation}.
503    pub operation: std::string::String,
504
505    /// Output only. The time the operation was created.
506    pub create_time: std::option::Option<wkt::Timestamp>,
507
508    /// Output only. The time the operation finished running.
509    pub end_time: std::option::Option<wkt::Timestamp>,
510
511    /// Output only. Identifies whether the user has requested cancellation
512    /// of the operation. Operations that have been cancelled successfully
513    /// have
514    /// [google.longrunning.Operation.error][google.longrunning.Operation.error]
515    /// value with a [google.rpc.Status.code][google.rpc.Status.code] of 1,
516    /// corresponding to
517    /// `[Code.CANCELLED][google.rpc.Code.CANCELLED]`.
518    ///
519    /// [google.longrunning.Operation.error]: longrunning::model::Operation::result
520    /// [google.rpc.Code.CANCELLED]: rpc::model::Code::Cancelled
521    /// [google.rpc.Status.code]: rpc::model::Status::code
522    pub requested_cancellation: bool,
523
524    /// Output only. API version used to start the operation.
525    pub api_version: std::string::String,
526
527    /// Output only. The Job associated with the operation.
528    pub job: std::option::Option<crate::model::Job>,
529
530    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
531}
532
533impl OperationMetadata {
534    pub fn new() -> Self {
535        std::default::Default::default()
536    }
537
538    /// Sets the value of [operation][crate::model::OperationMetadata::operation].
539    ///
540    /// # Example
541    /// ```ignore,no_run
542    /// # use google_cloud_storagebatchoperations_v1::model::OperationMetadata;
543    /// let x = OperationMetadata::new().set_operation("example");
544    /// ```
545    pub fn set_operation<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
546        self.operation = v.into();
547        self
548    }
549
550    /// Sets the value of [create_time][crate::model::OperationMetadata::create_time].
551    ///
552    /// # Example
553    /// ```ignore,no_run
554    /// # use google_cloud_storagebatchoperations_v1::model::OperationMetadata;
555    /// use wkt::Timestamp;
556    /// let x = OperationMetadata::new().set_create_time(Timestamp::default()/* use setters */);
557    /// ```
558    pub fn set_create_time<T>(mut self, v: T) -> Self
559    where
560        T: std::convert::Into<wkt::Timestamp>,
561    {
562        self.create_time = std::option::Option::Some(v.into());
563        self
564    }
565
566    /// Sets or clears the value of [create_time][crate::model::OperationMetadata::create_time].
567    ///
568    /// # Example
569    /// ```ignore,no_run
570    /// # use google_cloud_storagebatchoperations_v1::model::OperationMetadata;
571    /// use wkt::Timestamp;
572    /// let x = OperationMetadata::new().set_or_clear_create_time(Some(Timestamp::default()/* use setters */));
573    /// let x = OperationMetadata::new().set_or_clear_create_time(None::<Timestamp>);
574    /// ```
575    pub fn set_or_clear_create_time<T>(mut self, v: std::option::Option<T>) -> Self
576    where
577        T: std::convert::Into<wkt::Timestamp>,
578    {
579        self.create_time = v.map(|x| x.into());
580        self
581    }
582
583    /// Sets the value of [end_time][crate::model::OperationMetadata::end_time].
584    ///
585    /// # Example
586    /// ```ignore,no_run
587    /// # use google_cloud_storagebatchoperations_v1::model::OperationMetadata;
588    /// use wkt::Timestamp;
589    /// let x = OperationMetadata::new().set_end_time(Timestamp::default()/* use setters */);
590    /// ```
591    pub fn set_end_time<T>(mut self, v: T) -> Self
592    where
593        T: std::convert::Into<wkt::Timestamp>,
594    {
595        self.end_time = std::option::Option::Some(v.into());
596        self
597    }
598
599    /// Sets or clears the value of [end_time][crate::model::OperationMetadata::end_time].
600    ///
601    /// # Example
602    /// ```ignore,no_run
603    /// # use google_cloud_storagebatchoperations_v1::model::OperationMetadata;
604    /// use wkt::Timestamp;
605    /// let x = OperationMetadata::new().set_or_clear_end_time(Some(Timestamp::default()/* use setters */));
606    /// let x = OperationMetadata::new().set_or_clear_end_time(None::<Timestamp>);
607    /// ```
608    pub fn set_or_clear_end_time<T>(mut self, v: std::option::Option<T>) -> Self
609    where
610        T: std::convert::Into<wkt::Timestamp>,
611    {
612        self.end_time = v.map(|x| x.into());
613        self
614    }
615
616    /// Sets the value of [requested_cancellation][crate::model::OperationMetadata::requested_cancellation].
617    ///
618    /// # Example
619    /// ```ignore,no_run
620    /// # use google_cloud_storagebatchoperations_v1::model::OperationMetadata;
621    /// let x = OperationMetadata::new().set_requested_cancellation(true);
622    /// ```
623    pub fn set_requested_cancellation<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
624        self.requested_cancellation = v.into();
625        self
626    }
627
628    /// Sets the value of [api_version][crate::model::OperationMetadata::api_version].
629    ///
630    /// # Example
631    /// ```ignore,no_run
632    /// # use google_cloud_storagebatchoperations_v1::model::OperationMetadata;
633    /// let x = OperationMetadata::new().set_api_version("example");
634    /// ```
635    pub fn set_api_version<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
636        self.api_version = v.into();
637        self
638    }
639
640    /// Sets the value of [job][crate::model::OperationMetadata::job].
641    ///
642    /// # Example
643    /// ```ignore,no_run
644    /// # use google_cloud_storagebatchoperations_v1::model::OperationMetadata;
645    /// use google_cloud_storagebatchoperations_v1::model::Job;
646    /// let x = OperationMetadata::new().set_job(Job::default()/* use setters */);
647    /// ```
648    pub fn set_job<T>(mut self, v: T) -> Self
649    where
650        T: std::convert::Into<crate::model::Job>,
651    {
652        self.job = std::option::Option::Some(v.into());
653        self
654    }
655
656    /// Sets or clears the value of [job][crate::model::OperationMetadata::job].
657    ///
658    /// # Example
659    /// ```ignore,no_run
660    /// # use google_cloud_storagebatchoperations_v1::model::OperationMetadata;
661    /// use google_cloud_storagebatchoperations_v1::model::Job;
662    /// let x = OperationMetadata::new().set_or_clear_job(Some(Job::default()/* use setters */));
663    /// let x = OperationMetadata::new().set_or_clear_job(None::<Job>);
664    /// ```
665    pub fn set_or_clear_job<T>(mut self, v: std::option::Option<T>) -> Self
666    where
667        T: std::convert::Into<crate::model::Job>,
668    {
669        self.job = v.map(|x| x.into());
670        self
671    }
672}
673
674impl wkt::message::Message for OperationMetadata {
675    fn typename() -> &'static str {
676        "type.googleapis.com/google.cloud.storagebatchoperations.v1.OperationMetadata"
677    }
678}
679
680/// The Storage Batch Operations Job description.
681#[derive(Clone, Default, PartialEq)]
682#[non_exhaustive]
683pub struct Job {
684    /// Identifier. The resource name of the Job. job_id is unique
685    /// within the project, that is either set by the customer or
686    /// defined by the service. Format:
687    /// projects/{project}/locations/global/jobs/{job_id} .
688    /// For example: "projects/123456/locations/global/jobs/job01".
689    pub name: std::string::String,
690
691    /// Optional. A description provided by the user for the job. Its max length is
692    /// 1024 bytes when Unicode-encoded.
693    pub description: std::string::String,
694
695    /// Optional. Logging configuration.
696    pub logging_config: std::option::Option<crate::model::LoggingConfig>,
697
698    /// Output only. The time that the job was created.
699    pub create_time: std::option::Option<wkt::Timestamp>,
700
701    /// Output only. The time that the job was scheduled.
702    pub schedule_time: std::option::Option<wkt::Timestamp>,
703
704    /// Output only. The time that the job was completed.
705    pub complete_time: std::option::Option<wkt::Timestamp>,
706
707    /// Output only. Information about the progress of the job.
708    pub counters: std::option::Option<crate::model::Counters>,
709
710    /// Output only. Summarizes errors encountered with sample error log entries.
711    pub error_summaries: std::vec::Vec<crate::model::ErrorSummary>,
712
713    /// Output only. State of the job.
714    pub state: crate::model::job::State,
715
716    /// Optional. If true, the job will run in dry run mode, returning the total
717    /// object count and, if the object configuration is a prefix list, the bytes
718    /// found from source. No transformations will be performed.
719    pub dry_run: bool,
720
721    /// Specifies objects to be transformed.
722    pub source: std::option::Option<crate::model::job::Source>,
723
724    /// Operation to be performed on the objects.
725    pub transformation: std::option::Option<crate::model::job::Transformation>,
726
727    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
728}
729
730impl Job {
731    pub fn new() -> Self {
732        std::default::Default::default()
733    }
734
735    /// Sets the value of [name][crate::model::Job::name].
736    ///
737    /// # Example
738    /// ```ignore,no_run
739    /// # use google_cloud_storagebatchoperations_v1::model::Job;
740    /// let x = Job::new().set_name("example");
741    /// ```
742    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
743        self.name = v.into();
744        self
745    }
746
747    /// Sets the value of [description][crate::model::Job::description].
748    ///
749    /// # Example
750    /// ```ignore,no_run
751    /// # use google_cloud_storagebatchoperations_v1::model::Job;
752    /// let x = Job::new().set_description("example");
753    /// ```
754    pub fn set_description<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
755        self.description = v.into();
756        self
757    }
758
759    /// Sets the value of [logging_config][crate::model::Job::logging_config].
760    ///
761    /// # Example
762    /// ```ignore,no_run
763    /// # use google_cloud_storagebatchoperations_v1::model::Job;
764    /// use google_cloud_storagebatchoperations_v1::model::LoggingConfig;
765    /// let x = Job::new().set_logging_config(LoggingConfig::default()/* use setters */);
766    /// ```
767    pub fn set_logging_config<T>(mut self, v: T) -> Self
768    where
769        T: std::convert::Into<crate::model::LoggingConfig>,
770    {
771        self.logging_config = std::option::Option::Some(v.into());
772        self
773    }
774
775    /// Sets or clears the value of [logging_config][crate::model::Job::logging_config].
776    ///
777    /// # Example
778    /// ```ignore,no_run
779    /// # use google_cloud_storagebatchoperations_v1::model::Job;
780    /// use google_cloud_storagebatchoperations_v1::model::LoggingConfig;
781    /// let x = Job::new().set_or_clear_logging_config(Some(LoggingConfig::default()/* use setters */));
782    /// let x = Job::new().set_or_clear_logging_config(None::<LoggingConfig>);
783    /// ```
784    pub fn set_or_clear_logging_config<T>(mut self, v: std::option::Option<T>) -> Self
785    where
786        T: std::convert::Into<crate::model::LoggingConfig>,
787    {
788        self.logging_config = v.map(|x| x.into());
789        self
790    }
791
792    /// Sets the value of [create_time][crate::model::Job::create_time].
793    ///
794    /// # Example
795    /// ```ignore,no_run
796    /// # use google_cloud_storagebatchoperations_v1::model::Job;
797    /// use wkt::Timestamp;
798    /// let x = Job::new().set_create_time(Timestamp::default()/* use setters */);
799    /// ```
800    pub fn set_create_time<T>(mut self, v: T) -> Self
801    where
802        T: std::convert::Into<wkt::Timestamp>,
803    {
804        self.create_time = std::option::Option::Some(v.into());
805        self
806    }
807
808    /// Sets or clears the value of [create_time][crate::model::Job::create_time].
809    ///
810    /// # Example
811    /// ```ignore,no_run
812    /// # use google_cloud_storagebatchoperations_v1::model::Job;
813    /// use wkt::Timestamp;
814    /// let x = Job::new().set_or_clear_create_time(Some(Timestamp::default()/* use setters */));
815    /// let x = Job::new().set_or_clear_create_time(None::<Timestamp>);
816    /// ```
817    pub fn set_or_clear_create_time<T>(mut self, v: std::option::Option<T>) -> Self
818    where
819        T: std::convert::Into<wkt::Timestamp>,
820    {
821        self.create_time = v.map(|x| x.into());
822        self
823    }
824
825    /// Sets the value of [schedule_time][crate::model::Job::schedule_time].
826    ///
827    /// # Example
828    /// ```ignore,no_run
829    /// # use google_cloud_storagebatchoperations_v1::model::Job;
830    /// use wkt::Timestamp;
831    /// let x = Job::new().set_schedule_time(Timestamp::default()/* use setters */);
832    /// ```
833    pub fn set_schedule_time<T>(mut self, v: T) -> Self
834    where
835        T: std::convert::Into<wkt::Timestamp>,
836    {
837        self.schedule_time = std::option::Option::Some(v.into());
838        self
839    }
840
841    /// Sets or clears the value of [schedule_time][crate::model::Job::schedule_time].
842    ///
843    /// # Example
844    /// ```ignore,no_run
845    /// # use google_cloud_storagebatchoperations_v1::model::Job;
846    /// use wkt::Timestamp;
847    /// let x = Job::new().set_or_clear_schedule_time(Some(Timestamp::default()/* use setters */));
848    /// let x = Job::new().set_or_clear_schedule_time(None::<Timestamp>);
849    /// ```
850    pub fn set_or_clear_schedule_time<T>(mut self, v: std::option::Option<T>) -> Self
851    where
852        T: std::convert::Into<wkt::Timestamp>,
853    {
854        self.schedule_time = v.map(|x| x.into());
855        self
856    }
857
858    /// Sets the value of [complete_time][crate::model::Job::complete_time].
859    ///
860    /// # Example
861    /// ```ignore,no_run
862    /// # use google_cloud_storagebatchoperations_v1::model::Job;
863    /// use wkt::Timestamp;
864    /// let x = Job::new().set_complete_time(Timestamp::default()/* use setters */);
865    /// ```
866    pub fn set_complete_time<T>(mut self, v: T) -> Self
867    where
868        T: std::convert::Into<wkt::Timestamp>,
869    {
870        self.complete_time = std::option::Option::Some(v.into());
871        self
872    }
873
874    /// Sets or clears the value of [complete_time][crate::model::Job::complete_time].
875    ///
876    /// # Example
877    /// ```ignore,no_run
878    /// # use google_cloud_storagebatchoperations_v1::model::Job;
879    /// use wkt::Timestamp;
880    /// let x = Job::new().set_or_clear_complete_time(Some(Timestamp::default()/* use setters */));
881    /// let x = Job::new().set_or_clear_complete_time(None::<Timestamp>);
882    /// ```
883    pub fn set_or_clear_complete_time<T>(mut self, v: std::option::Option<T>) -> Self
884    where
885        T: std::convert::Into<wkt::Timestamp>,
886    {
887        self.complete_time = v.map(|x| x.into());
888        self
889    }
890
891    /// Sets the value of [counters][crate::model::Job::counters].
892    ///
893    /// # Example
894    /// ```ignore,no_run
895    /// # use google_cloud_storagebatchoperations_v1::model::Job;
896    /// use google_cloud_storagebatchoperations_v1::model::Counters;
897    /// let x = Job::new().set_counters(Counters::default()/* use setters */);
898    /// ```
899    pub fn set_counters<T>(mut self, v: T) -> Self
900    where
901        T: std::convert::Into<crate::model::Counters>,
902    {
903        self.counters = std::option::Option::Some(v.into());
904        self
905    }
906
907    /// Sets or clears the value of [counters][crate::model::Job::counters].
908    ///
909    /// # Example
910    /// ```ignore,no_run
911    /// # use google_cloud_storagebatchoperations_v1::model::Job;
912    /// use google_cloud_storagebatchoperations_v1::model::Counters;
913    /// let x = Job::new().set_or_clear_counters(Some(Counters::default()/* use setters */));
914    /// let x = Job::new().set_or_clear_counters(None::<Counters>);
915    /// ```
916    pub fn set_or_clear_counters<T>(mut self, v: std::option::Option<T>) -> Self
917    where
918        T: std::convert::Into<crate::model::Counters>,
919    {
920        self.counters = v.map(|x| x.into());
921        self
922    }
923
924    /// Sets the value of [error_summaries][crate::model::Job::error_summaries].
925    ///
926    /// # Example
927    /// ```ignore,no_run
928    /// # use google_cloud_storagebatchoperations_v1::model::Job;
929    /// use google_cloud_storagebatchoperations_v1::model::ErrorSummary;
930    /// let x = Job::new()
931    ///     .set_error_summaries([
932    ///         ErrorSummary::default()/* use setters */,
933    ///         ErrorSummary::default()/* use (different) setters */,
934    ///     ]);
935    /// ```
936    pub fn set_error_summaries<T, V>(mut self, v: T) -> Self
937    where
938        T: std::iter::IntoIterator<Item = V>,
939        V: std::convert::Into<crate::model::ErrorSummary>,
940    {
941        use std::iter::Iterator;
942        self.error_summaries = v.into_iter().map(|i| i.into()).collect();
943        self
944    }
945
946    /// Sets the value of [state][crate::model::Job::state].
947    ///
948    /// # Example
949    /// ```ignore,no_run
950    /// # use google_cloud_storagebatchoperations_v1::model::Job;
951    /// use google_cloud_storagebatchoperations_v1::model::job::State;
952    /// let x0 = Job::new().set_state(State::Running);
953    /// let x1 = Job::new().set_state(State::Succeeded);
954    /// let x2 = Job::new().set_state(State::Canceled);
955    /// ```
956    pub fn set_state<T: std::convert::Into<crate::model::job::State>>(mut self, v: T) -> Self {
957        self.state = v.into();
958        self
959    }
960
961    /// Sets the value of [dry_run][crate::model::Job::dry_run].
962    ///
963    /// # Example
964    /// ```ignore,no_run
965    /// # use google_cloud_storagebatchoperations_v1::model::Job;
966    /// let x = Job::new().set_dry_run(true);
967    /// ```
968    pub fn set_dry_run<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
969        self.dry_run = v.into();
970        self
971    }
972
973    /// Sets the value of [source][crate::model::Job::source].
974    ///
975    /// Note that all the setters affecting `source` are mutually
976    /// exclusive.
977    ///
978    /// # Example
979    /// ```ignore,no_run
980    /// # use google_cloud_storagebatchoperations_v1::model::Job;
981    /// use google_cloud_storagebatchoperations_v1::model::BucketList;
982    /// let x = Job::new().set_source(Some(
983    ///     google_cloud_storagebatchoperations_v1::model::job::Source::BucketList(BucketList::default().into())));
984    /// ```
985    pub fn set_source<T: std::convert::Into<std::option::Option<crate::model::job::Source>>>(
986        mut self,
987        v: T,
988    ) -> Self {
989        self.source = v.into();
990        self
991    }
992
993    /// The value of [source][crate::model::Job::source]
994    /// if it holds a `BucketList`, `None` if the field is not set or
995    /// holds a different branch.
996    pub fn bucket_list(&self) -> std::option::Option<&std::boxed::Box<crate::model::BucketList>> {
997        #[allow(unreachable_patterns)]
998        self.source.as_ref().and_then(|v| match v {
999            crate::model::job::Source::BucketList(v) => std::option::Option::Some(v),
1000            _ => std::option::Option::None,
1001        })
1002    }
1003
1004    /// Sets the value of [source][crate::model::Job::source]
1005    /// to hold a `BucketList`.
1006    ///
1007    /// Note that all the setters affecting `source` are
1008    /// mutually exclusive.
1009    ///
1010    /// # Example
1011    /// ```ignore,no_run
1012    /// # use google_cloud_storagebatchoperations_v1::model::Job;
1013    /// use google_cloud_storagebatchoperations_v1::model::BucketList;
1014    /// let x = Job::new().set_bucket_list(BucketList::default()/* use setters */);
1015    /// assert!(x.bucket_list().is_some());
1016    /// ```
1017    pub fn set_bucket_list<T: std::convert::Into<std::boxed::Box<crate::model::BucketList>>>(
1018        mut self,
1019        v: T,
1020    ) -> Self {
1021        self.source = std::option::Option::Some(crate::model::job::Source::BucketList(v.into()));
1022        self
1023    }
1024
1025    /// Sets the value of [transformation][crate::model::Job::transformation].
1026    ///
1027    /// Note that all the setters affecting `transformation` are mutually
1028    /// exclusive.
1029    ///
1030    /// # Example
1031    /// ```ignore,no_run
1032    /// # use google_cloud_storagebatchoperations_v1::model::Job;
1033    /// use google_cloud_storagebatchoperations_v1::model::PutObjectHold;
1034    /// let x = Job::new().set_transformation(Some(
1035    ///     google_cloud_storagebatchoperations_v1::model::job::Transformation::PutObjectHold(PutObjectHold::default().into())));
1036    /// ```
1037    pub fn set_transformation<
1038        T: std::convert::Into<std::option::Option<crate::model::job::Transformation>>,
1039    >(
1040        mut self,
1041        v: T,
1042    ) -> Self {
1043        self.transformation = v.into();
1044        self
1045    }
1046
1047    /// The value of [transformation][crate::model::Job::transformation]
1048    /// if it holds a `PutObjectHold`, `None` if the field is not set or
1049    /// holds a different branch.
1050    pub fn put_object_hold(
1051        &self,
1052    ) -> std::option::Option<&std::boxed::Box<crate::model::PutObjectHold>> {
1053        #[allow(unreachable_patterns)]
1054        self.transformation.as_ref().and_then(|v| match v {
1055            crate::model::job::Transformation::PutObjectHold(v) => std::option::Option::Some(v),
1056            _ => std::option::Option::None,
1057        })
1058    }
1059
1060    /// Sets the value of [transformation][crate::model::Job::transformation]
1061    /// to hold a `PutObjectHold`.
1062    ///
1063    /// Note that all the setters affecting `transformation` are
1064    /// mutually exclusive.
1065    ///
1066    /// # Example
1067    /// ```ignore,no_run
1068    /// # use google_cloud_storagebatchoperations_v1::model::Job;
1069    /// use google_cloud_storagebatchoperations_v1::model::PutObjectHold;
1070    /// let x = Job::new().set_put_object_hold(PutObjectHold::default()/* use setters */);
1071    /// assert!(x.put_object_hold().is_some());
1072    /// assert!(x.delete_object().is_none());
1073    /// assert!(x.put_metadata().is_none());
1074    /// assert!(x.rewrite_object().is_none());
1075    /// ```
1076    pub fn set_put_object_hold<
1077        T: std::convert::Into<std::boxed::Box<crate::model::PutObjectHold>>,
1078    >(
1079        mut self,
1080        v: T,
1081    ) -> Self {
1082        self.transformation =
1083            std::option::Option::Some(crate::model::job::Transformation::PutObjectHold(v.into()));
1084        self
1085    }
1086
1087    /// The value of [transformation][crate::model::Job::transformation]
1088    /// if it holds a `DeleteObject`, `None` if the field is not set or
1089    /// holds a different branch.
1090    pub fn delete_object(
1091        &self,
1092    ) -> std::option::Option<&std::boxed::Box<crate::model::DeleteObject>> {
1093        #[allow(unreachable_patterns)]
1094        self.transformation.as_ref().and_then(|v| match v {
1095            crate::model::job::Transformation::DeleteObject(v) => std::option::Option::Some(v),
1096            _ => std::option::Option::None,
1097        })
1098    }
1099
1100    /// Sets the value of [transformation][crate::model::Job::transformation]
1101    /// to hold a `DeleteObject`.
1102    ///
1103    /// Note that all the setters affecting `transformation` are
1104    /// mutually exclusive.
1105    ///
1106    /// # Example
1107    /// ```ignore,no_run
1108    /// # use google_cloud_storagebatchoperations_v1::model::Job;
1109    /// use google_cloud_storagebatchoperations_v1::model::DeleteObject;
1110    /// let x = Job::new().set_delete_object(DeleteObject::default()/* use setters */);
1111    /// assert!(x.delete_object().is_some());
1112    /// assert!(x.put_object_hold().is_none());
1113    /// assert!(x.put_metadata().is_none());
1114    /// assert!(x.rewrite_object().is_none());
1115    /// ```
1116    pub fn set_delete_object<T: std::convert::Into<std::boxed::Box<crate::model::DeleteObject>>>(
1117        mut self,
1118        v: T,
1119    ) -> Self {
1120        self.transformation =
1121            std::option::Option::Some(crate::model::job::Transformation::DeleteObject(v.into()));
1122        self
1123    }
1124
1125    /// The value of [transformation][crate::model::Job::transformation]
1126    /// if it holds a `PutMetadata`, `None` if the field is not set or
1127    /// holds a different branch.
1128    pub fn put_metadata(&self) -> std::option::Option<&std::boxed::Box<crate::model::PutMetadata>> {
1129        #[allow(unreachable_patterns)]
1130        self.transformation.as_ref().and_then(|v| match v {
1131            crate::model::job::Transformation::PutMetadata(v) => std::option::Option::Some(v),
1132            _ => std::option::Option::None,
1133        })
1134    }
1135
1136    /// Sets the value of [transformation][crate::model::Job::transformation]
1137    /// to hold a `PutMetadata`.
1138    ///
1139    /// Note that all the setters affecting `transformation` are
1140    /// mutually exclusive.
1141    ///
1142    /// # Example
1143    /// ```ignore,no_run
1144    /// # use google_cloud_storagebatchoperations_v1::model::Job;
1145    /// use google_cloud_storagebatchoperations_v1::model::PutMetadata;
1146    /// let x = Job::new().set_put_metadata(PutMetadata::default()/* use setters */);
1147    /// assert!(x.put_metadata().is_some());
1148    /// assert!(x.put_object_hold().is_none());
1149    /// assert!(x.delete_object().is_none());
1150    /// assert!(x.rewrite_object().is_none());
1151    /// ```
1152    pub fn set_put_metadata<T: std::convert::Into<std::boxed::Box<crate::model::PutMetadata>>>(
1153        mut self,
1154        v: T,
1155    ) -> Self {
1156        self.transformation =
1157            std::option::Option::Some(crate::model::job::Transformation::PutMetadata(v.into()));
1158        self
1159    }
1160
1161    /// The value of [transformation][crate::model::Job::transformation]
1162    /// if it holds a `RewriteObject`, `None` if the field is not set or
1163    /// holds a different branch.
1164    pub fn rewrite_object(
1165        &self,
1166    ) -> std::option::Option<&std::boxed::Box<crate::model::RewriteObject>> {
1167        #[allow(unreachable_patterns)]
1168        self.transformation.as_ref().and_then(|v| match v {
1169            crate::model::job::Transformation::RewriteObject(v) => std::option::Option::Some(v),
1170            _ => std::option::Option::None,
1171        })
1172    }
1173
1174    /// Sets the value of [transformation][crate::model::Job::transformation]
1175    /// to hold a `RewriteObject`.
1176    ///
1177    /// Note that all the setters affecting `transformation` are
1178    /// mutually exclusive.
1179    ///
1180    /// # Example
1181    /// ```ignore,no_run
1182    /// # use google_cloud_storagebatchoperations_v1::model::Job;
1183    /// use google_cloud_storagebatchoperations_v1::model::RewriteObject;
1184    /// let x = Job::new().set_rewrite_object(RewriteObject::default()/* use setters */);
1185    /// assert!(x.rewrite_object().is_some());
1186    /// assert!(x.put_object_hold().is_none());
1187    /// assert!(x.delete_object().is_none());
1188    /// assert!(x.put_metadata().is_none());
1189    /// ```
1190    pub fn set_rewrite_object<
1191        T: std::convert::Into<std::boxed::Box<crate::model::RewriteObject>>,
1192    >(
1193        mut self,
1194        v: T,
1195    ) -> Self {
1196        self.transformation =
1197            std::option::Option::Some(crate::model::job::Transformation::RewriteObject(v.into()));
1198        self
1199    }
1200}
1201
1202impl wkt::message::Message for Job {
1203    fn typename() -> &'static str {
1204        "type.googleapis.com/google.cloud.storagebatchoperations.v1.Job"
1205    }
1206}
1207
1208/// Defines additional types related to [Job].
1209pub mod job {
1210    #[allow(unused_imports)]
1211    use super::*;
1212
1213    /// Describes state of a job.
1214    ///
1215    /// # Working with unknown values
1216    ///
1217    /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
1218    /// additional enum variants at any time. Adding new variants is not considered
1219    /// a breaking change. Applications should write their code in anticipation of:
1220    ///
1221    /// - New values appearing in future releases of the client library, **and**
1222    /// - New values received dynamically, without application changes.
1223    ///
1224    /// Please consult the [Working with enums] section in the user guide for some
1225    /// guidelines.
1226    ///
1227    /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
1228    #[derive(Clone, Debug, PartialEq)]
1229    #[non_exhaustive]
1230    pub enum State {
1231        /// Default value. This value is unused.
1232        Unspecified,
1233        /// In progress.
1234        Running,
1235        /// Completed successfully.
1236        Succeeded,
1237        /// Cancelled by the user.
1238        Canceled,
1239        /// Terminated due to an unrecoverable failure.
1240        Failed,
1241        /// If set, the enum was initialized with an unknown value.
1242        ///
1243        /// Applications can examine the value using [State::value] or
1244        /// [State::name].
1245        UnknownValue(state::UnknownValue),
1246    }
1247
1248    #[doc(hidden)]
1249    pub mod state {
1250        #[allow(unused_imports)]
1251        use super::*;
1252        #[derive(Clone, Debug, PartialEq)]
1253        pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
1254    }
1255
1256    impl State {
1257        /// Gets the enum value.
1258        ///
1259        /// Returns `None` if the enum contains an unknown value deserialized from
1260        /// the string representation of enums.
1261        pub fn value(&self) -> std::option::Option<i32> {
1262            match self {
1263                Self::Unspecified => std::option::Option::Some(0),
1264                Self::Running => std::option::Option::Some(1),
1265                Self::Succeeded => std::option::Option::Some(2),
1266                Self::Canceled => std::option::Option::Some(3),
1267                Self::Failed => std::option::Option::Some(4),
1268                Self::UnknownValue(u) => u.0.value(),
1269            }
1270        }
1271
1272        /// Gets the enum value as a string.
1273        ///
1274        /// Returns `None` if the enum contains an unknown value deserialized from
1275        /// the integer representation of enums.
1276        pub fn name(&self) -> std::option::Option<&str> {
1277            match self {
1278                Self::Unspecified => std::option::Option::Some("STATE_UNSPECIFIED"),
1279                Self::Running => std::option::Option::Some("RUNNING"),
1280                Self::Succeeded => std::option::Option::Some("SUCCEEDED"),
1281                Self::Canceled => std::option::Option::Some("CANCELED"),
1282                Self::Failed => std::option::Option::Some("FAILED"),
1283                Self::UnknownValue(u) => u.0.name(),
1284            }
1285        }
1286    }
1287
1288    impl std::default::Default for State {
1289        fn default() -> Self {
1290            use std::convert::From;
1291            Self::from(0)
1292        }
1293    }
1294
1295    impl std::fmt::Display for State {
1296        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
1297            wkt::internal::display_enum(f, self.name(), self.value())
1298        }
1299    }
1300
1301    impl std::convert::From<i32> for State {
1302        fn from(value: i32) -> Self {
1303            match value {
1304                0 => Self::Unspecified,
1305                1 => Self::Running,
1306                2 => Self::Succeeded,
1307                3 => Self::Canceled,
1308                4 => Self::Failed,
1309                _ => Self::UnknownValue(state::UnknownValue(
1310                    wkt::internal::UnknownEnumValue::Integer(value),
1311                )),
1312            }
1313        }
1314    }
1315
1316    impl std::convert::From<&str> for State {
1317        fn from(value: &str) -> Self {
1318            use std::string::ToString;
1319            match value {
1320                "STATE_UNSPECIFIED" => Self::Unspecified,
1321                "RUNNING" => Self::Running,
1322                "SUCCEEDED" => Self::Succeeded,
1323                "CANCELED" => Self::Canceled,
1324                "FAILED" => Self::Failed,
1325                _ => Self::UnknownValue(state::UnknownValue(
1326                    wkt::internal::UnknownEnumValue::String(value.to_string()),
1327                )),
1328            }
1329        }
1330    }
1331
1332    impl serde::ser::Serialize for State {
1333        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
1334        where
1335            S: serde::Serializer,
1336        {
1337            match self {
1338                Self::Unspecified => serializer.serialize_i32(0),
1339                Self::Running => serializer.serialize_i32(1),
1340                Self::Succeeded => serializer.serialize_i32(2),
1341                Self::Canceled => serializer.serialize_i32(3),
1342                Self::Failed => serializer.serialize_i32(4),
1343                Self::UnknownValue(u) => u.0.serialize(serializer),
1344            }
1345        }
1346    }
1347
1348    impl<'de> serde::de::Deserialize<'de> for State {
1349        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
1350        where
1351            D: serde::Deserializer<'de>,
1352        {
1353            deserializer.deserialize_any(wkt::internal::EnumVisitor::<State>::new(
1354                ".google.cloud.storagebatchoperations.v1.Job.State",
1355            ))
1356        }
1357    }
1358
1359    /// Specifies objects to be transformed.
1360    #[derive(Clone, Debug, PartialEq)]
1361    #[non_exhaustive]
1362    pub enum Source {
1363        /// Specifies a list of buckets and their objects to be transformed.
1364        BucketList(std::boxed::Box<crate::model::BucketList>),
1365    }
1366
1367    /// Operation to be performed on the objects.
1368    #[derive(Clone, Debug, PartialEq)]
1369    #[non_exhaustive]
1370    pub enum Transformation {
1371        /// Changes object hold status.
1372        PutObjectHold(std::boxed::Box<crate::model::PutObjectHold>),
1373        /// Delete objects.
1374        DeleteObject(std::boxed::Box<crate::model::DeleteObject>),
1375        /// Updates object metadata. Allows updating fixed-key and custom metadata
1376        /// and fixed-key metadata i.e. Cache-Control, Content-Disposition,
1377        /// Content-Encoding, Content-Language, Content-Type, Custom-Time.
1378        PutMetadata(std::boxed::Box<crate::model::PutMetadata>),
1379        /// Rewrite the object and updates metadata like KMS key.
1380        RewriteObject(std::boxed::Box<crate::model::RewriteObject>),
1381    }
1382}
1383
1384/// Describes list of buckets and their objects to be transformed.
1385#[derive(Clone, Default, PartialEq)]
1386#[non_exhaustive]
1387pub struct BucketList {
1388    /// Required. List of buckets and their objects to be transformed. Currently,
1389    /// only one bucket configuration is supported. If multiple buckets are
1390    /// specified, an error will be returned.
1391    pub buckets: std::vec::Vec<crate::model::bucket_list::Bucket>,
1392
1393    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1394}
1395
1396impl BucketList {
1397    pub fn new() -> Self {
1398        std::default::Default::default()
1399    }
1400
1401    /// Sets the value of [buckets][crate::model::BucketList::buckets].
1402    ///
1403    /// # Example
1404    /// ```ignore,no_run
1405    /// # use google_cloud_storagebatchoperations_v1::model::BucketList;
1406    /// use google_cloud_storagebatchoperations_v1::model::bucket_list::Bucket;
1407    /// let x = BucketList::new()
1408    ///     .set_buckets([
1409    ///         Bucket::default()/* use setters */,
1410    ///         Bucket::default()/* use (different) setters */,
1411    ///     ]);
1412    /// ```
1413    pub fn set_buckets<T, V>(mut self, v: T) -> Self
1414    where
1415        T: std::iter::IntoIterator<Item = V>,
1416        V: std::convert::Into<crate::model::bucket_list::Bucket>,
1417    {
1418        use std::iter::Iterator;
1419        self.buckets = v.into_iter().map(|i| i.into()).collect();
1420        self
1421    }
1422}
1423
1424impl wkt::message::Message for BucketList {
1425    fn typename() -> &'static str {
1426        "type.googleapis.com/google.cloud.storagebatchoperations.v1.BucketList"
1427    }
1428}
1429
1430/// Defines additional types related to [BucketList].
1431pub mod bucket_list {
1432    #[allow(unused_imports)]
1433    use super::*;
1434
1435    /// Describes configuration of a single bucket and its objects to be
1436    /// transformed.
1437    #[derive(Clone, Default, PartialEq)]
1438    #[non_exhaustive]
1439    pub struct Bucket {
1440        /// Required. Bucket name for the objects to be transformed.
1441        pub bucket: std::string::String,
1442
1443        /// Specifies objects to be transformed.
1444        pub object_configuration:
1445            std::option::Option<crate::model::bucket_list::bucket::ObjectConfiguration>,
1446
1447        pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1448    }
1449
1450    impl Bucket {
1451        pub fn new() -> Self {
1452            std::default::Default::default()
1453        }
1454
1455        /// Sets the value of [bucket][crate::model::bucket_list::Bucket::bucket].
1456        ///
1457        /// # Example
1458        /// ```ignore,no_run
1459        /// # use google_cloud_storagebatchoperations_v1::model::bucket_list::Bucket;
1460        /// let x = Bucket::new().set_bucket("example");
1461        /// ```
1462        pub fn set_bucket<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1463            self.bucket = v.into();
1464            self
1465        }
1466
1467        /// Sets the value of [object_configuration][crate::model::bucket_list::Bucket::object_configuration].
1468        ///
1469        /// Note that all the setters affecting `object_configuration` are mutually
1470        /// exclusive.
1471        ///
1472        /// # Example
1473        /// ```ignore,no_run
1474        /// # use google_cloud_storagebatchoperations_v1::model::bucket_list::Bucket;
1475        /// use google_cloud_storagebatchoperations_v1::model::PrefixList;
1476        /// let x = Bucket::new().set_object_configuration(Some(
1477        ///     google_cloud_storagebatchoperations_v1::model::bucket_list::bucket::ObjectConfiguration::PrefixList(PrefixList::default().into())));
1478        /// ```
1479        pub fn set_object_configuration<
1480            T: std::convert::Into<
1481                    std::option::Option<crate::model::bucket_list::bucket::ObjectConfiguration>,
1482                >,
1483        >(
1484            mut self,
1485            v: T,
1486        ) -> Self {
1487            self.object_configuration = v.into();
1488            self
1489        }
1490
1491        /// The value of [object_configuration][crate::model::bucket_list::Bucket::object_configuration]
1492        /// if it holds a `PrefixList`, `None` if the field is not set or
1493        /// holds a different branch.
1494        pub fn prefix_list(
1495            &self,
1496        ) -> std::option::Option<&std::boxed::Box<crate::model::PrefixList>> {
1497            #[allow(unreachable_patterns)]
1498            self.object_configuration.as_ref().and_then(|v| match v {
1499                crate::model::bucket_list::bucket::ObjectConfiguration::PrefixList(v) => {
1500                    std::option::Option::Some(v)
1501                }
1502                _ => std::option::Option::None,
1503            })
1504        }
1505
1506        /// Sets the value of [object_configuration][crate::model::bucket_list::Bucket::object_configuration]
1507        /// to hold a `PrefixList`.
1508        ///
1509        /// Note that all the setters affecting `object_configuration` are
1510        /// mutually exclusive.
1511        ///
1512        /// # Example
1513        /// ```ignore,no_run
1514        /// # use google_cloud_storagebatchoperations_v1::model::bucket_list::Bucket;
1515        /// use google_cloud_storagebatchoperations_v1::model::PrefixList;
1516        /// let x = Bucket::new().set_prefix_list(PrefixList::default()/* use setters */);
1517        /// assert!(x.prefix_list().is_some());
1518        /// assert!(x.manifest().is_none());
1519        /// ```
1520        pub fn set_prefix_list<T: std::convert::Into<std::boxed::Box<crate::model::PrefixList>>>(
1521            mut self,
1522            v: T,
1523        ) -> Self {
1524            self.object_configuration = std::option::Option::Some(
1525                crate::model::bucket_list::bucket::ObjectConfiguration::PrefixList(v.into()),
1526            );
1527            self
1528        }
1529
1530        /// The value of [object_configuration][crate::model::bucket_list::Bucket::object_configuration]
1531        /// if it holds a `Manifest`, `None` if the field is not set or
1532        /// holds a different branch.
1533        pub fn manifest(&self) -> std::option::Option<&std::boxed::Box<crate::model::Manifest>> {
1534            #[allow(unreachable_patterns)]
1535            self.object_configuration.as_ref().and_then(|v| match v {
1536                crate::model::bucket_list::bucket::ObjectConfiguration::Manifest(v) => {
1537                    std::option::Option::Some(v)
1538                }
1539                _ => std::option::Option::None,
1540            })
1541        }
1542
1543        /// Sets the value of [object_configuration][crate::model::bucket_list::Bucket::object_configuration]
1544        /// to hold a `Manifest`.
1545        ///
1546        /// Note that all the setters affecting `object_configuration` are
1547        /// mutually exclusive.
1548        ///
1549        /// # Example
1550        /// ```ignore,no_run
1551        /// # use google_cloud_storagebatchoperations_v1::model::bucket_list::Bucket;
1552        /// use google_cloud_storagebatchoperations_v1::model::Manifest;
1553        /// let x = Bucket::new().set_manifest(Manifest::default()/* use setters */);
1554        /// assert!(x.manifest().is_some());
1555        /// assert!(x.prefix_list().is_none());
1556        /// ```
1557        pub fn set_manifest<T: std::convert::Into<std::boxed::Box<crate::model::Manifest>>>(
1558            mut self,
1559            v: T,
1560        ) -> Self {
1561            self.object_configuration = std::option::Option::Some(
1562                crate::model::bucket_list::bucket::ObjectConfiguration::Manifest(v.into()),
1563            );
1564            self
1565        }
1566    }
1567
1568    impl wkt::message::Message for Bucket {
1569        fn typename() -> &'static str {
1570            "type.googleapis.com/google.cloud.storagebatchoperations.v1.BucketList.Bucket"
1571        }
1572    }
1573
1574    /// Defines additional types related to [Bucket].
1575    pub mod bucket {
1576        #[allow(unused_imports)]
1577        use super::*;
1578
1579        /// Specifies objects to be transformed.
1580        #[derive(Clone, Debug, PartialEq)]
1581        #[non_exhaustive]
1582        pub enum ObjectConfiguration {
1583            /// Specifies objects matching a prefix set.
1584            PrefixList(std::boxed::Box<crate::model::PrefixList>),
1585            /// Specifies objects in a manifest file.
1586            Manifest(std::boxed::Box<crate::model::Manifest>),
1587        }
1588    }
1589}
1590
1591/// Describes list of objects to be transformed.
1592#[derive(Clone, Default, PartialEq)]
1593#[non_exhaustive]
1594pub struct Manifest {
1595    /// Required. `manifest_location` must contain the manifest source file that is
1596    /// a CSV file in a Google Cloud Storage bucket. Each row in the file must
1597    /// include the object details i.e. BucketId and Name. Generation may
1598    /// optionally be specified. When it is not specified the live object is acted
1599    /// upon. `manifest_location` should either be 1) An absolute path to the
1600    /// object in the format of `gs://bucket_name/path/file_name.csv`. 2) An
1601    /// absolute path with a single wildcard character in the file name, for
1602    /// example `gs://bucket_name/path/file_name*.csv`.
1603    /// If manifest location is specified with a wildcard, objects in all manifest
1604    /// files matching the pattern will be acted upon.
1605    pub manifest_location: std::string::String,
1606
1607    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1608}
1609
1610impl Manifest {
1611    pub fn new() -> Self {
1612        std::default::Default::default()
1613    }
1614
1615    /// Sets the value of [manifest_location][crate::model::Manifest::manifest_location].
1616    ///
1617    /// # Example
1618    /// ```ignore,no_run
1619    /// # use google_cloud_storagebatchoperations_v1::model::Manifest;
1620    /// let x = Manifest::new().set_manifest_location("example");
1621    /// ```
1622    pub fn set_manifest_location<T: std::convert::Into<std::string::String>>(
1623        mut self,
1624        v: T,
1625    ) -> Self {
1626        self.manifest_location = v.into();
1627        self
1628    }
1629}
1630
1631impl wkt::message::Message for Manifest {
1632    fn typename() -> &'static str {
1633        "type.googleapis.com/google.cloud.storagebatchoperations.v1.Manifest"
1634    }
1635}
1636
1637/// Describes prefixes of objects to be transformed.
1638#[derive(Clone, Default, PartialEq)]
1639#[non_exhaustive]
1640pub struct PrefixList {
1641    /// Optional. Include prefixes of the objects to be transformed.
1642    ///
1643    /// * Supports full object name
1644    /// * Supports prefix of the object name
1645    /// * Wildcards are not supported
1646    /// * Supports empty string for all objects in a bucket.
1647    pub included_object_prefixes: std::vec::Vec<std::string::String>,
1648
1649    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1650}
1651
1652impl PrefixList {
1653    pub fn new() -> Self {
1654        std::default::Default::default()
1655    }
1656
1657    /// Sets the value of [included_object_prefixes][crate::model::PrefixList::included_object_prefixes].
1658    ///
1659    /// # Example
1660    /// ```ignore,no_run
1661    /// # use google_cloud_storagebatchoperations_v1::model::PrefixList;
1662    /// let x = PrefixList::new().set_included_object_prefixes(["a", "b", "c"]);
1663    /// ```
1664    pub fn set_included_object_prefixes<T, V>(mut self, v: T) -> Self
1665    where
1666        T: std::iter::IntoIterator<Item = V>,
1667        V: std::convert::Into<std::string::String>,
1668    {
1669        use std::iter::Iterator;
1670        self.included_object_prefixes = v.into_iter().map(|i| i.into()).collect();
1671        self
1672    }
1673}
1674
1675impl wkt::message::Message for PrefixList {
1676    fn typename() -> &'static str {
1677        "type.googleapis.com/google.cloud.storagebatchoperations.v1.PrefixList"
1678    }
1679}
1680
1681/// Describes options to update object hold.
1682#[derive(Clone, Default, PartialEq)]
1683#[non_exhaustive]
1684pub struct PutObjectHold {
1685    /// Required. Updates object temporary holds state. When object temporary hold
1686    /// is set, object cannot be deleted or replaced.
1687    pub temporary_hold: crate::model::put_object_hold::HoldStatus,
1688
1689    /// Required. Updates object event based holds state. When object event based
1690    /// hold is set, object cannot be deleted or replaced. Resets object's time in
1691    /// the bucket for the purposes of the retention period.
1692    pub event_based_hold: crate::model::put_object_hold::HoldStatus,
1693
1694    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1695}
1696
1697impl PutObjectHold {
1698    pub fn new() -> Self {
1699        std::default::Default::default()
1700    }
1701
1702    /// Sets the value of [temporary_hold][crate::model::PutObjectHold::temporary_hold].
1703    ///
1704    /// # Example
1705    /// ```ignore,no_run
1706    /// # use google_cloud_storagebatchoperations_v1::model::PutObjectHold;
1707    /// use google_cloud_storagebatchoperations_v1::model::put_object_hold::HoldStatus;
1708    /// let x0 = PutObjectHold::new().set_temporary_hold(HoldStatus::Set);
1709    /// let x1 = PutObjectHold::new().set_temporary_hold(HoldStatus::Unset);
1710    /// ```
1711    pub fn set_temporary_hold<T: std::convert::Into<crate::model::put_object_hold::HoldStatus>>(
1712        mut self,
1713        v: T,
1714    ) -> Self {
1715        self.temporary_hold = v.into();
1716        self
1717    }
1718
1719    /// Sets the value of [event_based_hold][crate::model::PutObjectHold::event_based_hold].
1720    ///
1721    /// # Example
1722    /// ```ignore,no_run
1723    /// # use google_cloud_storagebatchoperations_v1::model::PutObjectHold;
1724    /// use google_cloud_storagebatchoperations_v1::model::put_object_hold::HoldStatus;
1725    /// let x0 = PutObjectHold::new().set_event_based_hold(HoldStatus::Set);
1726    /// let x1 = PutObjectHold::new().set_event_based_hold(HoldStatus::Unset);
1727    /// ```
1728    pub fn set_event_based_hold<
1729        T: std::convert::Into<crate::model::put_object_hold::HoldStatus>,
1730    >(
1731        mut self,
1732        v: T,
1733    ) -> Self {
1734        self.event_based_hold = v.into();
1735        self
1736    }
1737}
1738
1739impl wkt::message::Message for PutObjectHold {
1740    fn typename() -> &'static str {
1741        "type.googleapis.com/google.cloud.storagebatchoperations.v1.PutObjectHold"
1742    }
1743}
1744
1745/// Defines additional types related to [PutObjectHold].
1746pub mod put_object_hold {
1747    #[allow(unused_imports)]
1748    use super::*;
1749
1750    /// Describes the status of the hold.
1751    ///
1752    /// # Working with unknown values
1753    ///
1754    /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
1755    /// additional enum variants at any time. Adding new variants is not considered
1756    /// a breaking change. Applications should write their code in anticipation of:
1757    ///
1758    /// - New values appearing in future releases of the client library, **and**
1759    /// - New values received dynamically, without application changes.
1760    ///
1761    /// Please consult the [Working with enums] section in the user guide for some
1762    /// guidelines.
1763    ///
1764    /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
1765    #[derive(Clone, Debug, PartialEq)]
1766    #[non_exhaustive]
1767    pub enum HoldStatus {
1768        /// Default value, Object hold status will not be changed.
1769        Unspecified,
1770        /// Places the hold.
1771        Set,
1772        /// Releases the hold.
1773        Unset,
1774        /// If set, the enum was initialized with an unknown value.
1775        ///
1776        /// Applications can examine the value using [HoldStatus::value] or
1777        /// [HoldStatus::name].
1778        UnknownValue(hold_status::UnknownValue),
1779    }
1780
1781    #[doc(hidden)]
1782    pub mod hold_status {
1783        #[allow(unused_imports)]
1784        use super::*;
1785        #[derive(Clone, Debug, PartialEq)]
1786        pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
1787    }
1788
1789    impl HoldStatus {
1790        /// Gets the enum value.
1791        ///
1792        /// Returns `None` if the enum contains an unknown value deserialized from
1793        /// the string representation of enums.
1794        pub fn value(&self) -> std::option::Option<i32> {
1795            match self {
1796                Self::Unspecified => std::option::Option::Some(0),
1797                Self::Set => std::option::Option::Some(1),
1798                Self::Unset => std::option::Option::Some(2),
1799                Self::UnknownValue(u) => u.0.value(),
1800            }
1801        }
1802
1803        /// Gets the enum value as a string.
1804        ///
1805        /// Returns `None` if the enum contains an unknown value deserialized from
1806        /// the integer representation of enums.
1807        pub fn name(&self) -> std::option::Option<&str> {
1808            match self {
1809                Self::Unspecified => std::option::Option::Some("HOLD_STATUS_UNSPECIFIED"),
1810                Self::Set => std::option::Option::Some("SET"),
1811                Self::Unset => std::option::Option::Some("UNSET"),
1812                Self::UnknownValue(u) => u.0.name(),
1813            }
1814        }
1815    }
1816
1817    impl std::default::Default for HoldStatus {
1818        fn default() -> Self {
1819            use std::convert::From;
1820            Self::from(0)
1821        }
1822    }
1823
1824    impl std::fmt::Display for HoldStatus {
1825        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
1826            wkt::internal::display_enum(f, self.name(), self.value())
1827        }
1828    }
1829
1830    impl std::convert::From<i32> for HoldStatus {
1831        fn from(value: i32) -> Self {
1832            match value {
1833                0 => Self::Unspecified,
1834                1 => Self::Set,
1835                2 => Self::Unset,
1836                _ => Self::UnknownValue(hold_status::UnknownValue(
1837                    wkt::internal::UnknownEnumValue::Integer(value),
1838                )),
1839            }
1840        }
1841    }
1842
1843    impl std::convert::From<&str> for HoldStatus {
1844        fn from(value: &str) -> Self {
1845            use std::string::ToString;
1846            match value {
1847                "HOLD_STATUS_UNSPECIFIED" => Self::Unspecified,
1848                "SET" => Self::Set,
1849                "UNSET" => Self::Unset,
1850                _ => Self::UnknownValue(hold_status::UnknownValue(
1851                    wkt::internal::UnknownEnumValue::String(value.to_string()),
1852                )),
1853            }
1854        }
1855    }
1856
1857    impl serde::ser::Serialize for HoldStatus {
1858        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
1859        where
1860            S: serde::Serializer,
1861        {
1862            match self {
1863                Self::Unspecified => serializer.serialize_i32(0),
1864                Self::Set => serializer.serialize_i32(1),
1865                Self::Unset => serializer.serialize_i32(2),
1866                Self::UnknownValue(u) => u.0.serialize(serializer),
1867            }
1868        }
1869    }
1870
1871    impl<'de> serde::de::Deserialize<'de> for HoldStatus {
1872        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
1873        where
1874            D: serde::Deserializer<'de>,
1875        {
1876            deserializer.deserialize_any(wkt::internal::EnumVisitor::<HoldStatus>::new(
1877                ".google.cloud.storagebatchoperations.v1.PutObjectHold.HoldStatus",
1878            ))
1879        }
1880    }
1881}
1882
1883/// Describes options to delete an object.
1884#[derive(Clone, Default, PartialEq)]
1885#[non_exhaustive]
1886pub struct DeleteObject {
1887    /// Required. Controls deletion behavior when versioning is enabled for the
1888    /// object's bucket. If true both live and noncurrent objects will be
1889    /// permanently deleted. Otherwise live objects in versioned buckets will
1890    /// become noncurrent and objects that were already noncurrent will be skipped.
1891    /// This setting doesn't have any impact on the Soft Delete feature. All
1892    /// objects deleted by this service can be be restored for the duration of the
1893    /// Soft Delete retention duration if enabled. If enabled and the manifest
1894    /// doesn't specify an object's generation, a GetObjectMetadata call (a Class B
1895    /// operation) will be made to determine the live object generation.
1896    pub permanent_object_deletion_enabled: bool,
1897
1898    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1899}
1900
1901impl DeleteObject {
1902    pub fn new() -> Self {
1903        std::default::Default::default()
1904    }
1905
1906    /// Sets the value of [permanent_object_deletion_enabled][crate::model::DeleteObject::permanent_object_deletion_enabled].
1907    ///
1908    /// # Example
1909    /// ```ignore,no_run
1910    /// # use google_cloud_storagebatchoperations_v1::model::DeleteObject;
1911    /// let x = DeleteObject::new().set_permanent_object_deletion_enabled(true);
1912    /// ```
1913    pub fn set_permanent_object_deletion_enabled<T: std::convert::Into<bool>>(
1914        mut self,
1915        v: T,
1916    ) -> Self {
1917        self.permanent_object_deletion_enabled = v.into();
1918        self
1919    }
1920}
1921
1922impl wkt::message::Message for DeleteObject {
1923    fn typename() -> &'static str {
1924        "type.googleapis.com/google.cloud.storagebatchoperations.v1.DeleteObject"
1925    }
1926}
1927
1928/// Describes options for object rewrite.
1929#[derive(Clone, Default, PartialEq)]
1930#[non_exhaustive]
1931pub struct RewriteObject {
1932    /// Required. Resource name of the Cloud KMS key that will be used to encrypt
1933    /// the object. The Cloud KMS key must be located in same location as the
1934    /// object. Refer to
1935    /// <https://cloud.google.com/storage/docs/encryption/using-customer-managed-keys#add-object-key>
1936    /// for additional documentation. Format:
1937    /// projects/{project}/locations/{location}/keyRings/{keyring}/cryptoKeys/{key}
1938    /// For example:
1939    /// "projects/123456/locations/us-central1/keyRings/my-keyring/cryptoKeys/my-key".
1940    /// The object will be rewritten and set with the specified KMS key.
1941    pub kms_key: std::option::Option<std::string::String>,
1942
1943    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1944}
1945
1946impl RewriteObject {
1947    pub fn new() -> Self {
1948        std::default::Default::default()
1949    }
1950
1951    /// Sets the value of [kms_key][crate::model::RewriteObject::kms_key].
1952    ///
1953    /// # Example
1954    /// ```ignore,no_run
1955    /// # use google_cloud_storagebatchoperations_v1::model::RewriteObject;
1956    /// let x = RewriteObject::new().set_kms_key("example");
1957    /// ```
1958    pub fn set_kms_key<T>(mut self, v: T) -> Self
1959    where
1960        T: std::convert::Into<std::string::String>,
1961    {
1962        self.kms_key = std::option::Option::Some(v.into());
1963        self
1964    }
1965
1966    /// Sets or clears the value of [kms_key][crate::model::RewriteObject::kms_key].
1967    ///
1968    /// # Example
1969    /// ```ignore,no_run
1970    /// # use google_cloud_storagebatchoperations_v1::model::RewriteObject;
1971    /// let x = RewriteObject::new().set_or_clear_kms_key(Some("example"));
1972    /// let x = RewriteObject::new().set_or_clear_kms_key(None::<String>);
1973    /// ```
1974    pub fn set_or_clear_kms_key<T>(mut self, v: std::option::Option<T>) -> Self
1975    where
1976        T: std::convert::Into<std::string::String>,
1977    {
1978        self.kms_key = v.map(|x| x.into());
1979        self
1980    }
1981}
1982
1983impl wkt::message::Message for RewriteObject {
1984    fn typename() -> &'static str {
1985        "type.googleapis.com/google.cloud.storagebatchoperations.v1.RewriteObject"
1986    }
1987}
1988
1989/// Describes options for object retention update.
1990#[derive(Clone, Default, PartialEq)]
1991#[non_exhaustive]
1992pub struct ObjectRetention {
1993    /// Required. The time when the object will be retained until. UNSET will clear
1994    /// the retention. Must be specified in RFC 3339 format e.g.
1995    /// YYYY-MM-DD'T'HH:MM:SS.SS'Z' or YYYY-MM-DD'T'HH:MM:SS'Z'.
1996    pub retain_until_time: std::option::Option<std::string::String>,
1997
1998    /// Required. The retention mode of the object.
1999    pub retention_mode: std::option::Option<crate::model::object_retention::RetentionMode>,
2000
2001    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2002}
2003
2004impl ObjectRetention {
2005    pub fn new() -> Self {
2006        std::default::Default::default()
2007    }
2008
2009    /// Sets the value of [retain_until_time][crate::model::ObjectRetention::retain_until_time].
2010    ///
2011    /// # Example
2012    /// ```ignore,no_run
2013    /// # use google_cloud_storagebatchoperations_v1::model::ObjectRetention;
2014    /// let x = ObjectRetention::new().set_retain_until_time("example");
2015    /// ```
2016    pub fn set_retain_until_time<T>(mut self, v: T) -> Self
2017    where
2018        T: std::convert::Into<std::string::String>,
2019    {
2020        self.retain_until_time = std::option::Option::Some(v.into());
2021        self
2022    }
2023
2024    /// Sets or clears the value of [retain_until_time][crate::model::ObjectRetention::retain_until_time].
2025    ///
2026    /// # Example
2027    /// ```ignore,no_run
2028    /// # use google_cloud_storagebatchoperations_v1::model::ObjectRetention;
2029    /// let x = ObjectRetention::new().set_or_clear_retain_until_time(Some("example"));
2030    /// let x = ObjectRetention::new().set_or_clear_retain_until_time(None::<String>);
2031    /// ```
2032    pub fn set_or_clear_retain_until_time<T>(mut self, v: std::option::Option<T>) -> Self
2033    where
2034        T: std::convert::Into<std::string::String>,
2035    {
2036        self.retain_until_time = v.map(|x| x.into());
2037        self
2038    }
2039
2040    /// Sets the value of [retention_mode][crate::model::ObjectRetention::retention_mode].
2041    ///
2042    /// # Example
2043    /// ```ignore,no_run
2044    /// # use google_cloud_storagebatchoperations_v1::model::ObjectRetention;
2045    /// use google_cloud_storagebatchoperations_v1::model::object_retention::RetentionMode;
2046    /// let x0 = ObjectRetention::new().set_retention_mode(RetentionMode::Locked);
2047    /// let x1 = ObjectRetention::new().set_retention_mode(RetentionMode::Unlocked);
2048    /// ```
2049    pub fn set_retention_mode<T>(mut self, v: T) -> Self
2050    where
2051        T: std::convert::Into<crate::model::object_retention::RetentionMode>,
2052    {
2053        self.retention_mode = std::option::Option::Some(v.into());
2054        self
2055    }
2056
2057    /// Sets or clears the value of [retention_mode][crate::model::ObjectRetention::retention_mode].
2058    ///
2059    /// # Example
2060    /// ```ignore,no_run
2061    /// # use google_cloud_storagebatchoperations_v1::model::ObjectRetention;
2062    /// use google_cloud_storagebatchoperations_v1::model::object_retention::RetentionMode;
2063    /// let x0 = ObjectRetention::new().set_or_clear_retention_mode(Some(RetentionMode::Locked));
2064    /// let x1 = ObjectRetention::new().set_or_clear_retention_mode(Some(RetentionMode::Unlocked));
2065    /// let x_none = ObjectRetention::new().set_or_clear_retention_mode(None::<RetentionMode>);
2066    /// ```
2067    pub fn set_or_clear_retention_mode<T>(mut self, v: std::option::Option<T>) -> Self
2068    where
2069        T: std::convert::Into<crate::model::object_retention::RetentionMode>,
2070    {
2071        self.retention_mode = v.map(|x| x.into());
2072        self
2073    }
2074}
2075
2076impl wkt::message::Message for ObjectRetention {
2077    fn typename() -> &'static str {
2078        "type.googleapis.com/google.cloud.storagebatchoperations.v1.ObjectRetention"
2079    }
2080}
2081
2082/// Defines additional types related to [ObjectRetention].
2083pub mod object_retention {
2084    #[allow(unused_imports)]
2085    use super::*;
2086
2087    /// Describes the retention mode.
2088    ///
2089    /// # Working with unknown values
2090    ///
2091    /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
2092    /// additional enum variants at any time. Adding new variants is not considered
2093    /// a breaking change. Applications should write their code in anticipation of:
2094    ///
2095    /// - New values appearing in future releases of the client library, **and**
2096    /// - New values received dynamically, without application changes.
2097    ///
2098    /// Please consult the [Working with enums] section in the user guide for some
2099    /// guidelines.
2100    ///
2101    /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
2102    #[derive(Clone, Debug, PartialEq)]
2103    #[non_exhaustive]
2104    pub enum RetentionMode {
2105        /// If set and retain_until_time is empty, clears the retention.
2106        Unspecified,
2107        /// Sets the retention mode to locked.
2108        Locked,
2109        /// Sets the retention mode to unlocked.
2110        Unlocked,
2111        /// If set, the enum was initialized with an unknown value.
2112        ///
2113        /// Applications can examine the value using [RetentionMode::value] or
2114        /// [RetentionMode::name].
2115        UnknownValue(retention_mode::UnknownValue),
2116    }
2117
2118    #[doc(hidden)]
2119    pub mod retention_mode {
2120        #[allow(unused_imports)]
2121        use super::*;
2122        #[derive(Clone, Debug, PartialEq)]
2123        pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
2124    }
2125
2126    impl RetentionMode {
2127        /// Gets the enum value.
2128        ///
2129        /// Returns `None` if the enum contains an unknown value deserialized from
2130        /// the string representation of enums.
2131        pub fn value(&self) -> std::option::Option<i32> {
2132            match self {
2133                Self::Unspecified => std::option::Option::Some(0),
2134                Self::Locked => std::option::Option::Some(1),
2135                Self::Unlocked => std::option::Option::Some(2),
2136                Self::UnknownValue(u) => u.0.value(),
2137            }
2138        }
2139
2140        /// Gets the enum value as a string.
2141        ///
2142        /// Returns `None` if the enum contains an unknown value deserialized from
2143        /// the integer representation of enums.
2144        pub fn name(&self) -> std::option::Option<&str> {
2145            match self {
2146                Self::Unspecified => std::option::Option::Some("RETENTION_MODE_UNSPECIFIED"),
2147                Self::Locked => std::option::Option::Some("LOCKED"),
2148                Self::Unlocked => std::option::Option::Some("UNLOCKED"),
2149                Self::UnknownValue(u) => u.0.name(),
2150            }
2151        }
2152    }
2153
2154    impl std::default::Default for RetentionMode {
2155        fn default() -> Self {
2156            use std::convert::From;
2157            Self::from(0)
2158        }
2159    }
2160
2161    impl std::fmt::Display for RetentionMode {
2162        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
2163            wkt::internal::display_enum(f, self.name(), self.value())
2164        }
2165    }
2166
2167    impl std::convert::From<i32> for RetentionMode {
2168        fn from(value: i32) -> Self {
2169            match value {
2170                0 => Self::Unspecified,
2171                1 => Self::Locked,
2172                2 => Self::Unlocked,
2173                _ => Self::UnknownValue(retention_mode::UnknownValue(
2174                    wkt::internal::UnknownEnumValue::Integer(value),
2175                )),
2176            }
2177        }
2178    }
2179
2180    impl std::convert::From<&str> for RetentionMode {
2181        fn from(value: &str) -> Self {
2182            use std::string::ToString;
2183            match value {
2184                "RETENTION_MODE_UNSPECIFIED" => Self::Unspecified,
2185                "LOCKED" => Self::Locked,
2186                "UNLOCKED" => Self::Unlocked,
2187                _ => Self::UnknownValue(retention_mode::UnknownValue(
2188                    wkt::internal::UnknownEnumValue::String(value.to_string()),
2189                )),
2190            }
2191        }
2192    }
2193
2194    impl serde::ser::Serialize for RetentionMode {
2195        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
2196        where
2197            S: serde::Serializer,
2198        {
2199            match self {
2200                Self::Unspecified => serializer.serialize_i32(0),
2201                Self::Locked => serializer.serialize_i32(1),
2202                Self::Unlocked => serializer.serialize_i32(2),
2203                Self::UnknownValue(u) => u.0.serialize(serializer),
2204            }
2205        }
2206    }
2207
2208    impl<'de> serde::de::Deserialize<'de> for RetentionMode {
2209        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
2210        where
2211            D: serde::Deserializer<'de>,
2212        {
2213            deserializer.deserialize_any(wkt::internal::EnumVisitor::<RetentionMode>::new(
2214                ".google.cloud.storagebatchoperations.v1.ObjectRetention.RetentionMode",
2215            ))
2216        }
2217    }
2218}
2219
2220/// Describes options for object metadata update.
2221#[derive(Clone, Default, PartialEq)]
2222#[non_exhaustive]
2223pub struct PutMetadata {
2224    /// Optional. Updates objects Content-Disposition fixed metadata. Unset values
2225    /// will be ignored. Set empty values to clear the metadata. Refer
2226    /// <https://cloud.google.com/storage/docs/metadata#content-disposition> for
2227    /// additional documentation.
2228    pub content_disposition: std::option::Option<std::string::String>,
2229
2230    /// Optional. Updates objects Content-Encoding fixed metadata. Unset values
2231    /// will be ignored. Set empty values to clear the metadata. Refer to
2232    /// documentation in
2233    /// <https://cloud.google.com/storage/docs/metadata#content-encoding>.
2234    pub content_encoding: std::option::Option<std::string::String>,
2235
2236    /// Optional. Updates objects Content-Language fixed metadata. Refer to ISO
2237    /// 639-1 language codes for typical values of this metadata. Max length 100
2238    /// characters. Unset values will be ignored. Set empty values to clear the
2239    /// metadata. Refer to documentation in
2240    /// <https://cloud.google.com/storage/docs/metadata#content-language>.
2241    pub content_language: std::option::Option<std::string::String>,
2242
2243    /// Optional. Updates objects Content-Type fixed metadata. Unset values will be
2244    /// ignored. Set empty values to clear the metadata. Refer to documentation in
2245    /// <https://cloud.google.com/storage/docs/metadata#content-type>
2246    pub content_type: std::option::Option<std::string::String>,
2247
2248    /// Optional. Updates objects Cache-Control fixed metadata. Unset values will
2249    /// be ignored. Set empty values to clear the metadata. Additionally, the value
2250    /// for Custom-Time cannot decrease. Refer to documentation in
2251    /// <https://cloud.google.com/storage/docs/metadata#caching_data>.
2252    pub cache_control: std::option::Option<std::string::String>,
2253
2254    /// Optional. Updates objects Custom-Time fixed metadata. Unset values will be
2255    /// ignored. Set empty values to clear the metadata. Refer to documentation in
2256    /// <https://cloud.google.com/storage/docs/metadata#custom-time>.
2257    pub custom_time: std::option::Option<std::string::String>,
2258
2259    /// Optional. Updates objects custom metadata. Adds or sets individual custom
2260    /// metadata key value pairs on objects. Keys that are set with empty custom
2261    /// metadata values will have its value cleared. Existing custom metadata not
2262    /// specified with this flag is not changed. Refer to documentation in
2263    /// <https://cloud.google.com/storage/docs/metadata#custom-metadata>
2264    pub custom_metadata: std::collections::HashMap<std::string::String, std::string::String>,
2265
2266    /// Optional. Updates objects retention lock configuration. Unset values will
2267    /// be ignored. Set empty values to clear the retention for the object with
2268    /// existing `Unlocked` retention mode. Object with existing `Locked` retention
2269    /// mode cannot be cleared or reduce retain_until_time. Refer to documentation
2270    /// in <https://cloud.google.com/storage/docs/object-lock>
2271    pub object_retention: std::option::Option<crate::model::ObjectRetention>,
2272
2273    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2274}
2275
2276impl PutMetadata {
2277    pub fn new() -> Self {
2278        std::default::Default::default()
2279    }
2280
2281    /// Sets the value of [content_disposition][crate::model::PutMetadata::content_disposition].
2282    ///
2283    /// # Example
2284    /// ```ignore,no_run
2285    /// # use google_cloud_storagebatchoperations_v1::model::PutMetadata;
2286    /// let x = PutMetadata::new().set_content_disposition("example");
2287    /// ```
2288    pub fn set_content_disposition<T>(mut self, v: T) -> Self
2289    where
2290        T: std::convert::Into<std::string::String>,
2291    {
2292        self.content_disposition = std::option::Option::Some(v.into());
2293        self
2294    }
2295
2296    /// Sets or clears the value of [content_disposition][crate::model::PutMetadata::content_disposition].
2297    ///
2298    /// # Example
2299    /// ```ignore,no_run
2300    /// # use google_cloud_storagebatchoperations_v1::model::PutMetadata;
2301    /// let x = PutMetadata::new().set_or_clear_content_disposition(Some("example"));
2302    /// let x = PutMetadata::new().set_or_clear_content_disposition(None::<String>);
2303    /// ```
2304    pub fn set_or_clear_content_disposition<T>(mut self, v: std::option::Option<T>) -> Self
2305    where
2306        T: std::convert::Into<std::string::String>,
2307    {
2308        self.content_disposition = v.map(|x| x.into());
2309        self
2310    }
2311
2312    /// Sets the value of [content_encoding][crate::model::PutMetadata::content_encoding].
2313    ///
2314    /// # Example
2315    /// ```ignore,no_run
2316    /// # use google_cloud_storagebatchoperations_v1::model::PutMetadata;
2317    /// let x = PutMetadata::new().set_content_encoding("example");
2318    /// ```
2319    pub fn set_content_encoding<T>(mut self, v: T) -> Self
2320    where
2321        T: std::convert::Into<std::string::String>,
2322    {
2323        self.content_encoding = std::option::Option::Some(v.into());
2324        self
2325    }
2326
2327    /// Sets or clears the value of [content_encoding][crate::model::PutMetadata::content_encoding].
2328    ///
2329    /// # Example
2330    /// ```ignore,no_run
2331    /// # use google_cloud_storagebatchoperations_v1::model::PutMetadata;
2332    /// let x = PutMetadata::new().set_or_clear_content_encoding(Some("example"));
2333    /// let x = PutMetadata::new().set_or_clear_content_encoding(None::<String>);
2334    /// ```
2335    pub fn set_or_clear_content_encoding<T>(mut self, v: std::option::Option<T>) -> Self
2336    where
2337        T: std::convert::Into<std::string::String>,
2338    {
2339        self.content_encoding = v.map(|x| x.into());
2340        self
2341    }
2342
2343    /// Sets the value of [content_language][crate::model::PutMetadata::content_language].
2344    ///
2345    /// # Example
2346    /// ```ignore,no_run
2347    /// # use google_cloud_storagebatchoperations_v1::model::PutMetadata;
2348    /// let x = PutMetadata::new().set_content_language("example");
2349    /// ```
2350    pub fn set_content_language<T>(mut self, v: T) -> Self
2351    where
2352        T: std::convert::Into<std::string::String>,
2353    {
2354        self.content_language = std::option::Option::Some(v.into());
2355        self
2356    }
2357
2358    /// Sets or clears the value of [content_language][crate::model::PutMetadata::content_language].
2359    ///
2360    /// # Example
2361    /// ```ignore,no_run
2362    /// # use google_cloud_storagebatchoperations_v1::model::PutMetadata;
2363    /// let x = PutMetadata::new().set_or_clear_content_language(Some("example"));
2364    /// let x = PutMetadata::new().set_or_clear_content_language(None::<String>);
2365    /// ```
2366    pub fn set_or_clear_content_language<T>(mut self, v: std::option::Option<T>) -> Self
2367    where
2368        T: std::convert::Into<std::string::String>,
2369    {
2370        self.content_language = v.map(|x| x.into());
2371        self
2372    }
2373
2374    /// Sets the value of [content_type][crate::model::PutMetadata::content_type].
2375    ///
2376    /// # Example
2377    /// ```ignore,no_run
2378    /// # use google_cloud_storagebatchoperations_v1::model::PutMetadata;
2379    /// let x = PutMetadata::new().set_content_type("example");
2380    /// ```
2381    pub fn set_content_type<T>(mut self, v: T) -> Self
2382    where
2383        T: std::convert::Into<std::string::String>,
2384    {
2385        self.content_type = std::option::Option::Some(v.into());
2386        self
2387    }
2388
2389    /// Sets or clears the value of [content_type][crate::model::PutMetadata::content_type].
2390    ///
2391    /// # Example
2392    /// ```ignore,no_run
2393    /// # use google_cloud_storagebatchoperations_v1::model::PutMetadata;
2394    /// let x = PutMetadata::new().set_or_clear_content_type(Some("example"));
2395    /// let x = PutMetadata::new().set_or_clear_content_type(None::<String>);
2396    /// ```
2397    pub fn set_or_clear_content_type<T>(mut self, v: std::option::Option<T>) -> Self
2398    where
2399        T: std::convert::Into<std::string::String>,
2400    {
2401        self.content_type = v.map(|x| x.into());
2402        self
2403    }
2404
2405    /// Sets the value of [cache_control][crate::model::PutMetadata::cache_control].
2406    ///
2407    /// # Example
2408    /// ```ignore,no_run
2409    /// # use google_cloud_storagebatchoperations_v1::model::PutMetadata;
2410    /// let x = PutMetadata::new().set_cache_control("example");
2411    /// ```
2412    pub fn set_cache_control<T>(mut self, v: T) -> Self
2413    where
2414        T: std::convert::Into<std::string::String>,
2415    {
2416        self.cache_control = std::option::Option::Some(v.into());
2417        self
2418    }
2419
2420    /// Sets or clears the value of [cache_control][crate::model::PutMetadata::cache_control].
2421    ///
2422    /// # Example
2423    /// ```ignore,no_run
2424    /// # use google_cloud_storagebatchoperations_v1::model::PutMetadata;
2425    /// let x = PutMetadata::new().set_or_clear_cache_control(Some("example"));
2426    /// let x = PutMetadata::new().set_or_clear_cache_control(None::<String>);
2427    /// ```
2428    pub fn set_or_clear_cache_control<T>(mut self, v: std::option::Option<T>) -> Self
2429    where
2430        T: std::convert::Into<std::string::String>,
2431    {
2432        self.cache_control = v.map(|x| x.into());
2433        self
2434    }
2435
2436    /// Sets the value of [custom_time][crate::model::PutMetadata::custom_time].
2437    ///
2438    /// # Example
2439    /// ```ignore,no_run
2440    /// # use google_cloud_storagebatchoperations_v1::model::PutMetadata;
2441    /// let x = PutMetadata::new().set_custom_time("example");
2442    /// ```
2443    pub fn set_custom_time<T>(mut self, v: T) -> Self
2444    where
2445        T: std::convert::Into<std::string::String>,
2446    {
2447        self.custom_time = std::option::Option::Some(v.into());
2448        self
2449    }
2450
2451    /// Sets or clears the value of [custom_time][crate::model::PutMetadata::custom_time].
2452    ///
2453    /// # Example
2454    /// ```ignore,no_run
2455    /// # use google_cloud_storagebatchoperations_v1::model::PutMetadata;
2456    /// let x = PutMetadata::new().set_or_clear_custom_time(Some("example"));
2457    /// let x = PutMetadata::new().set_or_clear_custom_time(None::<String>);
2458    /// ```
2459    pub fn set_or_clear_custom_time<T>(mut self, v: std::option::Option<T>) -> Self
2460    where
2461        T: std::convert::Into<std::string::String>,
2462    {
2463        self.custom_time = v.map(|x| x.into());
2464        self
2465    }
2466
2467    /// Sets the value of [custom_metadata][crate::model::PutMetadata::custom_metadata].
2468    ///
2469    /// # Example
2470    /// ```ignore,no_run
2471    /// # use google_cloud_storagebatchoperations_v1::model::PutMetadata;
2472    /// let x = PutMetadata::new().set_custom_metadata([
2473    ///     ("key0", "abc"),
2474    ///     ("key1", "xyz"),
2475    /// ]);
2476    /// ```
2477    pub fn set_custom_metadata<T, K, V>(mut self, v: T) -> Self
2478    where
2479        T: std::iter::IntoIterator<Item = (K, V)>,
2480        K: std::convert::Into<std::string::String>,
2481        V: std::convert::Into<std::string::String>,
2482    {
2483        use std::iter::Iterator;
2484        self.custom_metadata = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
2485        self
2486    }
2487
2488    /// Sets the value of [object_retention][crate::model::PutMetadata::object_retention].
2489    ///
2490    /// # Example
2491    /// ```ignore,no_run
2492    /// # use google_cloud_storagebatchoperations_v1::model::PutMetadata;
2493    /// use google_cloud_storagebatchoperations_v1::model::ObjectRetention;
2494    /// let x = PutMetadata::new().set_object_retention(ObjectRetention::default()/* use setters */);
2495    /// ```
2496    pub fn set_object_retention<T>(mut self, v: T) -> Self
2497    where
2498        T: std::convert::Into<crate::model::ObjectRetention>,
2499    {
2500        self.object_retention = std::option::Option::Some(v.into());
2501        self
2502    }
2503
2504    /// Sets or clears the value of [object_retention][crate::model::PutMetadata::object_retention].
2505    ///
2506    /// # Example
2507    /// ```ignore,no_run
2508    /// # use google_cloud_storagebatchoperations_v1::model::PutMetadata;
2509    /// use google_cloud_storagebatchoperations_v1::model::ObjectRetention;
2510    /// let x = PutMetadata::new().set_or_clear_object_retention(Some(ObjectRetention::default()/* use setters */));
2511    /// let x = PutMetadata::new().set_or_clear_object_retention(None::<ObjectRetention>);
2512    /// ```
2513    pub fn set_or_clear_object_retention<T>(mut self, v: std::option::Option<T>) -> Self
2514    where
2515        T: std::convert::Into<crate::model::ObjectRetention>,
2516    {
2517        self.object_retention = v.map(|x| x.into());
2518        self
2519    }
2520}
2521
2522impl wkt::message::Message for PutMetadata {
2523    fn typename() -> &'static str {
2524        "type.googleapis.com/google.cloud.storagebatchoperations.v1.PutMetadata"
2525    }
2526}
2527
2528/// A summary of errors by error code, plus a count and sample error log
2529/// entries.
2530#[derive(Clone, Default, PartialEq)]
2531#[non_exhaustive]
2532pub struct ErrorSummary {
2533    /// Required. The canonical error code.
2534    pub error_code: rpc::model::Code,
2535
2536    /// Required. Number of errors encountered per `error_code`.
2537    pub error_count: i64,
2538
2539    /// Required. Sample error logs.
2540    pub error_log_entries: std::vec::Vec<crate::model::ErrorLogEntry>,
2541
2542    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2543}
2544
2545impl ErrorSummary {
2546    pub fn new() -> Self {
2547        std::default::Default::default()
2548    }
2549
2550    /// Sets the value of [error_code][crate::model::ErrorSummary::error_code].
2551    ///
2552    /// # Example
2553    /// ```ignore,no_run
2554    /// # use google_cloud_storagebatchoperations_v1::model::ErrorSummary;
2555    /// use rpc::model::Code;
2556    /// let x0 = ErrorSummary::new().set_error_code(Code::Cancelled);
2557    /// let x1 = ErrorSummary::new().set_error_code(Code::Unknown);
2558    /// let x2 = ErrorSummary::new().set_error_code(Code::InvalidArgument);
2559    /// ```
2560    pub fn set_error_code<T: std::convert::Into<rpc::model::Code>>(mut self, v: T) -> Self {
2561        self.error_code = v.into();
2562        self
2563    }
2564
2565    /// Sets the value of [error_count][crate::model::ErrorSummary::error_count].
2566    ///
2567    /// # Example
2568    /// ```ignore,no_run
2569    /// # use google_cloud_storagebatchoperations_v1::model::ErrorSummary;
2570    /// let x = ErrorSummary::new().set_error_count(42);
2571    /// ```
2572    pub fn set_error_count<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
2573        self.error_count = v.into();
2574        self
2575    }
2576
2577    /// Sets the value of [error_log_entries][crate::model::ErrorSummary::error_log_entries].
2578    ///
2579    /// # Example
2580    /// ```ignore,no_run
2581    /// # use google_cloud_storagebatchoperations_v1::model::ErrorSummary;
2582    /// use google_cloud_storagebatchoperations_v1::model::ErrorLogEntry;
2583    /// let x = ErrorSummary::new()
2584    ///     .set_error_log_entries([
2585    ///         ErrorLogEntry::default()/* use setters */,
2586    ///         ErrorLogEntry::default()/* use (different) setters */,
2587    ///     ]);
2588    /// ```
2589    pub fn set_error_log_entries<T, V>(mut self, v: T) -> Self
2590    where
2591        T: std::iter::IntoIterator<Item = V>,
2592        V: std::convert::Into<crate::model::ErrorLogEntry>,
2593    {
2594        use std::iter::Iterator;
2595        self.error_log_entries = v.into_iter().map(|i| i.into()).collect();
2596        self
2597    }
2598}
2599
2600impl wkt::message::Message for ErrorSummary {
2601    fn typename() -> &'static str {
2602        "type.googleapis.com/google.cloud.storagebatchoperations.v1.ErrorSummary"
2603    }
2604}
2605
2606/// An entry describing an error that has occurred.
2607#[derive(Clone, Default, PartialEq)]
2608#[non_exhaustive]
2609pub struct ErrorLogEntry {
2610    /// Required. Output only. Object URL. e.g. gs://my_bucket/object.txt
2611    pub object_uri: std::string::String,
2612
2613    /// Optional. Output only. At most 5 error log entries are recorded for a given
2614    /// error code for a job.
2615    pub error_details: std::vec::Vec<std::string::String>,
2616
2617    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2618}
2619
2620impl ErrorLogEntry {
2621    pub fn new() -> Self {
2622        std::default::Default::default()
2623    }
2624
2625    /// Sets the value of [object_uri][crate::model::ErrorLogEntry::object_uri].
2626    ///
2627    /// # Example
2628    /// ```ignore,no_run
2629    /// # use google_cloud_storagebatchoperations_v1::model::ErrorLogEntry;
2630    /// let x = ErrorLogEntry::new().set_object_uri("example");
2631    /// ```
2632    pub fn set_object_uri<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2633        self.object_uri = v.into();
2634        self
2635    }
2636
2637    /// Sets the value of [error_details][crate::model::ErrorLogEntry::error_details].
2638    ///
2639    /// # Example
2640    /// ```ignore,no_run
2641    /// # use google_cloud_storagebatchoperations_v1::model::ErrorLogEntry;
2642    /// let x = ErrorLogEntry::new().set_error_details(["a", "b", "c"]);
2643    /// ```
2644    pub fn set_error_details<T, V>(mut self, v: T) -> Self
2645    where
2646        T: std::iter::IntoIterator<Item = V>,
2647        V: std::convert::Into<std::string::String>,
2648    {
2649        use std::iter::Iterator;
2650        self.error_details = v.into_iter().map(|i| i.into()).collect();
2651        self
2652    }
2653}
2654
2655impl wkt::message::Message for ErrorLogEntry {
2656    fn typename() -> &'static str {
2657        "type.googleapis.com/google.cloud.storagebatchoperations.v1.ErrorLogEntry"
2658    }
2659}
2660
2661/// Describes details about the progress of the job.
2662#[derive(Clone, Default, PartialEq)]
2663#[non_exhaustive]
2664pub struct Counters {
2665    /// Output only. Number of objects listed.
2666    pub total_object_count: i64,
2667
2668    /// Output only. Number of objects completed.
2669    pub succeeded_object_count: i64,
2670
2671    /// Output only. Number of objects failed.
2672    pub failed_object_count: i64,
2673
2674    /// Output only. Number of bytes found from source. This field is only
2675    /// populated for jobs with a prefix list object configuration.
2676    pub total_bytes_found: std::option::Option<i64>,
2677
2678    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2679}
2680
2681impl Counters {
2682    pub fn new() -> Self {
2683        std::default::Default::default()
2684    }
2685
2686    /// Sets the value of [total_object_count][crate::model::Counters::total_object_count].
2687    ///
2688    /// # Example
2689    /// ```ignore,no_run
2690    /// # use google_cloud_storagebatchoperations_v1::model::Counters;
2691    /// let x = Counters::new().set_total_object_count(42);
2692    /// ```
2693    pub fn set_total_object_count<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
2694        self.total_object_count = v.into();
2695        self
2696    }
2697
2698    /// Sets the value of [succeeded_object_count][crate::model::Counters::succeeded_object_count].
2699    ///
2700    /// # Example
2701    /// ```ignore,no_run
2702    /// # use google_cloud_storagebatchoperations_v1::model::Counters;
2703    /// let x = Counters::new().set_succeeded_object_count(42);
2704    /// ```
2705    pub fn set_succeeded_object_count<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
2706        self.succeeded_object_count = v.into();
2707        self
2708    }
2709
2710    /// Sets the value of [failed_object_count][crate::model::Counters::failed_object_count].
2711    ///
2712    /// # Example
2713    /// ```ignore,no_run
2714    /// # use google_cloud_storagebatchoperations_v1::model::Counters;
2715    /// let x = Counters::new().set_failed_object_count(42);
2716    /// ```
2717    pub fn set_failed_object_count<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
2718        self.failed_object_count = v.into();
2719        self
2720    }
2721
2722    /// Sets the value of [total_bytes_found][crate::model::Counters::total_bytes_found].
2723    ///
2724    /// # Example
2725    /// ```ignore,no_run
2726    /// # use google_cloud_storagebatchoperations_v1::model::Counters;
2727    /// let x = Counters::new().set_total_bytes_found(42);
2728    /// ```
2729    pub fn set_total_bytes_found<T>(mut self, v: T) -> Self
2730    where
2731        T: std::convert::Into<i64>,
2732    {
2733        self.total_bytes_found = std::option::Option::Some(v.into());
2734        self
2735    }
2736
2737    /// Sets or clears the value of [total_bytes_found][crate::model::Counters::total_bytes_found].
2738    ///
2739    /// # Example
2740    /// ```ignore,no_run
2741    /// # use google_cloud_storagebatchoperations_v1::model::Counters;
2742    /// let x = Counters::new().set_or_clear_total_bytes_found(Some(42));
2743    /// let x = Counters::new().set_or_clear_total_bytes_found(None::<i32>);
2744    /// ```
2745    pub fn set_or_clear_total_bytes_found<T>(mut self, v: std::option::Option<T>) -> Self
2746    where
2747        T: std::convert::Into<i64>,
2748    {
2749        self.total_bytes_found = v.map(|x| x.into());
2750        self
2751    }
2752}
2753
2754impl wkt::message::Message for Counters {
2755    fn typename() -> &'static str {
2756        "type.googleapis.com/google.cloud.storagebatchoperations.v1.Counters"
2757    }
2758}
2759
2760/// Specifies the Cloud Logging behavior.
2761#[derive(Clone, Default, PartialEq)]
2762#[non_exhaustive]
2763pub struct LoggingConfig {
2764    /// Required. Specifies the actions to be logged.
2765    pub log_actions: std::vec::Vec<crate::model::logging_config::LoggableAction>,
2766
2767    /// Required. States in which Action are logged.If empty, no logs are
2768    /// generated.
2769    pub log_action_states: std::vec::Vec<crate::model::logging_config::LoggableActionState>,
2770
2771    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2772}
2773
2774impl LoggingConfig {
2775    pub fn new() -> Self {
2776        std::default::Default::default()
2777    }
2778
2779    /// Sets the value of [log_actions][crate::model::LoggingConfig::log_actions].
2780    ///
2781    /// # Example
2782    /// ```ignore,no_run
2783    /// # use google_cloud_storagebatchoperations_v1::model::LoggingConfig;
2784    /// use google_cloud_storagebatchoperations_v1::model::logging_config::LoggableAction;
2785    /// let x = LoggingConfig::new().set_log_actions([
2786    ///     LoggableAction::Transform,
2787    /// ]);
2788    /// ```
2789    pub fn set_log_actions<T, V>(mut self, v: T) -> Self
2790    where
2791        T: std::iter::IntoIterator<Item = V>,
2792        V: std::convert::Into<crate::model::logging_config::LoggableAction>,
2793    {
2794        use std::iter::Iterator;
2795        self.log_actions = v.into_iter().map(|i| i.into()).collect();
2796        self
2797    }
2798
2799    /// Sets the value of [log_action_states][crate::model::LoggingConfig::log_action_states].
2800    ///
2801    /// # Example
2802    /// ```ignore,no_run
2803    /// # use google_cloud_storagebatchoperations_v1::model::LoggingConfig;
2804    /// use google_cloud_storagebatchoperations_v1::model::logging_config::LoggableActionState;
2805    /// let x = LoggingConfig::new().set_log_action_states([
2806    ///     LoggableActionState::Succeeded,
2807    ///     LoggableActionState::Failed,
2808    /// ]);
2809    /// ```
2810    pub fn set_log_action_states<T, V>(mut self, v: T) -> Self
2811    where
2812        T: std::iter::IntoIterator<Item = V>,
2813        V: std::convert::Into<crate::model::logging_config::LoggableActionState>,
2814    {
2815        use std::iter::Iterator;
2816        self.log_action_states = v.into_iter().map(|i| i.into()).collect();
2817        self
2818    }
2819}
2820
2821impl wkt::message::Message for LoggingConfig {
2822    fn typename() -> &'static str {
2823        "type.googleapis.com/google.cloud.storagebatchoperations.v1.LoggingConfig"
2824    }
2825}
2826
2827/// Defines additional types related to [LoggingConfig].
2828pub mod logging_config {
2829    #[allow(unused_imports)]
2830    use super::*;
2831
2832    /// Loggable actions types.
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 LoggableAction {
2850        /// Illegal value, to avoid allowing a default.
2851        Unspecified,
2852        /// The corresponding transform action in this job.
2853        Transform,
2854        /// If set, the enum was initialized with an unknown value.
2855        ///
2856        /// Applications can examine the value using [LoggableAction::value] or
2857        /// [LoggableAction::name].
2858        UnknownValue(loggable_action::UnknownValue),
2859    }
2860
2861    #[doc(hidden)]
2862    pub mod loggable_action {
2863        #[allow(unused_imports)]
2864        use super::*;
2865        #[derive(Clone, Debug, PartialEq)]
2866        pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
2867    }
2868
2869    impl LoggableAction {
2870        /// Gets the enum value.
2871        ///
2872        /// Returns `None` if the enum contains an unknown value deserialized from
2873        /// the string representation of enums.
2874        pub fn value(&self) -> std::option::Option<i32> {
2875            match self {
2876                Self::Unspecified => std::option::Option::Some(0),
2877                Self::Transform => std::option::Option::Some(6),
2878                Self::UnknownValue(u) => u.0.value(),
2879            }
2880        }
2881
2882        /// Gets the enum value as a string.
2883        ///
2884        /// Returns `None` if the enum contains an unknown value deserialized from
2885        /// the integer representation of enums.
2886        pub fn name(&self) -> std::option::Option<&str> {
2887            match self {
2888                Self::Unspecified => std::option::Option::Some("LOGGABLE_ACTION_UNSPECIFIED"),
2889                Self::Transform => std::option::Option::Some("TRANSFORM"),
2890                Self::UnknownValue(u) => u.0.name(),
2891            }
2892        }
2893    }
2894
2895    impl std::default::Default for LoggableAction {
2896        fn default() -> Self {
2897            use std::convert::From;
2898            Self::from(0)
2899        }
2900    }
2901
2902    impl std::fmt::Display for LoggableAction {
2903        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
2904            wkt::internal::display_enum(f, self.name(), self.value())
2905        }
2906    }
2907
2908    impl std::convert::From<i32> for LoggableAction {
2909        fn from(value: i32) -> Self {
2910            match value {
2911                0 => Self::Unspecified,
2912                6 => Self::Transform,
2913                _ => Self::UnknownValue(loggable_action::UnknownValue(
2914                    wkt::internal::UnknownEnumValue::Integer(value),
2915                )),
2916            }
2917        }
2918    }
2919
2920    impl std::convert::From<&str> for LoggableAction {
2921        fn from(value: &str) -> Self {
2922            use std::string::ToString;
2923            match value {
2924                "LOGGABLE_ACTION_UNSPECIFIED" => Self::Unspecified,
2925                "TRANSFORM" => Self::Transform,
2926                _ => Self::UnknownValue(loggable_action::UnknownValue(
2927                    wkt::internal::UnknownEnumValue::String(value.to_string()),
2928                )),
2929            }
2930        }
2931    }
2932
2933    impl serde::ser::Serialize for LoggableAction {
2934        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
2935        where
2936            S: serde::Serializer,
2937        {
2938            match self {
2939                Self::Unspecified => serializer.serialize_i32(0),
2940                Self::Transform => serializer.serialize_i32(6),
2941                Self::UnknownValue(u) => u.0.serialize(serializer),
2942            }
2943        }
2944    }
2945
2946    impl<'de> serde::de::Deserialize<'de> for LoggableAction {
2947        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
2948        where
2949            D: serde::Deserializer<'de>,
2950        {
2951            deserializer.deserialize_any(wkt::internal::EnumVisitor::<LoggableAction>::new(
2952                ".google.cloud.storagebatchoperations.v1.LoggingConfig.LoggableAction",
2953            ))
2954        }
2955    }
2956
2957    /// Loggable action states filter.
2958    ///
2959    /// # Working with unknown values
2960    ///
2961    /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
2962    /// additional enum variants at any time. Adding new variants is not considered
2963    /// a breaking change. Applications should write their code in anticipation of:
2964    ///
2965    /// - New values appearing in future releases of the client library, **and**
2966    /// - New values received dynamically, without application changes.
2967    ///
2968    /// Please consult the [Working with enums] section in the user guide for some
2969    /// guidelines.
2970    ///
2971    /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
2972    #[derive(Clone, Debug, PartialEq)]
2973    #[non_exhaustive]
2974    pub enum LoggableActionState {
2975        /// Illegal value, to avoid allowing a default.
2976        Unspecified,
2977        /// `LoggableAction` completed successfully. `SUCCEEDED` actions are
2978        /// logged as [INFO][google.logging.type.LogSeverity.INFO].
2979        Succeeded,
2980        /// `LoggableAction` terminated in an error state. `FAILED` actions
2981        /// are logged as [ERROR][google.logging.type.LogSeverity.ERROR].
2982        Failed,
2983        /// If set, the enum was initialized with an unknown value.
2984        ///
2985        /// Applications can examine the value using [LoggableActionState::value] or
2986        /// [LoggableActionState::name].
2987        UnknownValue(loggable_action_state::UnknownValue),
2988    }
2989
2990    #[doc(hidden)]
2991    pub mod loggable_action_state {
2992        #[allow(unused_imports)]
2993        use super::*;
2994        #[derive(Clone, Debug, PartialEq)]
2995        pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
2996    }
2997
2998    impl LoggableActionState {
2999        /// Gets the enum value.
3000        ///
3001        /// Returns `None` if the enum contains an unknown value deserialized from
3002        /// the string representation of enums.
3003        pub fn value(&self) -> std::option::Option<i32> {
3004            match self {
3005                Self::Unspecified => std::option::Option::Some(0),
3006                Self::Succeeded => std::option::Option::Some(1),
3007                Self::Failed => std::option::Option::Some(2),
3008                Self::UnknownValue(u) => u.0.value(),
3009            }
3010        }
3011
3012        /// Gets the enum value as a string.
3013        ///
3014        /// Returns `None` if the enum contains an unknown value deserialized from
3015        /// the integer representation of enums.
3016        pub fn name(&self) -> std::option::Option<&str> {
3017            match self {
3018                Self::Unspecified => std::option::Option::Some("LOGGABLE_ACTION_STATE_UNSPECIFIED"),
3019                Self::Succeeded => std::option::Option::Some("SUCCEEDED"),
3020                Self::Failed => std::option::Option::Some("FAILED"),
3021                Self::UnknownValue(u) => u.0.name(),
3022            }
3023        }
3024    }
3025
3026    impl std::default::Default for LoggableActionState {
3027        fn default() -> Self {
3028            use std::convert::From;
3029            Self::from(0)
3030        }
3031    }
3032
3033    impl std::fmt::Display for LoggableActionState {
3034        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
3035            wkt::internal::display_enum(f, self.name(), self.value())
3036        }
3037    }
3038
3039    impl std::convert::From<i32> for LoggableActionState {
3040        fn from(value: i32) -> Self {
3041            match value {
3042                0 => Self::Unspecified,
3043                1 => Self::Succeeded,
3044                2 => Self::Failed,
3045                _ => Self::UnknownValue(loggable_action_state::UnknownValue(
3046                    wkt::internal::UnknownEnumValue::Integer(value),
3047                )),
3048            }
3049        }
3050    }
3051
3052    impl std::convert::From<&str> for LoggableActionState {
3053        fn from(value: &str) -> Self {
3054            use std::string::ToString;
3055            match value {
3056                "LOGGABLE_ACTION_STATE_UNSPECIFIED" => Self::Unspecified,
3057                "SUCCEEDED" => Self::Succeeded,
3058                "FAILED" => Self::Failed,
3059                _ => Self::UnknownValue(loggable_action_state::UnknownValue(
3060                    wkt::internal::UnknownEnumValue::String(value.to_string()),
3061                )),
3062            }
3063        }
3064    }
3065
3066    impl serde::ser::Serialize for LoggableActionState {
3067        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
3068        where
3069            S: serde::Serializer,
3070        {
3071            match self {
3072                Self::Unspecified => serializer.serialize_i32(0),
3073                Self::Succeeded => serializer.serialize_i32(1),
3074                Self::Failed => serializer.serialize_i32(2),
3075                Self::UnknownValue(u) => u.0.serialize(serializer),
3076            }
3077        }
3078    }
3079
3080    impl<'de> serde::de::Deserialize<'de> for LoggableActionState {
3081        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
3082        where
3083            D: serde::Deserializer<'de>,
3084        {
3085            deserializer.deserialize_any(wkt::internal::EnumVisitor::<LoggableActionState>::new(
3086                ".google.cloud.storagebatchoperations.v1.LoggingConfig.LoggableActionState",
3087            ))
3088        }
3089    }
3090}