google_cloud_storage/generated/gapic/
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
20/// Request message for DeleteBucket.
21#[derive(Clone, Default, PartialEq)]
22#[non_exhaustive]
23pub struct DeleteBucketRequest {
24    /// Required. Name of a bucket to delete.
25    pub name: std::string::String,
26
27    /// If set, only deletes the bucket if its metageneration matches this value.
28    pub if_metageneration_match: std::option::Option<i64>,
29
30    /// If set, only deletes the bucket if its metageneration does not match this
31    /// value.
32    pub if_metageneration_not_match: std::option::Option<i64>,
33
34    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
35}
36
37impl DeleteBucketRequest {
38    pub fn new() -> Self {
39        std::default::Default::default()
40    }
41
42    /// Sets the value of [name][crate::model::DeleteBucketRequest::name].
43    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
44        self.name = v.into();
45        self
46    }
47
48    /// Sets the value of [if_metageneration_match][crate::model::DeleteBucketRequest::if_metageneration_match].
49    pub fn set_if_metageneration_match<T>(mut self, v: T) -> Self
50    where
51        T: std::convert::Into<i64>,
52    {
53        self.if_metageneration_match = std::option::Option::Some(v.into());
54        self
55    }
56
57    /// Sets or clears the value of [if_metageneration_match][crate::model::DeleteBucketRequest::if_metageneration_match].
58    pub fn set_or_clear_if_metageneration_match<T>(mut self, v: std::option::Option<T>) -> Self
59    where
60        T: std::convert::Into<i64>,
61    {
62        self.if_metageneration_match = v.map(|x| x.into());
63        self
64    }
65
66    /// Sets the value of [if_metageneration_not_match][crate::model::DeleteBucketRequest::if_metageneration_not_match].
67    pub fn set_if_metageneration_not_match<T>(mut self, v: T) -> Self
68    where
69        T: std::convert::Into<i64>,
70    {
71        self.if_metageneration_not_match = std::option::Option::Some(v.into());
72        self
73    }
74
75    /// Sets or clears the value of [if_metageneration_not_match][crate::model::DeleteBucketRequest::if_metageneration_not_match].
76    pub fn set_or_clear_if_metageneration_not_match<T>(mut self, v: std::option::Option<T>) -> Self
77    where
78        T: std::convert::Into<i64>,
79    {
80        self.if_metageneration_not_match = v.map(|x| x.into());
81        self
82    }
83}
84
85impl wkt::message::Message for DeleteBucketRequest {
86    fn typename() -> &'static str {
87        "type.googleapis.com/google.storage.v2.DeleteBucketRequest"
88    }
89}
90
91#[doc(hidden)]
92impl<'de> serde::de::Deserialize<'de> for DeleteBucketRequest {
93    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
94    where
95        D: serde::Deserializer<'de>,
96    {
97        #[allow(non_camel_case_types)]
98        #[doc(hidden)]
99        #[derive(PartialEq, Eq, Hash)]
100        enum __FieldTag {
101            __name,
102            __if_metageneration_match,
103            __if_metageneration_not_match,
104            Unknown(std::string::String),
105        }
106        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
107            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
108            where
109                D: serde::Deserializer<'de>,
110            {
111                struct Visitor;
112                impl<'de> serde::de::Visitor<'de> for Visitor {
113                    type Value = __FieldTag;
114                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
115                        formatter.write_str("a field name for DeleteBucketRequest")
116                    }
117                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
118                    where
119                        E: serde::de::Error,
120                    {
121                        use std::result::Result::Ok;
122                        use std::string::ToString;
123                        match value {
124                            "name" => Ok(__FieldTag::__name),
125                            "ifMetagenerationMatch" => Ok(__FieldTag::__if_metageneration_match),
126                            "if_metageneration_match" => Ok(__FieldTag::__if_metageneration_match),
127                            "ifMetagenerationNotMatch" => {
128                                Ok(__FieldTag::__if_metageneration_not_match)
129                            }
130                            "if_metageneration_not_match" => {
131                                Ok(__FieldTag::__if_metageneration_not_match)
132                            }
133                            _ => Ok(__FieldTag::Unknown(value.to_string())),
134                        }
135                    }
136                }
137                deserializer.deserialize_identifier(Visitor)
138            }
139        }
140        struct Visitor;
141        impl<'de> serde::de::Visitor<'de> for Visitor {
142            type Value = DeleteBucketRequest;
143            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
144                formatter.write_str("struct DeleteBucketRequest")
145            }
146            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
147            where
148                A: serde::de::MapAccess<'de>,
149            {
150                #[allow(unused_imports)]
151                use serde::de::Error;
152                use std::option::Option::Some;
153                let mut fields = std::collections::HashSet::new();
154                let mut result = Self::Value::new();
155                while let Some(tag) = map.next_key::<__FieldTag>()? {
156                    #[allow(clippy::match_single_binding)]
157                    match tag {
158                        __FieldTag::__name => {
159                            if !fields.insert(__FieldTag::__name) {
160                                return std::result::Result::Err(A::Error::duplicate_field(
161                                    "multiple values for name",
162                                ));
163                            }
164                            result.name = map
165                                .next_value::<std::option::Option<std::string::String>>()?
166                                .unwrap_or_default();
167                        }
168                        __FieldTag::__if_metageneration_match => {
169                            if !fields.insert(__FieldTag::__if_metageneration_match) {
170                                return std::result::Result::Err(A::Error::duplicate_field(
171                                    "multiple values for if_metageneration_match",
172                                ));
173                            }
174                            struct __With(std::option::Option<i64>);
175                            impl<'de> serde::de::Deserialize<'de> for __With {
176                                fn deserialize<D>(
177                                    deserializer: D,
178                                ) -> std::result::Result<Self, D::Error>
179                                where
180                                    D: serde::de::Deserializer<'de>,
181                                {
182                                    serde_with::As::< std::option::Option<wkt::internal::I64> >::deserialize(deserializer).map(__With)
183                                }
184                            }
185                            result.if_metageneration_match = map.next_value::<__With>()?.0;
186                        }
187                        __FieldTag::__if_metageneration_not_match => {
188                            if !fields.insert(__FieldTag::__if_metageneration_not_match) {
189                                return std::result::Result::Err(A::Error::duplicate_field(
190                                    "multiple values for if_metageneration_not_match",
191                                ));
192                            }
193                            struct __With(std::option::Option<i64>);
194                            impl<'de> serde::de::Deserialize<'de> for __With {
195                                fn deserialize<D>(
196                                    deserializer: D,
197                                ) -> std::result::Result<Self, D::Error>
198                                where
199                                    D: serde::de::Deserializer<'de>,
200                                {
201                                    serde_with::As::< std::option::Option<wkt::internal::I64> >::deserialize(deserializer).map(__With)
202                                }
203                            }
204                            result.if_metageneration_not_match = map.next_value::<__With>()?.0;
205                        }
206                        __FieldTag::Unknown(key) => {
207                            let value = map.next_value::<serde_json::Value>()?;
208                            result._unknown_fields.insert(key, value);
209                        }
210                    }
211                }
212                std::result::Result::Ok(result)
213            }
214        }
215        deserializer.deserialize_any(Visitor)
216    }
217}
218
219#[doc(hidden)]
220impl serde::ser::Serialize for DeleteBucketRequest {
221    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
222    where
223        S: serde::ser::Serializer,
224    {
225        use serde::ser::SerializeMap;
226        #[allow(unused_imports)]
227        use std::option::Option::Some;
228        let mut state = serializer.serialize_map(std::option::Option::None)?;
229        if !self.name.is_empty() {
230            state.serialize_entry("name", &self.name)?;
231        }
232        if self.if_metageneration_match.is_some() {
233            struct __With<'a>(&'a std::option::Option<i64>);
234            impl<'a> serde::ser::Serialize for __With<'a> {
235                fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
236                where
237                    S: serde::ser::Serializer,
238                {
239                    serde_with::As::<std::option::Option<wkt::internal::I64>>::serialize(
240                        self.0, serializer,
241                    )
242                }
243            }
244            state.serialize_entry(
245                "ifMetagenerationMatch",
246                &__With(&self.if_metageneration_match),
247            )?;
248        }
249        if self.if_metageneration_not_match.is_some() {
250            struct __With<'a>(&'a std::option::Option<i64>);
251            impl<'a> serde::ser::Serialize for __With<'a> {
252                fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
253                where
254                    S: serde::ser::Serializer,
255                {
256                    serde_with::As::<std::option::Option<wkt::internal::I64>>::serialize(
257                        self.0, serializer,
258                    )
259                }
260            }
261            state.serialize_entry(
262                "ifMetagenerationNotMatch",
263                &__With(&self.if_metageneration_not_match),
264            )?;
265        }
266        if !self._unknown_fields.is_empty() {
267            for (key, value) in self._unknown_fields.iter() {
268                state.serialize_entry(key, &value)?;
269            }
270        }
271        state.end()
272    }
273}
274
275impl std::fmt::Debug for DeleteBucketRequest {
276    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
277        let mut debug_struct = f.debug_struct("DeleteBucketRequest");
278        debug_struct.field("name", &self.name);
279        debug_struct.field("if_metageneration_match", &self.if_metageneration_match);
280        debug_struct.field(
281            "if_metageneration_not_match",
282            &self.if_metageneration_not_match,
283        );
284        if !self._unknown_fields.is_empty() {
285            debug_struct.field("_unknown_fields", &self._unknown_fields);
286        }
287        debug_struct.finish()
288    }
289}
290
291/// Request message for GetBucket.
292#[derive(Clone, Default, PartialEq)]
293#[non_exhaustive]
294pub struct GetBucketRequest {
295    /// Required. Name of a bucket.
296    pub name: std::string::String,
297
298    /// If set, and if the bucket's current metageneration does not match the
299    /// specified value, the request will return an error.
300    pub if_metageneration_match: std::option::Option<i64>,
301
302    /// If set, and if the bucket's current metageneration matches the specified
303    /// value, the request will return an error.
304    pub if_metageneration_not_match: std::option::Option<i64>,
305
306    /// Mask specifying which fields to read.
307    /// A "*" field may be used to indicate all fields.
308    /// If no mask is specified, will default to all fields.
309    pub read_mask: std::option::Option<wkt::FieldMask>,
310
311    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
312}
313
314impl GetBucketRequest {
315    pub fn new() -> Self {
316        std::default::Default::default()
317    }
318
319    /// Sets the value of [name][crate::model::GetBucketRequest::name].
320    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
321        self.name = v.into();
322        self
323    }
324
325    /// Sets the value of [if_metageneration_match][crate::model::GetBucketRequest::if_metageneration_match].
326    pub fn set_if_metageneration_match<T>(mut self, v: T) -> Self
327    where
328        T: std::convert::Into<i64>,
329    {
330        self.if_metageneration_match = std::option::Option::Some(v.into());
331        self
332    }
333
334    /// Sets or clears the value of [if_metageneration_match][crate::model::GetBucketRequest::if_metageneration_match].
335    pub fn set_or_clear_if_metageneration_match<T>(mut self, v: std::option::Option<T>) -> Self
336    where
337        T: std::convert::Into<i64>,
338    {
339        self.if_metageneration_match = v.map(|x| x.into());
340        self
341    }
342
343    /// Sets the value of [if_metageneration_not_match][crate::model::GetBucketRequest::if_metageneration_not_match].
344    pub fn set_if_metageneration_not_match<T>(mut self, v: T) -> Self
345    where
346        T: std::convert::Into<i64>,
347    {
348        self.if_metageneration_not_match = std::option::Option::Some(v.into());
349        self
350    }
351
352    /// Sets or clears the value of [if_metageneration_not_match][crate::model::GetBucketRequest::if_metageneration_not_match].
353    pub fn set_or_clear_if_metageneration_not_match<T>(mut self, v: std::option::Option<T>) -> Self
354    where
355        T: std::convert::Into<i64>,
356    {
357        self.if_metageneration_not_match = v.map(|x| x.into());
358        self
359    }
360
361    /// Sets the value of [read_mask][crate::model::GetBucketRequest::read_mask].
362    pub fn set_read_mask<T>(mut self, v: T) -> Self
363    where
364        T: std::convert::Into<wkt::FieldMask>,
365    {
366        self.read_mask = std::option::Option::Some(v.into());
367        self
368    }
369
370    /// Sets or clears the value of [read_mask][crate::model::GetBucketRequest::read_mask].
371    pub fn set_or_clear_read_mask<T>(mut self, v: std::option::Option<T>) -> Self
372    where
373        T: std::convert::Into<wkt::FieldMask>,
374    {
375        self.read_mask = v.map(|x| x.into());
376        self
377    }
378}
379
380impl wkt::message::Message for GetBucketRequest {
381    fn typename() -> &'static str {
382        "type.googleapis.com/google.storage.v2.GetBucketRequest"
383    }
384}
385
386#[doc(hidden)]
387impl<'de> serde::de::Deserialize<'de> for GetBucketRequest {
388    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
389    where
390        D: serde::Deserializer<'de>,
391    {
392        #[allow(non_camel_case_types)]
393        #[doc(hidden)]
394        #[derive(PartialEq, Eq, Hash)]
395        enum __FieldTag {
396            __name,
397            __if_metageneration_match,
398            __if_metageneration_not_match,
399            __read_mask,
400            Unknown(std::string::String),
401        }
402        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
403            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
404            where
405                D: serde::Deserializer<'de>,
406            {
407                struct Visitor;
408                impl<'de> serde::de::Visitor<'de> for Visitor {
409                    type Value = __FieldTag;
410                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
411                        formatter.write_str("a field name for GetBucketRequest")
412                    }
413                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
414                    where
415                        E: serde::de::Error,
416                    {
417                        use std::result::Result::Ok;
418                        use std::string::ToString;
419                        match value {
420                            "name" => Ok(__FieldTag::__name),
421                            "ifMetagenerationMatch" => Ok(__FieldTag::__if_metageneration_match),
422                            "if_metageneration_match" => Ok(__FieldTag::__if_metageneration_match),
423                            "ifMetagenerationNotMatch" => {
424                                Ok(__FieldTag::__if_metageneration_not_match)
425                            }
426                            "if_metageneration_not_match" => {
427                                Ok(__FieldTag::__if_metageneration_not_match)
428                            }
429                            "readMask" => Ok(__FieldTag::__read_mask),
430                            "read_mask" => Ok(__FieldTag::__read_mask),
431                            _ => Ok(__FieldTag::Unknown(value.to_string())),
432                        }
433                    }
434                }
435                deserializer.deserialize_identifier(Visitor)
436            }
437        }
438        struct Visitor;
439        impl<'de> serde::de::Visitor<'de> for Visitor {
440            type Value = GetBucketRequest;
441            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
442                formatter.write_str("struct GetBucketRequest")
443            }
444            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
445            where
446                A: serde::de::MapAccess<'de>,
447            {
448                #[allow(unused_imports)]
449                use serde::de::Error;
450                use std::option::Option::Some;
451                let mut fields = std::collections::HashSet::new();
452                let mut result = Self::Value::new();
453                while let Some(tag) = map.next_key::<__FieldTag>()? {
454                    #[allow(clippy::match_single_binding)]
455                    match tag {
456                        __FieldTag::__name => {
457                            if !fields.insert(__FieldTag::__name) {
458                                return std::result::Result::Err(A::Error::duplicate_field(
459                                    "multiple values for name",
460                                ));
461                            }
462                            result.name = map
463                                .next_value::<std::option::Option<std::string::String>>()?
464                                .unwrap_or_default();
465                        }
466                        __FieldTag::__if_metageneration_match => {
467                            if !fields.insert(__FieldTag::__if_metageneration_match) {
468                                return std::result::Result::Err(A::Error::duplicate_field(
469                                    "multiple values for if_metageneration_match",
470                                ));
471                            }
472                            struct __With(std::option::Option<i64>);
473                            impl<'de> serde::de::Deserialize<'de> for __With {
474                                fn deserialize<D>(
475                                    deserializer: D,
476                                ) -> std::result::Result<Self, D::Error>
477                                where
478                                    D: serde::de::Deserializer<'de>,
479                                {
480                                    serde_with::As::< std::option::Option<wkt::internal::I64> >::deserialize(deserializer).map(__With)
481                                }
482                            }
483                            result.if_metageneration_match = map.next_value::<__With>()?.0;
484                        }
485                        __FieldTag::__if_metageneration_not_match => {
486                            if !fields.insert(__FieldTag::__if_metageneration_not_match) {
487                                return std::result::Result::Err(A::Error::duplicate_field(
488                                    "multiple values for if_metageneration_not_match",
489                                ));
490                            }
491                            struct __With(std::option::Option<i64>);
492                            impl<'de> serde::de::Deserialize<'de> for __With {
493                                fn deserialize<D>(
494                                    deserializer: D,
495                                ) -> std::result::Result<Self, D::Error>
496                                where
497                                    D: serde::de::Deserializer<'de>,
498                                {
499                                    serde_with::As::< std::option::Option<wkt::internal::I64> >::deserialize(deserializer).map(__With)
500                                }
501                            }
502                            result.if_metageneration_not_match = map.next_value::<__With>()?.0;
503                        }
504                        __FieldTag::__read_mask => {
505                            if !fields.insert(__FieldTag::__read_mask) {
506                                return std::result::Result::Err(A::Error::duplicate_field(
507                                    "multiple values for read_mask",
508                                ));
509                            }
510                            result.read_mask =
511                                map.next_value::<std::option::Option<wkt::FieldMask>>()?;
512                        }
513                        __FieldTag::Unknown(key) => {
514                            let value = map.next_value::<serde_json::Value>()?;
515                            result._unknown_fields.insert(key, value);
516                        }
517                    }
518                }
519                std::result::Result::Ok(result)
520            }
521        }
522        deserializer.deserialize_any(Visitor)
523    }
524}
525
526#[doc(hidden)]
527impl serde::ser::Serialize for GetBucketRequest {
528    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
529    where
530        S: serde::ser::Serializer,
531    {
532        use serde::ser::SerializeMap;
533        #[allow(unused_imports)]
534        use std::option::Option::Some;
535        let mut state = serializer.serialize_map(std::option::Option::None)?;
536        if !self.name.is_empty() {
537            state.serialize_entry("name", &self.name)?;
538        }
539        if self.if_metageneration_match.is_some() {
540            struct __With<'a>(&'a std::option::Option<i64>);
541            impl<'a> serde::ser::Serialize for __With<'a> {
542                fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
543                where
544                    S: serde::ser::Serializer,
545                {
546                    serde_with::As::<std::option::Option<wkt::internal::I64>>::serialize(
547                        self.0, serializer,
548                    )
549                }
550            }
551            state.serialize_entry(
552                "ifMetagenerationMatch",
553                &__With(&self.if_metageneration_match),
554            )?;
555        }
556        if self.if_metageneration_not_match.is_some() {
557            struct __With<'a>(&'a std::option::Option<i64>);
558            impl<'a> serde::ser::Serialize for __With<'a> {
559                fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
560                where
561                    S: serde::ser::Serializer,
562                {
563                    serde_with::As::<std::option::Option<wkt::internal::I64>>::serialize(
564                        self.0, serializer,
565                    )
566                }
567            }
568            state.serialize_entry(
569                "ifMetagenerationNotMatch",
570                &__With(&self.if_metageneration_not_match),
571            )?;
572        }
573        if self.read_mask.is_some() {
574            state.serialize_entry("readMask", &self.read_mask)?;
575        }
576        if !self._unknown_fields.is_empty() {
577            for (key, value) in self._unknown_fields.iter() {
578                state.serialize_entry(key, &value)?;
579            }
580        }
581        state.end()
582    }
583}
584
585impl std::fmt::Debug for GetBucketRequest {
586    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
587        let mut debug_struct = f.debug_struct("GetBucketRequest");
588        debug_struct.field("name", &self.name);
589        debug_struct.field("if_metageneration_match", &self.if_metageneration_match);
590        debug_struct.field(
591            "if_metageneration_not_match",
592            &self.if_metageneration_not_match,
593        );
594        debug_struct.field("read_mask", &self.read_mask);
595        if !self._unknown_fields.is_empty() {
596            debug_struct.field("_unknown_fields", &self._unknown_fields);
597        }
598        debug_struct.finish()
599    }
600}
601
602/// Request message for CreateBucket.
603#[derive(Clone, Default, PartialEq)]
604#[non_exhaustive]
605pub struct CreateBucketRequest {
606    /// Required. The project to which this bucket will belong. This field must
607    /// either be empty or `projects/_`. The project ID that owns this bucket
608    /// should be specified in the `bucket.project` field.
609    pub parent: std::string::String,
610
611    /// Optional. Properties of the new bucket being inserted.
612    /// The name of the bucket is specified in the `bucket_id` field. Populating
613    /// `bucket.name` field will result in an error.
614    /// The project of the bucket must be specified in the `bucket.project` field.
615    /// This field must be in `projects/{projectIdentifier}` format,
616    /// {projectIdentifier} can be the project ID or project number. The `parent`
617    /// field must be either empty or `projects/_`.
618    pub bucket: std::option::Option<crate::model::Bucket>,
619
620    /// Required. The ID to use for this bucket, which will become the final
621    /// component of the bucket's resource name. For example, the value `foo` might
622    /// result in a bucket with the name `projects/123456/buckets/foo`.
623    pub bucket_id: std::string::String,
624
625    /// Optional. Apply a predefined set of access controls to this bucket.
626    /// Valid values are "authenticatedRead", "private", "projectPrivate",
627    /// "publicRead", or "publicReadWrite".
628    pub predefined_acl: std::string::String,
629
630    /// Optional. Apply a predefined set of default object access controls to this
631    /// bucket. Valid values are "authenticatedRead", "bucketOwnerFullControl",
632    /// "bucketOwnerRead", "private", "projectPrivate", or "publicRead".
633    pub predefined_default_object_acl: std::string::String,
634
635    /// Optional. If true, enable object retention on the bucket.
636    pub enable_object_retention: bool,
637
638    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
639}
640
641impl CreateBucketRequest {
642    pub fn new() -> Self {
643        std::default::Default::default()
644    }
645
646    /// Sets the value of [parent][crate::model::CreateBucketRequest::parent].
647    pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
648        self.parent = v.into();
649        self
650    }
651
652    /// Sets the value of [bucket][crate::model::CreateBucketRequest::bucket].
653    pub fn set_bucket<T>(mut self, v: T) -> Self
654    where
655        T: std::convert::Into<crate::model::Bucket>,
656    {
657        self.bucket = std::option::Option::Some(v.into());
658        self
659    }
660
661    /// Sets or clears the value of [bucket][crate::model::CreateBucketRequest::bucket].
662    pub fn set_or_clear_bucket<T>(mut self, v: std::option::Option<T>) -> Self
663    where
664        T: std::convert::Into<crate::model::Bucket>,
665    {
666        self.bucket = v.map(|x| x.into());
667        self
668    }
669
670    /// Sets the value of [bucket_id][crate::model::CreateBucketRequest::bucket_id].
671    pub fn set_bucket_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
672        self.bucket_id = v.into();
673        self
674    }
675
676    /// Sets the value of [predefined_acl][crate::model::CreateBucketRequest::predefined_acl].
677    pub fn set_predefined_acl<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
678        self.predefined_acl = v.into();
679        self
680    }
681
682    /// Sets the value of [predefined_default_object_acl][crate::model::CreateBucketRequest::predefined_default_object_acl].
683    pub fn set_predefined_default_object_acl<T: std::convert::Into<std::string::String>>(
684        mut self,
685        v: T,
686    ) -> Self {
687        self.predefined_default_object_acl = v.into();
688        self
689    }
690
691    /// Sets the value of [enable_object_retention][crate::model::CreateBucketRequest::enable_object_retention].
692    pub fn set_enable_object_retention<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
693        self.enable_object_retention = v.into();
694        self
695    }
696}
697
698impl wkt::message::Message for CreateBucketRequest {
699    fn typename() -> &'static str {
700        "type.googleapis.com/google.storage.v2.CreateBucketRequest"
701    }
702}
703
704#[doc(hidden)]
705impl<'de> serde::de::Deserialize<'de> for CreateBucketRequest {
706    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
707    where
708        D: serde::Deserializer<'de>,
709    {
710        #[allow(non_camel_case_types)]
711        #[doc(hidden)]
712        #[derive(PartialEq, Eq, Hash)]
713        enum __FieldTag {
714            __parent,
715            __bucket,
716            __bucket_id,
717            __predefined_acl,
718            __predefined_default_object_acl,
719            __enable_object_retention,
720            Unknown(std::string::String),
721        }
722        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
723            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
724            where
725                D: serde::Deserializer<'de>,
726            {
727                struct Visitor;
728                impl<'de> serde::de::Visitor<'de> for Visitor {
729                    type Value = __FieldTag;
730                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
731                        formatter.write_str("a field name for CreateBucketRequest")
732                    }
733                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
734                    where
735                        E: serde::de::Error,
736                    {
737                        use std::result::Result::Ok;
738                        use std::string::ToString;
739                        match value {
740                            "parent" => Ok(__FieldTag::__parent),
741                            "bucket" => Ok(__FieldTag::__bucket),
742                            "bucketId" => Ok(__FieldTag::__bucket_id),
743                            "bucket_id" => Ok(__FieldTag::__bucket_id),
744                            "predefinedAcl" => Ok(__FieldTag::__predefined_acl),
745                            "predefined_acl" => Ok(__FieldTag::__predefined_acl),
746                            "predefinedDefaultObjectAcl" => {
747                                Ok(__FieldTag::__predefined_default_object_acl)
748                            }
749                            "predefined_default_object_acl" => {
750                                Ok(__FieldTag::__predefined_default_object_acl)
751                            }
752                            "enableObjectRetention" => Ok(__FieldTag::__enable_object_retention),
753                            "enable_object_retention" => Ok(__FieldTag::__enable_object_retention),
754                            _ => Ok(__FieldTag::Unknown(value.to_string())),
755                        }
756                    }
757                }
758                deserializer.deserialize_identifier(Visitor)
759            }
760        }
761        struct Visitor;
762        impl<'de> serde::de::Visitor<'de> for Visitor {
763            type Value = CreateBucketRequest;
764            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
765                formatter.write_str("struct CreateBucketRequest")
766            }
767            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
768            where
769                A: serde::de::MapAccess<'de>,
770            {
771                #[allow(unused_imports)]
772                use serde::de::Error;
773                use std::option::Option::Some;
774                let mut fields = std::collections::HashSet::new();
775                let mut result = Self::Value::new();
776                while let Some(tag) = map.next_key::<__FieldTag>()? {
777                    #[allow(clippy::match_single_binding)]
778                    match tag {
779                        __FieldTag::__parent => {
780                            if !fields.insert(__FieldTag::__parent) {
781                                return std::result::Result::Err(A::Error::duplicate_field(
782                                    "multiple values for parent",
783                                ));
784                            }
785                            result.parent = map
786                                .next_value::<std::option::Option<std::string::String>>()?
787                                .unwrap_or_default();
788                        }
789                        __FieldTag::__bucket => {
790                            if !fields.insert(__FieldTag::__bucket) {
791                                return std::result::Result::Err(A::Error::duplicate_field(
792                                    "multiple values for bucket",
793                                ));
794                            }
795                            result.bucket =
796                                map.next_value::<std::option::Option<crate::model::Bucket>>()?;
797                        }
798                        __FieldTag::__bucket_id => {
799                            if !fields.insert(__FieldTag::__bucket_id) {
800                                return std::result::Result::Err(A::Error::duplicate_field(
801                                    "multiple values for bucket_id",
802                                ));
803                            }
804                            result.bucket_id = map
805                                .next_value::<std::option::Option<std::string::String>>()?
806                                .unwrap_or_default();
807                        }
808                        __FieldTag::__predefined_acl => {
809                            if !fields.insert(__FieldTag::__predefined_acl) {
810                                return std::result::Result::Err(A::Error::duplicate_field(
811                                    "multiple values for predefined_acl",
812                                ));
813                            }
814                            result.predefined_acl = map
815                                .next_value::<std::option::Option<std::string::String>>()?
816                                .unwrap_or_default();
817                        }
818                        __FieldTag::__predefined_default_object_acl => {
819                            if !fields.insert(__FieldTag::__predefined_default_object_acl) {
820                                return std::result::Result::Err(A::Error::duplicate_field(
821                                    "multiple values for predefined_default_object_acl",
822                                ));
823                            }
824                            result.predefined_default_object_acl = map
825                                .next_value::<std::option::Option<std::string::String>>()?
826                                .unwrap_or_default();
827                        }
828                        __FieldTag::__enable_object_retention => {
829                            if !fields.insert(__FieldTag::__enable_object_retention) {
830                                return std::result::Result::Err(A::Error::duplicate_field(
831                                    "multiple values for enable_object_retention",
832                                ));
833                            }
834                            result.enable_object_retention = map
835                                .next_value::<std::option::Option<bool>>()?
836                                .unwrap_or_default();
837                        }
838                        __FieldTag::Unknown(key) => {
839                            let value = map.next_value::<serde_json::Value>()?;
840                            result._unknown_fields.insert(key, value);
841                        }
842                    }
843                }
844                std::result::Result::Ok(result)
845            }
846        }
847        deserializer.deserialize_any(Visitor)
848    }
849}
850
851#[doc(hidden)]
852impl serde::ser::Serialize for CreateBucketRequest {
853    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
854    where
855        S: serde::ser::Serializer,
856    {
857        use serde::ser::SerializeMap;
858        #[allow(unused_imports)]
859        use std::option::Option::Some;
860        let mut state = serializer.serialize_map(std::option::Option::None)?;
861        if !self.parent.is_empty() {
862            state.serialize_entry("parent", &self.parent)?;
863        }
864        if self.bucket.is_some() {
865            state.serialize_entry("bucket", &self.bucket)?;
866        }
867        if !self.bucket_id.is_empty() {
868            state.serialize_entry("bucketId", &self.bucket_id)?;
869        }
870        if !self.predefined_acl.is_empty() {
871            state.serialize_entry("predefinedAcl", &self.predefined_acl)?;
872        }
873        if !self.predefined_default_object_acl.is_empty() {
874            state.serialize_entry(
875                "predefinedDefaultObjectAcl",
876                &self.predefined_default_object_acl,
877            )?;
878        }
879        if !wkt::internal::is_default(&self.enable_object_retention) {
880            state.serialize_entry("enableObjectRetention", &self.enable_object_retention)?;
881        }
882        if !self._unknown_fields.is_empty() {
883            for (key, value) in self._unknown_fields.iter() {
884                state.serialize_entry(key, &value)?;
885            }
886        }
887        state.end()
888    }
889}
890
891impl std::fmt::Debug for CreateBucketRequest {
892    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
893        let mut debug_struct = f.debug_struct("CreateBucketRequest");
894        debug_struct.field("parent", &self.parent);
895        debug_struct.field("bucket", &self.bucket);
896        debug_struct.field("bucket_id", &self.bucket_id);
897        debug_struct.field("predefined_acl", &self.predefined_acl);
898        debug_struct.field(
899            "predefined_default_object_acl",
900            &self.predefined_default_object_acl,
901        );
902        debug_struct.field("enable_object_retention", &self.enable_object_retention);
903        if !self._unknown_fields.is_empty() {
904            debug_struct.field("_unknown_fields", &self._unknown_fields);
905        }
906        debug_struct.finish()
907    }
908}
909
910/// Request message for ListBuckets.
911#[derive(Clone, Default, PartialEq)]
912#[non_exhaustive]
913pub struct ListBucketsRequest {
914    /// Required. The project whose buckets we are listing.
915    pub parent: std::string::String,
916
917    /// Optional. Maximum number of buckets to return in a single response. The
918    /// service will use this parameter or 1,000 items, whichever is smaller. If
919    /// "acl" is present in the read_mask, the service will use this parameter of
920    /// 200 items, whichever is smaller.
921    pub page_size: i32,
922
923    /// Optional. A previously-returned page token representing part of the larger
924    /// set of results to view.
925    pub page_token: std::string::String,
926
927    /// Optional. Filter results to buckets whose names begin with this prefix.
928    pub prefix: std::string::String,
929
930    /// Mask specifying which fields to read from each result.
931    /// If no mask is specified, will default to all fields except items.owner,
932    /// items.acl, and items.default_object_acl.
933    ///
934    /// * may be used to mean "all fields".
935    pub read_mask: std::option::Option<wkt::FieldMask>,
936
937    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
938}
939
940impl ListBucketsRequest {
941    pub fn new() -> Self {
942        std::default::Default::default()
943    }
944
945    /// Sets the value of [parent][crate::model::ListBucketsRequest::parent].
946    pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
947        self.parent = v.into();
948        self
949    }
950
951    /// Sets the value of [page_size][crate::model::ListBucketsRequest::page_size].
952    pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
953        self.page_size = v.into();
954        self
955    }
956
957    /// Sets the value of [page_token][crate::model::ListBucketsRequest::page_token].
958    pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
959        self.page_token = v.into();
960        self
961    }
962
963    /// Sets the value of [prefix][crate::model::ListBucketsRequest::prefix].
964    pub fn set_prefix<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
965        self.prefix = v.into();
966        self
967    }
968
969    /// Sets the value of [read_mask][crate::model::ListBucketsRequest::read_mask].
970    pub fn set_read_mask<T>(mut self, v: T) -> Self
971    where
972        T: std::convert::Into<wkt::FieldMask>,
973    {
974        self.read_mask = std::option::Option::Some(v.into());
975        self
976    }
977
978    /// Sets or clears the value of [read_mask][crate::model::ListBucketsRequest::read_mask].
979    pub fn set_or_clear_read_mask<T>(mut self, v: std::option::Option<T>) -> Self
980    where
981        T: std::convert::Into<wkt::FieldMask>,
982    {
983        self.read_mask = v.map(|x| x.into());
984        self
985    }
986}
987
988impl wkt::message::Message for ListBucketsRequest {
989    fn typename() -> &'static str {
990        "type.googleapis.com/google.storage.v2.ListBucketsRequest"
991    }
992}
993
994#[doc(hidden)]
995impl<'de> serde::de::Deserialize<'de> for ListBucketsRequest {
996    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
997    where
998        D: serde::Deserializer<'de>,
999    {
1000        #[allow(non_camel_case_types)]
1001        #[doc(hidden)]
1002        #[derive(PartialEq, Eq, Hash)]
1003        enum __FieldTag {
1004            __parent,
1005            __page_size,
1006            __page_token,
1007            __prefix,
1008            __read_mask,
1009            Unknown(std::string::String),
1010        }
1011        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
1012            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
1013            where
1014                D: serde::Deserializer<'de>,
1015            {
1016                struct Visitor;
1017                impl<'de> serde::de::Visitor<'de> for Visitor {
1018                    type Value = __FieldTag;
1019                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
1020                        formatter.write_str("a field name for ListBucketsRequest")
1021                    }
1022                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
1023                    where
1024                        E: serde::de::Error,
1025                    {
1026                        use std::result::Result::Ok;
1027                        use std::string::ToString;
1028                        match value {
1029                            "parent" => Ok(__FieldTag::__parent),
1030                            "pageSize" => Ok(__FieldTag::__page_size),
1031                            "page_size" => Ok(__FieldTag::__page_size),
1032                            "pageToken" => Ok(__FieldTag::__page_token),
1033                            "page_token" => Ok(__FieldTag::__page_token),
1034                            "prefix" => Ok(__FieldTag::__prefix),
1035                            "readMask" => Ok(__FieldTag::__read_mask),
1036                            "read_mask" => Ok(__FieldTag::__read_mask),
1037                            _ => Ok(__FieldTag::Unknown(value.to_string())),
1038                        }
1039                    }
1040                }
1041                deserializer.deserialize_identifier(Visitor)
1042            }
1043        }
1044        struct Visitor;
1045        impl<'de> serde::de::Visitor<'de> for Visitor {
1046            type Value = ListBucketsRequest;
1047            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
1048                formatter.write_str("struct ListBucketsRequest")
1049            }
1050            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
1051            where
1052                A: serde::de::MapAccess<'de>,
1053            {
1054                #[allow(unused_imports)]
1055                use serde::de::Error;
1056                use std::option::Option::Some;
1057                let mut fields = std::collections::HashSet::new();
1058                let mut result = Self::Value::new();
1059                while let Some(tag) = map.next_key::<__FieldTag>()? {
1060                    #[allow(clippy::match_single_binding)]
1061                    match tag {
1062                        __FieldTag::__parent => {
1063                            if !fields.insert(__FieldTag::__parent) {
1064                                return std::result::Result::Err(A::Error::duplicate_field(
1065                                    "multiple values for parent",
1066                                ));
1067                            }
1068                            result.parent = map
1069                                .next_value::<std::option::Option<std::string::String>>()?
1070                                .unwrap_or_default();
1071                        }
1072                        __FieldTag::__page_size => {
1073                            if !fields.insert(__FieldTag::__page_size) {
1074                                return std::result::Result::Err(A::Error::duplicate_field(
1075                                    "multiple values for page_size",
1076                                ));
1077                            }
1078                            struct __With(std::option::Option<i32>);
1079                            impl<'de> serde::de::Deserialize<'de> for __With {
1080                                fn deserialize<D>(
1081                                    deserializer: D,
1082                                ) -> std::result::Result<Self, D::Error>
1083                                where
1084                                    D: serde::de::Deserializer<'de>,
1085                                {
1086                                    serde_with::As::< std::option::Option<wkt::internal::I32> >::deserialize(deserializer).map(__With)
1087                                }
1088                            }
1089                            result.page_size = map.next_value::<__With>()?.0.unwrap_or_default();
1090                        }
1091                        __FieldTag::__page_token => {
1092                            if !fields.insert(__FieldTag::__page_token) {
1093                                return std::result::Result::Err(A::Error::duplicate_field(
1094                                    "multiple values for page_token",
1095                                ));
1096                            }
1097                            result.page_token = map
1098                                .next_value::<std::option::Option<std::string::String>>()?
1099                                .unwrap_or_default();
1100                        }
1101                        __FieldTag::__prefix => {
1102                            if !fields.insert(__FieldTag::__prefix) {
1103                                return std::result::Result::Err(A::Error::duplicate_field(
1104                                    "multiple values for prefix",
1105                                ));
1106                            }
1107                            result.prefix = map
1108                                .next_value::<std::option::Option<std::string::String>>()?
1109                                .unwrap_or_default();
1110                        }
1111                        __FieldTag::__read_mask => {
1112                            if !fields.insert(__FieldTag::__read_mask) {
1113                                return std::result::Result::Err(A::Error::duplicate_field(
1114                                    "multiple values for read_mask",
1115                                ));
1116                            }
1117                            result.read_mask =
1118                                map.next_value::<std::option::Option<wkt::FieldMask>>()?;
1119                        }
1120                        __FieldTag::Unknown(key) => {
1121                            let value = map.next_value::<serde_json::Value>()?;
1122                            result._unknown_fields.insert(key, value);
1123                        }
1124                    }
1125                }
1126                std::result::Result::Ok(result)
1127            }
1128        }
1129        deserializer.deserialize_any(Visitor)
1130    }
1131}
1132
1133#[doc(hidden)]
1134impl serde::ser::Serialize for ListBucketsRequest {
1135    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
1136    where
1137        S: serde::ser::Serializer,
1138    {
1139        use serde::ser::SerializeMap;
1140        #[allow(unused_imports)]
1141        use std::option::Option::Some;
1142        let mut state = serializer.serialize_map(std::option::Option::None)?;
1143        if !self.parent.is_empty() {
1144            state.serialize_entry("parent", &self.parent)?;
1145        }
1146        if !wkt::internal::is_default(&self.page_size) {
1147            struct __With<'a>(&'a i32);
1148            impl<'a> serde::ser::Serialize for __With<'a> {
1149                fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
1150                where
1151                    S: serde::ser::Serializer,
1152                {
1153                    serde_with::As::<wkt::internal::I32>::serialize(self.0, serializer)
1154                }
1155            }
1156            state.serialize_entry("pageSize", &__With(&self.page_size))?;
1157        }
1158        if !self.page_token.is_empty() {
1159            state.serialize_entry("pageToken", &self.page_token)?;
1160        }
1161        if !self.prefix.is_empty() {
1162            state.serialize_entry("prefix", &self.prefix)?;
1163        }
1164        if self.read_mask.is_some() {
1165            state.serialize_entry("readMask", &self.read_mask)?;
1166        }
1167        if !self._unknown_fields.is_empty() {
1168            for (key, value) in self._unknown_fields.iter() {
1169                state.serialize_entry(key, &value)?;
1170            }
1171        }
1172        state.end()
1173    }
1174}
1175
1176impl std::fmt::Debug for ListBucketsRequest {
1177    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
1178        let mut debug_struct = f.debug_struct("ListBucketsRequest");
1179        debug_struct.field("parent", &self.parent);
1180        debug_struct.field("page_size", &self.page_size);
1181        debug_struct.field("page_token", &self.page_token);
1182        debug_struct.field("prefix", &self.prefix);
1183        debug_struct.field("read_mask", &self.read_mask);
1184        if !self._unknown_fields.is_empty() {
1185            debug_struct.field("_unknown_fields", &self._unknown_fields);
1186        }
1187        debug_struct.finish()
1188    }
1189}
1190
1191/// The result of a call to Buckets.ListBuckets
1192#[derive(Clone, Default, PartialEq)]
1193#[non_exhaustive]
1194pub struct ListBucketsResponse {
1195    /// The list of items.
1196    pub buckets: std::vec::Vec<crate::model::Bucket>,
1197
1198    /// The continuation token, used to page through large result sets. Provide
1199    /// this value in a subsequent request to return the next page of results.
1200    pub next_page_token: std::string::String,
1201
1202    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1203}
1204
1205impl ListBucketsResponse {
1206    pub fn new() -> Self {
1207        std::default::Default::default()
1208    }
1209
1210    /// Sets the value of [buckets][crate::model::ListBucketsResponse::buckets].
1211    pub fn set_buckets<T, V>(mut self, v: T) -> Self
1212    where
1213        T: std::iter::IntoIterator<Item = V>,
1214        V: std::convert::Into<crate::model::Bucket>,
1215    {
1216        use std::iter::Iterator;
1217        self.buckets = v.into_iter().map(|i| i.into()).collect();
1218        self
1219    }
1220
1221    /// Sets the value of [next_page_token][crate::model::ListBucketsResponse::next_page_token].
1222    pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1223        self.next_page_token = v.into();
1224        self
1225    }
1226}
1227
1228impl wkt::message::Message for ListBucketsResponse {
1229    fn typename() -> &'static str {
1230        "type.googleapis.com/google.storage.v2.ListBucketsResponse"
1231    }
1232}
1233
1234#[doc(hidden)]
1235impl gax::paginator::internal::PageableResponse for ListBucketsResponse {
1236    type PageItem = crate::model::Bucket;
1237
1238    fn items(self) -> std::vec::Vec<Self::PageItem> {
1239        self.buckets
1240    }
1241
1242    fn next_page_token(&self) -> std::string::String {
1243        use std::clone::Clone;
1244        self.next_page_token.clone()
1245    }
1246}
1247
1248#[doc(hidden)]
1249impl<'de> serde::de::Deserialize<'de> for ListBucketsResponse {
1250    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
1251    where
1252        D: serde::Deserializer<'de>,
1253    {
1254        #[allow(non_camel_case_types)]
1255        #[doc(hidden)]
1256        #[derive(PartialEq, Eq, Hash)]
1257        enum __FieldTag {
1258            __buckets,
1259            __next_page_token,
1260            Unknown(std::string::String),
1261        }
1262        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
1263            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
1264            where
1265                D: serde::Deserializer<'de>,
1266            {
1267                struct Visitor;
1268                impl<'de> serde::de::Visitor<'de> for Visitor {
1269                    type Value = __FieldTag;
1270                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
1271                        formatter.write_str("a field name for ListBucketsResponse")
1272                    }
1273                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
1274                    where
1275                        E: serde::de::Error,
1276                    {
1277                        use std::result::Result::Ok;
1278                        use std::string::ToString;
1279                        match value {
1280                            "buckets" => Ok(__FieldTag::__buckets),
1281                            "nextPageToken" => Ok(__FieldTag::__next_page_token),
1282                            "next_page_token" => Ok(__FieldTag::__next_page_token),
1283                            _ => Ok(__FieldTag::Unknown(value.to_string())),
1284                        }
1285                    }
1286                }
1287                deserializer.deserialize_identifier(Visitor)
1288            }
1289        }
1290        struct Visitor;
1291        impl<'de> serde::de::Visitor<'de> for Visitor {
1292            type Value = ListBucketsResponse;
1293            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
1294                formatter.write_str("struct ListBucketsResponse")
1295            }
1296            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
1297            where
1298                A: serde::de::MapAccess<'de>,
1299            {
1300                #[allow(unused_imports)]
1301                use serde::de::Error;
1302                use std::option::Option::Some;
1303                let mut fields = std::collections::HashSet::new();
1304                let mut result = Self::Value::new();
1305                while let Some(tag) = map.next_key::<__FieldTag>()? {
1306                    #[allow(clippy::match_single_binding)]
1307                    match tag {
1308                        __FieldTag::__buckets => {
1309                            if !fields.insert(__FieldTag::__buckets) {
1310                                return std::result::Result::Err(A::Error::duplicate_field(
1311                                    "multiple values for buckets",
1312                                ));
1313                            }
1314                            result.buckets = map.next_value::<std::option::Option<std::vec::Vec<crate::model::Bucket>>>()?.unwrap_or_default();
1315                        }
1316                        __FieldTag::__next_page_token => {
1317                            if !fields.insert(__FieldTag::__next_page_token) {
1318                                return std::result::Result::Err(A::Error::duplicate_field(
1319                                    "multiple values for next_page_token",
1320                                ));
1321                            }
1322                            result.next_page_token = map
1323                                .next_value::<std::option::Option<std::string::String>>()?
1324                                .unwrap_or_default();
1325                        }
1326                        __FieldTag::Unknown(key) => {
1327                            let value = map.next_value::<serde_json::Value>()?;
1328                            result._unknown_fields.insert(key, value);
1329                        }
1330                    }
1331                }
1332                std::result::Result::Ok(result)
1333            }
1334        }
1335        deserializer.deserialize_any(Visitor)
1336    }
1337}
1338
1339#[doc(hidden)]
1340impl serde::ser::Serialize for ListBucketsResponse {
1341    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
1342    where
1343        S: serde::ser::Serializer,
1344    {
1345        use serde::ser::SerializeMap;
1346        #[allow(unused_imports)]
1347        use std::option::Option::Some;
1348        let mut state = serializer.serialize_map(std::option::Option::None)?;
1349        if !self.buckets.is_empty() {
1350            state.serialize_entry("buckets", &self.buckets)?;
1351        }
1352        if !self.next_page_token.is_empty() {
1353            state.serialize_entry("nextPageToken", &self.next_page_token)?;
1354        }
1355        if !self._unknown_fields.is_empty() {
1356            for (key, value) in self._unknown_fields.iter() {
1357                state.serialize_entry(key, &value)?;
1358            }
1359        }
1360        state.end()
1361    }
1362}
1363
1364impl std::fmt::Debug for ListBucketsResponse {
1365    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
1366        let mut debug_struct = f.debug_struct("ListBucketsResponse");
1367        debug_struct.field("buckets", &self.buckets);
1368        debug_struct.field("next_page_token", &self.next_page_token);
1369        if !self._unknown_fields.is_empty() {
1370            debug_struct.field("_unknown_fields", &self._unknown_fields);
1371        }
1372        debug_struct.finish()
1373    }
1374}
1375
1376/// Request message for LockBucketRetentionPolicyRequest.
1377#[derive(Clone, Default, PartialEq)]
1378#[non_exhaustive]
1379pub struct LockBucketRetentionPolicyRequest {
1380    /// Required. Name of a bucket.
1381    pub bucket: std::string::String,
1382
1383    /// Required. Makes the operation conditional on whether bucket's current
1384    /// metageneration matches the given value. Must be positive.
1385    pub if_metageneration_match: i64,
1386
1387    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1388}
1389
1390impl LockBucketRetentionPolicyRequest {
1391    pub fn new() -> Self {
1392        std::default::Default::default()
1393    }
1394
1395    /// Sets the value of [bucket][crate::model::LockBucketRetentionPolicyRequest::bucket].
1396    pub fn set_bucket<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1397        self.bucket = v.into();
1398        self
1399    }
1400
1401    /// Sets the value of [if_metageneration_match][crate::model::LockBucketRetentionPolicyRequest::if_metageneration_match].
1402    pub fn set_if_metageneration_match<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
1403        self.if_metageneration_match = v.into();
1404        self
1405    }
1406}
1407
1408impl wkt::message::Message for LockBucketRetentionPolicyRequest {
1409    fn typename() -> &'static str {
1410        "type.googleapis.com/google.storage.v2.LockBucketRetentionPolicyRequest"
1411    }
1412}
1413
1414#[doc(hidden)]
1415impl<'de> serde::de::Deserialize<'de> for LockBucketRetentionPolicyRequest {
1416    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
1417    where
1418        D: serde::Deserializer<'de>,
1419    {
1420        #[allow(non_camel_case_types)]
1421        #[doc(hidden)]
1422        #[derive(PartialEq, Eq, Hash)]
1423        enum __FieldTag {
1424            __bucket,
1425            __if_metageneration_match,
1426            Unknown(std::string::String),
1427        }
1428        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
1429            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
1430            where
1431                D: serde::Deserializer<'de>,
1432            {
1433                struct Visitor;
1434                impl<'de> serde::de::Visitor<'de> for Visitor {
1435                    type Value = __FieldTag;
1436                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
1437                        formatter.write_str("a field name for LockBucketRetentionPolicyRequest")
1438                    }
1439                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
1440                    where
1441                        E: serde::de::Error,
1442                    {
1443                        use std::result::Result::Ok;
1444                        use std::string::ToString;
1445                        match value {
1446                            "bucket" => Ok(__FieldTag::__bucket),
1447                            "ifMetagenerationMatch" => Ok(__FieldTag::__if_metageneration_match),
1448                            "if_metageneration_match" => Ok(__FieldTag::__if_metageneration_match),
1449                            _ => Ok(__FieldTag::Unknown(value.to_string())),
1450                        }
1451                    }
1452                }
1453                deserializer.deserialize_identifier(Visitor)
1454            }
1455        }
1456        struct Visitor;
1457        impl<'de> serde::de::Visitor<'de> for Visitor {
1458            type Value = LockBucketRetentionPolicyRequest;
1459            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
1460                formatter.write_str("struct LockBucketRetentionPolicyRequest")
1461            }
1462            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
1463            where
1464                A: serde::de::MapAccess<'de>,
1465            {
1466                #[allow(unused_imports)]
1467                use serde::de::Error;
1468                use std::option::Option::Some;
1469                let mut fields = std::collections::HashSet::new();
1470                let mut result = Self::Value::new();
1471                while let Some(tag) = map.next_key::<__FieldTag>()? {
1472                    #[allow(clippy::match_single_binding)]
1473                    match tag {
1474                        __FieldTag::__bucket => {
1475                            if !fields.insert(__FieldTag::__bucket) {
1476                                return std::result::Result::Err(A::Error::duplicate_field(
1477                                    "multiple values for bucket",
1478                                ));
1479                            }
1480                            result.bucket = map
1481                                .next_value::<std::option::Option<std::string::String>>()?
1482                                .unwrap_or_default();
1483                        }
1484                        __FieldTag::__if_metageneration_match => {
1485                            if !fields.insert(__FieldTag::__if_metageneration_match) {
1486                                return std::result::Result::Err(A::Error::duplicate_field(
1487                                    "multiple values for if_metageneration_match",
1488                                ));
1489                            }
1490                            struct __With(std::option::Option<i64>);
1491                            impl<'de> serde::de::Deserialize<'de> for __With {
1492                                fn deserialize<D>(
1493                                    deserializer: D,
1494                                ) -> std::result::Result<Self, D::Error>
1495                                where
1496                                    D: serde::de::Deserializer<'de>,
1497                                {
1498                                    serde_with::As::< std::option::Option<wkt::internal::I64> >::deserialize(deserializer).map(__With)
1499                                }
1500                            }
1501                            result.if_metageneration_match =
1502                                map.next_value::<__With>()?.0.unwrap_or_default();
1503                        }
1504                        __FieldTag::Unknown(key) => {
1505                            let value = map.next_value::<serde_json::Value>()?;
1506                            result._unknown_fields.insert(key, value);
1507                        }
1508                    }
1509                }
1510                std::result::Result::Ok(result)
1511            }
1512        }
1513        deserializer.deserialize_any(Visitor)
1514    }
1515}
1516
1517#[doc(hidden)]
1518impl serde::ser::Serialize for LockBucketRetentionPolicyRequest {
1519    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
1520    where
1521        S: serde::ser::Serializer,
1522    {
1523        use serde::ser::SerializeMap;
1524        #[allow(unused_imports)]
1525        use std::option::Option::Some;
1526        let mut state = serializer.serialize_map(std::option::Option::None)?;
1527        if !self.bucket.is_empty() {
1528            state.serialize_entry("bucket", &self.bucket)?;
1529        }
1530        if !wkt::internal::is_default(&self.if_metageneration_match) {
1531            struct __With<'a>(&'a i64);
1532            impl<'a> serde::ser::Serialize for __With<'a> {
1533                fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
1534                where
1535                    S: serde::ser::Serializer,
1536                {
1537                    serde_with::As::<wkt::internal::I64>::serialize(self.0, serializer)
1538                }
1539            }
1540            state.serialize_entry(
1541                "ifMetagenerationMatch",
1542                &__With(&self.if_metageneration_match),
1543            )?;
1544        }
1545        if !self._unknown_fields.is_empty() {
1546            for (key, value) in self._unknown_fields.iter() {
1547                state.serialize_entry(key, &value)?;
1548            }
1549        }
1550        state.end()
1551    }
1552}
1553
1554impl std::fmt::Debug for LockBucketRetentionPolicyRequest {
1555    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
1556        let mut debug_struct = f.debug_struct("LockBucketRetentionPolicyRequest");
1557        debug_struct.field("bucket", &self.bucket);
1558        debug_struct.field("if_metageneration_match", &self.if_metageneration_match);
1559        if !self._unknown_fields.is_empty() {
1560            debug_struct.field("_unknown_fields", &self._unknown_fields);
1561        }
1562        debug_struct.finish()
1563    }
1564}
1565
1566/// Request for UpdateBucket method.
1567#[derive(Clone, Default, PartialEq)]
1568#[non_exhaustive]
1569pub struct UpdateBucketRequest {
1570    /// Required. The bucket to update.
1571    /// The bucket's `name` field will be used to identify the bucket.
1572    pub bucket: std::option::Option<crate::model::Bucket>,
1573
1574    /// If set, will only modify the bucket if its metageneration matches this
1575    /// value.
1576    pub if_metageneration_match: std::option::Option<i64>,
1577
1578    /// If set, will only modify the bucket if its metageneration does not match
1579    /// this value.
1580    pub if_metageneration_not_match: std::option::Option<i64>,
1581
1582    /// Optional. Apply a predefined set of access controls to this bucket.
1583    /// Valid values are "authenticatedRead", "private", "projectPrivate",
1584    /// "publicRead", or "publicReadWrite".
1585    pub predefined_acl: std::string::String,
1586
1587    /// Optional. Apply a predefined set of default object access controls to this
1588    /// bucket. Valid values are "authenticatedRead", "bucketOwnerFullControl",
1589    /// "bucketOwnerRead", "private", "projectPrivate", or "publicRead".
1590    pub predefined_default_object_acl: std::string::String,
1591
1592    /// Required. List of fields to be updated.
1593    ///
1594    /// To specify ALL fields, equivalent to the JSON API's "update" function,
1595    /// specify a single field with the value `*`. Note: not recommended. If a new
1596    /// field is introduced at a later time, an older client updating with the `*`
1597    /// may accidentally reset the new field's value.
1598    ///
1599    /// Not specifying any fields is an error.
1600    pub update_mask: std::option::Option<wkt::FieldMask>,
1601
1602    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1603}
1604
1605impl UpdateBucketRequest {
1606    pub fn new() -> Self {
1607        std::default::Default::default()
1608    }
1609
1610    /// Sets the value of [bucket][crate::model::UpdateBucketRequest::bucket].
1611    pub fn set_bucket<T>(mut self, v: T) -> Self
1612    where
1613        T: std::convert::Into<crate::model::Bucket>,
1614    {
1615        self.bucket = std::option::Option::Some(v.into());
1616        self
1617    }
1618
1619    /// Sets or clears the value of [bucket][crate::model::UpdateBucketRequest::bucket].
1620    pub fn set_or_clear_bucket<T>(mut self, v: std::option::Option<T>) -> Self
1621    where
1622        T: std::convert::Into<crate::model::Bucket>,
1623    {
1624        self.bucket = v.map(|x| x.into());
1625        self
1626    }
1627
1628    /// Sets the value of [if_metageneration_match][crate::model::UpdateBucketRequest::if_metageneration_match].
1629    pub fn set_if_metageneration_match<T>(mut self, v: T) -> Self
1630    where
1631        T: std::convert::Into<i64>,
1632    {
1633        self.if_metageneration_match = std::option::Option::Some(v.into());
1634        self
1635    }
1636
1637    /// Sets or clears the value of [if_metageneration_match][crate::model::UpdateBucketRequest::if_metageneration_match].
1638    pub fn set_or_clear_if_metageneration_match<T>(mut self, v: std::option::Option<T>) -> Self
1639    where
1640        T: std::convert::Into<i64>,
1641    {
1642        self.if_metageneration_match = v.map(|x| x.into());
1643        self
1644    }
1645
1646    /// Sets the value of [if_metageneration_not_match][crate::model::UpdateBucketRequest::if_metageneration_not_match].
1647    pub fn set_if_metageneration_not_match<T>(mut self, v: T) -> Self
1648    where
1649        T: std::convert::Into<i64>,
1650    {
1651        self.if_metageneration_not_match = std::option::Option::Some(v.into());
1652        self
1653    }
1654
1655    /// Sets or clears the value of [if_metageneration_not_match][crate::model::UpdateBucketRequest::if_metageneration_not_match].
1656    pub fn set_or_clear_if_metageneration_not_match<T>(mut self, v: std::option::Option<T>) -> Self
1657    where
1658        T: std::convert::Into<i64>,
1659    {
1660        self.if_metageneration_not_match = v.map(|x| x.into());
1661        self
1662    }
1663
1664    /// Sets the value of [predefined_acl][crate::model::UpdateBucketRequest::predefined_acl].
1665    pub fn set_predefined_acl<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1666        self.predefined_acl = v.into();
1667        self
1668    }
1669
1670    /// Sets the value of [predefined_default_object_acl][crate::model::UpdateBucketRequest::predefined_default_object_acl].
1671    pub fn set_predefined_default_object_acl<T: std::convert::Into<std::string::String>>(
1672        mut self,
1673        v: T,
1674    ) -> Self {
1675        self.predefined_default_object_acl = v.into();
1676        self
1677    }
1678
1679    /// Sets the value of [update_mask][crate::model::UpdateBucketRequest::update_mask].
1680    pub fn set_update_mask<T>(mut self, v: T) -> Self
1681    where
1682        T: std::convert::Into<wkt::FieldMask>,
1683    {
1684        self.update_mask = std::option::Option::Some(v.into());
1685        self
1686    }
1687
1688    /// Sets or clears the value of [update_mask][crate::model::UpdateBucketRequest::update_mask].
1689    pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
1690    where
1691        T: std::convert::Into<wkt::FieldMask>,
1692    {
1693        self.update_mask = v.map(|x| x.into());
1694        self
1695    }
1696}
1697
1698impl wkt::message::Message for UpdateBucketRequest {
1699    fn typename() -> &'static str {
1700        "type.googleapis.com/google.storage.v2.UpdateBucketRequest"
1701    }
1702}
1703
1704#[doc(hidden)]
1705impl<'de> serde::de::Deserialize<'de> for UpdateBucketRequest {
1706    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
1707    where
1708        D: serde::Deserializer<'de>,
1709    {
1710        #[allow(non_camel_case_types)]
1711        #[doc(hidden)]
1712        #[derive(PartialEq, Eq, Hash)]
1713        enum __FieldTag {
1714            __bucket,
1715            __if_metageneration_match,
1716            __if_metageneration_not_match,
1717            __predefined_acl,
1718            __predefined_default_object_acl,
1719            __update_mask,
1720            Unknown(std::string::String),
1721        }
1722        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
1723            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
1724            where
1725                D: serde::Deserializer<'de>,
1726            {
1727                struct Visitor;
1728                impl<'de> serde::de::Visitor<'de> for Visitor {
1729                    type Value = __FieldTag;
1730                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
1731                        formatter.write_str("a field name for UpdateBucketRequest")
1732                    }
1733                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
1734                    where
1735                        E: serde::de::Error,
1736                    {
1737                        use std::result::Result::Ok;
1738                        use std::string::ToString;
1739                        match value {
1740                            "bucket" => Ok(__FieldTag::__bucket),
1741                            "ifMetagenerationMatch" => Ok(__FieldTag::__if_metageneration_match),
1742                            "if_metageneration_match" => Ok(__FieldTag::__if_metageneration_match),
1743                            "ifMetagenerationNotMatch" => {
1744                                Ok(__FieldTag::__if_metageneration_not_match)
1745                            }
1746                            "if_metageneration_not_match" => {
1747                                Ok(__FieldTag::__if_metageneration_not_match)
1748                            }
1749                            "predefinedAcl" => Ok(__FieldTag::__predefined_acl),
1750                            "predefined_acl" => Ok(__FieldTag::__predefined_acl),
1751                            "predefinedDefaultObjectAcl" => {
1752                                Ok(__FieldTag::__predefined_default_object_acl)
1753                            }
1754                            "predefined_default_object_acl" => {
1755                                Ok(__FieldTag::__predefined_default_object_acl)
1756                            }
1757                            "updateMask" => Ok(__FieldTag::__update_mask),
1758                            "update_mask" => Ok(__FieldTag::__update_mask),
1759                            _ => Ok(__FieldTag::Unknown(value.to_string())),
1760                        }
1761                    }
1762                }
1763                deserializer.deserialize_identifier(Visitor)
1764            }
1765        }
1766        struct Visitor;
1767        impl<'de> serde::de::Visitor<'de> for Visitor {
1768            type Value = UpdateBucketRequest;
1769            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
1770                formatter.write_str("struct UpdateBucketRequest")
1771            }
1772            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
1773            where
1774                A: serde::de::MapAccess<'de>,
1775            {
1776                #[allow(unused_imports)]
1777                use serde::de::Error;
1778                use std::option::Option::Some;
1779                let mut fields = std::collections::HashSet::new();
1780                let mut result = Self::Value::new();
1781                while let Some(tag) = map.next_key::<__FieldTag>()? {
1782                    #[allow(clippy::match_single_binding)]
1783                    match tag {
1784                        __FieldTag::__bucket => {
1785                            if !fields.insert(__FieldTag::__bucket) {
1786                                return std::result::Result::Err(A::Error::duplicate_field(
1787                                    "multiple values for bucket",
1788                                ));
1789                            }
1790                            result.bucket =
1791                                map.next_value::<std::option::Option<crate::model::Bucket>>()?;
1792                        }
1793                        __FieldTag::__if_metageneration_match => {
1794                            if !fields.insert(__FieldTag::__if_metageneration_match) {
1795                                return std::result::Result::Err(A::Error::duplicate_field(
1796                                    "multiple values for if_metageneration_match",
1797                                ));
1798                            }
1799                            struct __With(std::option::Option<i64>);
1800                            impl<'de> serde::de::Deserialize<'de> for __With {
1801                                fn deserialize<D>(
1802                                    deserializer: D,
1803                                ) -> std::result::Result<Self, D::Error>
1804                                where
1805                                    D: serde::de::Deserializer<'de>,
1806                                {
1807                                    serde_with::As::< std::option::Option<wkt::internal::I64> >::deserialize(deserializer).map(__With)
1808                                }
1809                            }
1810                            result.if_metageneration_match = map.next_value::<__With>()?.0;
1811                        }
1812                        __FieldTag::__if_metageneration_not_match => {
1813                            if !fields.insert(__FieldTag::__if_metageneration_not_match) {
1814                                return std::result::Result::Err(A::Error::duplicate_field(
1815                                    "multiple values for if_metageneration_not_match",
1816                                ));
1817                            }
1818                            struct __With(std::option::Option<i64>);
1819                            impl<'de> serde::de::Deserialize<'de> for __With {
1820                                fn deserialize<D>(
1821                                    deserializer: D,
1822                                ) -> std::result::Result<Self, D::Error>
1823                                where
1824                                    D: serde::de::Deserializer<'de>,
1825                                {
1826                                    serde_with::As::< std::option::Option<wkt::internal::I64> >::deserialize(deserializer).map(__With)
1827                                }
1828                            }
1829                            result.if_metageneration_not_match = map.next_value::<__With>()?.0;
1830                        }
1831                        __FieldTag::__predefined_acl => {
1832                            if !fields.insert(__FieldTag::__predefined_acl) {
1833                                return std::result::Result::Err(A::Error::duplicate_field(
1834                                    "multiple values for predefined_acl",
1835                                ));
1836                            }
1837                            result.predefined_acl = map
1838                                .next_value::<std::option::Option<std::string::String>>()?
1839                                .unwrap_or_default();
1840                        }
1841                        __FieldTag::__predefined_default_object_acl => {
1842                            if !fields.insert(__FieldTag::__predefined_default_object_acl) {
1843                                return std::result::Result::Err(A::Error::duplicate_field(
1844                                    "multiple values for predefined_default_object_acl",
1845                                ));
1846                            }
1847                            result.predefined_default_object_acl = map
1848                                .next_value::<std::option::Option<std::string::String>>()?
1849                                .unwrap_or_default();
1850                        }
1851                        __FieldTag::__update_mask => {
1852                            if !fields.insert(__FieldTag::__update_mask) {
1853                                return std::result::Result::Err(A::Error::duplicate_field(
1854                                    "multiple values for update_mask",
1855                                ));
1856                            }
1857                            result.update_mask =
1858                                map.next_value::<std::option::Option<wkt::FieldMask>>()?;
1859                        }
1860                        __FieldTag::Unknown(key) => {
1861                            let value = map.next_value::<serde_json::Value>()?;
1862                            result._unknown_fields.insert(key, value);
1863                        }
1864                    }
1865                }
1866                std::result::Result::Ok(result)
1867            }
1868        }
1869        deserializer.deserialize_any(Visitor)
1870    }
1871}
1872
1873#[doc(hidden)]
1874impl serde::ser::Serialize for UpdateBucketRequest {
1875    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
1876    where
1877        S: serde::ser::Serializer,
1878    {
1879        use serde::ser::SerializeMap;
1880        #[allow(unused_imports)]
1881        use std::option::Option::Some;
1882        let mut state = serializer.serialize_map(std::option::Option::None)?;
1883        if self.bucket.is_some() {
1884            state.serialize_entry("bucket", &self.bucket)?;
1885        }
1886        if self.if_metageneration_match.is_some() {
1887            struct __With<'a>(&'a std::option::Option<i64>);
1888            impl<'a> serde::ser::Serialize for __With<'a> {
1889                fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
1890                where
1891                    S: serde::ser::Serializer,
1892                {
1893                    serde_with::As::<std::option::Option<wkt::internal::I64>>::serialize(
1894                        self.0, serializer,
1895                    )
1896                }
1897            }
1898            state.serialize_entry(
1899                "ifMetagenerationMatch",
1900                &__With(&self.if_metageneration_match),
1901            )?;
1902        }
1903        if self.if_metageneration_not_match.is_some() {
1904            struct __With<'a>(&'a std::option::Option<i64>);
1905            impl<'a> serde::ser::Serialize for __With<'a> {
1906                fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
1907                where
1908                    S: serde::ser::Serializer,
1909                {
1910                    serde_with::As::<std::option::Option<wkt::internal::I64>>::serialize(
1911                        self.0, serializer,
1912                    )
1913                }
1914            }
1915            state.serialize_entry(
1916                "ifMetagenerationNotMatch",
1917                &__With(&self.if_metageneration_not_match),
1918            )?;
1919        }
1920        if !self.predefined_acl.is_empty() {
1921            state.serialize_entry("predefinedAcl", &self.predefined_acl)?;
1922        }
1923        if !self.predefined_default_object_acl.is_empty() {
1924            state.serialize_entry(
1925                "predefinedDefaultObjectAcl",
1926                &self.predefined_default_object_acl,
1927            )?;
1928        }
1929        if self.update_mask.is_some() {
1930            state.serialize_entry("updateMask", &self.update_mask)?;
1931        }
1932        if !self._unknown_fields.is_empty() {
1933            for (key, value) in self._unknown_fields.iter() {
1934                state.serialize_entry(key, &value)?;
1935            }
1936        }
1937        state.end()
1938    }
1939}
1940
1941impl std::fmt::Debug for UpdateBucketRequest {
1942    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
1943        let mut debug_struct = f.debug_struct("UpdateBucketRequest");
1944        debug_struct.field("bucket", &self.bucket);
1945        debug_struct.field("if_metageneration_match", &self.if_metageneration_match);
1946        debug_struct.field(
1947            "if_metageneration_not_match",
1948            &self.if_metageneration_not_match,
1949        );
1950        debug_struct.field("predefined_acl", &self.predefined_acl);
1951        debug_struct.field(
1952            "predefined_default_object_acl",
1953            &self.predefined_default_object_acl,
1954        );
1955        debug_struct.field("update_mask", &self.update_mask);
1956        if !self._unknown_fields.is_empty() {
1957            debug_struct.field("_unknown_fields", &self._unknown_fields);
1958        }
1959        debug_struct.finish()
1960    }
1961}
1962
1963/// Request message for ComposeObject.
1964#[derive(Clone, Default, PartialEq)]
1965#[non_exhaustive]
1966pub struct ComposeObjectRequest {
1967    /// Required. Properties of the resulting object.
1968    pub destination: std::option::Option<crate::model::Object>,
1969
1970    /// Optional. The list of source objects that will be concatenated into a
1971    /// single object.
1972    pub source_objects: std::vec::Vec<crate::model::compose_object_request::SourceObject>,
1973
1974    /// Optional. Apply a predefined set of access controls to the destination
1975    /// object. Valid values are "authenticatedRead", "bucketOwnerFullControl",
1976    /// "bucketOwnerRead", "private", "projectPrivate", or "publicRead".
1977    pub destination_predefined_acl: std::string::String,
1978
1979    /// Makes the operation conditional on whether the object's current generation
1980    /// matches the given value. Setting to 0 makes the operation succeed only if
1981    /// there are no live versions of the object.
1982    pub if_generation_match: std::option::Option<i64>,
1983
1984    /// Makes the operation conditional on whether the object's current
1985    /// metageneration matches the given value.
1986    pub if_metageneration_match: std::option::Option<i64>,
1987
1988    /// Optional. Resource name of the Cloud KMS key, of the form
1989    /// `projects/my-project/locations/my-location/keyRings/my-kr/cryptoKeys/my-key`,
1990    /// that will be used to encrypt the object. Overrides the object
1991    /// metadata's `kms_key_name` value, if any.
1992    pub kms_key: std::string::String,
1993
1994    /// Optional. A set of parameters common to Storage API requests concerning an
1995    /// object.
1996    pub common_object_request_params: std::option::Option<crate::model::CommonObjectRequestParams>,
1997
1998    /// Optional. The checksums of the complete object. This will be validated
1999    /// against the combined checksums of the component objects.
2000    pub object_checksums: std::option::Option<crate::model::ObjectChecksums>,
2001
2002    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2003}
2004
2005impl ComposeObjectRequest {
2006    pub fn new() -> Self {
2007        std::default::Default::default()
2008    }
2009
2010    /// Sets the value of [destination][crate::model::ComposeObjectRequest::destination].
2011    pub fn set_destination<T>(mut self, v: T) -> Self
2012    where
2013        T: std::convert::Into<crate::model::Object>,
2014    {
2015        self.destination = std::option::Option::Some(v.into());
2016        self
2017    }
2018
2019    /// Sets or clears the value of [destination][crate::model::ComposeObjectRequest::destination].
2020    pub fn set_or_clear_destination<T>(mut self, v: std::option::Option<T>) -> Self
2021    where
2022        T: std::convert::Into<crate::model::Object>,
2023    {
2024        self.destination = v.map(|x| x.into());
2025        self
2026    }
2027
2028    /// Sets the value of [source_objects][crate::model::ComposeObjectRequest::source_objects].
2029    pub fn set_source_objects<T, V>(mut self, v: T) -> Self
2030    where
2031        T: std::iter::IntoIterator<Item = V>,
2032        V: std::convert::Into<crate::model::compose_object_request::SourceObject>,
2033    {
2034        use std::iter::Iterator;
2035        self.source_objects = v.into_iter().map(|i| i.into()).collect();
2036        self
2037    }
2038
2039    /// Sets the value of [destination_predefined_acl][crate::model::ComposeObjectRequest::destination_predefined_acl].
2040    pub fn set_destination_predefined_acl<T: std::convert::Into<std::string::String>>(
2041        mut self,
2042        v: T,
2043    ) -> Self {
2044        self.destination_predefined_acl = v.into();
2045        self
2046    }
2047
2048    /// Sets the value of [if_generation_match][crate::model::ComposeObjectRequest::if_generation_match].
2049    pub fn set_if_generation_match<T>(mut self, v: T) -> Self
2050    where
2051        T: std::convert::Into<i64>,
2052    {
2053        self.if_generation_match = std::option::Option::Some(v.into());
2054        self
2055    }
2056
2057    /// Sets or clears the value of [if_generation_match][crate::model::ComposeObjectRequest::if_generation_match].
2058    pub fn set_or_clear_if_generation_match<T>(mut self, v: std::option::Option<T>) -> Self
2059    where
2060        T: std::convert::Into<i64>,
2061    {
2062        self.if_generation_match = v.map(|x| x.into());
2063        self
2064    }
2065
2066    /// Sets the value of [if_metageneration_match][crate::model::ComposeObjectRequest::if_metageneration_match].
2067    pub fn set_if_metageneration_match<T>(mut self, v: T) -> Self
2068    where
2069        T: std::convert::Into<i64>,
2070    {
2071        self.if_metageneration_match = std::option::Option::Some(v.into());
2072        self
2073    }
2074
2075    /// Sets or clears the value of [if_metageneration_match][crate::model::ComposeObjectRequest::if_metageneration_match].
2076    pub fn set_or_clear_if_metageneration_match<T>(mut self, v: std::option::Option<T>) -> Self
2077    where
2078        T: std::convert::Into<i64>,
2079    {
2080        self.if_metageneration_match = v.map(|x| x.into());
2081        self
2082    }
2083
2084    /// Sets the value of [kms_key][crate::model::ComposeObjectRequest::kms_key].
2085    pub fn set_kms_key<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2086        self.kms_key = v.into();
2087        self
2088    }
2089
2090    /// Sets the value of [common_object_request_params][crate::model::ComposeObjectRequest::common_object_request_params].
2091    pub fn set_common_object_request_params<T>(mut self, v: T) -> Self
2092    where
2093        T: std::convert::Into<crate::model::CommonObjectRequestParams>,
2094    {
2095        self.common_object_request_params = std::option::Option::Some(v.into());
2096        self
2097    }
2098
2099    /// Sets or clears the value of [common_object_request_params][crate::model::ComposeObjectRequest::common_object_request_params].
2100    pub fn set_or_clear_common_object_request_params<T>(mut self, v: std::option::Option<T>) -> Self
2101    where
2102        T: std::convert::Into<crate::model::CommonObjectRequestParams>,
2103    {
2104        self.common_object_request_params = v.map(|x| x.into());
2105        self
2106    }
2107
2108    /// Sets the value of [object_checksums][crate::model::ComposeObjectRequest::object_checksums].
2109    pub fn set_object_checksums<T>(mut self, v: T) -> Self
2110    where
2111        T: std::convert::Into<crate::model::ObjectChecksums>,
2112    {
2113        self.object_checksums = std::option::Option::Some(v.into());
2114        self
2115    }
2116
2117    /// Sets or clears the value of [object_checksums][crate::model::ComposeObjectRequest::object_checksums].
2118    pub fn set_or_clear_object_checksums<T>(mut self, v: std::option::Option<T>) -> Self
2119    where
2120        T: std::convert::Into<crate::model::ObjectChecksums>,
2121    {
2122        self.object_checksums = v.map(|x| x.into());
2123        self
2124    }
2125}
2126
2127impl wkt::message::Message for ComposeObjectRequest {
2128    fn typename() -> &'static str {
2129        "type.googleapis.com/google.storage.v2.ComposeObjectRequest"
2130    }
2131}
2132
2133#[doc(hidden)]
2134impl<'de> serde::de::Deserialize<'de> for ComposeObjectRequest {
2135    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
2136    where
2137        D: serde::Deserializer<'de>,
2138    {
2139        #[allow(non_camel_case_types)]
2140        #[doc(hidden)]
2141        #[derive(PartialEq, Eq, Hash)]
2142        enum __FieldTag {
2143            __destination,
2144            __source_objects,
2145            __destination_predefined_acl,
2146            __if_generation_match,
2147            __if_metageneration_match,
2148            __kms_key,
2149            __common_object_request_params,
2150            __object_checksums,
2151            Unknown(std::string::String),
2152        }
2153        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
2154            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
2155            where
2156                D: serde::Deserializer<'de>,
2157            {
2158                struct Visitor;
2159                impl<'de> serde::de::Visitor<'de> for Visitor {
2160                    type Value = __FieldTag;
2161                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
2162                        formatter.write_str("a field name for ComposeObjectRequest")
2163                    }
2164                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
2165                    where
2166                        E: serde::de::Error,
2167                    {
2168                        use std::result::Result::Ok;
2169                        use std::string::ToString;
2170                        match value {
2171                            "destination" => Ok(__FieldTag::__destination),
2172                            "sourceObjects" => Ok(__FieldTag::__source_objects),
2173                            "source_objects" => Ok(__FieldTag::__source_objects),
2174                            "destinationPredefinedAcl" => {
2175                                Ok(__FieldTag::__destination_predefined_acl)
2176                            }
2177                            "destination_predefined_acl" => {
2178                                Ok(__FieldTag::__destination_predefined_acl)
2179                            }
2180                            "ifGenerationMatch" => Ok(__FieldTag::__if_generation_match),
2181                            "if_generation_match" => Ok(__FieldTag::__if_generation_match),
2182                            "ifMetagenerationMatch" => Ok(__FieldTag::__if_metageneration_match),
2183                            "if_metageneration_match" => Ok(__FieldTag::__if_metageneration_match),
2184                            "kmsKey" => Ok(__FieldTag::__kms_key),
2185                            "kms_key" => Ok(__FieldTag::__kms_key),
2186                            "commonObjectRequestParams" => {
2187                                Ok(__FieldTag::__common_object_request_params)
2188                            }
2189                            "common_object_request_params" => {
2190                                Ok(__FieldTag::__common_object_request_params)
2191                            }
2192                            "objectChecksums" => Ok(__FieldTag::__object_checksums),
2193                            "object_checksums" => Ok(__FieldTag::__object_checksums),
2194                            _ => Ok(__FieldTag::Unknown(value.to_string())),
2195                        }
2196                    }
2197                }
2198                deserializer.deserialize_identifier(Visitor)
2199            }
2200        }
2201        struct Visitor;
2202        impl<'de> serde::de::Visitor<'de> for Visitor {
2203            type Value = ComposeObjectRequest;
2204            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
2205                formatter.write_str("struct ComposeObjectRequest")
2206            }
2207            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
2208            where
2209                A: serde::de::MapAccess<'de>,
2210            {
2211                #[allow(unused_imports)]
2212                use serde::de::Error;
2213                use std::option::Option::Some;
2214                let mut fields = std::collections::HashSet::new();
2215                let mut result = Self::Value::new();
2216                while let Some(tag) = map.next_key::<__FieldTag>()? {
2217                    #[allow(clippy::match_single_binding)]
2218                    match tag {
2219                        __FieldTag::__destination => {
2220                            if !fields.insert(__FieldTag::__destination) {
2221                                return std::result::Result::Err(A::Error::duplicate_field(
2222                                    "multiple values for destination",
2223                                ));
2224                            }
2225                            result.destination =
2226                                map.next_value::<std::option::Option<crate::model::Object>>()?;
2227                        }
2228                        __FieldTag::__source_objects => {
2229                            if !fields.insert(__FieldTag::__source_objects) {
2230                                return std::result::Result::Err(A::Error::duplicate_field(
2231                                    "multiple values for source_objects",
2232                                ));
2233                            }
2234                            result.source_objects = map
2235                                .next_value::<std::option::Option<
2236                                    std::vec::Vec<
2237                                        crate::model::compose_object_request::SourceObject,
2238                                    >,
2239                                >>()?
2240                                .unwrap_or_default();
2241                        }
2242                        __FieldTag::__destination_predefined_acl => {
2243                            if !fields.insert(__FieldTag::__destination_predefined_acl) {
2244                                return std::result::Result::Err(A::Error::duplicate_field(
2245                                    "multiple values for destination_predefined_acl",
2246                                ));
2247                            }
2248                            result.destination_predefined_acl = map
2249                                .next_value::<std::option::Option<std::string::String>>()?
2250                                .unwrap_or_default();
2251                        }
2252                        __FieldTag::__if_generation_match => {
2253                            if !fields.insert(__FieldTag::__if_generation_match) {
2254                                return std::result::Result::Err(A::Error::duplicate_field(
2255                                    "multiple values for if_generation_match",
2256                                ));
2257                            }
2258                            struct __With(std::option::Option<i64>);
2259                            impl<'de> serde::de::Deserialize<'de> for __With {
2260                                fn deserialize<D>(
2261                                    deserializer: D,
2262                                ) -> std::result::Result<Self, D::Error>
2263                                where
2264                                    D: serde::de::Deserializer<'de>,
2265                                {
2266                                    serde_with::As::< std::option::Option<wkt::internal::I64> >::deserialize(deserializer).map(__With)
2267                                }
2268                            }
2269                            result.if_generation_match = map.next_value::<__With>()?.0;
2270                        }
2271                        __FieldTag::__if_metageneration_match => {
2272                            if !fields.insert(__FieldTag::__if_metageneration_match) {
2273                                return std::result::Result::Err(A::Error::duplicate_field(
2274                                    "multiple values for if_metageneration_match",
2275                                ));
2276                            }
2277                            struct __With(std::option::Option<i64>);
2278                            impl<'de> serde::de::Deserialize<'de> for __With {
2279                                fn deserialize<D>(
2280                                    deserializer: D,
2281                                ) -> std::result::Result<Self, D::Error>
2282                                where
2283                                    D: serde::de::Deserializer<'de>,
2284                                {
2285                                    serde_with::As::< std::option::Option<wkt::internal::I64> >::deserialize(deserializer).map(__With)
2286                                }
2287                            }
2288                            result.if_metageneration_match = map.next_value::<__With>()?.0;
2289                        }
2290                        __FieldTag::__kms_key => {
2291                            if !fields.insert(__FieldTag::__kms_key) {
2292                                return std::result::Result::Err(A::Error::duplicate_field(
2293                                    "multiple values for kms_key",
2294                                ));
2295                            }
2296                            result.kms_key = map
2297                                .next_value::<std::option::Option<std::string::String>>()?
2298                                .unwrap_or_default();
2299                        }
2300                        __FieldTag::__common_object_request_params => {
2301                            if !fields.insert(__FieldTag::__common_object_request_params) {
2302                                return std::result::Result::Err(A::Error::duplicate_field(
2303                                    "multiple values for common_object_request_params",
2304                                ));
2305                            }
2306                            result.common_object_request_params = map.next_value::<std::option::Option<crate::model::CommonObjectRequestParams>>()?
2307                                ;
2308                        }
2309                        __FieldTag::__object_checksums => {
2310                            if !fields.insert(__FieldTag::__object_checksums) {
2311                                return std::result::Result::Err(A::Error::duplicate_field(
2312                                    "multiple values for object_checksums",
2313                                ));
2314                            }
2315                            result.object_checksums = map
2316                                .next_value::<std::option::Option<crate::model::ObjectChecksums>>(
2317                                )?;
2318                        }
2319                        __FieldTag::Unknown(key) => {
2320                            let value = map.next_value::<serde_json::Value>()?;
2321                            result._unknown_fields.insert(key, value);
2322                        }
2323                    }
2324                }
2325                std::result::Result::Ok(result)
2326            }
2327        }
2328        deserializer.deserialize_any(Visitor)
2329    }
2330}
2331
2332#[doc(hidden)]
2333impl serde::ser::Serialize for ComposeObjectRequest {
2334    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
2335    where
2336        S: serde::ser::Serializer,
2337    {
2338        use serde::ser::SerializeMap;
2339        #[allow(unused_imports)]
2340        use std::option::Option::Some;
2341        let mut state = serializer.serialize_map(std::option::Option::None)?;
2342        if self.destination.is_some() {
2343            state.serialize_entry("destination", &self.destination)?;
2344        }
2345        if !self.source_objects.is_empty() {
2346            state.serialize_entry("sourceObjects", &self.source_objects)?;
2347        }
2348        if !self.destination_predefined_acl.is_empty() {
2349            state.serialize_entry("destinationPredefinedAcl", &self.destination_predefined_acl)?;
2350        }
2351        if self.if_generation_match.is_some() {
2352            struct __With<'a>(&'a std::option::Option<i64>);
2353            impl<'a> serde::ser::Serialize for __With<'a> {
2354                fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
2355                where
2356                    S: serde::ser::Serializer,
2357                {
2358                    serde_with::As::<std::option::Option<wkt::internal::I64>>::serialize(
2359                        self.0, serializer,
2360                    )
2361                }
2362            }
2363            state.serialize_entry("ifGenerationMatch", &__With(&self.if_generation_match))?;
2364        }
2365        if self.if_metageneration_match.is_some() {
2366            struct __With<'a>(&'a std::option::Option<i64>);
2367            impl<'a> serde::ser::Serialize for __With<'a> {
2368                fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
2369                where
2370                    S: serde::ser::Serializer,
2371                {
2372                    serde_with::As::<std::option::Option<wkt::internal::I64>>::serialize(
2373                        self.0, serializer,
2374                    )
2375                }
2376            }
2377            state.serialize_entry(
2378                "ifMetagenerationMatch",
2379                &__With(&self.if_metageneration_match),
2380            )?;
2381        }
2382        if !self.kms_key.is_empty() {
2383            state.serialize_entry("kmsKey", &self.kms_key)?;
2384        }
2385        if self.common_object_request_params.is_some() {
2386            state.serialize_entry(
2387                "commonObjectRequestParams",
2388                &self.common_object_request_params,
2389            )?;
2390        }
2391        if self.object_checksums.is_some() {
2392            state.serialize_entry("objectChecksums", &self.object_checksums)?;
2393        }
2394        if !self._unknown_fields.is_empty() {
2395            for (key, value) in self._unknown_fields.iter() {
2396                state.serialize_entry(key, &value)?;
2397            }
2398        }
2399        state.end()
2400    }
2401}
2402
2403impl std::fmt::Debug for ComposeObjectRequest {
2404    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
2405        let mut debug_struct = f.debug_struct("ComposeObjectRequest");
2406        debug_struct.field("destination", &self.destination);
2407        debug_struct.field("source_objects", &self.source_objects);
2408        debug_struct.field(
2409            "destination_predefined_acl",
2410            &self.destination_predefined_acl,
2411        );
2412        debug_struct.field("if_generation_match", &self.if_generation_match);
2413        debug_struct.field("if_metageneration_match", &self.if_metageneration_match);
2414        debug_struct.field("kms_key", &self.kms_key);
2415        debug_struct.field(
2416            "common_object_request_params",
2417            &self.common_object_request_params,
2418        );
2419        debug_struct.field("object_checksums", &self.object_checksums);
2420        if !self._unknown_fields.is_empty() {
2421            debug_struct.field("_unknown_fields", &self._unknown_fields);
2422        }
2423        debug_struct.finish()
2424    }
2425}
2426
2427/// Defines additional types related to [ComposeObjectRequest].
2428pub mod compose_object_request {
2429    #[allow(unused_imports)]
2430    use super::*;
2431
2432    /// Description of a source object for a composition request.
2433    #[derive(Clone, Default, PartialEq)]
2434    #[non_exhaustive]
2435    pub struct SourceObject {
2436        /// Required. The source object's name. All source objects must reside in the
2437        /// same bucket.
2438        pub name: std::string::String,
2439
2440        /// Optional. The generation of this object to use as the source.
2441        pub generation: i64,
2442
2443        /// Optional. Conditions that must be met for this operation to execute.
2444        pub object_preconditions: std::option::Option<
2445            crate::model::compose_object_request::source_object::ObjectPreconditions,
2446        >,
2447
2448        _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2449    }
2450
2451    impl SourceObject {
2452        pub fn new() -> Self {
2453            std::default::Default::default()
2454        }
2455
2456        /// Sets the value of [name][crate::model::compose_object_request::SourceObject::name].
2457        pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2458            self.name = v.into();
2459            self
2460        }
2461
2462        /// Sets the value of [generation][crate::model::compose_object_request::SourceObject::generation].
2463        pub fn set_generation<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
2464            self.generation = v.into();
2465            self
2466        }
2467
2468        /// Sets the value of [object_preconditions][crate::model::compose_object_request::SourceObject::object_preconditions].
2469        pub fn set_object_preconditions<T>(mut self, v: T) -> Self
2470        where
2471            T: std::convert::Into<
2472                    crate::model::compose_object_request::source_object::ObjectPreconditions,
2473                >,
2474        {
2475            self.object_preconditions = std::option::Option::Some(v.into());
2476            self
2477        }
2478
2479        /// Sets or clears the value of [object_preconditions][crate::model::compose_object_request::SourceObject::object_preconditions].
2480        pub fn set_or_clear_object_preconditions<T>(mut self, v: std::option::Option<T>) -> Self
2481        where
2482            T: std::convert::Into<
2483                    crate::model::compose_object_request::source_object::ObjectPreconditions,
2484                >,
2485        {
2486            self.object_preconditions = v.map(|x| x.into());
2487            self
2488        }
2489    }
2490
2491    impl wkt::message::Message for SourceObject {
2492        fn typename() -> &'static str {
2493            "type.googleapis.com/google.storage.v2.ComposeObjectRequest.SourceObject"
2494        }
2495    }
2496
2497    #[doc(hidden)]
2498    impl<'de> serde::de::Deserialize<'de> for SourceObject {
2499        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
2500        where
2501            D: serde::Deserializer<'de>,
2502        {
2503            #[allow(non_camel_case_types)]
2504            #[doc(hidden)]
2505            #[derive(PartialEq, Eq, Hash)]
2506            enum __FieldTag {
2507                __name,
2508                __generation,
2509                __object_preconditions,
2510                Unknown(std::string::String),
2511            }
2512            impl<'de> serde::de::Deserialize<'de> for __FieldTag {
2513                fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
2514                where
2515                    D: serde::Deserializer<'de>,
2516                {
2517                    struct Visitor;
2518                    impl<'de> serde::de::Visitor<'de> for Visitor {
2519                        type Value = __FieldTag;
2520                        fn expecting(
2521                            &self,
2522                            formatter: &mut std::fmt::Formatter,
2523                        ) -> std::fmt::Result {
2524                            formatter.write_str("a field name for SourceObject")
2525                        }
2526                        fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
2527                        where
2528                            E: serde::de::Error,
2529                        {
2530                            use std::result::Result::Ok;
2531                            use std::string::ToString;
2532                            match value {
2533                                "name" => Ok(__FieldTag::__name),
2534                                "generation" => Ok(__FieldTag::__generation),
2535                                "objectPreconditions" => Ok(__FieldTag::__object_preconditions),
2536                                "object_preconditions" => Ok(__FieldTag::__object_preconditions),
2537                                _ => Ok(__FieldTag::Unknown(value.to_string())),
2538                            }
2539                        }
2540                    }
2541                    deserializer.deserialize_identifier(Visitor)
2542                }
2543            }
2544            struct Visitor;
2545            impl<'de> serde::de::Visitor<'de> for Visitor {
2546                type Value = SourceObject;
2547                fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
2548                    formatter.write_str("struct SourceObject")
2549                }
2550                fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
2551                where
2552                    A: serde::de::MapAccess<'de>,
2553                {
2554                    #[allow(unused_imports)]
2555                    use serde::de::Error;
2556                    use std::option::Option::Some;
2557                    let mut fields = std::collections::HashSet::new();
2558                    let mut result = Self::Value::new();
2559                    while let Some(tag) = map.next_key::<__FieldTag>()? {
2560                        #[allow(clippy::match_single_binding)]
2561                        match tag {
2562                            __FieldTag::__name => {
2563                                if !fields.insert(__FieldTag::__name) {
2564                                    return std::result::Result::Err(A::Error::duplicate_field(
2565                                        "multiple values for name",
2566                                    ));
2567                                }
2568                                result.name = map
2569                                    .next_value::<std::option::Option<std::string::String>>()?
2570                                    .unwrap_or_default();
2571                            }
2572                            __FieldTag::__generation => {
2573                                if !fields.insert(__FieldTag::__generation) {
2574                                    return std::result::Result::Err(A::Error::duplicate_field(
2575                                        "multiple values for generation",
2576                                    ));
2577                                }
2578                                struct __With(std::option::Option<i64>);
2579                                impl<'de> serde::de::Deserialize<'de> for __With {
2580                                    fn deserialize<D>(
2581                                        deserializer: D,
2582                                    ) -> std::result::Result<Self, D::Error>
2583                                    where
2584                                        D: serde::de::Deserializer<'de>,
2585                                    {
2586                                        serde_with::As::< std::option::Option<wkt::internal::I64> >::deserialize(deserializer).map(__With)
2587                                    }
2588                                }
2589                                result.generation =
2590                                    map.next_value::<__With>()?.0.unwrap_or_default();
2591                            }
2592                            __FieldTag::__object_preconditions => {
2593                                if !fields.insert(__FieldTag::__object_preconditions) {
2594                                    return std::result::Result::Err(A::Error::duplicate_field(
2595                                        "multiple values for object_preconditions",
2596                                    ));
2597                                }
2598                                result.object_preconditions = map.next_value::<std::option::Option<crate::model::compose_object_request::source_object::ObjectPreconditions>>()?
2599                                    ;
2600                            }
2601                            __FieldTag::Unknown(key) => {
2602                                let value = map.next_value::<serde_json::Value>()?;
2603                                result._unknown_fields.insert(key, value);
2604                            }
2605                        }
2606                    }
2607                    std::result::Result::Ok(result)
2608                }
2609            }
2610            deserializer.deserialize_any(Visitor)
2611        }
2612    }
2613
2614    #[doc(hidden)]
2615    impl serde::ser::Serialize for SourceObject {
2616        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
2617        where
2618            S: serde::ser::Serializer,
2619        {
2620            use serde::ser::SerializeMap;
2621            #[allow(unused_imports)]
2622            use std::option::Option::Some;
2623            let mut state = serializer.serialize_map(std::option::Option::None)?;
2624            if !self.name.is_empty() {
2625                state.serialize_entry("name", &self.name)?;
2626            }
2627            if !wkt::internal::is_default(&self.generation) {
2628                struct __With<'a>(&'a i64);
2629                impl<'a> serde::ser::Serialize for __With<'a> {
2630                    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
2631                    where
2632                        S: serde::ser::Serializer,
2633                    {
2634                        serde_with::As::<wkt::internal::I64>::serialize(self.0, serializer)
2635                    }
2636                }
2637                state.serialize_entry("generation", &__With(&self.generation))?;
2638            }
2639            if self.object_preconditions.is_some() {
2640                state.serialize_entry("objectPreconditions", &self.object_preconditions)?;
2641            }
2642            if !self._unknown_fields.is_empty() {
2643                for (key, value) in self._unknown_fields.iter() {
2644                    state.serialize_entry(key, &value)?;
2645                }
2646            }
2647            state.end()
2648        }
2649    }
2650
2651    impl std::fmt::Debug for SourceObject {
2652        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
2653            let mut debug_struct = f.debug_struct("SourceObject");
2654            debug_struct.field("name", &self.name);
2655            debug_struct.field("generation", &self.generation);
2656            debug_struct.field("object_preconditions", &self.object_preconditions);
2657            if !self._unknown_fields.is_empty() {
2658                debug_struct.field("_unknown_fields", &self._unknown_fields);
2659            }
2660            debug_struct.finish()
2661        }
2662    }
2663
2664    /// Defines additional types related to [SourceObject].
2665    pub mod source_object {
2666        #[allow(unused_imports)]
2667        use super::*;
2668
2669        /// Preconditions for a source object of a composition request.
2670        #[derive(Clone, Default, PartialEq)]
2671        #[non_exhaustive]
2672        pub struct ObjectPreconditions {
2673            /// Only perform the composition if the generation of the source object
2674            /// that would be used matches this value.  If this value and a generation
2675            /// are both specified, they must be the same value or the call will fail.
2676            pub if_generation_match: std::option::Option<i64>,
2677
2678            _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2679        }
2680
2681        impl ObjectPreconditions {
2682            pub fn new() -> Self {
2683                std::default::Default::default()
2684            }
2685
2686            /// Sets the value of [if_generation_match][crate::model::compose_object_request::source_object::ObjectPreconditions::if_generation_match].
2687            pub fn set_if_generation_match<T>(mut self, v: T) -> Self
2688            where
2689                T: std::convert::Into<i64>,
2690            {
2691                self.if_generation_match = std::option::Option::Some(v.into());
2692                self
2693            }
2694
2695            /// Sets or clears the value of [if_generation_match][crate::model::compose_object_request::source_object::ObjectPreconditions::if_generation_match].
2696            pub fn set_or_clear_if_generation_match<T>(mut self, v: std::option::Option<T>) -> Self
2697            where
2698                T: std::convert::Into<i64>,
2699            {
2700                self.if_generation_match = v.map(|x| x.into());
2701                self
2702            }
2703        }
2704
2705        impl wkt::message::Message for ObjectPreconditions {
2706            fn typename() -> &'static str {
2707                "type.googleapis.com/google.storage.v2.ComposeObjectRequest.SourceObject.ObjectPreconditions"
2708            }
2709        }
2710
2711        #[doc(hidden)]
2712        impl<'de> serde::de::Deserialize<'de> for ObjectPreconditions {
2713            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
2714            where
2715                D: serde::Deserializer<'de>,
2716            {
2717                #[allow(non_camel_case_types)]
2718                #[doc(hidden)]
2719                #[derive(PartialEq, Eq, Hash)]
2720                enum __FieldTag {
2721                    __if_generation_match,
2722                    Unknown(std::string::String),
2723                }
2724                impl<'de> serde::de::Deserialize<'de> for __FieldTag {
2725                    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
2726                    where
2727                        D: serde::Deserializer<'de>,
2728                    {
2729                        struct Visitor;
2730                        impl<'de> serde::de::Visitor<'de> for Visitor {
2731                            type Value = __FieldTag;
2732                            fn expecting(
2733                                &self,
2734                                formatter: &mut std::fmt::Formatter,
2735                            ) -> std::fmt::Result {
2736                                formatter.write_str("a field name for ObjectPreconditions")
2737                            }
2738                            fn visit_str<E>(
2739                                self,
2740                                value: &str,
2741                            ) -> std::result::Result<Self::Value, E>
2742                            where
2743                                E: serde::de::Error,
2744                            {
2745                                use std::result::Result::Ok;
2746                                use std::string::ToString;
2747                                match value {
2748                                    "ifGenerationMatch" => Ok(__FieldTag::__if_generation_match),
2749                                    "if_generation_match" => Ok(__FieldTag::__if_generation_match),
2750                                    _ => Ok(__FieldTag::Unknown(value.to_string())),
2751                                }
2752                            }
2753                        }
2754                        deserializer.deserialize_identifier(Visitor)
2755                    }
2756                }
2757                struct Visitor;
2758                impl<'de> serde::de::Visitor<'de> for Visitor {
2759                    type Value = ObjectPreconditions;
2760                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
2761                        formatter.write_str("struct ObjectPreconditions")
2762                    }
2763                    fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
2764                    where
2765                        A: serde::de::MapAccess<'de>,
2766                    {
2767                        #[allow(unused_imports)]
2768                        use serde::de::Error;
2769                        use std::option::Option::Some;
2770                        let mut fields = std::collections::HashSet::new();
2771                        let mut result = Self::Value::new();
2772                        while let Some(tag) = map.next_key::<__FieldTag>()? {
2773                            #[allow(clippy::match_single_binding)]
2774                            match tag {
2775                                __FieldTag::__if_generation_match => {
2776                                    if !fields.insert(__FieldTag::__if_generation_match) {
2777                                        return std::result::Result::Err(
2778                                            A::Error::duplicate_field(
2779                                                "multiple values for if_generation_match",
2780                                            ),
2781                                        );
2782                                    }
2783                                    struct __With(std::option::Option<i64>);
2784                                    impl<'de> serde::de::Deserialize<'de> for __With {
2785                                        fn deserialize<D>(
2786                                            deserializer: D,
2787                                        ) -> std::result::Result<Self, D::Error>
2788                                        where
2789                                            D: serde::de::Deserializer<'de>,
2790                                        {
2791                                            serde_with::As::< std::option::Option<wkt::internal::I64> >::deserialize(deserializer).map(__With)
2792                                        }
2793                                    }
2794                                    result.if_generation_match = map.next_value::<__With>()?.0;
2795                                }
2796                                __FieldTag::Unknown(key) => {
2797                                    let value = map.next_value::<serde_json::Value>()?;
2798                                    result._unknown_fields.insert(key, value);
2799                                }
2800                            }
2801                        }
2802                        std::result::Result::Ok(result)
2803                    }
2804                }
2805                deserializer.deserialize_any(Visitor)
2806            }
2807        }
2808
2809        #[doc(hidden)]
2810        impl serde::ser::Serialize for ObjectPreconditions {
2811            fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
2812            where
2813                S: serde::ser::Serializer,
2814            {
2815                use serde::ser::SerializeMap;
2816                #[allow(unused_imports)]
2817                use std::option::Option::Some;
2818                let mut state = serializer.serialize_map(std::option::Option::None)?;
2819                if self.if_generation_match.is_some() {
2820                    struct __With<'a>(&'a std::option::Option<i64>);
2821                    impl<'a> serde::ser::Serialize for __With<'a> {
2822                        fn serialize<S>(
2823                            &self,
2824                            serializer: S,
2825                        ) -> std::result::Result<S::Ok, S::Error>
2826                        where
2827                            S: serde::ser::Serializer,
2828                        {
2829                            serde_with::As::<std::option::Option<wkt::internal::I64>>::serialize(
2830                                self.0, serializer,
2831                            )
2832                        }
2833                    }
2834                    state
2835                        .serialize_entry("ifGenerationMatch", &__With(&self.if_generation_match))?;
2836                }
2837                if !self._unknown_fields.is_empty() {
2838                    for (key, value) in self._unknown_fields.iter() {
2839                        state.serialize_entry(key, &value)?;
2840                    }
2841                }
2842                state.end()
2843            }
2844        }
2845
2846        impl std::fmt::Debug for ObjectPreconditions {
2847            fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
2848                let mut debug_struct = f.debug_struct("ObjectPreconditions");
2849                debug_struct.field("if_generation_match", &self.if_generation_match);
2850                if !self._unknown_fields.is_empty() {
2851                    debug_struct.field("_unknown_fields", &self._unknown_fields);
2852                }
2853                debug_struct.finish()
2854            }
2855        }
2856    }
2857}
2858
2859/// Message for deleting an object.
2860/// `bucket` and `object` **must** be set.
2861#[derive(Clone, Default, PartialEq)]
2862#[non_exhaustive]
2863pub struct DeleteObjectRequest {
2864    /// Required. Name of the bucket in which the object resides.
2865    pub bucket: std::string::String,
2866
2867    /// Required. The name of the finalized object to delete.
2868    /// Note: If you want to delete an unfinalized resumable upload please use
2869    /// `CancelResumableWrite`.
2870    pub object: std::string::String,
2871
2872    /// Optional. If present, permanently deletes a specific revision of this
2873    /// object (as opposed to the latest version, the default).
2874    pub generation: i64,
2875
2876    /// Makes the operation conditional on whether the object's current generation
2877    /// matches the given value. Setting to 0 makes the operation succeed only if
2878    /// there are no live versions of the object.
2879    pub if_generation_match: std::option::Option<i64>,
2880
2881    /// Makes the operation conditional on whether the object's live generation
2882    /// does not match the given value. If no live object exists, the precondition
2883    /// fails. Setting to 0 makes the operation succeed only if there is a live
2884    /// version of the object.
2885    pub if_generation_not_match: std::option::Option<i64>,
2886
2887    /// Makes the operation conditional on whether the object's current
2888    /// metageneration matches the given value.
2889    pub if_metageneration_match: std::option::Option<i64>,
2890
2891    /// Makes the operation conditional on whether the object's current
2892    /// metageneration does not match the given value.
2893    pub if_metageneration_not_match: std::option::Option<i64>,
2894
2895    /// Optional. A set of parameters common to Storage API requests concerning an
2896    /// object.
2897    pub common_object_request_params: std::option::Option<crate::model::CommonObjectRequestParams>,
2898
2899    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2900}
2901
2902impl DeleteObjectRequest {
2903    pub fn new() -> Self {
2904        std::default::Default::default()
2905    }
2906
2907    /// Sets the value of [bucket][crate::model::DeleteObjectRequest::bucket].
2908    pub fn set_bucket<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2909        self.bucket = v.into();
2910        self
2911    }
2912
2913    /// Sets the value of [object][crate::model::DeleteObjectRequest::object].
2914    pub fn set_object<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2915        self.object = v.into();
2916        self
2917    }
2918
2919    /// Sets the value of [generation][crate::model::DeleteObjectRequest::generation].
2920    pub fn set_generation<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
2921        self.generation = v.into();
2922        self
2923    }
2924
2925    /// Sets the value of [if_generation_match][crate::model::DeleteObjectRequest::if_generation_match].
2926    pub fn set_if_generation_match<T>(mut self, v: T) -> Self
2927    where
2928        T: std::convert::Into<i64>,
2929    {
2930        self.if_generation_match = std::option::Option::Some(v.into());
2931        self
2932    }
2933
2934    /// Sets or clears the value of [if_generation_match][crate::model::DeleteObjectRequest::if_generation_match].
2935    pub fn set_or_clear_if_generation_match<T>(mut self, v: std::option::Option<T>) -> Self
2936    where
2937        T: std::convert::Into<i64>,
2938    {
2939        self.if_generation_match = v.map(|x| x.into());
2940        self
2941    }
2942
2943    /// Sets the value of [if_generation_not_match][crate::model::DeleteObjectRequest::if_generation_not_match].
2944    pub fn set_if_generation_not_match<T>(mut self, v: T) -> Self
2945    where
2946        T: std::convert::Into<i64>,
2947    {
2948        self.if_generation_not_match = std::option::Option::Some(v.into());
2949        self
2950    }
2951
2952    /// Sets or clears the value of [if_generation_not_match][crate::model::DeleteObjectRequest::if_generation_not_match].
2953    pub fn set_or_clear_if_generation_not_match<T>(mut self, v: std::option::Option<T>) -> Self
2954    where
2955        T: std::convert::Into<i64>,
2956    {
2957        self.if_generation_not_match = v.map(|x| x.into());
2958        self
2959    }
2960
2961    /// Sets the value of [if_metageneration_match][crate::model::DeleteObjectRequest::if_metageneration_match].
2962    pub fn set_if_metageneration_match<T>(mut self, v: T) -> Self
2963    where
2964        T: std::convert::Into<i64>,
2965    {
2966        self.if_metageneration_match = std::option::Option::Some(v.into());
2967        self
2968    }
2969
2970    /// Sets or clears the value of [if_metageneration_match][crate::model::DeleteObjectRequest::if_metageneration_match].
2971    pub fn set_or_clear_if_metageneration_match<T>(mut self, v: std::option::Option<T>) -> Self
2972    where
2973        T: std::convert::Into<i64>,
2974    {
2975        self.if_metageneration_match = v.map(|x| x.into());
2976        self
2977    }
2978
2979    /// Sets the value of [if_metageneration_not_match][crate::model::DeleteObjectRequest::if_metageneration_not_match].
2980    pub fn set_if_metageneration_not_match<T>(mut self, v: T) -> Self
2981    where
2982        T: std::convert::Into<i64>,
2983    {
2984        self.if_metageneration_not_match = std::option::Option::Some(v.into());
2985        self
2986    }
2987
2988    /// Sets or clears the value of [if_metageneration_not_match][crate::model::DeleteObjectRequest::if_metageneration_not_match].
2989    pub fn set_or_clear_if_metageneration_not_match<T>(mut self, v: std::option::Option<T>) -> Self
2990    where
2991        T: std::convert::Into<i64>,
2992    {
2993        self.if_metageneration_not_match = v.map(|x| x.into());
2994        self
2995    }
2996
2997    /// Sets the value of [common_object_request_params][crate::model::DeleteObjectRequest::common_object_request_params].
2998    pub fn set_common_object_request_params<T>(mut self, v: T) -> Self
2999    where
3000        T: std::convert::Into<crate::model::CommonObjectRequestParams>,
3001    {
3002        self.common_object_request_params = std::option::Option::Some(v.into());
3003        self
3004    }
3005
3006    /// Sets or clears the value of [common_object_request_params][crate::model::DeleteObjectRequest::common_object_request_params].
3007    pub fn set_or_clear_common_object_request_params<T>(mut self, v: std::option::Option<T>) -> Self
3008    where
3009        T: std::convert::Into<crate::model::CommonObjectRequestParams>,
3010    {
3011        self.common_object_request_params = v.map(|x| x.into());
3012        self
3013    }
3014}
3015
3016impl wkt::message::Message for DeleteObjectRequest {
3017    fn typename() -> &'static str {
3018        "type.googleapis.com/google.storage.v2.DeleteObjectRequest"
3019    }
3020}
3021
3022#[doc(hidden)]
3023impl<'de> serde::de::Deserialize<'de> for DeleteObjectRequest {
3024    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
3025    where
3026        D: serde::Deserializer<'de>,
3027    {
3028        #[allow(non_camel_case_types)]
3029        #[doc(hidden)]
3030        #[derive(PartialEq, Eq, Hash)]
3031        enum __FieldTag {
3032            __bucket,
3033            __object,
3034            __generation,
3035            __if_generation_match,
3036            __if_generation_not_match,
3037            __if_metageneration_match,
3038            __if_metageneration_not_match,
3039            __common_object_request_params,
3040            Unknown(std::string::String),
3041        }
3042        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
3043            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
3044            where
3045                D: serde::Deserializer<'de>,
3046            {
3047                struct Visitor;
3048                impl<'de> serde::de::Visitor<'de> for Visitor {
3049                    type Value = __FieldTag;
3050                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
3051                        formatter.write_str("a field name for DeleteObjectRequest")
3052                    }
3053                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
3054                    where
3055                        E: serde::de::Error,
3056                    {
3057                        use std::result::Result::Ok;
3058                        use std::string::ToString;
3059                        match value {
3060                            "bucket" => Ok(__FieldTag::__bucket),
3061                            "object" => Ok(__FieldTag::__object),
3062                            "generation" => Ok(__FieldTag::__generation),
3063                            "ifGenerationMatch" => Ok(__FieldTag::__if_generation_match),
3064                            "if_generation_match" => Ok(__FieldTag::__if_generation_match),
3065                            "ifGenerationNotMatch" => Ok(__FieldTag::__if_generation_not_match),
3066                            "if_generation_not_match" => Ok(__FieldTag::__if_generation_not_match),
3067                            "ifMetagenerationMatch" => Ok(__FieldTag::__if_metageneration_match),
3068                            "if_metageneration_match" => Ok(__FieldTag::__if_metageneration_match),
3069                            "ifMetagenerationNotMatch" => {
3070                                Ok(__FieldTag::__if_metageneration_not_match)
3071                            }
3072                            "if_metageneration_not_match" => {
3073                                Ok(__FieldTag::__if_metageneration_not_match)
3074                            }
3075                            "commonObjectRequestParams" => {
3076                                Ok(__FieldTag::__common_object_request_params)
3077                            }
3078                            "common_object_request_params" => {
3079                                Ok(__FieldTag::__common_object_request_params)
3080                            }
3081                            _ => Ok(__FieldTag::Unknown(value.to_string())),
3082                        }
3083                    }
3084                }
3085                deserializer.deserialize_identifier(Visitor)
3086            }
3087        }
3088        struct Visitor;
3089        impl<'de> serde::de::Visitor<'de> for Visitor {
3090            type Value = DeleteObjectRequest;
3091            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
3092                formatter.write_str("struct DeleteObjectRequest")
3093            }
3094            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
3095            where
3096                A: serde::de::MapAccess<'de>,
3097            {
3098                #[allow(unused_imports)]
3099                use serde::de::Error;
3100                use std::option::Option::Some;
3101                let mut fields = std::collections::HashSet::new();
3102                let mut result = Self::Value::new();
3103                while let Some(tag) = map.next_key::<__FieldTag>()? {
3104                    #[allow(clippy::match_single_binding)]
3105                    match tag {
3106                        __FieldTag::__bucket => {
3107                            if !fields.insert(__FieldTag::__bucket) {
3108                                return std::result::Result::Err(A::Error::duplicate_field(
3109                                    "multiple values for bucket",
3110                                ));
3111                            }
3112                            result.bucket = map
3113                                .next_value::<std::option::Option<std::string::String>>()?
3114                                .unwrap_or_default();
3115                        }
3116                        __FieldTag::__object => {
3117                            if !fields.insert(__FieldTag::__object) {
3118                                return std::result::Result::Err(A::Error::duplicate_field(
3119                                    "multiple values for object",
3120                                ));
3121                            }
3122                            result.object = map
3123                                .next_value::<std::option::Option<std::string::String>>()?
3124                                .unwrap_or_default();
3125                        }
3126                        __FieldTag::__generation => {
3127                            if !fields.insert(__FieldTag::__generation) {
3128                                return std::result::Result::Err(A::Error::duplicate_field(
3129                                    "multiple values for generation",
3130                                ));
3131                            }
3132                            struct __With(std::option::Option<i64>);
3133                            impl<'de> serde::de::Deserialize<'de> for __With {
3134                                fn deserialize<D>(
3135                                    deserializer: D,
3136                                ) -> std::result::Result<Self, D::Error>
3137                                where
3138                                    D: serde::de::Deserializer<'de>,
3139                                {
3140                                    serde_with::As::< std::option::Option<wkt::internal::I64> >::deserialize(deserializer).map(__With)
3141                                }
3142                            }
3143                            result.generation = map.next_value::<__With>()?.0.unwrap_or_default();
3144                        }
3145                        __FieldTag::__if_generation_match => {
3146                            if !fields.insert(__FieldTag::__if_generation_match) {
3147                                return std::result::Result::Err(A::Error::duplicate_field(
3148                                    "multiple values for if_generation_match",
3149                                ));
3150                            }
3151                            struct __With(std::option::Option<i64>);
3152                            impl<'de> serde::de::Deserialize<'de> for __With {
3153                                fn deserialize<D>(
3154                                    deserializer: D,
3155                                ) -> std::result::Result<Self, D::Error>
3156                                where
3157                                    D: serde::de::Deserializer<'de>,
3158                                {
3159                                    serde_with::As::< std::option::Option<wkt::internal::I64> >::deserialize(deserializer).map(__With)
3160                                }
3161                            }
3162                            result.if_generation_match = map.next_value::<__With>()?.0;
3163                        }
3164                        __FieldTag::__if_generation_not_match => {
3165                            if !fields.insert(__FieldTag::__if_generation_not_match) {
3166                                return std::result::Result::Err(A::Error::duplicate_field(
3167                                    "multiple values for if_generation_not_match",
3168                                ));
3169                            }
3170                            struct __With(std::option::Option<i64>);
3171                            impl<'de> serde::de::Deserialize<'de> for __With {
3172                                fn deserialize<D>(
3173                                    deserializer: D,
3174                                ) -> std::result::Result<Self, D::Error>
3175                                where
3176                                    D: serde::de::Deserializer<'de>,
3177                                {
3178                                    serde_with::As::< std::option::Option<wkt::internal::I64> >::deserialize(deserializer).map(__With)
3179                                }
3180                            }
3181                            result.if_generation_not_match = map.next_value::<__With>()?.0;
3182                        }
3183                        __FieldTag::__if_metageneration_match => {
3184                            if !fields.insert(__FieldTag::__if_metageneration_match) {
3185                                return std::result::Result::Err(A::Error::duplicate_field(
3186                                    "multiple values for if_metageneration_match",
3187                                ));
3188                            }
3189                            struct __With(std::option::Option<i64>);
3190                            impl<'de> serde::de::Deserialize<'de> for __With {
3191                                fn deserialize<D>(
3192                                    deserializer: D,
3193                                ) -> std::result::Result<Self, D::Error>
3194                                where
3195                                    D: serde::de::Deserializer<'de>,
3196                                {
3197                                    serde_with::As::< std::option::Option<wkt::internal::I64> >::deserialize(deserializer).map(__With)
3198                                }
3199                            }
3200                            result.if_metageneration_match = map.next_value::<__With>()?.0;
3201                        }
3202                        __FieldTag::__if_metageneration_not_match => {
3203                            if !fields.insert(__FieldTag::__if_metageneration_not_match) {
3204                                return std::result::Result::Err(A::Error::duplicate_field(
3205                                    "multiple values for if_metageneration_not_match",
3206                                ));
3207                            }
3208                            struct __With(std::option::Option<i64>);
3209                            impl<'de> serde::de::Deserialize<'de> for __With {
3210                                fn deserialize<D>(
3211                                    deserializer: D,
3212                                ) -> std::result::Result<Self, D::Error>
3213                                where
3214                                    D: serde::de::Deserializer<'de>,
3215                                {
3216                                    serde_with::As::< std::option::Option<wkt::internal::I64> >::deserialize(deserializer).map(__With)
3217                                }
3218                            }
3219                            result.if_metageneration_not_match = map.next_value::<__With>()?.0;
3220                        }
3221                        __FieldTag::__common_object_request_params => {
3222                            if !fields.insert(__FieldTag::__common_object_request_params) {
3223                                return std::result::Result::Err(A::Error::duplicate_field(
3224                                    "multiple values for common_object_request_params",
3225                                ));
3226                            }
3227                            result.common_object_request_params = map.next_value::<std::option::Option<crate::model::CommonObjectRequestParams>>()?
3228                                ;
3229                        }
3230                        __FieldTag::Unknown(key) => {
3231                            let value = map.next_value::<serde_json::Value>()?;
3232                            result._unknown_fields.insert(key, value);
3233                        }
3234                    }
3235                }
3236                std::result::Result::Ok(result)
3237            }
3238        }
3239        deserializer.deserialize_any(Visitor)
3240    }
3241}
3242
3243#[doc(hidden)]
3244impl serde::ser::Serialize for DeleteObjectRequest {
3245    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
3246    where
3247        S: serde::ser::Serializer,
3248    {
3249        use serde::ser::SerializeMap;
3250        #[allow(unused_imports)]
3251        use std::option::Option::Some;
3252        let mut state = serializer.serialize_map(std::option::Option::None)?;
3253        if !self.bucket.is_empty() {
3254            state.serialize_entry("bucket", &self.bucket)?;
3255        }
3256        if !self.object.is_empty() {
3257            state.serialize_entry("object", &self.object)?;
3258        }
3259        if !wkt::internal::is_default(&self.generation) {
3260            struct __With<'a>(&'a i64);
3261            impl<'a> serde::ser::Serialize for __With<'a> {
3262                fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
3263                where
3264                    S: serde::ser::Serializer,
3265                {
3266                    serde_with::As::<wkt::internal::I64>::serialize(self.0, serializer)
3267                }
3268            }
3269            state.serialize_entry("generation", &__With(&self.generation))?;
3270        }
3271        if self.if_generation_match.is_some() {
3272            struct __With<'a>(&'a std::option::Option<i64>);
3273            impl<'a> serde::ser::Serialize for __With<'a> {
3274                fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
3275                where
3276                    S: serde::ser::Serializer,
3277                {
3278                    serde_with::As::<std::option::Option<wkt::internal::I64>>::serialize(
3279                        self.0, serializer,
3280                    )
3281                }
3282            }
3283            state.serialize_entry("ifGenerationMatch", &__With(&self.if_generation_match))?;
3284        }
3285        if self.if_generation_not_match.is_some() {
3286            struct __With<'a>(&'a std::option::Option<i64>);
3287            impl<'a> serde::ser::Serialize for __With<'a> {
3288                fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
3289                where
3290                    S: serde::ser::Serializer,
3291                {
3292                    serde_with::As::<std::option::Option<wkt::internal::I64>>::serialize(
3293                        self.0, serializer,
3294                    )
3295                }
3296            }
3297            state.serialize_entry(
3298                "ifGenerationNotMatch",
3299                &__With(&self.if_generation_not_match),
3300            )?;
3301        }
3302        if self.if_metageneration_match.is_some() {
3303            struct __With<'a>(&'a std::option::Option<i64>);
3304            impl<'a> serde::ser::Serialize for __With<'a> {
3305                fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
3306                where
3307                    S: serde::ser::Serializer,
3308                {
3309                    serde_with::As::<std::option::Option<wkt::internal::I64>>::serialize(
3310                        self.0, serializer,
3311                    )
3312                }
3313            }
3314            state.serialize_entry(
3315                "ifMetagenerationMatch",
3316                &__With(&self.if_metageneration_match),
3317            )?;
3318        }
3319        if self.if_metageneration_not_match.is_some() {
3320            struct __With<'a>(&'a std::option::Option<i64>);
3321            impl<'a> serde::ser::Serialize for __With<'a> {
3322                fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
3323                where
3324                    S: serde::ser::Serializer,
3325                {
3326                    serde_with::As::<std::option::Option<wkt::internal::I64>>::serialize(
3327                        self.0, serializer,
3328                    )
3329                }
3330            }
3331            state.serialize_entry(
3332                "ifMetagenerationNotMatch",
3333                &__With(&self.if_metageneration_not_match),
3334            )?;
3335        }
3336        if self.common_object_request_params.is_some() {
3337            state.serialize_entry(
3338                "commonObjectRequestParams",
3339                &self.common_object_request_params,
3340            )?;
3341        }
3342        if !self._unknown_fields.is_empty() {
3343            for (key, value) in self._unknown_fields.iter() {
3344                state.serialize_entry(key, &value)?;
3345            }
3346        }
3347        state.end()
3348    }
3349}
3350
3351impl std::fmt::Debug for DeleteObjectRequest {
3352    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
3353        let mut debug_struct = f.debug_struct("DeleteObjectRequest");
3354        debug_struct.field("bucket", &self.bucket);
3355        debug_struct.field("object", &self.object);
3356        debug_struct.field("generation", &self.generation);
3357        debug_struct.field("if_generation_match", &self.if_generation_match);
3358        debug_struct.field("if_generation_not_match", &self.if_generation_not_match);
3359        debug_struct.field("if_metageneration_match", &self.if_metageneration_match);
3360        debug_struct.field(
3361            "if_metageneration_not_match",
3362            &self.if_metageneration_not_match,
3363        );
3364        debug_struct.field(
3365            "common_object_request_params",
3366            &self.common_object_request_params,
3367        );
3368        if !self._unknown_fields.is_empty() {
3369            debug_struct.field("_unknown_fields", &self._unknown_fields);
3370        }
3371        debug_struct.finish()
3372    }
3373}
3374
3375/// Message for restoring an object.
3376/// `bucket`, `object`, and `generation` **must** be set.
3377#[derive(Clone, Default, PartialEq)]
3378#[non_exhaustive]
3379pub struct RestoreObjectRequest {
3380    /// Required. Name of the bucket in which the object resides.
3381    pub bucket: std::string::String,
3382
3383    /// Required. The name of the object to restore.
3384    pub object: std::string::String,
3385
3386    /// Required. The specific revision of the object to restore.
3387    pub generation: i64,
3388
3389    /// Optional. Restore token used to differentiate soft-deleted objects with the
3390    /// same name and generation. Only applicable for hierarchical namespace
3391    /// buckets. This parameter is optional, and is only required in the rare case
3392    /// when there are multiple soft-deleted objects with the same name and
3393    /// generation.
3394    pub restore_token: std::string::String,
3395
3396    /// Makes the operation conditional on whether the object's current generation
3397    /// matches the given value. Setting to 0 makes the operation succeed only if
3398    /// there are no live versions of the object.
3399    pub if_generation_match: std::option::Option<i64>,
3400
3401    /// Makes the operation conditional on whether the object's live generation
3402    /// does not match the given value. If no live object exists, the precondition
3403    /// fails. Setting to 0 makes the operation succeed only if there is a live
3404    /// version of the object.
3405    pub if_generation_not_match: std::option::Option<i64>,
3406
3407    /// Makes the operation conditional on whether the object's current
3408    /// metageneration matches the given value.
3409    pub if_metageneration_match: std::option::Option<i64>,
3410
3411    /// Makes the operation conditional on whether the object's current
3412    /// metageneration does not match the given value.
3413    pub if_metageneration_not_match: std::option::Option<i64>,
3414
3415    /// If false or unset, the bucket's default object ACL will be used.
3416    /// If true, copy the source object's access controls.
3417    /// Return an error if bucket has UBLA enabled.
3418    pub copy_source_acl: std::option::Option<bool>,
3419
3420    /// Optional. A set of parameters common to Storage API requests concerning an
3421    /// object.
3422    pub common_object_request_params: std::option::Option<crate::model::CommonObjectRequestParams>,
3423
3424    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3425}
3426
3427impl RestoreObjectRequest {
3428    pub fn new() -> Self {
3429        std::default::Default::default()
3430    }
3431
3432    /// Sets the value of [bucket][crate::model::RestoreObjectRequest::bucket].
3433    pub fn set_bucket<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3434        self.bucket = v.into();
3435        self
3436    }
3437
3438    /// Sets the value of [object][crate::model::RestoreObjectRequest::object].
3439    pub fn set_object<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3440        self.object = v.into();
3441        self
3442    }
3443
3444    /// Sets the value of [generation][crate::model::RestoreObjectRequest::generation].
3445    pub fn set_generation<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
3446        self.generation = v.into();
3447        self
3448    }
3449
3450    /// Sets the value of [restore_token][crate::model::RestoreObjectRequest::restore_token].
3451    pub fn set_restore_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3452        self.restore_token = v.into();
3453        self
3454    }
3455
3456    /// Sets the value of [if_generation_match][crate::model::RestoreObjectRequest::if_generation_match].
3457    pub fn set_if_generation_match<T>(mut self, v: T) -> Self
3458    where
3459        T: std::convert::Into<i64>,
3460    {
3461        self.if_generation_match = std::option::Option::Some(v.into());
3462        self
3463    }
3464
3465    /// Sets or clears the value of [if_generation_match][crate::model::RestoreObjectRequest::if_generation_match].
3466    pub fn set_or_clear_if_generation_match<T>(mut self, v: std::option::Option<T>) -> Self
3467    where
3468        T: std::convert::Into<i64>,
3469    {
3470        self.if_generation_match = v.map(|x| x.into());
3471        self
3472    }
3473
3474    /// Sets the value of [if_generation_not_match][crate::model::RestoreObjectRequest::if_generation_not_match].
3475    pub fn set_if_generation_not_match<T>(mut self, v: T) -> Self
3476    where
3477        T: std::convert::Into<i64>,
3478    {
3479        self.if_generation_not_match = std::option::Option::Some(v.into());
3480        self
3481    }
3482
3483    /// Sets or clears the value of [if_generation_not_match][crate::model::RestoreObjectRequest::if_generation_not_match].
3484    pub fn set_or_clear_if_generation_not_match<T>(mut self, v: std::option::Option<T>) -> Self
3485    where
3486        T: std::convert::Into<i64>,
3487    {
3488        self.if_generation_not_match = v.map(|x| x.into());
3489        self
3490    }
3491
3492    /// Sets the value of [if_metageneration_match][crate::model::RestoreObjectRequest::if_metageneration_match].
3493    pub fn set_if_metageneration_match<T>(mut self, v: T) -> Self
3494    where
3495        T: std::convert::Into<i64>,
3496    {
3497        self.if_metageneration_match = std::option::Option::Some(v.into());
3498        self
3499    }
3500
3501    /// Sets or clears the value of [if_metageneration_match][crate::model::RestoreObjectRequest::if_metageneration_match].
3502    pub fn set_or_clear_if_metageneration_match<T>(mut self, v: std::option::Option<T>) -> Self
3503    where
3504        T: std::convert::Into<i64>,
3505    {
3506        self.if_metageneration_match = v.map(|x| x.into());
3507        self
3508    }
3509
3510    /// Sets the value of [if_metageneration_not_match][crate::model::RestoreObjectRequest::if_metageneration_not_match].
3511    pub fn set_if_metageneration_not_match<T>(mut self, v: T) -> Self
3512    where
3513        T: std::convert::Into<i64>,
3514    {
3515        self.if_metageneration_not_match = std::option::Option::Some(v.into());
3516        self
3517    }
3518
3519    /// Sets or clears the value of [if_metageneration_not_match][crate::model::RestoreObjectRequest::if_metageneration_not_match].
3520    pub fn set_or_clear_if_metageneration_not_match<T>(mut self, v: std::option::Option<T>) -> Self
3521    where
3522        T: std::convert::Into<i64>,
3523    {
3524        self.if_metageneration_not_match = v.map(|x| x.into());
3525        self
3526    }
3527
3528    /// Sets the value of [copy_source_acl][crate::model::RestoreObjectRequest::copy_source_acl].
3529    pub fn set_copy_source_acl<T>(mut self, v: T) -> Self
3530    where
3531        T: std::convert::Into<bool>,
3532    {
3533        self.copy_source_acl = std::option::Option::Some(v.into());
3534        self
3535    }
3536
3537    /// Sets or clears the value of [copy_source_acl][crate::model::RestoreObjectRequest::copy_source_acl].
3538    pub fn set_or_clear_copy_source_acl<T>(mut self, v: std::option::Option<T>) -> Self
3539    where
3540        T: std::convert::Into<bool>,
3541    {
3542        self.copy_source_acl = v.map(|x| x.into());
3543        self
3544    }
3545
3546    /// Sets the value of [common_object_request_params][crate::model::RestoreObjectRequest::common_object_request_params].
3547    pub fn set_common_object_request_params<T>(mut self, v: T) -> Self
3548    where
3549        T: std::convert::Into<crate::model::CommonObjectRequestParams>,
3550    {
3551        self.common_object_request_params = std::option::Option::Some(v.into());
3552        self
3553    }
3554
3555    /// Sets or clears the value of [common_object_request_params][crate::model::RestoreObjectRequest::common_object_request_params].
3556    pub fn set_or_clear_common_object_request_params<T>(mut self, v: std::option::Option<T>) -> Self
3557    where
3558        T: std::convert::Into<crate::model::CommonObjectRequestParams>,
3559    {
3560        self.common_object_request_params = v.map(|x| x.into());
3561        self
3562    }
3563}
3564
3565impl wkt::message::Message for RestoreObjectRequest {
3566    fn typename() -> &'static str {
3567        "type.googleapis.com/google.storage.v2.RestoreObjectRequest"
3568    }
3569}
3570
3571#[doc(hidden)]
3572impl<'de> serde::de::Deserialize<'de> for RestoreObjectRequest {
3573    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
3574    where
3575        D: serde::Deserializer<'de>,
3576    {
3577        #[allow(non_camel_case_types)]
3578        #[doc(hidden)]
3579        #[derive(PartialEq, Eq, Hash)]
3580        enum __FieldTag {
3581            __bucket,
3582            __object,
3583            __generation,
3584            __restore_token,
3585            __if_generation_match,
3586            __if_generation_not_match,
3587            __if_metageneration_match,
3588            __if_metageneration_not_match,
3589            __copy_source_acl,
3590            __common_object_request_params,
3591            Unknown(std::string::String),
3592        }
3593        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
3594            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
3595            where
3596                D: serde::Deserializer<'de>,
3597            {
3598                struct Visitor;
3599                impl<'de> serde::de::Visitor<'de> for Visitor {
3600                    type Value = __FieldTag;
3601                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
3602                        formatter.write_str("a field name for RestoreObjectRequest")
3603                    }
3604                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
3605                    where
3606                        E: serde::de::Error,
3607                    {
3608                        use std::result::Result::Ok;
3609                        use std::string::ToString;
3610                        match value {
3611                            "bucket" => Ok(__FieldTag::__bucket),
3612                            "object" => Ok(__FieldTag::__object),
3613                            "generation" => Ok(__FieldTag::__generation),
3614                            "restoreToken" => Ok(__FieldTag::__restore_token),
3615                            "restore_token" => Ok(__FieldTag::__restore_token),
3616                            "ifGenerationMatch" => Ok(__FieldTag::__if_generation_match),
3617                            "if_generation_match" => Ok(__FieldTag::__if_generation_match),
3618                            "ifGenerationNotMatch" => Ok(__FieldTag::__if_generation_not_match),
3619                            "if_generation_not_match" => Ok(__FieldTag::__if_generation_not_match),
3620                            "ifMetagenerationMatch" => Ok(__FieldTag::__if_metageneration_match),
3621                            "if_metageneration_match" => Ok(__FieldTag::__if_metageneration_match),
3622                            "ifMetagenerationNotMatch" => {
3623                                Ok(__FieldTag::__if_metageneration_not_match)
3624                            }
3625                            "if_metageneration_not_match" => {
3626                                Ok(__FieldTag::__if_metageneration_not_match)
3627                            }
3628                            "copySourceAcl" => Ok(__FieldTag::__copy_source_acl),
3629                            "copy_source_acl" => Ok(__FieldTag::__copy_source_acl),
3630                            "commonObjectRequestParams" => {
3631                                Ok(__FieldTag::__common_object_request_params)
3632                            }
3633                            "common_object_request_params" => {
3634                                Ok(__FieldTag::__common_object_request_params)
3635                            }
3636                            _ => Ok(__FieldTag::Unknown(value.to_string())),
3637                        }
3638                    }
3639                }
3640                deserializer.deserialize_identifier(Visitor)
3641            }
3642        }
3643        struct Visitor;
3644        impl<'de> serde::de::Visitor<'de> for Visitor {
3645            type Value = RestoreObjectRequest;
3646            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
3647                formatter.write_str("struct RestoreObjectRequest")
3648            }
3649            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
3650            where
3651                A: serde::de::MapAccess<'de>,
3652            {
3653                #[allow(unused_imports)]
3654                use serde::de::Error;
3655                use std::option::Option::Some;
3656                let mut fields = std::collections::HashSet::new();
3657                let mut result = Self::Value::new();
3658                while let Some(tag) = map.next_key::<__FieldTag>()? {
3659                    #[allow(clippy::match_single_binding)]
3660                    match tag {
3661                        __FieldTag::__bucket => {
3662                            if !fields.insert(__FieldTag::__bucket) {
3663                                return std::result::Result::Err(A::Error::duplicate_field(
3664                                    "multiple values for bucket",
3665                                ));
3666                            }
3667                            result.bucket = map
3668                                .next_value::<std::option::Option<std::string::String>>()?
3669                                .unwrap_or_default();
3670                        }
3671                        __FieldTag::__object => {
3672                            if !fields.insert(__FieldTag::__object) {
3673                                return std::result::Result::Err(A::Error::duplicate_field(
3674                                    "multiple values for object",
3675                                ));
3676                            }
3677                            result.object = map
3678                                .next_value::<std::option::Option<std::string::String>>()?
3679                                .unwrap_or_default();
3680                        }
3681                        __FieldTag::__generation => {
3682                            if !fields.insert(__FieldTag::__generation) {
3683                                return std::result::Result::Err(A::Error::duplicate_field(
3684                                    "multiple values for generation",
3685                                ));
3686                            }
3687                            struct __With(std::option::Option<i64>);
3688                            impl<'de> serde::de::Deserialize<'de> for __With {
3689                                fn deserialize<D>(
3690                                    deserializer: D,
3691                                ) -> std::result::Result<Self, D::Error>
3692                                where
3693                                    D: serde::de::Deserializer<'de>,
3694                                {
3695                                    serde_with::As::< std::option::Option<wkt::internal::I64> >::deserialize(deserializer).map(__With)
3696                                }
3697                            }
3698                            result.generation = map.next_value::<__With>()?.0.unwrap_or_default();
3699                        }
3700                        __FieldTag::__restore_token => {
3701                            if !fields.insert(__FieldTag::__restore_token) {
3702                                return std::result::Result::Err(A::Error::duplicate_field(
3703                                    "multiple values for restore_token",
3704                                ));
3705                            }
3706                            result.restore_token = map
3707                                .next_value::<std::option::Option<std::string::String>>()?
3708                                .unwrap_or_default();
3709                        }
3710                        __FieldTag::__if_generation_match => {
3711                            if !fields.insert(__FieldTag::__if_generation_match) {
3712                                return std::result::Result::Err(A::Error::duplicate_field(
3713                                    "multiple values for if_generation_match",
3714                                ));
3715                            }
3716                            struct __With(std::option::Option<i64>);
3717                            impl<'de> serde::de::Deserialize<'de> for __With {
3718                                fn deserialize<D>(
3719                                    deserializer: D,
3720                                ) -> std::result::Result<Self, D::Error>
3721                                where
3722                                    D: serde::de::Deserializer<'de>,
3723                                {
3724                                    serde_with::As::< std::option::Option<wkt::internal::I64> >::deserialize(deserializer).map(__With)
3725                                }
3726                            }
3727                            result.if_generation_match = map.next_value::<__With>()?.0;
3728                        }
3729                        __FieldTag::__if_generation_not_match => {
3730                            if !fields.insert(__FieldTag::__if_generation_not_match) {
3731                                return std::result::Result::Err(A::Error::duplicate_field(
3732                                    "multiple values for if_generation_not_match",
3733                                ));
3734                            }
3735                            struct __With(std::option::Option<i64>);
3736                            impl<'de> serde::de::Deserialize<'de> for __With {
3737                                fn deserialize<D>(
3738                                    deserializer: D,
3739                                ) -> std::result::Result<Self, D::Error>
3740                                where
3741                                    D: serde::de::Deserializer<'de>,
3742                                {
3743                                    serde_with::As::< std::option::Option<wkt::internal::I64> >::deserialize(deserializer).map(__With)
3744                                }
3745                            }
3746                            result.if_generation_not_match = map.next_value::<__With>()?.0;
3747                        }
3748                        __FieldTag::__if_metageneration_match => {
3749                            if !fields.insert(__FieldTag::__if_metageneration_match) {
3750                                return std::result::Result::Err(A::Error::duplicate_field(
3751                                    "multiple values for if_metageneration_match",
3752                                ));
3753                            }
3754                            struct __With(std::option::Option<i64>);
3755                            impl<'de> serde::de::Deserialize<'de> for __With {
3756                                fn deserialize<D>(
3757                                    deserializer: D,
3758                                ) -> std::result::Result<Self, D::Error>
3759                                where
3760                                    D: serde::de::Deserializer<'de>,
3761                                {
3762                                    serde_with::As::< std::option::Option<wkt::internal::I64> >::deserialize(deserializer).map(__With)
3763                                }
3764                            }
3765                            result.if_metageneration_match = map.next_value::<__With>()?.0;
3766                        }
3767                        __FieldTag::__if_metageneration_not_match => {
3768                            if !fields.insert(__FieldTag::__if_metageneration_not_match) {
3769                                return std::result::Result::Err(A::Error::duplicate_field(
3770                                    "multiple values for if_metageneration_not_match",
3771                                ));
3772                            }
3773                            struct __With(std::option::Option<i64>);
3774                            impl<'de> serde::de::Deserialize<'de> for __With {
3775                                fn deserialize<D>(
3776                                    deserializer: D,
3777                                ) -> std::result::Result<Self, D::Error>
3778                                where
3779                                    D: serde::de::Deserializer<'de>,
3780                                {
3781                                    serde_with::As::< std::option::Option<wkt::internal::I64> >::deserialize(deserializer).map(__With)
3782                                }
3783                            }
3784                            result.if_metageneration_not_match = map.next_value::<__With>()?.0;
3785                        }
3786                        __FieldTag::__copy_source_acl => {
3787                            if !fields.insert(__FieldTag::__copy_source_acl) {
3788                                return std::result::Result::Err(A::Error::duplicate_field(
3789                                    "multiple values for copy_source_acl",
3790                                ));
3791                            }
3792                            result.copy_source_acl =
3793                                map.next_value::<std::option::Option<bool>>()?;
3794                        }
3795                        __FieldTag::__common_object_request_params => {
3796                            if !fields.insert(__FieldTag::__common_object_request_params) {
3797                                return std::result::Result::Err(A::Error::duplicate_field(
3798                                    "multiple values for common_object_request_params",
3799                                ));
3800                            }
3801                            result.common_object_request_params = map.next_value::<std::option::Option<crate::model::CommonObjectRequestParams>>()?
3802                                ;
3803                        }
3804                        __FieldTag::Unknown(key) => {
3805                            let value = map.next_value::<serde_json::Value>()?;
3806                            result._unknown_fields.insert(key, value);
3807                        }
3808                    }
3809                }
3810                std::result::Result::Ok(result)
3811            }
3812        }
3813        deserializer.deserialize_any(Visitor)
3814    }
3815}
3816
3817#[doc(hidden)]
3818impl serde::ser::Serialize for RestoreObjectRequest {
3819    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
3820    where
3821        S: serde::ser::Serializer,
3822    {
3823        use serde::ser::SerializeMap;
3824        #[allow(unused_imports)]
3825        use std::option::Option::Some;
3826        let mut state = serializer.serialize_map(std::option::Option::None)?;
3827        if !self.bucket.is_empty() {
3828            state.serialize_entry("bucket", &self.bucket)?;
3829        }
3830        if !self.object.is_empty() {
3831            state.serialize_entry("object", &self.object)?;
3832        }
3833        if !wkt::internal::is_default(&self.generation) {
3834            struct __With<'a>(&'a i64);
3835            impl<'a> serde::ser::Serialize for __With<'a> {
3836                fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
3837                where
3838                    S: serde::ser::Serializer,
3839                {
3840                    serde_with::As::<wkt::internal::I64>::serialize(self.0, serializer)
3841                }
3842            }
3843            state.serialize_entry("generation", &__With(&self.generation))?;
3844        }
3845        if !self.restore_token.is_empty() {
3846            state.serialize_entry("restoreToken", &self.restore_token)?;
3847        }
3848        if self.if_generation_match.is_some() {
3849            struct __With<'a>(&'a std::option::Option<i64>);
3850            impl<'a> serde::ser::Serialize for __With<'a> {
3851                fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
3852                where
3853                    S: serde::ser::Serializer,
3854                {
3855                    serde_with::As::<std::option::Option<wkt::internal::I64>>::serialize(
3856                        self.0, serializer,
3857                    )
3858                }
3859            }
3860            state.serialize_entry("ifGenerationMatch", &__With(&self.if_generation_match))?;
3861        }
3862        if self.if_generation_not_match.is_some() {
3863            struct __With<'a>(&'a std::option::Option<i64>);
3864            impl<'a> serde::ser::Serialize for __With<'a> {
3865                fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
3866                where
3867                    S: serde::ser::Serializer,
3868                {
3869                    serde_with::As::<std::option::Option<wkt::internal::I64>>::serialize(
3870                        self.0, serializer,
3871                    )
3872                }
3873            }
3874            state.serialize_entry(
3875                "ifGenerationNotMatch",
3876                &__With(&self.if_generation_not_match),
3877            )?;
3878        }
3879        if self.if_metageneration_match.is_some() {
3880            struct __With<'a>(&'a std::option::Option<i64>);
3881            impl<'a> serde::ser::Serialize for __With<'a> {
3882                fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
3883                where
3884                    S: serde::ser::Serializer,
3885                {
3886                    serde_with::As::<std::option::Option<wkt::internal::I64>>::serialize(
3887                        self.0, serializer,
3888                    )
3889                }
3890            }
3891            state.serialize_entry(
3892                "ifMetagenerationMatch",
3893                &__With(&self.if_metageneration_match),
3894            )?;
3895        }
3896        if self.if_metageneration_not_match.is_some() {
3897            struct __With<'a>(&'a std::option::Option<i64>);
3898            impl<'a> serde::ser::Serialize for __With<'a> {
3899                fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
3900                where
3901                    S: serde::ser::Serializer,
3902                {
3903                    serde_with::As::<std::option::Option<wkt::internal::I64>>::serialize(
3904                        self.0, serializer,
3905                    )
3906                }
3907            }
3908            state.serialize_entry(
3909                "ifMetagenerationNotMatch",
3910                &__With(&self.if_metageneration_not_match),
3911            )?;
3912        }
3913        if self.copy_source_acl.is_some() {
3914            state.serialize_entry("copySourceAcl", &self.copy_source_acl)?;
3915        }
3916        if self.common_object_request_params.is_some() {
3917            state.serialize_entry(
3918                "commonObjectRequestParams",
3919                &self.common_object_request_params,
3920            )?;
3921        }
3922        if !self._unknown_fields.is_empty() {
3923            for (key, value) in self._unknown_fields.iter() {
3924                state.serialize_entry(key, &value)?;
3925            }
3926        }
3927        state.end()
3928    }
3929}
3930
3931impl std::fmt::Debug for RestoreObjectRequest {
3932    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
3933        let mut debug_struct = f.debug_struct("RestoreObjectRequest");
3934        debug_struct.field("bucket", &self.bucket);
3935        debug_struct.field("object", &self.object);
3936        debug_struct.field("generation", &self.generation);
3937        debug_struct.field("restore_token", &self.restore_token);
3938        debug_struct.field("if_generation_match", &self.if_generation_match);
3939        debug_struct.field("if_generation_not_match", &self.if_generation_not_match);
3940        debug_struct.field("if_metageneration_match", &self.if_metageneration_match);
3941        debug_struct.field(
3942            "if_metageneration_not_match",
3943            &self.if_metageneration_not_match,
3944        );
3945        debug_struct.field("copy_source_acl", &self.copy_source_acl);
3946        debug_struct.field(
3947            "common_object_request_params",
3948            &self.common_object_request_params,
3949        );
3950        if !self._unknown_fields.is_empty() {
3951            debug_struct.field("_unknown_fields", &self._unknown_fields);
3952        }
3953        debug_struct.finish()
3954    }
3955}
3956
3957/// Request message for ReadObject.
3958#[derive(Clone, Default, PartialEq)]
3959#[non_exhaustive]
3960pub(crate) struct ReadObjectRequest {
3961    /// Required. The name of the bucket containing the object to read.
3962    pub bucket: std::string::String,
3963
3964    /// Required. The name of the object to read.
3965    pub object: std::string::String,
3966
3967    /// Optional. If present, selects a specific revision of this object (as
3968    /// opposed to the latest version, the default).
3969    pub generation: i64,
3970
3971    /// Optional. The offset for the first byte to return in the read, relative to
3972    /// the start of the object.
3973    ///
3974    /// A negative `read_offset` value will be interpreted as the number of bytes
3975    /// back from the end of the object to be returned. For example, if an object's
3976    /// length is 15 bytes, a ReadObjectRequest with `read_offset` = -5 and
3977    /// `read_limit` = 3 would return bytes 10 through 12 of the object. Requesting
3978    /// a negative offset with magnitude larger than the size of the object will
3979    /// return the entire object.
3980    pub read_offset: i64,
3981
3982    /// Optional. The maximum number of `data` bytes the server is allowed to
3983    /// return in the sum of all `Object` messages. A `read_limit` of zero
3984    /// indicates that there is no limit, and a negative `read_limit` will cause an
3985    /// error.
3986    ///
3987    /// If the stream returns fewer bytes than allowed by the `read_limit` and no
3988    /// error occurred, the stream includes all data from the `read_offset` to the
3989    /// end of the resource.
3990    pub read_limit: i64,
3991
3992    /// Makes the operation conditional on whether the object's current generation
3993    /// matches the given value. Setting to 0 makes the operation succeed only if
3994    /// there are no live versions of the object.
3995    pub if_generation_match: std::option::Option<i64>,
3996
3997    /// Makes the operation conditional on whether the object's live generation
3998    /// does not match the given value. If no live object exists, the precondition
3999    /// fails. Setting to 0 makes the operation succeed only if there is a live
4000    /// version of the object.
4001    pub if_generation_not_match: std::option::Option<i64>,
4002
4003    /// Makes the operation conditional on whether the object's current
4004    /// metageneration matches the given value.
4005    pub if_metageneration_match: std::option::Option<i64>,
4006
4007    /// Makes the operation conditional on whether the object's current
4008    /// metageneration does not match the given value.
4009    pub if_metageneration_not_match: std::option::Option<i64>,
4010
4011    /// Optional. A set of parameters common to Storage API requests concerning an
4012    /// object.
4013    pub common_object_request_params: std::option::Option<crate::model::CommonObjectRequestParams>,
4014
4015    /// Mask specifying which fields to read.
4016    /// The checksummed_data field and its children will always be present.
4017    /// If no mask is specified, will default to all fields except metadata.owner
4018    /// and metadata.acl.
4019    ///
4020    /// * may be used to mean "all fields".
4021    pub read_mask: std::option::Option<wkt::FieldMask>,
4022
4023    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4024}
4025
4026impl ReadObjectRequest {
4027    pub fn new() -> Self {
4028        std::default::Default::default()
4029    }
4030
4031    /// Sets the value of [bucket][crate::model::ReadObjectRequest::bucket].
4032    pub fn set_bucket<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4033        self.bucket = v.into();
4034        self
4035    }
4036
4037    /// Sets the value of [object][crate::model::ReadObjectRequest::object].
4038    pub fn set_object<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4039        self.object = v.into();
4040        self
4041    }
4042
4043    /// Sets the value of [generation][crate::model::ReadObjectRequest::generation].
4044    pub fn set_generation<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
4045        self.generation = v.into();
4046        self
4047    }
4048
4049    /// Sets the value of [read_offset][crate::model::ReadObjectRequest::read_offset].
4050    pub fn set_read_offset<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
4051        self.read_offset = v.into();
4052        self
4053    }
4054
4055    /// Sets the value of [read_limit][crate::model::ReadObjectRequest::read_limit].
4056    pub fn set_read_limit<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
4057        self.read_limit = v.into();
4058        self
4059    }
4060
4061    /// Sets the value of [if_generation_match][crate::model::ReadObjectRequest::if_generation_match].
4062    pub fn set_if_generation_match<T>(mut self, v: T) -> Self
4063    where
4064        T: std::convert::Into<i64>,
4065    {
4066        self.if_generation_match = std::option::Option::Some(v.into());
4067        self
4068    }
4069
4070    /// Sets or clears the value of [if_generation_match][crate::model::ReadObjectRequest::if_generation_match].
4071    pub fn set_or_clear_if_generation_match<T>(mut self, v: std::option::Option<T>) -> Self
4072    where
4073        T: std::convert::Into<i64>,
4074    {
4075        self.if_generation_match = v.map(|x| x.into());
4076        self
4077    }
4078
4079    /// Sets the value of [if_generation_not_match][crate::model::ReadObjectRequest::if_generation_not_match].
4080    pub fn set_if_generation_not_match<T>(mut self, v: T) -> Self
4081    where
4082        T: std::convert::Into<i64>,
4083    {
4084        self.if_generation_not_match = std::option::Option::Some(v.into());
4085        self
4086    }
4087
4088    /// Sets or clears the value of [if_generation_not_match][crate::model::ReadObjectRequest::if_generation_not_match].
4089    pub fn set_or_clear_if_generation_not_match<T>(mut self, v: std::option::Option<T>) -> Self
4090    where
4091        T: std::convert::Into<i64>,
4092    {
4093        self.if_generation_not_match = v.map(|x| x.into());
4094        self
4095    }
4096
4097    /// Sets the value of [if_metageneration_match][crate::model::ReadObjectRequest::if_metageneration_match].
4098    pub fn set_if_metageneration_match<T>(mut self, v: T) -> Self
4099    where
4100        T: std::convert::Into<i64>,
4101    {
4102        self.if_metageneration_match = std::option::Option::Some(v.into());
4103        self
4104    }
4105
4106    /// Sets or clears the value of [if_metageneration_match][crate::model::ReadObjectRequest::if_metageneration_match].
4107    pub fn set_or_clear_if_metageneration_match<T>(mut self, v: std::option::Option<T>) -> Self
4108    where
4109        T: std::convert::Into<i64>,
4110    {
4111        self.if_metageneration_match = v.map(|x| x.into());
4112        self
4113    }
4114
4115    /// Sets the value of [if_metageneration_not_match][crate::model::ReadObjectRequest::if_metageneration_not_match].
4116    pub fn set_if_metageneration_not_match<T>(mut self, v: T) -> Self
4117    where
4118        T: std::convert::Into<i64>,
4119    {
4120        self.if_metageneration_not_match = std::option::Option::Some(v.into());
4121        self
4122    }
4123
4124    /// Sets or clears the value of [if_metageneration_not_match][crate::model::ReadObjectRequest::if_metageneration_not_match].
4125    pub fn set_or_clear_if_metageneration_not_match<T>(mut self, v: std::option::Option<T>) -> Self
4126    where
4127        T: std::convert::Into<i64>,
4128    {
4129        self.if_metageneration_not_match = v.map(|x| x.into());
4130        self
4131    }
4132
4133    /// Sets the value of [common_object_request_params][crate::model::ReadObjectRequest::common_object_request_params].
4134    pub fn set_common_object_request_params<T>(mut self, v: T) -> Self
4135    where
4136        T: std::convert::Into<crate::model::CommonObjectRequestParams>,
4137    {
4138        self.common_object_request_params = std::option::Option::Some(v.into());
4139        self
4140    }
4141
4142    /// Sets or clears the value of [common_object_request_params][crate::model::ReadObjectRequest::common_object_request_params].
4143    pub fn set_or_clear_common_object_request_params<T>(mut self, v: std::option::Option<T>) -> Self
4144    where
4145        T: std::convert::Into<crate::model::CommonObjectRequestParams>,
4146    {
4147        self.common_object_request_params = v.map(|x| x.into());
4148        self
4149    }
4150
4151    /// Sets the value of [read_mask][crate::model::ReadObjectRequest::read_mask].
4152    pub fn set_read_mask<T>(mut self, v: T) -> Self
4153    where
4154        T: std::convert::Into<wkt::FieldMask>,
4155    {
4156        self.read_mask = std::option::Option::Some(v.into());
4157        self
4158    }
4159
4160    /// Sets or clears the value of [read_mask][crate::model::ReadObjectRequest::read_mask].
4161    pub fn set_or_clear_read_mask<T>(mut self, v: std::option::Option<T>) -> Self
4162    where
4163        T: std::convert::Into<wkt::FieldMask>,
4164    {
4165        self.read_mask = v.map(|x| x.into());
4166        self
4167    }
4168}
4169
4170impl wkt::message::Message for ReadObjectRequest {
4171    fn typename() -> &'static str {
4172        "type.googleapis.com/google.storage.v2.ReadObjectRequest"
4173    }
4174}
4175
4176#[doc(hidden)]
4177impl<'de> serde::de::Deserialize<'de> for ReadObjectRequest {
4178    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
4179    where
4180        D: serde::Deserializer<'de>,
4181    {
4182        #[allow(non_camel_case_types)]
4183        #[doc(hidden)]
4184        #[derive(PartialEq, Eq, Hash)]
4185        enum __FieldTag {
4186            __bucket,
4187            __object,
4188            __generation,
4189            __read_offset,
4190            __read_limit,
4191            __if_generation_match,
4192            __if_generation_not_match,
4193            __if_metageneration_match,
4194            __if_metageneration_not_match,
4195            __common_object_request_params,
4196            __read_mask,
4197            Unknown(std::string::String),
4198        }
4199        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
4200            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
4201            where
4202                D: serde::Deserializer<'de>,
4203            {
4204                struct Visitor;
4205                impl<'de> serde::de::Visitor<'de> for Visitor {
4206                    type Value = __FieldTag;
4207                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
4208                        formatter.write_str("a field name for ReadObjectRequest")
4209                    }
4210                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
4211                    where
4212                        E: serde::de::Error,
4213                    {
4214                        use std::result::Result::Ok;
4215                        use std::string::ToString;
4216                        match value {
4217                            "bucket" => Ok(__FieldTag::__bucket),
4218                            "object" => Ok(__FieldTag::__object),
4219                            "generation" => Ok(__FieldTag::__generation),
4220                            "readOffset" => Ok(__FieldTag::__read_offset),
4221                            "read_offset" => Ok(__FieldTag::__read_offset),
4222                            "readLimit" => Ok(__FieldTag::__read_limit),
4223                            "read_limit" => Ok(__FieldTag::__read_limit),
4224                            "ifGenerationMatch" => Ok(__FieldTag::__if_generation_match),
4225                            "if_generation_match" => Ok(__FieldTag::__if_generation_match),
4226                            "ifGenerationNotMatch" => Ok(__FieldTag::__if_generation_not_match),
4227                            "if_generation_not_match" => Ok(__FieldTag::__if_generation_not_match),
4228                            "ifMetagenerationMatch" => Ok(__FieldTag::__if_metageneration_match),
4229                            "if_metageneration_match" => Ok(__FieldTag::__if_metageneration_match),
4230                            "ifMetagenerationNotMatch" => {
4231                                Ok(__FieldTag::__if_metageneration_not_match)
4232                            }
4233                            "if_metageneration_not_match" => {
4234                                Ok(__FieldTag::__if_metageneration_not_match)
4235                            }
4236                            "commonObjectRequestParams" => {
4237                                Ok(__FieldTag::__common_object_request_params)
4238                            }
4239                            "common_object_request_params" => {
4240                                Ok(__FieldTag::__common_object_request_params)
4241                            }
4242                            "readMask" => Ok(__FieldTag::__read_mask),
4243                            "read_mask" => Ok(__FieldTag::__read_mask),
4244                            _ => Ok(__FieldTag::Unknown(value.to_string())),
4245                        }
4246                    }
4247                }
4248                deserializer.deserialize_identifier(Visitor)
4249            }
4250        }
4251        struct Visitor;
4252        impl<'de> serde::de::Visitor<'de> for Visitor {
4253            type Value = ReadObjectRequest;
4254            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
4255                formatter.write_str("struct ReadObjectRequest")
4256            }
4257            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
4258            where
4259                A: serde::de::MapAccess<'de>,
4260            {
4261                #[allow(unused_imports)]
4262                use serde::de::Error;
4263                use std::option::Option::Some;
4264                let mut fields = std::collections::HashSet::new();
4265                let mut result = Self::Value::new();
4266                while let Some(tag) = map.next_key::<__FieldTag>()? {
4267                    #[allow(clippy::match_single_binding)]
4268                    match tag {
4269                        __FieldTag::__bucket => {
4270                            if !fields.insert(__FieldTag::__bucket) {
4271                                return std::result::Result::Err(A::Error::duplicate_field(
4272                                    "multiple values for bucket",
4273                                ));
4274                            }
4275                            result.bucket = map
4276                                .next_value::<std::option::Option<std::string::String>>()?
4277                                .unwrap_or_default();
4278                        }
4279                        __FieldTag::__object => {
4280                            if !fields.insert(__FieldTag::__object) {
4281                                return std::result::Result::Err(A::Error::duplicate_field(
4282                                    "multiple values for object",
4283                                ));
4284                            }
4285                            result.object = map
4286                                .next_value::<std::option::Option<std::string::String>>()?
4287                                .unwrap_or_default();
4288                        }
4289                        __FieldTag::__generation => {
4290                            if !fields.insert(__FieldTag::__generation) {
4291                                return std::result::Result::Err(A::Error::duplicate_field(
4292                                    "multiple values for generation",
4293                                ));
4294                            }
4295                            struct __With(std::option::Option<i64>);
4296                            impl<'de> serde::de::Deserialize<'de> for __With {
4297                                fn deserialize<D>(
4298                                    deserializer: D,
4299                                ) -> std::result::Result<Self, D::Error>
4300                                where
4301                                    D: serde::de::Deserializer<'de>,
4302                                {
4303                                    serde_with::As::< std::option::Option<wkt::internal::I64> >::deserialize(deserializer).map(__With)
4304                                }
4305                            }
4306                            result.generation = map.next_value::<__With>()?.0.unwrap_or_default();
4307                        }
4308                        __FieldTag::__read_offset => {
4309                            if !fields.insert(__FieldTag::__read_offset) {
4310                                return std::result::Result::Err(A::Error::duplicate_field(
4311                                    "multiple values for read_offset",
4312                                ));
4313                            }
4314                            struct __With(std::option::Option<i64>);
4315                            impl<'de> serde::de::Deserialize<'de> for __With {
4316                                fn deserialize<D>(
4317                                    deserializer: D,
4318                                ) -> std::result::Result<Self, D::Error>
4319                                where
4320                                    D: serde::de::Deserializer<'de>,
4321                                {
4322                                    serde_with::As::< std::option::Option<wkt::internal::I64> >::deserialize(deserializer).map(__With)
4323                                }
4324                            }
4325                            result.read_offset = map.next_value::<__With>()?.0.unwrap_or_default();
4326                        }
4327                        __FieldTag::__read_limit => {
4328                            if !fields.insert(__FieldTag::__read_limit) {
4329                                return std::result::Result::Err(A::Error::duplicate_field(
4330                                    "multiple values for read_limit",
4331                                ));
4332                            }
4333                            struct __With(std::option::Option<i64>);
4334                            impl<'de> serde::de::Deserialize<'de> for __With {
4335                                fn deserialize<D>(
4336                                    deserializer: D,
4337                                ) -> std::result::Result<Self, D::Error>
4338                                where
4339                                    D: serde::de::Deserializer<'de>,
4340                                {
4341                                    serde_with::As::< std::option::Option<wkt::internal::I64> >::deserialize(deserializer).map(__With)
4342                                }
4343                            }
4344                            result.read_limit = map.next_value::<__With>()?.0.unwrap_or_default();
4345                        }
4346                        __FieldTag::__if_generation_match => {
4347                            if !fields.insert(__FieldTag::__if_generation_match) {
4348                                return std::result::Result::Err(A::Error::duplicate_field(
4349                                    "multiple values for if_generation_match",
4350                                ));
4351                            }
4352                            struct __With(std::option::Option<i64>);
4353                            impl<'de> serde::de::Deserialize<'de> for __With {
4354                                fn deserialize<D>(
4355                                    deserializer: D,
4356                                ) -> std::result::Result<Self, D::Error>
4357                                where
4358                                    D: serde::de::Deserializer<'de>,
4359                                {
4360                                    serde_with::As::< std::option::Option<wkt::internal::I64> >::deserialize(deserializer).map(__With)
4361                                }
4362                            }
4363                            result.if_generation_match = map.next_value::<__With>()?.0;
4364                        }
4365                        __FieldTag::__if_generation_not_match => {
4366                            if !fields.insert(__FieldTag::__if_generation_not_match) {
4367                                return std::result::Result::Err(A::Error::duplicate_field(
4368                                    "multiple values for if_generation_not_match",
4369                                ));
4370                            }
4371                            struct __With(std::option::Option<i64>);
4372                            impl<'de> serde::de::Deserialize<'de> for __With {
4373                                fn deserialize<D>(
4374                                    deserializer: D,
4375                                ) -> std::result::Result<Self, D::Error>
4376                                where
4377                                    D: serde::de::Deserializer<'de>,
4378                                {
4379                                    serde_with::As::< std::option::Option<wkt::internal::I64> >::deserialize(deserializer).map(__With)
4380                                }
4381                            }
4382                            result.if_generation_not_match = map.next_value::<__With>()?.0;
4383                        }
4384                        __FieldTag::__if_metageneration_match => {
4385                            if !fields.insert(__FieldTag::__if_metageneration_match) {
4386                                return std::result::Result::Err(A::Error::duplicate_field(
4387                                    "multiple values for if_metageneration_match",
4388                                ));
4389                            }
4390                            struct __With(std::option::Option<i64>);
4391                            impl<'de> serde::de::Deserialize<'de> for __With {
4392                                fn deserialize<D>(
4393                                    deserializer: D,
4394                                ) -> std::result::Result<Self, D::Error>
4395                                where
4396                                    D: serde::de::Deserializer<'de>,
4397                                {
4398                                    serde_with::As::< std::option::Option<wkt::internal::I64> >::deserialize(deserializer).map(__With)
4399                                }
4400                            }
4401                            result.if_metageneration_match = map.next_value::<__With>()?.0;
4402                        }
4403                        __FieldTag::__if_metageneration_not_match => {
4404                            if !fields.insert(__FieldTag::__if_metageneration_not_match) {
4405                                return std::result::Result::Err(A::Error::duplicate_field(
4406                                    "multiple values for if_metageneration_not_match",
4407                                ));
4408                            }
4409                            struct __With(std::option::Option<i64>);
4410                            impl<'de> serde::de::Deserialize<'de> for __With {
4411                                fn deserialize<D>(
4412                                    deserializer: D,
4413                                ) -> std::result::Result<Self, D::Error>
4414                                where
4415                                    D: serde::de::Deserializer<'de>,
4416                                {
4417                                    serde_with::As::< std::option::Option<wkt::internal::I64> >::deserialize(deserializer).map(__With)
4418                                }
4419                            }
4420                            result.if_metageneration_not_match = map.next_value::<__With>()?.0;
4421                        }
4422                        __FieldTag::__common_object_request_params => {
4423                            if !fields.insert(__FieldTag::__common_object_request_params) {
4424                                return std::result::Result::Err(A::Error::duplicate_field(
4425                                    "multiple values for common_object_request_params",
4426                                ));
4427                            }
4428                            result.common_object_request_params = map.next_value::<std::option::Option<crate::model::CommonObjectRequestParams>>()?
4429                                ;
4430                        }
4431                        __FieldTag::__read_mask => {
4432                            if !fields.insert(__FieldTag::__read_mask) {
4433                                return std::result::Result::Err(A::Error::duplicate_field(
4434                                    "multiple values for read_mask",
4435                                ));
4436                            }
4437                            result.read_mask =
4438                                map.next_value::<std::option::Option<wkt::FieldMask>>()?;
4439                        }
4440                        __FieldTag::Unknown(key) => {
4441                            let value = map.next_value::<serde_json::Value>()?;
4442                            result._unknown_fields.insert(key, value);
4443                        }
4444                    }
4445                }
4446                std::result::Result::Ok(result)
4447            }
4448        }
4449        deserializer.deserialize_any(Visitor)
4450    }
4451}
4452
4453#[doc(hidden)]
4454impl serde::ser::Serialize for ReadObjectRequest {
4455    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
4456    where
4457        S: serde::ser::Serializer,
4458    {
4459        use serde::ser::SerializeMap;
4460        #[allow(unused_imports)]
4461        use std::option::Option::Some;
4462        let mut state = serializer.serialize_map(std::option::Option::None)?;
4463        if !self.bucket.is_empty() {
4464            state.serialize_entry("bucket", &self.bucket)?;
4465        }
4466        if !self.object.is_empty() {
4467            state.serialize_entry("object", &self.object)?;
4468        }
4469        if !wkt::internal::is_default(&self.generation) {
4470            struct __With<'a>(&'a i64);
4471            impl<'a> serde::ser::Serialize for __With<'a> {
4472                fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
4473                where
4474                    S: serde::ser::Serializer,
4475                {
4476                    serde_with::As::<wkt::internal::I64>::serialize(self.0, serializer)
4477                }
4478            }
4479            state.serialize_entry("generation", &__With(&self.generation))?;
4480        }
4481        if !wkt::internal::is_default(&self.read_offset) {
4482            struct __With<'a>(&'a i64);
4483            impl<'a> serde::ser::Serialize for __With<'a> {
4484                fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
4485                where
4486                    S: serde::ser::Serializer,
4487                {
4488                    serde_with::As::<wkt::internal::I64>::serialize(self.0, serializer)
4489                }
4490            }
4491            state.serialize_entry("readOffset", &__With(&self.read_offset))?;
4492        }
4493        if !wkt::internal::is_default(&self.read_limit) {
4494            struct __With<'a>(&'a i64);
4495            impl<'a> serde::ser::Serialize for __With<'a> {
4496                fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
4497                where
4498                    S: serde::ser::Serializer,
4499                {
4500                    serde_with::As::<wkt::internal::I64>::serialize(self.0, serializer)
4501                }
4502            }
4503            state.serialize_entry("readLimit", &__With(&self.read_limit))?;
4504        }
4505        if self.if_generation_match.is_some() {
4506            struct __With<'a>(&'a std::option::Option<i64>);
4507            impl<'a> serde::ser::Serialize for __With<'a> {
4508                fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
4509                where
4510                    S: serde::ser::Serializer,
4511                {
4512                    serde_with::As::<std::option::Option<wkt::internal::I64>>::serialize(
4513                        self.0, serializer,
4514                    )
4515                }
4516            }
4517            state.serialize_entry("ifGenerationMatch", &__With(&self.if_generation_match))?;
4518        }
4519        if self.if_generation_not_match.is_some() {
4520            struct __With<'a>(&'a std::option::Option<i64>);
4521            impl<'a> serde::ser::Serialize for __With<'a> {
4522                fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
4523                where
4524                    S: serde::ser::Serializer,
4525                {
4526                    serde_with::As::<std::option::Option<wkt::internal::I64>>::serialize(
4527                        self.0, serializer,
4528                    )
4529                }
4530            }
4531            state.serialize_entry(
4532                "ifGenerationNotMatch",
4533                &__With(&self.if_generation_not_match),
4534            )?;
4535        }
4536        if self.if_metageneration_match.is_some() {
4537            struct __With<'a>(&'a std::option::Option<i64>);
4538            impl<'a> serde::ser::Serialize for __With<'a> {
4539                fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
4540                where
4541                    S: serde::ser::Serializer,
4542                {
4543                    serde_with::As::<std::option::Option<wkt::internal::I64>>::serialize(
4544                        self.0, serializer,
4545                    )
4546                }
4547            }
4548            state.serialize_entry(
4549                "ifMetagenerationMatch",
4550                &__With(&self.if_metageneration_match),
4551            )?;
4552        }
4553        if self.if_metageneration_not_match.is_some() {
4554            struct __With<'a>(&'a std::option::Option<i64>);
4555            impl<'a> serde::ser::Serialize for __With<'a> {
4556                fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
4557                where
4558                    S: serde::ser::Serializer,
4559                {
4560                    serde_with::As::<std::option::Option<wkt::internal::I64>>::serialize(
4561                        self.0, serializer,
4562                    )
4563                }
4564            }
4565            state.serialize_entry(
4566                "ifMetagenerationNotMatch",
4567                &__With(&self.if_metageneration_not_match),
4568            )?;
4569        }
4570        if self.common_object_request_params.is_some() {
4571            state.serialize_entry(
4572                "commonObjectRequestParams",
4573                &self.common_object_request_params,
4574            )?;
4575        }
4576        if self.read_mask.is_some() {
4577            state.serialize_entry("readMask", &self.read_mask)?;
4578        }
4579        if !self._unknown_fields.is_empty() {
4580            for (key, value) in self._unknown_fields.iter() {
4581                state.serialize_entry(key, &value)?;
4582            }
4583        }
4584        state.end()
4585    }
4586}
4587
4588impl std::fmt::Debug for ReadObjectRequest {
4589    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
4590        let mut debug_struct = f.debug_struct("ReadObjectRequest");
4591        debug_struct.field("bucket", &self.bucket);
4592        debug_struct.field("object", &self.object);
4593        debug_struct.field("generation", &self.generation);
4594        debug_struct.field("read_offset", &self.read_offset);
4595        debug_struct.field("read_limit", &self.read_limit);
4596        debug_struct.field("if_generation_match", &self.if_generation_match);
4597        debug_struct.field("if_generation_not_match", &self.if_generation_not_match);
4598        debug_struct.field("if_metageneration_match", &self.if_metageneration_match);
4599        debug_struct.field(
4600            "if_metageneration_not_match",
4601            &self.if_metageneration_not_match,
4602        );
4603        debug_struct.field(
4604            "common_object_request_params",
4605            &self.common_object_request_params,
4606        );
4607        debug_struct.field("read_mask", &self.read_mask);
4608        if !self._unknown_fields.is_empty() {
4609            debug_struct.field("_unknown_fields", &self._unknown_fields);
4610        }
4611        debug_struct.finish()
4612    }
4613}
4614
4615/// Request message for GetObject.
4616#[derive(Clone, Default, PartialEq)]
4617#[non_exhaustive]
4618pub struct GetObjectRequest {
4619    /// Required. Name of the bucket in which the object resides.
4620    pub bucket: std::string::String,
4621
4622    /// Required. Name of the object.
4623    pub object: std::string::String,
4624
4625    /// Optional. If present, selects a specific revision of this object (as
4626    /// opposed to the latest version, the default).
4627    pub generation: i64,
4628
4629    /// If true, return the soft-deleted version of this object.
4630    pub soft_deleted: std::option::Option<bool>,
4631
4632    /// Makes the operation conditional on whether the object's current generation
4633    /// matches the given value. Setting to 0 makes the operation succeed only if
4634    /// there are no live versions of the object.
4635    pub if_generation_match: std::option::Option<i64>,
4636
4637    /// Makes the operation conditional on whether the object's live generation
4638    /// does not match the given value. If no live object exists, the precondition
4639    /// fails. Setting to 0 makes the operation succeed only if there is a live
4640    /// version of the object.
4641    pub if_generation_not_match: std::option::Option<i64>,
4642
4643    /// Makes the operation conditional on whether the object's current
4644    /// metageneration matches the given value.
4645    pub if_metageneration_match: std::option::Option<i64>,
4646
4647    /// Makes the operation conditional on whether the object's current
4648    /// metageneration does not match the given value.
4649    pub if_metageneration_not_match: std::option::Option<i64>,
4650
4651    /// Optional. A set of parameters common to Storage API requests concerning an
4652    /// object.
4653    pub common_object_request_params: std::option::Option<crate::model::CommonObjectRequestParams>,
4654
4655    /// Mask specifying which fields to read.
4656    /// If no mask is specified, will default to all fields except metadata.acl and
4657    /// metadata.owner.
4658    ///
4659    /// * may be used to mean "all fields".
4660    pub read_mask: std::option::Option<wkt::FieldMask>,
4661
4662    /// Optional. Restore token used to differentiate soft-deleted objects with the
4663    /// same name and generation. Only applicable for hierarchical namespace
4664    /// buckets and if soft_deleted is set to true. This parameter is optional, and
4665    /// is only required in the rare case when there are multiple soft-deleted
4666    /// objects with the same name and generation.
4667    pub restore_token: std::string::String,
4668
4669    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4670}
4671
4672impl GetObjectRequest {
4673    pub fn new() -> Self {
4674        std::default::Default::default()
4675    }
4676
4677    /// Sets the value of [bucket][crate::model::GetObjectRequest::bucket].
4678    pub fn set_bucket<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4679        self.bucket = v.into();
4680        self
4681    }
4682
4683    /// Sets the value of [object][crate::model::GetObjectRequest::object].
4684    pub fn set_object<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4685        self.object = v.into();
4686        self
4687    }
4688
4689    /// Sets the value of [generation][crate::model::GetObjectRequest::generation].
4690    pub fn set_generation<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
4691        self.generation = v.into();
4692        self
4693    }
4694
4695    /// Sets the value of [soft_deleted][crate::model::GetObjectRequest::soft_deleted].
4696    pub fn set_soft_deleted<T>(mut self, v: T) -> Self
4697    where
4698        T: std::convert::Into<bool>,
4699    {
4700        self.soft_deleted = std::option::Option::Some(v.into());
4701        self
4702    }
4703
4704    /// Sets or clears the value of [soft_deleted][crate::model::GetObjectRequest::soft_deleted].
4705    pub fn set_or_clear_soft_deleted<T>(mut self, v: std::option::Option<T>) -> Self
4706    where
4707        T: std::convert::Into<bool>,
4708    {
4709        self.soft_deleted = v.map(|x| x.into());
4710        self
4711    }
4712
4713    /// Sets the value of [if_generation_match][crate::model::GetObjectRequest::if_generation_match].
4714    pub fn set_if_generation_match<T>(mut self, v: T) -> Self
4715    where
4716        T: std::convert::Into<i64>,
4717    {
4718        self.if_generation_match = std::option::Option::Some(v.into());
4719        self
4720    }
4721
4722    /// Sets or clears the value of [if_generation_match][crate::model::GetObjectRequest::if_generation_match].
4723    pub fn set_or_clear_if_generation_match<T>(mut self, v: std::option::Option<T>) -> Self
4724    where
4725        T: std::convert::Into<i64>,
4726    {
4727        self.if_generation_match = v.map(|x| x.into());
4728        self
4729    }
4730
4731    /// Sets the value of [if_generation_not_match][crate::model::GetObjectRequest::if_generation_not_match].
4732    pub fn set_if_generation_not_match<T>(mut self, v: T) -> Self
4733    where
4734        T: std::convert::Into<i64>,
4735    {
4736        self.if_generation_not_match = std::option::Option::Some(v.into());
4737        self
4738    }
4739
4740    /// Sets or clears the value of [if_generation_not_match][crate::model::GetObjectRequest::if_generation_not_match].
4741    pub fn set_or_clear_if_generation_not_match<T>(mut self, v: std::option::Option<T>) -> Self
4742    where
4743        T: std::convert::Into<i64>,
4744    {
4745        self.if_generation_not_match = v.map(|x| x.into());
4746        self
4747    }
4748
4749    /// Sets the value of [if_metageneration_match][crate::model::GetObjectRequest::if_metageneration_match].
4750    pub fn set_if_metageneration_match<T>(mut self, v: T) -> Self
4751    where
4752        T: std::convert::Into<i64>,
4753    {
4754        self.if_metageneration_match = std::option::Option::Some(v.into());
4755        self
4756    }
4757
4758    /// Sets or clears the value of [if_metageneration_match][crate::model::GetObjectRequest::if_metageneration_match].
4759    pub fn set_or_clear_if_metageneration_match<T>(mut self, v: std::option::Option<T>) -> Self
4760    where
4761        T: std::convert::Into<i64>,
4762    {
4763        self.if_metageneration_match = v.map(|x| x.into());
4764        self
4765    }
4766
4767    /// Sets the value of [if_metageneration_not_match][crate::model::GetObjectRequest::if_metageneration_not_match].
4768    pub fn set_if_metageneration_not_match<T>(mut self, v: T) -> Self
4769    where
4770        T: std::convert::Into<i64>,
4771    {
4772        self.if_metageneration_not_match = std::option::Option::Some(v.into());
4773        self
4774    }
4775
4776    /// Sets or clears the value of [if_metageneration_not_match][crate::model::GetObjectRequest::if_metageneration_not_match].
4777    pub fn set_or_clear_if_metageneration_not_match<T>(mut self, v: std::option::Option<T>) -> Self
4778    where
4779        T: std::convert::Into<i64>,
4780    {
4781        self.if_metageneration_not_match = v.map(|x| x.into());
4782        self
4783    }
4784
4785    /// Sets the value of [common_object_request_params][crate::model::GetObjectRequest::common_object_request_params].
4786    pub fn set_common_object_request_params<T>(mut self, v: T) -> Self
4787    where
4788        T: std::convert::Into<crate::model::CommonObjectRequestParams>,
4789    {
4790        self.common_object_request_params = std::option::Option::Some(v.into());
4791        self
4792    }
4793
4794    /// Sets or clears the value of [common_object_request_params][crate::model::GetObjectRequest::common_object_request_params].
4795    pub fn set_or_clear_common_object_request_params<T>(mut self, v: std::option::Option<T>) -> Self
4796    where
4797        T: std::convert::Into<crate::model::CommonObjectRequestParams>,
4798    {
4799        self.common_object_request_params = v.map(|x| x.into());
4800        self
4801    }
4802
4803    /// Sets the value of [read_mask][crate::model::GetObjectRequest::read_mask].
4804    pub fn set_read_mask<T>(mut self, v: T) -> Self
4805    where
4806        T: std::convert::Into<wkt::FieldMask>,
4807    {
4808        self.read_mask = std::option::Option::Some(v.into());
4809        self
4810    }
4811
4812    /// Sets or clears the value of [read_mask][crate::model::GetObjectRequest::read_mask].
4813    pub fn set_or_clear_read_mask<T>(mut self, v: std::option::Option<T>) -> Self
4814    where
4815        T: std::convert::Into<wkt::FieldMask>,
4816    {
4817        self.read_mask = v.map(|x| x.into());
4818        self
4819    }
4820
4821    /// Sets the value of [restore_token][crate::model::GetObjectRequest::restore_token].
4822    pub fn set_restore_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4823        self.restore_token = v.into();
4824        self
4825    }
4826}
4827
4828impl wkt::message::Message for GetObjectRequest {
4829    fn typename() -> &'static str {
4830        "type.googleapis.com/google.storage.v2.GetObjectRequest"
4831    }
4832}
4833
4834#[doc(hidden)]
4835impl<'de> serde::de::Deserialize<'de> for GetObjectRequest {
4836    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
4837    where
4838        D: serde::Deserializer<'de>,
4839    {
4840        #[allow(non_camel_case_types)]
4841        #[doc(hidden)]
4842        #[derive(PartialEq, Eq, Hash)]
4843        enum __FieldTag {
4844            __bucket,
4845            __object,
4846            __generation,
4847            __soft_deleted,
4848            __if_generation_match,
4849            __if_generation_not_match,
4850            __if_metageneration_match,
4851            __if_metageneration_not_match,
4852            __common_object_request_params,
4853            __read_mask,
4854            __restore_token,
4855            Unknown(std::string::String),
4856        }
4857        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
4858            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
4859            where
4860                D: serde::Deserializer<'de>,
4861            {
4862                struct Visitor;
4863                impl<'de> serde::de::Visitor<'de> for Visitor {
4864                    type Value = __FieldTag;
4865                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
4866                        formatter.write_str("a field name for GetObjectRequest")
4867                    }
4868                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
4869                    where
4870                        E: serde::de::Error,
4871                    {
4872                        use std::result::Result::Ok;
4873                        use std::string::ToString;
4874                        match value {
4875                            "bucket" => Ok(__FieldTag::__bucket),
4876                            "object" => Ok(__FieldTag::__object),
4877                            "generation" => Ok(__FieldTag::__generation),
4878                            "softDeleted" => Ok(__FieldTag::__soft_deleted),
4879                            "soft_deleted" => Ok(__FieldTag::__soft_deleted),
4880                            "ifGenerationMatch" => Ok(__FieldTag::__if_generation_match),
4881                            "if_generation_match" => Ok(__FieldTag::__if_generation_match),
4882                            "ifGenerationNotMatch" => Ok(__FieldTag::__if_generation_not_match),
4883                            "if_generation_not_match" => Ok(__FieldTag::__if_generation_not_match),
4884                            "ifMetagenerationMatch" => Ok(__FieldTag::__if_metageneration_match),
4885                            "if_metageneration_match" => Ok(__FieldTag::__if_metageneration_match),
4886                            "ifMetagenerationNotMatch" => {
4887                                Ok(__FieldTag::__if_metageneration_not_match)
4888                            }
4889                            "if_metageneration_not_match" => {
4890                                Ok(__FieldTag::__if_metageneration_not_match)
4891                            }
4892                            "commonObjectRequestParams" => {
4893                                Ok(__FieldTag::__common_object_request_params)
4894                            }
4895                            "common_object_request_params" => {
4896                                Ok(__FieldTag::__common_object_request_params)
4897                            }
4898                            "readMask" => Ok(__FieldTag::__read_mask),
4899                            "read_mask" => Ok(__FieldTag::__read_mask),
4900                            "restoreToken" => Ok(__FieldTag::__restore_token),
4901                            "restore_token" => Ok(__FieldTag::__restore_token),
4902                            _ => Ok(__FieldTag::Unknown(value.to_string())),
4903                        }
4904                    }
4905                }
4906                deserializer.deserialize_identifier(Visitor)
4907            }
4908        }
4909        struct Visitor;
4910        impl<'de> serde::de::Visitor<'de> for Visitor {
4911            type Value = GetObjectRequest;
4912            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
4913                formatter.write_str("struct GetObjectRequest")
4914            }
4915            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
4916            where
4917                A: serde::de::MapAccess<'de>,
4918            {
4919                #[allow(unused_imports)]
4920                use serde::de::Error;
4921                use std::option::Option::Some;
4922                let mut fields = std::collections::HashSet::new();
4923                let mut result = Self::Value::new();
4924                while let Some(tag) = map.next_key::<__FieldTag>()? {
4925                    #[allow(clippy::match_single_binding)]
4926                    match tag {
4927                        __FieldTag::__bucket => {
4928                            if !fields.insert(__FieldTag::__bucket) {
4929                                return std::result::Result::Err(A::Error::duplicate_field(
4930                                    "multiple values for bucket",
4931                                ));
4932                            }
4933                            result.bucket = map
4934                                .next_value::<std::option::Option<std::string::String>>()?
4935                                .unwrap_or_default();
4936                        }
4937                        __FieldTag::__object => {
4938                            if !fields.insert(__FieldTag::__object) {
4939                                return std::result::Result::Err(A::Error::duplicate_field(
4940                                    "multiple values for object",
4941                                ));
4942                            }
4943                            result.object = map
4944                                .next_value::<std::option::Option<std::string::String>>()?
4945                                .unwrap_or_default();
4946                        }
4947                        __FieldTag::__generation => {
4948                            if !fields.insert(__FieldTag::__generation) {
4949                                return std::result::Result::Err(A::Error::duplicate_field(
4950                                    "multiple values for generation",
4951                                ));
4952                            }
4953                            struct __With(std::option::Option<i64>);
4954                            impl<'de> serde::de::Deserialize<'de> for __With {
4955                                fn deserialize<D>(
4956                                    deserializer: D,
4957                                ) -> std::result::Result<Self, D::Error>
4958                                where
4959                                    D: serde::de::Deserializer<'de>,
4960                                {
4961                                    serde_with::As::< std::option::Option<wkt::internal::I64> >::deserialize(deserializer).map(__With)
4962                                }
4963                            }
4964                            result.generation = map.next_value::<__With>()?.0.unwrap_or_default();
4965                        }
4966                        __FieldTag::__soft_deleted => {
4967                            if !fields.insert(__FieldTag::__soft_deleted) {
4968                                return std::result::Result::Err(A::Error::duplicate_field(
4969                                    "multiple values for soft_deleted",
4970                                ));
4971                            }
4972                            result.soft_deleted = map.next_value::<std::option::Option<bool>>()?;
4973                        }
4974                        __FieldTag::__if_generation_match => {
4975                            if !fields.insert(__FieldTag::__if_generation_match) {
4976                                return std::result::Result::Err(A::Error::duplicate_field(
4977                                    "multiple values for if_generation_match",
4978                                ));
4979                            }
4980                            struct __With(std::option::Option<i64>);
4981                            impl<'de> serde::de::Deserialize<'de> for __With {
4982                                fn deserialize<D>(
4983                                    deserializer: D,
4984                                ) -> std::result::Result<Self, D::Error>
4985                                where
4986                                    D: serde::de::Deserializer<'de>,
4987                                {
4988                                    serde_with::As::< std::option::Option<wkt::internal::I64> >::deserialize(deserializer).map(__With)
4989                                }
4990                            }
4991                            result.if_generation_match = map.next_value::<__With>()?.0;
4992                        }
4993                        __FieldTag::__if_generation_not_match => {
4994                            if !fields.insert(__FieldTag::__if_generation_not_match) {
4995                                return std::result::Result::Err(A::Error::duplicate_field(
4996                                    "multiple values for if_generation_not_match",
4997                                ));
4998                            }
4999                            struct __With(std::option::Option<i64>);
5000                            impl<'de> serde::de::Deserialize<'de> for __With {
5001                                fn deserialize<D>(
5002                                    deserializer: D,
5003                                ) -> std::result::Result<Self, D::Error>
5004                                where
5005                                    D: serde::de::Deserializer<'de>,
5006                                {
5007                                    serde_with::As::< std::option::Option<wkt::internal::I64> >::deserialize(deserializer).map(__With)
5008                                }
5009                            }
5010                            result.if_generation_not_match = map.next_value::<__With>()?.0;
5011                        }
5012                        __FieldTag::__if_metageneration_match => {
5013                            if !fields.insert(__FieldTag::__if_metageneration_match) {
5014                                return std::result::Result::Err(A::Error::duplicate_field(
5015                                    "multiple values for if_metageneration_match",
5016                                ));
5017                            }
5018                            struct __With(std::option::Option<i64>);
5019                            impl<'de> serde::de::Deserialize<'de> for __With {
5020                                fn deserialize<D>(
5021                                    deserializer: D,
5022                                ) -> std::result::Result<Self, D::Error>
5023                                where
5024                                    D: serde::de::Deserializer<'de>,
5025                                {
5026                                    serde_with::As::< std::option::Option<wkt::internal::I64> >::deserialize(deserializer).map(__With)
5027                                }
5028                            }
5029                            result.if_metageneration_match = map.next_value::<__With>()?.0;
5030                        }
5031                        __FieldTag::__if_metageneration_not_match => {
5032                            if !fields.insert(__FieldTag::__if_metageneration_not_match) {
5033                                return std::result::Result::Err(A::Error::duplicate_field(
5034                                    "multiple values for if_metageneration_not_match",
5035                                ));
5036                            }
5037                            struct __With(std::option::Option<i64>);
5038                            impl<'de> serde::de::Deserialize<'de> for __With {
5039                                fn deserialize<D>(
5040                                    deserializer: D,
5041                                ) -> std::result::Result<Self, D::Error>
5042                                where
5043                                    D: serde::de::Deserializer<'de>,
5044                                {
5045                                    serde_with::As::< std::option::Option<wkt::internal::I64> >::deserialize(deserializer).map(__With)
5046                                }
5047                            }
5048                            result.if_metageneration_not_match = map.next_value::<__With>()?.0;
5049                        }
5050                        __FieldTag::__common_object_request_params => {
5051                            if !fields.insert(__FieldTag::__common_object_request_params) {
5052                                return std::result::Result::Err(A::Error::duplicate_field(
5053                                    "multiple values for common_object_request_params",
5054                                ));
5055                            }
5056                            result.common_object_request_params = map.next_value::<std::option::Option<crate::model::CommonObjectRequestParams>>()?
5057                                ;
5058                        }
5059                        __FieldTag::__read_mask => {
5060                            if !fields.insert(__FieldTag::__read_mask) {
5061                                return std::result::Result::Err(A::Error::duplicate_field(
5062                                    "multiple values for read_mask",
5063                                ));
5064                            }
5065                            result.read_mask =
5066                                map.next_value::<std::option::Option<wkt::FieldMask>>()?;
5067                        }
5068                        __FieldTag::__restore_token => {
5069                            if !fields.insert(__FieldTag::__restore_token) {
5070                                return std::result::Result::Err(A::Error::duplicate_field(
5071                                    "multiple values for restore_token",
5072                                ));
5073                            }
5074                            result.restore_token = map
5075                                .next_value::<std::option::Option<std::string::String>>()?
5076                                .unwrap_or_default();
5077                        }
5078                        __FieldTag::Unknown(key) => {
5079                            let value = map.next_value::<serde_json::Value>()?;
5080                            result._unknown_fields.insert(key, value);
5081                        }
5082                    }
5083                }
5084                std::result::Result::Ok(result)
5085            }
5086        }
5087        deserializer.deserialize_any(Visitor)
5088    }
5089}
5090
5091#[doc(hidden)]
5092impl serde::ser::Serialize for GetObjectRequest {
5093    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
5094    where
5095        S: serde::ser::Serializer,
5096    {
5097        use serde::ser::SerializeMap;
5098        #[allow(unused_imports)]
5099        use std::option::Option::Some;
5100        let mut state = serializer.serialize_map(std::option::Option::None)?;
5101        if !self.bucket.is_empty() {
5102            state.serialize_entry("bucket", &self.bucket)?;
5103        }
5104        if !self.object.is_empty() {
5105            state.serialize_entry("object", &self.object)?;
5106        }
5107        if !wkt::internal::is_default(&self.generation) {
5108            struct __With<'a>(&'a i64);
5109            impl<'a> serde::ser::Serialize for __With<'a> {
5110                fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
5111                where
5112                    S: serde::ser::Serializer,
5113                {
5114                    serde_with::As::<wkt::internal::I64>::serialize(self.0, serializer)
5115                }
5116            }
5117            state.serialize_entry("generation", &__With(&self.generation))?;
5118        }
5119        if self.soft_deleted.is_some() {
5120            state.serialize_entry("softDeleted", &self.soft_deleted)?;
5121        }
5122        if self.if_generation_match.is_some() {
5123            struct __With<'a>(&'a std::option::Option<i64>);
5124            impl<'a> serde::ser::Serialize for __With<'a> {
5125                fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
5126                where
5127                    S: serde::ser::Serializer,
5128                {
5129                    serde_with::As::<std::option::Option<wkt::internal::I64>>::serialize(
5130                        self.0, serializer,
5131                    )
5132                }
5133            }
5134            state.serialize_entry("ifGenerationMatch", &__With(&self.if_generation_match))?;
5135        }
5136        if self.if_generation_not_match.is_some() {
5137            struct __With<'a>(&'a std::option::Option<i64>);
5138            impl<'a> serde::ser::Serialize for __With<'a> {
5139                fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
5140                where
5141                    S: serde::ser::Serializer,
5142                {
5143                    serde_with::As::<std::option::Option<wkt::internal::I64>>::serialize(
5144                        self.0, serializer,
5145                    )
5146                }
5147            }
5148            state.serialize_entry(
5149                "ifGenerationNotMatch",
5150                &__With(&self.if_generation_not_match),
5151            )?;
5152        }
5153        if self.if_metageneration_match.is_some() {
5154            struct __With<'a>(&'a std::option::Option<i64>);
5155            impl<'a> serde::ser::Serialize for __With<'a> {
5156                fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
5157                where
5158                    S: serde::ser::Serializer,
5159                {
5160                    serde_with::As::<std::option::Option<wkt::internal::I64>>::serialize(
5161                        self.0, serializer,
5162                    )
5163                }
5164            }
5165            state.serialize_entry(
5166                "ifMetagenerationMatch",
5167                &__With(&self.if_metageneration_match),
5168            )?;
5169        }
5170        if self.if_metageneration_not_match.is_some() {
5171            struct __With<'a>(&'a std::option::Option<i64>);
5172            impl<'a> serde::ser::Serialize for __With<'a> {
5173                fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
5174                where
5175                    S: serde::ser::Serializer,
5176                {
5177                    serde_with::As::<std::option::Option<wkt::internal::I64>>::serialize(
5178                        self.0, serializer,
5179                    )
5180                }
5181            }
5182            state.serialize_entry(
5183                "ifMetagenerationNotMatch",
5184                &__With(&self.if_metageneration_not_match),
5185            )?;
5186        }
5187        if self.common_object_request_params.is_some() {
5188            state.serialize_entry(
5189                "commonObjectRequestParams",
5190                &self.common_object_request_params,
5191            )?;
5192        }
5193        if self.read_mask.is_some() {
5194            state.serialize_entry("readMask", &self.read_mask)?;
5195        }
5196        if !self.restore_token.is_empty() {
5197            state.serialize_entry("restoreToken", &self.restore_token)?;
5198        }
5199        if !self._unknown_fields.is_empty() {
5200            for (key, value) in self._unknown_fields.iter() {
5201                state.serialize_entry(key, &value)?;
5202            }
5203        }
5204        state.end()
5205    }
5206}
5207
5208impl std::fmt::Debug for GetObjectRequest {
5209    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
5210        let mut debug_struct = f.debug_struct("GetObjectRequest");
5211        debug_struct.field("bucket", &self.bucket);
5212        debug_struct.field("object", &self.object);
5213        debug_struct.field("generation", &self.generation);
5214        debug_struct.field("soft_deleted", &self.soft_deleted);
5215        debug_struct.field("if_generation_match", &self.if_generation_match);
5216        debug_struct.field("if_generation_not_match", &self.if_generation_not_match);
5217        debug_struct.field("if_metageneration_match", &self.if_metageneration_match);
5218        debug_struct.field(
5219            "if_metageneration_not_match",
5220            &self.if_metageneration_not_match,
5221        );
5222        debug_struct.field(
5223            "common_object_request_params",
5224            &self.common_object_request_params,
5225        );
5226        debug_struct.field("read_mask", &self.read_mask);
5227        debug_struct.field("restore_token", &self.restore_token);
5228        if !self._unknown_fields.is_empty() {
5229            debug_struct.field("_unknown_fields", &self._unknown_fields);
5230        }
5231        debug_struct.finish()
5232    }
5233}
5234
5235/// Describes an attempt to insert an object, possibly over multiple requests.
5236#[derive(Clone, Default, PartialEq)]
5237#[non_exhaustive]
5238pub(crate) struct WriteObjectSpec {
5239    /// Required. Destination object, including its name and its metadata.
5240    pub resource: std::option::Option<crate::model::Object>,
5241
5242    /// Optional. Apply a predefined set of access controls to this object.
5243    /// Valid values are "authenticatedRead", "bucketOwnerFullControl",
5244    /// "bucketOwnerRead", "private", "projectPrivate", or "publicRead".
5245    pub predefined_acl: std::string::String,
5246
5247    /// Makes the operation conditional on whether the object's current
5248    /// generation matches the given value. Setting to 0 makes the operation
5249    /// succeed only if there are no live versions of the object.
5250    pub if_generation_match: std::option::Option<i64>,
5251
5252    /// Makes the operation conditional on whether the object's live
5253    /// generation does not match the given value. If no live object exists, the
5254    /// precondition fails. Setting to 0 makes the operation succeed only if
5255    /// there is a live version of the object.
5256    pub if_generation_not_match: std::option::Option<i64>,
5257
5258    /// Makes the operation conditional on whether the object's current
5259    /// metageneration matches the given value.
5260    pub if_metageneration_match: std::option::Option<i64>,
5261
5262    /// Makes the operation conditional on whether the object's current
5263    /// metageneration does not match the given value.
5264    pub if_metageneration_not_match: std::option::Option<i64>,
5265
5266    /// The expected final object size being uploaded.
5267    /// If this value is set, closing the stream after writing fewer or more than
5268    /// `object_size` bytes will result in an OUT_OF_RANGE error.
5269    ///
5270    /// This situation is considered a client error, and if such an error occurs
5271    /// you must start the upload over from scratch, this time sending the correct
5272    /// number of bytes.
5273    pub object_size: std::option::Option<i64>,
5274
5275    /// If true, the object will be created in appendable mode.
5276    /// This field may only be set when using BidiWriteObject.
5277    pub appendable: std::option::Option<bool>,
5278
5279    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5280}
5281
5282impl WriteObjectSpec {
5283    pub fn new() -> Self {
5284        std::default::Default::default()
5285    }
5286
5287    /// Sets the value of [resource][crate::model::WriteObjectSpec::resource].
5288    pub fn set_resource<T>(mut self, v: T) -> Self
5289    where
5290        T: std::convert::Into<crate::model::Object>,
5291    {
5292        self.resource = std::option::Option::Some(v.into());
5293        self
5294    }
5295
5296    /// Sets or clears the value of [resource][crate::model::WriteObjectSpec::resource].
5297    pub fn set_or_clear_resource<T>(mut self, v: std::option::Option<T>) -> Self
5298    where
5299        T: std::convert::Into<crate::model::Object>,
5300    {
5301        self.resource = v.map(|x| x.into());
5302        self
5303    }
5304
5305    /// Sets the value of [predefined_acl][crate::model::WriteObjectSpec::predefined_acl].
5306    pub fn set_predefined_acl<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5307        self.predefined_acl = v.into();
5308        self
5309    }
5310
5311    /// Sets the value of [if_generation_match][crate::model::WriteObjectSpec::if_generation_match].
5312    pub fn set_if_generation_match<T>(mut self, v: T) -> Self
5313    where
5314        T: std::convert::Into<i64>,
5315    {
5316        self.if_generation_match = std::option::Option::Some(v.into());
5317        self
5318    }
5319
5320    /// Sets or clears the value of [if_generation_match][crate::model::WriteObjectSpec::if_generation_match].
5321    pub fn set_or_clear_if_generation_match<T>(mut self, v: std::option::Option<T>) -> Self
5322    where
5323        T: std::convert::Into<i64>,
5324    {
5325        self.if_generation_match = v.map(|x| x.into());
5326        self
5327    }
5328
5329    /// Sets the value of [if_generation_not_match][crate::model::WriteObjectSpec::if_generation_not_match].
5330    pub fn set_if_generation_not_match<T>(mut self, v: T) -> Self
5331    where
5332        T: std::convert::Into<i64>,
5333    {
5334        self.if_generation_not_match = std::option::Option::Some(v.into());
5335        self
5336    }
5337
5338    /// Sets or clears the value of [if_generation_not_match][crate::model::WriteObjectSpec::if_generation_not_match].
5339    pub fn set_or_clear_if_generation_not_match<T>(mut self, v: std::option::Option<T>) -> Self
5340    where
5341        T: std::convert::Into<i64>,
5342    {
5343        self.if_generation_not_match = v.map(|x| x.into());
5344        self
5345    }
5346
5347    /// Sets the value of [if_metageneration_match][crate::model::WriteObjectSpec::if_metageneration_match].
5348    pub fn set_if_metageneration_match<T>(mut self, v: T) -> Self
5349    where
5350        T: std::convert::Into<i64>,
5351    {
5352        self.if_metageneration_match = std::option::Option::Some(v.into());
5353        self
5354    }
5355
5356    /// Sets or clears the value of [if_metageneration_match][crate::model::WriteObjectSpec::if_metageneration_match].
5357    pub fn set_or_clear_if_metageneration_match<T>(mut self, v: std::option::Option<T>) -> Self
5358    where
5359        T: std::convert::Into<i64>,
5360    {
5361        self.if_metageneration_match = v.map(|x| x.into());
5362        self
5363    }
5364
5365    /// Sets the value of [if_metageneration_not_match][crate::model::WriteObjectSpec::if_metageneration_not_match].
5366    pub fn set_if_metageneration_not_match<T>(mut self, v: T) -> Self
5367    where
5368        T: std::convert::Into<i64>,
5369    {
5370        self.if_metageneration_not_match = std::option::Option::Some(v.into());
5371        self
5372    }
5373
5374    /// Sets or clears the value of [if_metageneration_not_match][crate::model::WriteObjectSpec::if_metageneration_not_match].
5375    pub fn set_or_clear_if_metageneration_not_match<T>(mut self, v: std::option::Option<T>) -> Self
5376    where
5377        T: std::convert::Into<i64>,
5378    {
5379        self.if_metageneration_not_match = v.map(|x| x.into());
5380        self
5381    }
5382
5383    /// Sets the value of [object_size][crate::model::WriteObjectSpec::object_size].
5384    pub fn set_object_size<T>(mut self, v: T) -> Self
5385    where
5386        T: std::convert::Into<i64>,
5387    {
5388        self.object_size = std::option::Option::Some(v.into());
5389        self
5390    }
5391
5392    /// Sets or clears the value of [object_size][crate::model::WriteObjectSpec::object_size].
5393    pub fn set_or_clear_object_size<T>(mut self, v: std::option::Option<T>) -> Self
5394    where
5395        T: std::convert::Into<i64>,
5396    {
5397        self.object_size = v.map(|x| x.into());
5398        self
5399    }
5400
5401    /// Sets the value of [appendable][crate::model::WriteObjectSpec::appendable].
5402    pub fn set_appendable<T>(mut self, v: T) -> Self
5403    where
5404        T: std::convert::Into<bool>,
5405    {
5406        self.appendable = std::option::Option::Some(v.into());
5407        self
5408    }
5409
5410    /// Sets or clears the value of [appendable][crate::model::WriteObjectSpec::appendable].
5411    pub fn set_or_clear_appendable<T>(mut self, v: std::option::Option<T>) -> Self
5412    where
5413        T: std::convert::Into<bool>,
5414    {
5415        self.appendable = v.map(|x| x.into());
5416        self
5417    }
5418}
5419
5420impl wkt::message::Message for WriteObjectSpec {
5421    fn typename() -> &'static str {
5422        "type.googleapis.com/google.storage.v2.WriteObjectSpec"
5423    }
5424}
5425
5426#[doc(hidden)]
5427impl<'de> serde::de::Deserialize<'de> for WriteObjectSpec {
5428    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
5429    where
5430        D: serde::Deserializer<'de>,
5431    {
5432        #[allow(non_camel_case_types)]
5433        #[doc(hidden)]
5434        #[derive(PartialEq, Eq, Hash)]
5435        enum __FieldTag {
5436            __resource,
5437            __predefined_acl,
5438            __if_generation_match,
5439            __if_generation_not_match,
5440            __if_metageneration_match,
5441            __if_metageneration_not_match,
5442            __object_size,
5443            __appendable,
5444            Unknown(std::string::String),
5445        }
5446        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
5447            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
5448            where
5449                D: serde::Deserializer<'de>,
5450            {
5451                struct Visitor;
5452                impl<'de> serde::de::Visitor<'de> for Visitor {
5453                    type Value = __FieldTag;
5454                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
5455                        formatter.write_str("a field name for WriteObjectSpec")
5456                    }
5457                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
5458                    where
5459                        E: serde::de::Error,
5460                    {
5461                        use std::result::Result::Ok;
5462                        use std::string::ToString;
5463                        match value {
5464                            "resource" => Ok(__FieldTag::__resource),
5465                            "predefinedAcl" => Ok(__FieldTag::__predefined_acl),
5466                            "predefined_acl" => Ok(__FieldTag::__predefined_acl),
5467                            "ifGenerationMatch" => Ok(__FieldTag::__if_generation_match),
5468                            "if_generation_match" => Ok(__FieldTag::__if_generation_match),
5469                            "ifGenerationNotMatch" => Ok(__FieldTag::__if_generation_not_match),
5470                            "if_generation_not_match" => Ok(__FieldTag::__if_generation_not_match),
5471                            "ifMetagenerationMatch" => Ok(__FieldTag::__if_metageneration_match),
5472                            "if_metageneration_match" => Ok(__FieldTag::__if_metageneration_match),
5473                            "ifMetagenerationNotMatch" => {
5474                                Ok(__FieldTag::__if_metageneration_not_match)
5475                            }
5476                            "if_metageneration_not_match" => {
5477                                Ok(__FieldTag::__if_metageneration_not_match)
5478                            }
5479                            "objectSize" => Ok(__FieldTag::__object_size),
5480                            "object_size" => Ok(__FieldTag::__object_size),
5481                            "appendable" => Ok(__FieldTag::__appendable),
5482                            _ => Ok(__FieldTag::Unknown(value.to_string())),
5483                        }
5484                    }
5485                }
5486                deserializer.deserialize_identifier(Visitor)
5487            }
5488        }
5489        struct Visitor;
5490        impl<'de> serde::de::Visitor<'de> for Visitor {
5491            type Value = WriteObjectSpec;
5492            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
5493                formatter.write_str("struct WriteObjectSpec")
5494            }
5495            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
5496            where
5497                A: serde::de::MapAccess<'de>,
5498            {
5499                #[allow(unused_imports)]
5500                use serde::de::Error;
5501                use std::option::Option::Some;
5502                let mut fields = std::collections::HashSet::new();
5503                let mut result = Self::Value::new();
5504                while let Some(tag) = map.next_key::<__FieldTag>()? {
5505                    #[allow(clippy::match_single_binding)]
5506                    match tag {
5507                        __FieldTag::__resource => {
5508                            if !fields.insert(__FieldTag::__resource) {
5509                                return std::result::Result::Err(A::Error::duplicate_field(
5510                                    "multiple values for resource",
5511                                ));
5512                            }
5513                            result.resource =
5514                                map.next_value::<std::option::Option<crate::model::Object>>()?;
5515                        }
5516                        __FieldTag::__predefined_acl => {
5517                            if !fields.insert(__FieldTag::__predefined_acl) {
5518                                return std::result::Result::Err(A::Error::duplicate_field(
5519                                    "multiple values for predefined_acl",
5520                                ));
5521                            }
5522                            result.predefined_acl = map
5523                                .next_value::<std::option::Option<std::string::String>>()?
5524                                .unwrap_or_default();
5525                        }
5526                        __FieldTag::__if_generation_match => {
5527                            if !fields.insert(__FieldTag::__if_generation_match) {
5528                                return std::result::Result::Err(A::Error::duplicate_field(
5529                                    "multiple values for if_generation_match",
5530                                ));
5531                            }
5532                            struct __With(std::option::Option<i64>);
5533                            impl<'de> serde::de::Deserialize<'de> for __With {
5534                                fn deserialize<D>(
5535                                    deserializer: D,
5536                                ) -> std::result::Result<Self, D::Error>
5537                                where
5538                                    D: serde::de::Deserializer<'de>,
5539                                {
5540                                    serde_with::As::< std::option::Option<wkt::internal::I64> >::deserialize(deserializer).map(__With)
5541                                }
5542                            }
5543                            result.if_generation_match = map.next_value::<__With>()?.0;
5544                        }
5545                        __FieldTag::__if_generation_not_match => {
5546                            if !fields.insert(__FieldTag::__if_generation_not_match) {
5547                                return std::result::Result::Err(A::Error::duplicate_field(
5548                                    "multiple values for if_generation_not_match",
5549                                ));
5550                            }
5551                            struct __With(std::option::Option<i64>);
5552                            impl<'de> serde::de::Deserialize<'de> for __With {
5553                                fn deserialize<D>(
5554                                    deserializer: D,
5555                                ) -> std::result::Result<Self, D::Error>
5556                                where
5557                                    D: serde::de::Deserializer<'de>,
5558                                {
5559                                    serde_with::As::< std::option::Option<wkt::internal::I64> >::deserialize(deserializer).map(__With)
5560                                }
5561                            }
5562                            result.if_generation_not_match = map.next_value::<__With>()?.0;
5563                        }
5564                        __FieldTag::__if_metageneration_match => {
5565                            if !fields.insert(__FieldTag::__if_metageneration_match) {
5566                                return std::result::Result::Err(A::Error::duplicate_field(
5567                                    "multiple values for if_metageneration_match",
5568                                ));
5569                            }
5570                            struct __With(std::option::Option<i64>);
5571                            impl<'de> serde::de::Deserialize<'de> for __With {
5572                                fn deserialize<D>(
5573                                    deserializer: D,
5574                                ) -> std::result::Result<Self, D::Error>
5575                                where
5576                                    D: serde::de::Deserializer<'de>,
5577                                {
5578                                    serde_with::As::< std::option::Option<wkt::internal::I64> >::deserialize(deserializer).map(__With)
5579                                }
5580                            }
5581                            result.if_metageneration_match = map.next_value::<__With>()?.0;
5582                        }
5583                        __FieldTag::__if_metageneration_not_match => {
5584                            if !fields.insert(__FieldTag::__if_metageneration_not_match) {
5585                                return std::result::Result::Err(A::Error::duplicate_field(
5586                                    "multiple values for if_metageneration_not_match",
5587                                ));
5588                            }
5589                            struct __With(std::option::Option<i64>);
5590                            impl<'de> serde::de::Deserialize<'de> for __With {
5591                                fn deserialize<D>(
5592                                    deserializer: D,
5593                                ) -> std::result::Result<Self, D::Error>
5594                                where
5595                                    D: serde::de::Deserializer<'de>,
5596                                {
5597                                    serde_with::As::< std::option::Option<wkt::internal::I64> >::deserialize(deserializer).map(__With)
5598                                }
5599                            }
5600                            result.if_metageneration_not_match = map.next_value::<__With>()?.0;
5601                        }
5602                        __FieldTag::__object_size => {
5603                            if !fields.insert(__FieldTag::__object_size) {
5604                                return std::result::Result::Err(A::Error::duplicate_field(
5605                                    "multiple values for object_size",
5606                                ));
5607                            }
5608                            struct __With(std::option::Option<i64>);
5609                            impl<'de> serde::de::Deserialize<'de> for __With {
5610                                fn deserialize<D>(
5611                                    deserializer: D,
5612                                ) -> std::result::Result<Self, D::Error>
5613                                where
5614                                    D: serde::de::Deserializer<'de>,
5615                                {
5616                                    serde_with::As::< std::option::Option<wkt::internal::I64> >::deserialize(deserializer).map(__With)
5617                                }
5618                            }
5619                            result.object_size = map.next_value::<__With>()?.0;
5620                        }
5621                        __FieldTag::__appendable => {
5622                            if !fields.insert(__FieldTag::__appendable) {
5623                                return std::result::Result::Err(A::Error::duplicate_field(
5624                                    "multiple values for appendable",
5625                                ));
5626                            }
5627                            result.appendable = map.next_value::<std::option::Option<bool>>()?;
5628                        }
5629                        __FieldTag::Unknown(key) => {
5630                            let value = map.next_value::<serde_json::Value>()?;
5631                            result._unknown_fields.insert(key, value);
5632                        }
5633                    }
5634                }
5635                std::result::Result::Ok(result)
5636            }
5637        }
5638        deserializer.deserialize_any(Visitor)
5639    }
5640}
5641
5642#[doc(hidden)]
5643impl serde::ser::Serialize for WriteObjectSpec {
5644    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
5645    where
5646        S: serde::ser::Serializer,
5647    {
5648        use serde::ser::SerializeMap;
5649        #[allow(unused_imports)]
5650        use std::option::Option::Some;
5651        let mut state = serializer.serialize_map(std::option::Option::None)?;
5652        if self.resource.is_some() {
5653            state.serialize_entry("resource", &self.resource)?;
5654        }
5655        if !self.predefined_acl.is_empty() {
5656            state.serialize_entry("predefinedAcl", &self.predefined_acl)?;
5657        }
5658        if self.if_generation_match.is_some() {
5659            struct __With<'a>(&'a std::option::Option<i64>);
5660            impl<'a> serde::ser::Serialize for __With<'a> {
5661                fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
5662                where
5663                    S: serde::ser::Serializer,
5664                {
5665                    serde_with::As::<std::option::Option<wkt::internal::I64>>::serialize(
5666                        self.0, serializer,
5667                    )
5668                }
5669            }
5670            state.serialize_entry("ifGenerationMatch", &__With(&self.if_generation_match))?;
5671        }
5672        if self.if_generation_not_match.is_some() {
5673            struct __With<'a>(&'a std::option::Option<i64>);
5674            impl<'a> serde::ser::Serialize for __With<'a> {
5675                fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
5676                where
5677                    S: serde::ser::Serializer,
5678                {
5679                    serde_with::As::<std::option::Option<wkt::internal::I64>>::serialize(
5680                        self.0, serializer,
5681                    )
5682                }
5683            }
5684            state.serialize_entry(
5685                "ifGenerationNotMatch",
5686                &__With(&self.if_generation_not_match),
5687            )?;
5688        }
5689        if self.if_metageneration_match.is_some() {
5690            struct __With<'a>(&'a std::option::Option<i64>);
5691            impl<'a> serde::ser::Serialize for __With<'a> {
5692                fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
5693                where
5694                    S: serde::ser::Serializer,
5695                {
5696                    serde_with::As::<std::option::Option<wkt::internal::I64>>::serialize(
5697                        self.0, serializer,
5698                    )
5699                }
5700            }
5701            state.serialize_entry(
5702                "ifMetagenerationMatch",
5703                &__With(&self.if_metageneration_match),
5704            )?;
5705        }
5706        if self.if_metageneration_not_match.is_some() {
5707            struct __With<'a>(&'a std::option::Option<i64>);
5708            impl<'a> serde::ser::Serialize for __With<'a> {
5709                fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
5710                where
5711                    S: serde::ser::Serializer,
5712                {
5713                    serde_with::As::<std::option::Option<wkt::internal::I64>>::serialize(
5714                        self.0, serializer,
5715                    )
5716                }
5717            }
5718            state.serialize_entry(
5719                "ifMetagenerationNotMatch",
5720                &__With(&self.if_metageneration_not_match),
5721            )?;
5722        }
5723        if self.object_size.is_some() {
5724            struct __With<'a>(&'a std::option::Option<i64>);
5725            impl<'a> serde::ser::Serialize for __With<'a> {
5726                fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
5727                where
5728                    S: serde::ser::Serializer,
5729                {
5730                    serde_with::As::<std::option::Option<wkt::internal::I64>>::serialize(
5731                        self.0, serializer,
5732                    )
5733                }
5734            }
5735            state.serialize_entry("objectSize", &__With(&self.object_size))?;
5736        }
5737        if self.appendable.is_some() {
5738            state.serialize_entry("appendable", &self.appendable)?;
5739        }
5740        if !self._unknown_fields.is_empty() {
5741            for (key, value) in self._unknown_fields.iter() {
5742                state.serialize_entry(key, &value)?;
5743            }
5744        }
5745        state.end()
5746    }
5747}
5748
5749impl std::fmt::Debug for WriteObjectSpec {
5750    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
5751        let mut debug_struct = f.debug_struct("WriteObjectSpec");
5752        debug_struct.field("resource", &self.resource);
5753        debug_struct.field("predefined_acl", &self.predefined_acl);
5754        debug_struct.field("if_generation_match", &self.if_generation_match);
5755        debug_struct.field("if_generation_not_match", &self.if_generation_not_match);
5756        debug_struct.field("if_metageneration_match", &self.if_metageneration_match);
5757        debug_struct.field(
5758            "if_metageneration_not_match",
5759            &self.if_metageneration_not_match,
5760        );
5761        debug_struct.field("object_size", &self.object_size);
5762        debug_struct.field("appendable", &self.appendable);
5763        if !self._unknown_fields.is_empty() {
5764            debug_struct.field("_unknown_fields", &self._unknown_fields);
5765        }
5766        debug_struct.finish()
5767    }
5768}
5769
5770/// Request message for ListObjects.
5771#[derive(Clone, Default, PartialEq)]
5772#[non_exhaustive]
5773pub struct ListObjectsRequest {
5774    /// Required. Name of the bucket in which to look for objects.
5775    pub parent: std::string::String,
5776
5777    /// Optional. Maximum number of `items` plus `prefixes` to return
5778    /// in a single page of responses. As duplicate `prefixes` are
5779    /// omitted, fewer total results may be returned than requested. The service
5780    /// will use this parameter or 1,000 items, whichever is smaller.
5781    pub page_size: i32,
5782
5783    /// Optional. A previously-returned page token representing part of the larger
5784    /// set of results to view.
5785    pub page_token: std::string::String,
5786
5787    /// Optional. If set, returns results in a directory-like mode. `items` will
5788    /// contain only objects whose names, aside from the `prefix`, do not contain
5789    /// `delimiter`. Objects whose names, aside from the `prefix`, contain
5790    /// `delimiter` will have their name, truncated after the `delimiter`, returned
5791    /// in `prefixes`. Duplicate `prefixes` are omitted.
5792    pub delimiter: std::string::String,
5793
5794    /// Optional. If true, objects that end in exactly one instance of `delimiter`
5795    /// will have their metadata included in `items` in addition to
5796    /// `prefixes`.
5797    pub include_trailing_delimiter: bool,
5798
5799    /// Optional. Filter results to objects whose names begin with this prefix.
5800    pub prefix: std::string::String,
5801
5802    /// Optional. If `true`, lists all versions of an object as distinct results.
5803    /// For more information, see
5804    /// [Object
5805    /// Versioning](https://cloud.google.com/storage/docs/object-versioning).
5806    pub versions: bool,
5807
5808    /// Mask specifying which fields to read from each result.
5809    /// If no mask is specified, will default to all fields except items.acl and
5810    /// items.owner.
5811    ///
5812    /// * may be used to mean "all fields".
5813    pub read_mask: std::option::Option<wkt::FieldMask>,
5814
5815    /// Optional. Filter results to objects whose names are lexicographically equal
5816    /// to or after lexicographic_start. If lexicographic_end is also set, the
5817    /// objects listed have names between lexicographic_start (inclusive) and
5818    /// lexicographic_end (exclusive).
5819    pub lexicographic_start: std::string::String,
5820
5821    /// Optional. Filter results to objects whose names are lexicographically
5822    /// before lexicographic_end. If lexicographic_start is also set, the objects
5823    /// listed have names between lexicographic_start (inclusive) and
5824    /// lexicographic_end (exclusive).
5825    pub lexicographic_end: std::string::String,
5826
5827    /// Optional. If true, only list all soft-deleted versions of the object.
5828    /// Soft delete policy is required to set this option.
5829    pub soft_deleted: bool,
5830
5831    /// Optional. If true, will also include folders and managed folders (besides
5832    /// objects) in the returned `prefixes`. Requires `delimiter` to be set to '/'.
5833    pub include_folders_as_prefixes: bool,
5834
5835    /// Optional. Filter results to objects and prefixes that match this glob
5836    /// pattern. See [List Objects Using
5837    /// Glob](https://cloud.google.com/storage/docs/json_api/v1/objects/list#list-objects-and-prefixes-using-glob)
5838    /// for the full syntax.
5839    pub match_glob: std::string::String,
5840
5841    /// Optional. Filter the returned objects. Currently only supported for the
5842    /// `contexts` field. If `delimiter` is set, the returned `prefixes` are exempt
5843    /// from this filter.
5844    pub filter: std::string::String,
5845
5846    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5847}
5848
5849impl ListObjectsRequest {
5850    pub fn new() -> Self {
5851        std::default::Default::default()
5852    }
5853
5854    /// Sets the value of [parent][crate::model::ListObjectsRequest::parent].
5855    pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5856        self.parent = v.into();
5857        self
5858    }
5859
5860    /// Sets the value of [page_size][crate::model::ListObjectsRequest::page_size].
5861    pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
5862        self.page_size = v.into();
5863        self
5864    }
5865
5866    /// Sets the value of [page_token][crate::model::ListObjectsRequest::page_token].
5867    pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5868        self.page_token = v.into();
5869        self
5870    }
5871
5872    /// Sets the value of [delimiter][crate::model::ListObjectsRequest::delimiter].
5873    pub fn set_delimiter<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5874        self.delimiter = v.into();
5875        self
5876    }
5877
5878    /// Sets the value of [include_trailing_delimiter][crate::model::ListObjectsRequest::include_trailing_delimiter].
5879    pub fn set_include_trailing_delimiter<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
5880        self.include_trailing_delimiter = v.into();
5881        self
5882    }
5883
5884    /// Sets the value of [prefix][crate::model::ListObjectsRequest::prefix].
5885    pub fn set_prefix<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5886        self.prefix = v.into();
5887        self
5888    }
5889
5890    /// Sets the value of [versions][crate::model::ListObjectsRequest::versions].
5891    pub fn set_versions<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
5892        self.versions = v.into();
5893        self
5894    }
5895
5896    /// Sets the value of [read_mask][crate::model::ListObjectsRequest::read_mask].
5897    pub fn set_read_mask<T>(mut self, v: T) -> Self
5898    where
5899        T: std::convert::Into<wkt::FieldMask>,
5900    {
5901        self.read_mask = std::option::Option::Some(v.into());
5902        self
5903    }
5904
5905    /// Sets or clears the value of [read_mask][crate::model::ListObjectsRequest::read_mask].
5906    pub fn set_or_clear_read_mask<T>(mut self, v: std::option::Option<T>) -> Self
5907    where
5908        T: std::convert::Into<wkt::FieldMask>,
5909    {
5910        self.read_mask = v.map(|x| x.into());
5911        self
5912    }
5913
5914    /// Sets the value of [lexicographic_start][crate::model::ListObjectsRequest::lexicographic_start].
5915    pub fn set_lexicographic_start<T: std::convert::Into<std::string::String>>(
5916        mut self,
5917        v: T,
5918    ) -> Self {
5919        self.lexicographic_start = v.into();
5920        self
5921    }
5922
5923    /// Sets the value of [lexicographic_end][crate::model::ListObjectsRequest::lexicographic_end].
5924    pub fn set_lexicographic_end<T: std::convert::Into<std::string::String>>(
5925        mut self,
5926        v: T,
5927    ) -> Self {
5928        self.lexicographic_end = v.into();
5929        self
5930    }
5931
5932    /// Sets the value of [soft_deleted][crate::model::ListObjectsRequest::soft_deleted].
5933    pub fn set_soft_deleted<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
5934        self.soft_deleted = v.into();
5935        self
5936    }
5937
5938    /// Sets the value of [include_folders_as_prefixes][crate::model::ListObjectsRequest::include_folders_as_prefixes].
5939    pub fn set_include_folders_as_prefixes<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
5940        self.include_folders_as_prefixes = v.into();
5941        self
5942    }
5943
5944    /// Sets the value of [match_glob][crate::model::ListObjectsRequest::match_glob].
5945    pub fn set_match_glob<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5946        self.match_glob = v.into();
5947        self
5948    }
5949
5950    /// Sets the value of [filter][crate::model::ListObjectsRequest::filter].
5951    pub fn set_filter<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5952        self.filter = v.into();
5953        self
5954    }
5955}
5956
5957impl wkt::message::Message for ListObjectsRequest {
5958    fn typename() -> &'static str {
5959        "type.googleapis.com/google.storage.v2.ListObjectsRequest"
5960    }
5961}
5962
5963#[doc(hidden)]
5964impl<'de> serde::de::Deserialize<'de> for ListObjectsRequest {
5965    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
5966    where
5967        D: serde::Deserializer<'de>,
5968    {
5969        #[allow(non_camel_case_types)]
5970        #[doc(hidden)]
5971        #[derive(PartialEq, Eq, Hash)]
5972        enum __FieldTag {
5973            __parent,
5974            __page_size,
5975            __page_token,
5976            __delimiter,
5977            __include_trailing_delimiter,
5978            __prefix,
5979            __versions,
5980            __read_mask,
5981            __lexicographic_start,
5982            __lexicographic_end,
5983            __soft_deleted,
5984            __include_folders_as_prefixes,
5985            __match_glob,
5986            __filter,
5987            Unknown(std::string::String),
5988        }
5989        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
5990            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
5991            where
5992                D: serde::Deserializer<'de>,
5993            {
5994                struct Visitor;
5995                impl<'de> serde::de::Visitor<'de> for Visitor {
5996                    type Value = __FieldTag;
5997                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
5998                        formatter.write_str("a field name for ListObjectsRequest")
5999                    }
6000                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
6001                    where
6002                        E: serde::de::Error,
6003                    {
6004                        use std::result::Result::Ok;
6005                        use std::string::ToString;
6006                        match value {
6007                            "parent" => Ok(__FieldTag::__parent),
6008                            "pageSize" => Ok(__FieldTag::__page_size),
6009                            "page_size" => Ok(__FieldTag::__page_size),
6010                            "pageToken" => Ok(__FieldTag::__page_token),
6011                            "page_token" => Ok(__FieldTag::__page_token),
6012                            "delimiter" => Ok(__FieldTag::__delimiter),
6013                            "includeTrailingDelimiter" => {
6014                                Ok(__FieldTag::__include_trailing_delimiter)
6015                            }
6016                            "include_trailing_delimiter" => {
6017                                Ok(__FieldTag::__include_trailing_delimiter)
6018                            }
6019                            "prefix" => Ok(__FieldTag::__prefix),
6020                            "versions" => Ok(__FieldTag::__versions),
6021                            "readMask" => Ok(__FieldTag::__read_mask),
6022                            "read_mask" => Ok(__FieldTag::__read_mask),
6023                            "lexicographicStart" => Ok(__FieldTag::__lexicographic_start),
6024                            "lexicographic_start" => Ok(__FieldTag::__lexicographic_start),
6025                            "lexicographicEnd" => Ok(__FieldTag::__lexicographic_end),
6026                            "lexicographic_end" => Ok(__FieldTag::__lexicographic_end),
6027                            "softDeleted" => Ok(__FieldTag::__soft_deleted),
6028                            "soft_deleted" => Ok(__FieldTag::__soft_deleted),
6029                            "includeFoldersAsPrefixes" => {
6030                                Ok(__FieldTag::__include_folders_as_prefixes)
6031                            }
6032                            "include_folders_as_prefixes" => {
6033                                Ok(__FieldTag::__include_folders_as_prefixes)
6034                            }
6035                            "matchGlob" => Ok(__FieldTag::__match_glob),
6036                            "match_glob" => Ok(__FieldTag::__match_glob),
6037                            "filter" => Ok(__FieldTag::__filter),
6038                            _ => Ok(__FieldTag::Unknown(value.to_string())),
6039                        }
6040                    }
6041                }
6042                deserializer.deserialize_identifier(Visitor)
6043            }
6044        }
6045        struct Visitor;
6046        impl<'de> serde::de::Visitor<'de> for Visitor {
6047            type Value = ListObjectsRequest;
6048            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
6049                formatter.write_str("struct ListObjectsRequest")
6050            }
6051            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
6052            where
6053                A: serde::de::MapAccess<'de>,
6054            {
6055                #[allow(unused_imports)]
6056                use serde::de::Error;
6057                use std::option::Option::Some;
6058                let mut fields = std::collections::HashSet::new();
6059                let mut result = Self::Value::new();
6060                while let Some(tag) = map.next_key::<__FieldTag>()? {
6061                    #[allow(clippy::match_single_binding)]
6062                    match tag {
6063                        __FieldTag::__parent => {
6064                            if !fields.insert(__FieldTag::__parent) {
6065                                return std::result::Result::Err(A::Error::duplicate_field(
6066                                    "multiple values for parent",
6067                                ));
6068                            }
6069                            result.parent = map
6070                                .next_value::<std::option::Option<std::string::String>>()?
6071                                .unwrap_or_default();
6072                        }
6073                        __FieldTag::__page_size => {
6074                            if !fields.insert(__FieldTag::__page_size) {
6075                                return std::result::Result::Err(A::Error::duplicate_field(
6076                                    "multiple values for page_size",
6077                                ));
6078                            }
6079                            struct __With(std::option::Option<i32>);
6080                            impl<'de> serde::de::Deserialize<'de> for __With {
6081                                fn deserialize<D>(
6082                                    deserializer: D,
6083                                ) -> std::result::Result<Self, D::Error>
6084                                where
6085                                    D: serde::de::Deserializer<'de>,
6086                                {
6087                                    serde_with::As::< std::option::Option<wkt::internal::I32> >::deserialize(deserializer).map(__With)
6088                                }
6089                            }
6090                            result.page_size = map.next_value::<__With>()?.0.unwrap_or_default();
6091                        }
6092                        __FieldTag::__page_token => {
6093                            if !fields.insert(__FieldTag::__page_token) {
6094                                return std::result::Result::Err(A::Error::duplicate_field(
6095                                    "multiple values for page_token",
6096                                ));
6097                            }
6098                            result.page_token = map
6099                                .next_value::<std::option::Option<std::string::String>>()?
6100                                .unwrap_or_default();
6101                        }
6102                        __FieldTag::__delimiter => {
6103                            if !fields.insert(__FieldTag::__delimiter) {
6104                                return std::result::Result::Err(A::Error::duplicate_field(
6105                                    "multiple values for delimiter",
6106                                ));
6107                            }
6108                            result.delimiter = map
6109                                .next_value::<std::option::Option<std::string::String>>()?
6110                                .unwrap_or_default();
6111                        }
6112                        __FieldTag::__include_trailing_delimiter => {
6113                            if !fields.insert(__FieldTag::__include_trailing_delimiter) {
6114                                return std::result::Result::Err(A::Error::duplicate_field(
6115                                    "multiple values for include_trailing_delimiter",
6116                                ));
6117                            }
6118                            result.include_trailing_delimiter = map
6119                                .next_value::<std::option::Option<bool>>()?
6120                                .unwrap_or_default();
6121                        }
6122                        __FieldTag::__prefix => {
6123                            if !fields.insert(__FieldTag::__prefix) {
6124                                return std::result::Result::Err(A::Error::duplicate_field(
6125                                    "multiple values for prefix",
6126                                ));
6127                            }
6128                            result.prefix = map
6129                                .next_value::<std::option::Option<std::string::String>>()?
6130                                .unwrap_or_default();
6131                        }
6132                        __FieldTag::__versions => {
6133                            if !fields.insert(__FieldTag::__versions) {
6134                                return std::result::Result::Err(A::Error::duplicate_field(
6135                                    "multiple values for versions",
6136                                ));
6137                            }
6138                            result.versions = map
6139                                .next_value::<std::option::Option<bool>>()?
6140                                .unwrap_or_default();
6141                        }
6142                        __FieldTag::__read_mask => {
6143                            if !fields.insert(__FieldTag::__read_mask) {
6144                                return std::result::Result::Err(A::Error::duplicate_field(
6145                                    "multiple values for read_mask",
6146                                ));
6147                            }
6148                            result.read_mask =
6149                                map.next_value::<std::option::Option<wkt::FieldMask>>()?;
6150                        }
6151                        __FieldTag::__lexicographic_start => {
6152                            if !fields.insert(__FieldTag::__lexicographic_start) {
6153                                return std::result::Result::Err(A::Error::duplicate_field(
6154                                    "multiple values for lexicographic_start",
6155                                ));
6156                            }
6157                            result.lexicographic_start = map
6158                                .next_value::<std::option::Option<std::string::String>>()?
6159                                .unwrap_or_default();
6160                        }
6161                        __FieldTag::__lexicographic_end => {
6162                            if !fields.insert(__FieldTag::__lexicographic_end) {
6163                                return std::result::Result::Err(A::Error::duplicate_field(
6164                                    "multiple values for lexicographic_end",
6165                                ));
6166                            }
6167                            result.lexicographic_end = map
6168                                .next_value::<std::option::Option<std::string::String>>()?
6169                                .unwrap_or_default();
6170                        }
6171                        __FieldTag::__soft_deleted => {
6172                            if !fields.insert(__FieldTag::__soft_deleted) {
6173                                return std::result::Result::Err(A::Error::duplicate_field(
6174                                    "multiple values for soft_deleted",
6175                                ));
6176                            }
6177                            result.soft_deleted = map
6178                                .next_value::<std::option::Option<bool>>()?
6179                                .unwrap_or_default();
6180                        }
6181                        __FieldTag::__include_folders_as_prefixes => {
6182                            if !fields.insert(__FieldTag::__include_folders_as_prefixes) {
6183                                return std::result::Result::Err(A::Error::duplicate_field(
6184                                    "multiple values for include_folders_as_prefixes",
6185                                ));
6186                            }
6187                            result.include_folders_as_prefixes = map
6188                                .next_value::<std::option::Option<bool>>()?
6189                                .unwrap_or_default();
6190                        }
6191                        __FieldTag::__match_glob => {
6192                            if !fields.insert(__FieldTag::__match_glob) {
6193                                return std::result::Result::Err(A::Error::duplicate_field(
6194                                    "multiple values for match_glob",
6195                                ));
6196                            }
6197                            result.match_glob = map
6198                                .next_value::<std::option::Option<std::string::String>>()?
6199                                .unwrap_or_default();
6200                        }
6201                        __FieldTag::__filter => {
6202                            if !fields.insert(__FieldTag::__filter) {
6203                                return std::result::Result::Err(A::Error::duplicate_field(
6204                                    "multiple values for filter",
6205                                ));
6206                            }
6207                            result.filter = map
6208                                .next_value::<std::option::Option<std::string::String>>()?
6209                                .unwrap_or_default();
6210                        }
6211                        __FieldTag::Unknown(key) => {
6212                            let value = map.next_value::<serde_json::Value>()?;
6213                            result._unknown_fields.insert(key, value);
6214                        }
6215                    }
6216                }
6217                std::result::Result::Ok(result)
6218            }
6219        }
6220        deserializer.deserialize_any(Visitor)
6221    }
6222}
6223
6224#[doc(hidden)]
6225impl serde::ser::Serialize for ListObjectsRequest {
6226    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
6227    where
6228        S: serde::ser::Serializer,
6229    {
6230        use serde::ser::SerializeMap;
6231        #[allow(unused_imports)]
6232        use std::option::Option::Some;
6233        let mut state = serializer.serialize_map(std::option::Option::None)?;
6234        if !self.parent.is_empty() {
6235            state.serialize_entry("parent", &self.parent)?;
6236        }
6237        if !wkt::internal::is_default(&self.page_size) {
6238            struct __With<'a>(&'a i32);
6239            impl<'a> serde::ser::Serialize for __With<'a> {
6240                fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
6241                where
6242                    S: serde::ser::Serializer,
6243                {
6244                    serde_with::As::<wkt::internal::I32>::serialize(self.0, serializer)
6245                }
6246            }
6247            state.serialize_entry("pageSize", &__With(&self.page_size))?;
6248        }
6249        if !self.page_token.is_empty() {
6250            state.serialize_entry("pageToken", &self.page_token)?;
6251        }
6252        if !self.delimiter.is_empty() {
6253            state.serialize_entry("delimiter", &self.delimiter)?;
6254        }
6255        if !wkt::internal::is_default(&self.include_trailing_delimiter) {
6256            state.serialize_entry("includeTrailingDelimiter", &self.include_trailing_delimiter)?;
6257        }
6258        if !self.prefix.is_empty() {
6259            state.serialize_entry("prefix", &self.prefix)?;
6260        }
6261        if !wkt::internal::is_default(&self.versions) {
6262            state.serialize_entry("versions", &self.versions)?;
6263        }
6264        if self.read_mask.is_some() {
6265            state.serialize_entry("readMask", &self.read_mask)?;
6266        }
6267        if !self.lexicographic_start.is_empty() {
6268            state.serialize_entry("lexicographicStart", &self.lexicographic_start)?;
6269        }
6270        if !self.lexicographic_end.is_empty() {
6271            state.serialize_entry("lexicographicEnd", &self.lexicographic_end)?;
6272        }
6273        if !wkt::internal::is_default(&self.soft_deleted) {
6274            state.serialize_entry("softDeleted", &self.soft_deleted)?;
6275        }
6276        if !wkt::internal::is_default(&self.include_folders_as_prefixes) {
6277            state.serialize_entry(
6278                "includeFoldersAsPrefixes",
6279                &self.include_folders_as_prefixes,
6280            )?;
6281        }
6282        if !self.match_glob.is_empty() {
6283            state.serialize_entry("matchGlob", &self.match_glob)?;
6284        }
6285        if !self.filter.is_empty() {
6286            state.serialize_entry("filter", &self.filter)?;
6287        }
6288        if !self._unknown_fields.is_empty() {
6289            for (key, value) in self._unknown_fields.iter() {
6290                state.serialize_entry(key, &value)?;
6291            }
6292        }
6293        state.end()
6294    }
6295}
6296
6297impl std::fmt::Debug for ListObjectsRequest {
6298    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
6299        let mut debug_struct = f.debug_struct("ListObjectsRequest");
6300        debug_struct.field("parent", &self.parent);
6301        debug_struct.field("page_size", &self.page_size);
6302        debug_struct.field("page_token", &self.page_token);
6303        debug_struct.field("delimiter", &self.delimiter);
6304        debug_struct.field(
6305            "include_trailing_delimiter",
6306            &self.include_trailing_delimiter,
6307        );
6308        debug_struct.field("prefix", &self.prefix);
6309        debug_struct.field("versions", &self.versions);
6310        debug_struct.field("read_mask", &self.read_mask);
6311        debug_struct.field("lexicographic_start", &self.lexicographic_start);
6312        debug_struct.field("lexicographic_end", &self.lexicographic_end);
6313        debug_struct.field("soft_deleted", &self.soft_deleted);
6314        debug_struct.field(
6315            "include_folders_as_prefixes",
6316            &self.include_folders_as_prefixes,
6317        );
6318        debug_struct.field("match_glob", &self.match_glob);
6319        debug_struct.field("filter", &self.filter);
6320        if !self._unknown_fields.is_empty() {
6321            debug_struct.field("_unknown_fields", &self._unknown_fields);
6322        }
6323        debug_struct.finish()
6324    }
6325}
6326
6327/// Request message for RewriteObject.
6328/// If the source object is encrypted using a Customer-Supplied Encryption Key
6329/// the key information must be provided in the copy_source_encryption_algorithm,
6330/// copy_source_encryption_key_bytes, and copy_source_encryption_key_sha256_bytes
6331/// fields. If the destination object should be encrypted the keying information
6332/// should be provided in the encryption_algorithm, encryption_key_bytes, and
6333/// encryption_key_sha256_bytes fields of the
6334/// common_object_request_params.customer_encryption field.
6335#[derive(Clone, Default, PartialEq)]
6336#[non_exhaustive]
6337pub struct RewriteObjectRequest {
6338    /// Required. Immutable. The name of the destination object.
6339    /// See the
6340    /// [Naming Guidelines](https://cloud.google.com/storage/docs/objects#naming).
6341    /// Example: `test.txt`
6342    /// The `name` field by itself does not uniquely identify a Cloud Storage
6343    /// object. A Cloud Storage object is uniquely identified by the tuple of
6344    /// (bucket, object, generation).
6345    pub destination_name: std::string::String,
6346
6347    /// Required. Immutable. The name of the bucket containing the destination
6348    /// object.
6349    pub destination_bucket: std::string::String,
6350
6351    /// Optional. The name of the Cloud KMS key that will be used to encrypt the
6352    /// destination object. The Cloud KMS key must be located in same location as
6353    /// the object. If the parameter is not specified, the request uses the
6354    /// destination bucket's default encryption key, if any, or else the
6355    /// Google-managed encryption key.
6356    pub destination_kms_key: std::string::String,
6357
6358    /// Optional. Properties of the destination, post-rewrite object.
6359    /// The `name`, `bucket` and `kms_key` fields must not be populated (these
6360    /// values are specified in the `destination_name`, `destination_bucket`, and
6361    /// `destination_kms_key` fields).
6362    /// If `destination` is present it will be used to construct the destination
6363    /// object's metadata; otherwise the destination object's metadata will be
6364    /// copied from the source object.
6365    pub destination: std::option::Option<crate::model::Object>,
6366
6367    /// Required. Name of the bucket in which to find the source object.
6368    pub source_bucket: std::string::String,
6369
6370    /// Required. Name of the source object.
6371    pub source_object: std::string::String,
6372
6373    /// Optional. If present, selects a specific revision of the source object (as
6374    /// opposed to the latest version, the default).
6375    pub source_generation: i64,
6376
6377    /// Optional. Include this field (from the previous rewrite response) on each
6378    /// rewrite request after the first one, until the rewrite response 'done' flag
6379    /// is true. Calls that provide a rewriteToken can omit all other request
6380    /// fields, but if included those fields must match the values provided in the
6381    /// first rewrite request.
6382    pub rewrite_token: std::string::String,
6383
6384    /// Optional. Apply a predefined set of access controls to the destination
6385    /// object. Valid values are "authenticatedRead", "bucketOwnerFullControl",
6386    /// "bucketOwnerRead", "private", "projectPrivate", or "publicRead".
6387    pub destination_predefined_acl: std::string::String,
6388
6389    /// Makes the operation conditional on whether the object's current generation
6390    /// matches the given value. Setting to 0 makes the operation succeed only if
6391    /// there are no live versions of the object.
6392    pub if_generation_match: std::option::Option<i64>,
6393
6394    /// Makes the operation conditional on whether the object's live generation
6395    /// does not match the given value. If no live object exists, the precondition
6396    /// fails. Setting to 0 makes the operation succeed only if there is a live
6397    /// version of the object.
6398    pub if_generation_not_match: std::option::Option<i64>,
6399
6400    /// Makes the operation conditional on whether the destination object's current
6401    /// metageneration matches the given value.
6402    pub if_metageneration_match: std::option::Option<i64>,
6403
6404    /// Makes the operation conditional on whether the destination object's current
6405    /// metageneration does not match the given value.
6406    pub if_metageneration_not_match: std::option::Option<i64>,
6407
6408    /// Makes the operation conditional on whether the source object's live
6409    /// generation matches the given value.
6410    pub if_source_generation_match: std::option::Option<i64>,
6411
6412    /// Makes the operation conditional on whether the source object's live
6413    /// generation does not match the given value.
6414    pub if_source_generation_not_match: std::option::Option<i64>,
6415
6416    /// Makes the operation conditional on whether the source object's current
6417    /// metageneration matches the given value.
6418    pub if_source_metageneration_match: std::option::Option<i64>,
6419
6420    /// Makes the operation conditional on whether the source object's current
6421    /// metageneration does not match the given value.
6422    pub if_source_metageneration_not_match: std::option::Option<i64>,
6423
6424    /// Optional. The maximum number of bytes that will be rewritten per rewrite
6425    /// request. Most callers shouldn't need to specify this parameter - it is
6426    /// primarily in place to support testing. If specified the value must be an
6427    /// integral multiple of 1 MiB (1048576). Also, this only applies to requests
6428    /// where the source and destination span locations and/or storage classes.
6429    /// Finally, this value must not change across rewrite calls else you'll get an
6430    /// error that the `rewriteToken` is invalid.
6431    pub max_bytes_rewritten_per_call: i64,
6432
6433    /// Optional. The algorithm used to encrypt the source object, if any. Used if
6434    /// the source object was encrypted with a Customer-Supplied Encryption Key.
6435    pub copy_source_encryption_algorithm: std::string::String,
6436
6437    /// Optional. The raw bytes (not base64-encoded) AES-256 encryption key used to
6438    /// encrypt the source object, if it was encrypted with a Customer-Supplied
6439    /// Encryption Key.
6440    pub copy_source_encryption_key_bytes: ::bytes::Bytes,
6441
6442    /// Optional. The raw bytes (not base64-encoded) SHA256 hash of the encryption
6443    /// key used to encrypt the source object, if it was encrypted with a
6444    /// Customer-Supplied Encryption Key.
6445    pub copy_source_encryption_key_sha256_bytes: ::bytes::Bytes,
6446
6447    /// Optional. A set of parameters common to Storage API requests concerning an
6448    /// object.
6449    pub common_object_request_params: std::option::Option<crate::model::CommonObjectRequestParams>,
6450
6451    /// Optional. The checksums of the complete object. This will be used to
6452    /// validate the destination object after rewriting.
6453    pub object_checksums: std::option::Option<crate::model::ObjectChecksums>,
6454
6455    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
6456}
6457
6458impl RewriteObjectRequest {
6459    pub fn new() -> Self {
6460        std::default::Default::default()
6461    }
6462
6463    /// Sets the value of [destination_name][crate::model::RewriteObjectRequest::destination_name].
6464    pub fn set_destination_name<T: std::convert::Into<std::string::String>>(
6465        mut self,
6466        v: T,
6467    ) -> Self {
6468        self.destination_name = v.into();
6469        self
6470    }
6471
6472    /// Sets the value of [destination_bucket][crate::model::RewriteObjectRequest::destination_bucket].
6473    pub fn set_destination_bucket<T: std::convert::Into<std::string::String>>(
6474        mut self,
6475        v: T,
6476    ) -> Self {
6477        self.destination_bucket = v.into();
6478        self
6479    }
6480
6481    /// Sets the value of [destination_kms_key][crate::model::RewriteObjectRequest::destination_kms_key].
6482    pub fn set_destination_kms_key<T: std::convert::Into<std::string::String>>(
6483        mut self,
6484        v: T,
6485    ) -> Self {
6486        self.destination_kms_key = v.into();
6487        self
6488    }
6489
6490    /// Sets the value of [destination][crate::model::RewriteObjectRequest::destination].
6491    pub fn set_destination<T>(mut self, v: T) -> Self
6492    where
6493        T: std::convert::Into<crate::model::Object>,
6494    {
6495        self.destination = std::option::Option::Some(v.into());
6496        self
6497    }
6498
6499    /// Sets or clears the value of [destination][crate::model::RewriteObjectRequest::destination].
6500    pub fn set_or_clear_destination<T>(mut self, v: std::option::Option<T>) -> Self
6501    where
6502        T: std::convert::Into<crate::model::Object>,
6503    {
6504        self.destination = v.map(|x| x.into());
6505        self
6506    }
6507
6508    /// Sets the value of [source_bucket][crate::model::RewriteObjectRequest::source_bucket].
6509    pub fn set_source_bucket<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6510        self.source_bucket = v.into();
6511        self
6512    }
6513
6514    /// Sets the value of [source_object][crate::model::RewriteObjectRequest::source_object].
6515    pub fn set_source_object<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6516        self.source_object = v.into();
6517        self
6518    }
6519
6520    /// Sets the value of [source_generation][crate::model::RewriteObjectRequest::source_generation].
6521    pub fn set_source_generation<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
6522        self.source_generation = v.into();
6523        self
6524    }
6525
6526    /// Sets the value of [rewrite_token][crate::model::RewriteObjectRequest::rewrite_token].
6527    pub fn set_rewrite_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6528        self.rewrite_token = v.into();
6529        self
6530    }
6531
6532    /// Sets the value of [destination_predefined_acl][crate::model::RewriteObjectRequest::destination_predefined_acl].
6533    pub fn set_destination_predefined_acl<T: std::convert::Into<std::string::String>>(
6534        mut self,
6535        v: T,
6536    ) -> Self {
6537        self.destination_predefined_acl = v.into();
6538        self
6539    }
6540
6541    /// Sets the value of [if_generation_match][crate::model::RewriteObjectRequest::if_generation_match].
6542    pub fn set_if_generation_match<T>(mut self, v: T) -> Self
6543    where
6544        T: std::convert::Into<i64>,
6545    {
6546        self.if_generation_match = std::option::Option::Some(v.into());
6547        self
6548    }
6549
6550    /// Sets or clears the value of [if_generation_match][crate::model::RewriteObjectRequest::if_generation_match].
6551    pub fn set_or_clear_if_generation_match<T>(mut self, v: std::option::Option<T>) -> Self
6552    where
6553        T: std::convert::Into<i64>,
6554    {
6555        self.if_generation_match = v.map(|x| x.into());
6556        self
6557    }
6558
6559    /// Sets the value of [if_generation_not_match][crate::model::RewriteObjectRequest::if_generation_not_match].
6560    pub fn set_if_generation_not_match<T>(mut self, v: T) -> Self
6561    where
6562        T: std::convert::Into<i64>,
6563    {
6564        self.if_generation_not_match = std::option::Option::Some(v.into());
6565        self
6566    }
6567
6568    /// Sets or clears the value of [if_generation_not_match][crate::model::RewriteObjectRequest::if_generation_not_match].
6569    pub fn set_or_clear_if_generation_not_match<T>(mut self, v: std::option::Option<T>) -> Self
6570    where
6571        T: std::convert::Into<i64>,
6572    {
6573        self.if_generation_not_match = v.map(|x| x.into());
6574        self
6575    }
6576
6577    /// Sets the value of [if_metageneration_match][crate::model::RewriteObjectRequest::if_metageneration_match].
6578    pub fn set_if_metageneration_match<T>(mut self, v: T) -> Self
6579    where
6580        T: std::convert::Into<i64>,
6581    {
6582        self.if_metageneration_match = std::option::Option::Some(v.into());
6583        self
6584    }
6585
6586    /// Sets or clears the value of [if_metageneration_match][crate::model::RewriteObjectRequest::if_metageneration_match].
6587    pub fn set_or_clear_if_metageneration_match<T>(mut self, v: std::option::Option<T>) -> Self
6588    where
6589        T: std::convert::Into<i64>,
6590    {
6591        self.if_metageneration_match = v.map(|x| x.into());
6592        self
6593    }
6594
6595    /// Sets the value of [if_metageneration_not_match][crate::model::RewriteObjectRequest::if_metageneration_not_match].
6596    pub fn set_if_metageneration_not_match<T>(mut self, v: T) -> Self
6597    where
6598        T: std::convert::Into<i64>,
6599    {
6600        self.if_metageneration_not_match = std::option::Option::Some(v.into());
6601        self
6602    }
6603
6604    /// Sets or clears the value of [if_metageneration_not_match][crate::model::RewriteObjectRequest::if_metageneration_not_match].
6605    pub fn set_or_clear_if_metageneration_not_match<T>(mut self, v: std::option::Option<T>) -> Self
6606    where
6607        T: std::convert::Into<i64>,
6608    {
6609        self.if_metageneration_not_match = v.map(|x| x.into());
6610        self
6611    }
6612
6613    /// Sets the value of [if_source_generation_match][crate::model::RewriteObjectRequest::if_source_generation_match].
6614    pub fn set_if_source_generation_match<T>(mut self, v: T) -> Self
6615    where
6616        T: std::convert::Into<i64>,
6617    {
6618        self.if_source_generation_match = std::option::Option::Some(v.into());
6619        self
6620    }
6621
6622    /// Sets or clears the value of [if_source_generation_match][crate::model::RewriteObjectRequest::if_source_generation_match].
6623    pub fn set_or_clear_if_source_generation_match<T>(mut self, v: std::option::Option<T>) -> Self
6624    where
6625        T: std::convert::Into<i64>,
6626    {
6627        self.if_source_generation_match = v.map(|x| x.into());
6628        self
6629    }
6630
6631    /// Sets the value of [if_source_generation_not_match][crate::model::RewriteObjectRequest::if_source_generation_not_match].
6632    pub fn set_if_source_generation_not_match<T>(mut self, v: T) -> Self
6633    where
6634        T: std::convert::Into<i64>,
6635    {
6636        self.if_source_generation_not_match = std::option::Option::Some(v.into());
6637        self
6638    }
6639
6640    /// Sets or clears the value of [if_source_generation_not_match][crate::model::RewriteObjectRequest::if_source_generation_not_match].
6641    pub fn set_or_clear_if_source_generation_not_match<T>(
6642        mut self,
6643        v: std::option::Option<T>,
6644    ) -> Self
6645    where
6646        T: std::convert::Into<i64>,
6647    {
6648        self.if_source_generation_not_match = v.map(|x| x.into());
6649        self
6650    }
6651
6652    /// Sets the value of [if_source_metageneration_match][crate::model::RewriteObjectRequest::if_source_metageneration_match].
6653    pub fn set_if_source_metageneration_match<T>(mut self, v: T) -> Self
6654    where
6655        T: std::convert::Into<i64>,
6656    {
6657        self.if_source_metageneration_match = std::option::Option::Some(v.into());
6658        self
6659    }
6660
6661    /// Sets or clears the value of [if_source_metageneration_match][crate::model::RewriteObjectRequest::if_source_metageneration_match].
6662    pub fn set_or_clear_if_source_metageneration_match<T>(
6663        mut self,
6664        v: std::option::Option<T>,
6665    ) -> Self
6666    where
6667        T: std::convert::Into<i64>,
6668    {
6669        self.if_source_metageneration_match = v.map(|x| x.into());
6670        self
6671    }
6672
6673    /// Sets the value of [if_source_metageneration_not_match][crate::model::RewriteObjectRequest::if_source_metageneration_not_match].
6674    pub fn set_if_source_metageneration_not_match<T>(mut self, v: T) -> Self
6675    where
6676        T: std::convert::Into<i64>,
6677    {
6678        self.if_source_metageneration_not_match = std::option::Option::Some(v.into());
6679        self
6680    }
6681
6682    /// Sets or clears the value of [if_source_metageneration_not_match][crate::model::RewriteObjectRequest::if_source_metageneration_not_match].
6683    pub fn set_or_clear_if_source_metageneration_not_match<T>(
6684        mut self,
6685        v: std::option::Option<T>,
6686    ) -> Self
6687    where
6688        T: std::convert::Into<i64>,
6689    {
6690        self.if_source_metageneration_not_match = v.map(|x| x.into());
6691        self
6692    }
6693
6694    /// Sets the value of [max_bytes_rewritten_per_call][crate::model::RewriteObjectRequest::max_bytes_rewritten_per_call].
6695    pub fn set_max_bytes_rewritten_per_call<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
6696        self.max_bytes_rewritten_per_call = v.into();
6697        self
6698    }
6699
6700    /// Sets the value of [copy_source_encryption_algorithm][crate::model::RewriteObjectRequest::copy_source_encryption_algorithm].
6701    pub fn set_copy_source_encryption_algorithm<T: std::convert::Into<std::string::String>>(
6702        mut self,
6703        v: T,
6704    ) -> Self {
6705        self.copy_source_encryption_algorithm = v.into();
6706        self
6707    }
6708
6709    /// Sets the value of [copy_source_encryption_key_bytes][crate::model::RewriteObjectRequest::copy_source_encryption_key_bytes].
6710    pub fn set_copy_source_encryption_key_bytes<T: std::convert::Into<::bytes::Bytes>>(
6711        mut self,
6712        v: T,
6713    ) -> Self {
6714        self.copy_source_encryption_key_bytes = v.into();
6715        self
6716    }
6717
6718    /// Sets the value of [copy_source_encryption_key_sha256_bytes][crate::model::RewriteObjectRequest::copy_source_encryption_key_sha256_bytes].
6719    pub fn set_copy_source_encryption_key_sha256_bytes<T: std::convert::Into<::bytes::Bytes>>(
6720        mut self,
6721        v: T,
6722    ) -> Self {
6723        self.copy_source_encryption_key_sha256_bytes = v.into();
6724        self
6725    }
6726
6727    /// Sets the value of [common_object_request_params][crate::model::RewriteObjectRequest::common_object_request_params].
6728    pub fn set_common_object_request_params<T>(mut self, v: T) -> Self
6729    where
6730        T: std::convert::Into<crate::model::CommonObjectRequestParams>,
6731    {
6732        self.common_object_request_params = std::option::Option::Some(v.into());
6733        self
6734    }
6735
6736    /// Sets or clears the value of [common_object_request_params][crate::model::RewriteObjectRequest::common_object_request_params].
6737    pub fn set_or_clear_common_object_request_params<T>(mut self, v: std::option::Option<T>) -> Self
6738    where
6739        T: std::convert::Into<crate::model::CommonObjectRequestParams>,
6740    {
6741        self.common_object_request_params = v.map(|x| x.into());
6742        self
6743    }
6744
6745    /// Sets the value of [object_checksums][crate::model::RewriteObjectRequest::object_checksums].
6746    pub fn set_object_checksums<T>(mut self, v: T) -> Self
6747    where
6748        T: std::convert::Into<crate::model::ObjectChecksums>,
6749    {
6750        self.object_checksums = std::option::Option::Some(v.into());
6751        self
6752    }
6753
6754    /// Sets or clears the value of [object_checksums][crate::model::RewriteObjectRequest::object_checksums].
6755    pub fn set_or_clear_object_checksums<T>(mut self, v: std::option::Option<T>) -> Self
6756    where
6757        T: std::convert::Into<crate::model::ObjectChecksums>,
6758    {
6759        self.object_checksums = v.map(|x| x.into());
6760        self
6761    }
6762}
6763
6764impl wkt::message::Message for RewriteObjectRequest {
6765    fn typename() -> &'static str {
6766        "type.googleapis.com/google.storage.v2.RewriteObjectRequest"
6767    }
6768}
6769
6770#[doc(hidden)]
6771impl<'de> serde::de::Deserialize<'de> for RewriteObjectRequest {
6772    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
6773    where
6774        D: serde::Deserializer<'de>,
6775    {
6776        #[allow(non_camel_case_types)]
6777        #[doc(hidden)]
6778        #[derive(PartialEq, Eq, Hash)]
6779        enum __FieldTag {
6780            __destination_name,
6781            __destination_bucket,
6782            __destination_kms_key,
6783            __destination,
6784            __source_bucket,
6785            __source_object,
6786            __source_generation,
6787            __rewrite_token,
6788            __destination_predefined_acl,
6789            __if_generation_match,
6790            __if_generation_not_match,
6791            __if_metageneration_match,
6792            __if_metageneration_not_match,
6793            __if_source_generation_match,
6794            __if_source_generation_not_match,
6795            __if_source_metageneration_match,
6796            __if_source_metageneration_not_match,
6797            __max_bytes_rewritten_per_call,
6798            __copy_source_encryption_algorithm,
6799            __copy_source_encryption_key_bytes,
6800            __copy_source_encryption_key_sha256_bytes,
6801            __common_object_request_params,
6802            __object_checksums,
6803            Unknown(std::string::String),
6804        }
6805        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
6806            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
6807            where
6808                D: serde::Deserializer<'de>,
6809            {
6810                struct Visitor;
6811                impl<'de> serde::de::Visitor<'de> for Visitor {
6812                    type Value = __FieldTag;
6813                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
6814                        formatter.write_str("a field name for RewriteObjectRequest")
6815                    }
6816                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
6817                    where
6818                        E: serde::de::Error,
6819                    {
6820                        use std::result::Result::Ok;
6821                        use std::string::ToString;
6822                        match value {
6823                            "destinationName" => Ok(__FieldTag::__destination_name),
6824                            "destination_name" => Ok(__FieldTag::__destination_name),
6825                            "destinationBucket" => Ok(__FieldTag::__destination_bucket),
6826                            "destination_bucket" => Ok(__FieldTag::__destination_bucket),
6827                            "destinationKmsKey" => Ok(__FieldTag::__destination_kms_key),
6828                            "destination_kms_key" => Ok(__FieldTag::__destination_kms_key),
6829                            "destination" => Ok(__FieldTag::__destination),
6830                            "sourceBucket" => Ok(__FieldTag::__source_bucket),
6831                            "source_bucket" => Ok(__FieldTag::__source_bucket),
6832                            "sourceObject" => Ok(__FieldTag::__source_object),
6833                            "source_object" => Ok(__FieldTag::__source_object),
6834                            "sourceGeneration" => Ok(__FieldTag::__source_generation),
6835                            "source_generation" => Ok(__FieldTag::__source_generation),
6836                            "rewriteToken" => Ok(__FieldTag::__rewrite_token),
6837                            "rewrite_token" => Ok(__FieldTag::__rewrite_token),
6838                            "destinationPredefinedAcl" => {
6839                                Ok(__FieldTag::__destination_predefined_acl)
6840                            }
6841                            "destination_predefined_acl" => {
6842                                Ok(__FieldTag::__destination_predefined_acl)
6843                            }
6844                            "ifGenerationMatch" => Ok(__FieldTag::__if_generation_match),
6845                            "if_generation_match" => Ok(__FieldTag::__if_generation_match),
6846                            "ifGenerationNotMatch" => Ok(__FieldTag::__if_generation_not_match),
6847                            "if_generation_not_match" => Ok(__FieldTag::__if_generation_not_match),
6848                            "ifMetagenerationMatch" => Ok(__FieldTag::__if_metageneration_match),
6849                            "if_metageneration_match" => Ok(__FieldTag::__if_metageneration_match),
6850                            "ifMetagenerationNotMatch" => {
6851                                Ok(__FieldTag::__if_metageneration_not_match)
6852                            }
6853                            "if_metageneration_not_match" => {
6854                                Ok(__FieldTag::__if_metageneration_not_match)
6855                            }
6856                            "ifSourceGenerationMatch" => {
6857                                Ok(__FieldTag::__if_source_generation_match)
6858                            }
6859                            "if_source_generation_match" => {
6860                                Ok(__FieldTag::__if_source_generation_match)
6861                            }
6862                            "ifSourceGenerationNotMatch" => {
6863                                Ok(__FieldTag::__if_source_generation_not_match)
6864                            }
6865                            "if_source_generation_not_match" => {
6866                                Ok(__FieldTag::__if_source_generation_not_match)
6867                            }
6868                            "ifSourceMetagenerationMatch" => {
6869                                Ok(__FieldTag::__if_source_metageneration_match)
6870                            }
6871                            "if_source_metageneration_match" => {
6872                                Ok(__FieldTag::__if_source_metageneration_match)
6873                            }
6874                            "ifSourceMetagenerationNotMatch" => {
6875                                Ok(__FieldTag::__if_source_metageneration_not_match)
6876                            }
6877                            "if_source_metageneration_not_match" => {
6878                                Ok(__FieldTag::__if_source_metageneration_not_match)
6879                            }
6880                            "maxBytesRewrittenPerCall" => {
6881                                Ok(__FieldTag::__max_bytes_rewritten_per_call)
6882                            }
6883                            "max_bytes_rewritten_per_call" => {
6884                                Ok(__FieldTag::__max_bytes_rewritten_per_call)
6885                            }
6886                            "copySourceEncryptionAlgorithm" => {
6887                                Ok(__FieldTag::__copy_source_encryption_algorithm)
6888                            }
6889                            "copy_source_encryption_algorithm" => {
6890                                Ok(__FieldTag::__copy_source_encryption_algorithm)
6891                            }
6892                            "copySourceEncryptionKeyBytes" => {
6893                                Ok(__FieldTag::__copy_source_encryption_key_bytes)
6894                            }
6895                            "copy_source_encryption_key_bytes" => {
6896                                Ok(__FieldTag::__copy_source_encryption_key_bytes)
6897                            }
6898                            "copySourceEncryptionKeySha256Bytes" => {
6899                                Ok(__FieldTag::__copy_source_encryption_key_sha256_bytes)
6900                            }
6901                            "copy_source_encryption_key_sha256_bytes" => {
6902                                Ok(__FieldTag::__copy_source_encryption_key_sha256_bytes)
6903                            }
6904                            "commonObjectRequestParams" => {
6905                                Ok(__FieldTag::__common_object_request_params)
6906                            }
6907                            "common_object_request_params" => {
6908                                Ok(__FieldTag::__common_object_request_params)
6909                            }
6910                            "objectChecksums" => Ok(__FieldTag::__object_checksums),
6911                            "object_checksums" => Ok(__FieldTag::__object_checksums),
6912                            _ => Ok(__FieldTag::Unknown(value.to_string())),
6913                        }
6914                    }
6915                }
6916                deserializer.deserialize_identifier(Visitor)
6917            }
6918        }
6919        struct Visitor;
6920        impl<'de> serde::de::Visitor<'de> for Visitor {
6921            type Value = RewriteObjectRequest;
6922            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
6923                formatter.write_str("struct RewriteObjectRequest")
6924            }
6925            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
6926            where
6927                A: serde::de::MapAccess<'de>,
6928            {
6929                #[allow(unused_imports)]
6930                use serde::de::Error;
6931                use std::option::Option::Some;
6932                let mut fields = std::collections::HashSet::new();
6933                let mut result = Self::Value::new();
6934                while let Some(tag) = map.next_key::<__FieldTag>()? {
6935                    #[allow(clippy::match_single_binding)]
6936                    match tag {
6937                        __FieldTag::__destination_name => {
6938                            if !fields.insert(__FieldTag::__destination_name) {
6939                                return std::result::Result::Err(A::Error::duplicate_field(
6940                                    "multiple values for destination_name",
6941                                ));
6942                            }
6943                            result.destination_name = map
6944                                .next_value::<std::option::Option<std::string::String>>()?
6945                                .unwrap_or_default();
6946                        }
6947                        __FieldTag::__destination_bucket => {
6948                            if !fields.insert(__FieldTag::__destination_bucket) {
6949                                return std::result::Result::Err(A::Error::duplicate_field(
6950                                    "multiple values for destination_bucket",
6951                                ));
6952                            }
6953                            result.destination_bucket = map
6954                                .next_value::<std::option::Option<std::string::String>>()?
6955                                .unwrap_or_default();
6956                        }
6957                        __FieldTag::__destination_kms_key => {
6958                            if !fields.insert(__FieldTag::__destination_kms_key) {
6959                                return std::result::Result::Err(A::Error::duplicate_field(
6960                                    "multiple values for destination_kms_key",
6961                                ));
6962                            }
6963                            result.destination_kms_key = map
6964                                .next_value::<std::option::Option<std::string::String>>()?
6965                                .unwrap_or_default();
6966                        }
6967                        __FieldTag::__destination => {
6968                            if !fields.insert(__FieldTag::__destination) {
6969                                return std::result::Result::Err(A::Error::duplicate_field(
6970                                    "multiple values for destination",
6971                                ));
6972                            }
6973                            result.destination =
6974                                map.next_value::<std::option::Option<crate::model::Object>>()?;
6975                        }
6976                        __FieldTag::__source_bucket => {
6977                            if !fields.insert(__FieldTag::__source_bucket) {
6978                                return std::result::Result::Err(A::Error::duplicate_field(
6979                                    "multiple values for source_bucket",
6980                                ));
6981                            }
6982                            result.source_bucket = map
6983                                .next_value::<std::option::Option<std::string::String>>()?
6984                                .unwrap_or_default();
6985                        }
6986                        __FieldTag::__source_object => {
6987                            if !fields.insert(__FieldTag::__source_object) {
6988                                return std::result::Result::Err(A::Error::duplicate_field(
6989                                    "multiple values for source_object",
6990                                ));
6991                            }
6992                            result.source_object = map
6993                                .next_value::<std::option::Option<std::string::String>>()?
6994                                .unwrap_or_default();
6995                        }
6996                        __FieldTag::__source_generation => {
6997                            if !fields.insert(__FieldTag::__source_generation) {
6998                                return std::result::Result::Err(A::Error::duplicate_field(
6999                                    "multiple values for source_generation",
7000                                ));
7001                            }
7002                            struct __With(std::option::Option<i64>);
7003                            impl<'de> serde::de::Deserialize<'de> for __With {
7004                                fn deserialize<D>(
7005                                    deserializer: D,
7006                                ) -> std::result::Result<Self, D::Error>
7007                                where
7008                                    D: serde::de::Deserializer<'de>,
7009                                {
7010                                    serde_with::As::< std::option::Option<wkt::internal::I64> >::deserialize(deserializer).map(__With)
7011                                }
7012                            }
7013                            result.source_generation =
7014                                map.next_value::<__With>()?.0.unwrap_or_default();
7015                        }
7016                        __FieldTag::__rewrite_token => {
7017                            if !fields.insert(__FieldTag::__rewrite_token) {
7018                                return std::result::Result::Err(A::Error::duplicate_field(
7019                                    "multiple values for rewrite_token",
7020                                ));
7021                            }
7022                            result.rewrite_token = map
7023                                .next_value::<std::option::Option<std::string::String>>()?
7024                                .unwrap_or_default();
7025                        }
7026                        __FieldTag::__destination_predefined_acl => {
7027                            if !fields.insert(__FieldTag::__destination_predefined_acl) {
7028                                return std::result::Result::Err(A::Error::duplicate_field(
7029                                    "multiple values for destination_predefined_acl",
7030                                ));
7031                            }
7032                            result.destination_predefined_acl = map
7033                                .next_value::<std::option::Option<std::string::String>>()?
7034                                .unwrap_or_default();
7035                        }
7036                        __FieldTag::__if_generation_match => {
7037                            if !fields.insert(__FieldTag::__if_generation_match) {
7038                                return std::result::Result::Err(A::Error::duplicate_field(
7039                                    "multiple values for if_generation_match",
7040                                ));
7041                            }
7042                            struct __With(std::option::Option<i64>);
7043                            impl<'de> serde::de::Deserialize<'de> for __With {
7044                                fn deserialize<D>(
7045                                    deserializer: D,
7046                                ) -> std::result::Result<Self, D::Error>
7047                                where
7048                                    D: serde::de::Deserializer<'de>,
7049                                {
7050                                    serde_with::As::< std::option::Option<wkt::internal::I64> >::deserialize(deserializer).map(__With)
7051                                }
7052                            }
7053                            result.if_generation_match = map.next_value::<__With>()?.0;
7054                        }
7055                        __FieldTag::__if_generation_not_match => {
7056                            if !fields.insert(__FieldTag::__if_generation_not_match) {
7057                                return std::result::Result::Err(A::Error::duplicate_field(
7058                                    "multiple values for if_generation_not_match",
7059                                ));
7060                            }
7061                            struct __With(std::option::Option<i64>);
7062                            impl<'de> serde::de::Deserialize<'de> for __With {
7063                                fn deserialize<D>(
7064                                    deserializer: D,
7065                                ) -> std::result::Result<Self, D::Error>
7066                                where
7067                                    D: serde::de::Deserializer<'de>,
7068                                {
7069                                    serde_with::As::< std::option::Option<wkt::internal::I64> >::deserialize(deserializer).map(__With)
7070                                }
7071                            }
7072                            result.if_generation_not_match = map.next_value::<__With>()?.0;
7073                        }
7074                        __FieldTag::__if_metageneration_match => {
7075                            if !fields.insert(__FieldTag::__if_metageneration_match) {
7076                                return std::result::Result::Err(A::Error::duplicate_field(
7077                                    "multiple values for if_metageneration_match",
7078                                ));
7079                            }
7080                            struct __With(std::option::Option<i64>);
7081                            impl<'de> serde::de::Deserialize<'de> for __With {
7082                                fn deserialize<D>(
7083                                    deserializer: D,
7084                                ) -> std::result::Result<Self, D::Error>
7085                                where
7086                                    D: serde::de::Deserializer<'de>,
7087                                {
7088                                    serde_with::As::< std::option::Option<wkt::internal::I64> >::deserialize(deserializer).map(__With)
7089                                }
7090                            }
7091                            result.if_metageneration_match = map.next_value::<__With>()?.0;
7092                        }
7093                        __FieldTag::__if_metageneration_not_match => {
7094                            if !fields.insert(__FieldTag::__if_metageneration_not_match) {
7095                                return std::result::Result::Err(A::Error::duplicate_field(
7096                                    "multiple values for if_metageneration_not_match",
7097                                ));
7098                            }
7099                            struct __With(std::option::Option<i64>);
7100                            impl<'de> serde::de::Deserialize<'de> for __With {
7101                                fn deserialize<D>(
7102                                    deserializer: D,
7103                                ) -> std::result::Result<Self, D::Error>
7104                                where
7105                                    D: serde::de::Deserializer<'de>,
7106                                {
7107                                    serde_with::As::< std::option::Option<wkt::internal::I64> >::deserialize(deserializer).map(__With)
7108                                }
7109                            }
7110                            result.if_metageneration_not_match = map.next_value::<__With>()?.0;
7111                        }
7112                        __FieldTag::__if_source_generation_match => {
7113                            if !fields.insert(__FieldTag::__if_source_generation_match) {
7114                                return std::result::Result::Err(A::Error::duplicate_field(
7115                                    "multiple values for if_source_generation_match",
7116                                ));
7117                            }
7118                            struct __With(std::option::Option<i64>);
7119                            impl<'de> serde::de::Deserialize<'de> for __With {
7120                                fn deserialize<D>(
7121                                    deserializer: D,
7122                                ) -> std::result::Result<Self, D::Error>
7123                                where
7124                                    D: serde::de::Deserializer<'de>,
7125                                {
7126                                    serde_with::As::< std::option::Option<wkt::internal::I64> >::deserialize(deserializer).map(__With)
7127                                }
7128                            }
7129                            result.if_source_generation_match = map.next_value::<__With>()?.0;
7130                        }
7131                        __FieldTag::__if_source_generation_not_match => {
7132                            if !fields.insert(__FieldTag::__if_source_generation_not_match) {
7133                                return std::result::Result::Err(A::Error::duplicate_field(
7134                                    "multiple values for if_source_generation_not_match",
7135                                ));
7136                            }
7137                            struct __With(std::option::Option<i64>);
7138                            impl<'de> serde::de::Deserialize<'de> for __With {
7139                                fn deserialize<D>(
7140                                    deserializer: D,
7141                                ) -> std::result::Result<Self, D::Error>
7142                                where
7143                                    D: serde::de::Deserializer<'de>,
7144                                {
7145                                    serde_with::As::< std::option::Option<wkt::internal::I64> >::deserialize(deserializer).map(__With)
7146                                }
7147                            }
7148                            result.if_source_generation_not_match = map.next_value::<__With>()?.0;
7149                        }
7150                        __FieldTag::__if_source_metageneration_match => {
7151                            if !fields.insert(__FieldTag::__if_source_metageneration_match) {
7152                                return std::result::Result::Err(A::Error::duplicate_field(
7153                                    "multiple values for if_source_metageneration_match",
7154                                ));
7155                            }
7156                            struct __With(std::option::Option<i64>);
7157                            impl<'de> serde::de::Deserialize<'de> for __With {
7158                                fn deserialize<D>(
7159                                    deserializer: D,
7160                                ) -> std::result::Result<Self, D::Error>
7161                                where
7162                                    D: serde::de::Deserializer<'de>,
7163                                {
7164                                    serde_with::As::< std::option::Option<wkt::internal::I64> >::deserialize(deserializer).map(__With)
7165                                }
7166                            }
7167                            result.if_source_metageneration_match = map.next_value::<__With>()?.0;
7168                        }
7169                        __FieldTag::__if_source_metageneration_not_match => {
7170                            if !fields.insert(__FieldTag::__if_source_metageneration_not_match) {
7171                                return std::result::Result::Err(A::Error::duplicate_field(
7172                                    "multiple values for if_source_metageneration_not_match",
7173                                ));
7174                            }
7175                            struct __With(std::option::Option<i64>);
7176                            impl<'de> serde::de::Deserialize<'de> for __With {
7177                                fn deserialize<D>(
7178                                    deserializer: D,
7179                                ) -> std::result::Result<Self, D::Error>
7180                                where
7181                                    D: serde::de::Deserializer<'de>,
7182                                {
7183                                    serde_with::As::< std::option::Option<wkt::internal::I64> >::deserialize(deserializer).map(__With)
7184                                }
7185                            }
7186                            result.if_source_metageneration_not_match =
7187                                map.next_value::<__With>()?.0;
7188                        }
7189                        __FieldTag::__max_bytes_rewritten_per_call => {
7190                            if !fields.insert(__FieldTag::__max_bytes_rewritten_per_call) {
7191                                return std::result::Result::Err(A::Error::duplicate_field(
7192                                    "multiple values for max_bytes_rewritten_per_call",
7193                                ));
7194                            }
7195                            struct __With(std::option::Option<i64>);
7196                            impl<'de> serde::de::Deserialize<'de> for __With {
7197                                fn deserialize<D>(
7198                                    deserializer: D,
7199                                ) -> std::result::Result<Self, D::Error>
7200                                where
7201                                    D: serde::de::Deserializer<'de>,
7202                                {
7203                                    serde_with::As::< std::option::Option<wkt::internal::I64> >::deserialize(deserializer).map(__With)
7204                                }
7205                            }
7206                            result.max_bytes_rewritten_per_call =
7207                                map.next_value::<__With>()?.0.unwrap_or_default();
7208                        }
7209                        __FieldTag::__copy_source_encryption_algorithm => {
7210                            if !fields.insert(__FieldTag::__copy_source_encryption_algorithm) {
7211                                return std::result::Result::Err(A::Error::duplicate_field(
7212                                    "multiple values for copy_source_encryption_algorithm",
7213                                ));
7214                            }
7215                            result.copy_source_encryption_algorithm = map
7216                                .next_value::<std::option::Option<std::string::String>>()?
7217                                .unwrap_or_default();
7218                        }
7219                        __FieldTag::__copy_source_encryption_key_bytes => {
7220                            if !fields.insert(__FieldTag::__copy_source_encryption_key_bytes) {
7221                                return std::result::Result::Err(A::Error::duplicate_field(
7222                                    "multiple values for copy_source_encryption_key_bytes",
7223                                ));
7224                            }
7225                            struct __With(std::option::Option<::bytes::Bytes>);
7226                            impl<'de> serde::de::Deserialize<'de> for __With {
7227                                fn deserialize<D>(
7228                                    deserializer: D,
7229                                ) -> std::result::Result<Self, D::Error>
7230                                where
7231                                    D: serde::de::Deserializer<'de>,
7232                                {
7233                                    serde_with::As::< std::option::Option<serde_with::base64::Base64> >::deserialize(deserializer).map(__With)
7234                                }
7235                            }
7236                            result.copy_source_encryption_key_bytes =
7237                                map.next_value::<__With>()?.0.unwrap_or_default();
7238                        }
7239                        __FieldTag::__copy_source_encryption_key_sha256_bytes => {
7240                            if !fields.insert(__FieldTag::__copy_source_encryption_key_sha256_bytes)
7241                            {
7242                                return std::result::Result::Err(A::Error::duplicate_field(
7243                                    "multiple values for copy_source_encryption_key_sha256_bytes",
7244                                ));
7245                            }
7246                            struct __With(std::option::Option<::bytes::Bytes>);
7247                            impl<'de> serde::de::Deserialize<'de> for __With {
7248                                fn deserialize<D>(
7249                                    deserializer: D,
7250                                ) -> std::result::Result<Self, D::Error>
7251                                where
7252                                    D: serde::de::Deserializer<'de>,
7253                                {
7254                                    serde_with::As::< std::option::Option<serde_with::base64::Base64> >::deserialize(deserializer).map(__With)
7255                                }
7256                            }
7257                            result.copy_source_encryption_key_sha256_bytes =
7258                                map.next_value::<__With>()?.0.unwrap_or_default();
7259                        }
7260                        __FieldTag::__common_object_request_params => {
7261                            if !fields.insert(__FieldTag::__common_object_request_params) {
7262                                return std::result::Result::Err(A::Error::duplicate_field(
7263                                    "multiple values for common_object_request_params",
7264                                ));
7265                            }
7266                            result.common_object_request_params = map.next_value::<std::option::Option<crate::model::CommonObjectRequestParams>>()?
7267                                ;
7268                        }
7269                        __FieldTag::__object_checksums => {
7270                            if !fields.insert(__FieldTag::__object_checksums) {
7271                                return std::result::Result::Err(A::Error::duplicate_field(
7272                                    "multiple values for object_checksums",
7273                                ));
7274                            }
7275                            result.object_checksums = map
7276                                .next_value::<std::option::Option<crate::model::ObjectChecksums>>(
7277                                )?;
7278                        }
7279                        __FieldTag::Unknown(key) => {
7280                            let value = map.next_value::<serde_json::Value>()?;
7281                            result._unknown_fields.insert(key, value);
7282                        }
7283                    }
7284                }
7285                std::result::Result::Ok(result)
7286            }
7287        }
7288        deserializer.deserialize_any(Visitor)
7289    }
7290}
7291
7292#[doc(hidden)]
7293impl serde::ser::Serialize for RewriteObjectRequest {
7294    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
7295    where
7296        S: serde::ser::Serializer,
7297    {
7298        use serde::ser::SerializeMap;
7299        #[allow(unused_imports)]
7300        use std::option::Option::Some;
7301        let mut state = serializer.serialize_map(std::option::Option::None)?;
7302        if !self.destination_name.is_empty() {
7303            state.serialize_entry("destinationName", &self.destination_name)?;
7304        }
7305        if !self.destination_bucket.is_empty() {
7306            state.serialize_entry("destinationBucket", &self.destination_bucket)?;
7307        }
7308        if !self.destination_kms_key.is_empty() {
7309            state.serialize_entry("destinationKmsKey", &self.destination_kms_key)?;
7310        }
7311        if self.destination.is_some() {
7312            state.serialize_entry("destination", &self.destination)?;
7313        }
7314        if !self.source_bucket.is_empty() {
7315            state.serialize_entry("sourceBucket", &self.source_bucket)?;
7316        }
7317        if !self.source_object.is_empty() {
7318            state.serialize_entry("sourceObject", &self.source_object)?;
7319        }
7320        if !wkt::internal::is_default(&self.source_generation) {
7321            struct __With<'a>(&'a i64);
7322            impl<'a> serde::ser::Serialize for __With<'a> {
7323                fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
7324                where
7325                    S: serde::ser::Serializer,
7326                {
7327                    serde_with::As::<wkt::internal::I64>::serialize(self.0, serializer)
7328                }
7329            }
7330            state.serialize_entry("sourceGeneration", &__With(&self.source_generation))?;
7331        }
7332        if !self.rewrite_token.is_empty() {
7333            state.serialize_entry("rewriteToken", &self.rewrite_token)?;
7334        }
7335        if !self.destination_predefined_acl.is_empty() {
7336            state.serialize_entry("destinationPredefinedAcl", &self.destination_predefined_acl)?;
7337        }
7338        if self.if_generation_match.is_some() {
7339            struct __With<'a>(&'a std::option::Option<i64>);
7340            impl<'a> serde::ser::Serialize for __With<'a> {
7341                fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
7342                where
7343                    S: serde::ser::Serializer,
7344                {
7345                    serde_with::As::<std::option::Option<wkt::internal::I64>>::serialize(
7346                        self.0, serializer,
7347                    )
7348                }
7349            }
7350            state.serialize_entry("ifGenerationMatch", &__With(&self.if_generation_match))?;
7351        }
7352        if self.if_generation_not_match.is_some() {
7353            struct __With<'a>(&'a std::option::Option<i64>);
7354            impl<'a> serde::ser::Serialize for __With<'a> {
7355                fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
7356                where
7357                    S: serde::ser::Serializer,
7358                {
7359                    serde_with::As::<std::option::Option<wkt::internal::I64>>::serialize(
7360                        self.0, serializer,
7361                    )
7362                }
7363            }
7364            state.serialize_entry(
7365                "ifGenerationNotMatch",
7366                &__With(&self.if_generation_not_match),
7367            )?;
7368        }
7369        if self.if_metageneration_match.is_some() {
7370            struct __With<'a>(&'a std::option::Option<i64>);
7371            impl<'a> serde::ser::Serialize for __With<'a> {
7372                fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
7373                where
7374                    S: serde::ser::Serializer,
7375                {
7376                    serde_with::As::<std::option::Option<wkt::internal::I64>>::serialize(
7377                        self.0, serializer,
7378                    )
7379                }
7380            }
7381            state.serialize_entry(
7382                "ifMetagenerationMatch",
7383                &__With(&self.if_metageneration_match),
7384            )?;
7385        }
7386        if self.if_metageneration_not_match.is_some() {
7387            struct __With<'a>(&'a std::option::Option<i64>);
7388            impl<'a> serde::ser::Serialize for __With<'a> {
7389                fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
7390                where
7391                    S: serde::ser::Serializer,
7392                {
7393                    serde_with::As::<std::option::Option<wkt::internal::I64>>::serialize(
7394                        self.0, serializer,
7395                    )
7396                }
7397            }
7398            state.serialize_entry(
7399                "ifMetagenerationNotMatch",
7400                &__With(&self.if_metageneration_not_match),
7401            )?;
7402        }
7403        if self.if_source_generation_match.is_some() {
7404            struct __With<'a>(&'a std::option::Option<i64>);
7405            impl<'a> serde::ser::Serialize for __With<'a> {
7406                fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
7407                where
7408                    S: serde::ser::Serializer,
7409                {
7410                    serde_with::As::<std::option::Option<wkt::internal::I64>>::serialize(
7411                        self.0, serializer,
7412                    )
7413                }
7414            }
7415            state.serialize_entry(
7416                "ifSourceGenerationMatch",
7417                &__With(&self.if_source_generation_match),
7418            )?;
7419        }
7420        if self.if_source_generation_not_match.is_some() {
7421            struct __With<'a>(&'a std::option::Option<i64>);
7422            impl<'a> serde::ser::Serialize for __With<'a> {
7423                fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
7424                where
7425                    S: serde::ser::Serializer,
7426                {
7427                    serde_with::As::<std::option::Option<wkt::internal::I64>>::serialize(
7428                        self.0, serializer,
7429                    )
7430                }
7431            }
7432            state.serialize_entry(
7433                "ifSourceGenerationNotMatch",
7434                &__With(&self.if_source_generation_not_match),
7435            )?;
7436        }
7437        if self.if_source_metageneration_match.is_some() {
7438            struct __With<'a>(&'a std::option::Option<i64>);
7439            impl<'a> serde::ser::Serialize for __With<'a> {
7440                fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
7441                where
7442                    S: serde::ser::Serializer,
7443                {
7444                    serde_with::As::<std::option::Option<wkt::internal::I64>>::serialize(
7445                        self.0, serializer,
7446                    )
7447                }
7448            }
7449            state.serialize_entry(
7450                "ifSourceMetagenerationMatch",
7451                &__With(&self.if_source_metageneration_match),
7452            )?;
7453        }
7454        if self.if_source_metageneration_not_match.is_some() {
7455            struct __With<'a>(&'a std::option::Option<i64>);
7456            impl<'a> serde::ser::Serialize for __With<'a> {
7457                fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
7458                where
7459                    S: serde::ser::Serializer,
7460                {
7461                    serde_with::As::<std::option::Option<wkt::internal::I64>>::serialize(
7462                        self.0, serializer,
7463                    )
7464                }
7465            }
7466            state.serialize_entry(
7467                "ifSourceMetagenerationNotMatch",
7468                &__With(&self.if_source_metageneration_not_match),
7469            )?;
7470        }
7471        if !wkt::internal::is_default(&self.max_bytes_rewritten_per_call) {
7472            struct __With<'a>(&'a i64);
7473            impl<'a> serde::ser::Serialize for __With<'a> {
7474                fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
7475                where
7476                    S: serde::ser::Serializer,
7477                {
7478                    serde_with::As::<wkt::internal::I64>::serialize(self.0, serializer)
7479                }
7480            }
7481            state.serialize_entry(
7482                "maxBytesRewrittenPerCall",
7483                &__With(&self.max_bytes_rewritten_per_call),
7484            )?;
7485        }
7486        if !self.copy_source_encryption_algorithm.is_empty() {
7487            state.serialize_entry(
7488                "copySourceEncryptionAlgorithm",
7489                &self.copy_source_encryption_algorithm,
7490            )?;
7491        }
7492        if !self.copy_source_encryption_key_bytes.is_empty() {
7493            struct __With<'a>(&'a ::bytes::Bytes);
7494            impl<'a> serde::ser::Serialize for __With<'a> {
7495                fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
7496                where
7497                    S: serde::ser::Serializer,
7498                {
7499                    serde_with::As::<serde_with::base64::Base64>::serialize(self.0, serializer)
7500                }
7501            }
7502            state.serialize_entry(
7503                "copySourceEncryptionKeyBytes",
7504                &__With(&self.copy_source_encryption_key_bytes),
7505            )?;
7506        }
7507        if !self.copy_source_encryption_key_sha256_bytes.is_empty() {
7508            struct __With<'a>(&'a ::bytes::Bytes);
7509            impl<'a> serde::ser::Serialize for __With<'a> {
7510                fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
7511                where
7512                    S: serde::ser::Serializer,
7513                {
7514                    serde_with::As::<serde_with::base64::Base64>::serialize(self.0, serializer)
7515                }
7516            }
7517            state.serialize_entry(
7518                "copySourceEncryptionKeySha256Bytes",
7519                &__With(&self.copy_source_encryption_key_sha256_bytes),
7520            )?;
7521        }
7522        if self.common_object_request_params.is_some() {
7523            state.serialize_entry(
7524                "commonObjectRequestParams",
7525                &self.common_object_request_params,
7526            )?;
7527        }
7528        if self.object_checksums.is_some() {
7529            state.serialize_entry("objectChecksums", &self.object_checksums)?;
7530        }
7531        if !self._unknown_fields.is_empty() {
7532            for (key, value) in self._unknown_fields.iter() {
7533                state.serialize_entry(key, &value)?;
7534            }
7535        }
7536        state.end()
7537    }
7538}
7539
7540impl std::fmt::Debug for RewriteObjectRequest {
7541    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
7542        let mut debug_struct = f.debug_struct("RewriteObjectRequest");
7543        debug_struct.field("destination_name", &self.destination_name);
7544        debug_struct.field("destination_bucket", &self.destination_bucket);
7545        debug_struct.field("destination_kms_key", &self.destination_kms_key);
7546        debug_struct.field("destination", &self.destination);
7547        debug_struct.field("source_bucket", &self.source_bucket);
7548        debug_struct.field("source_object", &self.source_object);
7549        debug_struct.field("source_generation", &self.source_generation);
7550        debug_struct.field("rewrite_token", &self.rewrite_token);
7551        debug_struct.field(
7552            "destination_predefined_acl",
7553            &self.destination_predefined_acl,
7554        );
7555        debug_struct.field("if_generation_match", &self.if_generation_match);
7556        debug_struct.field("if_generation_not_match", &self.if_generation_not_match);
7557        debug_struct.field("if_metageneration_match", &self.if_metageneration_match);
7558        debug_struct.field(
7559            "if_metageneration_not_match",
7560            &self.if_metageneration_not_match,
7561        );
7562        debug_struct.field(
7563            "if_source_generation_match",
7564            &self.if_source_generation_match,
7565        );
7566        debug_struct.field(
7567            "if_source_generation_not_match",
7568            &self.if_source_generation_not_match,
7569        );
7570        debug_struct.field(
7571            "if_source_metageneration_match",
7572            &self.if_source_metageneration_match,
7573        );
7574        debug_struct.field(
7575            "if_source_metageneration_not_match",
7576            &self.if_source_metageneration_not_match,
7577        );
7578        debug_struct.field(
7579            "max_bytes_rewritten_per_call",
7580            &self.max_bytes_rewritten_per_call,
7581        );
7582        debug_struct.field(
7583            "copy_source_encryption_algorithm",
7584            &self.copy_source_encryption_algorithm,
7585        );
7586        debug_struct.field(
7587            "copy_source_encryption_key_bytes",
7588            &self.copy_source_encryption_key_bytes,
7589        );
7590        debug_struct.field(
7591            "copy_source_encryption_key_sha256_bytes",
7592            &self.copy_source_encryption_key_sha256_bytes,
7593        );
7594        debug_struct.field(
7595            "common_object_request_params",
7596            &self.common_object_request_params,
7597        );
7598        debug_struct.field("object_checksums", &self.object_checksums);
7599        if !self._unknown_fields.is_empty() {
7600            debug_struct.field("_unknown_fields", &self._unknown_fields);
7601        }
7602        debug_struct.finish()
7603    }
7604}
7605
7606/// A rewrite response.
7607#[derive(Clone, Default, PartialEq)]
7608#[non_exhaustive]
7609pub struct RewriteResponse {
7610    /// The total bytes written so far, which can be used to provide a waiting user
7611    /// with a progress indicator. This property is always present in the response.
7612    pub total_bytes_rewritten: i64,
7613
7614    /// The total size of the object being copied in bytes. This property is always
7615    /// present in the response.
7616    pub object_size: i64,
7617
7618    /// `true` if the copy is finished; otherwise, `false` if
7619    /// the copy is in progress. This property is always present in the response.
7620    pub done: bool,
7621
7622    /// A token to use in subsequent requests to continue copying data. This token
7623    /// is present in the response only when there is more data to copy.
7624    pub rewrite_token: std::string::String,
7625
7626    /// A resource containing the metadata for the copied-to object. This property
7627    /// is present in the response only when copying completes.
7628    pub resource: std::option::Option<crate::model::Object>,
7629
7630    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
7631}
7632
7633impl RewriteResponse {
7634    pub fn new() -> Self {
7635        std::default::Default::default()
7636    }
7637
7638    /// Sets the value of [total_bytes_rewritten][crate::model::RewriteResponse::total_bytes_rewritten].
7639    pub fn set_total_bytes_rewritten<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
7640        self.total_bytes_rewritten = v.into();
7641        self
7642    }
7643
7644    /// Sets the value of [object_size][crate::model::RewriteResponse::object_size].
7645    pub fn set_object_size<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
7646        self.object_size = v.into();
7647        self
7648    }
7649
7650    /// Sets the value of [done][crate::model::RewriteResponse::done].
7651    pub fn set_done<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
7652        self.done = v.into();
7653        self
7654    }
7655
7656    /// Sets the value of [rewrite_token][crate::model::RewriteResponse::rewrite_token].
7657    pub fn set_rewrite_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
7658        self.rewrite_token = v.into();
7659        self
7660    }
7661
7662    /// Sets the value of [resource][crate::model::RewriteResponse::resource].
7663    pub fn set_resource<T>(mut self, v: T) -> Self
7664    where
7665        T: std::convert::Into<crate::model::Object>,
7666    {
7667        self.resource = std::option::Option::Some(v.into());
7668        self
7669    }
7670
7671    /// Sets or clears the value of [resource][crate::model::RewriteResponse::resource].
7672    pub fn set_or_clear_resource<T>(mut self, v: std::option::Option<T>) -> Self
7673    where
7674        T: std::convert::Into<crate::model::Object>,
7675    {
7676        self.resource = v.map(|x| x.into());
7677        self
7678    }
7679}
7680
7681impl wkt::message::Message for RewriteResponse {
7682    fn typename() -> &'static str {
7683        "type.googleapis.com/google.storage.v2.RewriteResponse"
7684    }
7685}
7686
7687#[doc(hidden)]
7688impl<'de> serde::de::Deserialize<'de> for RewriteResponse {
7689    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
7690    where
7691        D: serde::Deserializer<'de>,
7692    {
7693        #[allow(non_camel_case_types)]
7694        #[doc(hidden)]
7695        #[derive(PartialEq, Eq, Hash)]
7696        enum __FieldTag {
7697            __total_bytes_rewritten,
7698            __object_size,
7699            __done,
7700            __rewrite_token,
7701            __resource,
7702            Unknown(std::string::String),
7703        }
7704        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
7705            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
7706            where
7707                D: serde::Deserializer<'de>,
7708            {
7709                struct Visitor;
7710                impl<'de> serde::de::Visitor<'de> for Visitor {
7711                    type Value = __FieldTag;
7712                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
7713                        formatter.write_str("a field name for RewriteResponse")
7714                    }
7715                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
7716                    where
7717                        E: serde::de::Error,
7718                    {
7719                        use std::result::Result::Ok;
7720                        use std::string::ToString;
7721                        match value {
7722                            "totalBytesRewritten" => Ok(__FieldTag::__total_bytes_rewritten),
7723                            "total_bytes_rewritten" => Ok(__FieldTag::__total_bytes_rewritten),
7724                            "objectSize" => Ok(__FieldTag::__object_size),
7725                            "object_size" => Ok(__FieldTag::__object_size),
7726                            "done" => Ok(__FieldTag::__done),
7727                            "rewriteToken" => Ok(__FieldTag::__rewrite_token),
7728                            "rewrite_token" => Ok(__FieldTag::__rewrite_token),
7729                            "resource" => Ok(__FieldTag::__resource),
7730                            _ => Ok(__FieldTag::Unknown(value.to_string())),
7731                        }
7732                    }
7733                }
7734                deserializer.deserialize_identifier(Visitor)
7735            }
7736        }
7737        struct Visitor;
7738        impl<'de> serde::de::Visitor<'de> for Visitor {
7739            type Value = RewriteResponse;
7740            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
7741                formatter.write_str("struct RewriteResponse")
7742            }
7743            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
7744            where
7745                A: serde::de::MapAccess<'de>,
7746            {
7747                #[allow(unused_imports)]
7748                use serde::de::Error;
7749                use std::option::Option::Some;
7750                let mut fields = std::collections::HashSet::new();
7751                let mut result = Self::Value::new();
7752                while let Some(tag) = map.next_key::<__FieldTag>()? {
7753                    #[allow(clippy::match_single_binding)]
7754                    match tag {
7755                        __FieldTag::__total_bytes_rewritten => {
7756                            if !fields.insert(__FieldTag::__total_bytes_rewritten) {
7757                                return std::result::Result::Err(A::Error::duplicate_field(
7758                                    "multiple values for total_bytes_rewritten",
7759                                ));
7760                            }
7761                            struct __With(std::option::Option<i64>);
7762                            impl<'de> serde::de::Deserialize<'de> for __With {
7763                                fn deserialize<D>(
7764                                    deserializer: D,
7765                                ) -> std::result::Result<Self, D::Error>
7766                                where
7767                                    D: serde::de::Deserializer<'de>,
7768                                {
7769                                    serde_with::As::< std::option::Option<wkt::internal::I64> >::deserialize(deserializer).map(__With)
7770                                }
7771                            }
7772                            result.total_bytes_rewritten =
7773                                map.next_value::<__With>()?.0.unwrap_or_default();
7774                        }
7775                        __FieldTag::__object_size => {
7776                            if !fields.insert(__FieldTag::__object_size) {
7777                                return std::result::Result::Err(A::Error::duplicate_field(
7778                                    "multiple values for object_size",
7779                                ));
7780                            }
7781                            struct __With(std::option::Option<i64>);
7782                            impl<'de> serde::de::Deserialize<'de> for __With {
7783                                fn deserialize<D>(
7784                                    deserializer: D,
7785                                ) -> std::result::Result<Self, D::Error>
7786                                where
7787                                    D: serde::de::Deserializer<'de>,
7788                                {
7789                                    serde_with::As::< std::option::Option<wkt::internal::I64> >::deserialize(deserializer).map(__With)
7790                                }
7791                            }
7792                            result.object_size = map.next_value::<__With>()?.0.unwrap_or_default();
7793                        }
7794                        __FieldTag::__done => {
7795                            if !fields.insert(__FieldTag::__done) {
7796                                return std::result::Result::Err(A::Error::duplicate_field(
7797                                    "multiple values for done",
7798                                ));
7799                            }
7800                            result.done = map
7801                                .next_value::<std::option::Option<bool>>()?
7802                                .unwrap_or_default();
7803                        }
7804                        __FieldTag::__rewrite_token => {
7805                            if !fields.insert(__FieldTag::__rewrite_token) {
7806                                return std::result::Result::Err(A::Error::duplicate_field(
7807                                    "multiple values for rewrite_token",
7808                                ));
7809                            }
7810                            result.rewrite_token = map
7811                                .next_value::<std::option::Option<std::string::String>>()?
7812                                .unwrap_or_default();
7813                        }
7814                        __FieldTag::__resource => {
7815                            if !fields.insert(__FieldTag::__resource) {
7816                                return std::result::Result::Err(A::Error::duplicate_field(
7817                                    "multiple values for resource",
7818                                ));
7819                            }
7820                            result.resource =
7821                                map.next_value::<std::option::Option<crate::model::Object>>()?;
7822                        }
7823                        __FieldTag::Unknown(key) => {
7824                            let value = map.next_value::<serde_json::Value>()?;
7825                            result._unknown_fields.insert(key, value);
7826                        }
7827                    }
7828                }
7829                std::result::Result::Ok(result)
7830            }
7831        }
7832        deserializer.deserialize_any(Visitor)
7833    }
7834}
7835
7836#[doc(hidden)]
7837impl serde::ser::Serialize for RewriteResponse {
7838    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
7839    where
7840        S: serde::ser::Serializer,
7841    {
7842        use serde::ser::SerializeMap;
7843        #[allow(unused_imports)]
7844        use std::option::Option::Some;
7845        let mut state = serializer.serialize_map(std::option::Option::None)?;
7846        if !wkt::internal::is_default(&self.total_bytes_rewritten) {
7847            struct __With<'a>(&'a i64);
7848            impl<'a> serde::ser::Serialize for __With<'a> {
7849                fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
7850                where
7851                    S: serde::ser::Serializer,
7852                {
7853                    serde_with::As::<wkt::internal::I64>::serialize(self.0, serializer)
7854                }
7855            }
7856            state.serialize_entry("totalBytesRewritten", &__With(&self.total_bytes_rewritten))?;
7857        }
7858        if !wkt::internal::is_default(&self.object_size) {
7859            struct __With<'a>(&'a i64);
7860            impl<'a> serde::ser::Serialize for __With<'a> {
7861                fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
7862                where
7863                    S: serde::ser::Serializer,
7864                {
7865                    serde_with::As::<wkt::internal::I64>::serialize(self.0, serializer)
7866                }
7867            }
7868            state.serialize_entry("objectSize", &__With(&self.object_size))?;
7869        }
7870        if !wkt::internal::is_default(&self.done) {
7871            state.serialize_entry("done", &self.done)?;
7872        }
7873        if !self.rewrite_token.is_empty() {
7874            state.serialize_entry("rewriteToken", &self.rewrite_token)?;
7875        }
7876        if self.resource.is_some() {
7877            state.serialize_entry("resource", &self.resource)?;
7878        }
7879        if !self._unknown_fields.is_empty() {
7880            for (key, value) in self._unknown_fields.iter() {
7881                state.serialize_entry(key, &value)?;
7882            }
7883        }
7884        state.end()
7885    }
7886}
7887
7888impl std::fmt::Debug for RewriteResponse {
7889    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
7890        let mut debug_struct = f.debug_struct("RewriteResponse");
7891        debug_struct.field("total_bytes_rewritten", &self.total_bytes_rewritten);
7892        debug_struct.field("object_size", &self.object_size);
7893        debug_struct.field("done", &self.done);
7894        debug_struct.field("rewrite_token", &self.rewrite_token);
7895        debug_struct.field("resource", &self.resource);
7896        if !self._unknown_fields.is_empty() {
7897            debug_struct.field("_unknown_fields", &self._unknown_fields);
7898        }
7899        debug_struct.finish()
7900    }
7901}
7902
7903/// Request message for MoveObject.
7904#[derive(Clone, Default, PartialEq)]
7905#[non_exhaustive]
7906pub struct MoveObjectRequest {
7907    /// Required. Name of the bucket in which the object resides.
7908    pub bucket: std::string::String,
7909
7910    /// Required. Name of the source object.
7911    pub source_object: std::string::String,
7912
7913    /// Required. Name of the destination object.
7914    pub destination_object: std::string::String,
7915
7916    /// Optional. Makes the operation conditional on whether the source object's
7917    /// current generation matches the given value. `if_source_generation_match`
7918    /// and `if_source_generation_not_match` conditions are mutually exclusive:
7919    /// it's an error for both of them to be set in the request.
7920    pub if_source_generation_match: std::option::Option<i64>,
7921
7922    /// Optional. Makes the operation conditional on whether the source object's
7923    /// current generation does not match the given value.
7924    /// `if_source_generation_match` and `if_source_generation_not_match`
7925    /// conditions are mutually exclusive: it's an error for both of them to be set
7926    /// in the request.
7927    pub if_source_generation_not_match: std::option::Option<i64>,
7928
7929    /// Optional. Makes the operation conditional on whether the source object's
7930    /// current metageneration matches the given value.
7931    /// `if_source_metageneration_match` and `if_source_metageneration_not_match`
7932    /// conditions are mutually exclusive: it's an error for both of them to be set
7933    /// in the request.
7934    pub if_source_metageneration_match: std::option::Option<i64>,
7935
7936    /// Optional. Makes the operation conditional on whether the source object's
7937    /// current metageneration does not match the given value.
7938    /// `if_source_metageneration_match` and `if_source_metageneration_not_match`
7939    /// conditions are mutually exclusive: it's an error for both of them to be set
7940    /// in the request.
7941    pub if_source_metageneration_not_match: std::option::Option<i64>,
7942
7943    /// Optional. Makes the operation conditional on whether the destination
7944    /// object's current generation matches the given value. Setting to 0 makes the
7945    /// operation succeed only if there are no live versions of the object.
7946    /// `if_generation_match` and `if_generation_not_match` conditions are mutually
7947    /// exclusive: it's an error for both of them to be set in the request.
7948    pub if_generation_match: std::option::Option<i64>,
7949
7950    /// Optional. Makes the operation conditional on whether the destination
7951    /// object's current generation does not match the given value. If no live
7952    /// object exists, the precondition fails. Setting to 0 makes the operation
7953    /// succeed only if there is a live version of the object.
7954    /// `if_generation_match` and `if_generation_not_match` conditions are mutually
7955    /// exclusive: it's an error for both of them to be set in the request.
7956    pub if_generation_not_match: std::option::Option<i64>,
7957
7958    /// Optional. Makes the operation conditional on whether the destination
7959    /// object's current metageneration matches the given value.
7960    /// `if_metageneration_match` and `if_metageneration_not_match` conditions are
7961    /// mutually exclusive: it's an error for both of them to be set in the
7962    /// request.
7963    pub if_metageneration_match: std::option::Option<i64>,
7964
7965    /// Optional. Makes the operation conditional on whether the destination
7966    /// object's current metageneration does not match the given value.
7967    /// `if_metageneration_match` and `if_metageneration_not_match` conditions are
7968    /// mutually exclusive: it's an error for both of them to be set in the
7969    /// request.
7970    pub if_metageneration_not_match: std::option::Option<i64>,
7971
7972    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
7973}
7974
7975impl MoveObjectRequest {
7976    pub fn new() -> Self {
7977        std::default::Default::default()
7978    }
7979
7980    /// Sets the value of [bucket][crate::model::MoveObjectRequest::bucket].
7981    pub fn set_bucket<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
7982        self.bucket = v.into();
7983        self
7984    }
7985
7986    /// Sets the value of [source_object][crate::model::MoveObjectRequest::source_object].
7987    pub fn set_source_object<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
7988        self.source_object = v.into();
7989        self
7990    }
7991
7992    /// Sets the value of [destination_object][crate::model::MoveObjectRequest::destination_object].
7993    pub fn set_destination_object<T: std::convert::Into<std::string::String>>(
7994        mut self,
7995        v: T,
7996    ) -> Self {
7997        self.destination_object = v.into();
7998        self
7999    }
8000
8001    /// Sets the value of [if_source_generation_match][crate::model::MoveObjectRequest::if_source_generation_match].
8002    pub fn set_if_source_generation_match<T>(mut self, v: T) -> Self
8003    where
8004        T: std::convert::Into<i64>,
8005    {
8006        self.if_source_generation_match = std::option::Option::Some(v.into());
8007        self
8008    }
8009
8010    /// Sets or clears the value of [if_source_generation_match][crate::model::MoveObjectRequest::if_source_generation_match].
8011    pub fn set_or_clear_if_source_generation_match<T>(mut self, v: std::option::Option<T>) -> Self
8012    where
8013        T: std::convert::Into<i64>,
8014    {
8015        self.if_source_generation_match = v.map(|x| x.into());
8016        self
8017    }
8018
8019    /// Sets the value of [if_source_generation_not_match][crate::model::MoveObjectRequest::if_source_generation_not_match].
8020    pub fn set_if_source_generation_not_match<T>(mut self, v: T) -> Self
8021    where
8022        T: std::convert::Into<i64>,
8023    {
8024        self.if_source_generation_not_match = std::option::Option::Some(v.into());
8025        self
8026    }
8027
8028    /// Sets or clears the value of [if_source_generation_not_match][crate::model::MoveObjectRequest::if_source_generation_not_match].
8029    pub fn set_or_clear_if_source_generation_not_match<T>(
8030        mut self,
8031        v: std::option::Option<T>,
8032    ) -> Self
8033    where
8034        T: std::convert::Into<i64>,
8035    {
8036        self.if_source_generation_not_match = v.map(|x| x.into());
8037        self
8038    }
8039
8040    /// Sets the value of [if_source_metageneration_match][crate::model::MoveObjectRequest::if_source_metageneration_match].
8041    pub fn set_if_source_metageneration_match<T>(mut self, v: T) -> Self
8042    where
8043        T: std::convert::Into<i64>,
8044    {
8045        self.if_source_metageneration_match = std::option::Option::Some(v.into());
8046        self
8047    }
8048
8049    /// Sets or clears the value of [if_source_metageneration_match][crate::model::MoveObjectRequest::if_source_metageneration_match].
8050    pub fn set_or_clear_if_source_metageneration_match<T>(
8051        mut self,
8052        v: std::option::Option<T>,
8053    ) -> Self
8054    where
8055        T: std::convert::Into<i64>,
8056    {
8057        self.if_source_metageneration_match = v.map(|x| x.into());
8058        self
8059    }
8060
8061    /// Sets the value of [if_source_metageneration_not_match][crate::model::MoveObjectRequest::if_source_metageneration_not_match].
8062    pub fn set_if_source_metageneration_not_match<T>(mut self, v: T) -> Self
8063    where
8064        T: std::convert::Into<i64>,
8065    {
8066        self.if_source_metageneration_not_match = std::option::Option::Some(v.into());
8067        self
8068    }
8069
8070    /// Sets or clears the value of [if_source_metageneration_not_match][crate::model::MoveObjectRequest::if_source_metageneration_not_match].
8071    pub fn set_or_clear_if_source_metageneration_not_match<T>(
8072        mut self,
8073        v: std::option::Option<T>,
8074    ) -> Self
8075    where
8076        T: std::convert::Into<i64>,
8077    {
8078        self.if_source_metageneration_not_match = v.map(|x| x.into());
8079        self
8080    }
8081
8082    /// Sets the value of [if_generation_match][crate::model::MoveObjectRequest::if_generation_match].
8083    pub fn set_if_generation_match<T>(mut self, v: T) -> Self
8084    where
8085        T: std::convert::Into<i64>,
8086    {
8087        self.if_generation_match = std::option::Option::Some(v.into());
8088        self
8089    }
8090
8091    /// Sets or clears the value of [if_generation_match][crate::model::MoveObjectRequest::if_generation_match].
8092    pub fn set_or_clear_if_generation_match<T>(mut self, v: std::option::Option<T>) -> Self
8093    where
8094        T: std::convert::Into<i64>,
8095    {
8096        self.if_generation_match = v.map(|x| x.into());
8097        self
8098    }
8099
8100    /// Sets the value of [if_generation_not_match][crate::model::MoveObjectRequest::if_generation_not_match].
8101    pub fn set_if_generation_not_match<T>(mut self, v: T) -> Self
8102    where
8103        T: std::convert::Into<i64>,
8104    {
8105        self.if_generation_not_match = std::option::Option::Some(v.into());
8106        self
8107    }
8108
8109    /// Sets or clears the value of [if_generation_not_match][crate::model::MoveObjectRequest::if_generation_not_match].
8110    pub fn set_or_clear_if_generation_not_match<T>(mut self, v: std::option::Option<T>) -> Self
8111    where
8112        T: std::convert::Into<i64>,
8113    {
8114        self.if_generation_not_match = v.map(|x| x.into());
8115        self
8116    }
8117
8118    /// Sets the value of [if_metageneration_match][crate::model::MoveObjectRequest::if_metageneration_match].
8119    pub fn set_if_metageneration_match<T>(mut self, v: T) -> Self
8120    where
8121        T: std::convert::Into<i64>,
8122    {
8123        self.if_metageneration_match = std::option::Option::Some(v.into());
8124        self
8125    }
8126
8127    /// Sets or clears the value of [if_metageneration_match][crate::model::MoveObjectRequest::if_metageneration_match].
8128    pub fn set_or_clear_if_metageneration_match<T>(mut self, v: std::option::Option<T>) -> Self
8129    where
8130        T: std::convert::Into<i64>,
8131    {
8132        self.if_metageneration_match = v.map(|x| x.into());
8133        self
8134    }
8135
8136    /// Sets the value of [if_metageneration_not_match][crate::model::MoveObjectRequest::if_metageneration_not_match].
8137    pub fn set_if_metageneration_not_match<T>(mut self, v: T) -> Self
8138    where
8139        T: std::convert::Into<i64>,
8140    {
8141        self.if_metageneration_not_match = std::option::Option::Some(v.into());
8142        self
8143    }
8144
8145    /// Sets or clears the value of [if_metageneration_not_match][crate::model::MoveObjectRequest::if_metageneration_not_match].
8146    pub fn set_or_clear_if_metageneration_not_match<T>(mut self, v: std::option::Option<T>) -> Self
8147    where
8148        T: std::convert::Into<i64>,
8149    {
8150        self.if_metageneration_not_match = v.map(|x| x.into());
8151        self
8152    }
8153}
8154
8155impl wkt::message::Message for MoveObjectRequest {
8156    fn typename() -> &'static str {
8157        "type.googleapis.com/google.storage.v2.MoveObjectRequest"
8158    }
8159}
8160
8161#[doc(hidden)]
8162impl<'de> serde::de::Deserialize<'de> for MoveObjectRequest {
8163    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
8164    where
8165        D: serde::Deserializer<'de>,
8166    {
8167        #[allow(non_camel_case_types)]
8168        #[doc(hidden)]
8169        #[derive(PartialEq, Eq, Hash)]
8170        enum __FieldTag {
8171            __bucket,
8172            __source_object,
8173            __destination_object,
8174            __if_source_generation_match,
8175            __if_source_generation_not_match,
8176            __if_source_metageneration_match,
8177            __if_source_metageneration_not_match,
8178            __if_generation_match,
8179            __if_generation_not_match,
8180            __if_metageneration_match,
8181            __if_metageneration_not_match,
8182            Unknown(std::string::String),
8183        }
8184        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
8185            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
8186            where
8187                D: serde::Deserializer<'de>,
8188            {
8189                struct Visitor;
8190                impl<'de> serde::de::Visitor<'de> for Visitor {
8191                    type Value = __FieldTag;
8192                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
8193                        formatter.write_str("a field name for MoveObjectRequest")
8194                    }
8195                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
8196                    where
8197                        E: serde::de::Error,
8198                    {
8199                        use std::result::Result::Ok;
8200                        use std::string::ToString;
8201                        match value {
8202                            "bucket" => Ok(__FieldTag::__bucket),
8203                            "sourceObject" => Ok(__FieldTag::__source_object),
8204                            "source_object" => Ok(__FieldTag::__source_object),
8205                            "destinationObject" => Ok(__FieldTag::__destination_object),
8206                            "destination_object" => Ok(__FieldTag::__destination_object),
8207                            "ifSourceGenerationMatch" => {
8208                                Ok(__FieldTag::__if_source_generation_match)
8209                            }
8210                            "if_source_generation_match" => {
8211                                Ok(__FieldTag::__if_source_generation_match)
8212                            }
8213                            "ifSourceGenerationNotMatch" => {
8214                                Ok(__FieldTag::__if_source_generation_not_match)
8215                            }
8216                            "if_source_generation_not_match" => {
8217                                Ok(__FieldTag::__if_source_generation_not_match)
8218                            }
8219                            "ifSourceMetagenerationMatch" => {
8220                                Ok(__FieldTag::__if_source_metageneration_match)
8221                            }
8222                            "if_source_metageneration_match" => {
8223                                Ok(__FieldTag::__if_source_metageneration_match)
8224                            }
8225                            "ifSourceMetagenerationNotMatch" => {
8226                                Ok(__FieldTag::__if_source_metageneration_not_match)
8227                            }
8228                            "if_source_metageneration_not_match" => {
8229                                Ok(__FieldTag::__if_source_metageneration_not_match)
8230                            }
8231                            "ifGenerationMatch" => Ok(__FieldTag::__if_generation_match),
8232                            "if_generation_match" => Ok(__FieldTag::__if_generation_match),
8233                            "ifGenerationNotMatch" => Ok(__FieldTag::__if_generation_not_match),
8234                            "if_generation_not_match" => Ok(__FieldTag::__if_generation_not_match),
8235                            "ifMetagenerationMatch" => Ok(__FieldTag::__if_metageneration_match),
8236                            "if_metageneration_match" => Ok(__FieldTag::__if_metageneration_match),
8237                            "ifMetagenerationNotMatch" => {
8238                                Ok(__FieldTag::__if_metageneration_not_match)
8239                            }
8240                            "if_metageneration_not_match" => {
8241                                Ok(__FieldTag::__if_metageneration_not_match)
8242                            }
8243                            _ => Ok(__FieldTag::Unknown(value.to_string())),
8244                        }
8245                    }
8246                }
8247                deserializer.deserialize_identifier(Visitor)
8248            }
8249        }
8250        struct Visitor;
8251        impl<'de> serde::de::Visitor<'de> for Visitor {
8252            type Value = MoveObjectRequest;
8253            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
8254                formatter.write_str("struct MoveObjectRequest")
8255            }
8256            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
8257            where
8258                A: serde::de::MapAccess<'de>,
8259            {
8260                #[allow(unused_imports)]
8261                use serde::de::Error;
8262                use std::option::Option::Some;
8263                let mut fields = std::collections::HashSet::new();
8264                let mut result = Self::Value::new();
8265                while let Some(tag) = map.next_key::<__FieldTag>()? {
8266                    #[allow(clippy::match_single_binding)]
8267                    match tag {
8268                        __FieldTag::__bucket => {
8269                            if !fields.insert(__FieldTag::__bucket) {
8270                                return std::result::Result::Err(A::Error::duplicate_field(
8271                                    "multiple values for bucket",
8272                                ));
8273                            }
8274                            result.bucket = map
8275                                .next_value::<std::option::Option<std::string::String>>()?
8276                                .unwrap_or_default();
8277                        }
8278                        __FieldTag::__source_object => {
8279                            if !fields.insert(__FieldTag::__source_object) {
8280                                return std::result::Result::Err(A::Error::duplicate_field(
8281                                    "multiple values for source_object",
8282                                ));
8283                            }
8284                            result.source_object = map
8285                                .next_value::<std::option::Option<std::string::String>>()?
8286                                .unwrap_or_default();
8287                        }
8288                        __FieldTag::__destination_object => {
8289                            if !fields.insert(__FieldTag::__destination_object) {
8290                                return std::result::Result::Err(A::Error::duplicate_field(
8291                                    "multiple values for destination_object",
8292                                ));
8293                            }
8294                            result.destination_object = map
8295                                .next_value::<std::option::Option<std::string::String>>()?
8296                                .unwrap_or_default();
8297                        }
8298                        __FieldTag::__if_source_generation_match => {
8299                            if !fields.insert(__FieldTag::__if_source_generation_match) {
8300                                return std::result::Result::Err(A::Error::duplicate_field(
8301                                    "multiple values for if_source_generation_match",
8302                                ));
8303                            }
8304                            struct __With(std::option::Option<i64>);
8305                            impl<'de> serde::de::Deserialize<'de> for __With {
8306                                fn deserialize<D>(
8307                                    deserializer: D,
8308                                ) -> std::result::Result<Self, D::Error>
8309                                where
8310                                    D: serde::de::Deserializer<'de>,
8311                                {
8312                                    serde_with::As::< std::option::Option<wkt::internal::I64> >::deserialize(deserializer).map(__With)
8313                                }
8314                            }
8315                            result.if_source_generation_match = map.next_value::<__With>()?.0;
8316                        }
8317                        __FieldTag::__if_source_generation_not_match => {
8318                            if !fields.insert(__FieldTag::__if_source_generation_not_match) {
8319                                return std::result::Result::Err(A::Error::duplicate_field(
8320                                    "multiple values for if_source_generation_not_match",
8321                                ));
8322                            }
8323                            struct __With(std::option::Option<i64>);
8324                            impl<'de> serde::de::Deserialize<'de> for __With {
8325                                fn deserialize<D>(
8326                                    deserializer: D,
8327                                ) -> std::result::Result<Self, D::Error>
8328                                where
8329                                    D: serde::de::Deserializer<'de>,
8330                                {
8331                                    serde_with::As::< std::option::Option<wkt::internal::I64> >::deserialize(deserializer).map(__With)
8332                                }
8333                            }
8334                            result.if_source_generation_not_match = map.next_value::<__With>()?.0;
8335                        }
8336                        __FieldTag::__if_source_metageneration_match => {
8337                            if !fields.insert(__FieldTag::__if_source_metageneration_match) {
8338                                return std::result::Result::Err(A::Error::duplicate_field(
8339                                    "multiple values for if_source_metageneration_match",
8340                                ));
8341                            }
8342                            struct __With(std::option::Option<i64>);
8343                            impl<'de> serde::de::Deserialize<'de> for __With {
8344                                fn deserialize<D>(
8345                                    deserializer: D,
8346                                ) -> std::result::Result<Self, D::Error>
8347                                where
8348                                    D: serde::de::Deserializer<'de>,
8349                                {
8350                                    serde_with::As::< std::option::Option<wkt::internal::I64> >::deserialize(deserializer).map(__With)
8351                                }
8352                            }
8353                            result.if_source_metageneration_match = map.next_value::<__With>()?.0;
8354                        }
8355                        __FieldTag::__if_source_metageneration_not_match => {
8356                            if !fields.insert(__FieldTag::__if_source_metageneration_not_match) {
8357                                return std::result::Result::Err(A::Error::duplicate_field(
8358                                    "multiple values for if_source_metageneration_not_match",
8359                                ));
8360                            }
8361                            struct __With(std::option::Option<i64>);
8362                            impl<'de> serde::de::Deserialize<'de> for __With {
8363                                fn deserialize<D>(
8364                                    deserializer: D,
8365                                ) -> std::result::Result<Self, D::Error>
8366                                where
8367                                    D: serde::de::Deserializer<'de>,
8368                                {
8369                                    serde_with::As::< std::option::Option<wkt::internal::I64> >::deserialize(deserializer).map(__With)
8370                                }
8371                            }
8372                            result.if_source_metageneration_not_match =
8373                                map.next_value::<__With>()?.0;
8374                        }
8375                        __FieldTag::__if_generation_match => {
8376                            if !fields.insert(__FieldTag::__if_generation_match) {
8377                                return std::result::Result::Err(A::Error::duplicate_field(
8378                                    "multiple values for if_generation_match",
8379                                ));
8380                            }
8381                            struct __With(std::option::Option<i64>);
8382                            impl<'de> serde::de::Deserialize<'de> for __With {
8383                                fn deserialize<D>(
8384                                    deserializer: D,
8385                                ) -> std::result::Result<Self, D::Error>
8386                                where
8387                                    D: serde::de::Deserializer<'de>,
8388                                {
8389                                    serde_with::As::< std::option::Option<wkt::internal::I64> >::deserialize(deserializer).map(__With)
8390                                }
8391                            }
8392                            result.if_generation_match = map.next_value::<__With>()?.0;
8393                        }
8394                        __FieldTag::__if_generation_not_match => {
8395                            if !fields.insert(__FieldTag::__if_generation_not_match) {
8396                                return std::result::Result::Err(A::Error::duplicate_field(
8397                                    "multiple values for if_generation_not_match",
8398                                ));
8399                            }
8400                            struct __With(std::option::Option<i64>);
8401                            impl<'de> serde::de::Deserialize<'de> for __With {
8402                                fn deserialize<D>(
8403                                    deserializer: D,
8404                                ) -> std::result::Result<Self, D::Error>
8405                                where
8406                                    D: serde::de::Deserializer<'de>,
8407                                {
8408                                    serde_with::As::< std::option::Option<wkt::internal::I64> >::deserialize(deserializer).map(__With)
8409                                }
8410                            }
8411                            result.if_generation_not_match = map.next_value::<__With>()?.0;
8412                        }
8413                        __FieldTag::__if_metageneration_match => {
8414                            if !fields.insert(__FieldTag::__if_metageneration_match) {
8415                                return std::result::Result::Err(A::Error::duplicate_field(
8416                                    "multiple values for if_metageneration_match",
8417                                ));
8418                            }
8419                            struct __With(std::option::Option<i64>);
8420                            impl<'de> serde::de::Deserialize<'de> for __With {
8421                                fn deserialize<D>(
8422                                    deserializer: D,
8423                                ) -> std::result::Result<Self, D::Error>
8424                                where
8425                                    D: serde::de::Deserializer<'de>,
8426                                {
8427                                    serde_with::As::< std::option::Option<wkt::internal::I64> >::deserialize(deserializer).map(__With)
8428                                }
8429                            }
8430                            result.if_metageneration_match = map.next_value::<__With>()?.0;
8431                        }
8432                        __FieldTag::__if_metageneration_not_match => {
8433                            if !fields.insert(__FieldTag::__if_metageneration_not_match) {
8434                                return std::result::Result::Err(A::Error::duplicate_field(
8435                                    "multiple values for if_metageneration_not_match",
8436                                ));
8437                            }
8438                            struct __With(std::option::Option<i64>);
8439                            impl<'de> serde::de::Deserialize<'de> for __With {
8440                                fn deserialize<D>(
8441                                    deserializer: D,
8442                                ) -> std::result::Result<Self, D::Error>
8443                                where
8444                                    D: serde::de::Deserializer<'de>,
8445                                {
8446                                    serde_with::As::< std::option::Option<wkt::internal::I64> >::deserialize(deserializer).map(__With)
8447                                }
8448                            }
8449                            result.if_metageneration_not_match = map.next_value::<__With>()?.0;
8450                        }
8451                        __FieldTag::Unknown(key) => {
8452                            let value = map.next_value::<serde_json::Value>()?;
8453                            result._unknown_fields.insert(key, value);
8454                        }
8455                    }
8456                }
8457                std::result::Result::Ok(result)
8458            }
8459        }
8460        deserializer.deserialize_any(Visitor)
8461    }
8462}
8463
8464#[doc(hidden)]
8465impl serde::ser::Serialize for MoveObjectRequest {
8466    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
8467    where
8468        S: serde::ser::Serializer,
8469    {
8470        use serde::ser::SerializeMap;
8471        #[allow(unused_imports)]
8472        use std::option::Option::Some;
8473        let mut state = serializer.serialize_map(std::option::Option::None)?;
8474        if !self.bucket.is_empty() {
8475            state.serialize_entry("bucket", &self.bucket)?;
8476        }
8477        if !self.source_object.is_empty() {
8478            state.serialize_entry("sourceObject", &self.source_object)?;
8479        }
8480        if !self.destination_object.is_empty() {
8481            state.serialize_entry("destinationObject", &self.destination_object)?;
8482        }
8483        if self.if_source_generation_match.is_some() {
8484            struct __With<'a>(&'a std::option::Option<i64>);
8485            impl<'a> serde::ser::Serialize for __With<'a> {
8486                fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
8487                where
8488                    S: serde::ser::Serializer,
8489                {
8490                    serde_with::As::<std::option::Option<wkt::internal::I64>>::serialize(
8491                        self.0, serializer,
8492                    )
8493                }
8494            }
8495            state.serialize_entry(
8496                "ifSourceGenerationMatch",
8497                &__With(&self.if_source_generation_match),
8498            )?;
8499        }
8500        if self.if_source_generation_not_match.is_some() {
8501            struct __With<'a>(&'a std::option::Option<i64>);
8502            impl<'a> serde::ser::Serialize for __With<'a> {
8503                fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
8504                where
8505                    S: serde::ser::Serializer,
8506                {
8507                    serde_with::As::<std::option::Option<wkt::internal::I64>>::serialize(
8508                        self.0, serializer,
8509                    )
8510                }
8511            }
8512            state.serialize_entry(
8513                "ifSourceGenerationNotMatch",
8514                &__With(&self.if_source_generation_not_match),
8515            )?;
8516        }
8517        if self.if_source_metageneration_match.is_some() {
8518            struct __With<'a>(&'a std::option::Option<i64>);
8519            impl<'a> serde::ser::Serialize for __With<'a> {
8520                fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
8521                where
8522                    S: serde::ser::Serializer,
8523                {
8524                    serde_with::As::<std::option::Option<wkt::internal::I64>>::serialize(
8525                        self.0, serializer,
8526                    )
8527                }
8528            }
8529            state.serialize_entry(
8530                "ifSourceMetagenerationMatch",
8531                &__With(&self.if_source_metageneration_match),
8532            )?;
8533        }
8534        if self.if_source_metageneration_not_match.is_some() {
8535            struct __With<'a>(&'a std::option::Option<i64>);
8536            impl<'a> serde::ser::Serialize for __With<'a> {
8537                fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
8538                where
8539                    S: serde::ser::Serializer,
8540                {
8541                    serde_with::As::<std::option::Option<wkt::internal::I64>>::serialize(
8542                        self.0, serializer,
8543                    )
8544                }
8545            }
8546            state.serialize_entry(
8547                "ifSourceMetagenerationNotMatch",
8548                &__With(&self.if_source_metageneration_not_match),
8549            )?;
8550        }
8551        if self.if_generation_match.is_some() {
8552            struct __With<'a>(&'a std::option::Option<i64>);
8553            impl<'a> serde::ser::Serialize for __With<'a> {
8554                fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
8555                where
8556                    S: serde::ser::Serializer,
8557                {
8558                    serde_with::As::<std::option::Option<wkt::internal::I64>>::serialize(
8559                        self.0, serializer,
8560                    )
8561                }
8562            }
8563            state.serialize_entry("ifGenerationMatch", &__With(&self.if_generation_match))?;
8564        }
8565        if self.if_generation_not_match.is_some() {
8566            struct __With<'a>(&'a std::option::Option<i64>);
8567            impl<'a> serde::ser::Serialize for __With<'a> {
8568                fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
8569                where
8570                    S: serde::ser::Serializer,
8571                {
8572                    serde_with::As::<std::option::Option<wkt::internal::I64>>::serialize(
8573                        self.0, serializer,
8574                    )
8575                }
8576            }
8577            state.serialize_entry(
8578                "ifGenerationNotMatch",
8579                &__With(&self.if_generation_not_match),
8580            )?;
8581        }
8582        if self.if_metageneration_match.is_some() {
8583            struct __With<'a>(&'a std::option::Option<i64>);
8584            impl<'a> serde::ser::Serialize for __With<'a> {
8585                fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
8586                where
8587                    S: serde::ser::Serializer,
8588                {
8589                    serde_with::As::<std::option::Option<wkt::internal::I64>>::serialize(
8590                        self.0, serializer,
8591                    )
8592                }
8593            }
8594            state.serialize_entry(
8595                "ifMetagenerationMatch",
8596                &__With(&self.if_metageneration_match),
8597            )?;
8598        }
8599        if self.if_metageneration_not_match.is_some() {
8600            struct __With<'a>(&'a std::option::Option<i64>);
8601            impl<'a> serde::ser::Serialize for __With<'a> {
8602                fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
8603                where
8604                    S: serde::ser::Serializer,
8605                {
8606                    serde_with::As::<std::option::Option<wkt::internal::I64>>::serialize(
8607                        self.0, serializer,
8608                    )
8609                }
8610            }
8611            state.serialize_entry(
8612                "ifMetagenerationNotMatch",
8613                &__With(&self.if_metageneration_not_match),
8614            )?;
8615        }
8616        if !self._unknown_fields.is_empty() {
8617            for (key, value) in self._unknown_fields.iter() {
8618                state.serialize_entry(key, &value)?;
8619            }
8620        }
8621        state.end()
8622    }
8623}
8624
8625impl std::fmt::Debug for MoveObjectRequest {
8626    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
8627        let mut debug_struct = f.debug_struct("MoveObjectRequest");
8628        debug_struct.field("bucket", &self.bucket);
8629        debug_struct.field("source_object", &self.source_object);
8630        debug_struct.field("destination_object", &self.destination_object);
8631        debug_struct.field(
8632            "if_source_generation_match",
8633            &self.if_source_generation_match,
8634        );
8635        debug_struct.field(
8636            "if_source_generation_not_match",
8637            &self.if_source_generation_not_match,
8638        );
8639        debug_struct.field(
8640            "if_source_metageneration_match",
8641            &self.if_source_metageneration_match,
8642        );
8643        debug_struct.field(
8644            "if_source_metageneration_not_match",
8645            &self.if_source_metageneration_not_match,
8646        );
8647        debug_struct.field("if_generation_match", &self.if_generation_match);
8648        debug_struct.field("if_generation_not_match", &self.if_generation_not_match);
8649        debug_struct.field("if_metageneration_match", &self.if_metageneration_match);
8650        debug_struct.field(
8651            "if_metageneration_not_match",
8652            &self.if_metageneration_not_match,
8653        );
8654        if !self._unknown_fields.is_empty() {
8655            debug_struct.field("_unknown_fields", &self._unknown_fields);
8656        }
8657        debug_struct.finish()
8658    }
8659}
8660
8661/// Request message for UpdateObject.
8662#[derive(Clone, Default, PartialEq)]
8663#[non_exhaustive]
8664pub struct UpdateObjectRequest {
8665    /// Required. The object to update.
8666    /// The object's bucket and name fields are used to identify the object to
8667    /// update. If present, the object's generation field selects a specific
8668    /// revision of this object whose metadata should be updated. Otherwise,
8669    /// assumes the live version of the object.
8670    pub object: std::option::Option<crate::model::Object>,
8671
8672    /// Makes the operation conditional on whether the object's current generation
8673    /// matches the given value. Setting to 0 makes the operation succeed only if
8674    /// there are no live versions of the object.
8675    pub if_generation_match: std::option::Option<i64>,
8676
8677    /// Makes the operation conditional on whether the object's live generation
8678    /// does not match the given value. If no live object exists, the precondition
8679    /// fails. Setting to 0 makes the operation succeed only if there is a live
8680    /// version of the object.
8681    pub if_generation_not_match: std::option::Option<i64>,
8682
8683    /// Makes the operation conditional on whether the object's current
8684    /// metageneration matches the given value.
8685    pub if_metageneration_match: std::option::Option<i64>,
8686
8687    /// Makes the operation conditional on whether the object's current
8688    /// metageneration does not match the given value.
8689    pub if_metageneration_not_match: std::option::Option<i64>,
8690
8691    /// Optional. Apply a predefined set of access controls to this object.
8692    /// Valid values are "authenticatedRead", "bucketOwnerFullControl",
8693    /// "bucketOwnerRead", "private", "projectPrivate", or "publicRead".
8694    pub predefined_acl: std::string::String,
8695
8696    /// Required. List of fields to be updated.
8697    ///
8698    /// To specify ALL fields, equivalent to the JSON API's "update" function,
8699    /// specify a single field with the value `*`. Note: not recommended. If a new
8700    /// field is introduced at a later time, an older client updating with the `*`
8701    /// may accidentally reset the new field's value.
8702    ///
8703    /// Not specifying any fields is an error.
8704    pub update_mask: std::option::Option<wkt::FieldMask>,
8705
8706    /// Optional. A set of parameters common to Storage API requests concerning an
8707    /// object.
8708    pub common_object_request_params: std::option::Option<crate::model::CommonObjectRequestParams>,
8709
8710    /// Optional. Overrides the unlocked retention config on the object.
8711    pub override_unlocked_retention: bool,
8712
8713    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
8714}
8715
8716impl UpdateObjectRequest {
8717    pub fn new() -> Self {
8718        std::default::Default::default()
8719    }
8720
8721    /// Sets the value of [object][crate::model::UpdateObjectRequest::object].
8722    pub fn set_object<T>(mut self, v: T) -> Self
8723    where
8724        T: std::convert::Into<crate::model::Object>,
8725    {
8726        self.object = std::option::Option::Some(v.into());
8727        self
8728    }
8729
8730    /// Sets or clears the value of [object][crate::model::UpdateObjectRequest::object].
8731    pub fn set_or_clear_object<T>(mut self, v: std::option::Option<T>) -> Self
8732    where
8733        T: std::convert::Into<crate::model::Object>,
8734    {
8735        self.object = v.map(|x| x.into());
8736        self
8737    }
8738
8739    /// Sets the value of [if_generation_match][crate::model::UpdateObjectRequest::if_generation_match].
8740    pub fn set_if_generation_match<T>(mut self, v: T) -> Self
8741    where
8742        T: std::convert::Into<i64>,
8743    {
8744        self.if_generation_match = std::option::Option::Some(v.into());
8745        self
8746    }
8747
8748    /// Sets or clears the value of [if_generation_match][crate::model::UpdateObjectRequest::if_generation_match].
8749    pub fn set_or_clear_if_generation_match<T>(mut self, v: std::option::Option<T>) -> Self
8750    where
8751        T: std::convert::Into<i64>,
8752    {
8753        self.if_generation_match = v.map(|x| x.into());
8754        self
8755    }
8756
8757    /// Sets the value of [if_generation_not_match][crate::model::UpdateObjectRequest::if_generation_not_match].
8758    pub fn set_if_generation_not_match<T>(mut self, v: T) -> Self
8759    where
8760        T: std::convert::Into<i64>,
8761    {
8762        self.if_generation_not_match = std::option::Option::Some(v.into());
8763        self
8764    }
8765
8766    /// Sets or clears the value of [if_generation_not_match][crate::model::UpdateObjectRequest::if_generation_not_match].
8767    pub fn set_or_clear_if_generation_not_match<T>(mut self, v: std::option::Option<T>) -> Self
8768    where
8769        T: std::convert::Into<i64>,
8770    {
8771        self.if_generation_not_match = v.map(|x| x.into());
8772        self
8773    }
8774
8775    /// Sets the value of [if_metageneration_match][crate::model::UpdateObjectRequest::if_metageneration_match].
8776    pub fn set_if_metageneration_match<T>(mut self, v: T) -> Self
8777    where
8778        T: std::convert::Into<i64>,
8779    {
8780        self.if_metageneration_match = std::option::Option::Some(v.into());
8781        self
8782    }
8783
8784    /// Sets or clears the value of [if_metageneration_match][crate::model::UpdateObjectRequest::if_metageneration_match].
8785    pub fn set_or_clear_if_metageneration_match<T>(mut self, v: std::option::Option<T>) -> Self
8786    where
8787        T: std::convert::Into<i64>,
8788    {
8789        self.if_metageneration_match = v.map(|x| x.into());
8790        self
8791    }
8792
8793    /// Sets the value of [if_metageneration_not_match][crate::model::UpdateObjectRequest::if_metageneration_not_match].
8794    pub fn set_if_metageneration_not_match<T>(mut self, v: T) -> Self
8795    where
8796        T: std::convert::Into<i64>,
8797    {
8798        self.if_metageneration_not_match = std::option::Option::Some(v.into());
8799        self
8800    }
8801
8802    /// Sets or clears the value of [if_metageneration_not_match][crate::model::UpdateObjectRequest::if_metageneration_not_match].
8803    pub fn set_or_clear_if_metageneration_not_match<T>(mut self, v: std::option::Option<T>) -> Self
8804    where
8805        T: std::convert::Into<i64>,
8806    {
8807        self.if_metageneration_not_match = v.map(|x| x.into());
8808        self
8809    }
8810
8811    /// Sets the value of [predefined_acl][crate::model::UpdateObjectRequest::predefined_acl].
8812    pub fn set_predefined_acl<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
8813        self.predefined_acl = v.into();
8814        self
8815    }
8816
8817    /// Sets the value of [update_mask][crate::model::UpdateObjectRequest::update_mask].
8818    pub fn set_update_mask<T>(mut self, v: T) -> Self
8819    where
8820        T: std::convert::Into<wkt::FieldMask>,
8821    {
8822        self.update_mask = std::option::Option::Some(v.into());
8823        self
8824    }
8825
8826    /// Sets or clears the value of [update_mask][crate::model::UpdateObjectRequest::update_mask].
8827    pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
8828    where
8829        T: std::convert::Into<wkt::FieldMask>,
8830    {
8831        self.update_mask = v.map(|x| x.into());
8832        self
8833    }
8834
8835    /// Sets the value of [common_object_request_params][crate::model::UpdateObjectRequest::common_object_request_params].
8836    pub fn set_common_object_request_params<T>(mut self, v: T) -> Self
8837    where
8838        T: std::convert::Into<crate::model::CommonObjectRequestParams>,
8839    {
8840        self.common_object_request_params = std::option::Option::Some(v.into());
8841        self
8842    }
8843
8844    /// Sets or clears the value of [common_object_request_params][crate::model::UpdateObjectRequest::common_object_request_params].
8845    pub fn set_or_clear_common_object_request_params<T>(mut self, v: std::option::Option<T>) -> Self
8846    where
8847        T: std::convert::Into<crate::model::CommonObjectRequestParams>,
8848    {
8849        self.common_object_request_params = v.map(|x| x.into());
8850        self
8851    }
8852
8853    /// Sets the value of [override_unlocked_retention][crate::model::UpdateObjectRequest::override_unlocked_retention].
8854    pub fn set_override_unlocked_retention<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
8855        self.override_unlocked_retention = v.into();
8856        self
8857    }
8858}
8859
8860impl wkt::message::Message for UpdateObjectRequest {
8861    fn typename() -> &'static str {
8862        "type.googleapis.com/google.storage.v2.UpdateObjectRequest"
8863    }
8864}
8865
8866#[doc(hidden)]
8867impl<'de> serde::de::Deserialize<'de> for UpdateObjectRequest {
8868    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
8869    where
8870        D: serde::Deserializer<'de>,
8871    {
8872        #[allow(non_camel_case_types)]
8873        #[doc(hidden)]
8874        #[derive(PartialEq, Eq, Hash)]
8875        enum __FieldTag {
8876            __object,
8877            __if_generation_match,
8878            __if_generation_not_match,
8879            __if_metageneration_match,
8880            __if_metageneration_not_match,
8881            __predefined_acl,
8882            __update_mask,
8883            __common_object_request_params,
8884            __override_unlocked_retention,
8885            Unknown(std::string::String),
8886        }
8887        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
8888            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
8889            where
8890                D: serde::Deserializer<'de>,
8891            {
8892                struct Visitor;
8893                impl<'de> serde::de::Visitor<'de> for Visitor {
8894                    type Value = __FieldTag;
8895                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
8896                        formatter.write_str("a field name for UpdateObjectRequest")
8897                    }
8898                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
8899                    where
8900                        E: serde::de::Error,
8901                    {
8902                        use std::result::Result::Ok;
8903                        use std::string::ToString;
8904                        match value {
8905                            "object" => Ok(__FieldTag::__object),
8906                            "ifGenerationMatch" => Ok(__FieldTag::__if_generation_match),
8907                            "if_generation_match" => Ok(__FieldTag::__if_generation_match),
8908                            "ifGenerationNotMatch" => Ok(__FieldTag::__if_generation_not_match),
8909                            "if_generation_not_match" => Ok(__FieldTag::__if_generation_not_match),
8910                            "ifMetagenerationMatch" => Ok(__FieldTag::__if_metageneration_match),
8911                            "if_metageneration_match" => Ok(__FieldTag::__if_metageneration_match),
8912                            "ifMetagenerationNotMatch" => {
8913                                Ok(__FieldTag::__if_metageneration_not_match)
8914                            }
8915                            "if_metageneration_not_match" => {
8916                                Ok(__FieldTag::__if_metageneration_not_match)
8917                            }
8918                            "predefinedAcl" => Ok(__FieldTag::__predefined_acl),
8919                            "predefined_acl" => Ok(__FieldTag::__predefined_acl),
8920                            "updateMask" => Ok(__FieldTag::__update_mask),
8921                            "update_mask" => Ok(__FieldTag::__update_mask),
8922                            "commonObjectRequestParams" => {
8923                                Ok(__FieldTag::__common_object_request_params)
8924                            }
8925                            "common_object_request_params" => {
8926                                Ok(__FieldTag::__common_object_request_params)
8927                            }
8928                            "overrideUnlockedRetention" => {
8929                                Ok(__FieldTag::__override_unlocked_retention)
8930                            }
8931                            "override_unlocked_retention" => {
8932                                Ok(__FieldTag::__override_unlocked_retention)
8933                            }
8934                            _ => Ok(__FieldTag::Unknown(value.to_string())),
8935                        }
8936                    }
8937                }
8938                deserializer.deserialize_identifier(Visitor)
8939            }
8940        }
8941        struct Visitor;
8942        impl<'de> serde::de::Visitor<'de> for Visitor {
8943            type Value = UpdateObjectRequest;
8944            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
8945                formatter.write_str("struct UpdateObjectRequest")
8946            }
8947            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
8948            where
8949                A: serde::de::MapAccess<'de>,
8950            {
8951                #[allow(unused_imports)]
8952                use serde::de::Error;
8953                use std::option::Option::Some;
8954                let mut fields = std::collections::HashSet::new();
8955                let mut result = Self::Value::new();
8956                while let Some(tag) = map.next_key::<__FieldTag>()? {
8957                    #[allow(clippy::match_single_binding)]
8958                    match tag {
8959                        __FieldTag::__object => {
8960                            if !fields.insert(__FieldTag::__object) {
8961                                return std::result::Result::Err(A::Error::duplicate_field(
8962                                    "multiple values for object",
8963                                ));
8964                            }
8965                            result.object =
8966                                map.next_value::<std::option::Option<crate::model::Object>>()?;
8967                        }
8968                        __FieldTag::__if_generation_match => {
8969                            if !fields.insert(__FieldTag::__if_generation_match) {
8970                                return std::result::Result::Err(A::Error::duplicate_field(
8971                                    "multiple values for if_generation_match",
8972                                ));
8973                            }
8974                            struct __With(std::option::Option<i64>);
8975                            impl<'de> serde::de::Deserialize<'de> for __With {
8976                                fn deserialize<D>(
8977                                    deserializer: D,
8978                                ) -> std::result::Result<Self, D::Error>
8979                                where
8980                                    D: serde::de::Deserializer<'de>,
8981                                {
8982                                    serde_with::As::< std::option::Option<wkt::internal::I64> >::deserialize(deserializer).map(__With)
8983                                }
8984                            }
8985                            result.if_generation_match = map.next_value::<__With>()?.0;
8986                        }
8987                        __FieldTag::__if_generation_not_match => {
8988                            if !fields.insert(__FieldTag::__if_generation_not_match) {
8989                                return std::result::Result::Err(A::Error::duplicate_field(
8990                                    "multiple values for if_generation_not_match",
8991                                ));
8992                            }
8993                            struct __With(std::option::Option<i64>);
8994                            impl<'de> serde::de::Deserialize<'de> for __With {
8995                                fn deserialize<D>(
8996                                    deserializer: D,
8997                                ) -> std::result::Result<Self, D::Error>
8998                                where
8999                                    D: serde::de::Deserializer<'de>,
9000                                {
9001                                    serde_with::As::< std::option::Option<wkt::internal::I64> >::deserialize(deserializer).map(__With)
9002                                }
9003                            }
9004                            result.if_generation_not_match = map.next_value::<__With>()?.0;
9005                        }
9006                        __FieldTag::__if_metageneration_match => {
9007                            if !fields.insert(__FieldTag::__if_metageneration_match) {
9008                                return std::result::Result::Err(A::Error::duplicate_field(
9009                                    "multiple values for if_metageneration_match",
9010                                ));
9011                            }
9012                            struct __With(std::option::Option<i64>);
9013                            impl<'de> serde::de::Deserialize<'de> for __With {
9014                                fn deserialize<D>(
9015                                    deserializer: D,
9016                                ) -> std::result::Result<Self, D::Error>
9017                                where
9018                                    D: serde::de::Deserializer<'de>,
9019                                {
9020                                    serde_with::As::< std::option::Option<wkt::internal::I64> >::deserialize(deserializer).map(__With)
9021                                }
9022                            }
9023                            result.if_metageneration_match = map.next_value::<__With>()?.0;
9024                        }
9025                        __FieldTag::__if_metageneration_not_match => {
9026                            if !fields.insert(__FieldTag::__if_metageneration_not_match) {
9027                                return std::result::Result::Err(A::Error::duplicate_field(
9028                                    "multiple values for if_metageneration_not_match",
9029                                ));
9030                            }
9031                            struct __With(std::option::Option<i64>);
9032                            impl<'de> serde::de::Deserialize<'de> for __With {
9033                                fn deserialize<D>(
9034                                    deserializer: D,
9035                                ) -> std::result::Result<Self, D::Error>
9036                                where
9037                                    D: serde::de::Deserializer<'de>,
9038                                {
9039                                    serde_with::As::< std::option::Option<wkt::internal::I64> >::deserialize(deserializer).map(__With)
9040                                }
9041                            }
9042                            result.if_metageneration_not_match = map.next_value::<__With>()?.0;
9043                        }
9044                        __FieldTag::__predefined_acl => {
9045                            if !fields.insert(__FieldTag::__predefined_acl) {
9046                                return std::result::Result::Err(A::Error::duplicate_field(
9047                                    "multiple values for predefined_acl",
9048                                ));
9049                            }
9050                            result.predefined_acl = map
9051                                .next_value::<std::option::Option<std::string::String>>()?
9052                                .unwrap_or_default();
9053                        }
9054                        __FieldTag::__update_mask => {
9055                            if !fields.insert(__FieldTag::__update_mask) {
9056                                return std::result::Result::Err(A::Error::duplicate_field(
9057                                    "multiple values for update_mask",
9058                                ));
9059                            }
9060                            result.update_mask =
9061                                map.next_value::<std::option::Option<wkt::FieldMask>>()?;
9062                        }
9063                        __FieldTag::__common_object_request_params => {
9064                            if !fields.insert(__FieldTag::__common_object_request_params) {
9065                                return std::result::Result::Err(A::Error::duplicate_field(
9066                                    "multiple values for common_object_request_params",
9067                                ));
9068                            }
9069                            result.common_object_request_params = map.next_value::<std::option::Option<crate::model::CommonObjectRequestParams>>()?
9070                                ;
9071                        }
9072                        __FieldTag::__override_unlocked_retention => {
9073                            if !fields.insert(__FieldTag::__override_unlocked_retention) {
9074                                return std::result::Result::Err(A::Error::duplicate_field(
9075                                    "multiple values for override_unlocked_retention",
9076                                ));
9077                            }
9078                            result.override_unlocked_retention = map
9079                                .next_value::<std::option::Option<bool>>()?
9080                                .unwrap_or_default();
9081                        }
9082                        __FieldTag::Unknown(key) => {
9083                            let value = map.next_value::<serde_json::Value>()?;
9084                            result._unknown_fields.insert(key, value);
9085                        }
9086                    }
9087                }
9088                std::result::Result::Ok(result)
9089            }
9090        }
9091        deserializer.deserialize_any(Visitor)
9092    }
9093}
9094
9095#[doc(hidden)]
9096impl serde::ser::Serialize for UpdateObjectRequest {
9097    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
9098    where
9099        S: serde::ser::Serializer,
9100    {
9101        use serde::ser::SerializeMap;
9102        #[allow(unused_imports)]
9103        use std::option::Option::Some;
9104        let mut state = serializer.serialize_map(std::option::Option::None)?;
9105        if self.object.is_some() {
9106            state.serialize_entry("object", &self.object)?;
9107        }
9108        if self.if_generation_match.is_some() {
9109            struct __With<'a>(&'a std::option::Option<i64>);
9110            impl<'a> serde::ser::Serialize for __With<'a> {
9111                fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
9112                where
9113                    S: serde::ser::Serializer,
9114                {
9115                    serde_with::As::<std::option::Option<wkt::internal::I64>>::serialize(
9116                        self.0, serializer,
9117                    )
9118                }
9119            }
9120            state.serialize_entry("ifGenerationMatch", &__With(&self.if_generation_match))?;
9121        }
9122        if self.if_generation_not_match.is_some() {
9123            struct __With<'a>(&'a std::option::Option<i64>);
9124            impl<'a> serde::ser::Serialize for __With<'a> {
9125                fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
9126                where
9127                    S: serde::ser::Serializer,
9128                {
9129                    serde_with::As::<std::option::Option<wkt::internal::I64>>::serialize(
9130                        self.0, serializer,
9131                    )
9132                }
9133            }
9134            state.serialize_entry(
9135                "ifGenerationNotMatch",
9136                &__With(&self.if_generation_not_match),
9137            )?;
9138        }
9139        if self.if_metageneration_match.is_some() {
9140            struct __With<'a>(&'a std::option::Option<i64>);
9141            impl<'a> serde::ser::Serialize for __With<'a> {
9142                fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
9143                where
9144                    S: serde::ser::Serializer,
9145                {
9146                    serde_with::As::<std::option::Option<wkt::internal::I64>>::serialize(
9147                        self.0, serializer,
9148                    )
9149                }
9150            }
9151            state.serialize_entry(
9152                "ifMetagenerationMatch",
9153                &__With(&self.if_metageneration_match),
9154            )?;
9155        }
9156        if self.if_metageneration_not_match.is_some() {
9157            struct __With<'a>(&'a std::option::Option<i64>);
9158            impl<'a> serde::ser::Serialize for __With<'a> {
9159                fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
9160                where
9161                    S: serde::ser::Serializer,
9162                {
9163                    serde_with::As::<std::option::Option<wkt::internal::I64>>::serialize(
9164                        self.0, serializer,
9165                    )
9166                }
9167            }
9168            state.serialize_entry(
9169                "ifMetagenerationNotMatch",
9170                &__With(&self.if_metageneration_not_match),
9171            )?;
9172        }
9173        if !self.predefined_acl.is_empty() {
9174            state.serialize_entry("predefinedAcl", &self.predefined_acl)?;
9175        }
9176        if self.update_mask.is_some() {
9177            state.serialize_entry("updateMask", &self.update_mask)?;
9178        }
9179        if self.common_object_request_params.is_some() {
9180            state.serialize_entry(
9181                "commonObjectRequestParams",
9182                &self.common_object_request_params,
9183            )?;
9184        }
9185        if !wkt::internal::is_default(&self.override_unlocked_retention) {
9186            state.serialize_entry(
9187                "overrideUnlockedRetention",
9188                &self.override_unlocked_retention,
9189            )?;
9190        }
9191        if !self._unknown_fields.is_empty() {
9192            for (key, value) in self._unknown_fields.iter() {
9193                state.serialize_entry(key, &value)?;
9194            }
9195        }
9196        state.end()
9197    }
9198}
9199
9200impl std::fmt::Debug for UpdateObjectRequest {
9201    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
9202        let mut debug_struct = f.debug_struct("UpdateObjectRequest");
9203        debug_struct.field("object", &self.object);
9204        debug_struct.field("if_generation_match", &self.if_generation_match);
9205        debug_struct.field("if_generation_not_match", &self.if_generation_not_match);
9206        debug_struct.field("if_metageneration_match", &self.if_metageneration_match);
9207        debug_struct.field(
9208            "if_metageneration_not_match",
9209            &self.if_metageneration_not_match,
9210        );
9211        debug_struct.field("predefined_acl", &self.predefined_acl);
9212        debug_struct.field("update_mask", &self.update_mask);
9213        debug_struct.field(
9214            "common_object_request_params",
9215            &self.common_object_request_params,
9216        );
9217        debug_struct.field(
9218            "override_unlocked_retention",
9219            &self.override_unlocked_retention,
9220        );
9221        if !self._unknown_fields.is_empty() {
9222            debug_struct.field("_unknown_fields", &self._unknown_fields);
9223        }
9224        debug_struct.finish()
9225    }
9226}
9227
9228/// Parameters that can be passed to any object request.
9229#[derive(Clone, Default, PartialEq)]
9230#[non_exhaustive]
9231pub struct CommonObjectRequestParams {
9232    /// Optional. Encryption algorithm used with the Customer-Supplied Encryption
9233    /// Keys feature.
9234    pub encryption_algorithm: std::string::String,
9235
9236    /// Optional. Encryption key used with the Customer-Supplied Encryption Keys
9237    /// feature. In raw bytes format (not base64-encoded).
9238    pub encryption_key_bytes: ::bytes::Bytes,
9239
9240    /// Optional. SHA256 hash of encryption key used with the Customer-Supplied
9241    /// Encryption Keys feature.
9242    pub encryption_key_sha256_bytes: ::bytes::Bytes,
9243
9244    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
9245}
9246
9247impl CommonObjectRequestParams {
9248    pub fn new() -> Self {
9249        std::default::Default::default()
9250    }
9251
9252    /// Sets the value of [encryption_algorithm][crate::model::CommonObjectRequestParams::encryption_algorithm].
9253    pub fn set_encryption_algorithm<T: std::convert::Into<std::string::String>>(
9254        mut self,
9255        v: T,
9256    ) -> Self {
9257        self.encryption_algorithm = v.into();
9258        self
9259    }
9260
9261    /// Sets the value of [encryption_key_bytes][crate::model::CommonObjectRequestParams::encryption_key_bytes].
9262    pub fn set_encryption_key_bytes<T: std::convert::Into<::bytes::Bytes>>(mut self, v: T) -> Self {
9263        self.encryption_key_bytes = v.into();
9264        self
9265    }
9266
9267    /// Sets the value of [encryption_key_sha256_bytes][crate::model::CommonObjectRequestParams::encryption_key_sha256_bytes].
9268    pub fn set_encryption_key_sha256_bytes<T: std::convert::Into<::bytes::Bytes>>(
9269        mut self,
9270        v: T,
9271    ) -> Self {
9272        self.encryption_key_sha256_bytes = v.into();
9273        self
9274    }
9275}
9276
9277impl wkt::message::Message for CommonObjectRequestParams {
9278    fn typename() -> &'static str {
9279        "type.googleapis.com/google.storage.v2.CommonObjectRequestParams"
9280    }
9281}
9282
9283#[doc(hidden)]
9284impl<'de> serde::de::Deserialize<'de> for CommonObjectRequestParams {
9285    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
9286    where
9287        D: serde::Deserializer<'de>,
9288    {
9289        #[allow(non_camel_case_types)]
9290        #[doc(hidden)]
9291        #[derive(PartialEq, Eq, Hash)]
9292        enum __FieldTag {
9293            __encryption_algorithm,
9294            __encryption_key_bytes,
9295            __encryption_key_sha256_bytes,
9296            Unknown(std::string::String),
9297        }
9298        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
9299            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
9300            where
9301                D: serde::Deserializer<'de>,
9302            {
9303                struct Visitor;
9304                impl<'de> serde::de::Visitor<'de> for Visitor {
9305                    type Value = __FieldTag;
9306                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
9307                        formatter.write_str("a field name for CommonObjectRequestParams")
9308                    }
9309                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
9310                    where
9311                        E: serde::de::Error,
9312                    {
9313                        use std::result::Result::Ok;
9314                        use std::string::ToString;
9315                        match value {
9316                            "encryptionAlgorithm" => Ok(__FieldTag::__encryption_algorithm),
9317                            "encryption_algorithm" => Ok(__FieldTag::__encryption_algorithm),
9318                            "encryptionKeyBytes" => Ok(__FieldTag::__encryption_key_bytes),
9319                            "encryption_key_bytes" => Ok(__FieldTag::__encryption_key_bytes),
9320                            "encryptionKeySha256Bytes" => {
9321                                Ok(__FieldTag::__encryption_key_sha256_bytes)
9322                            }
9323                            "encryption_key_sha256_bytes" => {
9324                                Ok(__FieldTag::__encryption_key_sha256_bytes)
9325                            }
9326                            _ => Ok(__FieldTag::Unknown(value.to_string())),
9327                        }
9328                    }
9329                }
9330                deserializer.deserialize_identifier(Visitor)
9331            }
9332        }
9333        struct Visitor;
9334        impl<'de> serde::de::Visitor<'de> for Visitor {
9335            type Value = CommonObjectRequestParams;
9336            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
9337                formatter.write_str("struct CommonObjectRequestParams")
9338            }
9339            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
9340            where
9341                A: serde::de::MapAccess<'de>,
9342            {
9343                #[allow(unused_imports)]
9344                use serde::de::Error;
9345                use std::option::Option::Some;
9346                let mut fields = std::collections::HashSet::new();
9347                let mut result = Self::Value::new();
9348                while let Some(tag) = map.next_key::<__FieldTag>()? {
9349                    #[allow(clippy::match_single_binding)]
9350                    match tag {
9351                        __FieldTag::__encryption_algorithm => {
9352                            if !fields.insert(__FieldTag::__encryption_algorithm) {
9353                                return std::result::Result::Err(A::Error::duplicate_field(
9354                                    "multiple values for encryption_algorithm",
9355                                ));
9356                            }
9357                            result.encryption_algorithm = map
9358                                .next_value::<std::option::Option<std::string::String>>()?
9359                                .unwrap_or_default();
9360                        }
9361                        __FieldTag::__encryption_key_bytes => {
9362                            if !fields.insert(__FieldTag::__encryption_key_bytes) {
9363                                return std::result::Result::Err(A::Error::duplicate_field(
9364                                    "multiple values for encryption_key_bytes",
9365                                ));
9366                            }
9367                            struct __With(std::option::Option<::bytes::Bytes>);
9368                            impl<'de> serde::de::Deserialize<'de> for __With {
9369                                fn deserialize<D>(
9370                                    deserializer: D,
9371                                ) -> std::result::Result<Self, D::Error>
9372                                where
9373                                    D: serde::de::Deserializer<'de>,
9374                                {
9375                                    serde_with::As::< std::option::Option<serde_with::base64::Base64> >::deserialize(deserializer).map(__With)
9376                                }
9377                            }
9378                            result.encryption_key_bytes =
9379                                map.next_value::<__With>()?.0.unwrap_or_default();
9380                        }
9381                        __FieldTag::__encryption_key_sha256_bytes => {
9382                            if !fields.insert(__FieldTag::__encryption_key_sha256_bytes) {
9383                                return std::result::Result::Err(A::Error::duplicate_field(
9384                                    "multiple values for encryption_key_sha256_bytes",
9385                                ));
9386                            }
9387                            struct __With(std::option::Option<::bytes::Bytes>);
9388                            impl<'de> serde::de::Deserialize<'de> for __With {
9389                                fn deserialize<D>(
9390                                    deserializer: D,
9391                                ) -> std::result::Result<Self, D::Error>
9392                                where
9393                                    D: serde::de::Deserializer<'de>,
9394                                {
9395                                    serde_with::As::< std::option::Option<serde_with::base64::Base64> >::deserialize(deserializer).map(__With)
9396                                }
9397                            }
9398                            result.encryption_key_sha256_bytes =
9399                                map.next_value::<__With>()?.0.unwrap_or_default();
9400                        }
9401                        __FieldTag::Unknown(key) => {
9402                            let value = map.next_value::<serde_json::Value>()?;
9403                            result._unknown_fields.insert(key, value);
9404                        }
9405                    }
9406                }
9407                std::result::Result::Ok(result)
9408            }
9409        }
9410        deserializer.deserialize_any(Visitor)
9411    }
9412}
9413
9414#[doc(hidden)]
9415impl serde::ser::Serialize for CommonObjectRequestParams {
9416    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
9417    where
9418        S: serde::ser::Serializer,
9419    {
9420        use serde::ser::SerializeMap;
9421        #[allow(unused_imports)]
9422        use std::option::Option::Some;
9423        let mut state = serializer.serialize_map(std::option::Option::None)?;
9424        if !self.encryption_algorithm.is_empty() {
9425            state.serialize_entry("encryptionAlgorithm", &self.encryption_algorithm)?;
9426        }
9427        if !self.encryption_key_bytes.is_empty() {
9428            struct __With<'a>(&'a ::bytes::Bytes);
9429            impl<'a> serde::ser::Serialize for __With<'a> {
9430                fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
9431                where
9432                    S: serde::ser::Serializer,
9433                {
9434                    serde_with::As::<serde_with::base64::Base64>::serialize(self.0, serializer)
9435                }
9436            }
9437            state.serialize_entry("encryptionKeyBytes", &__With(&self.encryption_key_bytes))?;
9438        }
9439        if !self.encryption_key_sha256_bytes.is_empty() {
9440            struct __With<'a>(&'a ::bytes::Bytes);
9441            impl<'a> serde::ser::Serialize for __With<'a> {
9442                fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
9443                where
9444                    S: serde::ser::Serializer,
9445                {
9446                    serde_with::As::<serde_with::base64::Base64>::serialize(self.0, serializer)
9447                }
9448            }
9449            state.serialize_entry(
9450                "encryptionKeySha256Bytes",
9451                &__With(&self.encryption_key_sha256_bytes),
9452            )?;
9453        }
9454        if !self._unknown_fields.is_empty() {
9455            for (key, value) in self._unknown_fields.iter() {
9456                state.serialize_entry(key, &value)?;
9457            }
9458        }
9459        state.end()
9460    }
9461}
9462
9463impl std::fmt::Debug for CommonObjectRequestParams {
9464    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
9465        let mut debug_struct = f.debug_struct("CommonObjectRequestParams");
9466        debug_struct.field("encryption_algorithm", &self.encryption_algorithm);
9467        debug_struct.field("encryption_key_bytes", &self.encryption_key_bytes);
9468        debug_struct.field(
9469            "encryption_key_sha256_bytes",
9470            &self.encryption_key_sha256_bytes,
9471        );
9472        if !self._unknown_fields.is_empty() {
9473            debug_struct.field("_unknown_fields", &self._unknown_fields);
9474        }
9475        debug_struct.finish()
9476    }
9477}
9478
9479/// A bucket.
9480#[derive(Clone, Default, PartialEq)]
9481#[non_exhaustive]
9482pub struct Bucket {
9483    /// Identifier. The name of the bucket.
9484    /// Format: `projects/{project}/buckets/{bucket}`
9485    pub name: std::string::String,
9486
9487    /// Output only. The user-chosen part of the bucket name. The `{bucket}`
9488    /// portion of the `name` field. For globally unique buckets, this is equal to
9489    /// the "bucket name" of other Cloud Storage APIs. Example: "pub".
9490    pub bucket_id: std::string::String,
9491
9492    /// The etag of the bucket.
9493    /// If included in the metadata of an UpdateBucketRequest, the operation will
9494    /// only be performed if the etag matches that of the bucket.
9495    pub etag: std::string::String,
9496
9497    /// Immutable. The project which owns this bucket, in the format of
9498    /// "projects/{projectIdentifier}".
9499    /// {projectIdentifier} can be the project ID or project number.
9500    /// Output values will always be in project number format.
9501    pub project: std::string::String,
9502
9503    /// Output only. The metadata generation of this bucket.
9504    pub metageneration: i64,
9505
9506    /// Immutable. The location of the bucket. Object data for objects in the
9507    /// bucket resides in physical storage within this region.  Defaults to `US`.
9508    /// See the
9509    /// [<https://developers.google.com/storage/docs/concepts-techniques#specifyinglocations>"][developer's
9510    /// guide] for the authoritative list. Attempting to update this field after
9511    /// the bucket is created will result in an error.
9512    pub location: std::string::String,
9513
9514    /// Output only. The location type of the bucket (region, dual-region,
9515    /// multi-region, etc).
9516    pub location_type: std::string::String,
9517
9518    /// Optional. The bucket's default storage class, used whenever no storageClass
9519    /// is specified for a newly-created object. This defines how objects in the
9520    /// bucket are stored and determines the SLA and the cost of storage.
9521    /// If this value is not specified when the bucket is created, it will default
9522    /// to `STANDARD`. For more information, see
9523    /// <https://developers.google.com/storage/docs/storage-classes>.
9524    pub storage_class: std::string::String,
9525
9526    /// Optional. The recovery point objective for cross-region replication of the
9527    /// bucket. Applicable only for dual- and multi-region buckets. "DEFAULT" uses
9528    /// default replication. "ASYNC_TURBO" enables turbo replication, valid for
9529    /// dual-region buckets only. If rpo is not specified when the bucket is
9530    /// created, it defaults to "DEFAULT". For more information, see
9531    /// <https://cloud.google.com/storage/docs/availability-durability#turbo-replication>.
9532    pub rpo: std::string::String,
9533
9534    /// Optional. Access controls on the bucket.
9535    /// If iam_config.uniform_bucket_level_access is enabled on this bucket,
9536    /// requests to set, read, or modify acl is an error.
9537    pub acl: std::vec::Vec<crate::model::BucketAccessControl>,
9538
9539    /// Optional. Default access controls to apply to new objects when no ACL is
9540    /// provided. If iam_config.uniform_bucket_level_access is enabled on this
9541    /// bucket, requests to set, read, or modify acl is an error.
9542    pub default_object_acl: std::vec::Vec<crate::model::ObjectAccessControl>,
9543
9544    /// Optional. The bucket's lifecycle config. See
9545    /// [<https://developers.google.com/storage/docs/lifecycle>]Lifecycle Management]
9546    /// for more information.
9547    pub lifecycle: std::option::Option<crate::model::bucket::Lifecycle>,
9548
9549    /// Output only. The creation time of the bucket.
9550    pub create_time: std::option::Option<wkt::Timestamp>,
9551
9552    /// Optional. The bucket's [<https://www.w3.org/TR/cors/>][Cross-Origin Resource
9553    /// Sharing] (CORS) config.
9554    pub cors: std::vec::Vec<crate::model::bucket::Cors>,
9555
9556    /// Output only. The modification time of the bucket.
9557    pub update_time: std::option::Option<wkt::Timestamp>,
9558
9559    /// Optional. The default value for event-based hold on newly created objects
9560    /// in this bucket.  Event-based hold is a way to retain objects indefinitely
9561    /// until an event occurs, signified by the hold's release. After being
9562    /// released, such objects will be subject to bucket-level retention (if any).
9563    /// One sample use case of this flag is for banks to hold loan documents for at
9564    /// least 3 years after loan is paid in full. Here, bucket-level retention is 3
9565    /// years and the event is loan being paid in full. In this example, these
9566    /// objects will be held intact for any number of years until the event has
9567    /// occurred (event-based hold on the object is released) and then 3 more years
9568    /// after that. That means retention duration of the objects begins from the
9569    /// moment event-based hold transitioned from true to false.  Objects under
9570    /// event-based hold cannot be deleted, overwritten or archived until the hold
9571    /// is removed.
9572    pub default_event_based_hold: bool,
9573
9574    /// Optional. User-provided labels, in key/value pairs.
9575    pub labels: std::collections::HashMap<std::string::String, std::string::String>,
9576
9577    /// Optional. The bucket's website config, controlling how the service behaves
9578    /// when accessing bucket contents as a web site. See the
9579    /// [<https://cloud.google.com/storage/docs/static-website>][Static Website
9580    /// Examples] for more information.
9581    pub website: std::option::Option<crate::model::bucket::Website>,
9582
9583    /// Optional. The bucket's versioning config.
9584    pub versioning: std::option::Option<crate::model::bucket::Versioning>,
9585
9586    /// Optional. The bucket's logging config, which defines the destination bucket
9587    /// and name prefix (if any) for the current bucket's logs.
9588    pub logging: std::option::Option<crate::model::bucket::Logging>,
9589
9590    /// Output only. The owner of the bucket. This is always the project team's
9591    /// owner group.
9592    pub owner: std::option::Option<crate::model::Owner>,
9593
9594    /// Optional. Encryption config for a bucket.
9595    pub encryption: std::option::Option<crate::model::bucket::Encryption>,
9596
9597    /// Optional. The bucket's billing config.
9598    pub billing: std::option::Option<crate::model::bucket::Billing>,
9599
9600    /// Optional. The bucket's retention policy. The retention policy enforces a
9601    /// minimum retention time for all objects contained in the bucket, based on
9602    /// their creation time. Any attempt to overwrite or delete objects younger
9603    /// than the retention period will result in a PERMISSION_DENIED error.  An
9604    /// unlocked retention policy can be modified or removed from the bucket via a
9605    /// storage.buckets.update operation. A locked retention policy cannot be
9606    /// removed or shortened in duration for the lifetime of the bucket.
9607    /// Attempting to remove or decrease period of a locked retention policy will
9608    /// result in a PERMISSION_DENIED error.
9609    pub retention_policy: std::option::Option<crate::model::bucket::RetentionPolicy>,
9610
9611    /// Optional. The bucket's IAM config.
9612    pub iam_config: std::option::Option<crate::model::bucket::IamConfig>,
9613
9614    /// Optional. Reserved for future use.
9615    pub satisfies_pzs: bool,
9616
9617    /// Optional. Configuration that, if present, specifies the data placement for
9618    /// a
9619    /// [<https://cloud.google.com/storage/docs/locations#location-dr>][configurable
9620    /// dual-region].
9621    pub custom_placement_config: std::option::Option<crate::model::bucket::CustomPlacementConfig>,
9622
9623    /// Optional. The bucket's Autoclass configuration. If there is no
9624    /// configuration, the Autoclass feature will be disabled and have no effect on
9625    /// the bucket.
9626    pub autoclass: std::option::Option<crate::model::bucket::Autoclass>,
9627
9628    /// Optional. The bucket's hierarchical namespace configuration. If there is no
9629    /// configuration, the hierarchical namespace feature will be disabled and have
9630    /// no effect on the bucket.
9631    pub hierarchical_namespace: std::option::Option<crate::model::bucket::HierarchicalNamespace>,
9632
9633    /// Optional. The bucket's soft delete policy. The soft delete policy prevents
9634    /// soft-deleted objects from being permanently deleted.
9635    pub soft_delete_policy: std::option::Option<crate::model::bucket::SoftDeletePolicy>,
9636
9637    /// Optional. The bucket's object retention configuration. Must be enabled
9638    /// before objects in the bucket may have retention configured.
9639    pub object_retention: std::option::Option<crate::model::bucket::ObjectRetention>,
9640
9641    /// Optional. The bucket's IP filter configuration.
9642    pub ip_filter: std::option::Option<crate::model::bucket::IpFilter>,
9643
9644    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
9645}
9646
9647impl Bucket {
9648    pub fn new() -> Self {
9649        std::default::Default::default()
9650    }
9651
9652    /// Sets the value of [name][crate::model::Bucket::name].
9653    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9654        self.name = v.into();
9655        self
9656    }
9657
9658    /// Sets the value of [bucket_id][crate::model::Bucket::bucket_id].
9659    pub fn set_bucket_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9660        self.bucket_id = v.into();
9661        self
9662    }
9663
9664    /// Sets the value of [etag][crate::model::Bucket::etag].
9665    pub fn set_etag<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9666        self.etag = v.into();
9667        self
9668    }
9669
9670    /// Sets the value of [project][crate::model::Bucket::project].
9671    pub fn set_project<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9672        self.project = v.into();
9673        self
9674    }
9675
9676    /// Sets the value of [metageneration][crate::model::Bucket::metageneration].
9677    pub fn set_metageneration<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
9678        self.metageneration = v.into();
9679        self
9680    }
9681
9682    /// Sets the value of [location][crate::model::Bucket::location].
9683    pub fn set_location<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9684        self.location = v.into();
9685        self
9686    }
9687
9688    /// Sets the value of [location_type][crate::model::Bucket::location_type].
9689    pub fn set_location_type<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9690        self.location_type = v.into();
9691        self
9692    }
9693
9694    /// Sets the value of [storage_class][crate::model::Bucket::storage_class].
9695    pub fn set_storage_class<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9696        self.storage_class = v.into();
9697        self
9698    }
9699
9700    /// Sets the value of [rpo][crate::model::Bucket::rpo].
9701    pub fn set_rpo<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9702        self.rpo = v.into();
9703        self
9704    }
9705
9706    /// Sets the value of [acl][crate::model::Bucket::acl].
9707    pub fn set_acl<T, V>(mut self, v: T) -> Self
9708    where
9709        T: std::iter::IntoIterator<Item = V>,
9710        V: std::convert::Into<crate::model::BucketAccessControl>,
9711    {
9712        use std::iter::Iterator;
9713        self.acl = v.into_iter().map(|i| i.into()).collect();
9714        self
9715    }
9716
9717    /// Sets the value of [default_object_acl][crate::model::Bucket::default_object_acl].
9718    pub fn set_default_object_acl<T, V>(mut self, v: T) -> Self
9719    where
9720        T: std::iter::IntoIterator<Item = V>,
9721        V: std::convert::Into<crate::model::ObjectAccessControl>,
9722    {
9723        use std::iter::Iterator;
9724        self.default_object_acl = v.into_iter().map(|i| i.into()).collect();
9725        self
9726    }
9727
9728    /// Sets the value of [lifecycle][crate::model::Bucket::lifecycle].
9729    pub fn set_lifecycle<T>(mut self, v: T) -> Self
9730    where
9731        T: std::convert::Into<crate::model::bucket::Lifecycle>,
9732    {
9733        self.lifecycle = std::option::Option::Some(v.into());
9734        self
9735    }
9736
9737    /// Sets or clears the value of [lifecycle][crate::model::Bucket::lifecycle].
9738    pub fn set_or_clear_lifecycle<T>(mut self, v: std::option::Option<T>) -> Self
9739    where
9740        T: std::convert::Into<crate::model::bucket::Lifecycle>,
9741    {
9742        self.lifecycle = v.map(|x| x.into());
9743        self
9744    }
9745
9746    /// Sets the value of [create_time][crate::model::Bucket::create_time].
9747    pub fn set_create_time<T>(mut self, v: T) -> Self
9748    where
9749        T: std::convert::Into<wkt::Timestamp>,
9750    {
9751        self.create_time = std::option::Option::Some(v.into());
9752        self
9753    }
9754
9755    /// Sets or clears the value of [create_time][crate::model::Bucket::create_time].
9756    pub fn set_or_clear_create_time<T>(mut self, v: std::option::Option<T>) -> Self
9757    where
9758        T: std::convert::Into<wkt::Timestamp>,
9759    {
9760        self.create_time = v.map(|x| x.into());
9761        self
9762    }
9763
9764    /// Sets the value of [cors][crate::model::Bucket::cors].
9765    pub fn set_cors<T, V>(mut self, v: T) -> Self
9766    where
9767        T: std::iter::IntoIterator<Item = V>,
9768        V: std::convert::Into<crate::model::bucket::Cors>,
9769    {
9770        use std::iter::Iterator;
9771        self.cors = v.into_iter().map(|i| i.into()).collect();
9772        self
9773    }
9774
9775    /// Sets the value of [update_time][crate::model::Bucket::update_time].
9776    pub fn set_update_time<T>(mut self, v: T) -> Self
9777    where
9778        T: std::convert::Into<wkt::Timestamp>,
9779    {
9780        self.update_time = std::option::Option::Some(v.into());
9781        self
9782    }
9783
9784    /// Sets or clears the value of [update_time][crate::model::Bucket::update_time].
9785    pub fn set_or_clear_update_time<T>(mut self, v: std::option::Option<T>) -> Self
9786    where
9787        T: std::convert::Into<wkt::Timestamp>,
9788    {
9789        self.update_time = v.map(|x| x.into());
9790        self
9791    }
9792
9793    /// Sets the value of [default_event_based_hold][crate::model::Bucket::default_event_based_hold].
9794    pub fn set_default_event_based_hold<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
9795        self.default_event_based_hold = v.into();
9796        self
9797    }
9798
9799    /// Sets the value of [labels][crate::model::Bucket::labels].
9800    pub fn set_labels<T, K, V>(mut self, v: T) -> Self
9801    where
9802        T: std::iter::IntoIterator<Item = (K, V)>,
9803        K: std::convert::Into<std::string::String>,
9804        V: std::convert::Into<std::string::String>,
9805    {
9806        use std::iter::Iterator;
9807        self.labels = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
9808        self
9809    }
9810
9811    /// Sets the value of [website][crate::model::Bucket::website].
9812    pub fn set_website<T>(mut self, v: T) -> Self
9813    where
9814        T: std::convert::Into<crate::model::bucket::Website>,
9815    {
9816        self.website = std::option::Option::Some(v.into());
9817        self
9818    }
9819
9820    /// Sets or clears the value of [website][crate::model::Bucket::website].
9821    pub fn set_or_clear_website<T>(mut self, v: std::option::Option<T>) -> Self
9822    where
9823        T: std::convert::Into<crate::model::bucket::Website>,
9824    {
9825        self.website = v.map(|x| x.into());
9826        self
9827    }
9828
9829    /// Sets the value of [versioning][crate::model::Bucket::versioning].
9830    pub fn set_versioning<T>(mut self, v: T) -> Self
9831    where
9832        T: std::convert::Into<crate::model::bucket::Versioning>,
9833    {
9834        self.versioning = std::option::Option::Some(v.into());
9835        self
9836    }
9837
9838    /// Sets or clears the value of [versioning][crate::model::Bucket::versioning].
9839    pub fn set_or_clear_versioning<T>(mut self, v: std::option::Option<T>) -> Self
9840    where
9841        T: std::convert::Into<crate::model::bucket::Versioning>,
9842    {
9843        self.versioning = v.map(|x| x.into());
9844        self
9845    }
9846
9847    /// Sets the value of [logging][crate::model::Bucket::logging].
9848    pub fn set_logging<T>(mut self, v: T) -> Self
9849    where
9850        T: std::convert::Into<crate::model::bucket::Logging>,
9851    {
9852        self.logging = std::option::Option::Some(v.into());
9853        self
9854    }
9855
9856    /// Sets or clears the value of [logging][crate::model::Bucket::logging].
9857    pub fn set_or_clear_logging<T>(mut self, v: std::option::Option<T>) -> Self
9858    where
9859        T: std::convert::Into<crate::model::bucket::Logging>,
9860    {
9861        self.logging = v.map(|x| x.into());
9862        self
9863    }
9864
9865    /// Sets the value of [owner][crate::model::Bucket::owner].
9866    pub fn set_owner<T>(mut self, v: T) -> Self
9867    where
9868        T: std::convert::Into<crate::model::Owner>,
9869    {
9870        self.owner = std::option::Option::Some(v.into());
9871        self
9872    }
9873
9874    /// Sets or clears the value of [owner][crate::model::Bucket::owner].
9875    pub fn set_or_clear_owner<T>(mut self, v: std::option::Option<T>) -> Self
9876    where
9877        T: std::convert::Into<crate::model::Owner>,
9878    {
9879        self.owner = v.map(|x| x.into());
9880        self
9881    }
9882
9883    /// Sets the value of [encryption][crate::model::Bucket::encryption].
9884    pub fn set_encryption<T>(mut self, v: T) -> Self
9885    where
9886        T: std::convert::Into<crate::model::bucket::Encryption>,
9887    {
9888        self.encryption = std::option::Option::Some(v.into());
9889        self
9890    }
9891
9892    /// Sets or clears the value of [encryption][crate::model::Bucket::encryption].
9893    pub fn set_or_clear_encryption<T>(mut self, v: std::option::Option<T>) -> Self
9894    where
9895        T: std::convert::Into<crate::model::bucket::Encryption>,
9896    {
9897        self.encryption = v.map(|x| x.into());
9898        self
9899    }
9900
9901    /// Sets the value of [billing][crate::model::Bucket::billing].
9902    pub fn set_billing<T>(mut self, v: T) -> Self
9903    where
9904        T: std::convert::Into<crate::model::bucket::Billing>,
9905    {
9906        self.billing = std::option::Option::Some(v.into());
9907        self
9908    }
9909
9910    /// Sets or clears the value of [billing][crate::model::Bucket::billing].
9911    pub fn set_or_clear_billing<T>(mut self, v: std::option::Option<T>) -> Self
9912    where
9913        T: std::convert::Into<crate::model::bucket::Billing>,
9914    {
9915        self.billing = v.map(|x| x.into());
9916        self
9917    }
9918
9919    /// Sets the value of [retention_policy][crate::model::Bucket::retention_policy].
9920    pub fn set_retention_policy<T>(mut self, v: T) -> Self
9921    where
9922        T: std::convert::Into<crate::model::bucket::RetentionPolicy>,
9923    {
9924        self.retention_policy = std::option::Option::Some(v.into());
9925        self
9926    }
9927
9928    /// Sets or clears the value of [retention_policy][crate::model::Bucket::retention_policy].
9929    pub fn set_or_clear_retention_policy<T>(mut self, v: std::option::Option<T>) -> Self
9930    where
9931        T: std::convert::Into<crate::model::bucket::RetentionPolicy>,
9932    {
9933        self.retention_policy = v.map(|x| x.into());
9934        self
9935    }
9936
9937    /// Sets the value of [iam_config][crate::model::Bucket::iam_config].
9938    pub fn set_iam_config<T>(mut self, v: T) -> Self
9939    where
9940        T: std::convert::Into<crate::model::bucket::IamConfig>,
9941    {
9942        self.iam_config = std::option::Option::Some(v.into());
9943        self
9944    }
9945
9946    /// Sets or clears the value of [iam_config][crate::model::Bucket::iam_config].
9947    pub fn set_or_clear_iam_config<T>(mut self, v: std::option::Option<T>) -> Self
9948    where
9949        T: std::convert::Into<crate::model::bucket::IamConfig>,
9950    {
9951        self.iam_config = v.map(|x| x.into());
9952        self
9953    }
9954
9955    /// Sets the value of [satisfies_pzs][crate::model::Bucket::satisfies_pzs].
9956    pub fn set_satisfies_pzs<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
9957        self.satisfies_pzs = v.into();
9958        self
9959    }
9960
9961    /// Sets the value of [custom_placement_config][crate::model::Bucket::custom_placement_config].
9962    pub fn set_custom_placement_config<T>(mut self, v: T) -> Self
9963    where
9964        T: std::convert::Into<crate::model::bucket::CustomPlacementConfig>,
9965    {
9966        self.custom_placement_config = std::option::Option::Some(v.into());
9967        self
9968    }
9969
9970    /// Sets or clears the value of [custom_placement_config][crate::model::Bucket::custom_placement_config].
9971    pub fn set_or_clear_custom_placement_config<T>(mut self, v: std::option::Option<T>) -> Self
9972    where
9973        T: std::convert::Into<crate::model::bucket::CustomPlacementConfig>,
9974    {
9975        self.custom_placement_config = v.map(|x| x.into());
9976        self
9977    }
9978
9979    /// Sets the value of [autoclass][crate::model::Bucket::autoclass].
9980    pub fn set_autoclass<T>(mut self, v: T) -> Self
9981    where
9982        T: std::convert::Into<crate::model::bucket::Autoclass>,
9983    {
9984        self.autoclass = std::option::Option::Some(v.into());
9985        self
9986    }
9987
9988    /// Sets or clears the value of [autoclass][crate::model::Bucket::autoclass].
9989    pub fn set_or_clear_autoclass<T>(mut self, v: std::option::Option<T>) -> Self
9990    where
9991        T: std::convert::Into<crate::model::bucket::Autoclass>,
9992    {
9993        self.autoclass = v.map(|x| x.into());
9994        self
9995    }
9996
9997    /// Sets the value of [hierarchical_namespace][crate::model::Bucket::hierarchical_namespace].
9998    pub fn set_hierarchical_namespace<T>(mut self, v: T) -> Self
9999    where
10000        T: std::convert::Into<crate::model::bucket::HierarchicalNamespace>,
10001    {
10002        self.hierarchical_namespace = std::option::Option::Some(v.into());
10003        self
10004    }
10005
10006    /// Sets or clears the value of [hierarchical_namespace][crate::model::Bucket::hierarchical_namespace].
10007    pub fn set_or_clear_hierarchical_namespace<T>(mut self, v: std::option::Option<T>) -> Self
10008    where
10009        T: std::convert::Into<crate::model::bucket::HierarchicalNamespace>,
10010    {
10011        self.hierarchical_namespace = v.map(|x| x.into());
10012        self
10013    }
10014
10015    /// Sets the value of [soft_delete_policy][crate::model::Bucket::soft_delete_policy].
10016    pub fn set_soft_delete_policy<T>(mut self, v: T) -> Self
10017    where
10018        T: std::convert::Into<crate::model::bucket::SoftDeletePolicy>,
10019    {
10020        self.soft_delete_policy = std::option::Option::Some(v.into());
10021        self
10022    }
10023
10024    /// Sets or clears the value of [soft_delete_policy][crate::model::Bucket::soft_delete_policy].
10025    pub fn set_or_clear_soft_delete_policy<T>(mut self, v: std::option::Option<T>) -> Self
10026    where
10027        T: std::convert::Into<crate::model::bucket::SoftDeletePolicy>,
10028    {
10029        self.soft_delete_policy = v.map(|x| x.into());
10030        self
10031    }
10032
10033    /// Sets the value of [object_retention][crate::model::Bucket::object_retention].
10034    pub fn set_object_retention<T>(mut self, v: T) -> Self
10035    where
10036        T: std::convert::Into<crate::model::bucket::ObjectRetention>,
10037    {
10038        self.object_retention = std::option::Option::Some(v.into());
10039        self
10040    }
10041
10042    /// Sets or clears the value of [object_retention][crate::model::Bucket::object_retention].
10043    pub fn set_or_clear_object_retention<T>(mut self, v: std::option::Option<T>) -> Self
10044    where
10045        T: std::convert::Into<crate::model::bucket::ObjectRetention>,
10046    {
10047        self.object_retention = v.map(|x| x.into());
10048        self
10049    }
10050
10051    /// Sets the value of [ip_filter][crate::model::Bucket::ip_filter].
10052    pub fn set_ip_filter<T>(mut self, v: T) -> Self
10053    where
10054        T: std::convert::Into<crate::model::bucket::IpFilter>,
10055    {
10056        self.ip_filter = std::option::Option::Some(v.into());
10057        self
10058    }
10059
10060    /// Sets or clears the value of [ip_filter][crate::model::Bucket::ip_filter].
10061    pub fn set_or_clear_ip_filter<T>(mut self, v: std::option::Option<T>) -> Self
10062    where
10063        T: std::convert::Into<crate::model::bucket::IpFilter>,
10064    {
10065        self.ip_filter = v.map(|x| x.into());
10066        self
10067    }
10068}
10069
10070impl wkt::message::Message for Bucket {
10071    fn typename() -> &'static str {
10072        "type.googleapis.com/google.storage.v2.Bucket"
10073    }
10074}
10075
10076#[doc(hidden)]
10077impl<'de> serde::de::Deserialize<'de> for Bucket {
10078    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
10079    where
10080        D: serde::Deserializer<'de>,
10081    {
10082        #[allow(non_camel_case_types)]
10083        #[doc(hidden)]
10084        #[derive(PartialEq, Eq, Hash)]
10085        enum __FieldTag {
10086            __name,
10087            __bucket_id,
10088            __etag,
10089            __project,
10090            __metageneration,
10091            __location,
10092            __location_type,
10093            __storage_class,
10094            __rpo,
10095            __acl,
10096            __default_object_acl,
10097            __lifecycle,
10098            __create_time,
10099            __cors,
10100            __update_time,
10101            __default_event_based_hold,
10102            __labels,
10103            __website,
10104            __versioning,
10105            __logging,
10106            __owner,
10107            __encryption,
10108            __billing,
10109            __retention_policy,
10110            __iam_config,
10111            __satisfies_pzs,
10112            __custom_placement_config,
10113            __autoclass,
10114            __hierarchical_namespace,
10115            __soft_delete_policy,
10116            __object_retention,
10117            __ip_filter,
10118            Unknown(std::string::String),
10119        }
10120        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
10121            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
10122            where
10123                D: serde::Deserializer<'de>,
10124            {
10125                struct Visitor;
10126                impl<'de> serde::de::Visitor<'de> for Visitor {
10127                    type Value = __FieldTag;
10128                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
10129                        formatter.write_str("a field name for Bucket")
10130                    }
10131                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
10132                    where
10133                        E: serde::de::Error,
10134                    {
10135                        use std::result::Result::Ok;
10136                        use std::string::ToString;
10137                        match value {
10138                            "name" => Ok(__FieldTag::__name),
10139                            "bucketId" => Ok(__FieldTag::__bucket_id),
10140                            "bucket_id" => Ok(__FieldTag::__bucket_id),
10141                            "etag" => Ok(__FieldTag::__etag),
10142                            "project" => Ok(__FieldTag::__project),
10143                            "metageneration" => Ok(__FieldTag::__metageneration),
10144                            "location" => Ok(__FieldTag::__location),
10145                            "locationType" => Ok(__FieldTag::__location_type),
10146                            "location_type" => Ok(__FieldTag::__location_type),
10147                            "storageClass" => Ok(__FieldTag::__storage_class),
10148                            "storage_class" => Ok(__FieldTag::__storage_class),
10149                            "rpo" => Ok(__FieldTag::__rpo),
10150                            "acl" => Ok(__FieldTag::__acl),
10151                            "defaultObjectAcl" => Ok(__FieldTag::__default_object_acl),
10152                            "default_object_acl" => Ok(__FieldTag::__default_object_acl),
10153                            "lifecycle" => Ok(__FieldTag::__lifecycle),
10154                            "createTime" => Ok(__FieldTag::__create_time),
10155                            "create_time" => Ok(__FieldTag::__create_time),
10156                            "cors" => Ok(__FieldTag::__cors),
10157                            "updateTime" => Ok(__FieldTag::__update_time),
10158                            "update_time" => Ok(__FieldTag::__update_time),
10159                            "defaultEventBasedHold" => Ok(__FieldTag::__default_event_based_hold),
10160                            "default_event_based_hold" => {
10161                                Ok(__FieldTag::__default_event_based_hold)
10162                            }
10163                            "labels" => Ok(__FieldTag::__labels),
10164                            "website" => Ok(__FieldTag::__website),
10165                            "versioning" => Ok(__FieldTag::__versioning),
10166                            "logging" => Ok(__FieldTag::__logging),
10167                            "owner" => Ok(__FieldTag::__owner),
10168                            "encryption" => Ok(__FieldTag::__encryption),
10169                            "billing" => Ok(__FieldTag::__billing),
10170                            "retentionPolicy" => Ok(__FieldTag::__retention_policy),
10171                            "retention_policy" => Ok(__FieldTag::__retention_policy),
10172                            "iamConfig" => Ok(__FieldTag::__iam_config),
10173                            "iam_config" => Ok(__FieldTag::__iam_config),
10174                            "satisfiesPzs" => Ok(__FieldTag::__satisfies_pzs),
10175                            "satisfies_pzs" => Ok(__FieldTag::__satisfies_pzs),
10176                            "customPlacementConfig" => Ok(__FieldTag::__custom_placement_config),
10177                            "custom_placement_config" => Ok(__FieldTag::__custom_placement_config),
10178                            "autoclass" => Ok(__FieldTag::__autoclass),
10179                            "hierarchicalNamespace" => Ok(__FieldTag::__hierarchical_namespace),
10180                            "hierarchical_namespace" => Ok(__FieldTag::__hierarchical_namespace),
10181                            "softDeletePolicy" => Ok(__FieldTag::__soft_delete_policy),
10182                            "soft_delete_policy" => Ok(__FieldTag::__soft_delete_policy),
10183                            "objectRetention" => Ok(__FieldTag::__object_retention),
10184                            "object_retention" => Ok(__FieldTag::__object_retention),
10185                            "ipFilter" => Ok(__FieldTag::__ip_filter),
10186                            "ip_filter" => Ok(__FieldTag::__ip_filter),
10187                            _ => Ok(__FieldTag::Unknown(value.to_string())),
10188                        }
10189                    }
10190                }
10191                deserializer.deserialize_identifier(Visitor)
10192            }
10193        }
10194        struct Visitor;
10195        impl<'de> serde::de::Visitor<'de> for Visitor {
10196            type Value = Bucket;
10197            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
10198                formatter.write_str("struct Bucket")
10199            }
10200            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
10201            where
10202                A: serde::de::MapAccess<'de>,
10203            {
10204                #[allow(unused_imports)]
10205                use serde::de::Error;
10206                use std::option::Option::Some;
10207                let mut fields = std::collections::HashSet::new();
10208                let mut result = Self::Value::new();
10209                while let Some(tag) = map.next_key::<__FieldTag>()? {
10210                    #[allow(clippy::match_single_binding)]
10211                    match tag {
10212                        __FieldTag::__name => {
10213                            if !fields.insert(__FieldTag::__name) {
10214                                return std::result::Result::Err(A::Error::duplicate_field(
10215                                    "multiple values for name",
10216                                ));
10217                            }
10218                            result.name = map
10219                                .next_value::<std::option::Option<std::string::String>>()?
10220                                .unwrap_or_default();
10221                        }
10222                        __FieldTag::__bucket_id => {
10223                            if !fields.insert(__FieldTag::__bucket_id) {
10224                                return std::result::Result::Err(A::Error::duplicate_field(
10225                                    "multiple values for bucket_id",
10226                                ));
10227                            }
10228                            result.bucket_id = map
10229                                .next_value::<std::option::Option<std::string::String>>()?
10230                                .unwrap_or_default();
10231                        }
10232                        __FieldTag::__etag => {
10233                            if !fields.insert(__FieldTag::__etag) {
10234                                return std::result::Result::Err(A::Error::duplicate_field(
10235                                    "multiple values for etag",
10236                                ));
10237                            }
10238                            result.etag = map
10239                                .next_value::<std::option::Option<std::string::String>>()?
10240                                .unwrap_or_default();
10241                        }
10242                        __FieldTag::__project => {
10243                            if !fields.insert(__FieldTag::__project) {
10244                                return std::result::Result::Err(A::Error::duplicate_field(
10245                                    "multiple values for project",
10246                                ));
10247                            }
10248                            result.project = map
10249                                .next_value::<std::option::Option<std::string::String>>()?
10250                                .unwrap_or_default();
10251                        }
10252                        __FieldTag::__metageneration => {
10253                            if !fields.insert(__FieldTag::__metageneration) {
10254                                return std::result::Result::Err(A::Error::duplicate_field(
10255                                    "multiple values for metageneration",
10256                                ));
10257                            }
10258                            struct __With(std::option::Option<i64>);
10259                            impl<'de> serde::de::Deserialize<'de> for __With {
10260                                fn deserialize<D>(
10261                                    deserializer: D,
10262                                ) -> std::result::Result<Self, D::Error>
10263                                where
10264                                    D: serde::de::Deserializer<'de>,
10265                                {
10266                                    serde_with::As::< std::option::Option<wkt::internal::I64> >::deserialize(deserializer).map(__With)
10267                                }
10268                            }
10269                            result.metageneration =
10270                                map.next_value::<__With>()?.0.unwrap_or_default();
10271                        }
10272                        __FieldTag::__location => {
10273                            if !fields.insert(__FieldTag::__location) {
10274                                return std::result::Result::Err(A::Error::duplicate_field(
10275                                    "multiple values for location",
10276                                ));
10277                            }
10278                            result.location = map
10279                                .next_value::<std::option::Option<std::string::String>>()?
10280                                .unwrap_or_default();
10281                        }
10282                        __FieldTag::__location_type => {
10283                            if !fields.insert(__FieldTag::__location_type) {
10284                                return std::result::Result::Err(A::Error::duplicate_field(
10285                                    "multiple values for location_type",
10286                                ));
10287                            }
10288                            result.location_type = map
10289                                .next_value::<std::option::Option<std::string::String>>()?
10290                                .unwrap_or_default();
10291                        }
10292                        __FieldTag::__storage_class => {
10293                            if !fields.insert(__FieldTag::__storage_class) {
10294                                return std::result::Result::Err(A::Error::duplicate_field(
10295                                    "multiple values for storage_class",
10296                                ));
10297                            }
10298                            result.storage_class = map
10299                                .next_value::<std::option::Option<std::string::String>>()?
10300                                .unwrap_or_default();
10301                        }
10302                        __FieldTag::__rpo => {
10303                            if !fields.insert(__FieldTag::__rpo) {
10304                                return std::result::Result::Err(A::Error::duplicate_field(
10305                                    "multiple values for rpo",
10306                                ));
10307                            }
10308                            result.rpo = map
10309                                .next_value::<std::option::Option<std::string::String>>()?
10310                                .unwrap_or_default();
10311                        }
10312                        __FieldTag::__acl => {
10313                            if !fields.insert(__FieldTag::__acl) {
10314                                return std::result::Result::Err(A::Error::duplicate_field(
10315                                    "multiple values for acl",
10316                                ));
10317                            }
10318                            result.acl = map
10319                                .next_value::<std::option::Option<
10320                                    std::vec::Vec<crate::model::BucketAccessControl>,
10321                                >>()?
10322                                .unwrap_or_default();
10323                        }
10324                        __FieldTag::__default_object_acl => {
10325                            if !fields.insert(__FieldTag::__default_object_acl) {
10326                                return std::result::Result::Err(A::Error::duplicate_field(
10327                                    "multiple values for default_object_acl",
10328                                ));
10329                            }
10330                            result.default_object_acl = map
10331                                .next_value::<std::option::Option<
10332                                    std::vec::Vec<crate::model::ObjectAccessControl>,
10333                                >>()?
10334                                .unwrap_or_default();
10335                        }
10336                        __FieldTag::__lifecycle => {
10337                            if !fields.insert(__FieldTag::__lifecycle) {
10338                                return std::result::Result::Err(A::Error::duplicate_field(
10339                                    "multiple values for lifecycle",
10340                                ));
10341                            }
10342                            result.lifecycle = map
10343                                .next_value::<std::option::Option<crate::model::bucket::Lifecycle>>(
10344                                )?;
10345                        }
10346                        __FieldTag::__create_time => {
10347                            if !fields.insert(__FieldTag::__create_time) {
10348                                return std::result::Result::Err(A::Error::duplicate_field(
10349                                    "multiple values for create_time",
10350                                ));
10351                            }
10352                            result.create_time =
10353                                map.next_value::<std::option::Option<wkt::Timestamp>>()?;
10354                        }
10355                        __FieldTag::__cors => {
10356                            if !fields.insert(__FieldTag::__cors) {
10357                                return std::result::Result::Err(A::Error::duplicate_field(
10358                                    "multiple values for cors",
10359                                ));
10360                            }
10361                            result.cors = map.next_value::<std::option::Option<std::vec::Vec<crate::model::bucket::Cors>>>()?.unwrap_or_default();
10362                        }
10363                        __FieldTag::__update_time => {
10364                            if !fields.insert(__FieldTag::__update_time) {
10365                                return std::result::Result::Err(A::Error::duplicate_field(
10366                                    "multiple values for update_time",
10367                                ));
10368                            }
10369                            result.update_time =
10370                                map.next_value::<std::option::Option<wkt::Timestamp>>()?;
10371                        }
10372                        __FieldTag::__default_event_based_hold => {
10373                            if !fields.insert(__FieldTag::__default_event_based_hold) {
10374                                return std::result::Result::Err(A::Error::duplicate_field(
10375                                    "multiple values for default_event_based_hold",
10376                                ));
10377                            }
10378                            result.default_event_based_hold = map
10379                                .next_value::<std::option::Option<bool>>()?
10380                                .unwrap_or_default();
10381                        }
10382                        __FieldTag::__labels => {
10383                            if !fields.insert(__FieldTag::__labels) {
10384                                return std::result::Result::Err(A::Error::duplicate_field(
10385                                    "multiple values for labels",
10386                                ));
10387                            }
10388                            result.labels = map
10389                                .next_value::<std::option::Option<
10390                                    std::collections::HashMap<
10391                                        std::string::String,
10392                                        std::string::String,
10393                                    >,
10394                                >>()?
10395                                .unwrap_or_default();
10396                        }
10397                        __FieldTag::__website => {
10398                            if !fields.insert(__FieldTag::__website) {
10399                                return std::result::Result::Err(A::Error::duplicate_field(
10400                                    "multiple values for website",
10401                                ));
10402                            }
10403                            result.website = map
10404                                .next_value::<std::option::Option<crate::model::bucket::Website>>(
10405                                )?;
10406                        }
10407                        __FieldTag::__versioning => {
10408                            if !fields.insert(__FieldTag::__versioning) {
10409                                return std::result::Result::Err(A::Error::duplicate_field(
10410                                    "multiple values for versioning",
10411                                ));
10412                            }
10413                            result.versioning = map.next_value::<std::option::Option<crate::model::bucket::Versioning>>()?
10414                                ;
10415                        }
10416                        __FieldTag::__logging => {
10417                            if !fields.insert(__FieldTag::__logging) {
10418                                return std::result::Result::Err(A::Error::duplicate_field(
10419                                    "multiple values for logging",
10420                                ));
10421                            }
10422                            result.logging = map
10423                                .next_value::<std::option::Option<crate::model::bucket::Logging>>(
10424                                )?;
10425                        }
10426                        __FieldTag::__owner => {
10427                            if !fields.insert(__FieldTag::__owner) {
10428                                return std::result::Result::Err(A::Error::duplicate_field(
10429                                    "multiple values for owner",
10430                                ));
10431                            }
10432                            result.owner =
10433                                map.next_value::<std::option::Option<crate::model::Owner>>()?;
10434                        }
10435                        __FieldTag::__encryption => {
10436                            if !fields.insert(__FieldTag::__encryption) {
10437                                return std::result::Result::Err(A::Error::duplicate_field(
10438                                    "multiple values for encryption",
10439                                ));
10440                            }
10441                            result.encryption = map.next_value::<std::option::Option<crate::model::bucket::Encryption>>()?
10442                                ;
10443                        }
10444                        __FieldTag::__billing => {
10445                            if !fields.insert(__FieldTag::__billing) {
10446                                return std::result::Result::Err(A::Error::duplicate_field(
10447                                    "multiple values for billing",
10448                                ));
10449                            }
10450                            result.billing = map
10451                                .next_value::<std::option::Option<crate::model::bucket::Billing>>(
10452                                )?;
10453                        }
10454                        __FieldTag::__retention_policy => {
10455                            if !fields.insert(__FieldTag::__retention_policy) {
10456                                return std::result::Result::Err(A::Error::duplicate_field(
10457                                    "multiple values for retention_policy",
10458                                ));
10459                            }
10460                            result.retention_policy = map.next_value::<std::option::Option<crate::model::bucket::RetentionPolicy>>()?
10461                                ;
10462                        }
10463                        __FieldTag::__iam_config => {
10464                            if !fields.insert(__FieldTag::__iam_config) {
10465                                return std::result::Result::Err(A::Error::duplicate_field(
10466                                    "multiple values for iam_config",
10467                                ));
10468                            }
10469                            result.iam_config = map
10470                                .next_value::<std::option::Option<crate::model::bucket::IamConfig>>(
10471                                )?;
10472                        }
10473                        __FieldTag::__satisfies_pzs => {
10474                            if !fields.insert(__FieldTag::__satisfies_pzs) {
10475                                return std::result::Result::Err(A::Error::duplicate_field(
10476                                    "multiple values for satisfies_pzs",
10477                                ));
10478                            }
10479                            result.satisfies_pzs = map
10480                                .next_value::<std::option::Option<bool>>()?
10481                                .unwrap_or_default();
10482                        }
10483                        __FieldTag::__custom_placement_config => {
10484                            if !fields.insert(__FieldTag::__custom_placement_config) {
10485                                return std::result::Result::Err(A::Error::duplicate_field(
10486                                    "multiple values for custom_placement_config",
10487                                ));
10488                            }
10489                            result.custom_placement_config =
10490                                map.next_value::<std::option::Option<
10491                                    crate::model::bucket::CustomPlacementConfig,
10492                                >>()?;
10493                        }
10494                        __FieldTag::__autoclass => {
10495                            if !fields.insert(__FieldTag::__autoclass) {
10496                                return std::result::Result::Err(A::Error::duplicate_field(
10497                                    "multiple values for autoclass",
10498                                ));
10499                            }
10500                            result.autoclass = map
10501                                .next_value::<std::option::Option<crate::model::bucket::Autoclass>>(
10502                                )?;
10503                        }
10504                        __FieldTag::__hierarchical_namespace => {
10505                            if !fields.insert(__FieldTag::__hierarchical_namespace) {
10506                                return std::result::Result::Err(A::Error::duplicate_field(
10507                                    "multiple values for hierarchical_namespace",
10508                                ));
10509                            }
10510                            result.hierarchical_namespace =
10511                                map.next_value::<std::option::Option<
10512                                    crate::model::bucket::HierarchicalNamespace,
10513                                >>()?;
10514                        }
10515                        __FieldTag::__soft_delete_policy => {
10516                            if !fields.insert(__FieldTag::__soft_delete_policy) {
10517                                return std::result::Result::Err(A::Error::duplicate_field(
10518                                    "multiple values for soft_delete_policy",
10519                                ));
10520                            }
10521                            result.soft_delete_policy = map.next_value::<std::option::Option<crate::model::bucket::SoftDeletePolicy>>()?
10522                                ;
10523                        }
10524                        __FieldTag::__object_retention => {
10525                            if !fields.insert(__FieldTag::__object_retention) {
10526                                return std::result::Result::Err(A::Error::duplicate_field(
10527                                    "multiple values for object_retention",
10528                                ));
10529                            }
10530                            result.object_retention = map.next_value::<std::option::Option<crate::model::bucket::ObjectRetention>>()?
10531                                ;
10532                        }
10533                        __FieldTag::__ip_filter => {
10534                            if !fields.insert(__FieldTag::__ip_filter) {
10535                                return std::result::Result::Err(A::Error::duplicate_field(
10536                                    "multiple values for ip_filter",
10537                                ));
10538                            }
10539                            result.ip_filter = map
10540                                .next_value::<std::option::Option<crate::model::bucket::IpFilter>>(
10541                                )?;
10542                        }
10543                        __FieldTag::Unknown(key) => {
10544                            let value = map.next_value::<serde_json::Value>()?;
10545                            result._unknown_fields.insert(key, value);
10546                        }
10547                    }
10548                }
10549                std::result::Result::Ok(result)
10550            }
10551        }
10552        deserializer.deserialize_any(Visitor)
10553    }
10554}
10555
10556#[doc(hidden)]
10557impl serde::ser::Serialize for Bucket {
10558    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
10559    where
10560        S: serde::ser::Serializer,
10561    {
10562        use serde::ser::SerializeMap;
10563        #[allow(unused_imports)]
10564        use std::option::Option::Some;
10565        let mut state = serializer.serialize_map(std::option::Option::None)?;
10566        if !self.name.is_empty() {
10567            state.serialize_entry("name", &self.name)?;
10568        }
10569        if !self.bucket_id.is_empty() {
10570            state.serialize_entry("bucketId", &self.bucket_id)?;
10571        }
10572        if !self.etag.is_empty() {
10573            state.serialize_entry("etag", &self.etag)?;
10574        }
10575        if !self.project.is_empty() {
10576            state.serialize_entry("project", &self.project)?;
10577        }
10578        if !wkt::internal::is_default(&self.metageneration) {
10579            struct __With<'a>(&'a i64);
10580            impl<'a> serde::ser::Serialize for __With<'a> {
10581                fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
10582                where
10583                    S: serde::ser::Serializer,
10584                {
10585                    serde_with::As::<wkt::internal::I64>::serialize(self.0, serializer)
10586                }
10587            }
10588            state.serialize_entry("metageneration", &__With(&self.metageneration))?;
10589        }
10590        if !self.location.is_empty() {
10591            state.serialize_entry("location", &self.location)?;
10592        }
10593        if !self.location_type.is_empty() {
10594            state.serialize_entry("locationType", &self.location_type)?;
10595        }
10596        if !self.storage_class.is_empty() {
10597            state.serialize_entry("storageClass", &self.storage_class)?;
10598        }
10599        if !self.rpo.is_empty() {
10600            state.serialize_entry("rpo", &self.rpo)?;
10601        }
10602        if !self.acl.is_empty() {
10603            state.serialize_entry("acl", &self.acl)?;
10604        }
10605        if !self.default_object_acl.is_empty() {
10606            state.serialize_entry("defaultObjectAcl", &self.default_object_acl)?;
10607        }
10608        if self.lifecycle.is_some() {
10609            state.serialize_entry("lifecycle", &self.lifecycle)?;
10610        }
10611        if self.create_time.is_some() {
10612            state.serialize_entry("createTime", &self.create_time)?;
10613        }
10614        if !self.cors.is_empty() {
10615            state.serialize_entry("cors", &self.cors)?;
10616        }
10617        if self.update_time.is_some() {
10618            state.serialize_entry("updateTime", &self.update_time)?;
10619        }
10620        if !wkt::internal::is_default(&self.default_event_based_hold) {
10621            state.serialize_entry("defaultEventBasedHold", &self.default_event_based_hold)?;
10622        }
10623        if !self.labels.is_empty() {
10624            state.serialize_entry("labels", &self.labels)?;
10625        }
10626        if self.website.is_some() {
10627            state.serialize_entry("website", &self.website)?;
10628        }
10629        if self.versioning.is_some() {
10630            state.serialize_entry("versioning", &self.versioning)?;
10631        }
10632        if self.logging.is_some() {
10633            state.serialize_entry("logging", &self.logging)?;
10634        }
10635        if self.owner.is_some() {
10636            state.serialize_entry("owner", &self.owner)?;
10637        }
10638        if self.encryption.is_some() {
10639            state.serialize_entry("encryption", &self.encryption)?;
10640        }
10641        if self.billing.is_some() {
10642            state.serialize_entry("billing", &self.billing)?;
10643        }
10644        if self.retention_policy.is_some() {
10645            state.serialize_entry("retentionPolicy", &self.retention_policy)?;
10646        }
10647        if self.iam_config.is_some() {
10648            state.serialize_entry("iamConfig", &self.iam_config)?;
10649        }
10650        if !wkt::internal::is_default(&self.satisfies_pzs) {
10651            state.serialize_entry("satisfiesPzs", &self.satisfies_pzs)?;
10652        }
10653        if self.custom_placement_config.is_some() {
10654            state.serialize_entry("customPlacementConfig", &self.custom_placement_config)?;
10655        }
10656        if self.autoclass.is_some() {
10657            state.serialize_entry("autoclass", &self.autoclass)?;
10658        }
10659        if self.hierarchical_namespace.is_some() {
10660            state.serialize_entry("hierarchicalNamespace", &self.hierarchical_namespace)?;
10661        }
10662        if self.soft_delete_policy.is_some() {
10663            state.serialize_entry("softDeletePolicy", &self.soft_delete_policy)?;
10664        }
10665        if self.object_retention.is_some() {
10666            state.serialize_entry("objectRetention", &self.object_retention)?;
10667        }
10668        if self.ip_filter.is_some() {
10669            state.serialize_entry("ipFilter", &self.ip_filter)?;
10670        }
10671        if !self._unknown_fields.is_empty() {
10672            for (key, value) in self._unknown_fields.iter() {
10673                state.serialize_entry(key, &value)?;
10674            }
10675        }
10676        state.end()
10677    }
10678}
10679
10680impl std::fmt::Debug for Bucket {
10681    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
10682        let mut debug_struct = f.debug_struct("Bucket");
10683        debug_struct.field("name", &self.name);
10684        debug_struct.field("bucket_id", &self.bucket_id);
10685        debug_struct.field("etag", &self.etag);
10686        debug_struct.field("project", &self.project);
10687        debug_struct.field("metageneration", &self.metageneration);
10688        debug_struct.field("location", &self.location);
10689        debug_struct.field("location_type", &self.location_type);
10690        debug_struct.field("storage_class", &self.storage_class);
10691        debug_struct.field("rpo", &self.rpo);
10692        debug_struct.field("acl", &self.acl);
10693        debug_struct.field("default_object_acl", &self.default_object_acl);
10694        debug_struct.field("lifecycle", &self.lifecycle);
10695        debug_struct.field("create_time", &self.create_time);
10696        debug_struct.field("cors", &self.cors);
10697        debug_struct.field("update_time", &self.update_time);
10698        debug_struct.field("default_event_based_hold", &self.default_event_based_hold);
10699        debug_struct.field("labels", &self.labels);
10700        debug_struct.field("website", &self.website);
10701        debug_struct.field("versioning", &self.versioning);
10702        debug_struct.field("logging", &self.logging);
10703        debug_struct.field("owner", &self.owner);
10704        debug_struct.field("encryption", &self.encryption);
10705        debug_struct.field("billing", &self.billing);
10706        debug_struct.field("retention_policy", &self.retention_policy);
10707        debug_struct.field("iam_config", &self.iam_config);
10708        debug_struct.field("satisfies_pzs", &self.satisfies_pzs);
10709        debug_struct.field("custom_placement_config", &self.custom_placement_config);
10710        debug_struct.field("autoclass", &self.autoclass);
10711        debug_struct.field("hierarchical_namespace", &self.hierarchical_namespace);
10712        debug_struct.field("soft_delete_policy", &self.soft_delete_policy);
10713        debug_struct.field("object_retention", &self.object_retention);
10714        debug_struct.field("ip_filter", &self.ip_filter);
10715        if !self._unknown_fields.is_empty() {
10716            debug_struct.field("_unknown_fields", &self._unknown_fields);
10717        }
10718        debug_struct.finish()
10719    }
10720}
10721
10722/// Defines additional types related to [Bucket].
10723pub mod bucket {
10724    #[allow(unused_imports)]
10725    use super::*;
10726
10727    /// Billing properties of a bucket.
10728    #[derive(Clone, Default, PartialEq)]
10729    #[non_exhaustive]
10730    pub struct Billing {
10731        /// Optional. When set to true, Requester Pays is enabled for this bucket.
10732        pub requester_pays: bool,
10733
10734        _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
10735    }
10736
10737    impl Billing {
10738        pub fn new() -> Self {
10739            std::default::Default::default()
10740        }
10741
10742        /// Sets the value of [requester_pays][crate::model::bucket::Billing::requester_pays].
10743        pub fn set_requester_pays<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
10744            self.requester_pays = v.into();
10745            self
10746        }
10747    }
10748
10749    impl wkt::message::Message for Billing {
10750        fn typename() -> &'static str {
10751            "type.googleapis.com/google.storage.v2.Bucket.Billing"
10752        }
10753    }
10754
10755    #[doc(hidden)]
10756    impl<'de> serde::de::Deserialize<'de> for Billing {
10757        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
10758        where
10759            D: serde::Deserializer<'de>,
10760        {
10761            #[allow(non_camel_case_types)]
10762            #[doc(hidden)]
10763            #[derive(PartialEq, Eq, Hash)]
10764            enum __FieldTag {
10765                __requester_pays,
10766                Unknown(std::string::String),
10767            }
10768            impl<'de> serde::de::Deserialize<'de> for __FieldTag {
10769                fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
10770                where
10771                    D: serde::Deserializer<'de>,
10772                {
10773                    struct Visitor;
10774                    impl<'de> serde::de::Visitor<'de> for Visitor {
10775                        type Value = __FieldTag;
10776                        fn expecting(
10777                            &self,
10778                            formatter: &mut std::fmt::Formatter,
10779                        ) -> std::fmt::Result {
10780                            formatter.write_str("a field name for Billing")
10781                        }
10782                        fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
10783                        where
10784                            E: serde::de::Error,
10785                        {
10786                            use std::result::Result::Ok;
10787                            use std::string::ToString;
10788                            match value {
10789                                "requesterPays" => Ok(__FieldTag::__requester_pays),
10790                                "requester_pays" => Ok(__FieldTag::__requester_pays),
10791                                _ => Ok(__FieldTag::Unknown(value.to_string())),
10792                            }
10793                        }
10794                    }
10795                    deserializer.deserialize_identifier(Visitor)
10796                }
10797            }
10798            struct Visitor;
10799            impl<'de> serde::de::Visitor<'de> for Visitor {
10800                type Value = Billing;
10801                fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
10802                    formatter.write_str("struct Billing")
10803                }
10804                fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
10805                where
10806                    A: serde::de::MapAccess<'de>,
10807                {
10808                    #[allow(unused_imports)]
10809                    use serde::de::Error;
10810                    use std::option::Option::Some;
10811                    let mut fields = std::collections::HashSet::new();
10812                    let mut result = Self::Value::new();
10813                    while let Some(tag) = map.next_key::<__FieldTag>()? {
10814                        #[allow(clippy::match_single_binding)]
10815                        match tag {
10816                            __FieldTag::__requester_pays => {
10817                                if !fields.insert(__FieldTag::__requester_pays) {
10818                                    return std::result::Result::Err(A::Error::duplicate_field(
10819                                        "multiple values for requester_pays",
10820                                    ));
10821                                }
10822                                result.requester_pays = map
10823                                    .next_value::<std::option::Option<bool>>()?
10824                                    .unwrap_or_default();
10825                            }
10826                            __FieldTag::Unknown(key) => {
10827                                let value = map.next_value::<serde_json::Value>()?;
10828                                result._unknown_fields.insert(key, value);
10829                            }
10830                        }
10831                    }
10832                    std::result::Result::Ok(result)
10833                }
10834            }
10835            deserializer.deserialize_any(Visitor)
10836        }
10837    }
10838
10839    #[doc(hidden)]
10840    impl serde::ser::Serialize for Billing {
10841        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
10842        where
10843            S: serde::ser::Serializer,
10844        {
10845            use serde::ser::SerializeMap;
10846            #[allow(unused_imports)]
10847            use std::option::Option::Some;
10848            let mut state = serializer.serialize_map(std::option::Option::None)?;
10849            if !wkt::internal::is_default(&self.requester_pays) {
10850                state.serialize_entry("requesterPays", &self.requester_pays)?;
10851            }
10852            if !self._unknown_fields.is_empty() {
10853                for (key, value) in self._unknown_fields.iter() {
10854                    state.serialize_entry(key, &value)?;
10855                }
10856            }
10857            state.end()
10858        }
10859    }
10860
10861    impl std::fmt::Debug for Billing {
10862        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
10863            let mut debug_struct = f.debug_struct("Billing");
10864            debug_struct.field("requester_pays", &self.requester_pays);
10865            if !self._unknown_fields.is_empty() {
10866                debug_struct.field("_unknown_fields", &self._unknown_fields);
10867            }
10868            debug_struct.finish()
10869        }
10870    }
10871
10872    /// Cross-Origin Response sharing (CORS) properties for a bucket.
10873    /// For more on Cloud Storage and CORS, see
10874    /// <https://cloud.google.com/storage/docs/cross-origin>.
10875    /// For more on CORS in general, see <https://tools.ietf.org/html/rfc6454>.
10876    #[derive(Clone, Default, PartialEq)]
10877    #[non_exhaustive]
10878    pub struct Cors {
10879        /// Optional. The list of Origins eligible to receive CORS response headers.
10880        /// See [<https://tools.ietf.org/html/rfc6454>][RFC 6454] for more on origins.
10881        /// Note: "*" is permitted in the list of origins, and means "any Origin".
10882        pub origin: std::vec::Vec<std::string::String>,
10883
10884        /// Optional. The list of HTTP methods on which to include CORS response
10885        /// headers,
10886        /// (`GET`, `OPTIONS`, `POST`, etc) Note: "*" is permitted in the list of
10887        /// methods, and means "any method".
10888        pub method: std::vec::Vec<std::string::String>,
10889
10890        /// Optional. The list of HTTP headers other than the
10891        /// [<https://www.w3.org/TR/cors/#simple-response-header>][simple response
10892        /// headers] to give permission for the user-agent to share across domains.
10893        pub response_header: std::vec::Vec<std::string::String>,
10894
10895        /// Optional. The value, in seconds, to return in the
10896        /// [<https://www.w3.org/TR/cors/#access-control-max-age-response-header>][Access-Control-Max-Age
10897        /// header] used in preflight responses.
10898        pub max_age_seconds: i32,
10899
10900        _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
10901    }
10902
10903    impl Cors {
10904        pub fn new() -> Self {
10905            std::default::Default::default()
10906        }
10907
10908        /// Sets the value of [origin][crate::model::bucket::Cors::origin].
10909        pub fn set_origin<T, V>(mut self, v: T) -> Self
10910        where
10911            T: std::iter::IntoIterator<Item = V>,
10912            V: std::convert::Into<std::string::String>,
10913        {
10914            use std::iter::Iterator;
10915            self.origin = v.into_iter().map(|i| i.into()).collect();
10916            self
10917        }
10918
10919        /// Sets the value of [method][crate::model::bucket::Cors::method].
10920        pub fn set_method<T, V>(mut self, v: T) -> Self
10921        where
10922            T: std::iter::IntoIterator<Item = V>,
10923            V: std::convert::Into<std::string::String>,
10924        {
10925            use std::iter::Iterator;
10926            self.method = v.into_iter().map(|i| i.into()).collect();
10927            self
10928        }
10929
10930        /// Sets the value of [response_header][crate::model::bucket::Cors::response_header].
10931        pub fn set_response_header<T, V>(mut self, v: T) -> Self
10932        where
10933            T: std::iter::IntoIterator<Item = V>,
10934            V: std::convert::Into<std::string::String>,
10935        {
10936            use std::iter::Iterator;
10937            self.response_header = v.into_iter().map(|i| i.into()).collect();
10938            self
10939        }
10940
10941        /// Sets the value of [max_age_seconds][crate::model::bucket::Cors::max_age_seconds].
10942        pub fn set_max_age_seconds<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
10943            self.max_age_seconds = v.into();
10944            self
10945        }
10946    }
10947
10948    impl wkt::message::Message for Cors {
10949        fn typename() -> &'static str {
10950            "type.googleapis.com/google.storage.v2.Bucket.Cors"
10951        }
10952    }
10953
10954    #[doc(hidden)]
10955    impl<'de> serde::de::Deserialize<'de> for Cors {
10956        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
10957        where
10958            D: serde::Deserializer<'de>,
10959        {
10960            #[allow(non_camel_case_types)]
10961            #[doc(hidden)]
10962            #[derive(PartialEq, Eq, Hash)]
10963            enum __FieldTag {
10964                __origin,
10965                __method,
10966                __response_header,
10967                __max_age_seconds,
10968                Unknown(std::string::String),
10969            }
10970            impl<'de> serde::de::Deserialize<'de> for __FieldTag {
10971                fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
10972                where
10973                    D: serde::Deserializer<'de>,
10974                {
10975                    struct Visitor;
10976                    impl<'de> serde::de::Visitor<'de> for Visitor {
10977                        type Value = __FieldTag;
10978                        fn expecting(
10979                            &self,
10980                            formatter: &mut std::fmt::Formatter,
10981                        ) -> std::fmt::Result {
10982                            formatter.write_str("a field name for Cors")
10983                        }
10984                        fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
10985                        where
10986                            E: serde::de::Error,
10987                        {
10988                            use std::result::Result::Ok;
10989                            use std::string::ToString;
10990                            match value {
10991                                "origin" => Ok(__FieldTag::__origin),
10992                                "method" => Ok(__FieldTag::__method),
10993                                "responseHeader" => Ok(__FieldTag::__response_header),
10994                                "response_header" => Ok(__FieldTag::__response_header),
10995                                "maxAgeSeconds" => Ok(__FieldTag::__max_age_seconds),
10996                                "max_age_seconds" => Ok(__FieldTag::__max_age_seconds),
10997                                _ => Ok(__FieldTag::Unknown(value.to_string())),
10998                            }
10999                        }
11000                    }
11001                    deserializer.deserialize_identifier(Visitor)
11002                }
11003            }
11004            struct Visitor;
11005            impl<'de> serde::de::Visitor<'de> for Visitor {
11006                type Value = Cors;
11007                fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
11008                    formatter.write_str("struct Cors")
11009                }
11010                fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
11011                where
11012                    A: serde::de::MapAccess<'de>,
11013                {
11014                    #[allow(unused_imports)]
11015                    use serde::de::Error;
11016                    use std::option::Option::Some;
11017                    let mut fields = std::collections::HashSet::new();
11018                    let mut result = Self::Value::new();
11019                    while let Some(tag) = map.next_key::<__FieldTag>()? {
11020                        #[allow(clippy::match_single_binding)]
11021                        match tag {
11022                            __FieldTag::__origin => {
11023                                if !fields.insert(__FieldTag::__origin) {
11024                                    return std::result::Result::Err(A::Error::duplicate_field(
11025                                        "multiple values for origin",
11026                                    ));
11027                                }
11028                                result.origin = map.next_value::<std::option::Option<std::vec::Vec<std::string::String>>>()?.unwrap_or_default();
11029                            }
11030                            __FieldTag::__method => {
11031                                if !fields.insert(__FieldTag::__method) {
11032                                    return std::result::Result::Err(A::Error::duplicate_field(
11033                                        "multiple values for method",
11034                                    ));
11035                                }
11036                                result.method = map.next_value::<std::option::Option<std::vec::Vec<std::string::String>>>()?.unwrap_or_default();
11037                            }
11038                            __FieldTag::__response_header => {
11039                                if !fields.insert(__FieldTag::__response_header) {
11040                                    return std::result::Result::Err(A::Error::duplicate_field(
11041                                        "multiple values for response_header",
11042                                    ));
11043                                }
11044                                result.response_header = map.next_value::<std::option::Option<std::vec::Vec<std::string::String>>>()?.unwrap_or_default();
11045                            }
11046                            __FieldTag::__max_age_seconds => {
11047                                if !fields.insert(__FieldTag::__max_age_seconds) {
11048                                    return std::result::Result::Err(A::Error::duplicate_field(
11049                                        "multiple values for max_age_seconds",
11050                                    ));
11051                                }
11052                                struct __With(std::option::Option<i32>);
11053                                impl<'de> serde::de::Deserialize<'de> for __With {
11054                                    fn deserialize<D>(
11055                                        deserializer: D,
11056                                    ) -> std::result::Result<Self, D::Error>
11057                                    where
11058                                        D: serde::de::Deserializer<'de>,
11059                                    {
11060                                        serde_with::As::< std::option::Option<wkt::internal::I32> >::deserialize(deserializer).map(__With)
11061                                    }
11062                                }
11063                                result.max_age_seconds =
11064                                    map.next_value::<__With>()?.0.unwrap_or_default();
11065                            }
11066                            __FieldTag::Unknown(key) => {
11067                                let value = map.next_value::<serde_json::Value>()?;
11068                                result._unknown_fields.insert(key, value);
11069                            }
11070                        }
11071                    }
11072                    std::result::Result::Ok(result)
11073                }
11074            }
11075            deserializer.deserialize_any(Visitor)
11076        }
11077    }
11078
11079    #[doc(hidden)]
11080    impl serde::ser::Serialize for Cors {
11081        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
11082        where
11083            S: serde::ser::Serializer,
11084        {
11085            use serde::ser::SerializeMap;
11086            #[allow(unused_imports)]
11087            use std::option::Option::Some;
11088            let mut state = serializer.serialize_map(std::option::Option::None)?;
11089            if !self.origin.is_empty() {
11090                state.serialize_entry("origin", &self.origin)?;
11091            }
11092            if !self.method.is_empty() {
11093                state.serialize_entry("method", &self.method)?;
11094            }
11095            if !self.response_header.is_empty() {
11096                state.serialize_entry("responseHeader", &self.response_header)?;
11097            }
11098            if !wkt::internal::is_default(&self.max_age_seconds) {
11099                struct __With<'a>(&'a i32);
11100                impl<'a> serde::ser::Serialize for __With<'a> {
11101                    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
11102                    where
11103                        S: serde::ser::Serializer,
11104                    {
11105                        serde_with::As::<wkt::internal::I32>::serialize(self.0, serializer)
11106                    }
11107                }
11108                state.serialize_entry("maxAgeSeconds", &__With(&self.max_age_seconds))?;
11109            }
11110            if !self._unknown_fields.is_empty() {
11111                for (key, value) in self._unknown_fields.iter() {
11112                    state.serialize_entry(key, &value)?;
11113                }
11114            }
11115            state.end()
11116        }
11117    }
11118
11119    impl std::fmt::Debug for Cors {
11120        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
11121            let mut debug_struct = f.debug_struct("Cors");
11122            debug_struct.field("origin", &self.origin);
11123            debug_struct.field("method", &self.method);
11124            debug_struct.field("response_header", &self.response_header);
11125            debug_struct.field("max_age_seconds", &self.max_age_seconds);
11126            if !self._unknown_fields.is_empty() {
11127                debug_struct.field("_unknown_fields", &self._unknown_fields);
11128            }
11129            debug_struct.finish()
11130        }
11131    }
11132
11133    /// Encryption properties of a bucket.
11134    #[derive(Clone, Default, PartialEq)]
11135    #[non_exhaustive]
11136    pub struct Encryption {
11137        /// Optional. The name of the Cloud KMS key that will be used to encrypt
11138        /// objects inserted into this bucket, if no encryption method is specified.
11139        pub default_kms_key: std::string::String,
11140
11141        /// Optional. If omitted, then new objects with GMEK encryption-type is
11142        /// allowed. If set, then new objects created in this bucket must comply with
11143        /// enforcement config. Changing this has no effect on existing objects; it
11144        /// applies to new objects only.
11145        pub google_managed_encryption_enforcement_config: std::option::Option<
11146            crate::model::bucket::encryption::GoogleManagedEncryptionEnforcementConfig,
11147        >,
11148
11149        /// Optional. If omitted, then new objects with CMEK encryption-type is
11150        /// allowed. If set, then new objects created in this bucket must comply with
11151        /// enforcement config. Changing this has no effect on existing objects; it
11152        /// applies to new objects only.
11153        pub customer_managed_encryption_enforcement_config: std::option::Option<
11154            crate::model::bucket::encryption::CustomerManagedEncryptionEnforcementConfig,
11155        >,
11156
11157        /// Optional. If omitted, then new objects with CSEK encryption-type is
11158        /// allowed. If set, then new objects created in this bucket must comply with
11159        /// enforcement config. Changing this has no effect on existing objects; it
11160        /// applies to new objects only.
11161        pub customer_supplied_encryption_enforcement_config: std::option::Option<
11162            crate::model::bucket::encryption::CustomerSuppliedEncryptionEnforcementConfig,
11163        >,
11164
11165        _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
11166    }
11167
11168    impl Encryption {
11169        pub fn new() -> Self {
11170            std::default::Default::default()
11171        }
11172
11173        /// Sets the value of [default_kms_key][crate::model::bucket::Encryption::default_kms_key].
11174        pub fn set_default_kms_key<T: std::convert::Into<std::string::String>>(
11175            mut self,
11176            v: T,
11177        ) -> Self {
11178            self.default_kms_key = v.into();
11179            self
11180        }
11181
11182        /// Sets the value of [google_managed_encryption_enforcement_config][crate::model::bucket::Encryption::google_managed_encryption_enforcement_config].
11183        pub fn set_google_managed_encryption_enforcement_config<T>(mut self, v: T) -> Self
11184        where
11185            T: std::convert::Into<
11186                    crate::model::bucket::encryption::GoogleManagedEncryptionEnforcementConfig,
11187                >,
11188        {
11189            self.google_managed_encryption_enforcement_config = std::option::Option::Some(v.into());
11190            self
11191        }
11192
11193        /// Sets or clears the value of [google_managed_encryption_enforcement_config][crate::model::bucket::Encryption::google_managed_encryption_enforcement_config].
11194        pub fn set_or_clear_google_managed_encryption_enforcement_config<T>(
11195            mut self,
11196            v: std::option::Option<T>,
11197        ) -> Self
11198        where
11199            T: std::convert::Into<
11200                    crate::model::bucket::encryption::GoogleManagedEncryptionEnforcementConfig,
11201                >,
11202        {
11203            self.google_managed_encryption_enforcement_config = v.map(|x| x.into());
11204            self
11205        }
11206
11207        /// Sets the value of [customer_managed_encryption_enforcement_config][crate::model::bucket::Encryption::customer_managed_encryption_enforcement_config].
11208        pub fn set_customer_managed_encryption_enforcement_config<T>(mut self, v: T) -> Self
11209        where
11210            T: std::convert::Into<
11211                    crate::model::bucket::encryption::CustomerManagedEncryptionEnforcementConfig,
11212                >,
11213        {
11214            self.customer_managed_encryption_enforcement_config =
11215                std::option::Option::Some(v.into());
11216            self
11217        }
11218
11219        /// Sets or clears the value of [customer_managed_encryption_enforcement_config][crate::model::bucket::Encryption::customer_managed_encryption_enforcement_config].
11220        pub fn set_or_clear_customer_managed_encryption_enforcement_config<T>(
11221            mut self,
11222            v: std::option::Option<T>,
11223        ) -> Self
11224        where
11225            T: std::convert::Into<
11226                    crate::model::bucket::encryption::CustomerManagedEncryptionEnforcementConfig,
11227                >,
11228        {
11229            self.customer_managed_encryption_enforcement_config = v.map(|x| x.into());
11230            self
11231        }
11232
11233        /// Sets the value of [customer_supplied_encryption_enforcement_config][crate::model::bucket::Encryption::customer_supplied_encryption_enforcement_config].
11234        pub fn set_customer_supplied_encryption_enforcement_config<T>(mut self, v: T) -> Self
11235        where
11236            T: std::convert::Into<
11237                    crate::model::bucket::encryption::CustomerSuppliedEncryptionEnforcementConfig,
11238                >,
11239        {
11240            self.customer_supplied_encryption_enforcement_config =
11241                std::option::Option::Some(v.into());
11242            self
11243        }
11244
11245        /// Sets or clears the value of [customer_supplied_encryption_enforcement_config][crate::model::bucket::Encryption::customer_supplied_encryption_enforcement_config].
11246        pub fn set_or_clear_customer_supplied_encryption_enforcement_config<T>(
11247            mut self,
11248            v: std::option::Option<T>,
11249        ) -> Self
11250        where
11251            T: std::convert::Into<
11252                    crate::model::bucket::encryption::CustomerSuppliedEncryptionEnforcementConfig,
11253                >,
11254        {
11255            self.customer_supplied_encryption_enforcement_config = v.map(|x| x.into());
11256            self
11257        }
11258    }
11259
11260    impl wkt::message::Message for Encryption {
11261        fn typename() -> &'static str {
11262            "type.googleapis.com/google.storage.v2.Bucket.Encryption"
11263        }
11264    }
11265
11266    #[doc(hidden)]
11267    impl<'de> serde::de::Deserialize<'de> for Encryption {
11268        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
11269        where
11270            D: serde::Deserializer<'de>,
11271        {
11272            #[allow(non_camel_case_types)]
11273            #[doc(hidden)]
11274            #[derive(PartialEq, Eq, Hash)]
11275            enum __FieldTag {
11276                __default_kms_key,
11277                __google_managed_encryption_enforcement_config,
11278                __customer_managed_encryption_enforcement_config,
11279                __customer_supplied_encryption_enforcement_config,
11280                Unknown(std::string::String),
11281            }
11282            impl<'de> serde::de::Deserialize<'de> for __FieldTag {
11283                fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
11284                where
11285                    D: serde::Deserializer<'de>,
11286                {
11287                    struct Visitor;
11288                    impl<'de> serde::de::Visitor<'de> for Visitor {
11289                        type Value = __FieldTag;
11290                        fn expecting(
11291                            &self,
11292                            formatter: &mut std::fmt::Formatter,
11293                        ) -> std::fmt::Result {
11294                            formatter.write_str("a field name for Encryption")
11295                        }
11296                        fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
11297                        where
11298                            E: serde::de::Error,
11299                        {
11300                            use std::result::Result::Ok;
11301                            use std::string::ToString;
11302                            match value {
11303                                "defaultKmsKey" => Ok(__FieldTag::__default_kms_key),
11304                                "default_kms_key" => Ok(__FieldTag::__default_kms_key),
11305                                "googleManagedEncryptionEnforcementConfig" => {
11306                                    Ok(__FieldTag::__google_managed_encryption_enforcement_config)
11307                                }
11308                                "google_managed_encryption_enforcement_config" => {
11309                                    Ok(__FieldTag::__google_managed_encryption_enforcement_config)
11310                                }
11311                                "customerManagedEncryptionEnforcementConfig" => {
11312                                    Ok(__FieldTag::__customer_managed_encryption_enforcement_config)
11313                                }
11314                                "customer_managed_encryption_enforcement_config" => {
11315                                    Ok(__FieldTag::__customer_managed_encryption_enforcement_config)
11316                                }
11317                                "customerSuppliedEncryptionEnforcementConfig" => Ok(
11318                                    __FieldTag::__customer_supplied_encryption_enforcement_config,
11319                                ),
11320                                "customer_supplied_encryption_enforcement_config" => Ok(
11321                                    __FieldTag::__customer_supplied_encryption_enforcement_config,
11322                                ),
11323                                _ => Ok(__FieldTag::Unknown(value.to_string())),
11324                            }
11325                        }
11326                    }
11327                    deserializer.deserialize_identifier(Visitor)
11328                }
11329            }
11330            struct Visitor;
11331            impl<'de> serde::de::Visitor<'de> for Visitor {
11332                type Value = Encryption;
11333                fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
11334                    formatter.write_str("struct Encryption")
11335                }
11336                fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
11337                where
11338                    A: serde::de::MapAccess<'de>,
11339                {
11340                    #[allow(unused_imports)]
11341                    use serde::de::Error;
11342                    use std::option::Option::Some;
11343                    let mut fields = std::collections::HashSet::new();
11344                    let mut result = Self::Value::new();
11345                    while let Some(tag) = map.next_key::<__FieldTag>()? {
11346                        #[allow(clippy::match_single_binding)]
11347                        match tag {
11348                            __FieldTag::__default_kms_key => {
11349                                if !fields.insert(__FieldTag::__default_kms_key) {
11350                                    return std::result::Result::Err(A::Error::duplicate_field(
11351                                        "multiple values for default_kms_key",
11352                                    ));
11353                                }
11354                                result.default_kms_key = map
11355                                    .next_value::<std::option::Option<std::string::String>>()?
11356                                    .unwrap_or_default();
11357                            }
11358                            __FieldTag::__google_managed_encryption_enforcement_config => {
11359                                if !fields.insert(
11360                                    __FieldTag::__google_managed_encryption_enforcement_config,
11361                                ) {
11362                                    return std::result::Result::Err(A::Error::duplicate_field(
11363                                        "multiple values for google_managed_encryption_enforcement_config",
11364                                    ));
11365                                }
11366                                result.google_managed_encryption_enforcement_config = map.next_value::<std::option::Option<crate::model::bucket::encryption::GoogleManagedEncryptionEnforcementConfig>>()?
11367                                    ;
11368                            }
11369                            __FieldTag::__customer_managed_encryption_enforcement_config => {
11370                                if !fields.insert(
11371                                    __FieldTag::__customer_managed_encryption_enforcement_config,
11372                                ) {
11373                                    return std::result::Result::Err(A::Error::duplicate_field(
11374                                        "multiple values for customer_managed_encryption_enforcement_config",
11375                                    ));
11376                                }
11377                                result.customer_managed_encryption_enforcement_config = map.next_value::<std::option::Option<crate::model::bucket::encryption::CustomerManagedEncryptionEnforcementConfig>>()?
11378                                    ;
11379                            }
11380                            __FieldTag::__customer_supplied_encryption_enforcement_config => {
11381                                if !fields.insert(
11382                                    __FieldTag::__customer_supplied_encryption_enforcement_config,
11383                                ) {
11384                                    return std::result::Result::Err(A::Error::duplicate_field(
11385                                        "multiple values for customer_supplied_encryption_enforcement_config",
11386                                    ));
11387                                }
11388                                result.customer_supplied_encryption_enforcement_config = map.next_value::<std::option::Option<crate::model::bucket::encryption::CustomerSuppliedEncryptionEnforcementConfig>>()?
11389                                    ;
11390                            }
11391                            __FieldTag::Unknown(key) => {
11392                                let value = map.next_value::<serde_json::Value>()?;
11393                                result._unknown_fields.insert(key, value);
11394                            }
11395                        }
11396                    }
11397                    std::result::Result::Ok(result)
11398                }
11399            }
11400            deserializer.deserialize_any(Visitor)
11401        }
11402    }
11403
11404    #[doc(hidden)]
11405    impl serde::ser::Serialize for Encryption {
11406        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
11407        where
11408            S: serde::ser::Serializer,
11409        {
11410            use serde::ser::SerializeMap;
11411            #[allow(unused_imports)]
11412            use std::option::Option::Some;
11413            let mut state = serializer.serialize_map(std::option::Option::None)?;
11414            if !self.default_kms_key.is_empty() {
11415                state.serialize_entry("defaultKmsKey", &self.default_kms_key)?;
11416            }
11417            if self.google_managed_encryption_enforcement_config.is_some() {
11418                state.serialize_entry(
11419                    "googleManagedEncryptionEnforcementConfig",
11420                    &self.google_managed_encryption_enforcement_config,
11421                )?;
11422            }
11423            if self
11424                .customer_managed_encryption_enforcement_config
11425                .is_some()
11426            {
11427                state.serialize_entry(
11428                    "customerManagedEncryptionEnforcementConfig",
11429                    &self.customer_managed_encryption_enforcement_config,
11430                )?;
11431            }
11432            if self
11433                .customer_supplied_encryption_enforcement_config
11434                .is_some()
11435            {
11436                state.serialize_entry(
11437                    "customerSuppliedEncryptionEnforcementConfig",
11438                    &self.customer_supplied_encryption_enforcement_config,
11439                )?;
11440            }
11441            if !self._unknown_fields.is_empty() {
11442                for (key, value) in self._unknown_fields.iter() {
11443                    state.serialize_entry(key, &value)?;
11444                }
11445            }
11446            state.end()
11447        }
11448    }
11449
11450    impl std::fmt::Debug for Encryption {
11451        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
11452            let mut debug_struct = f.debug_struct("Encryption");
11453            debug_struct.field("default_kms_key", &self.default_kms_key);
11454            debug_struct.field(
11455                "google_managed_encryption_enforcement_config",
11456                &self.google_managed_encryption_enforcement_config,
11457            );
11458            debug_struct.field(
11459                "customer_managed_encryption_enforcement_config",
11460                &self.customer_managed_encryption_enforcement_config,
11461            );
11462            debug_struct.field(
11463                "customer_supplied_encryption_enforcement_config",
11464                &self.customer_supplied_encryption_enforcement_config,
11465            );
11466            if !self._unknown_fields.is_empty() {
11467                debug_struct.field("_unknown_fields", &self._unknown_fields);
11468            }
11469            debug_struct.finish()
11470        }
11471    }
11472
11473    /// Defines additional types related to [Encryption].
11474    pub mod encryption {
11475        #[allow(unused_imports)]
11476        use super::*;
11477
11478        /// Google Managed Encryption (GMEK) enforcement config of a bucket.
11479        #[derive(Clone, Default, PartialEq)]
11480        #[non_exhaustive]
11481        pub struct GoogleManagedEncryptionEnforcementConfig {
11482            /// Restriction mode for google-managed encryption for new objects within
11483            /// the bucket. Valid values are: "NotRestricted", "FullyRestricted".
11484            /// If `NotRestricted` or unset, creation of new objects with
11485            /// google-managed encryption is allowed.
11486            /// If `FullyRestricted`, new objects can't be created using google-managed
11487            /// encryption.
11488            pub restriction_mode: std::option::Option<std::string::String>,
11489
11490            /// Time from which the config was effective. This is service-provided.
11491            pub effective_time: std::option::Option<wkt::Timestamp>,
11492
11493            _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
11494        }
11495
11496        impl GoogleManagedEncryptionEnforcementConfig {
11497            pub fn new() -> Self {
11498                std::default::Default::default()
11499            }
11500
11501            /// Sets the value of [restriction_mode][crate::model::bucket::encryption::GoogleManagedEncryptionEnforcementConfig::restriction_mode].
11502            pub fn set_restriction_mode<T>(mut self, v: T) -> Self
11503            where
11504                T: std::convert::Into<std::string::String>,
11505            {
11506                self.restriction_mode = std::option::Option::Some(v.into());
11507                self
11508            }
11509
11510            /// Sets or clears the value of [restriction_mode][crate::model::bucket::encryption::GoogleManagedEncryptionEnforcementConfig::restriction_mode].
11511            pub fn set_or_clear_restriction_mode<T>(mut self, v: std::option::Option<T>) -> Self
11512            where
11513                T: std::convert::Into<std::string::String>,
11514            {
11515                self.restriction_mode = v.map(|x| x.into());
11516                self
11517            }
11518
11519            /// Sets the value of [effective_time][crate::model::bucket::encryption::GoogleManagedEncryptionEnforcementConfig::effective_time].
11520            pub fn set_effective_time<T>(mut self, v: T) -> Self
11521            where
11522                T: std::convert::Into<wkt::Timestamp>,
11523            {
11524                self.effective_time = std::option::Option::Some(v.into());
11525                self
11526            }
11527
11528            /// Sets or clears the value of [effective_time][crate::model::bucket::encryption::GoogleManagedEncryptionEnforcementConfig::effective_time].
11529            pub fn set_or_clear_effective_time<T>(mut self, v: std::option::Option<T>) -> Self
11530            where
11531                T: std::convert::Into<wkt::Timestamp>,
11532            {
11533                self.effective_time = v.map(|x| x.into());
11534                self
11535            }
11536        }
11537
11538        impl wkt::message::Message for GoogleManagedEncryptionEnforcementConfig {
11539            fn typename() -> &'static str {
11540                "type.googleapis.com/google.storage.v2.Bucket.Encryption.GoogleManagedEncryptionEnforcementConfig"
11541            }
11542        }
11543
11544        #[doc(hidden)]
11545        impl<'de> serde::de::Deserialize<'de> for GoogleManagedEncryptionEnforcementConfig {
11546            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
11547            where
11548                D: serde::Deserializer<'de>,
11549            {
11550                #[allow(non_camel_case_types)]
11551                #[doc(hidden)]
11552                #[derive(PartialEq, Eq, Hash)]
11553                enum __FieldTag {
11554                    __restriction_mode,
11555                    __effective_time,
11556                    Unknown(std::string::String),
11557                }
11558                impl<'de> serde::de::Deserialize<'de> for __FieldTag {
11559                    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
11560                    where
11561                        D: serde::Deserializer<'de>,
11562                    {
11563                        struct Visitor;
11564                        impl<'de> serde::de::Visitor<'de> for Visitor {
11565                            type Value = __FieldTag;
11566                            fn expecting(
11567                                &self,
11568                                formatter: &mut std::fmt::Formatter,
11569                            ) -> std::fmt::Result {
11570                                formatter.write_str(
11571                                    "a field name for GoogleManagedEncryptionEnforcementConfig",
11572                                )
11573                            }
11574                            fn visit_str<E>(
11575                                self,
11576                                value: &str,
11577                            ) -> std::result::Result<Self::Value, E>
11578                            where
11579                                E: serde::de::Error,
11580                            {
11581                                use std::result::Result::Ok;
11582                                use std::string::ToString;
11583                                match value {
11584                                    "restrictionMode" => Ok(__FieldTag::__restriction_mode),
11585                                    "restriction_mode" => Ok(__FieldTag::__restriction_mode),
11586                                    "effectiveTime" => Ok(__FieldTag::__effective_time),
11587                                    "effective_time" => Ok(__FieldTag::__effective_time),
11588                                    _ => Ok(__FieldTag::Unknown(value.to_string())),
11589                                }
11590                            }
11591                        }
11592                        deserializer.deserialize_identifier(Visitor)
11593                    }
11594                }
11595                struct Visitor;
11596                impl<'de> serde::de::Visitor<'de> for Visitor {
11597                    type Value = GoogleManagedEncryptionEnforcementConfig;
11598                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
11599                        formatter.write_str("struct GoogleManagedEncryptionEnforcementConfig")
11600                    }
11601                    fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
11602                    where
11603                        A: serde::de::MapAccess<'de>,
11604                    {
11605                        #[allow(unused_imports)]
11606                        use serde::de::Error;
11607                        use std::option::Option::Some;
11608                        let mut fields = std::collections::HashSet::new();
11609                        let mut result = Self::Value::new();
11610                        while let Some(tag) = map.next_key::<__FieldTag>()? {
11611                            #[allow(clippy::match_single_binding)]
11612                            match tag {
11613                                __FieldTag::__restriction_mode => {
11614                                    if !fields.insert(__FieldTag::__restriction_mode) {
11615                                        return std::result::Result::Err(
11616                                            A::Error::duplicate_field(
11617                                                "multiple values for restriction_mode",
11618                                            ),
11619                                        );
11620                                    }
11621                                    result.restriction_mode = map
11622                                        .next_value::<std::option::Option<std::string::String>>()?;
11623                                }
11624                                __FieldTag::__effective_time => {
11625                                    if !fields.insert(__FieldTag::__effective_time) {
11626                                        return std::result::Result::Err(
11627                                            A::Error::duplicate_field(
11628                                                "multiple values for effective_time",
11629                                            ),
11630                                        );
11631                                    }
11632                                    result.effective_time =
11633                                        map.next_value::<std::option::Option<wkt::Timestamp>>()?;
11634                                }
11635                                __FieldTag::Unknown(key) => {
11636                                    let value = map.next_value::<serde_json::Value>()?;
11637                                    result._unknown_fields.insert(key, value);
11638                                }
11639                            }
11640                        }
11641                        std::result::Result::Ok(result)
11642                    }
11643                }
11644                deserializer.deserialize_any(Visitor)
11645            }
11646        }
11647
11648        #[doc(hidden)]
11649        impl serde::ser::Serialize for GoogleManagedEncryptionEnforcementConfig {
11650            fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
11651            where
11652                S: serde::ser::Serializer,
11653            {
11654                use serde::ser::SerializeMap;
11655                #[allow(unused_imports)]
11656                use std::option::Option::Some;
11657                let mut state = serializer.serialize_map(std::option::Option::None)?;
11658                if self.restriction_mode.is_some() {
11659                    state.serialize_entry("restrictionMode", &self.restriction_mode)?;
11660                }
11661                if self.effective_time.is_some() {
11662                    state.serialize_entry("effectiveTime", &self.effective_time)?;
11663                }
11664                if !self._unknown_fields.is_empty() {
11665                    for (key, value) in self._unknown_fields.iter() {
11666                        state.serialize_entry(key, &value)?;
11667                    }
11668                }
11669                state.end()
11670            }
11671        }
11672
11673        impl std::fmt::Debug for GoogleManagedEncryptionEnforcementConfig {
11674            fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
11675                let mut debug_struct = f.debug_struct("GoogleManagedEncryptionEnforcementConfig");
11676                debug_struct.field("restriction_mode", &self.restriction_mode);
11677                debug_struct.field("effective_time", &self.effective_time);
11678                if !self._unknown_fields.is_empty() {
11679                    debug_struct.field("_unknown_fields", &self._unknown_fields);
11680                }
11681                debug_struct.finish()
11682            }
11683        }
11684
11685        /// Customer Managed Encryption (CMEK) enforcement config of a bucket.
11686        #[derive(Clone, Default, PartialEq)]
11687        #[non_exhaustive]
11688        pub struct CustomerManagedEncryptionEnforcementConfig {
11689            /// Restriction mode for customer-managed encryption for new objects within
11690            /// the bucket. Valid values are: "NotRestricted", "FullyRestricted".
11691            /// If `NotRestricted` or unset, creation of new objects with
11692            /// customer-managed encryption is allowed.
11693            /// If `FullyRestricted`, new objects can't be created using
11694            /// customer-managed encryption.
11695            pub restriction_mode: std::option::Option<std::string::String>,
11696
11697            /// Time from which the config was effective. This is service-provided.
11698            pub effective_time: std::option::Option<wkt::Timestamp>,
11699
11700            _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
11701        }
11702
11703        impl CustomerManagedEncryptionEnforcementConfig {
11704            pub fn new() -> Self {
11705                std::default::Default::default()
11706            }
11707
11708            /// Sets the value of [restriction_mode][crate::model::bucket::encryption::CustomerManagedEncryptionEnforcementConfig::restriction_mode].
11709            pub fn set_restriction_mode<T>(mut self, v: T) -> Self
11710            where
11711                T: std::convert::Into<std::string::String>,
11712            {
11713                self.restriction_mode = std::option::Option::Some(v.into());
11714                self
11715            }
11716
11717            /// Sets or clears the value of [restriction_mode][crate::model::bucket::encryption::CustomerManagedEncryptionEnforcementConfig::restriction_mode].
11718            pub fn set_or_clear_restriction_mode<T>(mut self, v: std::option::Option<T>) -> Self
11719            where
11720                T: std::convert::Into<std::string::String>,
11721            {
11722                self.restriction_mode = v.map(|x| x.into());
11723                self
11724            }
11725
11726            /// Sets the value of [effective_time][crate::model::bucket::encryption::CustomerManagedEncryptionEnforcementConfig::effective_time].
11727            pub fn set_effective_time<T>(mut self, v: T) -> Self
11728            where
11729                T: std::convert::Into<wkt::Timestamp>,
11730            {
11731                self.effective_time = std::option::Option::Some(v.into());
11732                self
11733            }
11734
11735            /// Sets or clears the value of [effective_time][crate::model::bucket::encryption::CustomerManagedEncryptionEnforcementConfig::effective_time].
11736            pub fn set_or_clear_effective_time<T>(mut self, v: std::option::Option<T>) -> Self
11737            where
11738                T: std::convert::Into<wkt::Timestamp>,
11739            {
11740                self.effective_time = v.map(|x| x.into());
11741                self
11742            }
11743        }
11744
11745        impl wkt::message::Message for CustomerManagedEncryptionEnforcementConfig {
11746            fn typename() -> &'static str {
11747                "type.googleapis.com/google.storage.v2.Bucket.Encryption.CustomerManagedEncryptionEnforcementConfig"
11748            }
11749        }
11750
11751        #[doc(hidden)]
11752        impl<'de> serde::de::Deserialize<'de> for CustomerManagedEncryptionEnforcementConfig {
11753            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
11754            where
11755                D: serde::Deserializer<'de>,
11756            {
11757                #[allow(non_camel_case_types)]
11758                #[doc(hidden)]
11759                #[derive(PartialEq, Eq, Hash)]
11760                enum __FieldTag {
11761                    __restriction_mode,
11762                    __effective_time,
11763                    Unknown(std::string::String),
11764                }
11765                impl<'de> serde::de::Deserialize<'de> for __FieldTag {
11766                    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
11767                    where
11768                        D: serde::Deserializer<'de>,
11769                    {
11770                        struct Visitor;
11771                        impl<'de> serde::de::Visitor<'de> for Visitor {
11772                            type Value = __FieldTag;
11773                            fn expecting(
11774                                &self,
11775                                formatter: &mut std::fmt::Formatter,
11776                            ) -> std::fmt::Result {
11777                                formatter.write_str(
11778                                    "a field name for CustomerManagedEncryptionEnforcementConfig",
11779                                )
11780                            }
11781                            fn visit_str<E>(
11782                                self,
11783                                value: &str,
11784                            ) -> std::result::Result<Self::Value, E>
11785                            where
11786                                E: serde::de::Error,
11787                            {
11788                                use std::result::Result::Ok;
11789                                use std::string::ToString;
11790                                match value {
11791                                    "restrictionMode" => Ok(__FieldTag::__restriction_mode),
11792                                    "restriction_mode" => Ok(__FieldTag::__restriction_mode),
11793                                    "effectiveTime" => Ok(__FieldTag::__effective_time),
11794                                    "effective_time" => Ok(__FieldTag::__effective_time),
11795                                    _ => Ok(__FieldTag::Unknown(value.to_string())),
11796                                }
11797                            }
11798                        }
11799                        deserializer.deserialize_identifier(Visitor)
11800                    }
11801                }
11802                struct Visitor;
11803                impl<'de> serde::de::Visitor<'de> for Visitor {
11804                    type Value = CustomerManagedEncryptionEnforcementConfig;
11805                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
11806                        formatter.write_str("struct CustomerManagedEncryptionEnforcementConfig")
11807                    }
11808                    fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
11809                    where
11810                        A: serde::de::MapAccess<'de>,
11811                    {
11812                        #[allow(unused_imports)]
11813                        use serde::de::Error;
11814                        use std::option::Option::Some;
11815                        let mut fields = std::collections::HashSet::new();
11816                        let mut result = Self::Value::new();
11817                        while let Some(tag) = map.next_key::<__FieldTag>()? {
11818                            #[allow(clippy::match_single_binding)]
11819                            match tag {
11820                                __FieldTag::__restriction_mode => {
11821                                    if !fields.insert(__FieldTag::__restriction_mode) {
11822                                        return std::result::Result::Err(
11823                                            A::Error::duplicate_field(
11824                                                "multiple values for restriction_mode",
11825                                            ),
11826                                        );
11827                                    }
11828                                    result.restriction_mode = map
11829                                        .next_value::<std::option::Option<std::string::String>>()?;
11830                                }
11831                                __FieldTag::__effective_time => {
11832                                    if !fields.insert(__FieldTag::__effective_time) {
11833                                        return std::result::Result::Err(
11834                                            A::Error::duplicate_field(
11835                                                "multiple values for effective_time",
11836                                            ),
11837                                        );
11838                                    }
11839                                    result.effective_time =
11840                                        map.next_value::<std::option::Option<wkt::Timestamp>>()?;
11841                                }
11842                                __FieldTag::Unknown(key) => {
11843                                    let value = map.next_value::<serde_json::Value>()?;
11844                                    result._unknown_fields.insert(key, value);
11845                                }
11846                            }
11847                        }
11848                        std::result::Result::Ok(result)
11849                    }
11850                }
11851                deserializer.deserialize_any(Visitor)
11852            }
11853        }
11854
11855        #[doc(hidden)]
11856        impl serde::ser::Serialize for CustomerManagedEncryptionEnforcementConfig {
11857            fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
11858            where
11859                S: serde::ser::Serializer,
11860            {
11861                use serde::ser::SerializeMap;
11862                #[allow(unused_imports)]
11863                use std::option::Option::Some;
11864                let mut state = serializer.serialize_map(std::option::Option::None)?;
11865                if self.restriction_mode.is_some() {
11866                    state.serialize_entry("restrictionMode", &self.restriction_mode)?;
11867                }
11868                if self.effective_time.is_some() {
11869                    state.serialize_entry("effectiveTime", &self.effective_time)?;
11870                }
11871                if !self._unknown_fields.is_empty() {
11872                    for (key, value) in self._unknown_fields.iter() {
11873                        state.serialize_entry(key, &value)?;
11874                    }
11875                }
11876                state.end()
11877            }
11878        }
11879
11880        impl std::fmt::Debug for CustomerManagedEncryptionEnforcementConfig {
11881            fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
11882                let mut debug_struct = f.debug_struct("CustomerManagedEncryptionEnforcementConfig");
11883                debug_struct.field("restriction_mode", &self.restriction_mode);
11884                debug_struct.field("effective_time", &self.effective_time);
11885                if !self._unknown_fields.is_empty() {
11886                    debug_struct.field("_unknown_fields", &self._unknown_fields);
11887                }
11888                debug_struct.finish()
11889            }
11890        }
11891
11892        /// Customer Supplied Encryption (CSEK) enforcement config of a bucket.
11893        #[derive(Clone, Default, PartialEq)]
11894        #[non_exhaustive]
11895        pub struct CustomerSuppliedEncryptionEnforcementConfig {
11896            /// Restriction mode for customer-supplied encryption for new objects
11897            /// within the bucket. Valid values are: "NotRestricted",
11898            /// "FullyRestricted".
11899            /// If `NotRestricted` or unset, creation of new objects with
11900            /// customer-supplied encryption is allowed.
11901            /// If `FullyRestricted`, new objects can't be created using
11902            /// customer-supplied encryption.
11903            pub restriction_mode: std::option::Option<std::string::String>,
11904
11905            /// Time from which the config was effective. This is service-provided.
11906            pub effective_time: std::option::Option<wkt::Timestamp>,
11907
11908            _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
11909        }
11910
11911        impl CustomerSuppliedEncryptionEnforcementConfig {
11912            pub fn new() -> Self {
11913                std::default::Default::default()
11914            }
11915
11916            /// Sets the value of [restriction_mode][crate::model::bucket::encryption::CustomerSuppliedEncryptionEnforcementConfig::restriction_mode].
11917            pub fn set_restriction_mode<T>(mut self, v: T) -> Self
11918            where
11919                T: std::convert::Into<std::string::String>,
11920            {
11921                self.restriction_mode = std::option::Option::Some(v.into());
11922                self
11923            }
11924
11925            /// Sets or clears the value of [restriction_mode][crate::model::bucket::encryption::CustomerSuppliedEncryptionEnforcementConfig::restriction_mode].
11926            pub fn set_or_clear_restriction_mode<T>(mut self, v: std::option::Option<T>) -> Self
11927            where
11928                T: std::convert::Into<std::string::String>,
11929            {
11930                self.restriction_mode = v.map(|x| x.into());
11931                self
11932            }
11933
11934            /// Sets the value of [effective_time][crate::model::bucket::encryption::CustomerSuppliedEncryptionEnforcementConfig::effective_time].
11935            pub fn set_effective_time<T>(mut self, v: T) -> Self
11936            where
11937                T: std::convert::Into<wkt::Timestamp>,
11938            {
11939                self.effective_time = std::option::Option::Some(v.into());
11940                self
11941            }
11942
11943            /// Sets or clears the value of [effective_time][crate::model::bucket::encryption::CustomerSuppliedEncryptionEnforcementConfig::effective_time].
11944            pub fn set_or_clear_effective_time<T>(mut self, v: std::option::Option<T>) -> Self
11945            where
11946                T: std::convert::Into<wkt::Timestamp>,
11947            {
11948                self.effective_time = v.map(|x| x.into());
11949                self
11950            }
11951        }
11952
11953        impl wkt::message::Message for CustomerSuppliedEncryptionEnforcementConfig {
11954            fn typename() -> &'static str {
11955                "type.googleapis.com/google.storage.v2.Bucket.Encryption.CustomerSuppliedEncryptionEnforcementConfig"
11956            }
11957        }
11958
11959        #[doc(hidden)]
11960        impl<'de> serde::de::Deserialize<'de> for CustomerSuppliedEncryptionEnforcementConfig {
11961            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
11962            where
11963                D: serde::Deserializer<'de>,
11964            {
11965                #[allow(non_camel_case_types)]
11966                #[doc(hidden)]
11967                #[derive(PartialEq, Eq, Hash)]
11968                enum __FieldTag {
11969                    __restriction_mode,
11970                    __effective_time,
11971                    Unknown(std::string::String),
11972                }
11973                impl<'de> serde::de::Deserialize<'de> for __FieldTag {
11974                    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
11975                    where
11976                        D: serde::Deserializer<'de>,
11977                    {
11978                        struct Visitor;
11979                        impl<'de> serde::de::Visitor<'de> for Visitor {
11980                            type Value = __FieldTag;
11981                            fn expecting(
11982                                &self,
11983                                formatter: &mut std::fmt::Formatter,
11984                            ) -> std::fmt::Result {
11985                                formatter.write_str(
11986                                    "a field name for CustomerSuppliedEncryptionEnforcementConfig",
11987                                )
11988                            }
11989                            fn visit_str<E>(
11990                                self,
11991                                value: &str,
11992                            ) -> std::result::Result<Self::Value, E>
11993                            where
11994                                E: serde::de::Error,
11995                            {
11996                                use std::result::Result::Ok;
11997                                use std::string::ToString;
11998                                match value {
11999                                    "restrictionMode" => Ok(__FieldTag::__restriction_mode),
12000                                    "restriction_mode" => Ok(__FieldTag::__restriction_mode),
12001                                    "effectiveTime" => Ok(__FieldTag::__effective_time),
12002                                    "effective_time" => Ok(__FieldTag::__effective_time),
12003                                    _ => Ok(__FieldTag::Unknown(value.to_string())),
12004                                }
12005                            }
12006                        }
12007                        deserializer.deserialize_identifier(Visitor)
12008                    }
12009                }
12010                struct Visitor;
12011                impl<'de> serde::de::Visitor<'de> for Visitor {
12012                    type Value = CustomerSuppliedEncryptionEnforcementConfig;
12013                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
12014                        formatter.write_str("struct CustomerSuppliedEncryptionEnforcementConfig")
12015                    }
12016                    fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
12017                    where
12018                        A: serde::de::MapAccess<'de>,
12019                    {
12020                        #[allow(unused_imports)]
12021                        use serde::de::Error;
12022                        use std::option::Option::Some;
12023                        let mut fields = std::collections::HashSet::new();
12024                        let mut result = Self::Value::new();
12025                        while let Some(tag) = map.next_key::<__FieldTag>()? {
12026                            #[allow(clippy::match_single_binding)]
12027                            match tag {
12028                                __FieldTag::__restriction_mode => {
12029                                    if !fields.insert(__FieldTag::__restriction_mode) {
12030                                        return std::result::Result::Err(
12031                                            A::Error::duplicate_field(
12032                                                "multiple values for restriction_mode",
12033                                            ),
12034                                        );
12035                                    }
12036                                    result.restriction_mode = map
12037                                        .next_value::<std::option::Option<std::string::String>>()?;
12038                                }
12039                                __FieldTag::__effective_time => {
12040                                    if !fields.insert(__FieldTag::__effective_time) {
12041                                        return std::result::Result::Err(
12042                                            A::Error::duplicate_field(
12043                                                "multiple values for effective_time",
12044                                            ),
12045                                        );
12046                                    }
12047                                    result.effective_time =
12048                                        map.next_value::<std::option::Option<wkt::Timestamp>>()?;
12049                                }
12050                                __FieldTag::Unknown(key) => {
12051                                    let value = map.next_value::<serde_json::Value>()?;
12052                                    result._unknown_fields.insert(key, value);
12053                                }
12054                            }
12055                        }
12056                        std::result::Result::Ok(result)
12057                    }
12058                }
12059                deserializer.deserialize_any(Visitor)
12060            }
12061        }
12062
12063        #[doc(hidden)]
12064        impl serde::ser::Serialize for CustomerSuppliedEncryptionEnforcementConfig {
12065            fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
12066            where
12067                S: serde::ser::Serializer,
12068            {
12069                use serde::ser::SerializeMap;
12070                #[allow(unused_imports)]
12071                use std::option::Option::Some;
12072                let mut state = serializer.serialize_map(std::option::Option::None)?;
12073                if self.restriction_mode.is_some() {
12074                    state.serialize_entry("restrictionMode", &self.restriction_mode)?;
12075                }
12076                if self.effective_time.is_some() {
12077                    state.serialize_entry("effectiveTime", &self.effective_time)?;
12078                }
12079                if !self._unknown_fields.is_empty() {
12080                    for (key, value) in self._unknown_fields.iter() {
12081                        state.serialize_entry(key, &value)?;
12082                    }
12083                }
12084                state.end()
12085            }
12086        }
12087
12088        impl std::fmt::Debug for CustomerSuppliedEncryptionEnforcementConfig {
12089            fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
12090                let mut debug_struct =
12091                    f.debug_struct("CustomerSuppliedEncryptionEnforcementConfig");
12092                debug_struct.field("restriction_mode", &self.restriction_mode);
12093                debug_struct.field("effective_time", &self.effective_time);
12094                if !self._unknown_fields.is_empty() {
12095                    debug_struct.field("_unknown_fields", &self._unknown_fields);
12096                }
12097                debug_struct.finish()
12098            }
12099        }
12100    }
12101
12102    /// Bucket restriction options.
12103    #[derive(Clone, Default, PartialEq)]
12104    #[non_exhaustive]
12105    pub struct IamConfig {
12106        /// Optional. Bucket restriction options currently enforced on the bucket.
12107        pub uniform_bucket_level_access:
12108            std::option::Option<crate::model::bucket::iam_config::UniformBucketLevelAccess>,
12109
12110        /// Optional. Whether IAM will enforce public access prevention. Valid values
12111        /// are "enforced" or "inherited".
12112        pub public_access_prevention: std::string::String,
12113
12114        _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
12115    }
12116
12117    impl IamConfig {
12118        pub fn new() -> Self {
12119            std::default::Default::default()
12120        }
12121
12122        /// Sets the value of [uniform_bucket_level_access][crate::model::bucket::IamConfig::uniform_bucket_level_access].
12123        pub fn set_uniform_bucket_level_access<T>(mut self, v: T) -> Self
12124        where
12125            T: std::convert::Into<crate::model::bucket::iam_config::UniformBucketLevelAccess>,
12126        {
12127            self.uniform_bucket_level_access = std::option::Option::Some(v.into());
12128            self
12129        }
12130
12131        /// Sets or clears the value of [uniform_bucket_level_access][crate::model::bucket::IamConfig::uniform_bucket_level_access].
12132        pub fn set_or_clear_uniform_bucket_level_access<T>(
12133            mut self,
12134            v: std::option::Option<T>,
12135        ) -> Self
12136        where
12137            T: std::convert::Into<crate::model::bucket::iam_config::UniformBucketLevelAccess>,
12138        {
12139            self.uniform_bucket_level_access = v.map(|x| x.into());
12140            self
12141        }
12142
12143        /// Sets the value of [public_access_prevention][crate::model::bucket::IamConfig::public_access_prevention].
12144        pub fn set_public_access_prevention<T: std::convert::Into<std::string::String>>(
12145            mut self,
12146            v: T,
12147        ) -> Self {
12148            self.public_access_prevention = v.into();
12149            self
12150        }
12151    }
12152
12153    impl wkt::message::Message for IamConfig {
12154        fn typename() -> &'static str {
12155            "type.googleapis.com/google.storage.v2.Bucket.IamConfig"
12156        }
12157    }
12158
12159    #[doc(hidden)]
12160    impl<'de> serde::de::Deserialize<'de> for IamConfig {
12161        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
12162        where
12163            D: serde::Deserializer<'de>,
12164        {
12165            #[allow(non_camel_case_types)]
12166            #[doc(hidden)]
12167            #[derive(PartialEq, Eq, Hash)]
12168            enum __FieldTag {
12169                __uniform_bucket_level_access,
12170                __public_access_prevention,
12171                Unknown(std::string::String),
12172            }
12173            impl<'de> serde::de::Deserialize<'de> for __FieldTag {
12174                fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
12175                where
12176                    D: serde::Deserializer<'de>,
12177                {
12178                    struct Visitor;
12179                    impl<'de> serde::de::Visitor<'de> for Visitor {
12180                        type Value = __FieldTag;
12181                        fn expecting(
12182                            &self,
12183                            formatter: &mut std::fmt::Formatter,
12184                        ) -> std::fmt::Result {
12185                            formatter.write_str("a field name for IamConfig")
12186                        }
12187                        fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
12188                        where
12189                            E: serde::de::Error,
12190                        {
12191                            use std::result::Result::Ok;
12192                            use std::string::ToString;
12193                            match value {
12194                                "uniformBucketLevelAccess" => {
12195                                    Ok(__FieldTag::__uniform_bucket_level_access)
12196                                }
12197                                "uniform_bucket_level_access" => {
12198                                    Ok(__FieldTag::__uniform_bucket_level_access)
12199                                }
12200                                "publicAccessPrevention" => {
12201                                    Ok(__FieldTag::__public_access_prevention)
12202                                }
12203                                "public_access_prevention" => {
12204                                    Ok(__FieldTag::__public_access_prevention)
12205                                }
12206                                _ => Ok(__FieldTag::Unknown(value.to_string())),
12207                            }
12208                        }
12209                    }
12210                    deserializer.deserialize_identifier(Visitor)
12211                }
12212            }
12213            struct Visitor;
12214            impl<'de> serde::de::Visitor<'de> for Visitor {
12215                type Value = IamConfig;
12216                fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
12217                    formatter.write_str("struct IamConfig")
12218                }
12219                fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
12220                where
12221                    A: serde::de::MapAccess<'de>,
12222                {
12223                    #[allow(unused_imports)]
12224                    use serde::de::Error;
12225                    use std::option::Option::Some;
12226                    let mut fields = std::collections::HashSet::new();
12227                    let mut result = Self::Value::new();
12228                    while let Some(tag) = map.next_key::<__FieldTag>()? {
12229                        #[allow(clippy::match_single_binding)]
12230                        match tag {
12231                            __FieldTag::__uniform_bucket_level_access => {
12232                                if !fields.insert(__FieldTag::__uniform_bucket_level_access) {
12233                                    return std::result::Result::Err(A::Error::duplicate_field(
12234                                        "multiple values for uniform_bucket_level_access",
12235                                    ));
12236                                }
12237                                result.uniform_bucket_level_access = map
12238                                    .next_value::<std::option::Option<
12239                                        crate::model::bucket::iam_config::UniformBucketLevelAccess,
12240                                    >>()?;
12241                            }
12242                            __FieldTag::__public_access_prevention => {
12243                                if !fields.insert(__FieldTag::__public_access_prevention) {
12244                                    return std::result::Result::Err(A::Error::duplicate_field(
12245                                        "multiple values for public_access_prevention",
12246                                    ));
12247                                }
12248                                result.public_access_prevention = map
12249                                    .next_value::<std::option::Option<std::string::String>>()?
12250                                    .unwrap_or_default();
12251                            }
12252                            __FieldTag::Unknown(key) => {
12253                                let value = map.next_value::<serde_json::Value>()?;
12254                                result._unknown_fields.insert(key, value);
12255                            }
12256                        }
12257                    }
12258                    std::result::Result::Ok(result)
12259                }
12260            }
12261            deserializer.deserialize_any(Visitor)
12262        }
12263    }
12264
12265    #[doc(hidden)]
12266    impl serde::ser::Serialize for IamConfig {
12267        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
12268        where
12269            S: serde::ser::Serializer,
12270        {
12271            use serde::ser::SerializeMap;
12272            #[allow(unused_imports)]
12273            use std::option::Option::Some;
12274            let mut state = serializer.serialize_map(std::option::Option::None)?;
12275            if self.uniform_bucket_level_access.is_some() {
12276                state.serialize_entry(
12277                    "uniformBucketLevelAccess",
12278                    &self.uniform_bucket_level_access,
12279                )?;
12280            }
12281            if !self.public_access_prevention.is_empty() {
12282                state.serialize_entry("publicAccessPrevention", &self.public_access_prevention)?;
12283            }
12284            if !self._unknown_fields.is_empty() {
12285                for (key, value) in self._unknown_fields.iter() {
12286                    state.serialize_entry(key, &value)?;
12287                }
12288            }
12289            state.end()
12290        }
12291    }
12292
12293    impl std::fmt::Debug for IamConfig {
12294        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
12295            let mut debug_struct = f.debug_struct("IamConfig");
12296            debug_struct.field(
12297                "uniform_bucket_level_access",
12298                &self.uniform_bucket_level_access,
12299            );
12300            debug_struct.field("public_access_prevention", &self.public_access_prevention);
12301            if !self._unknown_fields.is_empty() {
12302                debug_struct.field("_unknown_fields", &self._unknown_fields);
12303            }
12304            debug_struct.finish()
12305        }
12306    }
12307
12308    /// Defines additional types related to [IamConfig].
12309    pub mod iam_config {
12310        #[allow(unused_imports)]
12311        use super::*;
12312
12313        /// Settings for Uniform Bucket level access.
12314        /// See <https://cloud.google.com/storage/docs/uniform-bucket-level-access>.
12315        #[derive(Clone, Default, PartialEq)]
12316        #[non_exhaustive]
12317        pub struct UniformBucketLevelAccess {
12318            /// Optional. If set, access checks only use bucket-level IAM policies or
12319            /// above.
12320            pub enabled: bool,
12321
12322            /// Optional. The deadline time for changing
12323            /// `iam_config.uniform_bucket_level_access.enabled` from `true` to
12324            /// `false`. Mutable until the specified deadline is reached, but not
12325            /// afterward.
12326            pub lock_time: std::option::Option<wkt::Timestamp>,
12327
12328            _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
12329        }
12330
12331        impl UniformBucketLevelAccess {
12332            pub fn new() -> Self {
12333                std::default::Default::default()
12334            }
12335
12336            /// Sets the value of [enabled][crate::model::bucket::iam_config::UniformBucketLevelAccess::enabled].
12337            pub fn set_enabled<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
12338                self.enabled = v.into();
12339                self
12340            }
12341
12342            /// Sets the value of [lock_time][crate::model::bucket::iam_config::UniformBucketLevelAccess::lock_time].
12343            pub fn set_lock_time<T>(mut self, v: T) -> Self
12344            where
12345                T: std::convert::Into<wkt::Timestamp>,
12346            {
12347                self.lock_time = std::option::Option::Some(v.into());
12348                self
12349            }
12350
12351            /// Sets or clears the value of [lock_time][crate::model::bucket::iam_config::UniformBucketLevelAccess::lock_time].
12352            pub fn set_or_clear_lock_time<T>(mut self, v: std::option::Option<T>) -> Self
12353            where
12354                T: std::convert::Into<wkt::Timestamp>,
12355            {
12356                self.lock_time = v.map(|x| x.into());
12357                self
12358            }
12359        }
12360
12361        impl wkt::message::Message for UniformBucketLevelAccess {
12362            fn typename() -> &'static str {
12363                "type.googleapis.com/google.storage.v2.Bucket.IamConfig.UniformBucketLevelAccess"
12364            }
12365        }
12366
12367        #[doc(hidden)]
12368        impl<'de> serde::de::Deserialize<'de> for UniformBucketLevelAccess {
12369            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
12370            where
12371                D: serde::Deserializer<'de>,
12372            {
12373                #[allow(non_camel_case_types)]
12374                #[doc(hidden)]
12375                #[derive(PartialEq, Eq, Hash)]
12376                enum __FieldTag {
12377                    __enabled,
12378                    __lock_time,
12379                    Unknown(std::string::String),
12380                }
12381                impl<'de> serde::de::Deserialize<'de> for __FieldTag {
12382                    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
12383                    where
12384                        D: serde::Deserializer<'de>,
12385                    {
12386                        struct Visitor;
12387                        impl<'de> serde::de::Visitor<'de> for Visitor {
12388                            type Value = __FieldTag;
12389                            fn expecting(
12390                                &self,
12391                                formatter: &mut std::fmt::Formatter,
12392                            ) -> std::fmt::Result {
12393                                formatter.write_str("a field name for UniformBucketLevelAccess")
12394                            }
12395                            fn visit_str<E>(
12396                                self,
12397                                value: &str,
12398                            ) -> std::result::Result<Self::Value, E>
12399                            where
12400                                E: serde::de::Error,
12401                            {
12402                                use std::result::Result::Ok;
12403                                use std::string::ToString;
12404                                match value {
12405                                    "enabled" => Ok(__FieldTag::__enabled),
12406                                    "lockTime" => Ok(__FieldTag::__lock_time),
12407                                    "lock_time" => Ok(__FieldTag::__lock_time),
12408                                    _ => Ok(__FieldTag::Unknown(value.to_string())),
12409                                }
12410                            }
12411                        }
12412                        deserializer.deserialize_identifier(Visitor)
12413                    }
12414                }
12415                struct Visitor;
12416                impl<'de> serde::de::Visitor<'de> for Visitor {
12417                    type Value = UniformBucketLevelAccess;
12418                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
12419                        formatter.write_str("struct UniformBucketLevelAccess")
12420                    }
12421                    fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
12422                    where
12423                        A: serde::de::MapAccess<'de>,
12424                    {
12425                        #[allow(unused_imports)]
12426                        use serde::de::Error;
12427                        use std::option::Option::Some;
12428                        let mut fields = std::collections::HashSet::new();
12429                        let mut result = Self::Value::new();
12430                        while let Some(tag) = map.next_key::<__FieldTag>()? {
12431                            #[allow(clippy::match_single_binding)]
12432                            match tag {
12433                                __FieldTag::__enabled => {
12434                                    if !fields.insert(__FieldTag::__enabled) {
12435                                        return std::result::Result::Err(
12436                                            A::Error::duplicate_field(
12437                                                "multiple values for enabled",
12438                                            ),
12439                                        );
12440                                    }
12441                                    result.enabled = map
12442                                        .next_value::<std::option::Option<bool>>()?
12443                                        .unwrap_or_default();
12444                                }
12445                                __FieldTag::__lock_time => {
12446                                    if !fields.insert(__FieldTag::__lock_time) {
12447                                        return std::result::Result::Err(
12448                                            A::Error::duplicate_field(
12449                                                "multiple values for lock_time",
12450                                            ),
12451                                        );
12452                                    }
12453                                    result.lock_time =
12454                                        map.next_value::<std::option::Option<wkt::Timestamp>>()?;
12455                                }
12456                                __FieldTag::Unknown(key) => {
12457                                    let value = map.next_value::<serde_json::Value>()?;
12458                                    result._unknown_fields.insert(key, value);
12459                                }
12460                            }
12461                        }
12462                        std::result::Result::Ok(result)
12463                    }
12464                }
12465                deserializer.deserialize_any(Visitor)
12466            }
12467        }
12468
12469        #[doc(hidden)]
12470        impl serde::ser::Serialize for UniformBucketLevelAccess {
12471            fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
12472            where
12473                S: serde::ser::Serializer,
12474            {
12475                use serde::ser::SerializeMap;
12476                #[allow(unused_imports)]
12477                use std::option::Option::Some;
12478                let mut state = serializer.serialize_map(std::option::Option::None)?;
12479                if !wkt::internal::is_default(&self.enabled) {
12480                    state.serialize_entry("enabled", &self.enabled)?;
12481                }
12482                if self.lock_time.is_some() {
12483                    state.serialize_entry("lockTime", &self.lock_time)?;
12484                }
12485                if !self._unknown_fields.is_empty() {
12486                    for (key, value) in self._unknown_fields.iter() {
12487                        state.serialize_entry(key, &value)?;
12488                    }
12489                }
12490                state.end()
12491            }
12492        }
12493
12494        impl std::fmt::Debug for UniformBucketLevelAccess {
12495            fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
12496                let mut debug_struct = f.debug_struct("UniformBucketLevelAccess");
12497                debug_struct.field("enabled", &self.enabled);
12498                debug_struct.field("lock_time", &self.lock_time);
12499                if !self._unknown_fields.is_empty() {
12500                    debug_struct.field("_unknown_fields", &self._unknown_fields);
12501                }
12502                debug_struct.finish()
12503            }
12504        }
12505    }
12506
12507    /// Lifecycle properties of a bucket.
12508    /// For more information, see <https://cloud.google.com/storage/docs/lifecycle>.
12509    #[derive(Clone, Default, PartialEq)]
12510    #[non_exhaustive]
12511    pub struct Lifecycle {
12512        /// Optional. A lifecycle management rule, which is made of an action to take
12513        /// and the condition(s) under which the action will be taken.
12514        pub rule: std::vec::Vec<crate::model::bucket::lifecycle::Rule>,
12515
12516        _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
12517    }
12518
12519    impl Lifecycle {
12520        pub fn new() -> Self {
12521            std::default::Default::default()
12522        }
12523
12524        /// Sets the value of [rule][crate::model::bucket::Lifecycle::rule].
12525        pub fn set_rule<T, V>(mut self, v: T) -> Self
12526        where
12527            T: std::iter::IntoIterator<Item = V>,
12528            V: std::convert::Into<crate::model::bucket::lifecycle::Rule>,
12529        {
12530            use std::iter::Iterator;
12531            self.rule = v.into_iter().map(|i| i.into()).collect();
12532            self
12533        }
12534    }
12535
12536    impl wkt::message::Message for Lifecycle {
12537        fn typename() -> &'static str {
12538            "type.googleapis.com/google.storage.v2.Bucket.Lifecycle"
12539        }
12540    }
12541
12542    #[doc(hidden)]
12543    impl<'de> serde::de::Deserialize<'de> for Lifecycle {
12544        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
12545        where
12546            D: serde::Deserializer<'de>,
12547        {
12548            #[allow(non_camel_case_types)]
12549            #[doc(hidden)]
12550            #[derive(PartialEq, Eq, Hash)]
12551            enum __FieldTag {
12552                __rule,
12553                Unknown(std::string::String),
12554            }
12555            impl<'de> serde::de::Deserialize<'de> for __FieldTag {
12556                fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
12557                where
12558                    D: serde::Deserializer<'de>,
12559                {
12560                    struct Visitor;
12561                    impl<'de> serde::de::Visitor<'de> for Visitor {
12562                        type Value = __FieldTag;
12563                        fn expecting(
12564                            &self,
12565                            formatter: &mut std::fmt::Formatter,
12566                        ) -> std::fmt::Result {
12567                            formatter.write_str("a field name for Lifecycle")
12568                        }
12569                        fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
12570                        where
12571                            E: serde::de::Error,
12572                        {
12573                            use std::result::Result::Ok;
12574                            use std::string::ToString;
12575                            match value {
12576                                "rule" => Ok(__FieldTag::__rule),
12577                                _ => Ok(__FieldTag::Unknown(value.to_string())),
12578                            }
12579                        }
12580                    }
12581                    deserializer.deserialize_identifier(Visitor)
12582                }
12583            }
12584            struct Visitor;
12585            impl<'de> serde::de::Visitor<'de> for Visitor {
12586                type Value = Lifecycle;
12587                fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
12588                    formatter.write_str("struct Lifecycle")
12589                }
12590                fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
12591                where
12592                    A: serde::de::MapAccess<'de>,
12593                {
12594                    #[allow(unused_imports)]
12595                    use serde::de::Error;
12596                    use std::option::Option::Some;
12597                    let mut fields = std::collections::HashSet::new();
12598                    let mut result = Self::Value::new();
12599                    while let Some(tag) = map.next_key::<__FieldTag>()? {
12600                        #[allow(clippy::match_single_binding)]
12601                        match tag {
12602                            __FieldTag::__rule => {
12603                                if !fields.insert(__FieldTag::__rule) {
12604                                    return std::result::Result::Err(A::Error::duplicate_field(
12605                                        "multiple values for rule",
12606                                    ));
12607                                }
12608                                result.rule = map
12609                                    .next_value::<std::option::Option<
12610                                        std::vec::Vec<crate::model::bucket::lifecycle::Rule>,
12611                                    >>()?
12612                                    .unwrap_or_default();
12613                            }
12614                            __FieldTag::Unknown(key) => {
12615                                let value = map.next_value::<serde_json::Value>()?;
12616                                result._unknown_fields.insert(key, value);
12617                            }
12618                        }
12619                    }
12620                    std::result::Result::Ok(result)
12621                }
12622            }
12623            deserializer.deserialize_any(Visitor)
12624        }
12625    }
12626
12627    #[doc(hidden)]
12628    impl serde::ser::Serialize for Lifecycle {
12629        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
12630        where
12631            S: serde::ser::Serializer,
12632        {
12633            use serde::ser::SerializeMap;
12634            #[allow(unused_imports)]
12635            use std::option::Option::Some;
12636            let mut state = serializer.serialize_map(std::option::Option::None)?;
12637            if !self.rule.is_empty() {
12638                state.serialize_entry("rule", &self.rule)?;
12639            }
12640            if !self._unknown_fields.is_empty() {
12641                for (key, value) in self._unknown_fields.iter() {
12642                    state.serialize_entry(key, &value)?;
12643                }
12644            }
12645            state.end()
12646        }
12647    }
12648
12649    impl std::fmt::Debug for Lifecycle {
12650        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
12651            let mut debug_struct = f.debug_struct("Lifecycle");
12652            debug_struct.field("rule", &self.rule);
12653            if !self._unknown_fields.is_empty() {
12654                debug_struct.field("_unknown_fields", &self._unknown_fields);
12655            }
12656            debug_struct.finish()
12657        }
12658    }
12659
12660    /// Defines additional types related to [Lifecycle].
12661    pub mod lifecycle {
12662        #[allow(unused_imports)]
12663        use super::*;
12664
12665        /// A lifecycle Rule, combining an action to take on an object and a
12666        /// condition which will trigger that action.
12667        #[derive(Clone, Default, PartialEq)]
12668        #[non_exhaustive]
12669        pub struct Rule {
12670            /// Optional. The action to take.
12671            pub action: std::option::Option<crate::model::bucket::lifecycle::rule::Action>,
12672
12673            /// Optional. The condition(s) under which the action will be taken.
12674            pub condition: std::option::Option<crate::model::bucket::lifecycle::rule::Condition>,
12675
12676            _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
12677        }
12678
12679        impl Rule {
12680            pub fn new() -> Self {
12681                std::default::Default::default()
12682            }
12683
12684            /// Sets the value of [action][crate::model::bucket::lifecycle::Rule::action].
12685            pub fn set_action<T>(mut self, v: T) -> Self
12686            where
12687                T: std::convert::Into<crate::model::bucket::lifecycle::rule::Action>,
12688            {
12689                self.action = std::option::Option::Some(v.into());
12690                self
12691            }
12692
12693            /// Sets or clears the value of [action][crate::model::bucket::lifecycle::Rule::action].
12694            pub fn set_or_clear_action<T>(mut self, v: std::option::Option<T>) -> Self
12695            where
12696                T: std::convert::Into<crate::model::bucket::lifecycle::rule::Action>,
12697            {
12698                self.action = v.map(|x| x.into());
12699                self
12700            }
12701
12702            /// Sets the value of [condition][crate::model::bucket::lifecycle::Rule::condition].
12703            pub fn set_condition<T>(mut self, v: T) -> Self
12704            where
12705                T: std::convert::Into<crate::model::bucket::lifecycle::rule::Condition>,
12706            {
12707                self.condition = std::option::Option::Some(v.into());
12708                self
12709            }
12710
12711            /// Sets or clears the value of [condition][crate::model::bucket::lifecycle::Rule::condition].
12712            pub fn set_or_clear_condition<T>(mut self, v: std::option::Option<T>) -> Self
12713            where
12714                T: std::convert::Into<crate::model::bucket::lifecycle::rule::Condition>,
12715            {
12716                self.condition = v.map(|x| x.into());
12717                self
12718            }
12719        }
12720
12721        impl wkt::message::Message for Rule {
12722            fn typename() -> &'static str {
12723                "type.googleapis.com/google.storage.v2.Bucket.Lifecycle.Rule"
12724            }
12725        }
12726
12727        #[doc(hidden)]
12728        impl<'de> serde::de::Deserialize<'de> for Rule {
12729            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
12730            where
12731                D: serde::Deserializer<'de>,
12732            {
12733                #[allow(non_camel_case_types)]
12734                #[doc(hidden)]
12735                #[derive(PartialEq, Eq, Hash)]
12736                enum __FieldTag {
12737                    __action,
12738                    __condition,
12739                    Unknown(std::string::String),
12740                }
12741                impl<'de> serde::de::Deserialize<'de> for __FieldTag {
12742                    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
12743                    where
12744                        D: serde::Deserializer<'de>,
12745                    {
12746                        struct Visitor;
12747                        impl<'de> serde::de::Visitor<'de> for Visitor {
12748                            type Value = __FieldTag;
12749                            fn expecting(
12750                                &self,
12751                                formatter: &mut std::fmt::Formatter,
12752                            ) -> std::fmt::Result {
12753                                formatter.write_str("a field name for Rule")
12754                            }
12755                            fn visit_str<E>(
12756                                self,
12757                                value: &str,
12758                            ) -> std::result::Result<Self::Value, E>
12759                            where
12760                                E: serde::de::Error,
12761                            {
12762                                use std::result::Result::Ok;
12763                                use std::string::ToString;
12764                                match value {
12765                                    "action" => Ok(__FieldTag::__action),
12766                                    "condition" => Ok(__FieldTag::__condition),
12767                                    _ => Ok(__FieldTag::Unknown(value.to_string())),
12768                                }
12769                            }
12770                        }
12771                        deserializer.deserialize_identifier(Visitor)
12772                    }
12773                }
12774                struct Visitor;
12775                impl<'de> serde::de::Visitor<'de> for Visitor {
12776                    type Value = Rule;
12777                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
12778                        formatter.write_str("struct Rule")
12779                    }
12780                    fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
12781                    where
12782                        A: serde::de::MapAccess<'de>,
12783                    {
12784                        #[allow(unused_imports)]
12785                        use serde::de::Error;
12786                        use std::option::Option::Some;
12787                        let mut fields = std::collections::HashSet::new();
12788                        let mut result = Self::Value::new();
12789                        while let Some(tag) = map.next_key::<__FieldTag>()? {
12790                            #[allow(clippy::match_single_binding)]
12791                            match tag {
12792                                __FieldTag::__action => {
12793                                    if !fields.insert(__FieldTag::__action) {
12794                                        return std::result::Result::Err(
12795                                            A::Error::duplicate_field("multiple values for action"),
12796                                        );
12797                                    }
12798                                    result.action = map.next_value::<std::option::Option<
12799                                        crate::model::bucket::lifecycle::rule::Action,
12800                                    >>()?;
12801                                }
12802                                __FieldTag::__condition => {
12803                                    if !fields.insert(__FieldTag::__condition) {
12804                                        return std::result::Result::Err(
12805                                            A::Error::duplicate_field(
12806                                                "multiple values for condition",
12807                                            ),
12808                                        );
12809                                    }
12810                                    result.condition = map
12811                                        .next_value::<std::option::Option<
12812                                            crate::model::bucket::lifecycle::rule::Condition,
12813                                        >>()?;
12814                                }
12815                                __FieldTag::Unknown(key) => {
12816                                    let value = map.next_value::<serde_json::Value>()?;
12817                                    result._unknown_fields.insert(key, value);
12818                                }
12819                            }
12820                        }
12821                        std::result::Result::Ok(result)
12822                    }
12823                }
12824                deserializer.deserialize_any(Visitor)
12825            }
12826        }
12827
12828        #[doc(hidden)]
12829        impl serde::ser::Serialize for Rule {
12830            fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
12831            where
12832                S: serde::ser::Serializer,
12833            {
12834                use serde::ser::SerializeMap;
12835                #[allow(unused_imports)]
12836                use std::option::Option::Some;
12837                let mut state = serializer.serialize_map(std::option::Option::None)?;
12838                if self.action.is_some() {
12839                    state.serialize_entry("action", &self.action)?;
12840                }
12841                if self.condition.is_some() {
12842                    state.serialize_entry("condition", &self.condition)?;
12843                }
12844                if !self._unknown_fields.is_empty() {
12845                    for (key, value) in self._unknown_fields.iter() {
12846                        state.serialize_entry(key, &value)?;
12847                    }
12848                }
12849                state.end()
12850            }
12851        }
12852
12853        impl std::fmt::Debug for Rule {
12854            fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
12855                let mut debug_struct = f.debug_struct("Rule");
12856                debug_struct.field("action", &self.action);
12857                debug_struct.field("condition", &self.condition);
12858                if !self._unknown_fields.is_empty() {
12859                    debug_struct.field("_unknown_fields", &self._unknown_fields);
12860                }
12861                debug_struct.finish()
12862            }
12863        }
12864
12865        /// Defines additional types related to [Rule].
12866        pub mod rule {
12867            #[allow(unused_imports)]
12868            use super::*;
12869
12870            /// An action to take on an object.
12871            #[derive(Clone, Default, PartialEq)]
12872            #[non_exhaustive]
12873            pub struct Action {
12874                /// Optional. Type of the action. Currently, only `Delete`,
12875                /// `SetStorageClass`, and `AbortIncompleteMultipartUpload` are
12876                /// supported.
12877                pub r#type: std::string::String,
12878
12879                /// Optional. Target storage class. Required iff the type of the action
12880                /// is SetStorageClass.
12881                pub storage_class: std::string::String,
12882
12883                _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
12884            }
12885
12886            impl Action {
12887                pub fn new() -> Self {
12888                    std::default::Default::default()
12889                }
12890
12891                /// Sets the value of [r#type][crate::model::bucket::lifecycle::rule::Action::type].
12892                pub fn set_type<T: std::convert::Into<std::string::String>>(
12893                    mut self,
12894                    v: T,
12895                ) -> Self {
12896                    self.r#type = v.into();
12897                    self
12898                }
12899
12900                /// Sets the value of [storage_class][crate::model::bucket::lifecycle::rule::Action::storage_class].
12901                pub fn set_storage_class<T: std::convert::Into<std::string::String>>(
12902                    mut self,
12903                    v: T,
12904                ) -> Self {
12905                    self.storage_class = v.into();
12906                    self
12907                }
12908            }
12909
12910            impl wkt::message::Message for Action {
12911                fn typename() -> &'static str {
12912                    "type.googleapis.com/google.storage.v2.Bucket.Lifecycle.Rule.Action"
12913                }
12914            }
12915
12916            #[doc(hidden)]
12917            impl<'de> serde::de::Deserialize<'de> for Action {
12918                fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
12919                where
12920                    D: serde::Deserializer<'de>,
12921                {
12922                    #[allow(non_camel_case_types)]
12923                    #[doc(hidden)]
12924                    #[derive(PartialEq, Eq, Hash)]
12925                    enum __FieldTag {
12926                        __type,
12927                        __storage_class,
12928                        Unknown(std::string::String),
12929                    }
12930                    impl<'de> serde::de::Deserialize<'de> for __FieldTag {
12931                        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
12932                        where
12933                            D: serde::Deserializer<'de>,
12934                        {
12935                            struct Visitor;
12936                            impl<'de> serde::de::Visitor<'de> for Visitor {
12937                                type Value = __FieldTag;
12938                                fn expecting(
12939                                    &self,
12940                                    formatter: &mut std::fmt::Formatter,
12941                                ) -> std::fmt::Result {
12942                                    formatter.write_str("a field name for Action")
12943                                }
12944                                fn visit_str<E>(
12945                                    self,
12946                                    value: &str,
12947                                ) -> std::result::Result<Self::Value, E>
12948                                where
12949                                    E: serde::de::Error,
12950                                {
12951                                    use std::result::Result::Ok;
12952                                    use std::string::ToString;
12953                                    match value {
12954                                        "type" => Ok(__FieldTag::__type),
12955                                        "storageClass" => Ok(__FieldTag::__storage_class),
12956                                        "storage_class" => Ok(__FieldTag::__storage_class),
12957                                        _ => Ok(__FieldTag::Unknown(value.to_string())),
12958                                    }
12959                                }
12960                            }
12961                            deserializer.deserialize_identifier(Visitor)
12962                        }
12963                    }
12964                    struct Visitor;
12965                    impl<'de> serde::de::Visitor<'de> for Visitor {
12966                        type Value = Action;
12967                        fn expecting(
12968                            &self,
12969                            formatter: &mut std::fmt::Formatter,
12970                        ) -> std::fmt::Result {
12971                            formatter.write_str("struct Action")
12972                        }
12973                        fn visit_map<A>(
12974                            self,
12975                            mut map: A,
12976                        ) -> std::result::Result<Self::Value, A::Error>
12977                        where
12978                            A: serde::de::MapAccess<'de>,
12979                        {
12980                            #[allow(unused_imports)]
12981                            use serde::de::Error;
12982                            use std::option::Option::Some;
12983                            let mut fields = std::collections::HashSet::new();
12984                            let mut result = Self::Value::new();
12985                            while let Some(tag) = map.next_key::<__FieldTag>()? {
12986                                #[allow(clippy::match_single_binding)]
12987                                match tag {
12988                                    __FieldTag::__type => {
12989                                        if !fields.insert(__FieldTag::__type) {
12990                                            return std::result::Result::Err(
12991                                                A::Error::duplicate_field(
12992                                                    "multiple values for type",
12993                                                ),
12994                                            );
12995                                        }
12996                                        result.r#type = map
12997                                            .next_value::<std::option::Option<std::string::String>>(
12998                                            )?
12999                                            .unwrap_or_default();
13000                                    }
13001                                    __FieldTag::__storage_class => {
13002                                        if !fields.insert(__FieldTag::__storage_class) {
13003                                            return std::result::Result::Err(
13004                                                A::Error::duplicate_field(
13005                                                    "multiple values for storage_class",
13006                                                ),
13007                                            );
13008                                        }
13009                                        result.storage_class = map
13010                                            .next_value::<std::option::Option<std::string::String>>(
13011                                            )?
13012                                            .unwrap_or_default();
13013                                    }
13014                                    __FieldTag::Unknown(key) => {
13015                                        let value = map.next_value::<serde_json::Value>()?;
13016                                        result._unknown_fields.insert(key, value);
13017                                    }
13018                                }
13019                            }
13020                            std::result::Result::Ok(result)
13021                        }
13022                    }
13023                    deserializer.deserialize_any(Visitor)
13024                }
13025            }
13026
13027            #[doc(hidden)]
13028            impl serde::ser::Serialize for Action {
13029                fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
13030                where
13031                    S: serde::ser::Serializer,
13032                {
13033                    use serde::ser::SerializeMap;
13034                    #[allow(unused_imports)]
13035                    use std::option::Option::Some;
13036                    let mut state = serializer.serialize_map(std::option::Option::None)?;
13037                    if !self.r#type.is_empty() {
13038                        state.serialize_entry("type", &self.r#type)?;
13039                    }
13040                    if !self.storage_class.is_empty() {
13041                        state.serialize_entry("storageClass", &self.storage_class)?;
13042                    }
13043                    if !self._unknown_fields.is_empty() {
13044                        for (key, value) in self._unknown_fields.iter() {
13045                            state.serialize_entry(key, &value)?;
13046                        }
13047                    }
13048                    state.end()
13049                }
13050            }
13051
13052            impl std::fmt::Debug for Action {
13053                fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
13054                    let mut debug_struct = f.debug_struct("Action");
13055                    debug_struct.field("r#type", &self.r#type);
13056                    debug_struct.field("storage_class", &self.storage_class);
13057                    if !self._unknown_fields.is_empty() {
13058                        debug_struct.field("_unknown_fields", &self._unknown_fields);
13059                    }
13060                    debug_struct.finish()
13061                }
13062            }
13063
13064            /// A condition of an object which triggers some action.
13065            #[derive(Clone, Default, PartialEq)]
13066            #[non_exhaustive]
13067            pub struct Condition {
13068                /// Age of an object (in days). This condition is satisfied when an
13069                /// object reaches the specified age.
13070                /// A value of 0 indicates that all objects immediately match this
13071                /// condition.
13072                pub age_days: std::option::Option<i32>,
13073
13074                /// Optional. This condition is satisfied when an object is created
13075                /// before midnight of the specified date in UTC.
13076                pub created_before: std::option::Option<gtype::model::Date>,
13077
13078                /// Relevant only for versioned objects. If the value is
13079                /// `true`, this condition matches live objects; if the value
13080                /// is `false`, it matches archived objects.
13081                pub is_live: std::option::Option<bool>,
13082
13083                /// Relevant only for versioned objects. If the value is N, this
13084                /// condition is satisfied when there are at least N versions (including
13085                /// the live version) newer than this version of the object.
13086                pub num_newer_versions: std::option::Option<i32>,
13087
13088                /// Optional. Objects having any of the storage classes specified by this
13089                /// condition will be matched. Values include `MULTI_REGIONAL`,
13090                /// `REGIONAL`, `NEARLINE`, `COLDLINE`, `STANDARD`, and
13091                /// `DURABLE_REDUCED_AVAILABILITY`.
13092                pub matches_storage_class: std::vec::Vec<std::string::String>,
13093
13094                /// Number of days that have elapsed since the custom timestamp set on an
13095                /// object.
13096                /// The value of the field must be a nonnegative integer.
13097                pub days_since_custom_time: std::option::Option<i32>,
13098
13099                /// Optional. An object matches this condition if the custom timestamp
13100                /// set on the object is before the specified date in UTC.
13101                pub custom_time_before: std::option::Option<gtype::model::Date>,
13102
13103                /// This condition is relevant only for versioned objects. An object
13104                /// version satisfies this condition only if these many days have been
13105                /// passed since it became noncurrent. The value of the field must be a
13106                /// nonnegative integer. If it's zero, the object version will become
13107                /// eligible for Lifecycle action as soon as it becomes noncurrent.
13108                pub days_since_noncurrent_time: std::option::Option<i32>,
13109
13110                /// Optional. This condition is relevant only for versioned objects. An
13111                /// object version satisfies this condition only if it became noncurrent
13112                /// before the specified date in UTC.
13113                pub noncurrent_time_before: std::option::Option<gtype::model::Date>,
13114
13115                /// Optional. List of object name prefixes. If any prefix exactly matches
13116                /// the beginning of the object name, the condition evaluates to true.
13117                pub matches_prefix: std::vec::Vec<std::string::String>,
13118
13119                /// Optional. List of object name suffixes. If any suffix exactly matches
13120                /// the end of the object name, the condition evaluates to true.
13121                pub matches_suffix: std::vec::Vec<std::string::String>,
13122
13123                _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
13124            }
13125
13126            impl Condition {
13127                pub fn new() -> Self {
13128                    std::default::Default::default()
13129                }
13130
13131                /// Sets the value of [age_days][crate::model::bucket::lifecycle::rule::Condition::age_days].
13132                pub fn set_age_days<T>(mut self, v: T) -> Self
13133                where
13134                    T: std::convert::Into<i32>,
13135                {
13136                    self.age_days = std::option::Option::Some(v.into());
13137                    self
13138                }
13139
13140                /// Sets or clears the value of [age_days][crate::model::bucket::lifecycle::rule::Condition::age_days].
13141                pub fn set_or_clear_age_days<T>(mut self, v: std::option::Option<T>) -> Self
13142                where
13143                    T: std::convert::Into<i32>,
13144                {
13145                    self.age_days = v.map(|x| x.into());
13146                    self
13147                }
13148
13149                /// Sets the value of [created_before][crate::model::bucket::lifecycle::rule::Condition::created_before].
13150                pub fn set_created_before<T>(mut self, v: T) -> Self
13151                where
13152                    T: std::convert::Into<gtype::model::Date>,
13153                {
13154                    self.created_before = std::option::Option::Some(v.into());
13155                    self
13156                }
13157
13158                /// Sets or clears the value of [created_before][crate::model::bucket::lifecycle::rule::Condition::created_before].
13159                pub fn set_or_clear_created_before<T>(mut self, v: std::option::Option<T>) -> Self
13160                where
13161                    T: std::convert::Into<gtype::model::Date>,
13162                {
13163                    self.created_before = v.map(|x| x.into());
13164                    self
13165                }
13166
13167                /// Sets the value of [is_live][crate::model::bucket::lifecycle::rule::Condition::is_live].
13168                pub fn set_is_live<T>(mut self, v: T) -> Self
13169                where
13170                    T: std::convert::Into<bool>,
13171                {
13172                    self.is_live = std::option::Option::Some(v.into());
13173                    self
13174                }
13175
13176                /// Sets or clears the value of [is_live][crate::model::bucket::lifecycle::rule::Condition::is_live].
13177                pub fn set_or_clear_is_live<T>(mut self, v: std::option::Option<T>) -> Self
13178                where
13179                    T: std::convert::Into<bool>,
13180                {
13181                    self.is_live = v.map(|x| x.into());
13182                    self
13183                }
13184
13185                /// Sets the value of [num_newer_versions][crate::model::bucket::lifecycle::rule::Condition::num_newer_versions].
13186                pub fn set_num_newer_versions<T>(mut self, v: T) -> Self
13187                where
13188                    T: std::convert::Into<i32>,
13189                {
13190                    self.num_newer_versions = std::option::Option::Some(v.into());
13191                    self
13192                }
13193
13194                /// Sets or clears the value of [num_newer_versions][crate::model::bucket::lifecycle::rule::Condition::num_newer_versions].
13195                pub fn set_or_clear_num_newer_versions<T>(
13196                    mut self,
13197                    v: std::option::Option<T>,
13198                ) -> Self
13199                where
13200                    T: std::convert::Into<i32>,
13201                {
13202                    self.num_newer_versions = v.map(|x| x.into());
13203                    self
13204                }
13205
13206                /// Sets the value of [matches_storage_class][crate::model::bucket::lifecycle::rule::Condition::matches_storage_class].
13207                pub fn set_matches_storage_class<T, V>(mut self, v: T) -> Self
13208                where
13209                    T: std::iter::IntoIterator<Item = V>,
13210                    V: std::convert::Into<std::string::String>,
13211                {
13212                    use std::iter::Iterator;
13213                    self.matches_storage_class = v.into_iter().map(|i| i.into()).collect();
13214                    self
13215                }
13216
13217                /// Sets the value of [days_since_custom_time][crate::model::bucket::lifecycle::rule::Condition::days_since_custom_time].
13218                pub fn set_days_since_custom_time<T>(mut self, v: T) -> Self
13219                where
13220                    T: std::convert::Into<i32>,
13221                {
13222                    self.days_since_custom_time = std::option::Option::Some(v.into());
13223                    self
13224                }
13225
13226                /// Sets or clears the value of [days_since_custom_time][crate::model::bucket::lifecycle::rule::Condition::days_since_custom_time].
13227                pub fn set_or_clear_days_since_custom_time<T>(
13228                    mut self,
13229                    v: std::option::Option<T>,
13230                ) -> Self
13231                where
13232                    T: std::convert::Into<i32>,
13233                {
13234                    self.days_since_custom_time = v.map(|x| x.into());
13235                    self
13236                }
13237
13238                /// Sets the value of [custom_time_before][crate::model::bucket::lifecycle::rule::Condition::custom_time_before].
13239                pub fn set_custom_time_before<T>(mut self, v: T) -> Self
13240                where
13241                    T: std::convert::Into<gtype::model::Date>,
13242                {
13243                    self.custom_time_before = std::option::Option::Some(v.into());
13244                    self
13245                }
13246
13247                /// Sets or clears the value of [custom_time_before][crate::model::bucket::lifecycle::rule::Condition::custom_time_before].
13248                pub fn set_or_clear_custom_time_before<T>(
13249                    mut self,
13250                    v: std::option::Option<T>,
13251                ) -> Self
13252                where
13253                    T: std::convert::Into<gtype::model::Date>,
13254                {
13255                    self.custom_time_before = v.map(|x| x.into());
13256                    self
13257                }
13258
13259                /// Sets the value of [days_since_noncurrent_time][crate::model::bucket::lifecycle::rule::Condition::days_since_noncurrent_time].
13260                pub fn set_days_since_noncurrent_time<T>(mut self, v: T) -> Self
13261                where
13262                    T: std::convert::Into<i32>,
13263                {
13264                    self.days_since_noncurrent_time = std::option::Option::Some(v.into());
13265                    self
13266                }
13267
13268                /// Sets or clears the value of [days_since_noncurrent_time][crate::model::bucket::lifecycle::rule::Condition::days_since_noncurrent_time].
13269                pub fn set_or_clear_days_since_noncurrent_time<T>(
13270                    mut self,
13271                    v: std::option::Option<T>,
13272                ) -> Self
13273                where
13274                    T: std::convert::Into<i32>,
13275                {
13276                    self.days_since_noncurrent_time = v.map(|x| x.into());
13277                    self
13278                }
13279
13280                /// Sets the value of [noncurrent_time_before][crate::model::bucket::lifecycle::rule::Condition::noncurrent_time_before].
13281                pub fn set_noncurrent_time_before<T>(mut self, v: T) -> Self
13282                where
13283                    T: std::convert::Into<gtype::model::Date>,
13284                {
13285                    self.noncurrent_time_before = std::option::Option::Some(v.into());
13286                    self
13287                }
13288
13289                /// Sets or clears the value of [noncurrent_time_before][crate::model::bucket::lifecycle::rule::Condition::noncurrent_time_before].
13290                pub fn set_or_clear_noncurrent_time_before<T>(
13291                    mut self,
13292                    v: std::option::Option<T>,
13293                ) -> Self
13294                where
13295                    T: std::convert::Into<gtype::model::Date>,
13296                {
13297                    self.noncurrent_time_before = v.map(|x| x.into());
13298                    self
13299                }
13300
13301                /// Sets the value of [matches_prefix][crate::model::bucket::lifecycle::rule::Condition::matches_prefix].
13302                pub fn set_matches_prefix<T, V>(mut self, v: T) -> Self
13303                where
13304                    T: std::iter::IntoIterator<Item = V>,
13305                    V: std::convert::Into<std::string::String>,
13306                {
13307                    use std::iter::Iterator;
13308                    self.matches_prefix = v.into_iter().map(|i| i.into()).collect();
13309                    self
13310                }
13311
13312                /// Sets the value of [matches_suffix][crate::model::bucket::lifecycle::rule::Condition::matches_suffix].
13313                pub fn set_matches_suffix<T, V>(mut self, v: T) -> Self
13314                where
13315                    T: std::iter::IntoIterator<Item = V>,
13316                    V: std::convert::Into<std::string::String>,
13317                {
13318                    use std::iter::Iterator;
13319                    self.matches_suffix = v.into_iter().map(|i| i.into()).collect();
13320                    self
13321                }
13322            }
13323
13324            impl wkt::message::Message for Condition {
13325                fn typename() -> &'static str {
13326                    "type.googleapis.com/google.storage.v2.Bucket.Lifecycle.Rule.Condition"
13327                }
13328            }
13329
13330            #[doc(hidden)]
13331            impl<'de> serde::de::Deserialize<'de> for Condition {
13332                fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
13333                where
13334                    D: serde::Deserializer<'de>,
13335                {
13336                    #[allow(non_camel_case_types)]
13337                    #[doc(hidden)]
13338                    #[derive(PartialEq, Eq, Hash)]
13339                    enum __FieldTag {
13340                        __age_days,
13341                        __created_before,
13342                        __is_live,
13343                        __num_newer_versions,
13344                        __matches_storage_class,
13345                        __days_since_custom_time,
13346                        __custom_time_before,
13347                        __days_since_noncurrent_time,
13348                        __noncurrent_time_before,
13349                        __matches_prefix,
13350                        __matches_suffix,
13351                        Unknown(std::string::String),
13352                    }
13353                    impl<'de> serde::de::Deserialize<'de> for __FieldTag {
13354                        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
13355                        where
13356                            D: serde::Deserializer<'de>,
13357                        {
13358                            struct Visitor;
13359                            impl<'de> serde::de::Visitor<'de> for Visitor {
13360                                type Value = __FieldTag;
13361                                fn expecting(
13362                                    &self,
13363                                    formatter: &mut std::fmt::Formatter,
13364                                ) -> std::fmt::Result {
13365                                    formatter.write_str("a field name for Condition")
13366                                }
13367                                fn visit_str<E>(
13368                                    self,
13369                                    value: &str,
13370                                ) -> std::result::Result<Self::Value, E>
13371                                where
13372                                    E: serde::de::Error,
13373                                {
13374                                    use std::result::Result::Ok;
13375                                    use std::string::ToString;
13376                                    match value {
13377                                        "ageDays" => Ok(__FieldTag::__age_days),
13378                                        "age_days" => Ok(__FieldTag::__age_days),
13379                                        "createdBefore" => Ok(__FieldTag::__created_before),
13380                                        "created_before" => Ok(__FieldTag::__created_before),
13381                                        "isLive" => Ok(__FieldTag::__is_live),
13382                                        "is_live" => Ok(__FieldTag::__is_live),
13383                                        "numNewerVersions" => Ok(__FieldTag::__num_newer_versions),
13384                                        "num_newer_versions" => {
13385                                            Ok(__FieldTag::__num_newer_versions)
13386                                        }
13387                                        "matchesStorageClass" => {
13388                                            Ok(__FieldTag::__matches_storage_class)
13389                                        }
13390                                        "matches_storage_class" => {
13391                                            Ok(__FieldTag::__matches_storage_class)
13392                                        }
13393                                        "daysSinceCustomTime" => {
13394                                            Ok(__FieldTag::__days_since_custom_time)
13395                                        }
13396                                        "days_since_custom_time" => {
13397                                            Ok(__FieldTag::__days_since_custom_time)
13398                                        }
13399                                        "customTimeBefore" => Ok(__FieldTag::__custom_time_before),
13400                                        "custom_time_before" => {
13401                                            Ok(__FieldTag::__custom_time_before)
13402                                        }
13403                                        "daysSinceNoncurrentTime" => {
13404                                            Ok(__FieldTag::__days_since_noncurrent_time)
13405                                        }
13406                                        "days_since_noncurrent_time" => {
13407                                            Ok(__FieldTag::__days_since_noncurrent_time)
13408                                        }
13409                                        "noncurrentTimeBefore" => {
13410                                            Ok(__FieldTag::__noncurrent_time_before)
13411                                        }
13412                                        "noncurrent_time_before" => {
13413                                            Ok(__FieldTag::__noncurrent_time_before)
13414                                        }
13415                                        "matchesPrefix" => Ok(__FieldTag::__matches_prefix),
13416                                        "matches_prefix" => Ok(__FieldTag::__matches_prefix),
13417                                        "matchesSuffix" => Ok(__FieldTag::__matches_suffix),
13418                                        "matches_suffix" => Ok(__FieldTag::__matches_suffix),
13419                                        _ => Ok(__FieldTag::Unknown(value.to_string())),
13420                                    }
13421                                }
13422                            }
13423                            deserializer.deserialize_identifier(Visitor)
13424                        }
13425                    }
13426                    struct Visitor;
13427                    impl<'de> serde::de::Visitor<'de> for Visitor {
13428                        type Value = Condition;
13429                        fn expecting(
13430                            &self,
13431                            formatter: &mut std::fmt::Formatter,
13432                        ) -> std::fmt::Result {
13433                            formatter.write_str("struct Condition")
13434                        }
13435                        fn visit_map<A>(
13436                            self,
13437                            mut map: A,
13438                        ) -> std::result::Result<Self::Value, A::Error>
13439                        where
13440                            A: serde::de::MapAccess<'de>,
13441                        {
13442                            #[allow(unused_imports)]
13443                            use serde::de::Error;
13444                            use std::option::Option::Some;
13445                            let mut fields = std::collections::HashSet::new();
13446                            let mut result = Self::Value::new();
13447                            while let Some(tag) = map.next_key::<__FieldTag>()? {
13448                                #[allow(clippy::match_single_binding)]
13449                                match tag {
13450                                    __FieldTag::__age_days => {
13451                                        if !fields.insert(__FieldTag::__age_days) {
13452                                            return std::result::Result::Err(
13453                                                A::Error::duplicate_field(
13454                                                    "multiple values for age_days",
13455                                                ),
13456                                            );
13457                                        }
13458                                        struct __With(std::option::Option<i32>);
13459                                        impl<'de> serde::de::Deserialize<'de> for __With {
13460                                            fn deserialize<D>(
13461                                                deserializer: D,
13462                                            ) -> std::result::Result<Self, D::Error>
13463                                            where
13464                                                D: serde::de::Deserializer<'de>,
13465                                            {
13466                                                serde_with::As::<
13467                                                    std::option::Option<wkt::internal::I32>,
13468                                                >::deserialize(
13469                                                    deserializer
13470                                                )
13471                                                .map(__With)
13472                                            }
13473                                        }
13474                                        result.age_days = map.next_value::<__With>()?.0;
13475                                    }
13476                                    __FieldTag::__created_before => {
13477                                        if !fields.insert(__FieldTag::__created_before) {
13478                                            return std::result::Result::Err(
13479                                                A::Error::duplicate_field(
13480                                                    "multiple values for created_before",
13481                                                ),
13482                                            );
13483                                        }
13484                                        result.created_before = map
13485                                            .next_value::<std::option::Option<gtype::model::Date>>(
13486                                            )?;
13487                                    }
13488                                    __FieldTag::__is_live => {
13489                                        if !fields.insert(__FieldTag::__is_live) {
13490                                            return std::result::Result::Err(
13491                                                A::Error::duplicate_field(
13492                                                    "multiple values for is_live",
13493                                                ),
13494                                            );
13495                                        }
13496                                        result.is_live =
13497                                            map.next_value::<std::option::Option<bool>>()?;
13498                                    }
13499                                    __FieldTag::__num_newer_versions => {
13500                                        if !fields.insert(__FieldTag::__num_newer_versions) {
13501                                            return std::result::Result::Err(
13502                                                A::Error::duplicate_field(
13503                                                    "multiple values for num_newer_versions",
13504                                                ),
13505                                            );
13506                                        }
13507                                        struct __With(std::option::Option<i32>);
13508                                        impl<'de> serde::de::Deserialize<'de> for __With {
13509                                            fn deserialize<D>(
13510                                                deserializer: D,
13511                                            ) -> std::result::Result<Self, D::Error>
13512                                            where
13513                                                D: serde::de::Deserializer<'de>,
13514                                            {
13515                                                serde_with::As::<
13516                                                    std::option::Option<wkt::internal::I32>,
13517                                                >::deserialize(
13518                                                    deserializer
13519                                                )
13520                                                .map(__With)
13521                                            }
13522                                        }
13523                                        result.num_newer_versions = map.next_value::<__With>()?.0;
13524                                    }
13525                                    __FieldTag::__matches_storage_class => {
13526                                        if !fields.insert(__FieldTag::__matches_storage_class) {
13527                                            return std::result::Result::Err(
13528                                                A::Error::duplicate_field(
13529                                                    "multiple values for matches_storage_class",
13530                                                ),
13531                                            );
13532                                        }
13533                                        result.matches_storage_class =
13534                                            map.next_value::<std::option::Option<
13535                                                std::vec::Vec<std::string::String>,
13536                                            >>()?
13537                                            .unwrap_or_default();
13538                                    }
13539                                    __FieldTag::__days_since_custom_time => {
13540                                        if !fields.insert(__FieldTag::__days_since_custom_time) {
13541                                            return std::result::Result::Err(
13542                                                A::Error::duplicate_field(
13543                                                    "multiple values for days_since_custom_time",
13544                                                ),
13545                                            );
13546                                        }
13547                                        struct __With(std::option::Option<i32>);
13548                                        impl<'de> serde::de::Deserialize<'de> for __With {
13549                                            fn deserialize<D>(
13550                                                deserializer: D,
13551                                            ) -> std::result::Result<Self, D::Error>
13552                                            where
13553                                                D: serde::de::Deserializer<'de>,
13554                                            {
13555                                                serde_with::As::<
13556                                                    std::option::Option<wkt::internal::I32>,
13557                                                >::deserialize(
13558                                                    deserializer
13559                                                )
13560                                                .map(__With)
13561                                            }
13562                                        }
13563                                        result.days_since_custom_time =
13564                                            map.next_value::<__With>()?.0;
13565                                    }
13566                                    __FieldTag::__custom_time_before => {
13567                                        if !fields.insert(__FieldTag::__custom_time_before) {
13568                                            return std::result::Result::Err(
13569                                                A::Error::duplicate_field(
13570                                                    "multiple values for custom_time_before",
13571                                                ),
13572                                            );
13573                                        }
13574                                        result.custom_time_before = map
13575                                            .next_value::<std::option::Option<gtype::model::Date>>(
13576                                            )?;
13577                                    }
13578                                    __FieldTag::__days_since_noncurrent_time => {
13579                                        if !fields.insert(__FieldTag::__days_since_noncurrent_time)
13580                                        {
13581                                            return std::result::Result::Err(
13582                                                A::Error::duplicate_field(
13583                                                    "multiple values for days_since_noncurrent_time",
13584                                                ),
13585                                            );
13586                                        }
13587                                        struct __With(std::option::Option<i32>);
13588                                        impl<'de> serde::de::Deserialize<'de> for __With {
13589                                            fn deserialize<D>(
13590                                                deserializer: D,
13591                                            ) -> std::result::Result<Self, D::Error>
13592                                            where
13593                                                D: serde::de::Deserializer<'de>,
13594                                            {
13595                                                serde_with::As::<
13596                                                    std::option::Option<wkt::internal::I32>,
13597                                                >::deserialize(
13598                                                    deserializer
13599                                                )
13600                                                .map(__With)
13601                                            }
13602                                        }
13603                                        result.days_since_noncurrent_time =
13604                                            map.next_value::<__With>()?.0;
13605                                    }
13606                                    __FieldTag::__noncurrent_time_before => {
13607                                        if !fields.insert(__FieldTag::__noncurrent_time_before) {
13608                                            return std::result::Result::Err(
13609                                                A::Error::duplicate_field(
13610                                                    "multiple values for noncurrent_time_before",
13611                                                ),
13612                                            );
13613                                        }
13614                                        result.noncurrent_time_before = map
13615                                            .next_value::<std::option::Option<gtype::model::Date>>(
13616                                            )?;
13617                                    }
13618                                    __FieldTag::__matches_prefix => {
13619                                        if !fields.insert(__FieldTag::__matches_prefix) {
13620                                            return std::result::Result::Err(
13621                                                A::Error::duplicate_field(
13622                                                    "multiple values for matches_prefix",
13623                                                ),
13624                                            );
13625                                        }
13626                                        result.matches_prefix =
13627                                            map.next_value::<std::option::Option<
13628                                                std::vec::Vec<std::string::String>,
13629                                            >>()?
13630                                            .unwrap_or_default();
13631                                    }
13632                                    __FieldTag::__matches_suffix => {
13633                                        if !fields.insert(__FieldTag::__matches_suffix) {
13634                                            return std::result::Result::Err(
13635                                                A::Error::duplicate_field(
13636                                                    "multiple values for matches_suffix",
13637                                                ),
13638                                            );
13639                                        }
13640                                        result.matches_suffix =
13641                                            map.next_value::<std::option::Option<
13642                                                std::vec::Vec<std::string::String>,
13643                                            >>()?
13644                                            .unwrap_or_default();
13645                                    }
13646                                    __FieldTag::Unknown(key) => {
13647                                        let value = map.next_value::<serde_json::Value>()?;
13648                                        result._unknown_fields.insert(key, value);
13649                                    }
13650                                }
13651                            }
13652                            std::result::Result::Ok(result)
13653                        }
13654                    }
13655                    deserializer.deserialize_any(Visitor)
13656                }
13657            }
13658
13659            #[doc(hidden)]
13660            impl serde::ser::Serialize for Condition {
13661                fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
13662                where
13663                    S: serde::ser::Serializer,
13664                {
13665                    use serde::ser::SerializeMap;
13666                    #[allow(unused_imports)]
13667                    use std::option::Option::Some;
13668                    let mut state = serializer.serialize_map(std::option::Option::None)?;
13669                    if self.age_days.is_some() {
13670                        struct __With<'a>(&'a std::option::Option<i32>);
13671                        impl<'a> serde::ser::Serialize for __With<'a> {
13672                            fn serialize<S>(
13673                                &self,
13674                                serializer: S,
13675                            ) -> std::result::Result<S::Ok, S::Error>
13676                            where
13677                                S: serde::ser::Serializer,
13678                            {
13679                                serde_with::As::<std::option::Option<wkt::internal::I32>>::serialize(
13680                                    self.0, serializer,
13681                                )
13682                            }
13683                        }
13684                        state.serialize_entry("ageDays", &__With(&self.age_days))?;
13685                    }
13686                    if self.created_before.is_some() {
13687                        state.serialize_entry("createdBefore", &self.created_before)?;
13688                    }
13689                    if self.is_live.is_some() {
13690                        state.serialize_entry("isLive", &self.is_live)?;
13691                    }
13692                    if self.num_newer_versions.is_some() {
13693                        struct __With<'a>(&'a std::option::Option<i32>);
13694                        impl<'a> serde::ser::Serialize for __With<'a> {
13695                            fn serialize<S>(
13696                                &self,
13697                                serializer: S,
13698                            ) -> std::result::Result<S::Ok, S::Error>
13699                            where
13700                                S: serde::ser::Serializer,
13701                            {
13702                                serde_with::As::<std::option::Option<wkt::internal::I32>>::serialize(
13703                                    self.0, serializer,
13704                                )
13705                            }
13706                        }
13707                        state.serialize_entry(
13708                            "numNewerVersions",
13709                            &__With(&self.num_newer_versions),
13710                        )?;
13711                    }
13712                    if !self.matches_storage_class.is_empty() {
13713                        state
13714                            .serialize_entry("matchesStorageClass", &self.matches_storage_class)?;
13715                    }
13716                    if self.days_since_custom_time.is_some() {
13717                        struct __With<'a>(&'a std::option::Option<i32>);
13718                        impl<'a> serde::ser::Serialize for __With<'a> {
13719                            fn serialize<S>(
13720                                &self,
13721                                serializer: S,
13722                            ) -> std::result::Result<S::Ok, S::Error>
13723                            where
13724                                S: serde::ser::Serializer,
13725                            {
13726                                serde_with::As::<std::option::Option<wkt::internal::I32>>::serialize(
13727                                    self.0, serializer,
13728                                )
13729                            }
13730                        }
13731                        state.serialize_entry(
13732                            "daysSinceCustomTime",
13733                            &__With(&self.days_since_custom_time),
13734                        )?;
13735                    }
13736                    if self.custom_time_before.is_some() {
13737                        state.serialize_entry("customTimeBefore", &self.custom_time_before)?;
13738                    }
13739                    if self.days_since_noncurrent_time.is_some() {
13740                        struct __With<'a>(&'a std::option::Option<i32>);
13741                        impl<'a> serde::ser::Serialize for __With<'a> {
13742                            fn serialize<S>(
13743                                &self,
13744                                serializer: S,
13745                            ) -> std::result::Result<S::Ok, S::Error>
13746                            where
13747                                S: serde::ser::Serializer,
13748                            {
13749                                serde_with::As::<std::option::Option<wkt::internal::I32>>::serialize(
13750                                    self.0, serializer,
13751                                )
13752                            }
13753                        }
13754                        state.serialize_entry(
13755                            "daysSinceNoncurrentTime",
13756                            &__With(&self.days_since_noncurrent_time),
13757                        )?;
13758                    }
13759                    if self.noncurrent_time_before.is_some() {
13760                        state.serialize_entry(
13761                            "noncurrentTimeBefore",
13762                            &self.noncurrent_time_before,
13763                        )?;
13764                    }
13765                    if !self.matches_prefix.is_empty() {
13766                        state.serialize_entry("matchesPrefix", &self.matches_prefix)?;
13767                    }
13768                    if !self.matches_suffix.is_empty() {
13769                        state.serialize_entry("matchesSuffix", &self.matches_suffix)?;
13770                    }
13771                    if !self._unknown_fields.is_empty() {
13772                        for (key, value) in self._unknown_fields.iter() {
13773                            state.serialize_entry(key, &value)?;
13774                        }
13775                    }
13776                    state.end()
13777                }
13778            }
13779
13780            impl std::fmt::Debug for Condition {
13781                fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
13782                    let mut debug_struct = f.debug_struct("Condition");
13783                    debug_struct.field("age_days", &self.age_days);
13784                    debug_struct.field("created_before", &self.created_before);
13785                    debug_struct.field("is_live", &self.is_live);
13786                    debug_struct.field("num_newer_versions", &self.num_newer_versions);
13787                    debug_struct.field("matches_storage_class", &self.matches_storage_class);
13788                    debug_struct.field("days_since_custom_time", &self.days_since_custom_time);
13789                    debug_struct.field("custom_time_before", &self.custom_time_before);
13790                    debug_struct.field(
13791                        "days_since_noncurrent_time",
13792                        &self.days_since_noncurrent_time,
13793                    );
13794                    debug_struct.field("noncurrent_time_before", &self.noncurrent_time_before);
13795                    debug_struct.field("matches_prefix", &self.matches_prefix);
13796                    debug_struct.field("matches_suffix", &self.matches_suffix);
13797                    if !self._unknown_fields.is_empty() {
13798                        debug_struct.field("_unknown_fields", &self._unknown_fields);
13799                    }
13800                    debug_struct.finish()
13801                }
13802            }
13803        }
13804    }
13805
13806    /// Logging-related properties of a bucket.
13807    #[derive(Clone, Default, PartialEq)]
13808    #[non_exhaustive]
13809    pub struct Logging {
13810        /// Optional. The destination bucket where the current bucket's logs should
13811        /// be placed, using path format (like `projects/123456/buckets/foo`).
13812        pub log_bucket: std::string::String,
13813
13814        /// Optional. A prefix for log object names.
13815        pub log_object_prefix: std::string::String,
13816
13817        _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
13818    }
13819
13820    impl Logging {
13821        pub fn new() -> Self {
13822            std::default::Default::default()
13823        }
13824
13825        /// Sets the value of [log_bucket][crate::model::bucket::Logging::log_bucket].
13826        pub fn set_log_bucket<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
13827            self.log_bucket = v.into();
13828            self
13829        }
13830
13831        /// Sets the value of [log_object_prefix][crate::model::bucket::Logging::log_object_prefix].
13832        pub fn set_log_object_prefix<T: std::convert::Into<std::string::String>>(
13833            mut self,
13834            v: T,
13835        ) -> Self {
13836            self.log_object_prefix = v.into();
13837            self
13838        }
13839    }
13840
13841    impl wkt::message::Message for Logging {
13842        fn typename() -> &'static str {
13843            "type.googleapis.com/google.storage.v2.Bucket.Logging"
13844        }
13845    }
13846
13847    #[doc(hidden)]
13848    impl<'de> serde::de::Deserialize<'de> for Logging {
13849        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
13850        where
13851            D: serde::Deserializer<'de>,
13852        {
13853            #[allow(non_camel_case_types)]
13854            #[doc(hidden)]
13855            #[derive(PartialEq, Eq, Hash)]
13856            enum __FieldTag {
13857                __log_bucket,
13858                __log_object_prefix,
13859                Unknown(std::string::String),
13860            }
13861            impl<'de> serde::de::Deserialize<'de> for __FieldTag {
13862                fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
13863                where
13864                    D: serde::Deserializer<'de>,
13865                {
13866                    struct Visitor;
13867                    impl<'de> serde::de::Visitor<'de> for Visitor {
13868                        type Value = __FieldTag;
13869                        fn expecting(
13870                            &self,
13871                            formatter: &mut std::fmt::Formatter,
13872                        ) -> std::fmt::Result {
13873                            formatter.write_str("a field name for Logging")
13874                        }
13875                        fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
13876                        where
13877                            E: serde::de::Error,
13878                        {
13879                            use std::result::Result::Ok;
13880                            use std::string::ToString;
13881                            match value {
13882                                "logBucket" => Ok(__FieldTag::__log_bucket),
13883                                "log_bucket" => Ok(__FieldTag::__log_bucket),
13884                                "logObjectPrefix" => Ok(__FieldTag::__log_object_prefix),
13885                                "log_object_prefix" => Ok(__FieldTag::__log_object_prefix),
13886                                _ => Ok(__FieldTag::Unknown(value.to_string())),
13887                            }
13888                        }
13889                    }
13890                    deserializer.deserialize_identifier(Visitor)
13891                }
13892            }
13893            struct Visitor;
13894            impl<'de> serde::de::Visitor<'de> for Visitor {
13895                type Value = Logging;
13896                fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
13897                    formatter.write_str("struct Logging")
13898                }
13899                fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
13900                where
13901                    A: serde::de::MapAccess<'de>,
13902                {
13903                    #[allow(unused_imports)]
13904                    use serde::de::Error;
13905                    use std::option::Option::Some;
13906                    let mut fields = std::collections::HashSet::new();
13907                    let mut result = Self::Value::new();
13908                    while let Some(tag) = map.next_key::<__FieldTag>()? {
13909                        #[allow(clippy::match_single_binding)]
13910                        match tag {
13911                            __FieldTag::__log_bucket => {
13912                                if !fields.insert(__FieldTag::__log_bucket) {
13913                                    return std::result::Result::Err(A::Error::duplicate_field(
13914                                        "multiple values for log_bucket",
13915                                    ));
13916                                }
13917                                result.log_bucket = map
13918                                    .next_value::<std::option::Option<std::string::String>>()?
13919                                    .unwrap_or_default();
13920                            }
13921                            __FieldTag::__log_object_prefix => {
13922                                if !fields.insert(__FieldTag::__log_object_prefix) {
13923                                    return std::result::Result::Err(A::Error::duplicate_field(
13924                                        "multiple values for log_object_prefix",
13925                                    ));
13926                                }
13927                                result.log_object_prefix = map
13928                                    .next_value::<std::option::Option<std::string::String>>()?
13929                                    .unwrap_or_default();
13930                            }
13931                            __FieldTag::Unknown(key) => {
13932                                let value = map.next_value::<serde_json::Value>()?;
13933                                result._unknown_fields.insert(key, value);
13934                            }
13935                        }
13936                    }
13937                    std::result::Result::Ok(result)
13938                }
13939            }
13940            deserializer.deserialize_any(Visitor)
13941        }
13942    }
13943
13944    #[doc(hidden)]
13945    impl serde::ser::Serialize for Logging {
13946        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
13947        where
13948            S: serde::ser::Serializer,
13949        {
13950            use serde::ser::SerializeMap;
13951            #[allow(unused_imports)]
13952            use std::option::Option::Some;
13953            let mut state = serializer.serialize_map(std::option::Option::None)?;
13954            if !self.log_bucket.is_empty() {
13955                state.serialize_entry("logBucket", &self.log_bucket)?;
13956            }
13957            if !self.log_object_prefix.is_empty() {
13958                state.serialize_entry("logObjectPrefix", &self.log_object_prefix)?;
13959            }
13960            if !self._unknown_fields.is_empty() {
13961                for (key, value) in self._unknown_fields.iter() {
13962                    state.serialize_entry(key, &value)?;
13963                }
13964            }
13965            state.end()
13966        }
13967    }
13968
13969    impl std::fmt::Debug for Logging {
13970        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
13971            let mut debug_struct = f.debug_struct("Logging");
13972            debug_struct.field("log_bucket", &self.log_bucket);
13973            debug_struct.field("log_object_prefix", &self.log_object_prefix);
13974            if !self._unknown_fields.is_empty() {
13975                debug_struct.field("_unknown_fields", &self._unknown_fields);
13976            }
13977            debug_struct.finish()
13978        }
13979    }
13980
13981    /// Object Retention related properties of a bucket.
13982    #[derive(Clone, Default, PartialEq)]
13983    #[non_exhaustive]
13984    pub struct ObjectRetention {
13985        /// Optional. Output only. If true, object retention is enabled for the
13986        /// bucket.
13987        pub enabled: bool,
13988
13989        _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
13990    }
13991
13992    impl ObjectRetention {
13993        pub fn new() -> Self {
13994            std::default::Default::default()
13995        }
13996
13997        /// Sets the value of [enabled][crate::model::bucket::ObjectRetention::enabled].
13998        pub fn set_enabled<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
13999            self.enabled = v.into();
14000            self
14001        }
14002    }
14003
14004    impl wkt::message::Message for ObjectRetention {
14005        fn typename() -> &'static str {
14006            "type.googleapis.com/google.storage.v2.Bucket.ObjectRetention"
14007        }
14008    }
14009
14010    #[doc(hidden)]
14011    impl<'de> serde::de::Deserialize<'de> for ObjectRetention {
14012        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
14013        where
14014            D: serde::Deserializer<'de>,
14015        {
14016            #[allow(non_camel_case_types)]
14017            #[doc(hidden)]
14018            #[derive(PartialEq, Eq, Hash)]
14019            enum __FieldTag {
14020                __enabled,
14021                Unknown(std::string::String),
14022            }
14023            impl<'de> serde::de::Deserialize<'de> for __FieldTag {
14024                fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
14025                where
14026                    D: serde::Deserializer<'de>,
14027                {
14028                    struct Visitor;
14029                    impl<'de> serde::de::Visitor<'de> for Visitor {
14030                        type Value = __FieldTag;
14031                        fn expecting(
14032                            &self,
14033                            formatter: &mut std::fmt::Formatter,
14034                        ) -> std::fmt::Result {
14035                            formatter.write_str("a field name for ObjectRetention")
14036                        }
14037                        fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
14038                        where
14039                            E: serde::de::Error,
14040                        {
14041                            use std::result::Result::Ok;
14042                            use std::string::ToString;
14043                            match value {
14044                                "enabled" => Ok(__FieldTag::__enabled),
14045                                _ => Ok(__FieldTag::Unknown(value.to_string())),
14046                            }
14047                        }
14048                    }
14049                    deserializer.deserialize_identifier(Visitor)
14050                }
14051            }
14052            struct Visitor;
14053            impl<'de> serde::de::Visitor<'de> for Visitor {
14054                type Value = ObjectRetention;
14055                fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
14056                    formatter.write_str("struct ObjectRetention")
14057                }
14058                fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
14059                where
14060                    A: serde::de::MapAccess<'de>,
14061                {
14062                    #[allow(unused_imports)]
14063                    use serde::de::Error;
14064                    use std::option::Option::Some;
14065                    let mut fields = std::collections::HashSet::new();
14066                    let mut result = Self::Value::new();
14067                    while let Some(tag) = map.next_key::<__FieldTag>()? {
14068                        #[allow(clippy::match_single_binding)]
14069                        match tag {
14070                            __FieldTag::__enabled => {
14071                                if !fields.insert(__FieldTag::__enabled) {
14072                                    return std::result::Result::Err(A::Error::duplicate_field(
14073                                        "multiple values for enabled",
14074                                    ));
14075                                }
14076                                result.enabled = map
14077                                    .next_value::<std::option::Option<bool>>()?
14078                                    .unwrap_or_default();
14079                            }
14080                            __FieldTag::Unknown(key) => {
14081                                let value = map.next_value::<serde_json::Value>()?;
14082                                result._unknown_fields.insert(key, value);
14083                            }
14084                        }
14085                    }
14086                    std::result::Result::Ok(result)
14087                }
14088            }
14089            deserializer.deserialize_any(Visitor)
14090        }
14091    }
14092
14093    #[doc(hidden)]
14094    impl serde::ser::Serialize for ObjectRetention {
14095        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
14096        where
14097            S: serde::ser::Serializer,
14098        {
14099            use serde::ser::SerializeMap;
14100            #[allow(unused_imports)]
14101            use std::option::Option::Some;
14102            let mut state = serializer.serialize_map(std::option::Option::None)?;
14103            if !wkt::internal::is_default(&self.enabled) {
14104                state.serialize_entry("enabled", &self.enabled)?;
14105            }
14106            if !self._unknown_fields.is_empty() {
14107                for (key, value) in self._unknown_fields.iter() {
14108                    state.serialize_entry(key, &value)?;
14109                }
14110            }
14111            state.end()
14112        }
14113    }
14114
14115    impl std::fmt::Debug for ObjectRetention {
14116        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
14117            let mut debug_struct = f.debug_struct("ObjectRetention");
14118            debug_struct.field("enabled", &self.enabled);
14119            if !self._unknown_fields.is_empty() {
14120                debug_struct.field("_unknown_fields", &self._unknown_fields);
14121            }
14122            debug_struct.finish()
14123        }
14124    }
14125
14126    /// Retention policy properties of a bucket.
14127    #[derive(Clone, Default, PartialEq)]
14128    #[non_exhaustive]
14129    pub struct RetentionPolicy {
14130        /// Optional. Server-determined value that indicates the time from which
14131        /// policy was enforced and effective.
14132        pub effective_time: std::option::Option<wkt::Timestamp>,
14133
14134        /// Optional. Once locked, an object retention policy cannot be modified.
14135        pub is_locked: bool,
14136
14137        /// Optional. The duration that objects need to be retained. Retention
14138        /// duration must be greater than zero and less than 100 years. Note that
14139        /// enforcement of retention periods less than a day is not guaranteed. Such
14140        /// periods should only be used for testing purposes. Any `nanos` value
14141        /// specified will be rounded down to the nearest second.
14142        pub retention_duration: std::option::Option<wkt::Duration>,
14143
14144        _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
14145    }
14146
14147    impl RetentionPolicy {
14148        pub fn new() -> Self {
14149            std::default::Default::default()
14150        }
14151
14152        /// Sets the value of [effective_time][crate::model::bucket::RetentionPolicy::effective_time].
14153        pub fn set_effective_time<T>(mut self, v: T) -> Self
14154        where
14155            T: std::convert::Into<wkt::Timestamp>,
14156        {
14157            self.effective_time = std::option::Option::Some(v.into());
14158            self
14159        }
14160
14161        /// Sets or clears the value of [effective_time][crate::model::bucket::RetentionPolicy::effective_time].
14162        pub fn set_or_clear_effective_time<T>(mut self, v: std::option::Option<T>) -> Self
14163        where
14164            T: std::convert::Into<wkt::Timestamp>,
14165        {
14166            self.effective_time = v.map(|x| x.into());
14167            self
14168        }
14169
14170        /// Sets the value of [is_locked][crate::model::bucket::RetentionPolicy::is_locked].
14171        pub fn set_is_locked<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
14172            self.is_locked = v.into();
14173            self
14174        }
14175
14176        /// Sets the value of [retention_duration][crate::model::bucket::RetentionPolicy::retention_duration].
14177        pub fn set_retention_duration<T>(mut self, v: T) -> Self
14178        where
14179            T: std::convert::Into<wkt::Duration>,
14180        {
14181            self.retention_duration = std::option::Option::Some(v.into());
14182            self
14183        }
14184
14185        /// Sets or clears the value of [retention_duration][crate::model::bucket::RetentionPolicy::retention_duration].
14186        pub fn set_or_clear_retention_duration<T>(mut self, v: std::option::Option<T>) -> Self
14187        where
14188            T: std::convert::Into<wkt::Duration>,
14189        {
14190            self.retention_duration = v.map(|x| x.into());
14191            self
14192        }
14193    }
14194
14195    impl wkt::message::Message for RetentionPolicy {
14196        fn typename() -> &'static str {
14197            "type.googleapis.com/google.storage.v2.Bucket.RetentionPolicy"
14198        }
14199    }
14200
14201    #[doc(hidden)]
14202    impl<'de> serde::de::Deserialize<'de> for RetentionPolicy {
14203        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
14204        where
14205            D: serde::Deserializer<'de>,
14206        {
14207            #[allow(non_camel_case_types)]
14208            #[doc(hidden)]
14209            #[derive(PartialEq, Eq, Hash)]
14210            enum __FieldTag {
14211                __effective_time,
14212                __is_locked,
14213                __retention_duration,
14214                Unknown(std::string::String),
14215            }
14216            impl<'de> serde::de::Deserialize<'de> for __FieldTag {
14217                fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
14218                where
14219                    D: serde::Deserializer<'de>,
14220                {
14221                    struct Visitor;
14222                    impl<'de> serde::de::Visitor<'de> for Visitor {
14223                        type Value = __FieldTag;
14224                        fn expecting(
14225                            &self,
14226                            formatter: &mut std::fmt::Formatter,
14227                        ) -> std::fmt::Result {
14228                            formatter.write_str("a field name for RetentionPolicy")
14229                        }
14230                        fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
14231                        where
14232                            E: serde::de::Error,
14233                        {
14234                            use std::result::Result::Ok;
14235                            use std::string::ToString;
14236                            match value {
14237                                "effectiveTime" => Ok(__FieldTag::__effective_time),
14238                                "effective_time" => Ok(__FieldTag::__effective_time),
14239                                "isLocked" => Ok(__FieldTag::__is_locked),
14240                                "is_locked" => Ok(__FieldTag::__is_locked),
14241                                "retentionDuration" => Ok(__FieldTag::__retention_duration),
14242                                "retention_duration" => Ok(__FieldTag::__retention_duration),
14243                                _ => Ok(__FieldTag::Unknown(value.to_string())),
14244                            }
14245                        }
14246                    }
14247                    deserializer.deserialize_identifier(Visitor)
14248                }
14249            }
14250            struct Visitor;
14251            impl<'de> serde::de::Visitor<'de> for Visitor {
14252                type Value = RetentionPolicy;
14253                fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
14254                    formatter.write_str("struct RetentionPolicy")
14255                }
14256                fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
14257                where
14258                    A: serde::de::MapAccess<'de>,
14259                {
14260                    #[allow(unused_imports)]
14261                    use serde::de::Error;
14262                    use std::option::Option::Some;
14263                    let mut fields = std::collections::HashSet::new();
14264                    let mut result = Self::Value::new();
14265                    while let Some(tag) = map.next_key::<__FieldTag>()? {
14266                        #[allow(clippy::match_single_binding)]
14267                        match tag {
14268                            __FieldTag::__effective_time => {
14269                                if !fields.insert(__FieldTag::__effective_time) {
14270                                    return std::result::Result::Err(A::Error::duplicate_field(
14271                                        "multiple values for effective_time",
14272                                    ));
14273                                }
14274                                result.effective_time =
14275                                    map.next_value::<std::option::Option<wkt::Timestamp>>()?;
14276                            }
14277                            __FieldTag::__is_locked => {
14278                                if !fields.insert(__FieldTag::__is_locked) {
14279                                    return std::result::Result::Err(A::Error::duplicate_field(
14280                                        "multiple values for is_locked",
14281                                    ));
14282                                }
14283                                result.is_locked = map
14284                                    .next_value::<std::option::Option<bool>>()?
14285                                    .unwrap_or_default();
14286                            }
14287                            __FieldTag::__retention_duration => {
14288                                if !fields.insert(__FieldTag::__retention_duration) {
14289                                    return std::result::Result::Err(A::Error::duplicate_field(
14290                                        "multiple values for retention_duration",
14291                                    ));
14292                                }
14293                                result.retention_duration =
14294                                    map.next_value::<std::option::Option<wkt::Duration>>()?;
14295                            }
14296                            __FieldTag::Unknown(key) => {
14297                                let value = map.next_value::<serde_json::Value>()?;
14298                                result._unknown_fields.insert(key, value);
14299                            }
14300                        }
14301                    }
14302                    std::result::Result::Ok(result)
14303                }
14304            }
14305            deserializer.deserialize_any(Visitor)
14306        }
14307    }
14308
14309    #[doc(hidden)]
14310    impl serde::ser::Serialize for RetentionPolicy {
14311        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
14312        where
14313            S: serde::ser::Serializer,
14314        {
14315            use serde::ser::SerializeMap;
14316            #[allow(unused_imports)]
14317            use std::option::Option::Some;
14318            let mut state = serializer.serialize_map(std::option::Option::None)?;
14319            if self.effective_time.is_some() {
14320                state.serialize_entry("effectiveTime", &self.effective_time)?;
14321            }
14322            if !wkt::internal::is_default(&self.is_locked) {
14323                state.serialize_entry("isLocked", &self.is_locked)?;
14324            }
14325            if self.retention_duration.is_some() {
14326                state.serialize_entry("retentionDuration", &self.retention_duration)?;
14327            }
14328            if !self._unknown_fields.is_empty() {
14329                for (key, value) in self._unknown_fields.iter() {
14330                    state.serialize_entry(key, &value)?;
14331                }
14332            }
14333            state.end()
14334        }
14335    }
14336
14337    impl std::fmt::Debug for RetentionPolicy {
14338        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
14339            let mut debug_struct = f.debug_struct("RetentionPolicy");
14340            debug_struct.field("effective_time", &self.effective_time);
14341            debug_struct.field("is_locked", &self.is_locked);
14342            debug_struct.field("retention_duration", &self.retention_duration);
14343            if !self._unknown_fields.is_empty() {
14344                debug_struct.field("_unknown_fields", &self._unknown_fields);
14345            }
14346            debug_struct.finish()
14347        }
14348    }
14349
14350    /// Soft delete policy properties of a bucket.
14351    #[derive(Clone, Default, PartialEq)]
14352    #[non_exhaustive]
14353    pub struct SoftDeletePolicy {
14354        /// The period of time that soft-deleted objects in the bucket must be
14355        /// retained and cannot be permanently deleted. The duration must be greater
14356        /// than or equal to 7 days and less than 1 year.
14357        pub retention_duration: std::option::Option<wkt::Duration>,
14358
14359        /// Time from which the policy was effective. This is service-provided.
14360        pub effective_time: std::option::Option<wkt::Timestamp>,
14361
14362        _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
14363    }
14364
14365    impl SoftDeletePolicy {
14366        pub fn new() -> Self {
14367            std::default::Default::default()
14368        }
14369
14370        /// Sets the value of [retention_duration][crate::model::bucket::SoftDeletePolicy::retention_duration].
14371        pub fn set_retention_duration<T>(mut self, v: T) -> Self
14372        where
14373            T: std::convert::Into<wkt::Duration>,
14374        {
14375            self.retention_duration = std::option::Option::Some(v.into());
14376            self
14377        }
14378
14379        /// Sets or clears the value of [retention_duration][crate::model::bucket::SoftDeletePolicy::retention_duration].
14380        pub fn set_or_clear_retention_duration<T>(mut self, v: std::option::Option<T>) -> Self
14381        where
14382            T: std::convert::Into<wkt::Duration>,
14383        {
14384            self.retention_duration = v.map(|x| x.into());
14385            self
14386        }
14387
14388        /// Sets the value of [effective_time][crate::model::bucket::SoftDeletePolicy::effective_time].
14389        pub fn set_effective_time<T>(mut self, v: T) -> Self
14390        where
14391            T: std::convert::Into<wkt::Timestamp>,
14392        {
14393            self.effective_time = std::option::Option::Some(v.into());
14394            self
14395        }
14396
14397        /// Sets or clears the value of [effective_time][crate::model::bucket::SoftDeletePolicy::effective_time].
14398        pub fn set_or_clear_effective_time<T>(mut self, v: std::option::Option<T>) -> Self
14399        where
14400            T: std::convert::Into<wkt::Timestamp>,
14401        {
14402            self.effective_time = v.map(|x| x.into());
14403            self
14404        }
14405    }
14406
14407    impl wkt::message::Message for SoftDeletePolicy {
14408        fn typename() -> &'static str {
14409            "type.googleapis.com/google.storage.v2.Bucket.SoftDeletePolicy"
14410        }
14411    }
14412
14413    #[doc(hidden)]
14414    impl<'de> serde::de::Deserialize<'de> for SoftDeletePolicy {
14415        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
14416        where
14417            D: serde::Deserializer<'de>,
14418        {
14419            #[allow(non_camel_case_types)]
14420            #[doc(hidden)]
14421            #[derive(PartialEq, Eq, Hash)]
14422            enum __FieldTag {
14423                __retention_duration,
14424                __effective_time,
14425                Unknown(std::string::String),
14426            }
14427            impl<'de> serde::de::Deserialize<'de> for __FieldTag {
14428                fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
14429                where
14430                    D: serde::Deserializer<'de>,
14431                {
14432                    struct Visitor;
14433                    impl<'de> serde::de::Visitor<'de> for Visitor {
14434                        type Value = __FieldTag;
14435                        fn expecting(
14436                            &self,
14437                            formatter: &mut std::fmt::Formatter,
14438                        ) -> std::fmt::Result {
14439                            formatter.write_str("a field name for SoftDeletePolicy")
14440                        }
14441                        fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
14442                        where
14443                            E: serde::de::Error,
14444                        {
14445                            use std::result::Result::Ok;
14446                            use std::string::ToString;
14447                            match value {
14448                                "retentionDuration" => Ok(__FieldTag::__retention_duration),
14449                                "retention_duration" => Ok(__FieldTag::__retention_duration),
14450                                "effectiveTime" => Ok(__FieldTag::__effective_time),
14451                                "effective_time" => Ok(__FieldTag::__effective_time),
14452                                _ => Ok(__FieldTag::Unknown(value.to_string())),
14453                            }
14454                        }
14455                    }
14456                    deserializer.deserialize_identifier(Visitor)
14457                }
14458            }
14459            struct Visitor;
14460            impl<'de> serde::de::Visitor<'de> for Visitor {
14461                type Value = SoftDeletePolicy;
14462                fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
14463                    formatter.write_str("struct SoftDeletePolicy")
14464                }
14465                fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
14466                where
14467                    A: serde::de::MapAccess<'de>,
14468                {
14469                    #[allow(unused_imports)]
14470                    use serde::de::Error;
14471                    use std::option::Option::Some;
14472                    let mut fields = std::collections::HashSet::new();
14473                    let mut result = Self::Value::new();
14474                    while let Some(tag) = map.next_key::<__FieldTag>()? {
14475                        #[allow(clippy::match_single_binding)]
14476                        match tag {
14477                            __FieldTag::__retention_duration => {
14478                                if !fields.insert(__FieldTag::__retention_duration) {
14479                                    return std::result::Result::Err(A::Error::duplicate_field(
14480                                        "multiple values for retention_duration",
14481                                    ));
14482                                }
14483                                result.retention_duration =
14484                                    map.next_value::<std::option::Option<wkt::Duration>>()?;
14485                            }
14486                            __FieldTag::__effective_time => {
14487                                if !fields.insert(__FieldTag::__effective_time) {
14488                                    return std::result::Result::Err(A::Error::duplicate_field(
14489                                        "multiple values for effective_time",
14490                                    ));
14491                                }
14492                                result.effective_time =
14493                                    map.next_value::<std::option::Option<wkt::Timestamp>>()?;
14494                            }
14495                            __FieldTag::Unknown(key) => {
14496                                let value = map.next_value::<serde_json::Value>()?;
14497                                result._unknown_fields.insert(key, value);
14498                            }
14499                        }
14500                    }
14501                    std::result::Result::Ok(result)
14502                }
14503            }
14504            deserializer.deserialize_any(Visitor)
14505        }
14506    }
14507
14508    #[doc(hidden)]
14509    impl serde::ser::Serialize for SoftDeletePolicy {
14510        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
14511        where
14512            S: serde::ser::Serializer,
14513        {
14514            use serde::ser::SerializeMap;
14515            #[allow(unused_imports)]
14516            use std::option::Option::Some;
14517            let mut state = serializer.serialize_map(std::option::Option::None)?;
14518            if self.retention_duration.is_some() {
14519                state.serialize_entry("retentionDuration", &self.retention_duration)?;
14520            }
14521            if self.effective_time.is_some() {
14522                state.serialize_entry("effectiveTime", &self.effective_time)?;
14523            }
14524            if !self._unknown_fields.is_empty() {
14525                for (key, value) in self._unknown_fields.iter() {
14526                    state.serialize_entry(key, &value)?;
14527                }
14528            }
14529            state.end()
14530        }
14531    }
14532
14533    impl std::fmt::Debug for SoftDeletePolicy {
14534        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
14535            let mut debug_struct = f.debug_struct("SoftDeletePolicy");
14536            debug_struct.field("retention_duration", &self.retention_duration);
14537            debug_struct.field("effective_time", &self.effective_time);
14538            if !self._unknown_fields.is_empty() {
14539                debug_struct.field("_unknown_fields", &self._unknown_fields);
14540            }
14541            debug_struct.finish()
14542        }
14543    }
14544
14545    /// Properties of a bucket related to versioning.
14546    /// For more on Cloud Storage versioning, see
14547    /// <https://cloud.google.com/storage/docs/object-versioning>.
14548    #[derive(Clone, Default, PartialEq)]
14549    #[non_exhaustive]
14550    pub struct Versioning {
14551        /// Optional. While set to true, versioning is fully enabled for this bucket.
14552        pub enabled: bool,
14553
14554        _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
14555    }
14556
14557    impl Versioning {
14558        pub fn new() -> Self {
14559            std::default::Default::default()
14560        }
14561
14562        /// Sets the value of [enabled][crate::model::bucket::Versioning::enabled].
14563        pub fn set_enabled<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
14564            self.enabled = v.into();
14565            self
14566        }
14567    }
14568
14569    impl wkt::message::Message for Versioning {
14570        fn typename() -> &'static str {
14571            "type.googleapis.com/google.storage.v2.Bucket.Versioning"
14572        }
14573    }
14574
14575    #[doc(hidden)]
14576    impl<'de> serde::de::Deserialize<'de> for Versioning {
14577        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
14578        where
14579            D: serde::Deserializer<'de>,
14580        {
14581            #[allow(non_camel_case_types)]
14582            #[doc(hidden)]
14583            #[derive(PartialEq, Eq, Hash)]
14584            enum __FieldTag {
14585                __enabled,
14586                Unknown(std::string::String),
14587            }
14588            impl<'de> serde::de::Deserialize<'de> for __FieldTag {
14589                fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
14590                where
14591                    D: serde::Deserializer<'de>,
14592                {
14593                    struct Visitor;
14594                    impl<'de> serde::de::Visitor<'de> for Visitor {
14595                        type Value = __FieldTag;
14596                        fn expecting(
14597                            &self,
14598                            formatter: &mut std::fmt::Formatter,
14599                        ) -> std::fmt::Result {
14600                            formatter.write_str("a field name for Versioning")
14601                        }
14602                        fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
14603                        where
14604                            E: serde::de::Error,
14605                        {
14606                            use std::result::Result::Ok;
14607                            use std::string::ToString;
14608                            match value {
14609                                "enabled" => Ok(__FieldTag::__enabled),
14610                                _ => Ok(__FieldTag::Unknown(value.to_string())),
14611                            }
14612                        }
14613                    }
14614                    deserializer.deserialize_identifier(Visitor)
14615                }
14616            }
14617            struct Visitor;
14618            impl<'de> serde::de::Visitor<'de> for Visitor {
14619                type Value = Versioning;
14620                fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
14621                    formatter.write_str("struct Versioning")
14622                }
14623                fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
14624                where
14625                    A: serde::de::MapAccess<'de>,
14626                {
14627                    #[allow(unused_imports)]
14628                    use serde::de::Error;
14629                    use std::option::Option::Some;
14630                    let mut fields = std::collections::HashSet::new();
14631                    let mut result = Self::Value::new();
14632                    while let Some(tag) = map.next_key::<__FieldTag>()? {
14633                        #[allow(clippy::match_single_binding)]
14634                        match tag {
14635                            __FieldTag::__enabled => {
14636                                if !fields.insert(__FieldTag::__enabled) {
14637                                    return std::result::Result::Err(A::Error::duplicate_field(
14638                                        "multiple values for enabled",
14639                                    ));
14640                                }
14641                                result.enabled = map
14642                                    .next_value::<std::option::Option<bool>>()?
14643                                    .unwrap_or_default();
14644                            }
14645                            __FieldTag::Unknown(key) => {
14646                                let value = map.next_value::<serde_json::Value>()?;
14647                                result._unknown_fields.insert(key, value);
14648                            }
14649                        }
14650                    }
14651                    std::result::Result::Ok(result)
14652                }
14653            }
14654            deserializer.deserialize_any(Visitor)
14655        }
14656    }
14657
14658    #[doc(hidden)]
14659    impl serde::ser::Serialize for Versioning {
14660        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
14661        where
14662            S: serde::ser::Serializer,
14663        {
14664            use serde::ser::SerializeMap;
14665            #[allow(unused_imports)]
14666            use std::option::Option::Some;
14667            let mut state = serializer.serialize_map(std::option::Option::None)?;
14668            if !wkt::internal::is_default(&self.enabled) {
14669                state.serialize_entry("enabled", &self.enabled)?;
14670            }
14671            if !self._unknown_fields.is_empty() {
14672                for (key, value) in self._unknown_fields.iter() {
14673                    state.serialize_entry(key, &value)?;
14674                }
14675            }
14676            state.end()
14677        }
14678    }
14679
14680    impl std::fmt::Debug for Versioning {
14681        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
14682            let mut debug_struct = f.debug_struct("Versioning");
14683            debug_struct.field("enabled", &self.enabled);
14684            if !self._unknown_fields.is_empty() {
14685                debug_struct.field("_unknown_fields", &self._unknown_fields);
14686            }
14687            debug_struct.finish()
14688        }
14689    }
14690
14691    /// Properties of a bucket related to accessing the contents as a static
14692    /// website. For more on hosting a static website via Cloud Storage, see
14693    /// <https://cloud.google.com/storage/docs/hosting-static-website>.
14694    #[derive(Clone, Default, PartialEq)]
14695    #[non_exhaustive]
14696    pub struct Website {
14697        /// Optional. If the requested object path is missing, the service will
14698        /// ensure the path has a trailing '/', append this suffix, and attempt to
14699        /// retrieve the resulting object. This allows the creation of `index.html`
14700        /// objects to represent directory pages.
14701        pub main_page_suffix: std::string::String,
14702
14703        /// Optional. If the requested object path is missing, and any
14704        /// `mainPageSuffix` object is missing, if applicable, the service
14705        /// will return the named object from this bucket as the content for a
14706        /// [<https://tools.ietf.org/html/rfc7231#section-6.5.4>][404 Not Found]
14707        /// result.
14708        pub not_found_page: std::string::String,
14709
14710        _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
14711    }
14712
14713    impl Website {
14714        pub fn new() -> Self {
14715            std::default::Default::default()
14716        }
14717
14718        /// Sets the value of [main_page_suffix][crate::model::bucket::Website::main_page_suffix].
14719        pub fn set_main_page_suffix<T: std::convert::Into<std::string::String>>(
14720            mut self,
14721            v: T,
14722        ) -> Self {
14723            self.main_page_suffix = v.into();
14724            self
14725        }
14726
14727        /// Sets the value of [not_found_page][crate::model::bucket::Website::not_found_page].
14728        pub fn set_not_found_page<T: std::convert::Into<std::string::String>>(
14729            mut self,
14730            v: T,
14731        ) -> Self {
14732            self.not_found_page = v.into();
14733            self
14734        }
14735    }
14736
14737    impl wkt::message::Message for Website {
14738        fn typename() -> &'static str {
14739            "type.googleapis.com/google.storage.v2.Bucket.Website"
14740        }
14741    }
14742
14743    #[doc(hidden)]
14744    impl<'de> serde::de::Deserialize<'de> for Website {
14745        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
14746        where
14747            D: serde::Deserializer<'de>,
14748        {
14749            #[allow(non_camel_case_types)]
14750            #[doc(hidden)]
14751            #[derive(PartialEq, Eq, Hash)]
14752            enum __FieldTag {
14753                __main_page_suffix,
14754                __not_found_page,
14755                Unknown(std::string::String),
14756            }
14757            impl<'de> serde::de::Deserialize<'de> for __FieldTag {
14758                fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
14759                where
14760                    D: serde::Deserializer<'de>,
14761                {
14762                    struct Visitor;
14763                    impl<'de> serde::de::Visitor<'de> for Visitor {
14764                        type Value = __FieldTag;
14765                        fn expecting(
14766                            &self,
14767                            formatter: &mut std::fmt::Formatter,
14768                        ) -> std::fmt::Result {
14769                            formatter.write_str("a field name for Website")
14770                        }
14771                        fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
14772                        where
14773                            E: serde::de::Error,
14774                        {
14775                            use std::result::Result::Ok;
14776                            use std::string::ToString;
14777                            match value {
14778                                "mainPageSuffix" => Ok(__FieldTag::__main_page_suffix),
14779                                "main_page_suffix" => Ok(__FieldTag::__main_page_suffix),
14780                                "notFoundPage" => Ok(__FieldTag::__not_found_page),
14781                                "not_found_page" => Ok(__FieldTag::__not_found_page),
14782                                _ => Ok(__FieldTag::Unknown(value.to_string())),
14783                            }
14784                        }
14785                    }
14786                    deserializer.deserialize_identifier(Visitor)
14787                }
14788            }
14789            struct Visitor;
14790            impl<'de> serde::de::Visitor<'de> for Visitor {
14791                type Value = Website;
14792                fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
14793                    formatter.write_str("struct Website")
14794                }
14795                fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
14796                where
14797                    A: serde::de::MapAccess<'de>,
14798                {
14799                    #[allow(unused_imports)]
14800                    use serde::de::Error;
14801                    use std::option::Option::Some;
14802                    let mut fields = std::collections::HashSet::new();
14803                    let mut result = Self::Value::new();
14804                    while let Some(tag) = map.next_key::<__FieldTag>()? {
14805                        #[allow(clippy::match_single_binding)]
14806                        match tag {
14807                            __FieldTag::__main_page_suffix => {
14808                                if !fields.insert(__FieldTag::__main_page_suffix) {
14809                                    return std::result::Result::Err(A::Error::duplicate_field(
14810                                        "multiple values for main_page_suffix",
14811                                    ));
14812                                }
14813                                result.main_page_suffix = map
14814                                    .next_value::<std::option::Option<std::string::String>>()?
14815                                    .unwrap_or_default();
14816                            }
14817                            __FieldTag::__not_found_page => {
14818                                if !fields.insert(__FieldTag::__not_found_page) {
14819                                    return std::result::Result::Err(A::Error::duplicate_field(
14820                                        "multiple values for not_found_page",
14821                                    ));
14822                                }
14823                                result.not_found_page = map
14824                                    .next_value::<std::option::Option<std::string::String>>()?
14825                                    .unwrap_or_default();
14826                            }
14827                            __FieldTag::Unknown(key) => {
14828                                let value = map.next_value::<serde_json::Value>()?;
14829                                result._unknown_fields.insert(key, value);
14830                            }
14831                        }
14832                    }
14833                    std::result::Result::Ok(result)
14834                }
14835            }
14836            deserializer.deserialize_any(Visitor)
14837        }
14838    }
14839
14840    #[doc(hidden)]
14841    impl serde::ser::Serialize for Website {
14842        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
14843        where
14844            S: serde::ser::Serializer,
14845        {
14846            use serde::ser::SerializeMap;
14847            #[allow(unused_imports)]
14848            use std::option::Option::Some;
14849            let mut state = serializer.serialize_map(std::option::Option::None)?;
14850            if !self.main_page_suffix.is_empty() {
14851                state.serialize_entry("mainPageSuffix", &self.main_page_suffix)?;
14852            }
14853            if !self.not_found_page.is_empty() {
14854                state.serialize_entry("notFoundPage", &self.not_found_page)?;
14855            }
14856            if !self._unknown_fields.is_empty() {
14857                for (key, value) in self._unknown_fields.iter() {
14858                    state.serialize_entry(key, &value)?;
14859                }
14860            }
14861            state.end()
14862        }
14863    }
14864
14865    impl std::fmt::Debug for Website {
14866        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
14867            let mut debug_struct = f.debug_struct("Website");
14868            debug_struct.field("main_page_suffix", &self.main_page_suffix);
14869            debug_struct.field("not_found_page", &self.not_found_page);
14870            if !self._unknown_fields.is_empty() {
14871                debug_struct.field("_unknown_fields", &self._unknown_fields);
14872            }
14873            debug_struct.finish()
14874        }
14875    }
14876
14877    /// Configuration for Custom Dual Regions.  It should specify precisely two
14878    /// eligible regions within the same Multiregion. More information on regions
14879    /// may be found [here](https://cloud.google.com/storage/docs/locations).
14880    #[derive(Clone, Default, PartialEq)]
14881    #[non_exhaustive]
14882    pub struct CustomPlacementConfig {
14883        /// Optional. List of locations to use for data placement.
14884        pub data_locations: std::vec::Vec<std::string::String>,
14885
14886        _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
14887    }
14888
14889    impl CustomPlacementConfig {
14890        pub fn new() -> Self {
14891            std::default::Default::default()
14892        }
14893
14894        /// Sets the value of [data_locations][crate::model::bucket::CustomPlacementConfig::data_locations].
14895        pub fn set_data_locations<T, V>(mut self, v: T) -> Self
14896        where
14897            T: std::iter::IntoIterator<Item = V>,
14898            V: std::convert::Into<std::string::String>,
14899        {
14900            use std::iter::Iterator;
14901            self.data_locations = v.into_iter().map(|i| i.into()).collect();
14902            self
14903        }
14904    }
14905
14906    impl wkt::message::Message for CustomPlacementConfig {
14907        fn typename() -> &'static str {
14908            "type.googleapis.com/google.storage.v2.Bucket.CustomPlacementConfig"
14909        }
14910    }
14911
14912    #[doc(hidden)]
14913    impl<'de> serde::de::Deserialize<'de> for CustomPlacementConfig {
14914        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
14915        where
14916            D: serde::Deserializer<'de>,
14917        {
14918            #[allow(non_camel_case_types)]
14919            #[doc(hidden)]
14920            #[derive(PartialEq, Eq, Hash)]
14921            enum __FieldTag {
14922                __data_locations,
14923                Unknown(std::string::String),
14924            }
14925            impl<'de> serde::de::Deserialize<'de> for __FieldTag {
14926                fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
14927                where
14928                    D: serde::Deserializer<'de>,
14929                {
14930                    struct Visitor;
14931                    impl<'de> serde::de::Visitor<'de> for Visitor {
14932                        type Value = __FieldTag;
14933                        fn expecting(
14934                            &self,
14935                            formatter: &mut std::fmt::Formatter,
14936                        ) -> std::fmt::Result {
14937                            formatter.write_str("a field name for CustomPlacementConfig")
14938                        }
14939                        fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
14940                        where
14941                            E: serde::de::Error,
14942                        {
14943                            use std::result::Result::Ok;
14944                            use std::string::ToString;
14945                            match value {
14946                                "dataLocations" => Ok(__FieldTag::__data_locations),
14947                                "data_locations" => Ok(__FieldTag::__data_locations),
14948                                _ => Ok(__FieldTag::Unknown(value.to_string())),
14949                            }
14950                        }
14951                    }
14952                    deserializer.deserialize_identifier(Visitor)
14953                }
14954            }
14955            struct Visitor;
14956            impl<'de> serde::de::Visitor<'de> for Visitor {
14957                type Value = CustomPlacementConfig;
14958                fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
14959                    formatter.write_str("struct CustomPlacementConfig")
14960                }
14961                fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
14962                where
14963                    A: serde::de::MapAccess<'de>,
14964                {
14965                    #[allow(unused_imports)]
14966                    use serde::de::Error;
14967                    use std::option::Option::Some;
14968                    let mut fields = std::collections::HashSet::new();
14969                    let mut result = Self::Value::new();
14970                    while let Some(tag) = map.next_key::<__FieldTag>()? {
14971                        #[allow(clippy::match_single_binding)]
14972                        match tag {
14973                            __FieldTag::__data_locations => {
14974                                if !fields.insert(__FieldTag::__data_locations) {
14975                                    return std::result::Result::Err(A::Error::duplicate_field(
14976                                        "multiple values for data_locations",
14977                                    ));
14978                                }
14979                                result.data_locations = map.next_value::<std::option::Option<std::vec::Vec<std::string::String>>>()?.unwrap_or_default();
14980                            }
14981                            __FieldTag::Unknown(key) => {
14982                                let value = map.next_value::<serde_json::Value>()?;
14983                                result._unknown_fields.insert(key, value);
14984                            }
14985                        }
14986                    }
14987                    std::result::Result::Ok(result)
14988                }
14989            }
14990            deserializer.deserialize_any(Visitor)
14991        }
14992    }
14993
14994    #[doc(hidden)]
14995    impl serde::ser::Serialize for CustomPlacementConfig {
14996        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
14997        where
14998            S: serde::ser::Serializer,
14999        {
15000            use serde::ser::SerializeMap;
15001            #[allow(unused_imports)]
15002            use std::option::Option::Some;
15003            let mut state = serializer.serialize_map(std::option::Option::None)?;
15004            if !self.data_locations.is_empty() {
15005                state.serialize_entry("dataLocations", &self.data_locations)?;
15006            }
15007            if !self._unknown_fields.is_empty() {
15008                for (key, value) in self._unknown_fields.iter() {
15009                    state.serialize_entry(key, &value)?;
15010                }
15011            }
15012            state.end()
15013        }
15014    }
15015
15016    impl std::fmt::Debug for CustomPlacementConfig {
15017        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
15018            let mut debug_struct = f.debug_struct("CustomPlacementConfig");
15019            debug_struct.field("data_locations", &self.data_locations);
15020            if !self._unknown_fields.is_empty() {
15021                debug_struct.field("_unknown_fields", &self._unknown_fields);
15022            }
15023            debug_struct.finish()
15024        }
15025    }
15026
15027    /// Configuration for a bucket's Autoclass feature.
15028    #[derive(Clone, Default, PartialEq)]
15029    #[non_exhaustive]
15030    pub struct Autoclass {
15031        /// Optional. Enables Autoclass.
15032        pub enabled: bool,
15033
15034        /// Output only. Latest instant at which the `enabled` field was set to true
15035        /// after being disabled/unconfigured or set to false after being enabled. If
15036        /// Autoclass is enabled when the bucket is created, the toggle_time is set
15037        /// to the bucket creation time.
15038        pub toggle_time: std::option::Option<wkt::Timestamp>,
15039
15040        /// An object in an Autoclass bucket will eventually cool down to the
15041        /// terminal storage class if there is no access to the object.
15042        /// The only valid values are NEARLINE and ARCHIVE.
15043        pub terminal_storage_class: std::option::Option<std::string::String>,
15044
15045        /// Output only. Latest instant at which the autoclass terminal storage class
15046        /// was updated.
15047        pub terminal_storage_class_update_time: std::option::Option<wkt::Timestamp>,
15048
15049        _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
15050    }
15051
15052    impl Autoclass {
15053        pub fn new() -> Self {
15054            std::default::Default::default()
15055        }
15056
15057        /// Sets the value of [enabled][crate::model::bucket::Autoclass::enabled].
15058        pub fn set_enabled<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
15059            self.enabled = v.into();
15060            self
15061        }
15062
15063        /// Sets the value of [toggle_time][crate::model::bucket::Autoclass::toggle_time].
15064        pub fn set_toggle_time<T>(mut self, v: T) -> Self
15065        where
15066            T: std::convert::Into<wkt::Timestamp>,
15067        {
15068            self.toggle_time = std::option::Option::Some(v.into());
15069            self
15070        }
15071
15072        /// Sets or clears the value of [toggle_time][crate::model::bucket::Autoclass::toggle_time].
15073        pub fn set_or_clear_toggle_time<T>(mut self, v: std::option::Option<T>) -> Self
15074        where
15075            T: std::convert::Into<wkt::Timestamp>,
15076        {
15077            self.toggle_time = v.map(|x| x.into());
15078            self
15079        }
15080
15081        /// Sets the value of [terminal_storage_class][crate::model::bucket::Autoclass::terminal_storage_class].
15082        pub fn set_terminal_storage_class<T>(mut self, v: T) -> Self
15083        where
15084            T: std::convert::Into<std::string::String>,
15085        {
15086            self.terminal_storage_class = std::option::Option::Some(v.into());
15087            self
15088        }
15089
15090        /// Sets or clears the value of [terminal_storage_class][crate::model::bucket::Autoclass::terminal_storage_class].
15091        pub fn set_or_clear_terminal_storage_class<T>(mut self, v: std::option::Option<T>) -> Self
15092        where
15093            T: std::convert::Into<std::string::String>,
15094        {
15095            self.terminal_storage_class = v.map(|x| x.into());
15096            self
15097        }
15098
15099        /// Sets the value of [terminal_storage_class_update_time][crate::model::bucket::Autoclass::terminal_storage_class_update_time].
15100        pub fn set_terminal_storage_class_update_time<T>(mut self, v: T) -> Self
15101        where
15102            T: std::convert::Into<wkt::Timestamp>,
15103        {
15104            self.terminal_storage_class_update_time = std::option::Option::Some(v.into());
15105            self
15106        }
15107
15108        /// Sets or clears the value of [terminal_storage_class_update_time][crate::model::bucket::Autoclass::terminal_storage_class_update_time].
15109        pub fn set_or_clear_terminal_storage_class_update_time<T>(
15110            mut self,
15111            v: std::option::Option<T>,
15112        ) -> Self
15113        where
15114            T: std::convert::Into<wkt::Timestamp>,
15115        {
15116            self.terminal_storage_class_update_time = v.map(|x| x.into());
15117            self
15118        }
15119    }
15120
15121    impl wkt::message::Message for Autoclass {
15122        fn typename() -> &'static str {
15123            "type.googleapis.com/google.storage.v2.Bucket.Autoclass"
15124        }
15125    }
15126
15127    #[doc(hidden)]
15128    impl<'de> serde::de::Deserialize<'de> for Autoclass {
15129        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
15130        where
15131            D: serde::Deserializer<'de>,
15132        {
15133            #[allow(non_camel_case_types)]
15134            #[doc(hidden)]
15135            #[derive(PartialEq, Eq, Hash)]
15136            enum __FieldTag {
15137                __enabled,
15138                __toggle_time,
15139                __terminal_storage_class,
15140                __terminal_storage_class_update_time,
15141                Unknown(std::string::String),
15142            }
15143            impl<'de> serde::de::Deserialize<'de> for __FieldTag {
15144                fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
15145                where
15146                    D: serde::Deserializer<'de>,
15147                {
15148                    struct Visitor;
15149                    impl<'de> serde::de::Visitor<'de> for Visitor {
15150                        type Value = __FieldTag;
15151                        fn expecting(
15152                            &self,
15153                            formatter: &mut std::fmt::Formatter,
15154                        ) -> std::fmt::Result {
15155                            formatter.write_str("a field name for Autoclass")
15156                        }
15157                        fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
15158                        where
15159                            E: serde::de::Error,
15160                        {
15161                            use std::result::Result::Ok;
15162                            use std::string::ToString;
15163                            match value {
15164                                "enabled" => Ok(__FieldTag::__enabled),
15165                                "toggleTime" => Ok(__FieldTag::__toggle_time),
15166                                "toggle_time" => Ok(__FieldTag::__toggle_time),
15167                                "terminalStorageClass" => Ok(__FieldTag::__terminal_storage_class),
15168                                "terminal_storage_class" => {
15169                                    Ok(__FieldTag::__terminal_storage_class)
15170                                }
15171                                "terminalStorageClassUpdateTime" => {
15172                                    Ok(__FieldTag::__terminal_storage_class_update_time)
15173                                }
15174                                "terminal_storage_class_update_time" => {
15175                                    Ok(__FieldTag::__terminal_storage_class_update_time)
15176                                }
15177                                _ => Ok(__FieldTag::Unknown(value.to_string())),
15178                            }
15179                        }
15180                    }
15181                    deserializer.deserialize_identifier(Visitor)
15182                }
15183            }
15184            struct Visitor;
15185            impl<'de> serde::de::Visitor<'de> for Visitor {
15186                type Value = Autoclass;
15187                fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
15188                    formatter.write_str("struct Autoclass")
15189                }
15190                fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
15191                where
15192                    A: serde::de::MapAccess<'de>,
15193                {
15194                    #[allow(unused_imports)]
15195                    use serde::de::Error;
15196                    use std::option::Option::Some;
15197                    let mut fields = std::collections::HashSet::new();
15198                    let mut result = Self::Value::new();
15199                    while let Some(tag) = map.next_key::<__FieldTag>()? {
15200                        #[allow(clippy::match_single_binding)]
15201                        match tag {
15202                            __FieldTag::__enabled => {
15203                                if !fields.insert(__FieldTag::__enabled) {
15204                                    return std::result::Result::Err(A::Error::duplicate_field(
15205                                        "multiple values for enabled",
15206                                    ));
15207                                }
15208                                result.enabled = map
15209                                    .next_value::<std::option::Option<bool>>()?
15210                                    .unwrap_or_default();
15211                            }
15212                            __FieldTag::__toggle_time => {
15213                                if !fields.insert(__FieldTag::__toggle_time) {
15214                                    return std::result::Result::Err(A::Error::duplicate_field(
15215                                        "multiple values for toggle_time",
15216                                    ));
15217                                }
15218                                result.toggle_time =
15219                                    map.next_value::<std::option::Option<wkt::Timestamp>>()?;
15220                            }
15221                            __FieldTag::__terminal_storage_class => {
15222                                if !fields.insert(__FieldTag::__terminal_storage_class) {
15223                                    return std::result::Result::Err(A::Error::duplicate_field(
15224                                        "multiple values for terminal_storage_class",
15225                                    ));
15226                                }
15227                                result.terminal_storage_class =
15228                                    map.next_value::<std::option::Option<std::string::String>>()?;
15229                            }
15230                            __FieldTag::__terminal_storage_class_update_time => {
15231                                if !fields.insert(__FieldTag::__terminal_storage_class_update_time)
15232                                {
15233                                    return std::result::Result::Err(A::Error::duplicate_field(
15234                                        "multiple values for terminal_storage_class_update_time",
15235                                    ));
15236                                }
15237                                result.terminal_storage_class_update_time =
15238                                    map.next_value::<std::option::Option<wkt::Timestamp>>()?;
15239                            }
15240                            __FieldTag::Unknown(key) => {
15241                                let value = map.next_value::<serde_json::Value>()?;
15242                                result._unknown_fields.insert(key, value);
15243                            }
15244                        }
15245                    }
15246                    std::result::Result::Ok(result)
15247                }
15248            }
15249            deserializer.deserialize_any(Visitor)
15250        }
15251    }
15252
15253    #[doc(hidden)]
15254    impl serde::ser::Serialize for Autoclass {
15255        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
15256        where
15257            S: serde::ser::Serializer,
15258        {
15259            use serde::ser::SerializeMap;
15260            #[allow(unused_imports)]
15261            use std::option::Option::Some;
15262            let mut state = serializer.serialize_map(std::option::Option::None)?;
15263            if !wkt::internal::is_default(&self.enabled) {
15264                state.serialize_entry("enabled", &self.enabled)?;
15265            }
15266            if self.toggle_time.is_some() {
15267                state.serialize_entry("toggleTime", &self.toggle_time)?;
15268            }
15269            if self.terminal_storage_class.is_some() {
15270                state.serialize_entry("terminalStorageClass", &self.terminal_storage_class)?;
15271            }
15272            if self.terminal_storage_class_update_time.is_some() {
15273                state.serialize_entry(
15274                    "terminalStorageClassUpdateTime",
15275                    &self.terminal_storage_class_update_time,
15276                )?;
15277            }
15278            if !self._unknown_fields.is_empty() {
15279                for (key, value) in self._unknown_fields.iter() {
15280                    state.serialize_entry(key, &value)?;
15281                }
15282            }
15283            state.end()
15284        }
15285    }
15286
15287    impl std::fmt::Debug for Autoclass {
15288        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
15289            let mut debug_struct = f.debug_struct("Autoclass");
15290            debug_struct.field("enabled", &self.enabled);
15291            debug_struct.field("toggle_time", &self.toggle_time);
15292            debug_struct.field("terminal_storage_class", &self.terminal_storage_class);
15293            debug_struct.field(
15294                "terminal_storage_class_update_time",
15295                &self.terminal_storage_class_update_time,
15296            );
15297            if !self._unknown_fields.is_empty() {
15298                debug_struct.field("_unknown_fields", &self._unknown_fields);
15299            }
15300            debug_struct.finish()
15301        }
15302    }
15303
15304    /// The [bucket IP
15305    /// filtering](https://cloud.google.com/storage/docs/ip-filtering-overview)
15306    /// configuration. Specifies the network sources that can access the bucket, as
15307    /// well as its underlying objects.
15308    #[derive(Clone, Default, PartialEq)]
15309    #[non_exhaustive]
15310    pub struct IpFilter {
15311        /// The state of the IP filter configuration. Valid values are `Enabled` and
15312        /// `Disabled`. When set to `Enabled`, IP filtering rules are applied to a
15313        /// bucket and all incoming requests to the bucket are evaluated against
15314        /// these rules. When set to `Disabled`, IP filtering rules are not applied
15315        /// to a bucket.".
15316        pub mode: std::option::Option<std::string::String>,
15317
15318        /// Public IPs allowed to operate or access the bucket.
15319        pub public_network_source:
15320            std::option::Option<crate::model::bucket::ip_filter::PublicNetworkSource>,
15321
15322        /// Optional. The list of network sources that are allowed to access
15323        /// operations on the bucket or the underlying objects.
15324        pub vpc_network_sources: std::vec::Vec<crate::model::bucket::ip_filter::VpcNetworkSource>,
15325
15326        /// Optional. Whether or not to allow VPCs from orgs different than the
15327        /// bucket's parent org to access the bucket. When set to true, validations
15328        /// on the existence of the VPCs won't be performed. If set to false, each
15329        /// VPC network source will be checked to belong to the same org as the
15330        /// bucket as well as validated for existence.
15331        pub allow_cross_org_vpcs: bool,
15332
15333        /// Whether or not to allow all P4SA access to the bucket. When set to true,
15334        /// IP filter config validation will not apply.
15335        pub allow_all_service_agent_access: std::option::Option<bool>,
15336
15337        _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
15338    }
15339
15340    impl IpFilter {
15341        pub fn new() -> Self {
15342            std::default::Default::default()
15343        }
15344
15345        /// Sets the value of [mode][crate::model::bucket::IpFilter::mode].
15346        pub fn set_mode<T>(mut self, v: T) -> Self
15347        where
15348            T: std::convert::Into<std::string::String>,
15349        {
15350            self.mode = std::option::Option::Some(v.into());
15351            self
15352        }
15353
15354        /// Sets or clears the value of [mode][crate::model::bucket::IpFilter::mode].
15355        pub fn set_or_clear_mode<T>(mut self, v: std::option::Option<T>) -> Self
15356        where
15357            T: std::convert::Into<std::string::String>,
15358        {
15359            self.mode = v.map(|x| x.into());
15360            self
15361        }
15362
15363        /// Sets the value of [public_network_source][crate::model::bucket::IpFilter::public_network_source].
15364        pub fn set_public_network_source<T>(mut self, v: T) -> Self
15365        where
15366            T: std::convert::Into<crate::model::bucket::ip_filter::PublicNetworkSource>,
15367        {
15368            self.public_network_source = std::option::Option::Some(v.into());
15369            self
15370        }
15371
15372        /// Sets or clears the value of [public_network_source][crate::model::bucket::IpFilter::public_network_source].
15373        pub fn set_or_clear_public_network_source<T>(mut self, v: std::option::Option<T>) -> Self
15374        where
15375            T: std::convert::Into<crate::model::bucket::ip_filter::PublicNetworkSource>,
15376        {
15377            self.public_network_source = v.map(|x| x.into());
15378            self
15379        }
15380
15381        /// Sets the value of [vpc_network_sources][crate::model::bucket::IpFilter::vpc_network_sources].
15382        pub fn set_vpc_network_sources<T, V>(mut self, v: T) -> Self
15383        where
15384            T: std::iter::IntoIterator<Item = V>,
15385            V: std::convert::Into<crate::model::bucket::ip_filter::VpcNetworkSource>,
15386        {
15387            use std::iter::Iterator;
15388            self.vpc_network_sources = v.into_iter().map(|i| i.into()).collect();
15389            self
15390        }
15391
15392        /// Sets the value of [allow_cross_org_vpcs][crate::model::bucket::IpFilter::allow_cross_org_vpcs].
15393        pub fn set_allow_cross_org_vpcs<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
15394            self.allow_cross_org_vpcs = v.into();
15395            self
15396        }
15397
15398        /// Sets the value of [allow_all_service_agent_access][crate::model::bucket::IpFilter::allow_all_service_agent_access].
15399        pub fn set_allow_all_service_agent_access<T>(mut self, v: T) -> Self
15400        where
15401            T: std::convert::Into<bool>,
15402        {
15403            self.allow_all_service_agent_access = std::option::Option::Some(v.into());
15404            self
15405        }
15406
15407        /// Sets or clears the value of [allow_all_service_agent_access][crate::model::bucket::IpFilter::allow_all_service_agent_access].
15408        pub fn set_or_clear_allow_all_service_agent_access<T>(
15409            mut self,
15410            v: std::option::Option<T>,
15411        ) -> Self
15412        where
15413            T: std::convert::Into<bool>,
15414        {
15415            self.allow_all_service_agent_access = v.map(|x| x.into());
15416            self
15417        }
15418    }
15419
15420    impl wkt::message::Message for IpFilter {
15421        fn typename() -> &'static str {
15422            "type.googleapis.com/google.storage.v2.Bucket.IpFilter"
15423        }
15424    }
15425
15426    #[doc(hidden)]
15427    impl<'de> serde::de::Deserialize<'de> for IpFilter {
15428        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
15429        where
15430            D: serde::Deserializer<'de>,
15431        {
15432            #[allow(non_camel_case_types)]
15433            #[doc(hidden)]
15434            #[derive(PartialEq, Eq, Hash)]
15435            enum __FieldTag {
15436                __mode,
15437                __public_network_source,
15438                __vpc_network_sources,
15439                __allow_cross_org_vpcs,
15440                __allow_all_service_agent_access,
15441                Unknown(std::string::String),
15442            }
15443            impl<'de> serde::de::Deserialize<'de> for __FieldTag {
15444                fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
15445                where
15446                    D: serde::Deserializer<'de>,
15447                {
15448                    struct Visitor;
15449                    impl<'de> serde::de::Visitor<'de> for Visitor {
15450                        type Value = __FieldTag;
15451                        fn expecting(
15452                            &self,
15453                            formatter: &mut std::fmt::Formatter,
15454                        ) -> std::fmt::Result {
15455                            formatter.write_str("a field name for IpFilter")
15456                        }
15457                        fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
15458                        where
15459                            E: serde::de::Error,
15460                        {
15461                            use std::result::Result::Ok;
15462                            use std::string::ToString;
15463                            match value {
15464                                "mode" => Ok(__FieldTag::__mode),
15465                                "publicNetworkSource" => Ok(__FieldTag::__public_network_source),
15466                                "public_network_source" => Ok(__FieldTag::__public_network_source),
15467                                "vpcNetworkSources" => Ok(__FieldTag::__vpc_network_sources),
15468                                "vpc_network_sources" => Ok(__FieldTag::__vpc_network_sources),
15469                                "allowCrossOrgVpcs" => Ok(__FieldTag::__allow_cross_org_vpcs),
15470                                "allow_cross_org_vpcs" => Ok(__FieldTag::__allow_cross_org_vpcs),
15471                                "allowAllServiceAgentAccess" => {
15472                                    Ok(__FieldTag::__allow_all_service_agent_access)
15473                                }
15474                                "allow_all_service_agent_access" => {
15475                                    Ok(__FieldTag::__allow_all_service_agent_access)
15476                                }
15477                                _ => Ok(__FieldTag::Unknown(value.to_string())),
15478                            }
15479                        }
15480                    }
15481                    deserializer.deserialize_identifier(Visitor)
15482                }
15483            }
15484            struct Visitor;
15485            impl<'de> serde::de::Visitor<'de> for Visitor {
15486                type Value = IpFilter;
15487                fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
15488                    formatter.write_str("struct IpFilter")
15489                }
15490                fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
15491                where
15492                    A: serde::de::MapAccess<'de>,
15493                {
15494                    #[allow(unused_imports)]
15495                    use serde::de::Error;
15496                    use std::option::Option::Some;
15497                    let mut fields = std::collections::HashSet::new();
15498                    let mut result = Self::Value::new();
15499                    while let Some(tag) = map.next_key::<__FieldTag>()? {
15500                        #[allow(clippy::match_single_binding)]
15501                        match tag {
15502                            __FieldTag::__mode => {
15503                                if !fields.insert(__FieldTag::__mode) {
15504                                    return std::result::Result::Err(A::Error::duplicate_field(
15505                                        "multiple values for mode",
15506                                    ));
15507                                }
15508                                result.mode =
15509                                    map.next_value::<std::option::Option<std::string::String>>()?;
15510                            }
15511                            __FieldTag::__public_network_source => {
15512                                if !fields.insert(__FieldTag::__public_network_source) {
15513                                    return std::result::Result::Err(A::Error::duplicate_field(
15514                                        "multiple values for public_network_source",
15515                                    ));
15516                                }
15517                                result.public_network_source = map
15518                                    .next_value::<std::option::Option<
15519                                        crate::model::bucket::ip_filter::PublicNetworkSource,
15520                                    >>()?;
15521                            }
15522                            __FieldTag::__vpc_network_sources => {
15523                                if !fields.insert(__FieldTag::__vpc_network_sources) {
15524                                    return std::result::Result::Err(A::Error::duplicate_field(
15525                                        "multiple values for vpc_network_sources",
15526                                    ));
15527                                }
15528                                result.vpc_network_sources = map
15529                                    .next_value::<std::option::Option<
15530                                        std::vec::Vec<
15531                                            crate::model::bucket::ip_filter::VpcNetworkSource,
15532                                        >,
15533                                    >>()?
15534                                    .unwrap_or_default();
15535                            }
15536                            __FieldTag::__allow_cross_org_vpcs => {
15537                                if !fields.insert(__FieldTag::__allow_cross_org_vpcs) {
15538                                    return std::result::Result::Err(A::Error::duplicate_field(
15539                                        "multiple values for allow_cross_org_vpcs",
15540                                    ));
15541                                }
15542                                result.allow_cross_org_vpcs = map
15543                                    .next_value::<std::option::Option<bool>>()?
15544                                    .unwrap_or_default();
15545                            }
15546                            __FieldTag::__allow_all_service_agent_access => {
15547                                if !fields.insert(__FieldTag::__allow_all_service_agent_access) {
15548                                    return std::result::Result::Err(A::Error::duplicate_field(
15549                                        "multiple values for allow_all_service_agent_access",
15550                                    ));
15551                                }
15552                                result.allow_all_service_agent_access =
15553                                    map.next_value::<std::option::Option<bool>>()?;
15554                            }
15555                            __FieldTag::Unknown(key) => {
15556                                let value = map.next_value::<serde_json::Value>()?;
15557                                result._unknown_fields.insert(key, value);
15558                            }
15559                        }
15560                    }
15561                    std::result::Result::Ok(result)
15562                }
15563            }
15564            deserializer.deserialize_any(Visitor)
15565        }
15566    }
15567
15568    #[doc(hidden)]
15569    impl serde::ser::Serialize for IpFilter {
15570        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
15571        where
15572            S: serde::ser::Serializer,
15573        {
15574            use serde::ser::SerializeMap;
15575            #[allow(unused_imports)]
15576            use std::option::Option::Some;
15577            let mut state = serializer.serialize_map(std::option::Option::None)?;
15578            if self.mode.is_some() {
15579                state.serialize_entry("mode", &self.mode)?;
15580            }
15581            if self.public_network_source.is_some() {
15582                state.serialize_entry("publicNetworkSource", &self.public_network_source)?;
15583            }
15584            if !self.vpc_network_sources.is_empty() {
15585                state.serialize_entry("vpcNetworkSources", &self.vpc_network_sources)?;
15586            }
15587            if !wkt::internal::is_default(&self.allow_cross_org_vpcs) {
15588                state.serialize_entry("allowCrossOrgVpcs", &self.allow_cross_org_vpcs)?;
15589            }
15590            if self.allow_all_service_agent_access.is_some() {
15591                state.serialize_entry(
15592                    "allowAllServiceAgentAccess",
15593                    &self.allow_all_service_agent_access,
15594                )?;
15595            }
15596            if !self._unknown_fields.is_empty() {
15597                for (key, value) in self._unknown_fields.iter() {
15598                    state.serialize_entry(key, &value)?;
15599                }
15600            }
15601            state.end()
15602        }
15603    }
15604
15605    impl std::fmt::Debug for IpFilter {
15606        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
15607            let mut debug_struct = f.debug_struct("IpFilter");
15608            debug_struct.field("mode", &self.mode);
15609            debug_struct.field("public_network_source", &self.public_network_source);
15610            debug_struct.field("vpc_network_sources", &self.vpc_network_sources);
15611            debug_struct.field("allow_cross_org_vpcs", &self.allow_cross_org_vpcs);
15612            debug_struct.field(
15613                "allow_all_service_agent_access",
15614                &self.allow_all_service_agent_access,
15615            );
15616            if !self._unknown_fields.is_empty() {
15617                debug_struct.field("_unknown_fields", &self._unknown_fields);
15618            }
15619            debug_struct.finish()
15620        }
15621    }
15622
15623    /// Defines additional types related to [IpFilter].
15624    pub mod ip_filter {
15625        #[allow(unused_imports)]
15626        use super::*;
15627
15628        /// The public network IP address ranges that can access the bucket and its
15629        /// data.
15630        #[derive(Clone, Default, PartialEq)]
15631        #[non_exhaustive]
15632        pub struct PublicNetworkSource {
15633            /// Optional. The list of IPv4 and IPv6 cidr blocks that are allowed to
15634            /// operate or access the bucket and its underlying objects.
15635            pub allowed_ip_cidr_ranges: std::vec::Vec<std::string::String>,
15636
15637            _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
15638        }
15639
15640        impl PublicNetworkSource {
15641            pub fn new() -> Self {
15642                std::default::Default::default()
15643            }
15644
15645            /// Sets the value of [allowed_ip_cidr_ranges][crate::model::bucket::ip_filter::PublicNetworkSource::allowed_ip_cidr_ranges].
15646            pub fn set_allowed_ip_cidr_ranges<T, V>(mut self, v: T) -> Self
15647            where
15648                T: std::iter::IntoIterator<Item = V>,
15649                V: std::convert::Into<std::string::String>,
15650            {
15651                use std::iter::Iterator;
15652                self.allowed_ip_cidr_ranges = v.into_iter().map(|i| i.into()).collect();
15653                self
15654            }
15655        }
15656
15657        impl wkt::message::Message for PublicNetworkSource {
15658            fn typename() -> &'static str {
15659                "type.googleapis.com/google.storage.v2.Bucket.IpFilter.PublicNetworkSource"
15660            }
15661        }
15662
15663        #[doc(hidden)]
15664        impl<'de> serde::de::Deserialize<'de> for PublicNetworkSource {
15665            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
15666            where
15667                D: serde::Deserializer<'de>,
15668            {
15669                #[allow(non_camel_case_types)]
15670                #[doc(hidden)]
15671                #[derive(PartialEq, Eq, Hash)]
15672                enum __FieldTag {
15673                    __allowed_ip_cidr_ranges,
15674                    Unknown(std::string::String),
15675                }
15676                impl<'de> serde::de::Deserialize<'de> for __FieldTag {
15677                    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
15678                    where
15679                        D: serde::Deserializer<'de>,
15680                    {
15681                        struct Visitor;
15682                        impl<'de> serde::de::Visitor<'de> for Visitor {
15683                            type Value = __FieldTag;
15684                            fn expecting(
15685                                &self,
15686                                formatter: &mut std::fmt::Formatter,
15687                            ) -> std::fmt::Result {
15688                                formatter.write_str("a field name for PublicNetworkSource")
15689                            }
15690                            fn visit_str<E>(
15691                                self,
15692                                value: &str,
15693                            ) -> std::result::Result<Self::Value, E>
15694                            where
15695                                E: serde::de::Error,
15696                            {
15697                                use std::result::Result::Ok;
15698                                use std::string::ToString;
15699                                match value {
15700                                    "allowedIpCidrRanges" => {
15701                                        Ok(__FieldTag::__allowed_ip_cidr_ranges)
15702                                    }
15703                                    "allowed_ip_cidr_ranges" => {
15704                                        Ok(__FieldTag::__allowed_ip_cidr_ranges)
15705                                    }
15706                                    _ => Ok(__FieldTag::Unknown(value.to_string())),
15707                                }
15708                            }
15709                        }
15710                        deserializer.deserialize_identifier(Visitor)
15711                    }
15712                }
15713                struct Visitor;
15714                impl<'de> serde::de::Visitor<'de> for Visitor {
15715                    type Value = PublicNetworkSource;
15716                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
15717                        formatter.write_str("struct PublicNetworkSource")
15718                    }
15719                    fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
15720                    where
15721                        A: serde::de::MapAccess<'de>,
15722                    {
15723                        #[allow(unused_imports)]
15724                        use serde::de::Error;
15725                        use std::option::Option::Some;
15726                        let mut fields = std::collections::HashSet::new();
15727                        let mut result = Self::Value::new();
15728                        while let Some(tag) = map.next_key::<__FieldTag>()? {
15729                            #[allow(clippy::match_single_binding)]
15730                            match tag {
15731                                __FieldTag::__allowed_ip_cidr_ranges => {
15732                                    if !fields.insert(__FieldTag::__allowed_ip_cidr_ranges) {
15733                                        return std::result::Result::Err(
15734                                            A::Error::duplicate_field(
15735                                                "multiple values for allowed_ip_cidr_ranges",
15736                                            ),
15737                                        );
15738                                    }
15739                                    result.allowed_ip_cidr_ranges = map.next_value::<std::option::Option<std::vec::Vec<std::string::String>>>()?.unwrap_or_default();
15740                                }
15741                                __FieldTag::Unknown(key) => {
15742                                    let value = map.next_value::<serde_json::Value>()?;
15743                                    result._unknown_fields.insert(key, value);
15744                                }
15745                            }
15746                        }
15747                        std::result::Result::Ok(result)
15748                    }
15749                }
15750                deserializer.deserialize_any(Visitor)
15751            }
15752        }
15753
15754        #[doc(hidden)]
15755        impl serde::ser::Serialize for PublicNetworkSource {
15756            fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
15757            where
15758                S: serde::ser::Serializer,
15759            {
15760                use serde::ser::SerializeMap;
15761                #[allow(unused_imports)]
15762                use std::option::Option::Some;
15763                let mut state = serializer.serialize_map(std::option::Option::None)?;
15764                if !self.allowed_ip_cidr_ranges.is_empty() {
15765                    state.serialize_entry("allowedIpCidrRanges", &self.allowed_ip_cidr_ranges)?;
15766                }
15767                if !self._unknown_fields.is_empty() {
15768                    for (key, value) in self._unknown_fields.iter() {
15769                        state.serialize_entry(key, &value)?;
15770                    }
15771                }
15772                state.end()
15773            }
15774        }
15775
15776        impl std::fmt::Debug for PublicNetworkSource {
15777            fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
15778                let mut debug_struct = f.debug_struct("PublicNetworkSource");
15779                debug_struct.field("allowed_ip_cidr_ranges", &self.allowed_ip_cidr_ranges);
15780                if !self._unknown_fields.is_empty() {
15781                    debug_struct.field("_unknown_fields", &self._unknown_fields);
15782                }
15783                debug_struct.finish()
15784            }
15785        }
15786
15787        /// The list of VPC networks that can access the bucket.
15788        #[derive(Clone, Default, PartialEq)]
15789        #[non_exhaustive]
15790        pub struct VpcNetworkSource {
15791            /// Name of the network.
15792            ///
15793            /// Format: `projects/PROJECT_ID/global/networks/NETWORK_NAME`
15794            pub network: std::option::Option<std::string::String>,
15795
15796            /// Optional. The list of public or private IPv4 and IPv6 CIDR ranges that
15797            /// can access the bucket. In the CIDR IP address block, the specified IP
15798            /// address must be properly truncated, meaning all the host bits must be
15799            /// zero or else the input is considered malformed. For example,
15800            /// `192.0.2.0/24` is accepted but `192.0.2.1/24` is not. Similarly, for
15801            /// IPv6, `2001:db8::/32` is accepted whereas `2001:db8::1/32` is not.
15802            pub allowed_ip_cidr_ranges: std::vec::Vec<std::string::String>,
15803
15804            _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
15805        }
15806
15807        impl VpcNetworkSource {
15808            pub fn new() -> Self {
15809                std::default::Default::default()
15810            }
15811
15812            /// Sets the value of [network][crate::model::bucket::ip_filter::VpcNetworkSource::network].
15813            pub fn set_network<T>(mut self, v: T) -> Self
15814            where
15815                T: std::convert::Into<std::string::String>,
15816            {
15817                self.network = std::option::Option::Some(v.into());
15818                self
15819            }
15820
15821            /// Sets or clears the value of [network][crate::model::bucket::ip_filter::VpcNetworkSource::network].
15822            pub fn set_or_clear_network<T>(mut self, v: std::option::Option<T>) -> Self
15823            where
15824                T: std::convert::Into<std::string::String>,
15825            {
15826                self.network = v.map(|x| x.into());
15827                self
15828            }
15829
15830            /// Sets the value of [allowed_ip_cidr_ranges][crate::model::bucket::ip_filter::VpcNetworkSource::allowed_ip_cidr_ranges].
15831            pub fn set_allowed_ip_cidr_ranges<T, V>(mut self, v: T) -> Self
15832            where
15833                T: std::iter::IntoIterator<Item = V>,
15834                V: std::convert::Into<std::string::String>,
15835            {
15836                use std::iter::Iterator;
15837                self.allowed_ip_cidr_ranges = v.into_iter().map(|i| i.into()).collect();
15838                self
15839            }
15840        }
15841
15842        impl wkt::message::Message for VpcNetworkSource {
15843            fn typename() -> &'static str {
15844                "type.googleapis.com/google.storage.v2.Bucket.IpFilter.VpcNetworkSource"
15845            }
15846        }
15847
15848        #[doc(hidden)]
15849        impl<'de> serde::de::Deserialize<'de> for VpcNetworkSource {
15850            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
15851            where
15852                D: serde::Deserializer<'de>,
15853            {
15854                #[allow(non_camel_case_types)]
15855                #[doc(hidden)]
15856                #[derive(PartialEq, Eq, Hash)]
15857                enum __FieldTag {
15858                    __network,
15859                    __allowed_ip_cidr_ranges,
15860                    Unknown(std::string::String),
15861                }
15862                impl<'de> serde::de::Deserialize<'de> for __FieldTag {
15863                    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
15864                    where
15865                        D: serde::Deserializer<'de>,
15866                    {
15867                        struct Visitor;
15868                        impl<'de> serde::de::Visitor<'de> for Visitor {
15869                            type Value = __FieldTag;
15870                            fn expecting(
15871                                &self,
15872                                formatter: &mut std::fmt::Formatter,
15873                            ) -> std::fmt::Result {
15874                                formatter.write_str("a field name for VpcNetworkSource")
15875                            }
15876                            fn visit_str<E>(
15877                                self,
15878                                value: &str,
15879                            ) -> std::result::Result<Self::Value, E>
15880                            where
15881                                E: serde::de::Error,
15882                            {
15883                                use std::result::Result::Ok;
15884                                use std::string::ToString;
15885                                match value {
15886                                    "network" => Ok(__FieldTag::__network),
15887                                    "allowedIpCidrRanges" => {
15888                                        Ok(__FieldTag::__allowed_ip_cidr_ranges)
15889                                    }
15890                                    "allowed_ip_cidr_ranges" => {
15891                                        Ok(__FieldTag::__allowed_ip_cidr_ranges)
15892                                    }
15893                                    _ => Ok(__FieldTag::Unknown(value.to_string())),
15894                                }
15895                            }
15896                        }
15897                        deserializer.deserialize_identifier(Visitor)
15898                    }
15899                }
15900                struct Visitor;
15901                impl<'de> serde::de::Visitor<'de> for Visitor {
15902                    type Value = VpcNetworkSource;
15903                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
15904                        formatter.write_str("struct VpcNetworkSource")
15905                    }
15906                    fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
15907                    where
15908                        A: serde::de::MapAccess<'de>,
15909                    {
15910                        #[allow(unused_imports)]
15911                        use serde::de::Error;
15912                        use std::option::Option::Some;
15913                        let mut fields = std::collections::HashSet::new();
15914                        let mut result = Self::Value::new();
15915                        while let Some(tag) = map.next_key::<__FieldTag>()? {
15916                            #[allow(clippy::match_single_binding)]
15917                            match tag {
15918                                __FieldTag::__network => {
15919                                    if !fields.insert(__FieldTag::__network) {
15920                                        return std::result::Result::Err(
15921                                            A::Error::duplicate_field(
15922                                                "multiple values for network",
15923                                            ),
15924                                        );
15925                                    }
15926                                    result.network = map
15927                                        .next_value::<std::option::Option<std::string::String>>()?;
15928                                }
15929                                __FieldTag::__allowed_ip_cidr_ranges => {
15930                                    if !fields.insert(__FieldTag::__allowed_ip_cidr_ranges) {
15931                                        return std::result::Result::Err(
15932                                            A::Error::duplicate_field(
15933                                                "multiple values for allowed_ip_cidr_ranges",
15934                                            ),
15935                                        );
15936                                    }
15937                                    result.allowed_ip_cidr_ranges = map.next_value::<std::option::Option<std::vec::Vec<std::string::String>>>()?.unwrap_or_default();
15938                                }
15939                                __FieldTag::Unknown(key) => {
15940                                    let value = map.next_value::<serde_json::Value>()?;
15941                                    result._unknown_fields.insert(key, value);
15942                                }
15943                            }
15944                        }
15945                        std::result::Result::Ok(result)
15946                    }
15947                }
15948                deserializer.deserialize_any(Visitor)
15949            }
15950        }
15951
15952        #[doc(hidden)]
15953        impl serde::ser::Serialize for VpcNetworkSource {
15954            fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
15955            where
15956                S: serde::ser::Serializer,
15957            {
15958                use serde::ser::SerializeMap;
15959                #[allow(unused_imports)]
15960                use std::option::Option::Some;
15961                let mut state = serializer.serialize_map(std::option::Option::None)?;
15962                if self.network.is_some() {
15963                    state.serialize_entry("network", &self.network)?;
15964                }
15965                if !self.allowed_ip_cidr_ranges.is_empty() {
15966                    state.serialize_entry("allowedIpCidrRanges", &self.allowed_ip_cidr_ranges)?;
15967                }
15968                if !self._unknown_fields.is_empty() {
15969                    for (key, value) in self._unknown_fields.iter() {
15970                        state.serialize_entry(key, &value)?;
15971                    }
15972                }
15973                state.end()
15974            }
15975        }
15976
15977        impl std::fmt::Debug for VpcNetworkSource {
15978            fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
15979                let mut debug_struct = f.debug_struct("VpcNetworkSource");
15980                debug_struct.field("network", &self.network);
15981                debug_struct.field("allowed_ip_cidr_ranges", &self.allowed_ip_cidr_ranges);
15982                if !self._unknown_fields.is_empty() {
15983                    debug_struct.field("_unknown_fields", &self._unknown_fields);
15984                }
15985                debug_struct.finish()
15986            }
15987        }
15988    }
15989
15990    /// Configuration for a bucket's hierarchical namespace feature.
15991    #[derive(Clone, Default, PartialEq)]
15992    #[non_exhaustive]
15993    pub struct HierarchicalNamespace {
15994        /// Optional. Enables the hierarchical namespace feature.
15995        pub enabled: bool,
15996
15997        _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
15998    }
15999
16000    impl HierarchicalNamespace {
16001        pub fn new() -> Self {
16002            std::default::Default::default()
16003        }
16004
16005        /// Sets the value of [enabled][crate::model::bucket::HierarchicalNamespace::enabled].
16006        pub fn set_enabled<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
16007            self.enabled = v.into();
16008            self
16009        }
16010    }
16011
16012    impl wkt::message::Message for HierarchicalNamespace {
16013        fn typename() -> &'static str {
16014            "type.googleapis.com/google.storage.v2.Bucket.HierarchicalNamespace"
16015        }
16016    }
16017
16018    #[doc(hidden)]
16019    impl<'de> serde::de::Deserialize<'de> for HierarchicalNamespace {
16020        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
16021        where
16022            D: serde::Deserializer<'de>,
16023        {
16024            #[allow(non_camel_case_types)]
16025            #[doc(hidden)]
16026            #[derive(PartialEq, Eq, Hash)]
16027            enum __FieldTag {
16028                __enabled,
16029                Unknown(std::string::String),
16030            }
16031            impl<'de> serde::de::Deserialize<'de> for __FieldTag {
16032                fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
16033                where
16034                    D: serde::Deserializer<'de>,
16035                {
16036                    struct Visitor;
16037                    impl<'de> serde::de::Visitor<'de> for Visitor {
16038                        type Value = __FieldTag;
16039                        fn expecting(
16040                            &self,
16041                            formatter: &mut std::fmt::Formatter,
16042                        ) -> std::fmt::Result {
16043                            formatter.write_str("a field name for HierarchicalNamespace")
16044                        }
16045                        fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
16046                        where
16047                            E: serde::de::Error,
16048                        {
16049                            use std::result::Result::Ok;
16050                            use std::string::ToString;
16051                            match value {
16052                                "enabled" => Ok(__FieldTag::__enabled),
16053                                _ => Ok(__FieldTag::Unknown(value.to_string())),
16054                            }
16055                        }
16056                    }
16057                    deserializer.deserialize_identifier(Visitor)
16058                }
16059            }
16060            struct Visitor;
16061            impl<'de> serde::de::Visitor<'de> for Visitor {
16062                type Value = HierarchicalNamespace;
16063                fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
16064                    formatter.write_str("struct HierarchicalNamespace")
16065                }
16066                fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
16067                where
16068                    A: serde::de::MapAccess<'de>,
16069                {
16070                    #[allow(unused_imports)]
16071                    use serde::de::Error;
16072                    use std::option::Option::Some;
16073                    let mut fields = std::collections::HashSet::new();
16074                    let mut result = Self::Value::new();
16075                    while let Some(tag) = map.next_key::<__FieldTag>()? {
16076                        #[allow(clippy::match_single_binding)]
16077                        match tag {
16078                            __FieldTag::__enabled => {
16079                                if !fields.insert(__FieldTag::__enabled) {
16080                                    return std::result::Result::Err(A::Error::duplicate_field(
16081                                        "multiple values for enabled",
16082                                    ));
16083                                }
16084                                result.enabled = map
16085                                    .next_value::<std::option::Option<bool>>()?
16086                                    .unwrap_or_default();
16087                            }
16088                            __FieldTag::Unknown(key) => {
16089                                let value = map.next_value::<serde_json::Value>()?;
16090                                result._unknown_fields.insert(key, value);
16091                            }
16092                        }
16093                    }
16094                    std::result::Result::Ok(result)
16095                }
16096            }
16097            deserializer.deserialize_any(Visitor)
16098        }
16099    }
16100
16101    #[doc(hidden)]
16102    impl serde::ser::Serialize for HierarchicalNamespace {
16103        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
16104        where
16105            S: serde::ser::Serializer,
16106        {
16107            use serde::ser::SerializeMap;
16108            #[allow(unused_imports)]
16109            use std::option::Option::Some;
16110            let mut state = serializer.serialize_map(std::option::Option::None)?;
16111            if !wkt::internal::is_default(&self.enabled) {
16112                state.serialize_entry("enabled", &self.enabled)?;
16113            }
16114            if !self._unknown_fields.is_empty() {
16115                for (key, value) in self._unknown_fields.iter() {
16116                    state.serialize_entry(key, &value)?;
16117                }
16118            }
16119            state.end()
16120        }
16121    }
16122
16123    impl std::fmt::Debug for HierarchicalNamespace {
16124        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
16125            let mut debug_struct = f.debug_struct("HierarchicalNamespace");
16126            debug_struct.field("enabled", &self.enabled);
16127            if !self._unknown_fields.is_empty() {
16128                debug_struct.field("_unknown_fields", &self._unknown_fields);
16129            }
16130            debug_struct.finish()
16131        }
16132    }
16133}
16134
16135/// An access-control entry.
16136#[derive(Clone, Default, PartialEq)]
16137#[non_exhaustive]
16138pub struct BucketAccessControl {
16139    /// Optional. The access permission for the entity.
16140    pub role: std::string::String,
16141
16142    /// Optional. The ID of the access-control entry.
16143    pub id: std::string::String,
16144
16145    /// Optional. The entity holding the permission, in one of the following forms:
16146    ///
16147    /// * `user-{userid}`
16148    /// * `user-{email}`
16149    /// * `group-{groupid}`
16150    /// * `group-{email}`
16151    /// * `domain-{domain}`
16152    /// * `project-{team}-{projectnumber}`
16153    /// * `project-{team}-{projectid}`
16154    /// * `allUsers`
16155    /// * `allAuthenticatedUsers`
16156    ///   Examples:
16157    /// * The user `liz@example.com` would be `user-liz@example.com`.
16158    /// * The group `example@googlegroups.com` would be
16159    ///   `group-example@googlegroups.com`
16160    /// * All members of the Google Apps for Business domain `example.com` would be
16161    ///   `domain-example.com`
16162    ///   For project entities, `project-{team}-{projectnumber}` format will be
16163    ///   returned on response.
16164    pub entity: std::string::String,
16165
16166    /// Output only. The alternative entity format, if exists. For project
16167    /// entities, `project-{team}-{projectid}` format will be returned on response.
16168    pub entity_alt: std::string::String,
16169
16170    /// Optional. The ID for the entity, if any.
16171    pub entity_id: std::string::String,
16172
16173    /// Optional. The etag of the BucketAccessControl.
16174    /// If included in the metadata of an update or delete request message, the
16175    /// operation operation will only be performed if the etag matches that of the
16176    /// bucket's BucketAccessControl.
16177    pub etag: std::string::String,
16178
16179    /// Optional. The email address associated with the entity, if any.
16180    pub email: std::string::String,
16181
16182    /// Optional. The domain associated with the entity, if any.
16183    pub domain: std::string::String,
16184
16185    /// Optional. The project team associated with the entity, if any.
16186    pub project_team: std::option::Option<crate::model::ProjectTeam>,
16187
16188    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
16189}
16190
16191impl BucketAccessControl {
16192    pub fn new() -> Self {
16193        std::default::Default::default()
16194    }
16195
16196    /// Sets the value of [role][crate::model::BucketAccessControl::role].
16197    pub fn set_role<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
16198        self.role = v.into();
16199        self
16200    }
16201
16202    /// Sets the value of [id][crate::model::BucketAccessControl::id].
16203    pub fn set_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
16204        self.id = v.into();
16205        self
16206    }
16207
16208    /// Sets the value of [entity][crate::model::BucketAccessControl::entity].
16209    pub fn set_entity<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
16210        self.entity = v.into();
16211        self
16212    }
16213
16214    /// Sets the value of [entity_alt][crate::model::BucketAccessControl::entity_alt].
16215    pub fn set_entity_alt<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
16216        self.entity_alt = v.into();
16217        self
16218    }
16219
16220    /// Sets the value of [entity_id][crate::model::BucketAccessControl::entity_id].
16221    pub fn set_entity_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
16222        self.entity_id = v.into();
16223        self
16224    }
16225
16226    /// Sets the value of [etag][crate::model::BucketAccessControl::etag].
16227    pub fn set_etag<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
16228        self.etag = v.into();
16229        self
16230    }
16231
16232    /// Sets the value of [email][crate::model::BucketAccessControl::email].
16233    pub fn set_email<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
16234        self.email = v.into();
16235        self
16236    }
16237
16238    /// Sets the value of [domain][crate::model::BucketAccessControl::domain].
16239    pub fn set_domain<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
16240        self.domain = v.into();
16241        self
16242    }
16243
16244    /// Sets the value of [project_team][crate::model::BucketAccessControl::project_team].
16245    pub fn set_project_team<T>(mut self, v: T) -> Self
16246    where
16247        T: std::convert::Into<crate::model::ProjectTeam>,
16248    {
16249        self.project_team = std::option::Option::Some(v.into());
16250        self
16251    }
16252
16253    /// Sets or clears the value of [project_team][crate::model::BucketAccessControl::project_team].
16254    pub fn set_or_clear_project_team<T>(mut self, v: std::option::Option<T>) -> Self
16255    where
16256        T: std::convert::Into<crate::model::ProjectTeam>,
16257    {
16258        self.project_team = v.map(|x| x.into());
16259        self
16260    }
16261}
16262
16263impl wkt::message::Message for BucketAccessControl {
16264    fn typename() -> &'static str {
16265        "type.googleapis.com/google.storage.v2.BucketAccessControl"
16266    }
16267}
16268
16269#[doc(hidden)]
16270impl<'de> serde::de::Deserialize<'de> for BucketAccessControl {
16271    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
16272    where
16273        D: serde::Deserializer<'de>,
16274    {
16275        #[allow(non_camel_case_types)]
16276        #[doc(hidden)]
16277        #[derive(PartialEq, Eq, Hash)]
16278        enum __FieldTag {
16279            __role,
16280            __id,
16281            __entity,
16282            __entity_alt,
16283            __entity_id,
16284            __etag,
16285            __email,
16286            __domain,
16287            __project_team,
16288            Unknown(std::string::String),
16289        }
16290        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
16291            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
16292            where
16293                D: serde::Deserializer<'de>,
16294            {
16295                struct Visitor;
16296                impl<'de> serde::de::Visitor<'de> for Visitor {
16297                    type Value = __FieldTag;
16298                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
16299                        formatter.write_str("a field name for BucketAccessControl")
16300                    }
16301                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
16302                    where
16303                        E: serde::de::Error,
16304                    {
16305                        use std::result::Result::Ok;
16306                        use std::string::ToString;
16307                        match value {
16308                            "role" => Ok(__FieldTag::__role),
16309                            "id" => Ok(__FieldTag::__id),
16310                            "entity" => Ok(__FieldTag::__entity),
16311                            "entityAlt" => Ok(__FieldTag::__entity_alt),
16312                            "entity_alt" => Ok(__FieldTag::__entity_alt),
16313                            "entityId" => Ok(__FieldTag::__entity_id),
16314                            "entity_id" => Ok(__FieldTag::__entity_id),
16315                            "etag" => Ok(__FieldTag::__etag),
16316                            "email" => Ok(__FieldTag::__email),
16317                            "domain" => Ok(__FieldTag::__domain),
16318                            "projectTeam" => Ok(__FieldTag::__project_team),
16319                            "project_team" => Ok(__FieldTag::__project_team),
16320                            _ => Ok(__FieldTag::Unknown(value.to_string())),
16321                        }
16322                    }
16323                }
16324                deserializer.deserialize_identifier(Visitor)
16325            }
16326        }
16327        struct Visitor;
16328        impl<'de> serde::de::Visitor<'de> for Visitor {
16329            type Value = BucketAccessControl;
16330            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
16331                formatter.write_str("struct BucketAccessControl")
16332            }
16333            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
16334            where
16335                A: serde::de::MapAccess<'de>,
16336            {
16337                #[allow(unused_imports)]
16338                use serde::de::Error;
16339                use std::option::Option::Some;
16340                let mut fields = std::collections::HashSet::new();
16341                let mut result = Self::Value::new();
16342                while let Some(tag) = map.next_key::<__FieldTag>()? {
16343                    #[allow(clippy::match_single_binding)]
16344                    match tag {
16345                        __FieldTag::__role => {
16346                            if !fields.insert(__FieldTag::__role) {
16347                                return std::result::Result::Err(A::Error::duplicate_field(
16348                                    "multiple values for role",
16349                                ));
16350                            }
16351                            result.role = map
16352                                .next_value::<std::option::Option<std::string::String>>()?
16353                                .unwrap_or_default();
16354                        }
16355                        __FieldTag::__id => {
16356                            if !fields.insert(__FieldTag::__id) {
16357                                return std::result::Result::Err(A::Error::duplicate_field(
16358                                    "multiple values for id",
16359                                ));
16360                            }
16361                            result.id = map
16362                                .next_value::<std::option::Option<std::string::String>>()?
16363                                .unwrap_or_default();
16364                        }
16365                        __FieldTag::__entity => {
16366                            if !fields.insert(__FieldTag::__entity) {
16367                                return std::result::Result::Err(A::Error::duplicate_field(
16368                                    "multiple values for entity",
16369                                ));
16370                            }
16371                            result.entity = map
16372                                .next_value::<std::option::Option<std::string::String>>()?
16373                                .unwrap_or_default();
16374                        }
16375                        __FieldTag::__entity_alt => {
16376                            if !fields.insert(__FieldTag::__entity_alt) {
16377                                return std::result::Result::Err(A::Error::duplicate_field(
16378                                    "multiple values for entity_alt",
16379                                ));
16380                            }
16381                            result.entity_alt = map
16382                                .next_value::<std::option::Option<std::string::String>>()?
16383                                .unwrap_or_default();
16384                        }
16385                        __FieldTag::__entity_id => {
16386                            if !fields.insert(__FieldTag::__entity_id) {
16387                                return std::result::Result::Err(A::Error::duplicate_field(
16388                                    "multiple values for entity_id",
16389                                ));
16390                            }
16391                            result.entity_id = map
16392                                .next_value::<std::option::Option<std::string::String>>()?
16393                                .unwrap_or_default();
16394                        }
16395                        __FieldTag::__etag => {
16396                            if !fields.insert(__FieldTag::__etag) {
16397                                return std::result::Result::Err(A::Error::duplicate_field(
16398                                    "multiple values for etag",
16399                                ));
16400                            }
16401                            result.etag = map
16402                                .next_value::<std::option::Option<std::string::String>>()?
16403                                .unwrap_or_default();
16404                        }
16405                        __FieldTag::__email => {
16406                            if !fields.insert(__FieldTag::__email) {
16407                                return std::result::Result::Err(A::Error::duplicate_field(
16408                                    "multiple values for email",
16409                                ));
16410                            }
16411                            result.email = map
16412                                .next_value::<std::option::Option<std::string::String>>()?
16413                                .unwrap_or_default();
16414                        }
16415                        __FieldTag::__domain => {
16416                            if !fields.insert(__FieldTag::__domain) {
16417                                return std::result::Result::Err(A::Error::duplicate_field(
16418                                    "multiple values for domain",
16419                                ));
16420                            }
16421                            result.domain = map
16422                                .next_value::<std::option::Option<std::string::String>>()?
16423                                .unwrap_or_default();
16424                        }
16425                        __FieldTag::__project_team => {
16426                            if !fields.insert(__FieldTag::__project_team) {
16427                                return std::result::Result::Err(A::Error::duplicate_field(
16428                                    "multiple values for project_team",
16429                                ));
16430                            }
16431                            result.project_team =
16432                                map.next_value::<std::option::Option<crate::model::ProjectTeam>>()?;
16433                        }
16434                        __FieldTag::Unknown(key) => {
16435                            let value = map.next_value::<serde_json::Value>()?;
16436                            result._unknown_fields.insert(key, value);
16437                        }
16438                    }
16439                }
16440                std::result::Result::Ok(result)
16441            }
16442        }
16443        deserializer.deserialize_any(Visitor)
16444    }
16445}
16446
16447#[doc(hidden)]
16448impl serde::ser::Serialize for BucketAccessControl {
16449    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
16450    where
16451        S: serde::ser::Serializer,
16452    {
16453        use serde::ser::SerializeMap;
16454        #[allow(unused_imports)]
16455        use std::option::Option::Some;
16456        let mut state = serializer.serialize_map(std::option::Option::None)?;
16457        if !self.role.is_empty() {
16458            state.serialize_entry("role", &self.role)?;
16459        }
16460        if !self.id.is_empty() {
16461            state.serialize_entry("id", &self.id)?;
16462        }
16463        if !self.entity.is_empty() {
16464            state.serialize_entry("entity", &self.entity)?;
16465        }
16466        if !self.entity_alt.is_empty() {
16467            state.serialize_entry("entityAlt", &self.entity_alt)?;
16468        }
16469        if !self.entity_id.is_empty() {
16470            state.serialize_entry("entityId", &self.entity_id)?;
16471        }
16472        if !self.etag.is_empty() {
16473            state.serialize_entry("etag", &self.etag)?;
16474        }
16475        if !self.email.is_empty() {
16476            state.serialize_entry("email", &self.email)?;
16477        }
16478        if !self.domain.is_empty() {
16479            state.serialize_entry("domain", &self.domain)?;
16480        }
16481        if self.project_team.is_some() {
16482            state.serialize_entry("projectTeam", &self.project_team)?;
16483        }
16484        if !self._unknown_fields.is_empty() {
16485            for (key, value) in self._unknown_fields.iter() {
16486                state.serialize_entry(key, &value)?;
16487            }
16488        }
16489        state.end()
16490    }
16491}
16492
16493impl std::fmt::Debug for BucketAccessControl {
16494    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
16495        let mut debug_struct = f.debug_struct("BucketAccessControl");
16496        debug_struct.field("role", &self.role);
16497        debug_struct.field("id", &self.id);
16498        debug_struct.field("entity", &self.entity);
16499        debug_struct.field("entity_alt", &self.entity_alt);
16500        debug_struct.field("entity_id", &self.entity_id);
16501        debug_struct.field("etag", &self.etag);
16502        debug_struct.field("email", &self.email);
16503        debug_struct.field("domain", &self.domain);
16504        debug_struct.field("project_team", &self.project_team);
16505        if !self._unknown_fields.is_empty() {
16506            debug_struct.field("_unknown_fields", &self._unknown_fields);
16507        }
16508        debug_struct.finish()
16509    }
16510}
16511
16512/// Message used for storing full (not subrange) object checksums.
16513#[derive(Clone, Default, PartialEq)]
16514#[non_exhaustive]
16515pub struct ObjectChecksums {
16516    /// CRC32C digest of the object data. Computed by the Cloud Storage service for
16517    /// all written objects.
16518    /// If set in a WriteObjectRequest, service will validate that the stored
16519    /// object matches this checksum.
16520    pub crc32c: std::option::Option<u32>,
16521
16522    /// Optional. 128 bit MD5 hash of the object data.
16523    /// For more information about using the MD5 hash, see
16524    /// [<https://cloud.google.com/storage/docs/hashes-etags#json-api>][Hashes and
16525    /// ETags: Best Practices].
16526    /// Not all objects will provide an MD5 hash. For example, composite objects
16527    /// provide only crc32c hashes. This value is equivalent to running `cat
16528    /// object.txt | openssl md5 -binary`
16529    pub md5_hash: ::bytes::Bytes,
16530
16531    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
16532}
16533
16534impl ObjectChecksums {
16535    pub fn new() -> Self {
16536        std::default::Default::default()
16537    }
16538
16539    /// Sets the value of [crc32c][crate::model::ObjectChecksums::crc32c].
16540    pub fn set_crc32c<T>(mut self, v: T) -> Self
16541    where
16542        T: std::convert::Into<u32>,
16543    {
16544        self.crc32c = std::option::Option::Some(v.into());
16545        self
16546    }
16547
16548    /// Sets or clears the value of [crc32c][crate::model::ObjectChecksums::crc32c].
16549    pub fn set_or_clear_crc32c<T>(mut self, v: std::option::Option<T>) -> Self
16550    where
16551        T: std::convert::Into<u32>,
16552    {
16553        self.crc32c = v.map(|x| x.into());
16554        self
16555    }
16556
16557    /// Sets the value of [md5_hash][crate::model::ObjectChecksums::md5_hash].
16558    pub fn set_md5_hash<T: std::convert::Into<::bytes::Bytes>>(mut self, v: T) -> Self {
16559        self.md5_hash = v.into();
16560        self
16561    }
16562}
16563
16564impl wkt::message::Message for ObjectChecksums {
16565    fn typename() -> &'static str {
16566        "type.googleapis.com/google.storage.v2.ObjectChecksums"
16567    }
16568}
16569
16570#[doc(hidden)]
16571impl<'de> serde::de::Deserialize<'de> for ObjectChecksums {
16572    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
16573    where
16574        D: serde::Deserializer<'de>,
16575    {
16576        #[allow(non_camel_case_types)]
16577        #[doc(hidden)]
16578        #[derive(PartialEq, Eq, Hash)]
16579        enum __FieldTag {
16580            __crc32c,
16581            __md5_hash,
16582            Unknown(std::string::String),
16583        }
16584        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
16585            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
16586            where
16587                D: serde::Deserializer<'de>,
16588            {
16589                struct Visitor;
16590                impl<'de> serde::de::Visitor<'de> for Visitor {
16591                    type Value = __FieldTag;
16592                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
16593                        formatter.write_str("a field name for ObjectChecksums")
16594                    }
16595                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
16596                    where
16597                        E: serde::de::Error,
16598                    {
16599                        use std::result::Result::Ok;
16600                        use std::string::ToString;
16601                        match value {
16602                            "crc32c" => Ok(__FieldTag::__crc32c),
16603                            "md5Hash" => Ok(__FieldTag::__md5_hash),
16604                            "md5_hash" => Ok(__FieldTag::__md5_hash),
16605                            _ => Ok(__FieldTag::Unknown(value.to_string())),
16606                        }
16607                    }
16608                }
16609                deserializer.deserialize_identifier(Visitor)
16610            }
16611        }
16612        struct Visitor;
16613        impl<'de> serde::de::Visitor<'de> for Visitor {
16614            type Value = ObjectChecksums;
16615            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
16616                formatter.write_str("struct ObjectChecksums")
16617            }
16618            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
16619            where
16620                A: serde::de::MapAccess<'de>,
16621            {
16622                #[allow(unused_imports)]
16623                use serde::de::Error;
16624                use std::option::Option::Some;
16625                let mut fields = std::collections::HashSet::new();
16626                let mut result = Self::Value::new();
16627                while let Some(tag) = map.next_key::<__FieldTag>()? {
16628                    #[allow(clippy::match_single_binding)]
16629                    match tag {
16630                        __FieldTag::__crc32c => {
16631                            if !fields.insert(__FieldTag::__crc32c) {
16632                                return std::result::Result::Err(A::Error::duplicate_field(
16633                                    "multiple values for crc32c",
16634                                ));
16635                            }
16636                            struct __With(std::option::Option<u32>);
16637                            impl<'de> serde::de::Deserialize<'de> for __With {
16638                                fn deserialize<D>(
16639                                    deserializer: D,
16640                                ) -> std::result::Result<Self, D::Error>
16641                                where
16642                                    D: serde::de::Deserializer<'de>,
16643                                {
16644                                    serde_with::As::< std::option::Option<wkt::internal::U32> >::deserialize(deserializer).map(__With)
16645                                }
16646                            }
16647                            result.crc32c = map.next_value::<__With>()?.0;
16648                        }
16649                        __FieldTag::__md5_hash => {
16650                            if !fields.insert(__FieldTag::__md5_hash) {
16651                                return std::result::Result::Err(A::Error::duplicate_field(
16652                                    "multiple values for md5_hash",
16653                                ));
16654                            }
16655                            struct __With(std::option::Option<::bytes::Bytes>);
16656                            impl<'de> serde::de::Deserialize<'de> for __With {
16657                                fn deserialize<D>(
16658                                    deserializer: D,
16659                                ) -> std::result::Result<Self, D::Error>
16660                                where
16661                                    D: serde::de::Deserializer<'de>,
16662                                {
16663                                    serde_with::As::< std::option::Option<serde_with::base64::Base64> >::deserialize(deserializer).map(__With)
16664                                }
16665                            }
16666                            result.md5_hash = map.next_value::<__With>()?.0.unwrap_or_default();
16667                        }
16668                        __FieldTag::Unknown(key) => {
16669                            let value = map.next_value::<serde_json::Value>()?;
16670                            result._unknown_fields.insert(key, value);
16671                        }
16672                    }
16673                }
16674                std::result::Result::Ok(result)
16675            }
16676        }
16677        deserializer.deserialize_any(Visitor)
16678    }
16679}
16680
16681#[doc(hidden)]
16682impl serde::ser::Serialize for ObjectChecksums {
16683    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
16684    where
16685        S: serde::ser::Serializer,
16686    {
16687        use serde::ser::SerializeMap;
16688        #[allow(unused_imports)]
16689        use std::option::Option::Some;
16690        let mut state = serializer.serialize_map(std::option::Option::None)?;
16691        if self.crc32c.is_some() {
16692            struct __With<'a>(&'a std::option::Option<u32>);
16693            impl<'a> serde::ser::Serialize for __With<'a> {
16694                fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
16695                where
16696                    S: serde::ser::Serializer,
16697                {
16698                    serde_with::As::<std::option::Option<wkt::internal::U32>>::serialize(
16699                        self.0, serializer,
16700                    )
16701                }
16702            }
16703            state.serialize_entry("crc32c", &__With(&self.crc32c))?;
16704        }
16705        if !self.md5_hash.is_empty() {
16706            struct __With<'a>(&'a ::bytes::Bytes);
16707            impl<'a> serde::ser::Serialize for __With<'a> {
16708                fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
16709                where
16710                    S: serde::ser::Serializer,
16711                {
16712                    serde_with::As::<serde_with::base64::Base64>::serialize(self.0, serializer)
16713                }
16714            }
16715            state.serialize_entry("md5Hash", &__With(&self.md5_hash))?;
16716        }
16717        if !self._unknown_fields.is_empty() {
16718            for (key, value) in self._unknown_fields.iter() {
16719                state.serialize_entry(key, &value)?;
16720            }
16721        }
16722        state.end()
16723    }
16724}
16725
16726impl std::fmt::Debug for ObjectChecksums {
16727    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
16728        let mut debug_struct = f.debug_struct("ObjectChecksums");
16729        debug_struct.field("crc32c", &self.crc32c);
16730        debug_struct.field("md5_hash", &self.md5_hash);
16731        if !self._unknown_fields.is_empty() {
16732            debug_struct.field("_unknown_fields", &self._unknown_fields);
16733        }
16734        debug_struct.finish()
16735    }
16736}
16737
16738/// The payload of a single user-defined object context.
16739#[derive(Clone, Default, PartialEq)]
16740#[non_exhaustive]
16741pub struct ObjectCustomContextPayload {
16742    /// Required. The value of the object context.
16743    pub value: std::string::String,
16744
16745    /// Output only. The time at which the object context was created.
16746    pub create_time: std::option::Option<wkt::Timestamp>,
16747
16748    /// Output only. The time at which the object context was last updated.
16749    pub update_time: std::option::Option<wkt::Timestamp>,
16750
16751    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
16752}
16753
16754impl ObjectCustomContextPayload {
16755    pub fn new() -> Self {
16756        std::default::Default::default()
16757    }
16758
16759    /// Sets the value of [value][crate::model::ObjectCustomContextPayload::value].
16760    pub fn set_value<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
16761        self.value = v.into();
16762        self
16763    }
16764
16765    /// Sets the value of [create_time][crate::model::ObjectCustomContextPayload::create_time].
16766    pub fn set_create_time<T>(mut self, v: T) -> Self
16767    where
16768        T: std::convert::Into<wkt::Timestamp>,
16769    {
16770        self.create_time = std::option::Option::Some(v.into());
16771        self
16772    }
16773
16774    /// Sets or clears the value of [create_time][crate::model::ObjectCustomContextPayload::create_time].
16775    pub fn set_or_clear_create_time<T>(mut self, v: std::option::Option<T>) -> Self
16776    where
16777        T: std::convert::Into<wkt::Timestamp>,
16778    {
16779        self.create_time = v.map(|x| x.into());
16780        self
16781    }
16782
16783    /// Sets the value of [update_time][crate::model::ObjectCustomContextPayload::update_time].
16784    pub fn set_update_time<T>(mut self, v: T) -> Self
16785    where
16786        T: std::convert::Into<wkt::Timestamp>,
16787    {
16788        self.update_time = std::option::Option::Some(v.into());
16789        self
16790    }
16791
16792    /// Sets or clears the value of [update_time][crate::model::ObjectCustomContextPayload::update_time].
16793    pub fn set_or_clear_update_time<T>(mut self, v: std::option::Option<T>) -> Self
16794    where
16795        T: std::convert::Into<wkt::Timestamp>,
16796    {
16797        self.update_time = v.map(|x| x.into());
16798        self
16799    }
16800}
16801
16802impl wkt::message::Message for ObjectCustomContextPayload {
16803    fn typename() -> &'static str {
16804        "type.googleapis.com/google.storage.v2.ObjectCustomContextPayload"
16805    }
16806}
16807
16808#[doc(hidden)]
16809impl<'de> serde::de::Deserialize<'de> for ObjectCustomContextPayload {
16810    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
16811    where
16812        D: serde::Deserializer<'de>,
16813    {
16814        #[allow(non_camel_case_types)]
16815        #[doc(hidden)]
16816        #[derive(PartialEq, Eq, Hash)]
16817        enum __FieldTag {
16818            __value,
16819            __create_time,
16820            __update_time,
16821            Unknown(std::string::String),
16822        }
16823        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
16824            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
16825            where
16826                D: serde::Deserializer<'de>,
16827            {
16828                struct Visitor;
16829                impl<'de> serde::de::Visitor<'de> for Visitor {
16830                    type Value = __FieldTag;
16831                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
16832                        formatter.write_str("a field name for ObjectCustomContextPayload")
16833                    }
16834                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
16835                    where
16836                        E: serde::de::Error,
16837                    {
16838                        use std::result::Result::Ok;
16839                        use std::string::ToString;
16840                        match value {
16841                            "value" => Ok(__FieldTag::__value),
16842                            "createTime" => Ok(__FieldTag::__create_time),
16843                            "create_time" => Ok(__FieldTag::__create_time),
16844                            "updateTime" => Ok(__FieldTag::__update_time),
16845                            "update_time" => Ok(__FieldTag::__update_time),
16846                            _ => Ok(__FieldTag::Unknown(value.to_string())),
16847                        }
16848                    }
16849                }
16850                deserializer.deserialize_identifier(Visitor)
16851            }
16852        }
16853        struct Visitor;
16854        impl<'de> serde::de::Visitor<'de> for Visitor {
16855            type Value = ObjectCustomContextPayload;
16856            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
16857                formatter.write_str("struct ObjectCustomContextPayload")
16858            }
16859            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
16860            where
16861                A: serde::de::MapAccess<'de>,
16862            {
16863                #[allow(unused_imports)]
16864                use serde::de::Error;
16865                use std::option::Option::Some;
16866                let mut fields = std::collections::HashSet::new();
16867                let mut result = Self::Value::new();
16868                while let Some(tag) = map.next_key::<__FieldTag>()? {
16869                    #[allow(clippy::match_single_binding)]
16870                    match tag {
16871                        __FieldTag::__value => {
16872                            if !fields.insert(__FieldTag::__value) {
16873                                return std::result::Result::Err(A::Error::duplicate_field(
16874                                    "multiple values for value",
16875                                ));
16876                            }
16877                            result.value = map
16878                                .next_value::<std::option::Option<std::string::String>>()?
16879                                .unwrap_or_default();
16880                        }
16881                        __FieldTag::__create_time => {
16882                            if !fields.insert(__FieldTag::__create_time) {
16883                                return std::result::Result::Err(A::Error::duplicate_field(
16884                                    "multiple values for create_time",
16885                                ));
16886                            }
16887                            result.create_time =
16888                                map.next_value::<std::option::Option<wkt::Timestamp>>()?;
16889                        }
16890                        __FieldTag::__update_time => {
16891                            if !fields.insert(__FieldTag::__update_time) {
16892                                return std::result::Result::Err(A::Error::duplicate_field(
16893                                    "multiple values for update_time",
16894                                ));
16895                            }
16896                            result.update_time =
16897                                map.next_value::<std::option::Option<wkt::Timestamp>>()?;
16898                        }
16899                        __FieldTag::Unknown(key) => {
16900                            let value = map.next_value::<serde_json::Value>()?;
16901                            result._unknown_fields.insert(key, value);
16902                        }
16903                    }
16904                }
16905                std::result::Result::Ok(result)
16906            }
16907        }
16908        deserializer.deserialize_any(Visitor)
16909    }
16910}
16911
16912#[doc(hidden)]
16913impl serde::ser::Serialize for ObjectCustomContextPayload {
16914    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
16915    where
16916        S: serde::ser::Serializer,
16917    {
16918        use serde::ser::SerializeMap;
16919        #[allow(unused_imports)]
16920        use std::option::Option::Some;
16921        let mut state = serializer.serialize_map(std::option::Option::None)?;
16922        if !self.value.is_empty() {
16923            state.serialize_entry("value", &self.value)?;
16924        }
16925        if self.create_time.is_some() {
16926            state.serialize_entry("createTime", &self.create_time)?;
16927        }
16928        if self.update_time.is_some() {
16929            state.serialize_entry("updateTime", &self.update_time)?;
16930        }
16931        if !self._unknown_fields.is_empty() {
16932            for (key, value) in self._unknown_fields.iter() {
16933                state.serialize_entry(key, &value)?;
16934            }
16935        }
16936        state.end()
16937    }
16938}
16939
16940impl std::fmt::Debug for ObjectCustomContextPayload {
16941    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
16942        let mut debug_struct = f.debug_struct("ObjectCustomContextPayload");
16943        debug_struct.field("value", &self.value);
16944        debug_struct.field("create_time", &self.create_time);
16945        debug_struct.field("update_time", &self.update_time);
16946        if !self._unknown_fields.is_empty() {
16947            debug_struct.field("_unknown_fields", &self._unknown_fields);
16948        }
16949        debug_struct.finish()
16950    }
16951}
16952
16953/// All contexts of an object grouped by type.
16954#[derive(Clone, Default, PartialEq)]
16955#[non_exhaustive]
16956pub struct ObjectContexts {
16957    /// Optional. User-defined object contexts.
16958    pub custom:
16959        std::collections::HashMap<std::string::String, crate::model::ObjectCustomContextPayload>,
16960
16961    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
16962}
16963
16964impl ObjectContexts {
16965    pub fn new() -> Self {
16966        std::default::Default::default()
16967    }
16968
16969    /// Sets the value of [custom][crate::model::ObjectContexts::custom].
16970    pub fn set_custom<T, K, V>(mut self, v: T) -> Self
16971    where
16972        T: std::iter::IntoIterator<Item = (K, V)>,
16973        K: std::convert::Into<std::string::String>,
16974        V: std::convert::Into<crate::model::ObjectCustomContextPayload>,
16975    {
16976        use std::iter::Iterator;
16977        self.custom = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
16978        self
16979    }
16980}
16981
16982impl wkt::message::Message for ObjectContexts {
16983    fn typename() -> &'static str {
16984        "type.googleapis.com/google.storage.v2.ObjectContexts"
16985    }
16986}
16987
16988#[doc(hidden)]
16989impl<'de> serde::de::Deserialize<'de> for ObjectContexts {
16990    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
16991    where
16992        D: serde::Deserializer<'de>,
16993    {
16994        #[allow(non_camel_case_types)]
16995        #[doc(hidden)]
16996        #[derive(PartialEq, Eq, Hash)]
16997        enum __FieldTag {
16998            __custom,
16999            Unknown(std::string::String),
17000        }
17001        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
17002            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
17003            where
17004                D: serde::Deserializer<'de>,
17005            {
17006                struct Visitor;
17007                impl<'de> serde::de::Visitor<'de> for Visitor {
17008                    type Value = __FieldTag;
17009                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
17010                        formatter.write_str("a field name for ObjectContexts")
17011                    }
17012                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
17013                    where
17014                        E: serde::de::Error,
17015                    {
17016                        use std::result::Result::Ok;
17017                        use std::string::ToString;
17018                        match value {
17019                            "custom" => Ok(__FieldTag::__custom),
17020                            _ => Ok(__FieldTag::Unknown(value.to_string())),
17021                        }
17022                    }
17023                }
17024                deserializer.deserialize_identifier(Visitor)
17025            }
17026        }
17027        struct Visitor;
17028        impl<'de> serde::de::Visitor<'de> for Visitor {
17029            type Value = ObjectContexts;
17030            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
17031                formatter.write_str("struct ObjectContexts")
17032            }
17033            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
17034            where
17035                A: serde::de::MapAccess<'de>,
17036            {
17037                #[allow(unused_imports)]
17038                use serde::de::Error;
17039                use std::option::Option::Some;
17040                let mut fields = std::collections::HashSet::new();
17041                let mut result = Self::Value::new();
17042                while let Some(tag) = map.next_key::<__FieldTag>()? {
17043                    #[allow(clippy::match_single_binding)]
17044                    match tag {
17045                        __FieldTag::__custom => {
17046                            if !fields.insert(__FieldTag::__custom) {
17047                                return std::result::Result::Err(A::Error::duplicate_field(
17048                                    "multiple values for custom",
17049                                ));
17050                            }
17051                            result.custom = map
17052                                .next_value::<std::option::Option<
17053                                    std::collections::HashMap<
17054                                        std::string::String,
17055                                        crate::model::ObjectCustomContextPayload,
17056                                    >,
17057                                >>()?
17058                                .unwrap_or_default();
17059                        }
17060                        __FieldTag::Unknown(key) => {
17061                            let value = map.next_value::<serde_json::Value>()?;
17062                            result._unknown_fields.insert(key, value);
17063                        }
17064                    }
17065                }
17066                std::result::Result::Ok(result)
17067            }
17068        }
17069        deserializer.deserialize_any(Visitor)
17070    }
17071}
17072
17073#[doc(hidden)]
17074impl serde::ser::Serialize for ObjectContexts {
17075    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
17076    where
17077        S: serde::ser::Serializer,
17078    {
17079        use serde::ser::SerializeMap;
17080        #[allow(unused_imports)]
17081        use std::option::Option::Some;
17082        let mut state = serializer.serialize_map(std::option::Option::None)?;
17083        if !self.custom.is_empty() {
17084            state.serialize_entry("custom", &self.custom)?;
17085        }
17086        if !self._unknown_fields.is_empty() {
17087            for (key, value) in self._unknown_fields.iter() {
17088                state.serialize_entry(key, &value)?;
17089            }
17090        }
17091        state.end()
17092    }
17093}
17094
17095impl std::fmt::Debug for ObjectContexts {
17096    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
17097        let mut debug_struct = f.debug_struct("ObjectContexts");
17098        debug_struct.field("custom", &self.custom);
17099        if !self._unknown_fields.is_empty() {
17100            debug_struct.field("_unknown_fields", &self._unknown_fields);
17101        }
17102        debug_struct.finish()
17103    }
17104}
17105
17106/// Describes the Customer-Supplied Encryption Key mechanism used to store an
17107/// Object's data at rest.
17108#[derive(Clone, Default, PartialEq)]
17109#[non_exhaustive]
17110pub struct CustomerEncryption {
17111    /// Optional. The encryption algorithm.
17112    pub encryption_algorithm: std::string::String,
17113
17114    /// Optional. SHA256 hash value of the encryption key.
17115    /// In raw bytes format (not base64-encoded).
17116    pub key_sha256_bytes: ::bytes::Bytes,
17117
17118    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
17119}
17120
17121impl CustomerEncryption {
17122    pub fn new() -> Self {
17123        std::default::Default::default()
17124    }
17125
17126    /// Sets the value of [encryption_algorithm][crate::model::CustomerEncryption::encryption_algorithm].
17127    pub fn set_encryption_algorithm<T: std::convert::Into<std::string::String>>(
17128        mut self,
17129        v: T,
17130    ) -> Self {
17131        self.encryption_algorithm = v.into();
17132        self
17133    }
17134
17135    /// Sets the value of [key_sha256_bytes][crate::model::CustomerEncryption::key_sha256_bytes].
17136    pub fn set_key_sha256_bytes<T: std::convert::Into<::bytes::Bytes>>(mut self, v: T) -> Self {
17137        self.key_sha256_bytes = v.into();
17138        self
17139    }
17140}
17141
17142impl wkt::message::Message for CustomerEncryption {
17143    fn typename() -> &'static str {
17144        "type.googleapis.com/google.storage.v2.CustomerEncryption"
17145    }
17146}
17147
17148#[doc(hidden)]
17149impl<'de> serde::de::Deserialize<'de> for CustomerEncryption {
17150    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
17151    where
17152        D: serde::Deserializer<'de>,
17153    {
17154        #[allow(non_camel_case_types)]
17155        #[doc(hidden)]
17156        #[derive(PartialEq, Eq, Hash)]
17157        enum __FieldTag {
17158            __encryption_algorithm,
17159            __key_sha256_bytes,
17160            Unknown(std::string::String),
17161        }
17162        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
17163            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
17164            where
17165                D: serde::Deserializer<'de>,
17166            {
17167                struct Visitor;
17168                impl<'de> serde::de::Visitor<'de> for Visitor {
17169                    type Value = __FieldTag;
17170                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
17171                        formatter.write_str("a field name for CustomerEncryption")
17172                    }
17173                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
17174                    where
17175                        E: serde::de::Error,
17176                    {
17177                        use std::result::Result::Ok;
17178                        use std::string::ToString;
17179                        match value {
17180                            "encryptionAlgorithm" => Ok(__FieldTag::__encryption_algorithm),
17181                            "encryption_algorithm" => Ok(__FieldTag::__encryption_algorithm),
17182                            "keySha256Bytes" => Ok(__FieldTag::__key_sha256_bytes),
17183                            "key_sha256_bytes" => Ok(__FieldTag::__key_sha256_bytes),
17184                            _ => Ok(__FieldTag::Unknown(value.to_string())),
17185                        }
17186                    }
17187                }
17188                deserializer.deserialize_identifier(Visitor)
17189            }
17190        }
17191        struct Visitor;
17192        impl<'de> serde::de::Visitor<'de> for Visitor {
17193            type Value = CustomerEncryption;
17194            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
17195                formatter.write_str("struct CustomerEncryption")
17196            }
17197            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
17198            where
17199                A: serde::de::MapAccess<'de>,
17200            {
17201                #[allow(unused_imports)]
17202                use serde::de::Error;
17203                use std::option::Option::Some;
17204                let mut fields = std::collections::HashSet::new();
17205                let mut result = Self::Value::new();
17206                while let Some(tag) = map.next_key::<__FieldTag>()? {
17207                    #[allow(clippy::match_single_binding)]
17208                    match tag {
17209                        __FieldTag::__encryption_algorithm => {
17210                            if !fields.insert(__FieldTag::__encryption_algorithm) {
17211                                return std::result::Result::Err(A::Error::duplicate_field(
17212                                    "multiple values for encryption_algorithm",
17213                                ));
17214                            }
17215                            result.encryption_algorithm = map
17216                                .next_value::<std::option::Option<std::string::String>>()?
17217                                .unwrap_or_default();
17218                        }
17219                        __FieldTag::__key_sha256_bytes => {
17220                            if !fields.insert(__FieldTag::__key_sha256_bytes) {
17221                                return std::result::Result::Err(A::Error::duplicate_field(
17222                                    "multiple values for key_sha256_bytes",
17223                                ));
17224                            }
17225                            struct __With(std::option::Option<::bytes::Bytes>);
17226                            impl<'de> serde::de::Deserialize<'de> for __With {
17227                                fn deserialize<D>(
17228                                    deserializer: D,
17229                                ) -> std::result::Result<Self, D::Error>
17230                                where
17231                                    D: serde::de::Deserializer<'de>,
17232                                {
17233                                    serde_with::As::< std::option::Option<serde_with::base64::Base64> >::deserialize(deserializer).map(__With)
17234                                }
17235                            }
17236                            result.key_sha256_bytes =
17237                                map.next_value::<__With>()?.0.unwrap_or_default();
17238                        }
17239                        __FieldTag::Unknown(key) => {
17240                            let value = map.next_value::<serde_json::Value>()?;
17241                            result._unknown_fields.insert(key, value);
17242                        }
17243                    }
17244                }
17245                std::result::Result::Ok(result)
17246            }
17247        }
17248        deserializer.deserialize_any(Visitor)
17249    }
17250}
17251
17252#[doc(hidden)]
17253impl serde::ser::Serialize for CustomerEncryption {
17254    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
17255    where
17256        S: serde::ser::Serializer,
17257    {
17258        use serde::ser::SerializeMap;
17259        #[allow(unused_imports)]
17260        use std::option::Option::Some;
17261        let mut state = serializer.serialize_map(std::option::Option::None)?;
17262        if !self.encryption_algorithm.is_empty() {
17263            state.serialize_entry("encryptionAlgorithm", &self.encryption_algorithm)?;
17264        }
17265        if !self.key_sha256_bytes.is_empty() {
17266            struct __With<'a>(&'a ::bytes::Bytes);
17267            impl<'a> serde::ser::Serialize for __With<'a> {
17268                fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
17269                where
17270                    S: serde::ser::Serializer,
17271                {
17272                    serde_with::As::<serde_with::base64::Base64>::serialize(self.0, serializer)
17273                }
17274            }
17275            state.serialize_entry("keySha256Bytes", &__With(&self.key_sha256_bytes))?;
17276        }
17277        if !self._unknown_fields.is_empty() {
17278            for (key, value) in self._unknown_fields.iter() {
17279                state.serialize_entry(key, &value)?;
17280            }
17281        }
17282        state.end()
17283    }
17284}
17285
17286impl std::fmt::Debug for CustomerEncryption {
17287    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
17288        let mut debug_struct = f.debug_struct("CustomerEncryption");
17289        debug_struct.field("encryption_algorithm", &self.encryption_algorithm);
17290        debug_struct.field("key_sha256_bytes", &self.key_sha256_bytes);
17291        if !self._unknown_fields.is_empty() {
17292            debug_struct.field("_unknown_fields", &self._unknown_fields);
17293        }
17294        debug_struct.finish()
17295    }
17296}
17297
17298/// An object.
17299#[derive(Clone, Default, PartialEq)]
17300#[non_exhaustive]
17301pub struct Object {
17302    /// Immutable. The name of this object. Nearly any sequence of unicode
17303    /// characters is valid. See
17304    /// [Guidelines](https://cloud.google.com/storage/docs/objects#naming).
17305    /// Example: `test.txt`
17306    /// The `name` field by itself does not uniquely identify a Cloud Storage
17307    /// object. A Cloud Storage object is uniquely identified by the tuple of
17308    /// (bucket, object, generation).
17309    pub name: std::string::String,
17310
17311    /// Immutable. The name of the bucket containing this object.
17312    pub bucket: std::string::String,
17313
17314    /// Optional. The etag of the object.
17315    /// If included in the metadata of an update or delete request message, the
17316    /// operation will only be performed if the etag matches that of the live
17317    /// object.
17318    pub etag: std::string::String,
17319
17320    /// Immutable. The content generation of this object. Used for object
17321    /// versioning.
17322    pub generation: i64,
17323
17324    /// Output only. Restore token used to differentiate deleted objects with the
17325    /// same name and generation. This field is output only, and only set for
17326    /// deleted objects in HNS buckets.
17327    pub restore_token: std::option::Option<std::string::String>,
17328
17329    /// Output only. The version of the metadata for this generation of this
17330    /// object. Used for preconditions and for detecting changes in metadata. A
17331    /// metageneration number is only meaningful in the context of a particular
17332    /// generation of a particular object.
17333    pub metageneration: i64,
17334
17335    /// Optional. Storage class of the object.
17336    pub storage_class: std::string::String,
17337
17338    /// Output only. Content-Length of the object data in bytes, matching
17339    /// [<https://tools.ietf.org/html/rfc7230#section-3.3.2>][RFC 7230 §3.3.2].
17340    pub size: i64,
17341
17342    /// Optional. Content-Encoding of the object data, matching
17343    /// [<https://tools.ietf.org/html/rfc7231#section-3.1.2.2>][RFC 7231 §3.1.2.2]
17344    pub content_encoding: std::string::String,
17345
17346    /// Optional. Content-Disposition of the object data, matching
17347    /// [<https://tools.ietf.org/html/rfc6266>][RFC 6266].
17348    pub content_disposition: std::string::String,
17349
17350    /// Optional. Cache-Control directive for the object data, matching
17351    /// [<https://tools.ietf.org/html/rfc7234#section-5.2>"][RFC 7234 §5.2].
17352    /// If omitted, and the object is accessible to all anonymous users, the
17353    /// default will be `public, max-age=3600`.
17354    pub cache_control: std::string::String,
17355
17356    /// Optional. Access controls on the object.
17357    /// If iam_config.uniform_bucket_level_access is enabled on the parent
17358    /// bucket, requests to set, read, or modify acl is an error.
17359    pub acl: std::vec::Vec<crate::model::ObjectAccessControl>,
17360
17361    /// Optional. Content-Language of the object data, matching
17362    /// [<https://tools.ietf.org/html/rfc7231#section-3.1.3.2>][RFC 7231 §3.1.3.2].
17363    pub content_language: std::string::String,
17364
17365    /// Output only. If this object is noncurrent, this is the time when the object
17366    /// became noncurrent.
17367    pub delete_time: std::option::Option<wkt::Timestamp>,
17368
17369    /// Output only. The time when the object was finalized.
17370    pub finalize_time: std::option::Option<wkt::Timestamp>,
17371
17372    /// Optional. Content-Type of the object data, matching
17373    /// [<https://tools.ietf.org/html/rfc7231#section-3.1.1.5>][RFC 7231 §3.1.1.5].
17374    /// If an object is stored without a Content-Type, it is served as
17375    /// `application/octet-stream`.
17376    pub content_type: std::string::String,
17377
17378    /// Output only. The creation time of the object.
17379    pub create_time: std::option::Option<wkt::Timestamp>,
17380
17381    /// Output only. Number of underlying components that make up this object.
17382    /// Components are accumulated by compose operations.
17383    pub component_count: i32,
17384
17385    /// Output only. Hashes for the data part of this object. This field is used
17386    /// for output only and will be silently ignored if provided in requests. The
17387    /// checksums of the complete object regardless of data range. If the object is
17388    /// downloaded in full, the client should compute one of these checksums over
17389    /// the downloaded object and compare it against the value provided here.
17390    pub checksums: std::option::Option<crate::model::ObjectChecksums>,
17391
17392    /// Output only. The modification time of the object metadata.
17393    /// Set initially to object creation time and then updated whenever any
17394    /// metadata of the object changes. This includes changes made by a requester,
17395    /// such as modifying custom metadata, as well as changes made by Cloud Storage
17396    /// on behalf of a requester, such as changing the storage class based on an
17397    /// Object Lifecycle Configuration.
17398    pub update_time: std::option::Option<wkt::Timestamp>,
17399
17400    /// Optional. Cloud KMS Key used to encrypt this object, if the object is
17401    /// encrypted by such a key.
17402    pub kms_key: std::string::String,
17403
17404    /// Output only. The time at which the object's storage class was last changed.
17405    /// When the object is initially created, it will be set to time_created.
17406    pub update_storage_class_time: std::option::Option<wkt::Timestamp>,
17407
17408    /// Optional. Whether an object is under temporary hold. While this flag is set
17409    /// to true, the object is protected against deletion and overwrites.  A common
17410    /// use case of this flag is regulatory investigations where objects need to be
17411    /// retained while the investigation is ongoing. Note that unlike event-based
17412    /// hold, temporary hold does not impact retention expiration time of an
17413    /// object.
17414    pub temporary_hold: bool,
17415
17416    /// Optional. A server-determined value that specifies the earliest time that
17417    /// the object's retention period expires. Note 1: This field is not provided
17418    /// for objects with an active event-based hold, since retention expiration is
17419    /// unknown until the hold is removed. Note 2: This value can be provided even
17420    /// when temporary hold is set (so that the user can reason about policy
17421    /// without having to first unset the temporary hold).
17422    pub retention_expire_time: std::option::Option<wkt::Timestamp>,
17423
17424    /// Optional. User-provided metadata, in key/value pairs.
17425    pub metadata: std::collections::HashMap<std::string::String, std::string::String>,
17426
17427    /// Optional. User-defined or system-defined object contexts. Each object
17428    /// context is a key-payload pair, where the key provides the identification
17429    /// and the payload holds the associated value and additional metadata.
17430    pub contexts: std::option::Option<crate::model::ObjectContexts>,
17431
17432    /// Whether an object is under event-based hold.
17433    /// An event-based hold is a way to force the retention of an object until
17434    /// after some event occurs. Once the hold is released by explicitly setting
17435    /// this field to false, the object will become subject to any bucket-level
17436    /// retention policy, except that the retention duration will be calculated
17437    /// from the time the event based hold was lifted, rather than the time the
17438    /// object was created.
17439    ///
17440    /// In a WriteObject request, not setting this field implies that the value
17441    /// should be taken from the parent bucket's "default_event_based_hold" field.
17442    /// In a response, this field will always be set to true or false.
17443    pub event_based_hold: std::option::Option<bool>,
17444
17445    /// Output only. The owner of the object. This will always be the uploader of
17446    /// the object.
17447    pub owner: std::option::Option<crate::model::Owner>,
17448
17449    /// Optional. Metadata of Customer-Supplied Encryption Key, if the object is
17450    /// encrypted by such a key.
17451    pub customer_encryption: std::option::Option<crate::model::CustomerEncryption>,
17452
17453    /// Optional. A user-specified timestamp set on an object.
17454    pub custom_time: std::option::Option<wkt::Timestamp>,
17455
17456    /// Output only. This is the time when the object became soft-deleted.
17457    ///
17458    /// Soft-deleted objects are only accessible if a soft_delete_policy is
17459    /// enabled. Also see hard_delete_time.
17460    pub soft_delete_time: std::option::Option<wkt::Timestamp>,
17461
17462    /// Output only. The time when the object will be permanently deleted.
17463    ///
17464    /// Only set when an object becomes soft-deleted with a soft_delete_policy.
17465    /// Otherwise, the object will not be accessible.
17466    pub hard_delete_time: std::option::Option<wkt::Timestamp>,
17467
17468    /// Optional. Retention configuration of this object.
17469    /// May only be configured if the bucket has object retention enabled.
17470    pub retention: std::option::Option<crate::model::object::Retention>,
17471
17472    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
17473}
17474
17475impl Object {
17476    pub fn new() -> Self {
17477        std::default::Default::default()
17478    }
17479
17480    /// Sets the value of [name][crate::model::Object::name].
17481    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
17482        self.name = v.into();
17483        self
17484    }
17485
17486    /// Sets the value of [bucket][crate::model::Object::bucket].
17487    pub fn set_bucket<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
17488        self.bucket = v.into();
17489        self
17490    }
17491
17492    /// Sets the value of [etag][crate::model::Object::etag].
17493    pub fn set_etag<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
17494        self.etag = v.into();
17495        self
17496    }
17497
17498    /// Sets the value of [generation][crate::model::Object::generation].
17499    pub fn set_generation<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
17500        self.generation = v.into();
17501        self
17502    }
17503
17504    /// Sets the value of [restore_token][crate::model::Object::restore_token].
17505    pub fn set_restore_token<T>(mut self, v: T) -> Self
17506    where
17507        T: std::convert::Into<std::string::String>,
17508    {
17509        self.restore_token = std::option::Option::Some(v.into());
17510        self
17511    }
17512
17513    /// Sets or clears the value of [restore_token][crate::model::Object::restore_token].
17514    pub fn set_or_clear_restore_token<T>(mut self, v: std::option::Option<T>) -> Self
17515    where
17516        T: std::convert::Into<std::string::String>,
17517    {
17518        self.restore_token = v.map(|x| x.into());
17519        self
17520    }
17521
17522    /// Sets the value of [metageneration][crate::model::Object::metageneration].
17523    pub fn set_metageneration<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
17524        self.metageneration = v.into();
17525        self
17526    }
17527
17528    /// Sets the value of [storage_class][crate::model::Object::storage_class].
17529    pub fn set_storage_class<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
17530        self.storage_class = v.into();
17531        self
17532    }
17533
17534    /// Sets the value of [size][crate::model::Object::size].
17535    pub fn set_size<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
17536        self.size = v.into();
17537        self
17538    }
17539
17540    /// Sets the value of [content_encoding][crate::model::Object::content_encoding].
17541    pub fn set_content_encoding<T: std::convert::Into<std::string::String>>(
17542        mut self,
17543        v: T,
17544    ) -> Self {
17545        self.content_encoding = v.into();
17546        self
17547    }
17548
17549    /// Sets the value of [content_disposition][crate::model::Object::content_disposition].
17550    pub fn set_content_disposition<T: std::convert::Into<std::string::String>>(
17551        mut self,
17552        v: T,
17553    ) -> Self {
17554        self.content_disposition = v.into();
17555        self
17556    }
17557
17558    /// Sets the value of [cache_control][crate::model::Object::cache_control].
17559    pub fn set_cache_control<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
17560        self.cache_control = v.into();
17561        self
17562    }
17563
17564    /// Sets the value of [acl][crate::model::Object::acl].
17565    pub fn set_acl<T, V>(mut self, v: T) -> Self
17566    where
17567        T: std::iter::IntoIterator<Item = V>,
17568        V: std::convert::Into<crate::model::ObjectAccessControl>,
17569    {
17570        use std::iter::Iterator;
17571        self.acl = v.into_iter().map(|i| i.into()).collect();
17572        self
17573    }
17574
17575    /// Sets the value of [content_language][crate::model::Object::content_language].
17576    pub fn set_content_language<T: std::convert::Into<std::string::String>>(
17577        mut self,
17578        v: T,
17579    ) -> Self {
17580        self.content_language = v.into();
17581        self
17582    }
17583
17584    /// Sets the value of [delete_time][crate::model::Object::delete_time].
17585    pub fn set_delete_time<T>(mut self, v: T) -> Self
17586    where
17587        T: std::convert::Into<wkt::Timestamp>,
17588    {
17589        self.delete_time = std::option::Option::Some(v.into());
17590        self
17591    }
17592
17593    /// Sets or clears the value of [delete_time][crate::model::Object::delete_time].
17594    pub fn set_or_clear_delete_time<T>(mut self, v: std::option::Option<T>) -> Self
17595    where
17596        T: std::convert::Into<wkt::Timestamp>,
17597    {
17598        self.delete_time = v.map(|x| x.into());
17599        self
17600    }
17601
17602    /// Sets the value of [finalize_time][crate::model::Object::finalize_time].
17603    pub fn set_finalize_time<T>(mut self, v: T) -> Self
17604    where
17605        T: std::convert::Into<wkt::Timestamp>,
17606    {
17607        self.finalize_time = std::option::Option::Some(v.into());
17608        self
17609    }
17610
17611    /// Sets or clears the value of [finalize_time][crate::model::Object::finalize_time].
17612    pub fn set_or_clear_finalize_time<T>(mut self, v: std::option::Option<T>) -> Self
17613    where
17614        T: std::convert::Into<wkt::Timestamp>,
17615    {
17616        self.finalize_time = v.map(|x| x.into());
17617        self
17618    }
17619
17620    /// Sets the value of [content_type][crate::model::Object::content_type].
17621    pub fn set_content_type<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
17622        self.content_type = v.into();
17623        self
17624    }
17625
17626    /// Sets the value of [create_time][crate::model::Object::create_time].
17627    pub fn set_create_time<T>(mut self, v: T) -> Self
17628    where
17629        T: std::convert::Into<wkt::Timestamp>,
17630    {
17631        self.create_time = std::option::Option::Some(v.into());
17632        self
17633    }
17634
17635    /// Sets or clears the value of [create_time][crate::model::Object::create_time].
17636    pub fn set_or_clear_create_time<T>(mut self, v: std::option::Option<T>) -> Self
17637    where
17638        T: std::convert::Into<wkt::Timestamp>,
17639    {
17640        self.create_time = v.map(|x| x.into());
17641        self
17642    }
17643
17644    /// Sets the value of [component_count][crate::model::Object::component_count].
17645    pub fn set_component_count<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
17646        self.component_count = v.into();
17647        self
17648    }
17649
17650    /// Sets the value of [checksums][crate::model::Object::checksums].
17651    pub fn set_checksums<T>(mut self, v: T) -> Self
17652    where
17653        T: std::convert::Into<crate::model::ObjectChecksums>,
17654    {
17655        self.checksums = std::option::Option::Some(v.into());
17656        self
17657    }
17658
17659    /// Sets or clears the value of [checksums][crate::model::Object::checksums].
17660    pub fn set_or_clear_checksums<T>(mut self, v: std::option::Option<T>) -> Self
17661    where
17662        T: std::convert::Into<crate::model::ObjectChecksums>,
17663    {
17664        self.checksums = v.map(|x| x.into());
17665        self
17666    }
17667
17668    /// Sets the value of [update_time][crate::model::Object::update_time].
17669    pub fn set_update_time<T>(mut self, v: T) -> Self
17670    where
17671        T: std::convert::Into<wkt::Timestamp>,
17672    {
17673        self.update_time = std::option::Option::Some(v.into());
17674        self
17675    }
17676
17677    /// Sets or clears the value of [update_time][crate::model::Object::update_time].
17678    pub fn set_or_clear_update_time<T>(mut self, v: std::option::Option<T>) -> Self
17679    where
17680        T: std::convert::Into<wkt::Timestamp>,
17681    {
17682        self.update_time = v.map(|x| x.into());
17683        self
17684    }
17685
17686    /// Sets the value of [kms_key][crate::model::Object::kms_key].
17687    pub fn set_kms_key<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
17688        self.kms_key = v.into();
17689        self
17690    }
17691
17692    /// Sets the value of [update_storage_class_time][crate::model::Object::update_storage_class_time].
17693    pub fn set_update_storage_class_time<T>(mut self, v: T) -> Self
17694    where
17695        T: std::convert::Into<wkt::Timestamp>,
17696    {
17697        self.update_storage_class_time = std::option::Option::Some(v.into());
17698        self
17699    }
17700
17701    /// Sets or clears the value of [update_storage_class_time][crate::model::Object::update_storage_class_time].
17702    pub fn set_or_clear_update_storage_class_time<T>(mut self, v: std::option::Option<T>) -> Self
17703    where
17704        T: std::convert::Into<wkt::Timestamp>,
17705    {
17706        self.update_storage_class_time = v.map(|x| x.into());
17707        self
17708    }
17709
17710    /// Sets the value of [temporary_hold][crate::model::Object::temporary_hold].
17711    pub fn set_temporary_hold<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
17712        self.temporary_hold = v.into();
17713        self
17714    }
17715
17716    /// Sets the value of [retention_expire_time][crate::model::Object::retention_expire_time].
17717    pub fn set_retention_expire_time<T>(mut self, v: T) -> Self
17718    where
17719        T: std::convert::Into<wkt::Timestamp>,
17720    {
17721        self.retention_expire_time = std::option::Option::Some(v.into());
17722        self
17723    }
17724
17725    /// Sets or clears the value of [retention_expire_time][crate::model::Object::retention_expire_time].
17726    pub fn set_or_clear_retention_expire_time<T>(mut self, v: std::option::Option<T>) -> Self
17727    where
17728        T: std::convert::Into<wkt::Timestamp>,
17729    {
17730        self.retention_expire_time = v.map(|x| x.into());
17731        self
17732    }
17733
17734    /// Sets the value of [metadata][crate::model::Object::metadata].
17735    pub fn set_metadata<T, K, V>(mut self, v: T) -> Self
17736    where
17737        T: std::iter::IntoIterator<Item = (K, V)>,
17738        K: std::convert::Into<std::string::String>,
17739        V: std::convert::Into<std::string::String>,
17740    {
17741        use std::iter::Iterator;
17742        self.metadata = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
17743        self
17744    }
17745
17746    /// Sets the value of [contexts][crate::model::Object::contexts].
17747    pub fn set_contexts<T>(mut self, v: T) -> Self
17748    where
17749        T: std::convert::Into<crate::model::ObjectContexts>,
17750    {
17751        self.contexts = std::option::Option::Some(v.into());
17752        self
17753    }
17754
17755    /// Sets or clears the value of [contexts][crate::model::Object::contexts].
17756    pub fn set_or_clear_contexts<T>(mut self, v: std::option::Option<T>) -> Self
17757    where
17758        T: std::convert::Into<crate::model::ObjectContexts>,
17759    {
17760        self.contexts = v.map(|x| x.into());
17761        self
17762    }
17763
17764    /// Sets the value of [event_based_hold][crate::model::Object::event_based_hold].
17765    pub fn set_event_based_hold<T>(mut self, v: T) -> Self
17766    where
17767        T: std::convert::Into<bool>,
17768    {
17769        self.event_based_hold = std::option::Option::Some(v.into());
17770        self
17771    }
17772
17773    /// Sets or clears the value of [event_based_hold][crate::model::Object::event_based_hold].
17774    pub fn set_or_clear_event_based_hold<T>(mut self, v: std::option::Option<T>) -> Self
17775    where
17776        T: std::convert::Into<bool>,
17777    {
17778        self.event_based_hold = v.map(|x| x.into());
17779        self
17780    }
17781
17782    /// Sets the value of [owner][crate::model::Object::owner].
17783    pub fn set_owner<T>(mut self, v: T) -> Self
17784    where
17785        T: std::convert::Into<crate::model::Owner>,
17786    {
17787        self.owner = std::option::Option::Some(v.into());
17788        self
17789    }
17790
17791    /// Sets or clears the value of [owner][crate::model::Object::owner].
17792    pub fn set_or_clear_owner<T>(mut self, v: std::option::Option<T>) -> Self
17793    where
17794        T: std::convert::Into<crate::model::Owner>,
17795    {
17796        self.owner = v.map(|x| x.into());
17797        self
17798    }
17799
17800    /// Sets the value of [customer_encryption][crate::model::Object::customer_encryption].
17801    pub fn set_customer_encryption<T>(mut self, v: T) -> Self
17802    where
17803        T: std::convert::Into<crate::model::CustomerEncryption>,
17804    {
17805        self.customer_encryption = std::option::Option::Some(v.into());
17806        self
17807    }
17808
17809    /// Sets or clears the value of [customer_encryption][crate::model::Object::customer_encryption].
17810    pub fn set_or_clear_customer_encryption<T>(mut self, v: std::option::Option<T>) -> Self
17811    where
17812        T: std::convert::Into<crate::model::CustomerEncryption>,
17813    {
17814        self.customer_encryption = v.map(|x| x.into());
17815        self
17816    }
17817
17818    /// Sets the value of [custom_time][crate::model::Object::custom_time].
17819    pub fn set_custom_time<T>(mut self, v: T) -> Self
17820    where
17821        T: std::convert::Into<wkt::Timestamp>,
17822    {
17823        self.custom_time = std::option::Option::Some(v.into());
17824        self
17825    }
17826
17827    /// Sets or clears the value of [custom_time][crate::model::Object::custom_time].
17828    pub fn set_or_clear_custom_time<T>(mut self, v: std::option::Option<T>) -> Self
17829    where
17830        T: std::convert::Into<wkt::Timestamp>,
17831    {
17832        self.custom_time = v.map(|x| x.into());
17833        self
17834    }
17835
17836    /// Sets the value of [soft_delete_time][crate::model::Object::soft_delete_time].
17837    pub fn set_soft_delete_time<T>(mut self, v: T) -> Self
17838    where
17839        T: std::convert::Into<wkt::Timestamp>,
17840    {
17841        self.soft_delete_time = std::option::Option::Some(v.into());
17842        self
17843    }
17844
17845    /// Sets or clears the value of [soft_delete_time][crate::model::Object::soft_delete_time].
17846    pub fn set_or_clear_soft_delete_time<T>(mut self, v: std::option::Option<T>) -> Self
17847    where
17848        T: std::convert::Into<wkt::Timestamp>,
17849    {
17850        self.soft_delete_time = v.map(|x| x.into());
17851        self
17852    }
17853
17854    /// Sets the value of [hard_delete_time][crate::model::Object::hard_delete_time].
17855    pub fn set_hard_delete_time<T>(mut self, v: T) -> Self
17856    where
17857        T: std::convert::Into<wkt::Timestamp>,
17858    {
17859        self.hard_delete_time = std::option::Option::Some(v.into());
17860        self
17861    }
17862
17863    /// Sets or clears the value of [hard_delete_time][crate::model::Object::hard_delete_time].
17864    pub fn set_or_clear_hard_delete_time<T>(mut self, v: std::option::Option<T>) -> Self
17865    where
17866        T: std::convert::Into<wkt::Timestamp>,
17867    {
17868        self.hard_delete_time = v.map(|x| x.into());
17869        self
17870    }
17871
17872    /// Sets the value of [retention][crate::model::Object::retention].
17873    pub fn set_retention<T>(mut self, v: T) -> Self
17874    where
17875        T: std::convert::Into<crate::model::object::Retention>,
17876    {
17877        self.retention = std::option::Option::Some(v.into());
17878        self
17879    }
17880
17881    /// Sets or clears the value of [retention][crate::model::Object::retention].
17882    pub fn set_or_clear_retention<T>(mut self, v: std::option::Option<T>) -> Self
17883    where
17884        T: std::convert::Into<crate::model::object::Retention>,
17885    {
17886        self.retention = v.map(|x| x.into());
17887        self
17888    }
17889}
17890
17891impl wkt::message::Message for Object {
17892    fn typename() -> &'static str {
17893        "type.googleapis.com/google.storage.v2.Object"
17894    }
17895}
17896
17897#[doc(hidden)]
17898impl<'de> serde::de::Deserialize<'de> for Object {
17899    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
17900    where
17901        D: serde::Deserializer<'de>,
17902    {
17903        #[allow(non_camel_case_types)]
17904        #[doc(hidden)]
17905        #[derive(PartialEq, Eq, Hash)]
17906        enum __FieldTag {
17907            __name,
17908            __bucket,
17909            __etag,
17910            __generation,
17911            __restore_token,
17912            __metageneration,
17913            __storage_class,
17914            __size,
17915            __content_encoding,
17916            __content_disposition,
17917            __cache_control,
17918            __acl,
17919            __content_language,
17920            __delete_time,
17921            __finalize_time,
17922            __content_type,
17923            __create_time,
17924            __component_count,
17925            __checksums,
17926            __update_time,
17927            __kms_key,
17928            __update_storage_class_time,
17929            __temporary_hold,
17930            __retention_expire_time,
17931            __metadata,
17932            __contexts,
17933            __event_based_hold,
17934            __owner,
17935            __customer_encryption,
17936            __custom_time,
17937            __soft_delete_time,
17938            __hard_delete_time,
17939            __retention,
17940            Unknown(std::string::String),
17941        }
17942        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
17943            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
17944            where
17945                D: serde::Deserializer<'de>,
17946            {
17947                struct Visitor;
17948                impl<'de> serde::de::Visitor<'de> for Visitor {
17949                    type Value = __FieldTag;
17950                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
17951                        formatter.write_str("a field name for Object")
17952                    }
17953                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
17954                    where
17955                        E: serde::de::Error,
17956                    {
17957                        use std::result::Result::Ok;
17958                        use std::string::ToString;
17959                        match value {
17960                            "name" => Ok(__FieldTag::__name),
17961                            "bucket" => Ok(__FieldTag::__bucket),
17962                            "etag" => Ok(__FieldTag::__etag),
17963                            "generation" => Ok(__FieldTag::__generation),
17964                            "restoreToken" => Ok(__FieldTag::__restore_token),
17965                            "restore_token" => Ok(__FieldTag::__restore_token),
17966                            "metageneration" => Ok(__FieldTag::__metageneration),
17967                            "storageClass" => Ok(__FieldTag::__storage_class),
17968                            "storage_class" => Ok(__FieldTag::__storage_class),
17969                            "size" => Ok(__FieldTag::__size),
17970                            "contentEncoding" => Ok(__FieldTag::__content_encoding),
17971                            "content_encoding" => Ok(__FieldTag::__content_encoding),
17972                            "contentDisposition" => Ok(__FieldTag::__content_disposition),
17973                            "content_disposition" => Ok(__FieldTag::__content_disposition),
17974                            "cacheControl" => Ok(__FieldTag::__cache_control),
17975                            "cache_control" => Ok(__FieldTag::__cache_control),
17976                            "acl" => Ok(__FieldTag::__acl),
17977                            "contentLanguage" => Ok(__FieldTag::__content_language),
17978                            "content_language" => Ok(__FieldTag::__content_language),
17979                            "deleteTime" => Ok(__FieldTag::__delete_time),
17980                            "delete_time" => Ok(__FieldTag::__delete_time),
17981                            "finalizeTime" => Ok(__FieldTag::__finalize_time),
17982                            "finalize_time" => Ok(__FieldTag::__finalize_time),
17983                            "contentType" => Ok(__FieldTag::__content_type),
17984                            "content_type" => Ok(__FieldTag::__content_type),
17985                            "createTime" => Ok(__FieldTag::__create_time),
17986                            "create_time" => Ok(__FieldTag::__create_time),
17987                            "componentCount" => Ok(__FieldTag::__component_count),
17988                            "component_count" => Ok(__FieldTag::__component_count),
17989                            "checksums" => Ok(__FieldTag::__checksums),
17990                            "updateTime" => Ok(__FieldTag::__update_time),
17991                            "update_time" => Ok(__FieldTag::__update_time),
17992                            "kmsKey" => Ok(__FieldTag::__kms_key),
17993                            "kms_key" => Ok(__FieldTag::__kms_key),
17994                            "updateStorageClassTime" => Ok(__FieldTag::__update_storage_class_time),
17995                            "update_storage_class_time" => {
17996                                Ok(__FieldTag::__update_storage_class_time)
17997                            }
17998                            "temporaryHold" => Ok(__FieldTag::__temporary_hold),
17999                            "temporary_hold" => Ok(__FieldTag::__temporary_hold),
18000                            "retentionExpireTime" => Ok(__FieldTag::__retention_expire_time),
18001                            "retention_expire_time" => Ok(__FieldTag::__retention_expire_time),
18002                            "metadata" => Ok(__FieldTag::__metadata),
18003                            "contexts" => Ok(__FieldTag::__contexts),
18004                            "eventBasedHold" => Ok(__FieldTag::__event_based_hold),
18005                            "event_based_hold" => Ok(__FieldTag::__event_based_hold),
18006                            "owner" => Ok(__FieldTag::__owner),
18007                            "customerEncryption" => Ok(__FieldTag::__customer_encryption),
18008                            "customer_encryption" => Ok(__FieldTag::__customer_encryption),
18009                            "customTime" => Ok(__FieldTag::__custom_time),
18010                            "custom_time" => Ok(__FieldTag::__custom_time),
18011                            "softDeleteTime" => Ok(__FieldTag::__soft_delete_time),
18012                            "soft_delete_time" => Ok(__FieldTag::__soft_delete_time),
18013                            "hardDeleteTime" => Ok(__FieldTag::__hard_delete_time),
18014                            "hard_delete_time" => Ok(__FieldTag::__hard_delete_time),
18015                            "retention" => Ok(__FieldTag::__retention),
18016                            _ => Ok(__FieldTag::Unknown(value.to_string())),
18017                        }
18018                    }
18019                }
18020                deserializer.deserialize_identifier(Visitor)
18021            }
18022        }
18023        struct Visitor;
18024        impl<'de> serde::de::Visitor<'de> for Visitor {
18025            type Value = Object;
18026            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
18027                formatter.write_str("struct Object")
18028            }
18029            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
18030            where
18031                A: serde::de::MapAccess<'de>,
18032            {
18033                #[allow(unused_imports)]
18034                use serde::de::Error;
18035                use std::option::Option::Some;
18036                let mut fields = std::collections::HashSet::new();
18037                let mut result = Self::Value::new();
18038                while let Some(tag) = map.next_key::<__FieldTag>()? {
18039                    #[allow(clippy::match_single_binding)]
18040                    match tag {
18041                        __FieldTag::__name => {
18042                            if !fields.insert(__FieldTag::__name) {
18043                                return std::result::Result::Err(A::Error::duplicate_field(
18044                                    "multiple values for name",
18045                                ));
18046                            }
18047                            result.name = map
18048                                .next_value::<std::option::Option<std::string::String>>()?
18049                                .unwrap_or_default();
18050                        }
18051                        __FieldTag::__bucket => {
18052                            if !fields.insert(__FieldTag::__bucket) {
18053                                return std::result::Result::Err(A::Error::duplicate_field(
18054                                    "multiple values for bucket",
18055                                ));
18056                            }
18057                            result.bucket = map
18058                                .next_value::<std::option::Option<std::string::String>>()?
18059                                .unwrap_or_default();
18060                        }
18061                        __FieldTag::__etag => {
18062                            if !fields.insert(__FieldTag::__etag) {
18063                                return std::result::Result::Err(A::Error::duplicate_field(
18064                                    "multiple values for etag",
18065                                ));
18066                            }
18067                            result.etag = map
18068                                .next_value::<std::option::Option<std::string::String>>()?
18069                                .unwrap_or_default();
18070                        }
18071                        __FieldTag::__generation => {
18072                            if !fields.insert(__FieldTag::__generation) {
18073                                return std::result::Result::Err(A::Error::duplicate_field(
18074                                    "multiple values for generation",
18075                                ));
18076                            }
18077                            struct __With(std::option::Option<i64>);
18078                            impl<'de> serde::de::Deserialize<'de> for __With {
18079                                fn deserialize<D>(
18080                                    deserializer: D,
18081                                ) -> std::result::Result<Self, D::Error>
18082                                where
18083                                    D: serde::de::Deserializer<'de>,
18084                                {
18085                                    serde_with::As::< std::option::Option<wkt::internal::I64> >::deserialize(deserializer).map(__With)
18086                                }
18087                            }
18088                            result.generation = map.next_value::<__With>()?.0.unwrap_or_default();
18089                        }
18090                        __FieldTag::__restore_token => {
18091                            if !fields.insert(__FieldTag::__restore_token) {
18092                                return std::result::Result::Err(A::Error::duplicate_field(
18093                                    "multiple values for restore_token",
18094                                ));
18095                            }
18096                            result.restore_token =
18097                                map.next_value::<std::option::Option<std::string::String>>()?;
18098                        }
18099                        __FieldTag::__metageneration => {
18100                            if !fields.insert(__FieldTag::__metageneration) {
18101                                return std::result::Result::Err(A::Error::duplicate_field(
18102                                    "multiple values for metageneration",
18103                                ));
18104                            }
18105                            struct __With(std::option::Option<i64>);
18106                            impl<'de> serde::de::Deserialize<'de> for __With {
18107                                fn deserialize<D>(
18108                                    deserializer: D,
18109                                ) -> std::result::Result<Self, D::Error>
18110                                where
18111                                    D: serde::de::Deserializer<'de>,
18112                                {
18113                                    serde_with::As::< std::option::Option<wkt::internal::I64> >::deserialize(deserializer).map(__With)
18114                                }
18115                            }
18116                            result.metageneration =
18117                                map.next_value::<__With>()?.0.unwrap_or_default();
18118                        }
18119                        __FieldTag::__storage_class => {
18120                            if !fields.insert(__FieldTag::__storage_class) {
18121                                return std::result::Result::Err(A::Error::duplicate_field(
18122                                    "multiple values for storage_class",
18123                                ));
18124                            }
18125                            result.storage_class = map
18126                                .next_value::<std::option::Option<std::string::String>>()?
18127                                .unwrap_or_default();
18128                        }
18129                        __FieldTag::__size => {
18130                            if !fields.insert(__FieldTag::__size) {
18131                                return std::result::Result::Err(A::Error::duplicate_field(
18132                                    "multiple values for size",
18133                                ));
18134                            }
18135                            struct __With(std::option::Option<i64>);
18136                            impl<'de> serde::de::Deserialize<'de> for __With {
18137                                fn deserialize<D>(
18138                                    deserializer: D,
18139                                ) -> std::result::Result<Self, D::Error>
18140                                where
18141                                    D: serde::de::Deserializer<'de>,
18142                                {
18143                                    serde_with::As::< std::option::Option<wkt::internal::I64> >::deserialize(deserializer).map(__With)
18144                                }
18145                            }
18146                            result.size = map.next_value::<__With>()?.0.unwrap_or_default();
18147                        }
18148                        __FieldTag::__content_encoding => {
18149                            if !fields.insert(__FieldTag::__content_encoding) {
18150                                return std::result::Result::Err(A::Error::duplicate_field(
18151                                    "multiple values for content_encoding",
18152                                ));
18153                            }
18154                            result.content_encoding = map
18155                                .next_value::<std::option::Option<std::string::String>>()?
18156                                .unwrap_or_default();
18157                        }
18158                        __FieldTag::__content_disposition => {
18159                            if !fields.insert(__FieldTag::__content_disposition) {
18160                                return std::result::Result::Err(A::Error::duplicate_field(
18161                                    "multiple values for content_disposition",
18162                                ));
18163                            }
18164                            result.content_disposition = map
18165                                .next_value::<std::option::Option<std::string::String>>()?
18166                                .unwrap_or_default();
18167                        }
18168                        __FieldTag::__cache_control => {
18169                            if !fields.insert(__FieldTag::__cache_control) {
18170                                return std::result::Result::Err(A::Error::duplicate_field(
18171                                    "multiple values for cache_control",
18172                                ));
18173                            }
18174                            result.cache_control = map
18175                                .next_value::<std::option::Option<std::string::String>>()?
18176                                .unwrap_or_default();
18177                        }
18178                        __FieldTag::__acl => {
18179                            if !fields.insert(__FieldTag::__acl) {
18180                                return std::result::Result::Err(A::Error::duplicate_field(
18181                                    "multiple values for acl",
18182                                ));
18183                            }
18184                            result.acl = map
18185                                .next_value::<std::option::Option<
18186                                    std::vec::Vec<crate::model::ObjectAccessControl>,
18187                                >>()?
18188                                .unwrap_or_default();
18189                        }
18190                        __FieldTag::__content_language => {
18191                            if !fields.insert(__FieldTag::__content_language) {
18192                                return std::result::Result::Err(A::Error::duplicate_field(
18193                                    "multiple values for content_language",
18194                                ));
18195                            }
18196                            result.content_language = map
18197                                .next_value::<std::option::Option<std::string::String>>()?
18198                                .unwrap_or_default();
18199                        }
18200                        __FieldTag::__delete_time => {
18201                            if !fields.insert(__FieldTag::__delete_time) {
18202                                return std::result::Result::Err(A::Error::duplicate_field(
18203                                    "multiple values for delete_time",
18204                                ));
18205                            }
18206                            result.delete_time =
18207                                map.next_value::<std::option::Option<wkt::Timestamp>>()?;
18208                        }
18209                        __FieldTag::__finalize_time => {
18210                            if !fields.insert(__FieldTag::__finalize_time) {
18211                                return std::result::Result::Err(A::Error::duplicate_field(
18212                                    "multiple values for finalize_time",
18213                                ));
18214                            }
18215                            result.finalize_time =
18216                                map.next_value::<std::option::Option<wkt::Timestamp>>()?;
18217                        }
18218                        __FieldTag::__content_type => {
18219                            if !fields.insert(__FieldTag::__content_type) {
18220                                return std::result::Result::Err(A::Error::duplicate_field(
18221                                    "multiple values for content_type",
18222                                ));
18223                            }
18224                            result.content_type = map
18225                                .next_value::<std::option::Option<std::string::String>>()?
18226                                .unwrap_or_default();
18227                        }
18228                        __FieldTag::__create_time => {
18229                            if !fields.insert(__FieldTag::__create_time) {
18230                                return std::result::Result::Err(A::Error::duplicate_field(
18231                                    "multiple values for create_time",
18232                                ));
18233                            }
18234                            result.create_time =
18235                                map.next_value::<std::option::Option<wkt::Timestamp>>()?;
18236                        }
18237                        __FieldTag::__component_count => {
18238                            if !fields.insert(__FieldTag::__component_count) {
18239                                return std::result::Result::Err(A::Error::duplicate_field(
18240                                    "multiple values for component_count",
18241                                ));
18242                            }
18243                            struct __With(std::option::Option<i32>);
18244                            impl<'de> serde::de::Deserialize<'de> for __With {
18245                                fn deserialize<D>(
18246                                    deserializer: D,
18247                                ) -> std::result::Result<Self, D::Error>
18248                                where
18249                                    D: serde::de::Deserializer<'de>,
18250                                {
18251                                    serde_with::As::< std::option::Option<wkt::internal::I32> >::deserialize(deserializer).map(__With)
18252                                }
18253                            }
18254                            result.component_count =
18255                                map.next_value::<__With>()?.0.unwrap_or_default();
18256                        }
18257                        __FieldTag::__checksums => {
18258                            if !fields.insert(__FieldTag::__checksums) {
18259                                return std::result::Result::Err(A::Error::duplicate_field(
18260                                    "multiple values for checksums",
18261                                ));
18262                            }
18263                            result.checksums = map
18264                                .next_value::<std::option::Option<crate::model::ObjectChecksums>>(
18265                                )?;
18266                        }
18267                        __FieldTag::__update_time => {
18268                            if !fields.insert(__FieldTag::__update_time) {
18269                                return std::result::Result::Err(A::Error::duplicate_field(
18270                                    "multiple values for update_time",
18271                                ));
18272                            }
18273                            result.update_time =
18274                                map.next_value::<std::option::Option<wkt::Timestamp>>()?;
18275                        }
18276                        __FieldTag::__kms_key => {
18277                            if !fields.insert(__FieldTag::__kms_key) {
18278                                return std::result::Result::Err(A::Error::duplicate_field(
18279                                    "multiple values for kms_key",
18280                                ));
18281                            }
18282                            result.kms_key = map
18283                                .next_value::<std::option::Option<std::string::String>>()?
18284                                .unwrap_or_default();
18285                        }
18286                        __FieldTag::__update_storage_class_time => {
18287                            if !fields.insert(__FieldTag::__update_storage_class_time) {
18288                                return std::result::Result::Err(A::Error::duplicate_field(
18289                                    "multiple values for update_storage_class_time",
18290                                ));
18291                            }
18292                            result.update_storage_class_time =
18293                                map.next_value::<std::option::Option<wkt::Timestamp>>()?;
18294                        }
18295                        __FieldTag::__temporary_hold => {
18296                            if !fields.insert(__FieldTag::__temporary_hold) {
18297                                return std::result::Result::Err(A::Error::duplicate_field(
18298                                    "multiple values for temporary_hold",
18299                                ));
18300                            }
18301                            result.temporary_hold = map
18302                                .next_value::<std::option::Option<bool>>()?
18303                                .unwrap_or_default();
18304                        }
18305                        __FieldTag::__retention_expire_time => {
18306                            if !fields.insert(__FieldTag::__retention_expire_time) {
18307                                return std::result::Result::Err(A::Error::duplicate_field(
18308                                    "multiple values for retention_expire_time",
18309                                ));
18310                            }
18311                            result.retention_expire_time =
18312                                map.next_value::<std::option::Option<wkt::Timestamp>>()?;
18313                        }
18314                        __FieldTag::__metadata => {
18315                            if !fields.insert(__FieldTag::__metadata) {
18316                                return std::result::Result::Err(A::Error::duplicate_field(
18317                                    "multiple values for metadata",
18318                                ));
18319                            }
18320                            result.metadata = map
18321                                .next_value::<std::option::Option<
18322                                    std::collections::HashMap<
18323                                        std::string::String,
18324                                        std::string::String,
18325                                    >,
18326                                >>()?
18327                                .unwrap_or_default();
18328                        }
18329                        __FieldTag::__contexts => {
18330                            if !fields.insert(__FieldTag::__contexts) {
18331                                return std::result::Result::Err(A::Error::duplicate_field(
18332                                    "multiple values for contexts",
18333                                ));
18334                            }
18335                            result.contexts = map
18336                                .next_value::<std::option::Option<crate::model::ObjectContexts>>(
18337                                )?;
18338                        }
18339                        __FieldTag::__event_based_hold => {
18340                            if !fields.insert(__FieldTag::__event_based_hold) {
18341                                return std::result::Result::Err(A::Error::duplicate_field(
18342                                    "multiple values for event_based_hold",
18343                                ));
18344                            }
18345                            result.event_based_hold =
18346                                map.next_value::<std::option::Option<bool>>()?;
18347                        }
18348                        __FieldTag::__owner => {
18349                            if !fields.insert(__FieldTag::__owner) {
18350                                return std::result::Result::Err(A::Error::duplicate_field(
18351                                    "multiple values for owner",
18352                                ));
18353                            }
18354                            result.owner =
18355                                map.next_value::<std::option::Option<crate::model::Owner>>()?;
18356                        }
18357                        __FieldTag::__customer_encryption => {
18358                            if !fields.insert(__FieldTag::__customer_encryption) {
18359                                return std::result::Result::Err(A::Error::duplicate_field(
18360                                    "multiple values for customer_encryption",
18361                                ));
18362                            }
18363                            result.customer_encryption = map.next_value::<std::option::Option<crate::model::CustomerEncryption>>()?
18364                                ;
18365                        }
18366                        __FieldTag::__custom_time => {
18367                            if !fields.insert(__FieldTag::__custom_time) {
18368                                return std::result::Result::Err(A::Error::duplicate_field(
18369                                    "multiple values for custom_time",
18370                                ));
18371                            }
18372                            result.custom_time =
18373                                map.next_value::<std::option::Option<wkt::Timestamp>>()?;
18374                        }
18375                        __FieldTag::__soft_delete_time => {
18376                            if !fields.insert(__FieldTag::__soft_delete_time) {
18377                                return std::result::Result::Err(A::Error::duplicate_field(
18378                                    "multiple values for soft_delete_time",
18379                                ));
18380                            }
18381                            result.soft_delete_time =
18382                                map.next_value::<std::option::Option<wkt::Timestamp>>()?;
18383                        }
18384                        __FieldTag::__hard_delete_time => {
18385                            if !fields.insert(__FieldTag::__hard_delete_time) {
18386                                return std::result::Result::Err(A::Error::duplicate_field(
18387                                    "multiple values for hard_delete_time",
18388                                ));
18389                            }
18390                            result.hard_delete_time =
18391                                map.next_value::<std::option::Option<wkt::Timestamp>>()?;
18392                        }
18393                        __FieldTag::__retention => {
18394                            if !fields.insert(__FieldTag::__retention) {
18395                                return std::result::Result::Err(A::Error::duplicate_field(
18396                                    "multiple values for retention",
18397                                ));
18398                            }
18399                            result.retention = map
18400                                .next_value::<std::option::Option<crate::model::object::Retention>>(
18401                                )?;
18402                        }
18403                        __FieldTag::Unknown(key) => {
18404                            let value = map.next_value::<serde_json::Value>()?;
18405                            result._unknown_fields.insert(key, value);
18406                        }
18407                    }
18408                }
18409                std::result::Result::Ok(result)
18410            }
18411        }
18412        deserializer.deserialize_any(Visitor)
18413    }
18414}
18415
18416#[doc(hidden)]
18417impl serde::ser::Serialize for Object {
18418    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
18419    where
18420        S: serde::ser::Serializer,
18421    {
18422        use serde::ser::SerializeMap;
18423        #[allow(unused_imports)]
18424        use std::option::Option::Some;
18425        let mut state = serializer.serialize_map(std::option::Option::None)?;
18426        if !self.name.is_empty() {
18427            state.serialize_entry("name", &self.name)?;
18428        }
18429        if !self.bucket.is_empty() {
18430            state.serialize_entry("bucket", &self.bucket)?;
18431        }
18432        if !self.etag.is_empty() {
18433            state.serialize_entry("etag", &self.etag)?;
18434        }
18435        if !wkt::internal::is_default(&self.generation) {
18436            struct __With<'a>(&'a i64);
18437            impl<'a> serde::ser::Serialize for __With<'a> {
18438                fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
18439                where
18440                    S: serde::ser::Serializer,
18441                {
18442                    serde_with::As::<wkt::internal::I64>::serialize(self.0, serializer)
18443                }
18444            }
18445            state.serialize_entry("generation", &__With(&self.generation))?;
18446        }
18447        if self.restore_token.is_some() {
18448            state.serialize_entry("restoreToken", &self.restore_token)?;
18449        }
18450        if !wkt::internal::is_default(&self.metageneration) {
18451            struct __With<'a>(&'a i64);
18452            impl<'a> serde::ser::Serialize for __With<'a> {
18453                fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
18454                where
18455                    S: serde::ser::Serializer,
18456                {
18457                    serde_with::As::<wkt::internal::I64>::serialize(self.0, serializer)
18458                }
18459            }
18460            state.serialize_entry("metageneration", &__With(&self.metageneration))?;
18461        }
18462        if !self.storage_class.is_empty() {
18463            state.serialize_entry("storageClass", &self.storage_class)?;
18464        }
18465        if !wkt::internal::is_default(&self.size) {
18466            struct __With<'a>(&'a i64);
18467            impl<'a> serde::ser::Serialize for __With<'a> {
18468                fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
18469                where
18470                    S: serde::ser::Serializer,
18471                {
18472                    serde_with::As::<wkt::internal::I64>::serialize(self.0, serializer)
18473                }
18474            }
18475            state.serialize_entry("size", &__With(&self.size))?;
18476        }
18477        if !self.content_encoding.is_empty() {
18478            state.serialize_entry("contentEncoding", &self.content_encoding)?;
18479        }
18480        if !self.content_disposition.is_empty() {
18481            state.serialize_entry("contentDisposition", &self.content_disposition)?;
18482        }
18483        if !self.cache_control.is_empty() {
18484            state.serialize_entry("cacheControl", &self.cache_control)?;
18485        }
18486        if !self.acl.is_empty() {
18487            state.serialize_entry("acl", &self.acl)?;
18488        }
18489        if !self.content_language.is_empty() {
18490            state.serialize_entry("contentLanguage", &self.content_language)?;
18491        }
18492        if self.delete_time.is_some() {
18493            state.serialize_entry("deleteTime", &self.delete_time)?;
18494        }
18495        if self.finalize_time.is_some() {
18496            state.serialize_entry("finalizeTime", &self.finalize_time)?;
18497        }
18498        if !self.content_type.is_empty() {
18499            state.serialize_entry("contentType", &self.content_type)?;
18500        }
18501        if self.create_time.is_some() {
18502            state.serialize_entry("createTime", &self.create_time)?;
18503        }
18504        if !wkt::internal::is_default(&self.component_count) {
18505            struct __With<'a>(&'a i32);
18506            impl<'a> serde::ser::Serialize for __With<'a> {
18507                fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
18508                where
18509                    S: serde::ser::Serializer,
18510                {
18511                    serde_with::As::<wkt::internal::I32>::serialize(self.0, serializer)
18512                }
18513            }
18514            state.serialize_entry("componentCount", &__With(&self.component_count))?;
18515        }
18516        if self.checksums.is_some() {
18517            state.serialize_entry("checksums", &self.checksums)?;
18518        }
18519        if self.update_time.is_some() {
18520            state.serialize_entry("updateTime", &self.update_time)?;
18521        }
18522        if !self.kms_key.is_empty() {
18523            state.serialize_entry("kmsKey", &self.kms_key)?;
18524        }
18525        if self.update_storage_class_time.is_some() {
18526            state.serialize_entry("updateStorageClassTime", &self.update_storage_class_time)?;
18527        }
18528        if !wkt::internal::is_default(&self.temporary_hold) {
18529            state.serialize_entry("temporaryHold", &self.temporary_hold)?;
18530        }
18531        if self.retention_expire_time.is_some() {
18532            state.serialize_entry("retentionExpireTime", &self.retention_expire_time)?;
18533        }
18534        if !self.metadata.is_empty() {
18535            state.serialize_entry("metadata", &self.metadata)?;
18536        }
18537        if self.contexts.is_some() {
18538            state.serialize_entry("contexts", &self.contexts)?;
18539        }
18540        if self.event_based_hold.is_some() {
18541            state.serialize_entry("eventBasedHold", &self.event_based_hold)?;
18542        }
18543        if self.owner.is_some() {
18544            state.serialize_entry("owner", &self.owner)?;
18545        }
18546        if self.customer_encryption.is_some() {
18547            state.serialize_entry("customerEncryption", &self.customer_encryption)?;
18548        }
18549        if self.custom_time.is_some() {
18550            state.serialize_entry("customTime", &self.custom_time)?;
18551        }
18552        if self.soft_delete_time.is_some() {
18553            state.serialize_entry("softDeleteTime", &self.soft_delete_time)?;
18554        }
18555        if self.hard_delete_time.is_some() {
18556            state.serialize_entry("hardDeleteTime", &self.hard_delete_time)?;
18557        }
18558        if self.retention.is_some() {
18559            state.serialize_entry("retention", &self.retention)?;
18560        }
18561        if !self._unknown_fields.is_empty() {
18562            for (key, value) in self._unknown_fields.iter() {
18563                state.serialize_entry(key, &value)?;
18564            }
18565        }
18566        state.end()
18567    }
18568}
18569
18570impl std::fmt::Debug for Object {
18571    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
18572        let mut debug_struct = f.debug_struct("Object");
18573        debug_struct.field("name", &self.name);
18574        debug_struct.field("bucket", &self.bucket);
18575        debug_struct.field("etag", &self.etag);
18576        debug_struct.field("generation", &self.generation);
18577        debug_struct.field("restore_token", &self.restore_token);
18578        debug_struct.field("metageneration", &self.metageneration);
18579        debug_struct.field("storage_class", &self.storage_class);
18580        debug_struct.field("size", &self.size);
18581        debug_struct.field("content_encoding", &self.content_encoding);
18582        debug_struct.field("content_disposition", &self.content_disposition);
18583        debug_struct.field("cache_control", &self.cache_control);
18584        debug_struct.field("acl", &self.acl);
18585        debug_struct.field("content_language", &self.content_language);
18586        debug_struct.field("delete_time", &self.delete_time);
18587        debug_struct.field("finalize_time", &self.finalize_time);
18588        debug_struct.field("content_type", &self.content_type);
18589        debug_struct.field("create_time", &self.create_time);
18590        debug_struct.field("component_count", &self.component_count);
18591        debug_struct.field("checksums", &self.checksums);
18592        debug_struct.field("update_time", &self.update_time);
18593        debug_struct.field("kms_key", &self.kms_key);
18594        debug_struct.field("update_storage_class_time", &self.update_storage_class_time);
18595        debug_struct.field("temporary_hold", &self.temporary_hold);
18596        debug_struct.field("retention_expire_time", &self.retention_expire_time);
18597        debug_struct.field("metadata", &self.metadata);
18598        debug_struct.field("contexts", &self.contexts);
18599        debug_struct.field("event_based_hold", &self.event_based_hold);
18600        debug_struct.field("owner", &self.owner);
18601        debug_struct.field("customer_encryption", &self.customer_encryption);
18602        debug_struct.field("custom_time", &self.custom_time);
18603        debug_struct.field("soft_delete_time", &self.soft_delete_time);
18604        debug_struct.field("hard_delete_time", &self.hard_delete_time);
18605        debug_struct.field("retention", &self.retention);
18606        if !self._unknown_fields.is_empty() {
18607            debug_struct.field("_unknown_fields", &self._unknown_fields);
18608        }
18609        debug_struct.finish()
18610    }
18611}
18612
18613/// Defines additional types related to [Object].
18614pub mod object {
18615    #[allow(unused_imports)]
18616    use super::*;
18617
18618    /// Specifies retention parameters of the object. Objects under retention
18619    /// cannot be deleted or overwritten until their retention expires.
18620    #[derive(Clone, Default, PartialEq)]
18621    #[non_exhaustive]
18622    pub struct Retention {
18623        /// Optional. The mode of the Retention.
18624        pub mode: crate::model::object::retention::Mode,
18625
18626        /// Optional. The timestamp that the object needs to be retained until.
18627        /// Value cannot be set in the past or more than 100 years in the future.
18628        pub retain_until_time: std::option::Option<wkt::Timestamp>,
18629
18630        _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
18631    }
18632
18633    impl Retention {
18634        pub fn new() -> Self {
18635            std::default::Default::default()
18636        }
18637
18638        /// Sets the value of [mode][crate::model::object::Retention::mode].
18639        pub fn set_mode<T: std::convert::Into<crate::model::object::retention::Mode>>(
18640            mut self,
18641            v: T,
18642        ) -> Self {
18643            self.mode = v.into();
18644            self
18645        }
18646
18647        /// Sets the value of [retain_until_time][crate::model::object::Retention::retain_until_time].
18648        pub fn set_retain_until_time<T>(mut self, v: T) -> Self
18649        where
18650            T: std::convert::Into<wkt::Timestamp>,
18651        {
18652            self.retain_until_time = std::option::Option::Some(v.into());
18653            self
18654        }
18655
18656        /// Sets or clears the value of [retain_until_time][crate::model::object::Retention::retain_until_time].
18657        pub fn set_or_clear_retain_until_time<T>(mut self, v: std::option::Option<T>) -> Self
18658        where
18659            T: std::convert::Into<wkt::Timestamp>,
18660        {
18661            self.retain_until_time = v.map(|x| x.into());
18662            self
18663        }
18664    }
18665
18666    impl wkt::message::Message for Retention {
18667        fn typename() -> &'static str {
18668            "type.googleapis.com/google.storage.v2.Object.Retention"
18669        }
18670    }
18671
18672    #[doc(hidden)]
18673    impl<'de> serde::de::Deserialize<'de> for Retention {
18674        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
18675        where
18676            D: serde::Deserializer<'de>,
18677        {
18678            #[allow(non_camel_case_types)]
18679            #[doc(hidden)]
18680            #[derive(PartialEq, Eq, Hash)]
18681            enum __FieldTag {
18682                __mode,
18683                __retain_until_time,
18684                Unknown(std::string::String),
18685            }
18686            impl<'de> serde::de::Deserialize<'de> for __FieldTag {
18687                fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
18688                where
18689                    D: serde::Deserializer<'de>,
18690                {
18691                    struct Visitor;
18692                    impl<'de> serde::de::Visitor<'de> for Visitor {
18693                        type Value = __FieldTag;
18694                        fn expecting(
18695                            &self,
18696                            formatter: &mut std::fmt::Formatter,
18697                        ) -> std::fmt::Result {
18698                            formatter.write_str("a field name for Retention")
18699                        }
18700                        fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
18701                        where
18702                            E: serde::de::Error,
18703                        {
18704                            use std::result::Result::Ok;
18705                            use std::string::ToString;
18706                            match value {
18707                                "mode" => Ok(__FieldTag::__mode),
18708                                "retainUntilTime" => Ok(__FieldTag::__retain_until_time),
18709                                "retain_until_time" => Ok(__FieldTag::__retain_until_time),
18710                                _ => Ok(__FieldTag::Unknown(value.to_string())),
18711                            }
18712                        }
18713                    }
18714                    deserializer.deserialize_identifier(Visitor)
18715                }
18716            }
18717            struct Visitor;
18718            impl<'de> serde::de::Visitor<'de> for Visitor {
18719                type Value = Retention;
18720                fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
18721                    formatter.write_str("struct Retention")
18722                }
18723                fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
18724                where
18725                    A: serde::de::MapAccess<'de>,
18726                {
18727                    #[allow(unused_imports)]
18728                    use serde::de::Error;
18729                    use std::option::Option::Some;
18730                    let mut fields = std::collections::HashSet::new();
18731                    let mut result = Self::Value::new();
18732                    while let Some(tag) = map.next_key::<__FieldTag>()? {
18733                        #[allow(clippy::match_single_binding)]
18734                        match tag {
18735                            __FieldTag::__mode => {
18736                                if !fields.insert(__FieldTag::__mode) {
18737                                    return std::result::Result::Err(A::Error::duplicate_field(
18738                                        "multiple values for mode",
18739                                    ));
18740                                }
18741                                result.mode = map.next_value::<std::option::Option<crate::model::object::retention::Mode>>()?.unwrap_or_default();
18742                            }
18743                            __FieldTag::__retain_until_time => {
18744                                if !fields.insert(__FieldTag::__retain_until_time) {
18745                                    return std::result::Result::Err(A::Error::duplicate_field(
18746                                        "multiple values for retain_until_time",
18747                                    ));
18748                                }
18749                                result.retain_until_time =
18750                                    map.next_value::<std::option::Option<wkt::Timestamp>>()?;
18751                            }
18752                            __FieldTag::Unknown(key) => {
18753                                let value = map.next_value::<serde_json::Value>()?;
18754                                result._unknown_fields.insert(key, value);
18755                            }
18756                        }
18757                    }
18758                    std::result::Result::Ok(result)
18759                }
18760            }
18761            deserializer.deserialize_any(Visitor)
18762        }
18763    }
18764
18765    #[doc(hidden)]
18766    impl serde::ser::Serialize for Retention {
18767        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
18768        where
18769            S: serde::ser::Serializer,
18770        {
18771            use serde::ser::SerializeMap;
18772            #[allow(unused_imports)]
18773            use std::option::Option::Some;
18774            let mut state = serializer.serialize_map(std::option::Option::None)?;
18775            if !wkt::internal::is_default(&self.mode) {
18776                state.serialize_entry("mode", &self.mode)?;
18777            }
18778            if self.retain_until_time.is_some() {
18779                state.serialize_entry("retainUntilTime", &self.retain_until_time)?;
18780            }
18781            if !self._unknown_fields.is_empty() {
18782                for (key, value) in self._unknown_fields.iter() {
18783                    state.serialize_entry(key, &value)?;
18784                }
18785            }
18786            state.end()
18787        }
18788    }
18789
18790    impl std::fmt::Debug for Retention {
18791        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
18792            let mut debug_struct = f.debug_struct("Retention");
18793            debug_struct.field("mode", &self.mode);
18794            debug_struct.field("retain_until_time", &self.retain_until_time);
18795            if !self._unknown_fields.is_empty() {
18796                debug_struct.field("_unknown_fields", &self._unknown_fields);
18797            }
18798            debug_struct.finish()
18799        }
18800    }
18801
18802    /// Defines additional types related to [Retention].
18803    pub mod retention {
18804        #[allow(unused_imports)]
18805        use super::*;
18806
18807        /// Retention mode values.
18808        ///
18809        /// # Working with unknown values
18810        ///
18811        /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
18812        /// additional enum variants at any time. Adding new variants is not considered
18813        /// a breaking change. Applications should write their code in anticipation of:
18814        ///
18815        /// - New values appearing in future releases of the client library, **and**
18816        /// - New values received dynamically, without application changes.
18817        ///
18818        /// Please consult the [Working with enums] section in the user guide for some
18819        /// guidelines.
18820        ///
18821        /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
18822        #[derive(Clone, Debug, PartialEq)]
18823        #[non_exhaustive]
18824        pub enum Mode {
18825            /// No specified mode. Object is not under retention.
18826            Unspecified,
18827            /// Retention period may be decreased or increased.
18828            /// The Retention configuration may be removed.
18829            /// The mode may be changed to locked.
18830            Unlocked,
18831            /// Retention period may be increased.
18832            /// The Retention configuration cannot be removed.
18833            /// The mode cannot be changed.
18834            Locked,
18835            /// If set, the enum was initialized with an unknown value.
18836            ///
18837            /// Applications can examine the value using [Mode::value] or
18838            /// [Mode::name].
18839            UnknownValue(mode::UnknownValue),
18840        }
18841
18842        #[doc(hidden)]
18843        pub mod mode {
18844            #[allow(unused_imports)]
18845            use super::*;
18846            #[derive(Clone, Debug, PartialEq)]
18847            pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
18848        }
18849
18850        impl Mode {
18851            /// Gets the enum value.
18852            ///
18853            /// Returns `None` if the enum contains an unknown value deserialized from
18854            /// the string representation of enums.
18855            pub fn value(&self) -> std::option::Option<i32> {
18856                match self {
18857                    Self::Unspecified => std::option::Option::Some(0),
18858                    Self::Unlocked => std::option::Option::Some(1),
18859                    Self::Locked => std::option::Option::Some(2),
18860                    Self::UnknownValue(u) => u.0.value(),
18861                }
18862            }
18863
18864            /// Gets the enum value as a string.
18865            ///
18866            /// Returns `None` if the enum contains an unknown value deserialized from
18867            /// the integer representation of enums.
18868            pub fn name(&self) -> std::option::Option<&str> {
18869                match self {
18870                    Self::Unspecified => std::option::Option::Some("MODE_UNSPECIFIED"),
18871                    Self::Unlocked => std::option::Option::Some("UNLOCKED"),
18872                    Self::Locked => std::option::Option::Some("LOCKED"),
18873                    Self::UnknownValue(u) => u.0.name(),
18874                }
18875            }
18876        }
18877
18878        impl std::default::Default for Mode {
18879            fn default() -> Self {
18880                use std::convert::From;
18881                Self::from(0)
18882            }
18883        }
18884
18885        impl std::fmt::Display for Mode {
18886            fn fmt(
18887                &self,
18888                f: &mut std::fmt::Formatter<'_>,
18889            ) -> std::result::Result<(), std::fmt::Error> {
18890                wkt::internal::display_enum(f, self.name(), self.value())
18891            }
18892        }
18893
18894        impl std::convert::From<i32> for Mode {
18895            fn from(value: i32) -> Self {
18896                match value {
18897                    0 => Self::Unspecified,
18898                    1 => Self::Unlocked,
18899                    2 => Self::Locked,
18900                    _ => Self::UnknownValue(mode::UnknownValue(
18901                        wkt::internal::UnknownEnumValue::Integer(value),
18902                    )),
18903                }
18904            }
18905        }
18906
18907        impl std::convert::From<&str> for Mode {
18908            fn from(value: &str) -> Self {
18909                use std::string::ToString;
18910                match value {
18911                    "MODE_UNSPECIFIED" => Self::Unspecified,
18912                    "UNLOCKED" => Self::Unlocked,
18913                    "LOCKED" => Self::Locked,
18914                    _ => Self::UnknownValue(mode::UnknownValue(
18915                        wkt::internal::UnknownEnumValue::String(value.to_string()),
18916                    )),
18917                }
18918            }
18919        }
18920
18921        impl serde::ser::Serialize for Mode {
18922            fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
18923            where
18924                S: serde::Serializer,
18925            {
18926                match self {
18927                    Self::Unspecified => serializer.serialize_i32(0),
18928                    Self::Unlocked => serializer.serialize_i32(1),
18929                    Self::Locked => serializer.serialize_i32(2),
18930                    Self::UnknownValue(u) => u.0.serialize(serializer),
18931                }
18932            }
18933        }
18934
18935        impl<'de> serde::de::Deserialize<'de> for Mode {
18936            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
18937            where
18938                D: serde::Deserializer<'de>,
18939            {
18940                deserializer.deserialize_any(wkt::internal::EnumVisitor::<Mode>::new(
18941                    ".google.storage.v2.Object.Retention.Mode",
18942                ))
18943            }
18944        }
18945    }
18946}
18947
18948/// An access-control entry.
18949#[derive(Clone, Default, PartialEq)]
18950#[non_exhaustive]
18951pub struct ObjectAccessControl {
18952    /// Optional. The access permission for the entity. One of the following
18953    /// values:
18954    ///
18955    /// * `READER`
18956    /// * `WRITER`
18957    /// * `OWNER`
18958    pub role: std::string::String,
18959
18960    /// Optional. The ID of the access-control entry.
18961    pub id: std::string::String,
18962
18963    /// Optional. The entity holding the permission, in one of the following forms:
18964    ///
18965    /// * `user-{userid}`
18966    /// * `user-{email}`
18967    /// * `group-{groupid}`
18968    /// * `group-{email}`
18969    /// * `domain-{domain}`
18970    /// * `project-{team}-{projectnumber}`
18971    /// * `project-{team}-{projectid}`
18972    /// * `allUsers`
18973    /// * `allAuthenticatedUsers`
18974    ///   Examples:
18975    /// * The user `liz@example.com` would be `user-liz@example.com`.
18976    /// * The group `example@googlegroups.com` would be
18977    ///   `group-example@googlegroups.com`.
18978    /// * All members of the Google Apps for Business domain `example.com` would be
18979    ///   `domain-example.com`.
18980    ///   For project entities, `project-{team}-{projectnumber}` format will be
18981    ///   returned on response.
18982    pub entity: std::string::String,
18983
18984    /// Output only. The alternative entity format, if exists. For project
18985    /// entities, `project-{team}-{projectid}` format will be returned on response.
18986    pub entity_alt: std::string::String,
18987
18988    /// Optional. The ID for the entity, if any.
18989    pub entity_id: std::string::String,
18990
18991    /// Optional. The etag of the ObjectAccessControl.
18992    /// If included in the metadata of an update or delete request message, the
18993    /// operation will only be performed if the etag matches that of the live
18994    /// object's ObjectAccessControl.
18995    pub etag: std::string::String,
18996
18997    /// Optional. The email address associated with the entity, if any.
18998    pub email: std::string::String,
18999
19000    /// Optional. The domain associated with the entity, if any.
19001    pub domain: std::string::String,
19002
19003    /// Optional. The project team associated with the entity, if any.
19004    pub project_team: std::option::Option<crate::model::ProjectTeam>,
19005
19006    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
19007}
19008
19009impl ObjectAccessControl {
19010    pub fn new() -> Self {
19011        std::default::Default::default()
19012    }
19013
19014    /// Sets the value of [role][crate::model::ObjectAccessControl::role].
19015    pub fn set_role<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
19016        self.role = v.into();
19017        self
19018    }
19019
19020    /// Sets the value of [id][crate::model::ObjectAccessControl::id].
19021    pub fn set_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
19022        self.id = v.into();
19023        self
19024    }
19025
19026    /// Sets the value of [entity][crate::model::ObjectAccessControl::entity].
19027    pub fn set_entity<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
19028        self.entity = v.into();
19029        self
19030    }
19031
19032    /// Sets the value of [entity_alt][crate::model::ObjectAccessControl::entity_alt].
19033    pub fn set_entity_alt<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
19034        self.entity_alt = v.into();
19035        self
19036    }
19037
19038    /// Sets the value of [entity_id][crate::model::ObjectAccessControl::entity_id].
19039    pub fn set_entity_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
19040        self.entity_id = v.into();
19041        self
19042    }
19043
19044    /// Sets the value of [etag][crate::model::ObjectAccessControl::etag].
19045    pub fn set_etag<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
19046        self.etag = v.into();
19047        self
19048    }
19049
19050    /// Sets the value of [email][crate::model::ObjectAccessControl::email].
19051    pub fn set_email<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
19052        self.email = v.into();
19053        self
19054    }
19055
19056    /// Sets the value of [domain][crate::model::ObjectAccessControl::domain].
19057    pub fn set_domain<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
19058        self.domain = v.into();
19059        self
19060    }
19061
19062    /// Sets the value of [project_team][crate::model::ObjectAccessControl::project_team].
19063    pub fn set_project_team<T>(mut self, v: T) -> Self
19064    where
19065        T: std::convert::Into<crate::model::ProjectTeam>,
19066    {
19067        self.project_team = std::option::Option::Some(v.into());
19068        self
19069    }
19070
19071    /// Sets or clears the value of [project_team][crate::model::ObjectAccessControl::project_team].
19072    pub fn set_or_clear_project_team<T>(mut self, v: std::option::Option<T>) -> Self
19073    where
19074        T: std::convert::Into<crate::model::ProjectTeam>,
19075    {
19076        self.project_team = v.map(|x| x.into());
19077        self
19078    }
19079}
19080
19081impl wkt::message::Message for ObjectAccessControl {
19082    fn typename() -> &'static str {
19083        "type.googleapis.com/google.storage.v2.ObjectAccessControl"
19084    }
19085}
19086
19087#[doc(hidden)]
19088impl<'de> serde::de::Deserialize<'de> for ObjectAccessControl {
19089    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
19090    where
19091        D: serde::Deserializer<'de>,
19092    {
19093        #[allow(non_camel_case_types)]
19094        #[doc(hidden)]
19095        #[derive(PartialEq, Eq, Hash)]
19096        enum __FieldTag {
19097            __role,
19098            __id,
19099            __entity,
19100            __entity_alt,
19101            __entity_id,
19102            __etag,
19103            __email,
19104            __domain,
19105            __project_team,
19106            Unknown(std::string::String),
19107        }
19108        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
19109            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
19110            where
19111                D: serde::Deserializer<'de>,
19112            {
19113                struct Visitor;
19114                impl<'de> serde::de::Visitor<'de> for Visitor {
19115                    type Value = __FieldTag;
19116                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
19117                        formatter.write_str("a field name for ObjectAccessControl")
19118                    }
19119                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
19120                    where
19121                        E: serde::de::Error,
19122                    {
19123                        use std::result::Result::Ok;
19124                        use std::string::ToString;
19125                        match value {
19126                            "role" => Ok(__FieldTag::__role),
19127                            "id" => Ok(__FieldTag::__id),
19128                            "entity" => Ok(__FieldTag::__entity),
19129                            "entityAlt" => Ok(__FieldTag::__entity_alt),
19130                            "entity_alt" => Ok(__FieldTag::__entity_alt),
19131                            "entityId" => Ok(__FieldTag::__entity_id),
19132                            "entity_id" => Ok(__FieldTag::__entity_id),
19133                            "etag" => Ok(__FieldTag::__etag),
19134                            "email" => Ok(__FieldTag::__email),
19135                            "domain" => Ok(__FieldTag::__domain),
19136                            "projectTeam" => Ok(__FieldTag::__project_team),
19137                            "project_team" => Ok(__FieldTag::__project_team),
19138                            _ => Ok(__FieldTag::Unknown(value.to_string())),
19139                        }
19140                    }
19141                }
19142                deserializer.deserialize_identifier(Visitor)
19143            }
19144        }
19145        struct Visitor;
19146        impl<'de> serde::de::Visitor<'de> for Visitor {
19147            type Value = ObjectAccessControl;
19148            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
19149                formatter.write_str("struct ObjectAccessControl")
19150            }
19151            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
19152            where
19153                A: serde::de::MapAccess<'de>,
19154            {
19155                #[allow(unused_imports)]
19156                use serde::de::Error;
19157                use std::option::Option::Some;
19158                let mut fields = std::collections::HashSet::new();
19159                let mut result = Self::Value::new();
19160                while let Some(tag) = map.next_key::<__FieldTag>()? {
19161                    #[allow(clippy::match_single_binding)]
19162                    match tag {
19163                        __FieldTag::__role => {
19164                            if !fields.insert(__FieldTag::__role) {
19165                                return std::result::Result::Err(A::Error::duplicate_field(
19166                                    "multiple values for role",
19167                                ));
19168                            }
19169                            result.role = map
19170                                .next_value::<std::option::Option<std::string::String>>()?
19171                                .unwrap_or_default();
19172                        }
19173                        __FieldTag::__id => {
19174                            if !fields.insert(__FieldTag::__id) {
19175                                return std::result::Result::Err(A::Error::duplicate_field(
19176                                    "multiple values for id",
19177                                ));
19178                            }
19179                            result.id = map
19180                                .next_value::<std::option::Option<std::string::String>>()?
19181                                .unwrap_or_default();
19182                        }
19183                        __FieldTag::__entity => {
19184                            if !fields.insert(__FieldTag::__entity) {
19185                                return std::result::Result::Err(A::Error::duplicate_field(
19186                                    "multiple values for entity",
19187                                ));
19188                            }
19189                            result.entity = map
19190                                .next_value::<std::option::Option<std::string::String>>()?
19191                                .unwrap_or_default();
19192                        }
19193                        __FieldTag::__entity_alt => {
19194                            if !fields.insert(__FieldTag::__entity_alt) {
19195                                return std::result::Result::Err(A::Error::duplicate_field(
19196                                    "multiple values for entity_alt",
19197                                ));
19198                            }
19199                            result.entity_alt = map
19200                                .next_value::<std::option::Option<std::string::String>>()?
19201                                .unwrap_or_default();
19202                        }
19203                        __FieldTag::__entity_id => {
19204                            if !fields.insert(__FieldTag::__entity_id) {
19205                                return std::result::Result::Err(A::Error::duplicate_field(
19206                                    "multiple values for entity_id",
19207                                ));
19208                            }
19209                            result.entity_id = map
19210                                .next_value::<std::option::Option<std::string::String>>()?
19211                                .unwrap_or_default();
19212                        }
19213                        __FieldTag::__etag => {
19214                            if !fields.insert(__FieldTag::__etag) {
19215                                return std::result::Result::Err(A::Error::duplicate_field(
19216                                    "multiple values for etag",
19217                                ));
19218                            }
19219                            result.etag = map
19220                                .next_value::<std::option::Option<std::string::String>>()?
19221                                .unwrap_or_default();
19222                        }
19223                        __FieldTag::__email => {
19224                            if !fields.insert(__FieldTag::__email) {
19225                                return std::result::Result::Err(A::Error::duplicate_field(
19226                                    "multiple values for email",
19227                                ));
19228                            }
19229                            result.email = map
19230                                .next_value::<std::option::Option<std::string::String>>()?
19231                                .unwrap_or_default();
19232                        }
19233                        __FieldTag::__domain => {
19234                            if !fields.insert(__FieldTag::__domain) {
19235                                return std::result::Result::Err(A::Error::duplicate_field(
19236                                    "multiple values for domain",
19237                                ));
19238                            }
19239                            result.domain = map
19240                                .next_value::<std::option::Option<std::string::String>>()?
19241                                .unwrap_or_default();
19242                        }
19243                        __FieldTag::__project_team => {
19244                            if !fields.insert(__FieldTag::__project_team) {
19245                                return std::result::Result::Err(A::Error::duplicate_field(
19246                                    "multiple values for project_team",
19247                                ));
19248                            }
19249                            result.project_team =
19250                                map.next_value::<std::option::Option<crate::model::ProjectTeam>>()?;
19251                        }
19252                        __FieldTag::Unknown(key) => {
19253                            let value = map.next_value::<serde_json::Value>()?;
19254                            result._unknown_fields.insert(key, value);
19255                        }
19256                    }
19257                }
19258                std::result::Result::Ok(result)
19259            }
19260        }
19261        deserializer.deserialize_any(Visitor)
19262    }
19263}
19264
19265#[doc(hidden)]
19266impl serde::ser::Serialize for ObjectAccessControl {
19267    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
19268    where
19269        S: serde::ser::Serializer,
19270    {
19271        use serde::ser::SerializeMap;
19272        #[allow(unused_imports)]
19273        use std::option::Option::Some;
19274        let mut state = serializer.serialize_map(std::option::Option::None)?;
19275        if !self.role.is_empty() {
19276            state.serialize_entry("role", &self.role)?;
19277        }
19278        if !self.id.is_empty() {
19279            state.serialize_entry("id", &self.id)?;
19280        }
19281        if !self.entity.is_empty() {
19282            state.serialize_entry("entity", &self.entity)?;
19283        }
19284        if !self.entity_alt.is_empty() {
19285            state.serialize_entry("entityAlt", &self.entity_alt)?;
19286        }
19287        if !self.entity_id.is_empty() {
19288            state.serialize_entry("entityId", &self.entity_id)?;
19289        }
19290        if !self.etag.is_empty() {
19291            state.serialize_entry("etag", &self.etag)?;
19292        }
19293        if !self.email.is_empty() {
19294            state.serialize_entry("email", &self.email)?;
19295        }
19296        if !self.domain.is_empty() {
19297            state.serialize_entry("domain", &self.domain)?;
19298        }
19299        if self.project_team.is_some() {
19300            state.serialize_entry("projectTeam", &self.project_team)?;
19301        }
19302        if !self._unknown_fields.is_empty() {
19303            for (key, value) in self._unknown_fields.iter() {
19304                state.serialize_entry(key, &value)?;
19305            }
19306        }
19307        state.end()
19308    }
19309}
19310
19311impl std::fmt::Debug for ObjectAccessControl {
19312    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
19313        let mut debug_struct = f.debug_struct("ObjectAccessControl");
19314        debug_struct.field("role", &self.role);
19315        debug_struct.field("id", &self.id);
19316        debug_struct.field("entity", &self.entity);
19317        debug_struct.field("entity_alt", &self.entity_alt);
19318        debug_struct.field("entity_id", &self.entity_id);
19319        debug_struct.field("etag", &self.etag);
19320        debug_struct.field("email", &self.email);
19321        debug_struct.field("domain", &self.domain);
19322        debug_struct.field("project_team", &self.project_team);
19323        if !self._unknown_fields.is_empty() {
19324            debug_struct.field("_unknown_fields", &self._unknown_fields);
19325        }
19326        debug_struct.finish()
19327    }
19328}
19329
19330/// The result of a call to Objects.ListObjects
19331#[derive(Clone, Default, PartialEq)]
19332#[non_exhaustive]
19333pub struct ListObjectsResponse {
19334    /// The list of items.
19335    pub objects: std::vec::Vec<crate::model::Object>,
19336
19337    /// The list of prefixes of objects matching-but-not-listed up to and including
19338    /// the requested delimiter.
19339    pub prefixes: std::vec::Vec<std::string::String>,
19340
19341    /// The continuation token, used to page through large result sets. Provide
19342    /// this value in a subsequent request to return the next page of results.
19343    pub next_page_token: std::string::String,
19344
19345    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
19346}
19347
19348impl ListObjectsResponse {
19349    pub fn new() -> Self {
19350        std::default::Default::default()
19351    }
19352
19353    /// Sets the value of [objects][crate::model::ListObjectsResponse::objects].
19354    pub fn set_objects<T, V>(mut self, v: T) -> Self
19355    where
19356        T: std::iter::IntoIterator<Item = V>,
19357        V: std::convert::Into<crate::model::Object>,
19358    {
19359        use std::iter::Iterator;
19360        self.objects = v.into_iter().map(|i| i.into()).collect();
19361        self
19362    }
19363
19364    /// Sets the value of [prefixes][crate::model::ListObjectsResponse::prefixes].
19365    pub fn set_prefixes<T, V>(mut self, v: T) -> Self
19366    where
19367        T: std::iter::IntoIterator<Item = V>,
19368        V: std::convert::Into<std::string::String>,
19369    {
19370        use std::iter::Iterator;
19371        self.prefixes = v.into_iter().map(|i| i.into()).collect();
19372        self
19373    }
19374
19375    /// Sets the value of [next_page_token][crate::model::ListObjectsResponse::next_page_token].
19376    pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
19377        self.next_page_token = v.into();
19378        self
19379    }
19380}
19381
19382impl wkt::message::Message for ListObjectsResponse {
19383    fn typename() -> &'static str {
19384        "type.googleapis.com/google.storage.v2.ListObjectsResponse"
19385    }
19386}
19387
19388#[doc(hidden)]
19389impl gax::paginator::internal::PageableResponse for ListObjectsResponse {
19390    type PageItem = crate::model::Object;
19391
19392    fn items(self) -> std::vec::Vec<Self::PageItem> {
19393        self.objects
19394    }
19395
19396    fn next_page_token(&self) -> std::string::String {
19397        use std::clone::Clone;
19398        self.next_page_token.clone()
19399    }
19400}
19401
19402#[doc(hidden)]
19403impl<'de> serde::de::Deserialize<'de> for ListObjectsResponse {
19404    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
19405    where
19406        D: serde::Deserializer<'de>,
19407    {
19408        #[allow(non_camel_case_types)]
19409        #[doc(hidden)]
19410        #[derive(PartialEq, Eq, Hash)]
19411        enum __FieldTag {
19412            __objects,
19413            __prefixes,
19414            __next_page_token,
19415            Unknown(std::string::String),
19416        }
19417        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
19418            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
19419            where
19420                D: serde::Deserializer<'de>,
19421            {
19422                struct Visitor;
19423                impl<'de> serde::de::Visitor<'de> for Visitor {
19424                    type Value = __FieldTag;
19425                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
19426                        formatter.write_str("a field name for ListObjectsResponse")
19427                    }
19428                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
19429                    where
19430                        E: serde::de::Error,
19431                    {
19432                        use std::result::Result::Ok;
19433                        use std::string::ToString;
19434                        match value {
19435                            "objects" => Ok(__FieldTag::__objects),
19436                            "prefixes" => Ok(__FieldTag::__prefixes),
19437                            "nextPageToken" => Ok(__FieldTag::__next_page_token),
19438                            "next_page_token" => Ok(__FieldTag::__next_page_token),
19439                            _ => Ok(__FieldTag::Unknown(value.to_string())),
19440                        }
19441                    }
19442                }
19443                deserializer.deserialize_identifier(Visitor)
19444            }
19445        }
19446        struct Visitor;
19447        impl<'de> serde::de::Visitor<'de> for Visitor {
19448            type Value = ListObjectsResponse;
19449            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
19450                formatter.write_str("struct ListObjectsResponse")
19451            }
19452            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
19453            where
19454                A: serde::de::MapAccess<'de>,
19455            {
19456                #[allow(unused_imports)]
19457                use serde::de::Error;
19458                use std::option::Option::Some;
19459                let mut fields = std::collections::HashSet::new();
19460                let mut result = Self::Value::new();
19461                while let Some(tag) = map.next_key::<__FieldTag>()? {
19462                    #[allow(clippy::match_single_binding)]
19463                    match tag {
19464                        __FieldTag::__objects => {
19465                            if !fields.insert(__FieldTag::__objects) {
19466                                return std::result::Result::Err(A::Error::duplicate_field(
19467                                    "multiple values for objects",
19468                                ));
19469                            }
19470                            result.objects = map.next_value::<std::option::Option<std::vec::Vec<crate::model::Object>>>()?.unwrap_or_default();
19471                        }
19472                        __FieldTag::__prefixes => {
19473                            if !fields.insert(__FieldTag::__prefixes) {
19474                                return std::result::Result::Err(A::Error::duplicate_field(
19475                                    "multiple values for prefixes",
19476                                ));
19477                            }
19478                            result.prefixes = map.next_value::<std::option::Option<std::vec::Vec<std::string::String>>>()?.unwrap_or_default();
19479                        }
19480                        __FieldTag::__next_page_token => {
19481                            if !fields.insert(__FieldTag::__next_page_token) {
19482                                return std::result::Result::Err(A::Error::duplicate_field(
19483                                    "multiple values for next_page_token",
19484                                ));
19485                            }
19486                            result.next_page_token = map
19487                                .next_value::<std::option::Option<std::string::String>>()?
19488                                .unwrap_or_default();
19489                        }
19490                        __FieldTag::Unknown(key) => {
19491                            let value = map.next_value::<serde_json::Value>()?;
19492                            result._unknown_fields.insert(key, value);
19493                        }
19494                    }
19495                }
19496                std::result::Result::Ok(result)
19497            }
19498        }
19499        deserializer.deserialize_any(Visitor)
19500    }
19501}
19502
19503#[doc(hidden)]
19504impl serde::ser::Serialize for ListObjectsResponse {
19505    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
19506    where
19507        S: serde::ser::Serializer,
19508    {
19509        use serde::ser::SerializeMap;
19510        #[allow(unused_imports)]
19511        use std::option::Option::Some;
19512        let mut state = serializer.serialize_map(std::option::Option::None)?;
19513        if !self.objects.is_empty() {
19514            state.serialize_entry("objects", &self.objects)?;
19515        }
19516        if !self.prefixes.is_empty() {
19517            state.serialize_entry("prefixes", &self.prefixes)?;
19518        }
19519        if !self.next_page_token.is_empty() {
19520            state.serialize_entry("nextPageToken", &self.next_page_token)?;
19521        }
19522        if !self._unknown_fields.is_empty() {
19523            for (key, value) in self._unknown_fields.iter() {
19524                state.serialize_entry(key, &value)?;
19525            }
19526        }
19527        state.end()
19528    }
19529}
19530
19531impl std::fmt::Debug for ListObjectsResponse {
19532    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
19533        let mut debug_struct = f.debug_struct("ListObjectsResponse");
19534        debug_struct.field("objects", &self.objects);
19535        debug_struct.field("prefixes", &self.prefixes);
19536        debug_struct.field("next_page_token", &self.next_page_token);
19537        if !self._unknown_fields.is_empty() {
19538            debug_struct.field("_unknown_fields", &self._unknown_fields);
19539        }
19540        debug_struct.finish()
19541    }
19542}
19543
19544/// Represents the Viewers, Editors, or Owners of a given project.
19545#[derive(Clone, Default, PartialEq)]
19546#[non_exhaustive]
19547pub struct ProjectTeam {
19548    /// Optional. The project number.
19549    pub project_number: std::string::String,
19550
19551    /// Optional. The team.
19552    pub team: std::string::String,
19553
19554    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
19555}
19556
19557impl ProjectTeam {
19558    pub fn new() -> Self {
19559        std::default::Default::default()
19560    }
19561
19562    /// Sets the value of [project_number][crate::model::ProjectTeam::project_number].
19563    pub fn set_project_number<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
19564        self.project_number = v.into();
19565        self
19566    }
19567
19568    /// Sets the value of [team][crate::model::ProjectTeam::team].
19569    pub fn set_team<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
19570        self.team = v.into();
19571        self
19572    }
19573}
19574
19575impl wkt::message::Message for ProjectTeam {
19576    fn typename() -> &'static str {
19577        "type.googleapis.com/google.storage.v2.ProjectTeam"
19578    }
19579}
19580
19581#[doc(hidden)]
19582impl<'de> serde::de::Deserialize<'de> for ProjectTeam {
19583    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
19584    where
19585        D: serde::Deserializer<'de>,
19586    {
19587        #[allow(non_camel_case_types)]
19588        #[doc(hidden)]
19589        #[derive(PartialEq, Eq, Hash)]
19590        enum __FieldTag {
19591            __project_number,
19592            __team,
19593            Unknown(std::string::String),
19594        }
19595        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
19596            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
19597            where
19598                D: serde::Deserializer<'de>,
19599            {
19600                struct Visitor;
19601                impl<'de> serde::de::Visitor<'de> for Visitor {
19602                    type Value = __FieldTag;
19603                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
19604                        formatter.write_str("a field name for ProjectTeam")
19605                    }
19606                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
19607                    where
19608                        E: serde::de::Error,
19609                    {
19610                        use std::result::Result::Ok;
19611                        use std::string::ToString;
19612                        match value {
19613                            "projectNumber" => Ok(__FieldTag::__project_number),
19614                            "project_number" => Ok(__FieldTag::__project_number),
19615                            "team" => Ok(__FieldTag::__team),
19616                            _ => Ok(__FieldTag::Unknown(value.to_string())),
19617                        }
19618                    }
19619                }
19620                deserializer.deserialize_identifier(Visitor)
19621            }
19622        }
19623        struct Visitor;
19624        impl<'de> serde::de::Visitor<'de> for Visitor {
19625            type Value = ProjectTeam;
19626            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
19627                formatter.write_str("struct ProjectTeam")
19628            }
19629            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
19630            where
19631                A: serde::de::MapAccess<'de>,
19632            {
19633                #[allow(unused_imports)]
19634                use serde::de::Error;
19635                use std::option::Option::Some;
19636                let mut fields = std::collections::HashSet::new();
19637                let mut result = Self::Value::new();
19638                while let Some(tag) = map.next_key::<__FieldTag>()? {
19639                    #[allow(clippy::match_single_binding)]
19640                    match tag {
19641                        __FieldTag::__project_number => {
19642                            if !fields.insert(__FieldTag::__project_number) {
19643                                return std::result::Result::Err(A::Error::duplicate_field(
19644                                    "multiple values for project_number",
19645                                ));
19646                            }
19647                            result.project_number = map
19648                                .next_value::<std::option::Option<std::string::String>>()?
19649                                .unwrap_or_default();
19650                        }
19651                        __FieldTag::__team => {
19652                            if !fields.insert(__FieldTag::__team) {
19653                                return std::result::Result::Err(A::Error::duplicate_field(
19654                                    "multiple values for team",
19655                                ));
19656                            }
19657                            result.team = map
19658                                .next_value::<std::option::Option<std::string::String>>()?
19659                                .unwrap_or_default();
19660                        }
19661                        __FieldTag::Unknown(key) => {
19662                            let value = map.next_value::<serde_json::Value>()?;
19663                            result._unknown_fields.insert(key, value);
19664                        }
19665                    }
19666                }
19667                std::result::Result::Ok(result)
19668            }
19669        }
19670        deserializer.deserialize_any(Visitor)
19671    }
19672}
19673
19674#[doc(hidden)]
19675impl serde::ser::Serialize for ProjectTeam {
19676    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
19677    where
19678        S: serde::ser::Serializer,
19679    {
19680        use serde::ser::SerializeMap;
19681        #[allow(unused_imports)]
19682        use std::option::Option::Some;
19683        let mut state = serializer.serialize_map(std::option::Option::None)?;
19684        if !self.project_number.is_empty() {
19685            state.serialize_entry("projectNumber", &self.project_number)?;
19686        }
19687        if !self.team.is_empty() {
19688            state.serialize_entry("team", &self.team)?;
19689        }
19690        if !self._unknown_fields.is_empty() {
19691            for (key, value) in self._unknown_fields.iter() {
19692                state.serialize_entry(key, &value)?;
19693            }
19694        }
19695        state.end()
19696    }
19697}
19698
19699impl std::fmt::Debug for ProjectTeam {
19700    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
19701        let mut debug_struct = f.debug_struct("ProjectTeam");
19702        debug_struct.field("project_number", &self.project_number);
19703        debug_struct.field("team", &self.team);
19704        if !self._unknown_fields.is_empty() {
19705            debug_struct.field("_unknown_fields", &self._unknown_fields);
19706        }
19707        debug_struct.finish()
19708    }
19709}
19710
19711/// The owner of a specific resource.
19712#[derive(Clone, Default, PartialEq)]
19713#[non_exhaustive]
19714pub struct Owner {
19715    /// Optional. The entity, in the form `user-`*userId*.
19716    pub entity: std::string::String,
19717
19718    /// Optional. The ID for the entity.
19719    pub entity_id: std::string::String,
19720
19721    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
19722}
19723
19724impl Owner {
19725    pub fn new() -> Self {
19726        std::default::Default::default()
19727    }
19728
19729    /// Sets the value of [entity][crate::model::Owner::entity].
19730    pub fn set_entity<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
19731        self.entity = v.into();
19732        self
19733    }
19734
19735    /// Sets the value of [entity_id][crate::model::Owner::entity_id].
19736    pub fn set_entity_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
19737        self.entity_id = v.into();
19738        self
19739    }
19740}
19741
19742impl wkt::message::Message for Owner {
19743    fn typename() -> &'static str {
19744        "type.googleapis.com/google.storage.v2.Owner"
19745    }
19746}
19747
19748#[doc(hidden)]
19749impl<'de> serde::de::Deserialize<'de> for Owner {
19750    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
19751    where
19752        D: serde::Deserializer<'de>,
19753    {
19754        #[allow(non_camel_case_types)]
19755        #[doc(hidden)]
19756        #[derive(PartialEq, Eq, Hash)]
19757        enum __FieldTag {
19758            __entity,
19759            __entity_id,
19760            Unknown(std::string::String),
19761        }
19762        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
19763            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
19764            where
19765                D: serde::Deserializer<'de>,
19766            {
19767                struct Visitor;
19768                impl<'de> serde::de::Visitor<'de> for Visitor {
19769                    type Value = __FieldTag;
19770                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
19771                        formatter.write_str("a field name for Owner")
19772                    }
19773                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
19774                    where
19775                        E: serde::de::Error,
19776                    {
19777                        use std::result::Result::Ok;
19778                        use std::string::ToString;
19779                        match value {
19780                            "entity" => Ok(__FieldTag::__entity),
19781                            "entityId" => Ok(__FieldTag::__entity_id),
19782                            "entity_id" => Ok(__FieldTag::__entity_id),
19783                            _ => Ok(__FieldTag::Unknown(value.to_string())),
19784                        }
19785                    }
19786                }
19787                deserializer.deserialize_identifier(Visitor)
19788            }
19789        }
19790        struct Visitor;
19791        impl<'de> serde::de::Visitor<'de> for Visitor {
19792            type Value = Owner;
19793            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
19794                formatter.write_str("struct Owner")
19795            }
19796            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
19797            where
19798                A: serde::de::MapAccess<'de>,
19799            {
19800                #[allow(unused_imports)]
19801                use serde::de::Error;
19802                use std::option::Option::Some;
19803                let mut fields = std::collections::HashSet::new();
19804                let mut result = Self::Value::new();
19805                while let Some(tag) = map.next_key::<__FieldTag>()? {
19806                    #[allow(clippy::match_single_binding)]
19807                    match tag {
19808                        __FieldTag::__entity => {
19809                            if !fields.insert(__FieldTag::__entity) {
19810                                return std::result::Result::Err(A::Error::duplicate_field(
19811                                    "multiple values for entity",
19812                                ));
19813                            }
19814                            result.entity = map
19815                                .next_value::<std::option::Option<std::string::String>>()?
19816                                .unwrap_or_default();
19817                        }
19818                        __FieldTag::__entity_id => {
19819                            if !fields.insert(__FieldTag::__entity_id) {
19820                                return std::result::Result::Err(A::Error::duplicate_field(
19821                                    "multiple values for entity_id",
19822                                ));
19823                            }
19824                            result.entity_id = map
19825                                .next_value::<std::option::Option<std::string::String>>()?
19826                                .unwrap_or_default();
19827                        }
19828                        __FieldTag::Unknown(key) => {
19829                            let value = map.next_value::<serde_json::Value>()?;
19830                            result._unknown_fields.insert(key, value);
19831                        }
19832                    }
19833                }
19834                std::result::Result::Ok(result)
19835            }
19836        }
19837        deserializer.deserialize_any(Visitor)
19838    }
19839}
19840
19841#[doc(hidden)]
19842impl serde::ser::Serialize for Owner {
19843    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
19844    where
19845        S: serde::ser::Serializer,
19846    {
19847        use serde::ser::SerializeMap;
19848        #[allow(unused_imports)]
19849        use std::option::Option::Some;
19850        let mut state = serializer.serialize_map(std::option::Option::None)?;
19851        if !self.entity.is_empty() {
19852            state.serialize_entry("entity", &self.entity)?;
19853        }
19854        if !self.entity_id.is_empty() {
19855            state.serialize_entry("entityId", &self.entity_id)?;
19856        }
19857        if !self._unknown_fields.is_empty() {
19858            for (key, value) in self._unknown_fields.iter() {
19859                state.serialize_entry(key, &value)?;
19860            }
19861        }
19862        state.end()
19863    }
19864}
19865
19866impl std::fmt::Debug for Owner {
19867    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
19868        let mut debug_struct = f.debug_struct("Owner");
19869        debug_struct.field("entity", &self.entity);
19870        debug_struct.field("entity_id", &self.entity_id);
19871        if !self._unknown_fields.is_empty() {
19872            debug_struct.field("_unknown_fields", &self._unknown_fields);
19873        }
19874        debug_struct.finish()
19875    }
19876}