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