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, Debug, 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
275/// Request message for GetBucket.
276#[derive(Clone, Debug, Default, PartialEq)]
277#[non_exhaustive]
278pub struct GetBucketRequest {
279    /// Required. Name of a bucket.
280    pub name: std::string::String,
281
282    /// If set, and if the bucket's current metageneration does not match the
283    /// specified value, the request will return an error.
284    pub if_metageneration_match: std::option::Option<i64>,
285
286    /// If set, and if the bucket's current metageneration matches the specified
287    /// value, the request will return an error.
288    pub if_metageneration_not_match: std::option::Option<i64>,
289
290    /// Mask specifying which fields to read.
291    /// A "*" field may be used to indicate all fields.
292    /// If no mask is specified, will default to all fields.
293    pub read_mask: std::option::Option<wkt::FieldMask>,
294
295    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
296}
297
298impl GetBucketRequest {
299    pub fn new() -> Self {
300        std::default::Default::default()
301    }
302
303    /// Sets the value of [name][crate::model::GetBucketRequest::name].
304    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
305        self.name = v.into();
306        self
307    }
308
309    /// Sets the value of [if_metageneration_match][crate::model::GetBucketRequest::if_metageneration_match].
310    pub fn set_if_metageneration_match<T>(mut self, v: T) -> Self
311    where
312        T: std::convert::Into<i64>,
313    {
314        self.if_metageneration_match = std::option::Option::Some(v.into());
315        self
316    }
317
318    /// Sets or clears the value of [if_metageneration_match][crate::model::GetBucketRequest::if_metageneration_match].
319    pub fn set_or_clear_if_metageneration_match<T>(mut self, v: std::option::Option<T>) -> Self
320    where
321        T: std::convert::Into<i64>,
322    {
323        self.if_metageneration_match = v.map(|x| x.into());
324        self
325    }
326
327    /// Sets the value of [if_metageneration_not_match][crate::model::GetBucketRequest::if_metageneration_not_match].
328    pub fn set_if_metageneration_not_match<T>(mut self, v: T) -> Self
329    where
330        T: std::convert::Into<i64>,
331    {
332        self.if_metageneration_not_match = std::option::Option::Some(v.into());
333        self
334    }
335
336    /// Sets or clears the value of [if_metageneration_not_match][crate::model::GetBucketRequest::if_metageneration_not_match].
337    pub fn set_or_clear_if_metageneration_not_match<T>(mut self, v: std::option::Option<T>) -> Self
338    where
339        T: std::convert::Into<i64>,
340    {
341        self.if_metageneration_not_match = v.map(|x| x.into());
342        self
343    }
344
345    /// Sets the value of [read_mask][crate::model::GetBucketRequest::read_mask].
346    pub fn set_read_mask<T>(mut self, v: T) -> Self
347    where
348        T: std::convert::Into<wkt::FieldMask>,
349    {
350        self.read_mask = std::option::Option::Some(v.into());
351        self
352    }
353
354    /// Sets or clears the value of [read_mask][crate::model::GetBucketRequest::read_mask].
355    pub fn set_or_clear_read_mask<T>(mut self, v: std::option::Option<T>) -> Self
356    where
357        T: std::convert::Into<wkt::FieldMask>,
358    {
359        self.read_mask = v.map(|x| x.into());
360        self
361    }
362}
363
364impl wkt::message::Message for GetBucketRequest {
365    fn typename() -> &'static str {
366        "type.googleapis.com/google.storage.v2.GetBucketRequest"
367    }
368}
369
370#[doc(hidden)]
371impl<'de> serde::de::Deserialize<'de> for GetBucketRequest {
372    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
373    where
374        D: serde::Deserializer<'de>,
375    {
376        #[allow(non_camel_case_types)]
377        #[doc(hidden)]
378        #[derive(PartialEq, Eq, Hash)]
379        enum __FieldTag {
380            __name,
381            __if_metageneration_match,
382            __if_metageneration_not_match,
383            __read_mask,
384            Unknown(std::string::String),
385        }
386        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
387            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
388            where
389                D: serde::Deserializer<'de>,
390            {
391                struct Visitor;
392                impl<'de> serde::de::Visitor<'de> for Visitor {
393                    type Value = __FieldTag;
394                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
395                        formatter.write_str("a field name for GetBucketRequest")
396                    }
397                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
398                    where
399                        E: serde::de::Error,
400                    {
401                        use std::result::Result::Ok;
402                        use std::string::ToString;
403                        match value {
404                            "name" => Ok(__FieldTag::__name),
405                            "ifMetagenerationMatch" => Ok(__FieldTag::__if_metageneration_match),
406                            "if_metageneration_match" => Ok(__FieldTag::__if_metageneration_match),
407                            "ifMetagenerationNotMatch" => {
408                                Ok(__FieldTag::__if_metageneration_not_match)
409                            }
410                            "if_metageneration_not_match" => {
411                                Ok(__FieldTag::__if_metageneration_not_match)
412                            }
413                            "readMask" => Ok(__FieldTag::__read_mask),
414                            "read_mask" => Ok(__FieldTag::__read_mask),
415                            _ => Ok(__FieldTag::Unknown(value.to_string())),
416                        }
417                    }
418                }
419                deserializer.deserialize_identifier(Visitor)
420            }
421        }
422        struct Visitor;
423        impl<'de> serde::de::Visitor<'de> for Visitor {
424            type Value = GetBucketRequest;
425            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
426                formatter.write_str("struct GetBucketRequest")
427            }
428            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
429            where
430                A: serde::de::MapAccess<'de>,
431            {
432                #[allow(unused_imports)]
433                use serde::de::Error;
434                use std::option::Option::Some;
435                let mut fields = std::collections::HashSet::new();
436                let mut result = Self::Value::new();
437                while let Some(tag) = map.next_key::<__FieldTag>()? {
438                    #[allow(clippy::match_single_binding)]
439                    match tag {
440                        __FieldTag::__name => {
441                            if !fields.insert(__FieldTag::__name) {
442                                return std::result::Result::Err(A::Error::duplicate_field(
443                                    "multiple values for name",
444                                ));
445                            }
446                            result.name = map
447                                .next_value::<std::option::Option<std::string::String>>()?
448                                .unwrap_or_default();
449                        }
450                        __FieldTag::__if_metageneration_match => {
451                            if !fields.insert(__FieldTag::__if_metageneration_match) {
452                                return std::result::Result::Err(A::Error::duplicate_field(
453                                    "multiple values for if_metageneration_match",
454                                ));
455                            }
456                            struct __With(std::option::Option<i64>);
457                            impl<'de> serde::de::Deserialize<'de> for __With {
458                                fn deserialize<D>(
459                                    deserializer: D,
460                                ) -> std::result::Result<Self, D::Error>
461                                where
462                                    D: serde::de::Deserializer<'de>,
463                                {
464                                    serde_with::As::< std::option::Option<wkt::internal::I64> >::deserialize(deserializer).map(__With)
465                                }
466                            }
467                            result.if_metageneration_match = map.next_value::<__With>()?.0;
468                        }
469                        __FieldTag::__if_metageneration_not_match => {
470                            if !fields.insert(__FieldTag::__if_metageneration_not_match) {
471                                return std::result::Result::Err(A::Error::duplicate_field(
472                                    "multiple values for if_metageneration_not_match",
473                                ));
474                            }
475                            struct __With(std::option::Option<i64>);
476                            impl<'de> serde::de::Deserialize<'de> for __With {
477                                fn deserialize<D>(
478                                    deserializer: D,
479                                ) -> std::result::Result<Self, D::Error>
480                                where
481                                    D: serde::de::Deserializer<'de>,
482                                {
483                                    serde_with::As::< std::option::Option<wkt::internal::I64> >::deserialize(deserializer).map(__With)
484                                }
485                            }
486                            result.if_metageneration_not_match = map.next_value::<__With>()?.0;
487                        }
488                        __FieldTag::__read_mask => {
489                            if !fields.insert(__FieldTag::__read_mask) {
490                                return std::result::Result::Err(A::Error::duplicate_field(
491                                    "multiple values for read_mask",
492                                ));
493                            }
494                            result.read_mask =
495                                map.next_value::<std::option::Option<wkt::FieldMask>>()?;
496                        }
497                        __FieldTag::Unknown(key) => {
498                            let value = map.next_value::<serde_json::Value>()?;
499                            result._unknown_fields.insert(key, value);
500                        }
501                    }
502                }
503                std::result::Result::Ok(result)
504            }
505        }
506        deserializer.deserialize_any(Visitor)
507    }
508}
509
510#[doc(hidden)]
511impl serde::ser::Serialize for GetBucketRequest {
512    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
513    where
514        S: serde::ser::Serializer,
515    {
516        use serde::ser::SerializeMap;
517        #[allow(unused_imports)]
518        use std::option::Option::Some;
519        let mut state = serializer.serialize_map(std::option::Option::None)?;
520        if !self.name.is_empty() {
521            state.serialize_entry("name", &self.name)?;
522        }
523        if self.if_metageneration_match.is_some() {
524            struct __With<'a>(&'a std::option::Option<i64>);
525            impl<'a> serde::ser::Serialize for __With<'a> {
526                fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
527                where
528                    S: serde::ser::Serializer,
529                {
530                    serde_with::As::<std::option::Option<wkt::internal::I64>>::serialize(
531                        self.0, serializer,
532                    )
533                }
534            }
535            state.serialize_entry(
536                "ifMetagenerationMatch",
537                &__With(&self.if_metageneration_match),
538            )?;
539        }
540        if self.if_metageneration_not_match.is_some() {
541            struct __With<'a>(&'a std::option::Option<i64>);
542            impl<'a> serde::ser::Serialize for __With<'a> {
543                fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
544                where
545                    S: serde::ser::Serializer,
546                {
547                    serde_with::As::<std::option::Option<wkt::internal::I64>>::serialize(
548                        self.0, serializer,
549                    )
550                }
551            }
552            state.serialize_entry(
553                "ifMetagenerationNotMatch",
554                &__With(&self.if_metageneration_not_match),
555            )?;
556        }
557        if self.read_mask.is_some() {
558            state.serialize_entry("readMask", &self.read_mask)?;
559        }
560        if !self._unknown_fields.is_empty() {
561            for (key, value) in self._unknown_fields.iter() {
562                state.serialize_entry(key, &value)?;
563            }
564        }
565        state.end()
566    }
567}
568
569/// Request message for CreateBucket.
570#[derive(Clone, Debug, Default, PartialEq)]
571#[non_exhaustive]
572pub struct CreateBucketRequest {
573    /// Required. The project to which this bucket will belong. This field must
574    /// either be empty or `projects/_`. The project ID that owns this bucket
575    /// should be specified in the `bucket.project` field.
576    pub parent: std::string::String,
577
578    /// Optional. Properties of the new bucket being inserted.
579    /// The name of the bucket is specified in the `bucket_id` field. Populating
580    /// `bucket.name` field will result in an error.
581    /// The project of the bucket must be specified in the `bucket.project` field.
582    /// This field must be in `projects/{projectIdentifier}` format,
583    /// {projectIdentifier} can be the project ID or project number. The `parent`
584    /// field must be either empty or `projects/_`.
585    pub bucket: std::option::Option<crate::model::Bucket>,
586
587    /// Required. The ID to use for this bucket, which will become the final
588    /// component of the bucket's resource name. For example, the value `foo` might
589    /// result in a bucket with the name `projects/123456/buckets/foo`.
590    pub bucket_id: std::string::String,
591
592    /// Optional. Apply a predefined set of access controls to this bucket.
593    /// Valid values are "authenticatedRead", "private", "projectPrivate",
594    /// "publicRead", or "publicReadWrite".
595    pub predefined_acl: std::string::String,
596
597    /// Optional. Apply a predefined set of default object access controls to this
598    /// bucket. Valid values are "authenticatedRead", "bucketOwnerFullControl",
599    /// "bucketOwnerRead", "private", "projectPrivate", or "publicRead".
600    pub predefined_default_object_acl: std::string::String,
601
602    /// Optional. If true, enable object retention on the bucket.
603    pub enable_object_retention: bool,
604
605    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
606}
607
608impl CreateBucketRequest {
609    pub fn new() -> Self {
610        std::default::Default::default()
611    }
612
613    /// Sets the value of [parent][crate::model::CreateBucketRequest::parent].
614    pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
615        self.parent = v.into();
616        self
617    }
618
619    /// Sets the value of [bucket][crate::model::CreateBucketRequest::bucket].
620    pub fn set_bucket<T>(mut self, v: T) -> Self
621    where
622        T: std::convert::Into<crate::model::Bucket>,
623    {
624        self.bucket = std::option::Option::Some(v.into());
625        self
626    }
627
628    /// Sets or clears the value of [bucket][crate::model::CreateBucketRequest::bucket].
629    pub fn set_or_clear_bucket<T>(mut self, v: std::option::Option<T>) -> Self
630    where
631        T: std::convert::Into<crate::model::Bucket>,
632    {
633        self.bucket = v.map(|x| x.into());
634        self
635    }
636
637    /// Sets the value of [bucket_id][crate::model::CreateBucketRequest::bucket_id].
638    pub fn set_bucket_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
639        self.bucket_id = v.into();
640        self
641    }
642
643    /// Sets the value of [predefined_acl][crate::model::CreateBucketRequest::predefined_acl].
644    pub fn set_predefined_acl<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
645        self.predefined_acl = v.into();
646        self
647    }
648
649    /// Sets the value of [predefined_default_object_acl][crate::model::CreateBucketRequest::predefined_default_object_acl].
650    pub fn set_predefined_default_object_acl<T: std::convert::Into<std::string::String>>(
651        mut self,
652        v: T,
653    ) -> Self {
654        self.predefined_default_object_acl = v.into();
655        self
656    }
657
658    /// Sets the value of [enable_object_retention][crate::model::CreateBucketRequest::enable_object_retention].
659    pub fn set_enable_object_retention<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
660        self.enable_object_retention = v.into();
661        self
662    }
663}
664
665impl wkt::message::Message for CreateBucketRequest {
666    fn typename() -> &'static str {
667        "type.googleapis.com/google.storage.v2.CreateBucketRequest"
668    }
669}
670
671#[doc(hidden)]
672impl<'de> serde::de::Deserialize<'de> for CreateBucketRequest {
673    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
674    where
675        D: serde::Deserializer<'de>,
676    {
677        #[allow(non_camel_case_types)]
678        #[doc(hidden)]
679        #[derive(PartialEq, Eq, Hash)]
680        enum __FieldTag {
681            __parent,
682            __bucket,
683            __bucket_id,
684            __predefined_acl,
685            __predefined_default_object_acl,
686            __enable_object_retention,
687            Unknown(std::string::String),
688        }
689        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
690            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
691            where
692                D: serde::Deserializer<'de>,
693            {
694                struct Visitor;
695                impl<'de> serde::de::Visitor<'de> for Visitor {
696                    type Value = __FieldTag;
697                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
698                        formatter.write_str("a field name for CreateBucketRequest")
699                    }
700                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
701                    where
702                        E: serde::de::Error,
703                    {
704                        use std::result::Result::Ok;
705                        use std::string::ToString;
706                        match value {
707                            "parent" => Ok(__FieldTag::__parent),
708                            "bucket" => Ok(__FieldTag::__bucket),
709                            "bucketId" => Ok(__FieldTag::__bucket_id),
710                            "bucket_id" => Ok(__FieldTag::__bucket_id),
711                            "predefinedAcl" => Ok(__FieldTag::__predefined_acl),
712                            "predefined_acl" => Ok(__FieldTag::__predefined_acl),
713                            "predefinedDefaultObjectAcl" => {
714                                Ok(__FieldTag::__predefined_default_object_acl)
715                            }
716                            "predefined_default_object_acl" => {
717                                Ok(__FieldTag::__predefined_default_object_acl)
718                            }
719                            "enableObjectRetention" => Ok(__FieldTag::__enable_object_retention),
720                            "enable_object_retention" => Ok(__FieldTag::__enable_object_retention),
721                            _ => Ok(__FieldTag::Unknown(value.to_string())),
722                        }
723                    }
724                }
725                deserializer.deserialize_identifier(Visitor)
726            }
727        }
728        struct Visitor;
729        impl<'de> serde::de::Visitor<'de> for Visitor {
730            type Value = CreateBucketRequest;
731            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
732                formatter.write_str("struct CreateBucketRequest")
733            }
734            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
735            where
736                A: serde::de::MapAccess<'de>,
737            {
738                #[allow(unused_imports)]
739                use serde::de::Error;
740                use std::option::Option::Some;
741                let mut fields = std::collections::HashSet::new();
742                let mut result = Self::Value::new();
743                while let Some(tag) = map.next_key::<__FieldTag>()? {
744                    #[allow(clippy::match_single_binding)]
745                    match tag {
746                        __FieldTag::__parent => {
747                            if !fields.insert(__FieldTag::__parent) {
748                                return std::result::Result::Err(A::Error::duplicate_field(
749                                    "multiple values for parent",
750                                ));
751                            }
752                            result.parent = map
753                                .next_value::<std::option::Option<std::string::String>>()?
754                                .unwrap_or_default();
755                        }
756                        __FieldTag::__bucket => {
757                            if !fields.insert(__FieldTag::__bucket) {
758                                return std::result::Result::Err(A::Error::duplicate_field(
759                                    "multiple values for bucket",
760                                ));
761                            }
762                            result.bucket =
763                                map.next_value::<std::option::Option<crate::model::Bucket>>()?;
764                        }
765                        __FieldTag::__bucket_id => {
766                            if !fields.insert(__FieldTag::__bucket_id) {
767                                return std::result::Result::Err(A::Error::duplicate_field(
768                                    "multiple values for bucket_id",
769                                ));
770                            }
771                            result.bucket_id = map
772                                .next_value::<std::option::Option<std::string::String>>()?
773                                .unwrap_or_default();
774                        }
775                        __FieldTag::__predefined_acl => {
776                            if !fields.insert(__FieldTag::__predefined_acl) {
777                                return std::result::Result::Err(A::Error::duplicate_field(
778                                    "multiple values for predefined_acl",
779                                ));
780                            }
781                            result.predefined_acl = map
782                                .next_value::<std::option::Option<std::string::String>>()?
783                                .unwrap_or_default();
784                        }
785                        __FieldTag::__predefined_default_object_acl => {
786                            if !fields.insert(__FieldTag::__predefined_default_object_acl) {
787                                return std::result::Result::Err(A::Error::duplicate_field(
788                                    "multiple values for predefined_default_object_acl",
789                                ));
790                            }
791                            result.predefined_default_object_acl = map
792                                .next_value::<std::option::Option<std::string::String>>()?
793                                .unwrap_or_default();
794                        }
795                        __FieldTag::__enable_object_retention => {
796                            if !fields.insert(__FieldTag::__enable_object_retention) {
797                                return std::result::Result::Err(A::Error::duplicate_field(
798                                    "multiple values for enable_object_retention",
799                                ));
800                            }
801                            result.enable_object_retention = map
802                                .next_value::<std::option::Option<bool>>()?
803                                .unwrap_or_default();
804                        }
805                        __FieldTag::Unknown(key) => {
806                            let value = map.next_value::<serde_json::Value>()?;
807                            result._unknown_fields.insert(key, value);
808                        }
809                    }
810                }
811                std::result::Result::Ok(result)
812            }
813        }
814        deserializer.deserialize_any(Visitor)
815    }
816}
817
818#[doc(hidden)]
819impl serde::ser::Serialize for CreateBucketRequest {
820    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
821    where
822        S: serde::ser::Serializer,
823    {
824        use serde::ser::SerializeMap;
825        #[allow(unused_imports)]
826        use std::option::Option::Some;
827        let mut state = serializer.serialize_map(std::option::Option::None)?;
828        if !self.parent.is_empty() {
829            state.serialize_entry("parent", &self.parent)?;
830        }
831        if self.bucket.is_some() {
832            state.serialize_entry("bucket", &self.bucket)?;
833        }
834        if !self.bucket_id.is_empty() {
835            state.serialize_entry("bucketId", &self.bucket_id)?;
836        }
837        if !self.predefined_acl.is_empty() {
838            state.serialize_entry("predefinedAcl", &self.predefined_acl)?;
839        }
840        if !self.predefined_default_object_acl.is_empty() {
841            state.serialize_entry(
842                "predefinedDefaultObjectAcl",
843                &self.predefined_default_object_acl,
844            )?;
845        }
846        if !wkt::internal::is_default(&self.enable_object_retention) {
847            state.serialize_entry("enableObjectRetention", &self.enable_object_retention)?;
848        }
849        if !self._unknown_fields.is_empty() {
850            for (key, value) in self._unknown_fields.iter() {
851                state.serialize_entry(key, &value)?;
852            }
853        }
854        state.end()
855    }
856}
857
858/// Request message for ListBuckets.
859#[derive(Clone, Debug, Default, PartialEq)]
860#[non_exhaustive]
861pub struct ListBucketsRequest {
862    /// Required. The project whose buckets we are listing.
863    pub parent: std::string::String,
864
865    /// Optional. Maximum number of buckets to return in a single response. The
866    /// service will use this parameter or 1,000 items, whichever is smaller. If
867    /// "acl" is present in the read_mask, the service will use this parameter of
868    /// 200 items, whichever is smaller.
869    pub page_size: i32,
870
871    /// Optional. A previously-returned page token representing part of the larger
872    /// set of results to view.
873    pub page_token: std::string::String,
874
875    /// Optional. Filter results to buckets whose names begin with this prefix.
876    pub prefix: std::string::String,
877
878    /// Mask specifying which fields to read from each result.
879    /// If no mask is specified, will default to all fields except items.owner,
880    /// items.acl, and items.default_object_acl.
881    ///
882    /// * may be used to mean "all fields".
883    pub read_mask: std::option::Option<wkt::FieldMask>,
884
885    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
886}
887
888impl ListBucketsRequest {
889    pub fn new() -> Self {
890        std::default::Default::default()
891    }
892
893    /// Sets the value of [parent][crate::model::ListBucketsRequest::parent].
894    pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
895        self.parent = v.into();
896        self
897    }
898
899    /// Sets the value of [page_size][crate::model::ListBucketsRequest::page_size].
900    pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
901        self.page_size = v.into();
902        self
903    }
904
905    /// Sets the value of [page_token][crate::model::ListBucketsRequest::page_token].
906    pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
907        self.page_token = v.into();
908        self
909    }
910
911    /// Sets the value of [prefix][crate::model::ListBucketsRequest::prefix].
912    pub fn set_prefix<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
913        self.prefix = v.into();
914        self
915    }
916
917    /// Sets the value of [read_mask][crate::model::ListBucketsRequest::read_mask].
918    pub fn set_read_mask<T>(mut self, v: T) -> Self
919    where
920        T: std::convert::Into<wkt::FieldMask>,
921    {
922        self.read_mask = std::option::Option::Some(v.into());
923        self
924    }
925
926    /// Sets or clears the value of [read_mask][crate::model::ListBucketsRequest::read_mask].
927    pub fn set_or_clear_read_mask<T>(mut self, v: std::option::Option<T>) -> Self
928    where
929        T: std::convert::Into<wkt::FieldMask>,
930    {
931        self.read_mask = v.map(|x| x.into());
932        self
933    }
934}
935
936impl wkt::message::Message for ListBucketsRequest {
937    fn typename() -> &'static str {
938        "type.googleapis.com/google.storage.v2.ListBucketsRequest"
939    }
940}
941
942#[doc(hidden)]
943impl<'de> serde::de::Deserialize<'de> for ListBucketsRequest {
944    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
945    where
946        D: serde::Deserializer<'de>,
947    {
948        #[allow(non_camel_case_types)]
949        #[doc(hidden)]
950        #[derive(PartialEq, Eq, Hash)]
951        enum __FieldTag {
952            __parent,
953            __page_size,
954            __page_token,
955            __prefix,
956            __read_mask,
957            Unknown(std::string::String),
958        }
959        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
960            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
961            where
962                D: serde::Deserializer<'de>,
963            {
964                struct Visitor;
965                impl<'de> serde::de::Visitor<'de> for Visitor {
966                    type Value = __FieldTag;
967                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
968                        formatter.write_str("a field name for ListBucketsRequest")
969                    }
970                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
971                    where
972                        E: serde::de::Error,
973                    {
974                        use std::result::Result::Ok;
975                        use std::string::ToString;
976                        match value {
977                            "parent" => Ok(__FieldTag::__parent),
978                            "pageSize" => Ok(__FieldTag::__page_size),
979                            "page_size" => Ok(__FieldTag::__page_size),
980                            "pageToken" => Ok(__FieldTag::__page_token),
981                            "page_token" => Ok(__FieldTag::__page_token),
982                            "prefix" => Ok(__FieldTag::__prefix),
983                            "readMask" => Ok(__FieldTag::__read_mask),
984                            "read_mask" => Ok(__FieldTag::__read_mask),
985                            _ => Ok(__FieldTag::Unknown(value.to_string())),
986                        }
987                    }
988                }
989                deserializer.deserialize_identifier(Visitor)
990            }
991        }
992        struct Visitor;
993        impl<'de> serde::de::Visitor<'de> for Visitor {
994            type Value = ListBucketsRequest;
995            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
996                formatter.write_str("struct ListBucketsRequest")
997            }
998            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
999            where
1000                A: serde::de::MapAccess<'de>,
1001            {
1002                #[allow(unused_imports)]
1003                use serde::de::Error;
1004                use std::option::Option::Some;
1005                let mut fields = std::collections::HashSet::new();
1006                let mut result = Self::Value::new();
1007                while let Some(tag) = map.next_key::<__FieldTag>()? {
1008                    #[allow(clippy::match_single_binding)]
1009                    match tag {
1010                        __FieldTag::__parent => {
1011                            if !fields.insert(__FieldTag::__parent) {
1012                                return std::result::Result::Err(A::Error::duplicate_field(
1013                                    "multiple values for parent",
1014                                ));
1015                            }
1016                            result.parent = map
1017                                .next_value::<std::option::Option<std::string::String>>()?
1018                                .unwrap_or_default();
1019                        }
1020                        __FieldTag::__page_size => {
1021                            if !fields.insert(__FieldTag::__page_size) {
1022                                return std::result::Result::Err(A::Error::duplicate_field(
1023                                    "multiple values for page_size",
1024                                ));
1025                            }
1026                            struct __With(std::option::Option<i32>);
1027                            impl<'de> serde::de::Deserialize<'de> for __With {
1028                                fn deserialize<D>(
1029                                    deserializer: D,
1030                                ) -> std::result::Result<Self, D::Error>
1031                                where
1032                                    D: serde::de::Deserializer<'de>,
1033                                {
1034                                    serde_with::As::< std::option::Option<wkt::internal::I32> >::deserialize(deserializer).map(__With)
1035                                }
1036                            }
1037                            result.page_size = map.next_value::<__With>()?.0.unwrap_or_default();
1038                        }
1039                        __FieldTag::__page_token => {
1040                            if !fields.insert(__FieldTag::__page_token) {
1041                                return std::result::Result::Err(A::Error::duplicate_field(
1042                                    "multiple values for page_token",
1043                                ));
1044                            }
1045                            result.page_token = map
1046                                .next_value::<std::option::Option<std::string::String>>()?
1047                                .unwrap_or_default();
1048                        }
1049                        __FieldTag::__prefix => {
1050                            if !fields.insert(__FieldTag::__prefix) {
1051                                return std::result::Result::Err(A::Error::duplicate_field(
1052                                    "multiple values for prefix",
1053                                ));
1054                            }
1055                            result.prefix = map
1056                                .next_value::<std::option::Option<std::string::String>>()?
1057                                .unwrap_or_default();
1058                        }
1059                        __FieldTag::__read_mask => {
1060                            if !fields.insert(__FieldTag::__read_mask) {
1061                                return std::result::Result::Err(A::Error::duplicate_field(
1062                                    "multiple values for read_mask",
1063                                ));
1064                            }
1065                            result.read_mask =
1066                                map.next_value::<std::option::Option<wkt::FieldMask>>()?;
1067                        }
1068                        __FieldTag::Unknown(key) => {
1069                            let value = map.next_value::<serde_json::Value>()?;
1070                            result._unknown_fields.insert(key, value);
1071                        }
1072                    }
1073                }
1074                std::result::Result::Ok(result)
1075            }
1076        }
1077        deserializer.deserialize_any(Visitor)
1078    }
1079}
1080
1081#[doc(hidden)]
1082impl serde::ser::Serialize for ListBucketsRequest {
1083    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
1084    where
1085        S: serde::ser::Serializer,
1086    {
1087        use serde::ser::SerializeMap;
1088        #[allow(unused_imports)]
1089        use std::option::Option::Some;
1090        let mut state = serializer.serialize_map(std::option::Option::None)?;
1091        if !self.parent.is_empty() {
1092            state.serialize_entry("parent", &self.parent)?;
1093        }
1094        if !wkt::internal::is_default(&self.page_size) {
1095            struct __With<'a>(&'a i32);
1096            impl<'a> serde::ser::Serialize for __With<'a> {
1097                fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
1098                where
1099                    S: serde::ser::Serializer,
1100                {
1101                    serde_with::As::<wkt::internal::I32>::serialize(self.0, serializer)
1102                }
1103            }
1104            state.serialize_entry("pageSize", &__With(&self.page_size))?;
1105        }
1106        if !self.page_token.is_empty() {
1107            state.serialize_entry("pageToken", &self.page_token)?;
1108        }
1109        if !self.prefix.is_empty() {
1110            state.serialize_entry("prefix", &self.prefix)?;
1111        }
1112        if self.read_mask.is_some() {
1113            state.serialize_entry("readMask", &self.read_mask)?;
1114        }
1115        if !self._unknown_fields.is_empty() {
1116            for (key, value) in self._unknown_fields.iter() {
1117                state.serialize_entry(key, &value)?;
1118            }
1119        }
1120        state.end()
1121    }
1122}
1123
1124/// The result of a call to Buckets.ListBuckets
1125#[derive(Clone, Debug, Default, PartialEq)]
1126#[non_exhaustive]
1127pub struct ListBucketsResponse {
1128    /// The list of items.
1129    pub buckets: std::vec::Vec<crate::model::Bucket>,
1130
1131    /// The continuation token, used to page through large result sets. Provide
1132    /// this value in a subsequent request to return the next page of results.
1133    pub next_page_token: std::string::String,
1134
1135    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1136}
1137
1138impl ListBucketsResponse {
1139    pub fn new() -> Self {
1140        std::default::Default::default()
1141    }
1142
1143    /// Sets the value of [buckets][crate::model::ListBucketsResponse::buckets].
1144    pub fn set_buckets<T, V>(mut self, v: T) -> Self
1145    where
1146        T: std::iter::IntoIterator<Item = V>,
1147        V: std::convert::Into<crate::model::Bucket>,
1148    {
1149        use std::iter::Iterator;
1150        self.buckets = v.into_iter().map(|i| i.into()).collect();
1151        self
1152    }
1153
1154    /// Sets the value of [next_page_token][crate::model::ListBucketsResponse::next_page_token].
1155    pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1156        self.next_page_token = v.into();
1157        self
1158    }
1159}
1160
1161impl wkt::message::Message for ListBucketsResponse {
1162    fn typename() -> &'static str {
1163        "type.googleapis.com/google.storage.v2.ListBucketsResponse"
1164    }
1165}
1166
1167#[doc(hidden)]
1168impl gax::paginator::internal::PageableResponse for ListBucketsResponse {
1169    type PageItem = crate::model::Bucket;
1170
1171    fn items(self) -> std::vec::Vec<Self::PageItem> {
1172        self.buckets
1173    }
1174
1175    fn next_page_token(&self) -> std::string::String {
1176        use std::clone::Clone;
1177        self.next_page_token.clone()
1178    }
1179}
1180
1181#[doc(hidden)]
1182impl<'de> serde::de::Deserialize<'de> for ListBucketsResponse {
1183    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
1184    where
1185        D: serde::Deserializer<'de>,
1186    {
1187        #[allow(non_camel_case_types)]
1188        #[doc(hidden)]
1189        #[derive(PartialEq, Eq, Hash)]
1190        enum __FieldTag {
1191            __buckets,
1192            __next_page_token,
1193            Unknown(std::string::String),
1194        }
1195        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
1196            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
1197            where
1198                D: serde::Deserializer<'de>,
1199            {
1200                struct Visitor;
1201                impl<'de> serde::de::Visitor<'de> for Visitor {
1202                    type Value = __FieldTag;
1203                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
1204                        formatter.write_str("a field name for ListBucketsResponse")
1205                    }
1206                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
1207                    where
1208                        E: serde::de::Error,
1209                    {
1210                        use std::result::Result::Ok;
1211                        use std::string::ToString;
1212                        match value {
1213                            "buckets" => Ok(__FieldTag::__buckets),
1214                            "nextPageToken" => Ok(__FieldTag::__next_page_token),
1215                            "next_page_token" => Ok(__FieldTag::__next_page_token),
1216                            _ => Ok(__FieldTag::Unknown(value.to_string())),
1217                        }
1218                    }
1219                }
1220                deserializer.deserialize_identifier(Visitor)
1221            }
1222        }
1223        struct Visitor;
1224        impl<'de> serde::de::Visitor<'de> for Visitor {
1225            type Value = ListBucketsResponse;
1226            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
1227                formatter.write_str("struct ListBucketsResponse")
1228            }
1229            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
1230            where
1231                A: serde::de::MapAccess<'de>,
1232            {
1233                #[allow(unused_imports)]
1234                use serde::de::Error;
1235                use std::option::Option::Some;
1236                let mut fields = std::collections::HashSet::new();
1237                let mut result = Self::Value::new();
1238                while let Some(tag) = map.next_key::<__FieldTag>()? {
1239                    #[allow(clippy::match_single_binding)]
1240                    match tag {
1241                        __FieldTag::__buckets => {
1242                            if !fields.insert(__FieldTag::__buckets) {
1243                                return std::result::Result::Err(A::Error::duplicate_field(
1244                                    "multiple values for buckets",
1245                                ));
1246                            }
1247                            result.buckets = map.next_value::<std::option::Option<std::vec::Vec<crate::model::Bucket>>>()?.unwrap_or_default();
1248                        }
1249                        __FieldTag::__next_page_token => {
1250                            if !fields.insert(__FieldTag::__next_page_token) {
1251                                return std::result::Result::Err(A::Error::duplicate_field(
1252                                    "multiple values for next_page_token",
1253                                ));
1254                            }
1255                            result.next_page_token = map
1256                                .next_value::<std::option::Option<std::string::String>>()?
1257                                .unwrap_or_default();
1258                        }
1259                        __FieldTag::Unknown(key) => {
1260                            let value = map.next_value::<serde_json::Value>()?;
1261                            result._unknown_fields.insert(key, value);
1262                        }
1263                    }
1264                }
1265                std::result::Result::Ok(result)
1266            }
1267        }
1268        deserializer.deserialize_any(Visitor)
1269    }
1270}
1271
1272#[doc(hidden)]
1273impl serde::ser::Serialize for ListBucketsResponse {
1274    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
1275    where
1276        S: serde::ser::Serializer,
1277    {
1278        use serde::ser::SerializeMap;
1279        #[allow(unused_imports)]
1280        use std::option::Option::Some;
1281        let mut state = serializer.serialize_map(std::option::Option::None)?;
1282        if !self.buckets.is_empty() {
1283            state.serialize_entry("buckets", &self.buckets)?;
1284        }
1285        if !self.next_page_token.is_empty() {
1286            state.serialize_entry("nextPageToken", &self.next_page_token)?;
1287        }
1288        if !self._unknown_fields.is_empty() {
1289            for (key, value) in self._unknown_fields.iter() {
1290                state.serialize_entry(key, &value)?;
1291            }
1292        }
1293        state.end()
1294    }
1295}
1296
1297/// Request message for LockBucketRetentionPolicyRequest.
1298#[derive(Clone, Debug, Default, PartialEq)]
1299#[non_exhaustive]
1300pub struct LockBucketRetentionPolicyRequest {
1301    /// Required. Name of a bucket.
1302    pub bucket: std::string::String,
1303
1304    /// Required. Makes the operation conditional on whether bucket's current
1305    /// metageneration matches the given value. Must be positive.
1306    pub if_metageneration_match: i64,
1307
1308    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1309}
1310
1311impl LockBucketRetentionPolicyRequest {
1312    pub fn new() -> Self {
1313        std::default::Default::default()
1314    }
1315
1316    /// Sets the value of [bucket][crate::model::LockBucketRetentionPolicyRequest::bucket].
1317    pub fn set_bucket<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1318        self.bucket = v.into();
1319        self
1320    }
1321
1322    /// Sets the value of [if_metageneration_match][crate::model::LockBucketRetentionPolicyRequest::if_metageneration_match].
1323    pub fn set_if_metageneration_match<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
1324        self.if_metageneration_match = v.into();
1325        self
1326    }
1327}
1328
1329impl wkt::message::Message for LockBucketRetentionPolicyRequest {
1330    fn typename() -> &'static str {
1331        "type.googleapis.com/google.storage.v2.LockBucketRetentionPolicyRequest"
1332    }
1333}
1334
1335#[doc(hidden)]
1336impl<'de> serde::de::Deserialize<'de> for LockBucketRetentionPolicyRequest {
1337    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
1338    where
1339        D: serde::Deserializer<'de>,
1340    {
1341        #[allow(non_camel_case_types)]
1342        #[doc(hidden)]
1343        #[derive(PartialEq, Eq, Hash)]
1344        enum __FieldTag {
1345            __bucket,
1346            __if_metageneration_match,
1347            Unknown(std::string::String),
1348        }
1349        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
1350            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
1351            where
1352                D: serde::Deserializer<'de>,
1353            {
1354                struct Visitor;
1355                impl<'de> serde::de::Visitor<'de> for Visitor {
1356                    type Value = __FieldTag;
1357                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
1358                        formatter.write_str("a field name for LockBucketRetentionPolicyRequest")
1359                    }
1360                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
1361                    where
1362                        E: serde::de::Error,
1363                    {
1364                        use std::result::Result::Ok;
1365                        use std::string::ToString;
1366                        match value {
1367                            "bucket" => Ok(__FieldTag::__bucket),
1368                            "ifMetagenerationMatch" => Ok(__FieldTag::__if_metageneration_match),
1369                            "if_metageneration_match" => Ok(__FieldTag::__if_metageneration_match),
1370                            _ => Ok(__FieldTag::Unknown(value.to_string())),
1371                        }
1372                    }
1373                }
1374                deserializer.deserialize_identifier(Visitor)
1375            }
1376        }
1377        struct Visitor;
1378        impl<'de> serde::de::Visitor<'de> for Visitor {
1379            type Value = LockBucketRetentionPolicyRequest;
1380            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
1381                formatter.write_str("struct LockBucketRetentionPolicyRequest")
1382            }
1383            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
1384            where
1385                A: serde::de::MapAccess<'de>,
1386            {
1387                #[allow(unused_imports)]
1388                use serde::de::Error;
1389                use std::option::Option::Some;
1390                let mut fields = std::collections::HashSet::new();
1391                let mut result = Self::Value::new();
1392                while let Some(tag) = map.next_key::<__FieldTag>()? {
1393                    #[allow(clippy::match_single_binding)]
1394                    match tag {
1395                        __FieldTag::__bucket => {
1396                            if !fields.insert(__FieldTag::__bucket) {
1397                                return std::result::Result::Err(A::Error::duplicate_field(
1398                                    "multiple values for bucket",
1399                                ));
1400                            }
1401                            result.bucket = map
1402                                .next_value::<std::option::Option<std::string::String>>()?
1403                                .unwrap_or_default();
1404                        }
1405                        __FieldTag::__if_metageneration_match => {
1406                            if !fields.insert(__FieldTag::__if_metageneration_match) {
1407                                return std::result::Result::Err(A::Error::duplicate_field(
1408                                    "multiple values for if_metageneration_match",
1409                                ));
1410                            }
1411                            struct __With(std::option::Option<i64>);
1412                            impl<'de> serde::de::Deserialize<'de> for __With {
1413                                fn deserialize<D>(
1414                                    deserializer: D,
1415                                ) -> std::result::Result<Self, D::Error>
1416                                where
1417                                    D: serde::de::Deserializer<'de>,
1418                                {
1419                                    serde_with::As::< std::option::Option<wkt::internal::I64> >::deserialize(deserializer).map(__With)
1420                                }
1421                            }
1422                            result.if_metageneration_match =
1423                                map.next_value::<__With>()?.0.unwrap_or_default();
1424                        }
1425                        __FieldTag::Unknown(key) => {
1426                            let value = map.next_value::<serde_json::Value>()?;
1427                            result._unknown_fields.insert(key, value);
1428                        }
1429                    }
1430                }
1431                std::result::Result::Ok(result)
1432            }
1433        }
1434        deserializer.deserialize_any(Visitor)
1435    }
1436}
1437
1438#[doc(hidden)]
1439impl serde::ser::Serialize for LockBucketRetentionPolicyRequest {
1440    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
1441    where
1442        S: serde::ser::Serializer,
1443    {
1444        use serde::ser::SerializeMap;
1445        #[allow(unused_imports)]
1446        use std::option::Option::Some;
1447        let mut state = serializer.serialize_map(std::option::Option::None)?;
1448        if !self.bucket.is_empty() {
1449            state.serialize_entry("bucket", &self.bucket)?;
1450        }
1451        if !wkt::internal::is_default(&self.if_metageneration_match) {
1452            struct __With<'a>(&'a i64);
1453            impl<'a> serde::ser::Serialize for __With<'a> {
1454                fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
1455                where
1456                    S: serde::ser::Serializer,
1457                {
1458                    serde_with::As::<wkt::internal::I64>::serialize(self.0, serializer)
1459                }
1460            }
1461            state.serialize_entry(
1462                "ifMetagenerationMatch",
1463                &__With(&self.if_metageneration_match),
1464            )?;
1465        }
1466        if !self._unknown_fields.is_empty() {
1467            for (key, value) in self._unknown_fields.iter() {
1468                state.serialize_entry(key, &value)?;
1469            }
1470        }
1471        state.end()
1472    }
1473}
1474
1475/// Request for UpdateBucket method.
1476#[derive(Clone, Debug, Default, PartialEq)]
1477#[non_exhaustive]
1478pub struct UpdateBucketRequest {
1479    /// Required. The bucket to update.
1480    /// The bucket's `name` field will be used to identify the bucket.
1481    pub bucket: std::option::Option<crate::model::Bucket>,
1482
1483    /// If set, will only modify the bucket if its metageneration matches this
1484    /// value.
1485    pub if_metageneration_match: std::option::Option<i64>,
1486
1487    /// If set, will only modify the bucket if its metageneration does not match
1488    /// this value.
1489    pub if_metageneration_not_match: std::option::Option<i64>,
1490
1491    /// Optional. Apply a predefined set of access controls to this bucket.
1492    /// Valid values are "authenticatedRead", "private", "projectPrivate",
1493    /// "publicRead", or "publicReadWrite".
1494    pub predefined_acl: std::string::String,
1495
1496    /// Optional. Apply a predefined set of default object access controls to this
1497    /// bucket. Valid values are "authenticatedRead", "bucketOwnerFullControl",
1498    /// "bucketOwnerRead", "private", "projectPrivate", or "publicRead".
1499    pub predefined_default_object_acl: std::string::String,
1500
1501    /// Required. List of fields to be updated.
1502    ///
1503    /// To specify ALL fields, equivalent to the JSON API's "update" function,
1504    /// specify a single field with the value `*`. Note: not recommended. If a new
1505    /// field is introduced at a later time, an older client updating with the `*`
1506    /// may accidentally reset the new field's value.
1507    ///
1508    /// Not specifying any fields is an error.
1509    pub update_mask: std::option::Option<wkt::FieldMask>,
1510
1511    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1512}
1513
1514impl UpdateBucketRequest {
1515    pub fn new() -> Self {
1516        std::default::Default::default()
1517    }
1518
1519    /// Sets the value of [bucket][crate::model::UpdateBucketRequest::bucket].
1520    pub fn set_bucket<T>(mut self, v: T) -> Self
1521    where
1522        T: std::convert::Into<crate::model::Bucket>,
1523    {
1524        self.bucket = std::option::Option::Some(v.into());
1525        self
1526    }
1527
1528    /// Sets or clears the value of [bucket][crate::model::UpdateBucketRequest::bucket].
1529    pub fn set_or_clear_bucket<T>(mut self, v: std::option::Option<T>) -> Self
1530    where
1531        T: std::convert::Into<crate::model::Bucket>,
1532    {
1533        self.bucket = v.map(|x| x.into());
1534        self
1535    }
1536
1537    /// Sets the value of [if_metageneration_match][crate::model::UpdateBucketRequest::if_metageneration_match].
1538    pub fn set_if_metageneration_match<T>(mut self, v: T) -> Self
1539    where
1540        T: std::convert::Into<i64>,
1541    {
1542        self.if_metageneration_match = std::option::Option::Some(v.into());
1543        self
1544    }
1545
1546    /// Sets or clears the value of [if_metageneration_match][crate::model::UpdateBucketRequest::if_metageneration_match].
1547    pub fn set_or_clear_if_metageneration_match<T>(mut self, v: std::option::Option<T>) -> Self
1548    where
1549        T: std::convert::Into<i64>,
1550    {
1551        self.if_metageneration_match = v.map(|x| x.into());
1552        self
1553    }
1554
1555    /// Sets the value of [if_metageneration_not_match][crate::model::UpdateBucketRequest::if_metageneration_not_match].
1556    pub fn set_if_metageneration_not_match<T>(mut self, v: T) -> Self
1557    where
1558        T: std::convert::Into<i64>,
1559    {
1560        self.if_metageneration_not_match = std::option::Option::Some(v.into());
1561        self
1562    }
1563
1564    /// Sets or clears the value of [if_metageneration_not_match][crate::model::UpdateBucketRequest::if_metageneration_not_match].
1565    pub fn set_or_clear_if_metageneration_not_match<T>(mut self, v: std::option::Option<T>) -> Self
1566    where
1567        T: std::convert::Into<i64>,
1568    {
1569        self.if_metageneration_not_match = v.map(|x| x.into());
1570        self
1571    }
1572
1573    /// Sets the value of [predefined_acl][crate::model::UpdateBucketRequest::predefined_acl].
1574    pub fn set_predefined_acl<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1575        self.predefined_acl = v.into();
1576        self
1577    }
1578
1579    /// Sets the value of [predefined_default_object_acl][crate::model::UpdateBucketRequest::predefined_default_object_acl].
1580    pub fn set_predefined_default_object_acl<T: std::convert::Into<std::string::String>>(
1581        mut self,
1582        v: T,
1583    ) -> Self {
1584        self.predefined_default_object_acl = v.into();
1585        self
1586    }
1587
1588    /// Sets the value of [update_mask][crate::model::UpdateBucketRequest::update_mask].
1589    pub fn set_update_mask<T>(mut self, v: T) -> Self
1590    where
1591        T: std::convert::Into<wkt::FieldMask>,
1592    {
1593        self.update_mask = std::option::Option::Some(v.into());
1594        self
1595    }
1596
1597    /// Sets or clears the value of [update_mask][crate::model::UpdateBucketRequest::update_mask].
1598    pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
1599    where
1600        T: std::convert::Into<wkt::FieldMask>,
1601    {
1602        self.update_mask = v.map(|x| x.into());
1603        self
1604    }
1605}
1606
1607impl wkt::message::Message for UpdateBucketRequest {
1608    fn typename() -> &'static str {
1609        "type.googleapis.com/google.storage.v2.UpdateBucketRequest"
1610    }
1611}
1612
1613#[doc(hidden)]
1614impl<'de> serde::de::Deserialize<'de> for UpdateBucketRequest {
1615    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
1616    where
1617        D: serde::Deserializer<'de>,
1618    {
1619        #[allow(non_camel_case_types)]
1620        #[doc(hidden)]
1621        #[derive(PartialEq, Eq, Hash)]
1622        enum __FieldTag {
1623            __bucket,
1624            __if_metageneration_match,
1625            __if_metageneration_not_match,
1626            __predefined_acl,
1627            __predefined_default_object_acl,
1628            __update_mask,
1629            Unknown(std::string::String),
1630        }
1631        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
1632            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
1633            where
1634                D: serde::Deserializer<'de>,
1635            {
1636                struct Visitor;
1637                impl<'de> serde::de::Visitor<'de> for Visitor {
1638                    type Value = __FieldTag;
1639                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
1640                        formatter.write_str("a field name for UpdateBucketRequest")
1641                    }
1642                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
1643                    where
1644                        E: serde::de::Error,
1645                    {
1646                        use std::result::Result::Ok;
1647                        use std::string::ToString;
1648                        match value {
1649                            "bucket" => Ok(__FieldTag::__bucket),
1650                            "ifMetagenerationMatch" => Ok(__FieldTag::__if_metageneration_match),
1651                            "if_metageneration_match" => Ok(__FieldTag::__if_metageneration_match),
1652                            "ifMetagenerationNotMatch" => {
1653                                Ok(__FieldTag::__if_metageneration_not_match)
1654                            }
1655                            "if_metageneration_not_match" => {
1656                                Ok(__FieldTag::__if_metageneration_not_match)
1657                            }
1658                            "predefinedAcl" => Ok(__FieldTag::__predefined_acl),
1659                            "predefined_acl" => Ok(__FieldTag::__predefined_acl),
1660                            "predefinedDefaultObjectAcl" => {
1661                                Ok(__FieldTag::__predefined_default_object_acl)
1662                            }
1663                            "predefined_default_object_acl" => {
1664                                Ok(__FieldTag::__predefined_default_object_acl)
1665                            }
1666                            "updateMask" => Ok(__FieldTag::__update_mask),
1667                            "update_mask" => Ok(__FieldTag::__update_mask),
1668                            _ => Ok(__FieldTag::Unknown(value.to_string())),
1669                        }
1670                    }
1671                }
1672                deserializer.deserialize_identifier(Visitor)
1673            }
1674        }
1675        struct Visitor;
1676        impl<'de> serde::de::Visitor<'de> for Visitor {
1677            type Value = UpdateBucketRequest;
1678            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
1679                formatter.write_str("struct UpdateBucketRequest")
1680            }
1681            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
1682            where
1683                A: serde::de::MapAccess<'de>,
1684            {
1685                #[allow(unused_imports)]
1686                use serde::de::Error;
1687                use std::option::Option::Some;
1688                let mut fields = std::collections::HashSet::new();
1689                let mut result = Self::Value::new();
1690                while let Some(tag) = map.next_key::<__FieldTag>()? {
1691                    #[allow(clippy::match_single_binding)]
1692                    match tag {
1693                        __FieldTag::__bucket => {
1694                            if !fields.insert(__FieldTag::__bucket) {
1695                                return std::result::Result::Err(A::Error::duplicate_field(
1696                                    "multiple values for bucket",
1697                                ));
1698                            }
1699                            result.bucket =
1700                                map.next_value::<std::option::Option<crate::model::Bucket>>()?;
1701                        }
1702                        __FieldTag::__if_metageneration_match => {
1703                            if !fields.insert(__FieldTag::__if_metageneration_match) {
1704                                return std::result::Result::Err(A::Error::duplicate_field(
1705                                    "multiple values for if_metageneration_match",
1706                                ));
1707                            }
1708                            struct __With(std::option::Option<i64>);
1709                            impl<'de> serde::de::Deserialize<'de> for __With {
1710                                fn deserialize<D>(
1711                                    deserializer: D,
1712                                ) -> std::result::Result<Self, D::Error>
1713                                where
1714                                    D: serde::de::Deserializer<'de>,
1715                                {
1716                                    serde_with::As::< std::option::Option<wkt::internal::I64> >::deserialize(deserializer).map(__With)
1717                                }
1718                            }
1719                            result.if_metageneration_match = map.next_value::<__With>()?.0;
1720                        }
1721                        __FieldTag::__if_metageneration_not_match => {
1722                            if !fields.insert(__FieldTag::__if_metageneration_not_match) {
1723                                return std::result::Result::Err(A::Error::duplicate_field(
1724                                    "multiple values for if_metageneration_not_match",
1725                                ));
1726                            }
1727                            struct __With(std::option::Option<i64>);
1728                            impl<'de> serde::de::Deserialize<'de> for __With {
1729                                fn deserialize<D>(
1730                                    deserializer: D,
1731                                ) -> std::result::Result<Self, D::Error>
1732                                where
1733                                    D: serde::de::Deserializer<'de>,
1734                                {
1735                                    serde_with::As::< std::option::Option<wkt::internal::I64> >::deserialize(deserializer).map(__With)
1736                                }
1737                            }
1738                            result.if_metageneration_not_match = map.next_value::<__With>()?.0;
1739                        }
1740                        __FieldTag::__predefined_acl => {
1741                            if !fields.insert(__FieldTag::__predefined_acl) {
1742                                return std::result::Result::Err(A::Error::duplicate_field(
1743                                    "multiple values for predefined_acl",
1744                                ));
1745                            }
1746                            result.predefined_acl = map
1747                                .next_value::<std::option::Option<std::string::String>>()?
1748                                .unwrap_or_default();
1749                        }
1750                        __FieldTag::__predefined_default_object_acl => {
1751                            if !fields.insert(__FieldTag::__predefined_default_object_acl) {
1752                                return std::result::Result::Err(A::Error::duplicate_field(
1753                                    "multiple values for predefined_default_object_acl",
1754                                ));
1755                            }
1756                            result.predefined_default_object_acl = map
1757                                .next_value::<std::option::Option<std::string::String>>()?
1758                                .unwrap_or_default();
1759                        }
1760                        __FieldTag::__update_mask => {
1761                            if !fields.insert(__FieldTag::__update_mask) {
1762                                return std::result::Result::Err(A::Error::duplicate_field(
1763                                    "multiple values for update_mask",
1764                                ));
1765                            }
1766                            result.update_mask =
1767                                map.next_value::<std::option::Option<wkt::FieldMask>>()?;
1768                        }
1769                        __FieldTag::Unknown(key) => {
1770                            let value = map.next_value::<serde_json::Value>()?;
1771                            result._unknown_fields.insert(key, value);
1772                        }
1773                    }
1774                }
1775                std::result::Result::Ok(result)
1776            }
1777        }
1778        deserializer.deserialize_any(Visitor)
1779    }
1780}
1781
1782#[doc(hidden)]
1783impl serde::ser::Serialize for UpdateBucketRequest {
1784    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
1785    where
1786        S: serde::ser::Serializer,
1787    {
1788        use serde::ser::SerializeMap;
1789        #[allow(unused_imports)]
1790        use std::option::Option::Some;
1791        let mut state = serializer.serialize_map(std::option::Option::None)?;
1792        if self.bucket.is_some() {
1793            state.serialize_entry("bucket", &self.bucket)?;
1794        }
1795        if self.if_metageneration_match.is_some() {
1796            struct __With<'a>(&'a std::option::Option<i64>);
1797            impl<'a> serde::ser::Serialize for __With<'a> {
1798                fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
1799                where
1800                    S: serde::ser::Serializer,
1801                {
1802                    serde_with::As::<std::option::Option<wkt::internal::I64>>::serialize(
1803                        self.0, serializer,
1804                    )
1805                }
1806            }
1807            state.serialize_entry(
1808                "ifMetagenerationMatch",
1809                &__With(&self.if_metageneration_match),
1810            )?;
1811        }
1812        if self.if_metageneration_not_match.is_some() {
1813            struct __With<'a>(&'a std::option::Option<i64>);
1814            impl<'a> serde::ser::Serialize for __With<'a> {
1815                fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
1816                where
1817                    S: serde::ser::Serializer,
1818                {
1819                    serde_with::As::<std::option::Option<wkt::internal::I64>>::serialize(
1820                        self.0, serializer,
1821                    )
1822                }
1823            }
1824            state.serialize_entry(
1825                "ifMetagenerationNotMatch",
1826                &__With(&self.if_metageneration_not_match),
1827            )?;
1828        }
1829        if !self.predefined_acl.is_empty() {
1830            state.serialize_entry("predefinedAcl", &self.predefined_acl)?;
1831        }
1832        if !self.predefined_default_object_acl.is_empty() {
1833            state.serialize_entry(
1834                "predefinedDefaultObjectAcl",
1835                &self.predefined_default_object_acl,
1836            )?;
1837        }
1838        if self.update_mask.is_some() {
1839            state.serialize_entry("updateMask", &self.update_mask)?;
1840        }
1841        if !self._unknown_fields.is_empty() {
1842            for (key, value) in self._unknown_fields.iter() {
1843                state.serialize_entry(key, &value)?;
1844            }
1845        }
1846        state.end()
1847    }
1848}
1849
1850/// Request message for ComposeObject.
1851#[derive(Clone, Debug, Default, PartialEq)]
1852#[non_exhaustive]
1853pub struct ComposeObjectRequest {
1854    /// Required. Properties of the resulting object.
1855    pub destination: std::option::Option<crate::model::Object>,
1856
1857    /// Optional. The list of source objects that will be concatenated into a
1858    /// single object.
1859    pub source_objects: std::vec::Vec<crate::model::compose_object_request::SourceObject>,
1860
1861    /// Optional. Apply a predefined set of access controls to the destination
1862    /// object. Valid values are "authenticatedRead", "bucketOwnerFullControl",
1863    /// "bucketOwnerRead", "private", "projectPrivate", or "publicRead".
1864    pub destination_predefined_acl: std::string::String,
1865
1866    /// Makes the operation conditional on whether the object's current generation
1867    /// matches the given value. Setting to 0 makes the operation succeed only if
1868    /// there are no live versions of the object.
1869    pub if_generation_match: std::option::Option<i64>,
1870
1871    /// Makes the operation conditional on whether the object's current
1872    /// metageneration matches the given value.
1873    pub if_metageneration_match: std::option::Option<i64>,
1874
1875    /// Optional. Resource name of the Cloud KMS key, of the form
1876    /// `projects/my-project/locations/my-location/keyRings/my-kr/cryptoKeys/my-key`,
1877    /// that will be used to encrypt the object. Overrides the object
1878    /// metadata's `kms_key_name` value, if any.
1879    pub kms_key: std::string::String,
1880
1881    /// Optional. A set of parameters common to Storage API requests concerning an
1882    /// object.
1883    pub common_object_request_params: std::option::Option<crate::model::CommonObjectRequestParams>,
1884
1885    /// Optional. The checksums of the complete object. This will be validated
1886    /// against the combined checksums of the component objects.
1887    pub object_checksums: std::option::Option<crate::model::ObjectChecksums>,
1888
1889    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1890}
1891
1892impl ComposeObjectRequest {
1893    pub fn new() -> Self {
1894        std::default::Default::default()
1895    }
1896
1897    /// Sets the value of [destination][crate::model::ComposeObjectRequest::destination].
1898    pub fn set_destination<T>(mut self, v: T) -> Self
1899    where
1900        T: std::convert::Into<crate::model::Object>,
1901    {
1902        self.destination = std::option::Option::Some(v.into());
1903        self
1904    }
1905
1906    /// Sets or clears the value of [destination][crate::model::ComposeObjectRequest::destination].
1907    pub fn set_or_clear_destination<T>(mut self, v: std::option::Option<T>) -> Self
1908    where
1909        T: std::convert::Into<crate::model::Object>,
1910    {
1911        self.destination = v.map(|x| x.into());
1912        self
1913    }
1914
1915    /// Sets the value of [source_objects][crate::model::ComposeObjectRequest::source_objects].
1916    pub fn set_source_objects<T, V>(mut self, v: T) -> Self
1917    where
1918        T: std::iter::IntoIterator<Item = V>,
1919        V: std::convert::Into<crate::model::compose_object_request::SourceObject>,
1920    {
1921        use std::iter::Iterator;
1922        self.source_objects = v.into_iter().map(|i| i.into()).collect();
1923        self
1924    }
1925
1926    /// Sets the value of [destination_predefined_acl][crate::model::ComposeObjectRequest::destination_predefined_acl].
1927    pub fn set_destination_predefined_acl<T: std::convert::Into<std::string::String>>(
1928        mut self,
1929        v: T,
1930    ) -> Self {
1931        self.destination_predefined_acl = v.into();
1932        self
1933    }
1934
1935    /// Sets the value of [if_generation_match][crate::model::ComposeObjectRequest::if_generation_match].
1936    pub fn set_if_generation_match<T>(mut self, v: T) -> Self
1937    where
1938        T: std::convert::Into<i64>,
1939    {
1940        self.if_generation_match = std::option::Option::Some(v.into());
1941        self
1942    }
1943
1944    /// Sets or clears the value of [if_generation_match][crate::model::ComposeObjectRequest::if_generation_match].
1945    pub fn set_or_clear_if_generation_match<T>(mut self, v: std::option::Option<T>) -> Self
1946    where
1947        T: std::convert::Into<i64>,
1948    {
1949        self.if_generation_match = v.map(|x| x.into());
1950        self
1951    }
1952
1953    /// Sets the value of [if_metageneration_match][crate::model::ComposeObjectRequest::if_metageneration_match].
1954    pub fn set_if_metageneration_match<T>(mut self, v: T) -> Self
1955    where
1956        T: std::convert::Into<i64>,
1957    {
1958        self.if_metageneration_match = std::option::Option::Some(v.into());
1959        self
1960    }
1961
1962    /// Sets or clears the value of [if_metageneration_match][crate::model::ComposeObjectRequest::if_metageneration_match].
1963    pub fn set_or_clear_if_metageneration_match<T>(mut self, v: std::option::Option<T>) -> Self
1964    where
1965        T: std::convert::Into<i64>,
1966    {
1967        self.if_metageneration_match = v.map(|x| x.into());
1968        self
1969    }
1970
1971    /// Sets the value of [kms_key][crate::model::ComposeObjectRequest::kms_key].
1972    pub fn set_kms_key<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1973        self.kms_key = v.into();
1974        self
1975    }
1976
1977    /// Sets the value of [common_object_request_params][crate::model::ComposeObjectRequest::common_object_request_params].
1978    pub fn set_common_object_request_params<T>(mut self, v: T) -> Self
1979    where
1980        T: std::convert::Into<crate::model::CommonObjectRequestParams>,
1981    {
1982        self.common_object_request_params = std::option::Option::Some(v.into());
1983        self
1984    }
1985
1986    /// Sets or clears the value of [common_object_request_params][crate::model::ComposeObjectRequest::common_object_request_params].
1987    pub fn set_or_clear_common_object_request_params<T>(mut self, v: std::option::Option<T>) -> Self
1988    where
1989        T: std::convert::Into<crate::model::CommonObjectRequestParams>,
1990    {
1991        self.common_object_request_params = v.map(|x| x.into());
1992        self
1993    }
1994
1995    /// Sets the value of [object_checksums][crate::model::ComposeObjectRequest::object_checksums].
1996    pub fn set_object_checksums<T>(mut self, v: T) -> Self
1997    where
1998        T: std::convert::Into<crate::model::ObjectChecksums>,
1999    {
2000        self.object_checksums = std::option::Option::Some(v.into());
2001        self
2002    }
2003
2004    /// Sets or clears the value of [object_checksums][crate::model::ComposeObjectRequest::object_checksums].
2005    pub fn set_or_clear_object_checksums<T>(mut self, v: std::option::Option<T>) -> Self
2006    where
2007        T: std::convert::Into<crate::model::ObjectChecksums>,
2008    {
2009        self.object_checksums = v.map(|x| x.into());
2010        self
2011    }
2012}
2013
2014impl wkt::message::Message for ComposeObjectRequest {
2015    fn typename() -> &'static str {
2016        "type.googleapis.com/google.storage.v2.ComposeObjectRequest"
2017    }
2018}
2019
2020#[doc(hidden)]
2021impl<'de> serde::de::Deserialize<'de> for ComposeObjectRequest {
2022    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
2023    where
2024        D: serde::Deserializer<'de>,
2025    {
2026        #[allow(non_camel_case_types)]
2027        #[doc(hidden)]
2028        #[derive(PartialEq, Eq, Hash)]
2029        enum __FieldTag {
2030            __destination,
2031            __source_objects,
2032            __destination_predefined_acl,
2033            __if_generation_match,
2034            __if_metageneration_match,
2035            __kms_key,
2036            __common_object_request_params,
2037            __object_checksums,
2038            Unknown(std::string::String),
2039        }
2040        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
2041            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
2042            where
2043                D: serde::Deserializer<'de>,
2044            {
2045                struct Visitor;
2046                impl<'de> serde::de::Visitor<'de> for Visitor {
2047                    type Value = __FieldTag;
2048                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
2049                        formatter.write_str("a field name for ComposeObjectRequest")
2050                    }
2051                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
2052                    where
2053                        E: serde::de::Error,
2054                    {
2055                        use std::result::Result::Ok;
2056                        use std::string::ToString;
2057                        match value {
2058                            "destination" => Ok(__FieldTag::__destination),
2059                            "sourceObjects" => Ok(__FieldTag::__source_objects),
2060                            "source_objects" => Ok(__FieldTag::__source_objects),
2061                            "destinationPredefinedAcl" => {
2062                                Ok(__FieldTag::__destination_predefined_acl)
2063                            }
2064                            "destination_predefined_acl" => {
2065                                Ok(__FieldTag::__destination_predefined_acl)
2066                            }
2067                            "ifGenerationMatch" => Ok(__FieldTag::__if_generation_match),
2068                            "if_generation_match" => Ok(__FieldTag::__if_generation_match),
2069                            "ifMetagenerationMatch" => Ok(__FieldTag::__if_metageneration_match),
2070                            "if_metageneration_match" => Ok(__FieldTag::__if_metageneration_match),
2071                            "kmsKey" => Ok(__FieldTag::__kms_key),
2072                            "kms_key" => Ok(__FieldTag::__kms_key),
2073                            "commonObjectRequestParams" => {
2074                                Ok(__FieldTag::__common_object_request_params)
2075                            }
2076                            "common_object_request_params" => {
2077                                Ok(__FieldTag::__common_object_request_params)
2078                            }
2079                            "objectChecksums" => Ok(__FieldTag::__object_checksums),
2080                            "object_checksums" => Ok(__FieldTag::__object_checksums),
2081                            _ => Ok(__FieldTag::Unknown(value.to_string())),
2082                        }
2083                    }
2084                }
2085                deserializer.deserialize_identifier(Visitor)
2086            }
2087        }
2088        struct Visitor;
2089        impl<'de> serde::de::Visitor<'de> for Visitor {
2090            type Value = ComposeObjectRequest;
2091            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
2092                formatter.write_str("struct ComposeObjectRequest")
2093            }
2094            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
2095            where
2096                A: serde::de::MapAccess<'de>,
2097            {
2098                #[allow(unused_imports)]
2099                use serde::de::Error;
2100                use std::option::Option::Some;
2101                let mut fields = std::collections::HashSet::new();
2102                let mut result = Self::Value::new();
2103                while let Some(tag) = map.next_key::<__FieldTag>()? {
2104                    #[allow(clippy::match_single_binding)]
2105                    match tag {
2106                        __FieldTag::__destination => {
2107                            if !fields.insert(__FieldTag::__destination) {
2108                                return std::result::Result::Err(A::Error::duplicate_field(
2109                                    "multiple values for destination",
2110                                ));
2111                            }
2112                            result.destination =
2113                                map.next_value::<std::option::Option<crate::model::Object>>()?;
2114                        }
2115                        __FieldTag::__source_objects => {
2116                            if !fields.insert(__FieldTag::__source_objects) {
2117                                return std::result::Result::Err(A::Error::duplicate_field(
2118                                    "multiple values for source_objects",
2119                                ));
2120                            }
2121                            result.source_objects = map
2122                                .next_value::<std::option::Option<
2123                                    std::vec::Vec<
2124                                        crate::model::compose_object_request::SourceObject,
2125                                    >,
2126                                >>()?
2127                                .unwrap_or_default();
2128                        }
2129                        __FieldTag::__destination_predefined_acl => {
2130                            if !fields.insert(__FieldTag::__destination_predefined_acl) {
2131                                return std::result::Result::Err(A::Error::duplicate_field(
2132                                    "multiple values for destination_predefined_acl",
2133                                ));
2134                            }
2135                            result.destination_predefined_acl = map
2136                                .next_value::<std::option::Option<std::string::String>>()?
2137                                .unwrap_or_default();
2138                        }
2139                        __FieldTag::__if_generation_match => {
2140                            if !fields.insert(__FieldTag::__if_generation_match) {
2141                                return std::result::Result::Err(A::Error::duplicate_field(
2142                                    "multiple values for if_generation_match",
2143                                ));
2144                            }
2145                            struct __With(std::option::Option<i64>);
2146                            impl<'de> serde::de::Deserialize<'de> for __With {
2147                                fn deserialize<D>(
2148                                    deserializer: D,
2149                                ) -> std::result::Result<Self, D::Error>
2150                                where
2151                                    D: serde::de::Deserializer<'de>,
2152                                {
2153                                    serde_with::As::< std::option::Option<wkt::internal::I64> >::deserialize(deserializer).map(__With)
2154                                }
2155                            }
2156                            result.if_generation_match = map.next_value::<__With>()?.0;
2157                        }
2158                        __FieldTag::__if_metageneration_match => {
2159                            if !fields.insert(__FieldTag::__if_metageneration_match) {
2160                                return std::result::Result::Err(A::Error::duplicate_field(
2161                                    "multiple values for if_metageneration_match",
2162                                ));
2163                            }
2164                            struct __With(std::option::Option<i64>);
2165                            impl<'de> serde::de::Deserialize<'de> for __With {
2166                                fn deserialize<D>(
2167                                    deserializer: D,
2168                                ) -> std::result::Result<Self, D::Error>
2169                                where
2170                                    D: serde::de::Deserializer<'de>,
2171                                {
2172                                    serde_with::As::< std::option::Option<wkt::internal::I64> >::deserialize(deserializer).map(__With)
2173                                }
2174                            }
2175                            result.if_metageneration_match = map.next_value::<__With>()?.0;
2176                        }
2177                        __FieldTag::__kms_key => {
2178                            if !fields.insert(__FieldTag::__kms_key) {
2179                                return std::result::Result::Err(A::Error::duplicate_field(
2180                                    "multiple values for kms_key",
2181                                ));
2182                            }
2183                            result.kms_key = map
2184                                .next_value::<std::option::Option<std::string::String>>()?
2185                                .unwrap_or_default();
2186                        }
2187                        __FieldTag::__common_object_request_params => {
2188                            if !fields.insert(__FieldTag::__common_object_request_params) {
2189                                return std::result::Result::Err(A::Error::duplicate_field(
2190                                    "multiple values for common_object_request_params",
2191                                ));
2192                            }
2193                            result.common_object_request_params = map.next_value::<std::option::Option<crate::model::CommonObjectRequestParams>>()?
2194                                ;
2195                        }
2196                        __FieldTag::__object_checksums => {
2197                            if !fields.insert(__FieldTag::__object_checksums) {
2198                                return std::result::Result::Err(A::Error::duplicate_field(
2199                                    "multiple values for object_checksums",
2200                                ));
2201                            }
2202                            result.object_checksums = map
2203                                .next_value::<std::option::Option<crate::model::ObjectChecksums>>(
2204                                )?;
2205                        }
2206                        __FieldTag::Unknown(key) => {
2207                            let value = map.next_value::<serde_json::Value>()?;
2208                            result._unknown_fields.insert(key, value);
2209                        }
2210                    }
2211                }
2212                std::result::Result::Ok(result)
2213            }
2214        }
2215        deserializer.deserialize_any(Visitor)
2216    }
2217}
2218
2219#[doc(hidden)]
2220impl serde::ser::Serialize for ComposeObjectRequest {
2221    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
2222    where
2223        S: serde::ser::Serializer,
2224    {
2225        use serde::ser::SerializeMap;
2226        #[allow(unused_imports)]
2227        use std::option::Option::Some;
2228        let mut state = serializer.serialize_map(std::option::Option::None)?;
2229        if self.destination.is_some() {
2230            state.serialize_entry("destination", &self.destination)?;
2231        }
2232        if !self.source_objects.is_empty() {
2233            state.serialize_entry("sourceObjects", &self.source_objects)?;
2234        }
2235        if !self.destination_predefined_acl.is_empty() {
2236            state.serialize_entry("destinationPredefinedAcl", &self.destination_predefined_acl)?;
2237        }
2238        if self.if_generation_match.is_some() {
2239            struct __With<'a>(&'a std::option::Option<i64>);
2240            impl<'a> serde::ser::Serialize for __With<'a> {
2241                fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
2242                where
2243                    S: serde::ser::Serializer,
2244                {
2245                    serde_with::As::<std::option::Option<wkt::internal::I64>>::serialize(
2246                        self.0, serializer,
2247                    )
2248                }
2249            }
2250            state.serialize_entry("ifGenerationMatch", &__With(&self.if_generation_match))?;
2251        }
2252        if self.if_metageneration_match.is_some() {
2253            struct __With<'a>(&'a std::option::Option<i64>);
2254            impl<'a> serde::ser::Serialize for __With<'a> {
2255                fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
2256                where
2257                    S: serde::ser::Serializer,
2258                {
2259                    serde_with::As::<std::option::Option<wkt::internal::I64>>::serialize(
2260                        self.0, serializer,
2261                    )
2262                }
2263            }
2264            state.serialize_entry(
2265                "ifMetagenerationMatch",
2266                &__With(&self.if_metageneration_match),
2267            )?;
2268        }
2269        if !self.kms_key.is_empty() {
2270            state.serialize_entry("kmsKey", &self.kms_key)?;
2271        }
2272        if self.common_object_request_params.is_some() {
2273            state.serialize_entry(
2274                "commonObjectRequestParams",
2275                &self.common_object_request_params,
2276            )?;
2277        }
2278        if self.object_checksums.is_some() {
2279            state.serialize_entry("objectChecksums", &self.object_checksums)?;
2280        }
2281        if !self._unknown_fields.is_empty() {
2282            for (key, value) in self._unknown_fields.iter() {
2283                state.serialize_entry(key, &value)?;
2284            }
2285        }
2286        state.end()
2287    }
2288}
2289
2290/// Defines additional types related to [ComposeObjectRequest].
2291pub mod compose_object_request {
2292    #[allow(unused_imports)]
2293    use super::*;
2294
2295    /// Description of a source object for a composition request.
2296    #[derive(Clone, Debug, Default, PartialEq)]
2297    #[non_exhaustive]
2298    pub struct SourceObject {
2299        /// Required. The source object's name. All source objects must reside in the
2300        /// same bucket.
2301        pub name: std::string::String,
2302
2303        /// Optional. The generation of this object to use as the source.
2304        pub generation: i64,
2305
2306        /// Optional. Conditions that must be met for this operation to execute.
2307        pub object_preconditions: std::option::Option<
2308            crate::model::compose_object_request::source_object::ObjectPreconditions,
2309        >,
2310
2311        _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2312    }
2313
2314    impl SourceObject {
2315        pub fn new() -> Self {
2316            std::default::Default::default()
2317        }
2318
2319        /// Sets the value of [name][crate::model::compose_object_request::SourceObject::name].
2320        pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2321            self.name = v.into();
2322            self
2323        }
2324
2325        /// Sets the value of [generation][crate::model::compose_object_request::SourceObject::generation].
2326        pub fn set_generation<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
2327            self.generation = v.into();
2328            self
2329        }
2330
2331        /// Sets the value of [object_preconditions][crate::model::compose_object_request::SourceObject::object_preconditions].
2332        pub fn set_object_preconditions<T>(mut self, v: T) -> Self
2333        where
2334            T: std::convert::Into<
2335                    crate::model::compose_object_request::source_object::ObjectPreconditions,
2336                >,
2337        {
2338            self.object_preconditions = std::option::Option::Some(v.into());
2339            self
2340        }
2341
2342        /// Sets or clears the value of [object_preconditions][crate::model::compose_object_request::SourceObject::object_preconditions].
2343        pub fn set_or_clear_object_preconditions<T>(mut self, v: std::option::Option<T>) -> Self
2344        where
2345            T: std::convert::Into<
2346                    crate::model::compose_object_request::source_object::ObjectPreconditions,
2347                >,
2348        {
2349            self.object_preconditions = v.map(|x| x.into());
2350            self
2351        }
2352    }
2353
2354    impl wkt::message::Message for SourceObject {
2355        fn typename() -> &'static str {
2356            "type.googleapis.com/google.storage.v2.ComposeObjectRequest.SourceObject"
2357        }
2358    }
2359
2360    #[doc(hidden)]
2361    impl<'de> serde::de::Deserialize<'de> for SourceObject {
2362        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
2363        where
2364            D: serde::Deserializer<'de>,
2365        {
2366            #[allow(non_camel_case_types)]
2367            #[doc(hidden)]
2368            #[derive(PartialEq, Eq, Hash)]
2369            enum __FieldTag {
2370                __name,
2371                __generation,
2372                __object_preconditions,
2373                Unknown(std::string::String),
2374            }
2375            impl<'de> serde::de::Deserialize<'de> for __FieldTag {
2376                fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
2377                where
2378                    D: serde::Deserializer<'de>,
2379                {
2380                    struct Visitor;
2381                    impl<'de> serde::de::Visitor<'de> for Visitor {
2382                        type Value = __FieldTag;
2383                        fn expecting(
2384                            &self,
2385                            formatter: &mut std::fmt::Formatter,
2386                        ) -> std::fmt::Result {
2387                            formatter.write_str("a field name for SourceObject")
2388                        }
2389                        fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
2390                        where
2391                            E: serde::de::Error,
2392                        {
2393                            use std::result::Result::Ok;
2394                            use std::string::ToString;
2395                            match value {
2396                                "name" => Ok(__FieldTag::__name),
2397                                "generation" => Ok(__FieldTag::__generation),
2398                                "objectPreconditions" => Ok(__FieldTag::__object_preconditions),
2399                                "object_preconditions" => Ok(__FieldTag::__object_preconditions),
2400                                _ => Ok(__FieldTag::Unknown(value.to_string())),
2401                            }
2402                        }
2403                    }
2404                    deserializer.deserialize_identifier(Visitor)
2405                }
2406            }
2407            struct Visitor;
2408            impl<'de> serde::de::Visitor<'de> for Visitor {
2409                type Value = SourceObject;
2410                fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
2411                    formatter.write_str("struct SourceObject")
2412                }
2413                fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
2414                where
2415                    A: serde::de::MapAccess<'de>,
2416                {
2417                    #[allow(unused_imports)]
2418                    use serde::de::Error;
2419                    use std::option::Option::Some;
2420                    let mut fields = std::collections::HashSet::new();
2421                    let mut result = Self::Value::new();
2422                    while let Some(tag) = map.next_key::<__FieldTag>()? {
2423                        #[allow(clippy::match_single_binding)]
2424                        match tag {
2425                            __FieldTag::__name => {
2426                                if !fields.insert(__FieldTag::__name) {
2427                                    return std::result::Result::Err(A::Error::duplicate_field(
2428                                        "multiple values for name",
2429                                    ));
2430                                }
2431                                result.name = map
2432                                    .next_value::<std::option::Option<std::string::String>>()?
2433                                    .unwrap_or_default();
2434                            }
2435                            __FieldTag::__generation => {
2436                                if !fields.insert(__FieldTag::__generation) {
2437                                    return std::result::Result::Err(A::Error::duplicate_field(
2438                                        "multiple values for generation",
2439                                    ));
2440                                }
2441                                struct __With(std::option::Option<i64>);
2442                                impl<'de> serde::de::Deserialize<'de> for __With {
2443                                    fn deserialize<D>(
2444                                        deserializer: D,
2445                                    ) -> std::result::Result<Self, D::Error>
2446                                    where
2447                                        D: serde::de::Deserializer<'de>,
2448                                    {
2449                                        serde_with::As::< std::option::Option<wkt::internal::I64> >::deserialize(deserializer).map(__With)
2450                                    }
2451                                }
2452                                result.generation =
2453                                    map.next_value::<__With>()?.0.unwrap_or_default();
2454                            }
2455                            __FieldTag::__object_preconditions => {
2456                                if !fields.insert(__FieldTag::__object_preconditions) {
2457                                    return std::result::Result::Err(A::Error::duplicate_field(
2458                                        "multiple values for object_preconditions",
2459                                    ));
2460                                }
2461                                result.object_preconditions = map.next_value::<std::option::Option<crate::model::compose_object_request::source_object::ObjectPreconditions>>()?
2462                                    ;
2463                            }
2464                            __FieldTag::Unknown(key) => {
2465                                let value = map.next_value::<serde_json::Value>()?;
2466                                result._unknown_fields.insert(key, value);
2467                            }
2468                        }
2469                    }
2470                    std::result::Result::Ok(result)
2471                }
2472            }
2473            deserializer.deserialize_any(Visitor)
2474        }
2475    }
2476
2477    #[doc(hidden)]
2478    impl serde::ser::Serialize for SourceObject {
2479        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
2480        where
2481            S: serde::ser::Serializer,
2482        {
2483            use serde::ser::SerializeMap;
2484            #[allow(unused_imports)]
2485            use std::option::Option::Some;
2486            let mut state = serializer.serialize_map(std::option::Option::None)?;
2487            if !self.name.is_empty() {
2488                state.serialize_entry("name", &self.name)?;
2489            }
2490            if !wkt::internal::is_default(&self.generation) {
2491                struct __With<'a>(&'a i64);
2492                impl<'a> serde::ser::Serialize for __With<'a> {
2493                    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
2494                    where
2495                        S: serde::ser::Serializer,
2496                    {
2497                        serde_with::As::<wkt::internal::I64>::serialize(self.0, serializer)
2498                    }
2499                }
2500                state.serialize_entry("generation", &__With(&self.generation))?;
2501            }
2502            if self.object_preconditions.is_some() {
2503                state.serialize_entry("objectPreconditions", &self.object_preconditions)?;
2504            }
2505            if !self._unknown_fields.is_empty() {
2506                for (key, value) in self._unknown_fields.iter() {
2507                    state.serialize_entry(key, &value)?;
2508                }
2509            }
2510            state.end()
2511        }
2512    }
2513
2514    /// Defines additional types related to [SourceObject].
2515    pub mod source_object {
2516        #[allow(unused_imports)]
2517        use super::*;
2518
2519        /// Preconditions for a source object of a composition request.
2520        #[derive(Clone, Debug, Default, PartialEq)]
2521        #[non_exhaustive]
2522        pub struct ObjectPreconditions {
2523            /// Only perform the composition if the generation of the source object
2524            /// that would be used matches this value.  If this value and a generation
2525            /// are both specified, they must be the same value or the call will fail.
2526            pub if_generation_match: std::option::Option<i64>,
2527
2528            _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2529        }
2530
2531        impl ObjectPreconditions {
2532            pub fn new() -> Self {
2533                std::default::Default::default()
2534            }
2535
2536            /// Sets the value of [if_generation_match][crate::model::compose_object_request::source_object::ObjectPreconditions::if_generation_match].
2537            pub fn set_if_generation_match<T>(mut self, v: T) -> Self
2538            where
2539                T: std::convert::Into<i64>,
2540            {
2541                self.if_generation_match = std::option::Option::Some(v.into());
2542                self
2543            }
2544
2545            /// Sets or clears the value of [if_generation_match][crate::model::compose_object_request::source_object::ObjectPreconditions::if_generation_match].
2546            pub fn set_or_clear_if_generation_match<T>(mut self, v: std::option::Option<T>) -> Self
2547            where
2548                T: std::convert::Into<i64>,
2549            {
2550                self.if_generation_match = v.map(|x| x.into());
2551                self
2552            }
2553        }
2554
2555        impl wkt::message::Message for ObjectPreconditions {
2556            fn typename() -> &'static str {
2557                "type.googleapis.com/google.storage.v2.ComposeObjectRequest.SourceObject.ObjectPreconditions"
2558            }
2559        }
2560
2561        #[doc(hidden)]
2562        impl<'de> serde::de::Deserialize<'de> for ObjectPreconditions {
2563            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
2564            where
2565                D: serde::Deserializer<'de>,
2566            {
2567                #[allow(non_camel_case_types)]
2568                #[doc(hidden)]
2569                #[derive(PartialEq, Eq, Hash)]
2570                enum __FieldTag {
2571                    __if_generation_match,
2572                    Unknown(std::string::String),
2573                }
2574                impl<'de> serde::de::Deserialize<'de> for __FieldTag {
2575                    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
2576                    where
2577                        D: serde::Deserializer<'de>,
2578                    {
2579                        struct Visitor;
2580                        impl<'de> serde::de::Visitor<'de> for Visitor {
2581                            type Value = __FieldTag;
2582                            fn expecting(
2583                                &self,
2584                                formatter: &mut std::fmt::Formatter,
2585                            ) -> std::fmt::Result {
2586                                formatter.write_str("a field name for ObjectPreconditions")
2587                            }
2588                            fn visit_str<E>(
2589                                self,
2590                                value: &str,
2591                            ) -> std::result::Result<Self::Value, E>
2592                            where
2593                                E: serde::de::Error,
2594                            {
2595                                use std::result::Result::Ok;
2596                                use std::string::ToString;
2597                                match value {
2598                                    "ifGenerationMatch" => Ok(__FieldTag::__if_generation_match),
2599                                    "if_generation_match" => Ok(__FieldTag::__if_generation_match),
2600                                    _ => Ok(__FieldTag::Unknown(value.to_string())),
2601                                }
2602                            }
2603                        }
2604                        deserializer.deserialize_identifier(Visitor)
2605                    }
2606                }
2607                struct Visitor;
2608                impl<'de> serde::de::Visitor<'de> for Visitor {
2609                    type Value = ObjectPreconditions;
2610                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
2611                        formatter.write_str("struct ObjectPreconditions")
2612                    }
2613                    fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
2614                    where
2615                        A: serde::de::MapAccess<'de>,
2616                    {
2617                        #[allow(unused_imports)]
2618                        use serde::de::Error;
2619                        use std::option::Option::Some;
2620                        let mut fields = std::collections::HashSet::new();
2621                        let mut result = Self::Value::new();
2622                        while let Some(tag) = map.next_key::<__FieldTag>()? {
2623                            #[allow(clippy::match_single_binding)]
2624                            match tag {
2625                                __FieldTag::__if_generation_match => {
2626                                    if !fields.insert(__FieldTag::__if_generation_match) {
2627                                        return std::result::Result::Err(
2628                                            A::Error::duplicate_field(
2629                                                "multiple values for if_generation_match",
2630                                            ),
2631                                        );
2632                                    }
2633                                    struct __With(std::option::Option<i64>);
2634                                    impl<'de> serde::de::Deserialize<'de> for __With {
2635                                        fn deserialize<D>(
2636                                            deserializer: D,
2637                                        ) -> std::result::Result<Self, D::Error>
2638                                        where
2639                                            D: serde::de::Deserializer<'de>,
2640                                        {
2641                                            serde_with::As::< std::option::Option<wkt::internal::I64> >::deserialize(deserializer).map(__With)
2642                                        }
2643                                    }
2644                                    result.if_generation_match = map.next_value::<__With>()?.0;
2645                                }
2646                                __FieldTag::Unknown(key) => {
2647                                    let value = map.next_value::<serde_json::Value>()?;
2648                                    result._unknown_fields.insert(key, value);
2649                                }
2650                            }
2651                        }
2652                        std::result::Result::Ok(result)
2653                    }
2654                }
2655                deserializer.deserialize_any(Visitor)
2656            }
2657        }
2658
2659        #[doc(hidden)]
2660        impl serde::ser::Serialize for ObjectPreconditions {
2661            fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
2662            where
2663                S: serde::ser::Serializer,
2664            {
2665                use serde::ser::SerializeMap;
2666                #[allow(unused_imports)]
2667                use std::option::Option::Some;
2668                let mut state = serializer.serialize_map(std::option::Option::None)?;
2669                if self.if_generation_match.is_some() {
2670                    struct __With<'a>(&'a std::option::Option<i64>);
2671                    impl<'a> serde::ser::Serialize for __With<'a> {
2672                        fn serialize<S>(
2673                            &self,
2674                            serializer: S,
2675                        ) -> std::result::Result<S::Ok, S::Error>
2676                        where
2677                            S: serde::ser::Serializer,
2678                        {
2679                            serde_with::As::<std::option::Option<wkt::internal::I64>>::serialize(
2680                                self.0, serializer,
2681                            )
2682                        }
2683                    }
2684                    state
2685                        .serialize_entry("ifGenerationMatch", &__With(&self.if_generation_match))?;
2686                }
2687                if !self._unknown_fields.is_empty() {
2688                    for (key, value) in self._unknown_fields.iter() {
2689                        state.serialize_entry(key, &value)?;
2690                    }
2691                }
2692                state.end()
2693            }
2694        }
2695    }
2696}
2697
2698/// Message for deleting an object.
2699/// `bucket` and `object` **must** be set.
2700#[derive(Clone, Debug, Default, PartialEq)]
2701#[non_exhaustive]
2702pub struct DeleteObjectRequest {
2703    /// Required. Name of the bucket in which the object resides.
2704    pub bucket: std::string::String,
2705
2706    /// Required. The name of the finalized object to delete.
2707    /// Note: If you want to delete an unfinalized resumable upload please use
2708    /// `CancelResumableWrite`.
2709    pub object: std::string::String,
2710
2711    /// Optional. If present, permanently deletes a specific revision of this
2712    /// object (as opposed to the latest version, the default).
2713    pub generation: i64,
2714
2715    /// Makes the operation conditional on whether the object's current generation
2716    /// matches the given value. Setting to 0 makes the operation succeed only if
2717    /// there are no live versions of the object.
2718    pub if_generation_match: std::option::Option<i64>,
2719
2720    /// Makes the operation conditional on whether the object's live generation
2721    /// does not match the given value. If no live object exists, the precondition
2722    /// fails. Setting to 0 makes the operation succeed only if there is a live
2723    /// version of the object.
2724    pub if_generation_not_match: std::option::Option<i64>,
2725
2726    /// Makes the operation conditional on whether the object's current
2727    /// metageneration matches the given value.
2728    pub if_metageneration_match: std::option::Option<i64>,
2729
2730    /// Makes the operation conditional on whether the object's current
2731    /// metageneration does not match the given value.
2732    pub if_metageneration_not_match: std::option::Option<i64>,
2733
2734    /// Optional. A set of parameters common to Storage API requests concerning an
2735    /// object.
2736    pub common_object_request_params: std::option::Option<crate::model::CommonObjectRequestParams>,
2737
2738    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2739}
2740
2741impl DeleteObjectRequest {
2742    pub fn new() -> Self {
2743        std::default::Default::default()
2744    }
2745
2746    /// Sets the value of [bucket][crate::model::DeleteObjectRequest::bucket].
2747    pub fn set_bucket<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2748        self.bucket = v.into();
2749        self
2750    }
2751
2752    /// Sets the value of [object][crate::model::DeleteObjectRequest::object].
2753    pub fn set_object<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2754        self.object = v.into();
2755        self
2756    }
2757
2758    /// Sets the value of [generation][crate::model::DeleteObjectRequest::generation].
2759    pub fn set_generation<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
2760        self.generation = v.into();
2761        self
2762    }
2763
2764    /// Sets the value of [if_generation_match][crate::model::DeleteObjectRequest::if_generation_match].
2765    pub fn set_if_generation_match<T>(mut self, v: T) -> Self
2766    where
2767        T: std::convert::Into<i64>,
2768    {
2769        self.if_generation_match = std::option::Option::Some(v.into());
2770        self
2771    }
2772
2773    /// Sets or clears the value of [if_generation_match][crate::model::DeleteObjectRequest::if_generation_match].
2774    pub fn set_or_clear_if_generation_match<T>(mut self, v: std::option::Option<T>) -> Self
2775    where
2776        T: std::convert::Into<i64>,
2777    {
2778        self.if_generation_match = v.map(|x| x.into());
2779        self
2780    }
2781
2782    /// Sets the value of [if_generation_not_match][crate::model::DeleteObjectRequest::if_generation_not_match].
2783    pub fn set_if_generation_not_match<T>(mut self, v: T) -> Self
2784    where
2785        T: std::convert::Into<i64>,
2786    {
2787        self.if_generation_not_match = std::option::Option::Some(v.into());
2788        self
2789    }
2790
2791    /// Sets or clears the value of [if_generation_not_match][crate::model::DeleteObjectRequest::if_generation_not_match].
2792    pub fn set_or_clear_if_generation_not_match<T>(mut self, v: std::option::Option<T>) -> Self
2793    where
2794        T: std::convert::Into<i64>,
2795    {
2796        self.if_generation_not_match = v.map(|x| x.into());
2797        self
2798    }
2799
2800    /// Sets the value of [if_metageneration_match][crate::model::DeleteObjectRequest::if_metageneration_match].
2801    pub fn set_if_metageneration_match<T>(mut self, v: T) -> Self
2802    where
2803        T: std::convert::Into<i64>,
2804    {
2805        self.if_metageneration_match = std::option::Option::Some(v.into());
2806        self
2807    }
2808
2809    /// Sets or clears the value of [if_metageneration_match][crate::model::DeleteObjectRequest::if_metageneration_match].
2810    pub fn set_or_clear_if_metageneration_match<T>(mut self, v: std::option::Option<T>) -> Self
2811    where
2812        T: std::convert::Into<i64>,
2813    {
2814        self.if_metageneration_match = v.map(|x| x.into());
2815        self
2816    }
2817
2818    /// Sets the value of [if_metageneration_not_match][crate::model::DeleteObjectRequest::if_metageneration_not_match].
2819    pub fn set_if_metageneration_not_match<T>(mut self, v: T) -> Self
2820    where
2821        T: std::convert::Into<i64>,
2822    {
2823        self.if_metageneration_not_match = std::option::Option::Some(v.into());
2824        self
2825    }
2826
2827    /// Sets or clears the value of [if_metageneration_not_match][crate::model::DeleteObjectRequest::if_metageneration_not_match].
2828    pub fn set_or_clear_if_metageneration_not_match<T>(mut self, v: std::option::Option<T>) -> Self
2829    where
2830        T: std::convert::Into<i64>,
2831    {
2832        self.if_metageneration_not_match = v.map(|x| x.into());
2833        self
2834    }
2835
2836    /// Sets the value of [common_object_request_params][crate::model::DeleteObjectRequest::common_object_request_params].
2837    pub fn set_common_object_request_params<T>(mut self, v: T) -> Self
2838    where
2839        T: std::convert::Into<crate::model::CommonObjectRequestParams>,
2840    {
2841        self.common_object_request_params = std::option::Option::Some(v.into());
2842        self
2843    }
2844
2845    /// Sets or clears the value of [common_object_request_params][crate::model::DeleteObjectRequest::common_object_request_params].
2846    pub fn set_or_clear_common_object_request_params<T>(mut self, v: std::option::Option<T>) -> Self
2847    where
2848        T: std::convert::Into<crate::model::CommonObjectRequestParams>,
2849    {
2850        self.common_object_request_params = v.map(|x| x.into());
2851        self
2852    }
2853}
2854
2855impl wkt::message::Message for DeleteObjectRequest {
2856    fn typename() -> &'static str {
2857        "type.googleapis.com/google.storage.v2.DeleteObjectRequest"
2858    }
2859}
2860
2861#[doc(hidden)]
2862impl<'de> serde::de::Deserialize<'de> for DeleteObjectRequest {
2863    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
2864    where
2865        D: serde::Deserializer<'de>,
2866    {
2867        #[allow(non_camel_case_types)]
2868        #[doc(hidden)]
2869        #[derive(PartialEq, Eq, Hash)]
2870        enum __FieldTag {
2871            __bucket,
2872            __object,
2873            __generation,
2874            __if_generation_match,
2875            __if_generation_not_match,
2876            __if_metageneration_match,
2877            __if_metageneration_not_match,
2878            __common_object_request_params,
2879            Unknown(std::string::String),
2880        }
2881        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
2882            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
2883            where
2884                D: serde::Deserializer<'de>,
2885            {
2886                struct Visitor;
2887                impl<'de> serde::de::Visitor<'de> for Visitor {
2888                    type Value = __FieldTag;
2889                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
2890                        formatter.write_str("a field name for DeleteObjectRequest")
2891                    }
2892                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
2893                    where
2894                        E: serde::de::Error,
2895                    {
2896                        use std::result::Result::Ok;
2897                        use std::string::ToString;
2898                        match value {
2899                            "bucket" => Ok(__FieldTag::__bucket),
2900                            "object" => Ok(__FieldTag::__object),
2901                            "generation" => Ok(__FieldTag::__generation),
2902                            "ifGenerationMatch" => Ok(__FieldTag::__if_generation_match),
2903                            "if_generation_match" => Ok(__FieldTag::__if_generation_match),
2904                            "ifGenerationNotMatch" => Ok(__FieldTag::__if_generation_not_match),
2905                            "if_generation_not_match" => Ok(__FieldTag::__if_generation_not_match),
2906                            "ifMetagenerationMatch" => Ok(__FieldTag::__if_metageneration_match),
2907                            "if_metageneration_match" => Ok(__FieldTag::__if_metageneration_match),
2908                            "ifMetagenerationNotMatch" => {
2909                                Ok(__FieldTag::__if_metageneration_not_match)
2910                            }
2911                            "if_metageneration_not_match" => {
2912                                Ok(__FieldTag::__if_metageneration_not_match)
2913                            }
2914                            "commonObjectRequestParams" => {
2915                                Ok(__FieldTag::__common_object_request_params)
2916                            }
2917                            "common_object_request_params" => {
2918                                Ok(__FieldTag::__common_object_request_params)
2919                            }
2920                            _ => Ok(__FieldTag::Unknown(value.to_string())),
2921                        }
2922                    }
2923                }
2924                deserializer.deserialize_identifier(Visitor)
2925            }
2926        }
2927        struct Visitor;
2928        impl<'de> serde::de::Visitor<'de> for Visitor {
2929            type Value = DeleteObjectRequest;
2930            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
2931                formatter.write_str("struct DeleteObjectRequest")
2932            }
2933            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
2934            where
2935                A: serde::de::MapAccess<'de>,
2936            {
2937                #[allow(unused_imports)]
2938                use serde::de::Error;
2939                use std::option::Option::Some;
2940                let mut fields = std::collections::HashSet::new();
2941                let mut result = Self::Value::new();
2942                while let Some(tag) = map.next_key::<__FieldTag>()? {
2943                    #[allow(clippy::match_single_binding)]
2944                    match tag {
2945                        __FieldTag::__bucket => {
2946                            if !fields.insert(__FieldTag::__bucket) {
2947                                return std::result::Result::Err(A::Error::duplicate_field(
2948                                    "multiple values for bucket",
2949                                ));
2950                            }
2951                            result.bucket = map
2952                                .next_value::<std::option::Option<std::string::String>>()?
2953                                .unwrap_or_default();
2954                        }
2955                        __FieldTag::__object => {
2956                            if !fields.insert(__FieldTag::__object) {
2957                                return std::result::Result::Err(A::Error::duplicate_field(
2958                                    "multiple values for object",
2959                                ));
2960                            }
2961                            result.object = map
2962                                .next_value::<std::option::Option<std::string::String>>()?
2963                                .unwrap_or_default();
2964                        }
2965                        __FieldTag::__generation => {
2966                            if !fields.insert(__FieldTag::__generation) {
2967                                return std::result::Result::Err(A::Error::duplicate_field(
2968                                    "multiple values for generation",
2969                                ));
2970                            }
2971                            struct __With(std::option::Option<i64>);
2972                            impl<'de> serde::de::Deserialize<'de> for __With {
2973                                fn deserialize<D>(
2974                                    deserializer: D,
2975                                ) -> std::result::Result<Self, D::Error>
2976                                where
2977                                    D: serde::de::Deserializer<'de>,
2978                                {
2979                                    serde_with::As::< std::option::Option<wkt::internal::I64> >::deserialize(deserializer).map(__With)
2980                                }
2981                            }
2982                            result.generation = map.next_value::<__With>()?.0.unwrap_or_default();
2983                        }
2984                        __FieldTag::__if_generation_match => {
2985                            if !fields.insert(__FieldTag::__if_generation_match) {
2986                                return std::result::Result::Err(A::Error::duplicate_field(
2987                                    "multiple values for if_generation_match",
2988                                ));
2989                            }
2990                            struct __With(std::option::Option<i64>);
2991                            impl<'de> serde::de::Deserialize<'de> for __With {
2992                                fn deserialize<D>(
2993                                    deserializer: D,
2994                                ) -> std::result::Result<Self, D::Error>
2995                                where
2996                                    D: serde::de::Deserializer<'de>,
2997                                {
2998                                    serde_with::As::< std::option::Option<wkt::internal::I64> >::deserialize(deserializer).map(__With)
2999                                }
3000                            }
3001                            result.if_generation_match = map.next_value::<__With>()?.0;
3002                        }
3003                        __FieldTag::__if_generation_not_match => {
3004                            if !fields.insert(__FieldTag::__if_generation_not_match) {
3005                                return std::result::Result::Err(A::Error::duplicate_field(
3006                                    "multiple values for if_generation_not_match",
3007                                ));
3008                            }
3009                            struct __With(std::option::Option<i64>);
3010                            impl<'de> serde::de::Deserialize<'de> for __With {
3011                                fn deserialize<D>(
3012                                    deserializer: D,
3013                                ) -> std::result::Result<Self, D::Error>
3014                                where
3015                                    D: serde::de::Deserializer<'de>,
3016                                {
3017                                    serde_with::As::< std::option::Option<wkt::internal::I64> >::deserialize(deserializer).map(__With)
3018                                }
3019                            }
3020                            result.if_generation_not_match = map.next_value::<__With>()?.0;
3021                        }
3022                        __FieldTag::__if_metageneration_match => {
3023                            if !fields.insert(__FieldTag::__if_metageneration_match) {
3024                                return std::result::Result::Err(A::Error::duplicate_field(
3025                                    "multiple values for if_metageneration_match",
3026                                ));
3027                            }
3028                            struct __With(std::option::Option<i64>);
3029                            impl<'de> serde::de::Deserialize<'de> for __With {
3030                                fn deserialize<D>(
3031                                    deserializer: D,
3032                                ) -> std::result::Result<Self, D::Error>
3033                                where
3034                                    D: serde::de::Deserializer<'de>,
3035                                {
3036                                    serde_with::As::< std::option::Option<wkt::internal::I64> >::deserialize(deserializer).map(__With)
3037                                }
3038                            }
3039                            result.if_metageneration_match = map.next_value::<__With>()?.0;
3040                        }
3041                        __FieldTag::__if_metageneration_not_match => {
3042                            if !fields.insert(__FieldTag::__if_metageneration_not_match) {
3043                                return std::result::Result::Err(A::Error::duplicate_field(
3044                                    "multiple values for if_metageneration_not_match",
3045                                ));
3046                            }
3047                            struct __With(std::option::Option<i64>);
3048                            impl<'de> serde::de::Deserialize<'de> for __With {
3049                                fn deserialize<D>(
3050                                    deserializer: D,
3051                                ) -> std::result::Result<Self, D::Error>
3052                                where
3053                                    D: serde::de::Deserializer<'de>,
3054                                {
3055                                    serde_with::As::< std::option::Option<wkt::internal::I64> >::deserialize(deserializer).map(__With)
3056                                }
3057                            }
3058                            result.if_metageneration_not_match = map.next_value::<__With>()?.0;
3059                        }
3060                        __FieldTag::__common_object_request_params => {
3061                            if !fields.insert(__FieldTag::__common_object_request_params) {
3062                                return std::result::Result::Err(A::Error::duplicate_field(
3063                                    "multiple values for common_object_request_params",
3064                                ));
3065                            }
3066                            result.common_object_request_params = map.next_value::<std::option::Option<crate::model::CommonObjectRequestParams>>()?
3067                                ;
3068                        }
3069                        __FieldTag::Unknown(key) => {
3070                            let value = map.next_value::<serde_json::Value>()?;
3071                            result._unknown_fields.insert(key, value);
3072                        }
3073                    }
3074                }
3075                std::result::Result::Ok(result)
3076            }
3077        }
3078        deserializer.deserialize_any(Visitor)
3079    }
3080}
3081
3082#[doc(hidden)]
3083impl serde::ser::Serialize for DeleteObjectRequest {
3084    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
3085    where
3086        S: serde::ser::Serializer,
3087    {
3088        use serde::ser::SerializeMap;
3089        #[allow(unused_imports)]
3090        use std::option::Option::Some;
3091        let mut state = serializer.serialize_map(std::option::Option::None)?;
3092        if !self.bucket.is_empty() {
3093            state.serialize_entry("bucket", &self.bucket)?;
3094        }
3095        if !self.object.is_empty() {
3096            state.serialize_entry("object", &self.object)?;
3097        }
3098        if !wkt::internal::is_default(&self.generation) {
3099            struct __With<'a>(&'a i64);
3100            impl<'a> serde::ser::Serialize for __With<'a> {
3101                fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
3102                where
3103                    S: serde::ser::Serializer,
3104                {
3105                    serde_with::As::<wkt::internal::I64>::serialize(self.0, serializer)
3106                }
3107            }
3108            state.serialize_entry("generation", &__With(&self.generation))?;
3109        }
3110        if self.if_generation_match.is_some() {
3111            struct __With<'a>(&'a std::option::Option<i64>);
3112            impl<'a> serde::ser::Serialize for __With<'a> {
3113                fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
3114                where
3115                    S: serde::ser::Serializer,
3116                {
3117                    serde_with::As::<std::option::Option<wkt::internal::I64>>::serialize(
3118                        self.0, serializer,
3119                    )
3120                }
3121            }
3122            state.serialize_entry("ifGenerationMatch", &__With(&self.if_generation_match))?;
3123        }
3124        if self.if_generation_not_match.is_some() {
3125            struct __With<'a>(&'a std::option::Option<i64>);
3126            impl<'a> serde::ser::Serialize for __With<'a> {
3127                fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
3128                where
3129                    S: serde::ser::Serializer,
3130                {
3131                    serde_with::As::<std::option::Option<wkt::internal::I64>>::serialize(
3132                        self.0, serializer,
3133                    )
3134                }
3135            }
3136            state.serialize_entry(
3137                "ifGenerationNotMatch",
3138                &__With(&self.if_generation_not_match),
3139            )?;
3140        }
3141        if self.if_metageneration_match.is_some() {
3142            struct __With<'a>(&'a std::option::Option<i64>);
3143            impl<'a> serde::ser::Serialize for __With<'a> {
3144                fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
3145                where
3146                    S: serde::ser::Serializer,
3147                {
3148                    serde_with::As::<std::option::Option<wkt::internal::I64>>::serialize(
3149                        self.0, serializer,
3150                    )
3151                }
3152            }
3153            state.serialize_entry(
3154                "ifMetagenerationMatch",
3155                &__With(&self.if_metageneration_match),
3156            )?;
3157        }
3158        if self.if_metageneration_not_match.is_some() {
3159            struct __With<'a>(&'a std::option::Option<i64>);
3160            impl<'a> serde::ser::Serialize for __With<'a> {
3161                fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
3162                where
3163                    S: serde::ser::Serializer,
3164                {
3165                    serde_with::As::<std::option::Option<wkt::internal::I64>>::serialize(
3166                        self.0, serializer,
3167                    )
3168                }
3169            }
3170            state.serialize_entry(
3171                "ifMetagenerationNotMatch",
3172                &__With(&self.if_metageneration_not_match),
3173            )?;
3174        }
3175        if self.common_object_request_params.is_some() {
3176            state.serialize_entry(
3177                "commonObjectRequestParams",
3178                &self.common_object_request_params,
3179            )?;
3180        }
3181        if !self._unknown_fields.is_empty() {
3182            for (key, value) in self._unknown_fields.iter() {
3183                state.serialize_entry(key, &value)?;
3184            }
3185        }
3186        state.end()
3187    }
3188}
3189
3190/// Message for restoring an object.
3191/// `bucket`, `object`, and `generation` **must** be set.
3192#[derive(Clone, Debug, Default, PartialEq)]
3193#[non_exhaustive]
3194pub struct RestoreObjectRequest {
3195    /// Required. Name of the bucket in which the object resides.
3196    pub bucket: std::string::String,
3197
3198    /// Required. The name of the object to restore.
3199    pub object: std::string::String,
3200
3201    /// Required. The specific revision of the object to restore.
3202    pub generation: i64,
3203
3204    /// Optional. Restore token used to differentiate soft-deleted objects with the
3205    /// same name and generation. Only applicable for hierarchical namespace
3206    /// buckets. This parameter is optional, and is only required in the rare case
3207    /// when there are multiple soft-deleted objects with the same name and
3208    /// generation.
3209    pub restore_token: std::string::String,
3210
3211    /// Makes the operation conditional on whether the object's current generation
3212    /// matches the given value. Setting to 0 makes the operation succeed only if
3213    /// there are no live versions of the object.
3214    pub if_generation_match: std::option::Option<i64>,
3215
3216    /// Makes the operation conditional on whether the object's live generation
3217    /// does not match the given value. If no live object exists, the precondition
3218    /// fails. Setting to 0 makes the operation succeed only if there is a live
3219    /// version of the object.
3220    pub if_generation_not_match: std::option::Option<i64>,
3221
3222    /// Makes the operation conditional on whether the object's current
3223    /// metageneration matches the given value.
3224    pub if_metageneration_match: std::option::Option<i64>,
3225
3226    /// Makes the operation conditional on whether the object's current
3227    /// metageneration does not match the given value.
3228    pub if_metageneration_not_match: std::option::Option<i64>,
3229
3230    /// If false or unset, the bucket's default object ACL will be used.
3231    /// If true, copy the source object's access controls.
3232    /// Return an error if bucket has UBLA enabled.
3233    pub copy_source_acl: std::option::Option<bool>,
3234
3235    /// Optional. A set of parameters common to Storage API requests concerning an
3236    /// object.
3237    pub common_object_request_params: std::option::Option<crate::model::CommonObjectRequestParams>,
3238
3239    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3240}
3241
3242impl RestoreObjectRequest {
3243    pub fn new() -> Self {
3244        std::default::Default::default()
3245    }
3246
3247    /// Sets the value of [bucket][crate::model::RestoreObjectRequest::bucket].
3248    pub fn set_bucket<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3249        self.bucket = v.into();
3250        self
3251    }
3252
3253    /// Sets the value of [object][crate::model::RestoreObjectRequest::object].
3254    pub fn set_object<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3255        self.object = v.into();
3256        self
3257    }
3258
3259    /// Sets the value of [generation][crate::model::RestoreObjectRequest::generation].
3260    pub fn set_generation<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
3261        self.generation = v.into();
3262        self
3263    }
3264
3265    /// Sets the value of [restore_token][crate::model::RestoreObjectRequest::restore_token].
3266    pub fn set_restore_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3267        self.restore_token = v.into();
3268        self
3269    }
3270
3271    /// Sets the value of [if_generation_match][crate::model::RestoreObjectRequest::if_generation_match].
3272    pub fn set_if_generation_match<T>(mut self, v: T) -> Self
3273    where
3274        T: std::convert::Into<i64>,
3275    {
3276        self.if_generation_match = std::option::Option::Some(v.into());
3277        self
3278    }
3279
3280    /// Sets or clears the value of [if_generation_match][crate::model::RestoreObjectRequest::if_generation_match].
3281    pub fn set_or_clear_if_generation_match<T>(mut self, v: std::option::Option<T>) -> Self
3282    where
3283        T: std::convert::Into<i64>,
3284    {
3285        self.if_generation_match = v.map(|x| x.into());
3286        self
3287    }
3288
3289    /// Sets the value of [if_generation_not_match][crate::model::RestoreObjectRequest::if_generation_not_match].
3290    pub fn set_if_generation_not_match<T>(mut self, v: T) -> Self
3291    where
3292        T: std::convert::Into<i64>,
3293    {
3294        self.if_generation_not_match = std::option::Option::Some(v.into());
3295        self
3296    }
3297
3298    /// Sets or clears the value of [if_generation_not_match][crate::model::RestoreObjectRequest::if_generation_not_match].
3299    pub fn set_or_clear_if_generation_not_match<T>(mut self, v: std::option::Option<T>) -> Self
3300    where
3301        T: std::convert::Into<i64>,
3302    {
3303        self.if_generation_not_match = v.map(|x| x.into());
3304        self
3305    }
3306
3307    /// Sets the value of [if_metageneration_match][crate::model::RestoreObjectRequest::if_metageneration_match].
3308    pub fn set_if_metageneration_match<T>(mut self, v: T) -> Self
3309    where
3310        T: std::convert::Into<i64>,
3311    {
3312        self.if_metageneration_match = std::option::Option::Some(v.into());
3313        self
3314    }
3315
3316    /// Sets or clears the value of [if_metageneration_match][crate::model::RestoreObjectRequest::if_metageneration_match].
3317    pub fn set_or_clear_if_metageneration_match<T>(mut self, v: std::option::Option<T>) -> Self
3318    where
3319        T: std::convert::Into<i64>,
3320    {
3321        self.if_metageneration_match = v.map(|x| x.into());
3322        self
3323    }
3324
3325    /// Sets the value of [if_metageneration_not_match][crate::model::RestoreObjectRequest::if_metageneration_not_match].
3326    pub fn set_if_metageneration_not_match<T>(mut self, v: T) -> Self
3327    where
3328        T: std::convert::Into<i64>,
3329    {
3330        self.if_metageneration_not_match = std::option::Option::Some(v.into());
3331        self
3332    }
3333
3334    /// Sets or clears the value of [if_metageneration_not_match][crate::model::RestoreObjectRequest::if_metageneration_not_match].
3335    pub fn set_or_clear_if_metageneration_not_match<T>(mut self, v: std::option::Option<T>) -> Self
3336    where
3337        T: std::convert::Into<i64>,
3338    {
3339        self.if_metageneration_not_match = v.map(|x| x.into());
3340        self
3341    }
3342
3343    /// Sets the value of [copy_source_acl][crate::model::RestoreObjectRequest::copy_source_acl].
3344    pub fn set_copy_source_acl<T>(mut self, v: T) -> Self
3345    where
3346        T: std::convert::Into<bool>,
3347    {
3348        self.copy_source_acl = std::option::Option::Some(v.into());
3349        self
3350    }
3351
3352    /// Sets or clears the value of [copy_source_acl][crate::model::RestoreObjectRequest::copy_source_acl].
3353    pub fn set_or_clear_copy_source_acl<T>(mut self, v: std::option::Option<T>) -> Self
3354    where
3355        T: std::convert::Into<bool>,
3356    {
3357        self.copy_source_acl = v.map(|x| x.into());
3358        self
3359    }
3360
3361    /// Sets the value of [common_object_request_params][crate::model::RestoreObjectRequest::common_object_request_params].
3362    pub fn set_common_object_request_params<T>(mut self, v: T) -> Self
3363    where
3364        T: std::convert::Into<crate::model::CommonObjectRequestParams>,
3365    {
3366        self.common_object_request_params = std::option::Option::Some(v.into());
3367        self
3368    }
3369
3370    /// Sets or clears the value of [common_object_request_params][crate::model::RestoreObjectRequest::common_object_request_params].
3371    pub fn set_or_clear_common_object_request_params<T>(mut self, v: std::option::Option<T>) -> Self
3372    where
3373        T: std::convert::Into<crate::model::CommonObjectRequestParams>,
3374    {
3375        self.common_object_request_params = v.map(|x| x.into());
3376        self
3377    }
3378}
3379
3380impl wkt::message::Message for RestoreObjectRequest {
3381    fn typename() -> &'static str {
3382        "type.googleapis.com/google.storage.v2.RestoreObjectRequest"
3383    }
3384}
3385
3386#[doc(hidden)]
3387impl<'de> serde::de::Deserialize<'de> for RestoreObjectRequest {
3388    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
3389    where
3390        D: serde::Deserializer<'de>,
3391    {
3392        #[allow(non_camel_case_types)]
3393        #[doc(hidden)]
3394        #[derive(PartialEq, Eq, Hash)]
3395        enum __FieldTag {
3396            __bucket,
3397            __object,
3398            __generation,
3399            __restore_token,
3400            __if_generation_match,
3401            __if_generation_not_match,
3402            __if_metageneration_match,
3403            __if_metageneration_not_match,
3404            __copy_source_acl,
3405            __common_object_request_params,
3406            Unknown(std::string::String),
3407        }
3408        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
3409            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
3410            where
3411                D: serde::Deserializer<'de>,
3412            {
3413                struct Visitor;
3414                impl<'de> serde::de::Visitor<'de> for Visitor {
3415                    type Value = __FieldTag;
3416                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
3417                        formatter.write_str("a field name for RestoreObjectRequest")
3418                    }
3419                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
3420                    where
3421                        E: serde::de::Error,
3422                    {
3423                        use std::result::Result::Ok;
3424                        use std::string::ToString;
3425                        match value {
3426                            "bucket" => Ok(__FieldTag::__bucket),
3427                            "object" => Ok(__FieldTag::__object),
3428                            "generation" => Ok(__FieldTag::__generation),
3429                            "restoreToken" => Ok(__FieldTag::__restore_token),
3430                            "restore_token" => Ok(__FieldTag::__restore_token),
3431                            "ifGenerationMatch" => Ok(__FieldTag::__if_generation_match),
3432                            "if_generation_match" => Ok(__FieldTag::__if_generation_match),
3433                            "ifGenerationNotMatch" => Ok(__FieldTag::__if_generation_not_match),
3434                            "if_generation_not_match" => Ok(__FieldTag::__if_generation_not_match),
3435                            "ifMetagenerationMatch" => Ok(__FieldTag::__if_metageneration_match),
3436                            "if_metageneration_match" => Ok(__FieldTag::__if_metageneration_match),
3437                            "ifMetagenerationNotMatch" => {
3438                                Ok(__FieldTag::__if_metageneration_not_match)
3439                            }
3440                            "if_metageneration_not_match" => {
3441                                Ok(__FieldTag::__if_metageneration_not_match)
3442                            }
3443                            "copySourceAcl" => Ok(__FieldTag::__copy_source_acl),
3444                            "copy_source_acl" => Ok(__FieldTag::__copy_source_acl),
3445                            "commonObjectRequestParams" => {
3446                                Ok(__FieldTag::__common_object_request_params)
3447                            }
3448                            "common_object_request_params" => {
3449                                Ok(__FieldTag::__common_object_request_params)
3450                            }
3451                            _ => Ok(__FieldTag::Unknown(value.to_string())),
3452                        }
3453                    }
3454                }
3455                deserializer.deserialize_identifier(Visitor)
3456            }
3457        }
3458        struct Visitor;
3459        impl<'de> serde::de::Visitor<'de> for Visitor {
3460            type Value = RestoreObjectRequest;
3461            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
3462                formatter.write_str("struct RestoreObjectRequest")
3463            }
3464            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
3465            where
3466                A: serde::de::MapAccess<'de>,
3467            {
3468                #[allow(unused_imports)]
3469                use serde::de::Error;
3470                use std::option::Option::Some;
3471                let mut fields = std::collections::HashSet::new();
3472                let mut result = Self::Value::new();
3473                while let Some(tag) = map.next_key::<__FieldTag>()? {
3474                    #[allow(clippy::match_single_binding)]
3475                    match tag {
3476                        __FieldTag::__bucket => {
3477                            if !fields.insert(__FieldTag::__bucket) {
3478                                return std::result::Result::Err(A::Error::duplicate_field(
3479                                    "multiple values for bucket",
3480                                ));
3481                            }
3482                            result.bucket = map
3483                                .next_value::<std::option::Option<std::string::String>>()?
3484                                .unwrap_or_default();
3485                        }
3486                        __FieldTag::__object => {
3487                            if !fields.insert(__FieldTag::__object) {
3488                                return std::result::Result::Err(A::Error::duplicate_field(
3489                                    "multiple values for object",
3490                                ));
3491                            }
3492                            result.object = map
3493                                .next_value::<std::option::Option<std::string::String>>()?
3494                                .unwrap_or_default();
3495                        }
3496                        __FieldTag::__generation => {
3497                            if !fields.insert(__FieldTag::__generation) {
3498                                return std::result::Result::Err(A::Error::duplicate_field(
3499                                    "multiple values for generation",
3500                                ));
3501                            }
3502                            struct __With(std::option::Option<i64>);
3503                            impl<'de> serde::de::Deserialize<'de> for __With {
3504                                fn deserialize<D>(
3505                                    deserializer: D,
3506                                ) -> std::result::Result<Self, D::Error>
3507                                where
3508                                    D: serde::de::Deserializer<'de>,
3509                                {
3510                                    serde_with::As::< std::option::Option<wkt::internal::I64> >::deserialize(deserializer).map(__With)
3511                                }
3512                            }
3513                            result.generation = map.next_value::<__With>()?.0.unwrap_or_default();
3514                        }
3515                        __FieldTag::__restore_token => {
3516                            if !fields.insert(__FieldTag::__restore_token) {
3517                                return std::result::Result::Err(A::Error::duplicate_field(
3518                                    "multiple values for restore_token",
3519                                ));
3520                            }
3521                            result.restore_token = map
3522                                .next_value::<std::option::Option<std::string::String>>()?
3523                                .unwrap_or_default();
3524                        }
3525                        __FieldTag::__if_generation_match => {
3526                            if !fields.insert(__FieldTag::__if_generation_match) {
3527                                return std::result::Result::Err(A::Error::duplicate_field(
3528                                    "multiple values for if_generation_match",
3529                                ));
3530                            }
3531                            struct __With(std::option::Option<i64>);
3532                            impl<'de> serde::de::Deserialize<'de> for __With {
3533                                fn deserialize<D>(
3534                                    deserializer: D,
3535                                ) -> std::result::Result<Self, D::Error>
3536                                where
3537                                    D: serde::de::Deserializer<'de>,
3538                                {
3539                                    serde_with::As::< std::option::Option<wkt::internal::I64> >::deserialize(deserializer).map(__With)
3540                                }
3541                            }
3542                            result.if_generation_match = map.next_value::<__With>()?.0;
3543                        }
3544                        __FieldTag::__if_generation_not_match => {
3545                            if !fields.insert(__FieldTag::__if_generation_not_match) {
3546                                return std::result::Result::Err(A::Error::duplicate_field(
3547                                    "multiple values for if_generation_not_match",
3548                                ));
3549                            }
3550                            struct __With(std::option::Option<i64>);
3551                            impl<'de> serde::de::Deserialize<'de> for __With {
3552                                fn deserialize<D>(
3553                                    deserializer: D,
3554                                ) -> std::result::Result<Self, D::Error>
3555                                where
3556                                    D: serde::de::Deserializer<'de>,
3557                                {
3558                                    serde_with::As::< std::option::Option<wkt::internal::I64> >::deserialize(deserializer).map(__With)
3559                                }
3560                            }
3561                            result.if_generation_not_match = map.next_value::<__With>()?.0;
3562                        }
3563                        __FieldTag::__if_metageneration_match => {
3564                            if !fields.insert(__FieldTag::__if_metageneration_match) {
3565                                return std::result::Result::Err(A::Error::duplicate_field(
3566                                    "multiple values for if_metageneration_match",
3567                                ));
3568                            }
3569                            struct __With(std::option::Option<i64>);
3570                            impl<'de> serde::de::Deserialize<'de> for __With {
3571                                fn deserialize<D>(
3572                                    deserializer: D,
3573                                ) -> std::result::Result<Self, D::Error>
3574                                where
3575                                    D: serde::de::Deserializer<'de>,
3576                                {
3577                                    serde_with::As::< std::option::Option<wkt::internal::I64> >::deserialize(deserializer).map(__With)
3578                                }
3579                            }
3580                            result.if_metageneration_match = map.next_value::<__With>()?.0;
3581                        }
3582                        __FieldTag::__if_metageneration_not_match => {
3583                            if !fields.insert(__FieldTag::__if_metageneration_not_match) {
3584                                return std::result::Result::Err(A::Error::duplicate_field(
3585                                    "multiple values for if_metageneration_not_match",
3586                                ));
3587                            }
3588                            struct __With(std::option::Option<i64>);
3589                            impl<'de> serde::de::Deserialize<'de> for __With {
3590                                fn deserialize<D>(
3591                                    deserializer: D,
3592                                ) -> std::result::Result<Self, D::Error>
3593                                where
3594                                    D: serde::de::Deserializer<'de>,
3595                                {
3596                                    serde_with::As::< std::option::Option<wkt::internal::I64> >::deserialize(deserializer).map(__With)
3597                                }
3598                            }
3599                            result.if_metageneration_not_match = map.next_value::<__With>()?.0;
3600                        }
3601                        __FieldTag::__copy_source_acl => {
3602                            if !fields.insert(__FieldTag::__copy_source_acl) {
3603                                return std::result::Result::Err(A::Error::duplicate_field(
3604                                    "multiple values for copy_source_acl",
3605                                ));
3606                            }
3607                            result.copy_source_acl =
3608                                map.next_value::<std::option::Option<bool>>()?;
3609                        }
3610                        __FieldTag::__common_object_request_params => {
3611                            if !fields.insert(__FieldTag::__common_object_request_params) {
3612                                return std::result::Result::Err(A::Error::duplicate_field(
3613                                    "multiple values for common_object_request_params",
3614                                ));
3615                            }
3616                            result.common_object_request_params = map.next_value::<std::option::Option<crate::model::CommonObjectRequestParams>>()?
3617                                ;
3618                        }
3619                        __FieldTag::Unknown(key) => {
3620                            let value = map.next_value::<serde_json::Value>()?;
3621                            result._unknown_fields.insert(key, value);
3622                        }
3623                    }
3624                }
3625                std::result::Result::Ok(result)
3626            }
3627        }
3628        deserializer.deserialize_any(Visitor)
3629    }
3630}
3631
3632#[doc(hidden)]
3633impl serde::ser::Serialize for RestoreObjectRequest {
3634    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
3635    where
3636        S: serde::ser::Serializer,
3637    {
3638        use serde::ser::SerializeMap;
3639        #[allow(unused_imports)]
3640        use std::option::Option::Some;
3641        let mut state = serializer.serialize_map(std::option::Option::None)?;
3642        if !self.bucket.is_empty() {
3643            state.serialize_entry("bucket", &self.bucket)?;
3644        }
3645        if !self.object.is_empty() {
3646            state.serialize_entry("object", &self.object)?;
3647        }
3648        if !wkt::internal::is_default(&self.generation) {
3649            struct __With<'a>(&'a i64);
3650            impl<'a> serde::ser::Serialize for __With<'a> {
3651                fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
3652                where
3653                    S: serde::ser::Serializer,
3654                {
3655                    serde_with::As::<wkt::internal::I64>::serialize(self.0, serializer)
3656                }
3657            }
3658            state.serialize_entry("generation", &__With(&self.generation))?;
3659        }
3660        if !self.restore_token.is_empty() {
3661            state.serialize_entry("restoreToken", &self.restore_token)?;
3662        }
3663        if self.if_generation_match.is_some() {
3664            struct __With<'a>(&'a std::option::Option<i64>);
3665            impl<'a> serde::ser::Serialize for __With<'a> {
3666                fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
3667                where
3668                    S: serde::ser::Serializer,
3669                {
3670                    serde_with::As::<std::option::Option<wkt::internal::I64>>::serialize(
3671                        self.0, serializer,
3672                    )
3673                }
3674            }
3675            state.serialize_entry("ifGenerationMatch", &__With(&self.if_generation_match))?;
3676        }
3677        if self.if_generation_not_match.is_some() {
3678            struct __With<'a>(&'a std::option::Option<i64>);
3679            impl<'a> serde::ser::Serialize for __With<'a> {
3680                fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
3681                where
3682                    S: serde::ser::Serializer,
3683                {
3684                    serde_with::As::<std::option::Option<wkt::internal::I64>>::serialize(
3685                        self.0, serializer,
3686                    )
3687                }
3688            }
3689            state.serialize_entry(
3690                "ifGenerationNotMatch",
3691                &__With(&self.if_generation_not_match),
3692            )?;
3693        }
3694        if self.if_metageneration_match.is_some() {
3695            struct __With<'a>(&'a std::option::Option<i64>);
3696            impl<'a> serde::ser::Serialize for __With<'a> {
3697                fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
3698                where
3699                    S: serde::ser::Serializer,
3700                {
3701                    serde_with::As::<std::option::Option<wkt::internal::I64>>::serialize(
3702                        self.0, serializer,
3703                    )
3704                }
3705            }
3706            state.serialize_entry(
3707                "ifMetagenerationMatch",
3708                &__With(&self.if_metageneration_match),
3709            )?;
3710        }
3711        if self.if_metageneration_not_match.is_some() {
3712            struct __With<'a>(&'a std::option::Option<i64>);
3713            impl<'a> serde::ser::Serialize for __With<'a> {
3714                fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
3715                where
3716                    S: serde::ser::Serializer,
3717                {
3718                    serde_with::As::<std::option::Option<wkt::internal::I64>>::serialize(
3719                        self.0, serializer,
3720                    )
3721                }
3722            }
3723            state.serialize_entry(
3724                "ifMetagenerationNotMatch",
3725                &__With(&self.if_metageneration_not_match),
3726            )?;
3727        }
3728        if self.copy_source_acl.is_some() {
3729            state.serialize_entry("copySourceAcl", &self.copy_source_acl)?;
3730        }
3731        if self.common_object_request_params.is_some() {
3732            state.serialize_entry(
3733                "commonObjectRequestParams",
3734                &self.common_object_request_params,
3735            )?;
3736        }
3737        if !self._unknown_fields.is_empty() {
3738            for (key, value) in self._unknown_fields.iter() {
3739                state.serialize_entry(key, &value)?;
3740            }
3741        }
3742        state.end()
3743    }
3744}
3745
3746/// Request message for ReadObject.
3747#[derive(Clone, Debug, Default, PartialEq)]
3748#[non_exhaustive]
3749pub(crate) struct ReadObjectRequest {
3750    /// Required. The name of the bucket containing the object to read.
3751    pub bucket: std::string::String,
3752
3753    /// Required. The name of the object to read.
3754    pub object: std::string::String,
3755
3756    /// Optional. If present, selects a specific revision of this object (as
3757    /// opposed to the latest version, the default).
3758    pub generation: i64,
3759
3760    /// Optional. The offset for the first byte to return in the read, relative to
3761    /// the start of the object.
3762    ///
3763    /// A negative `read_offset` value will be interpreted as the number of bytes
3764    /// back from the end of the object to be returned. For example, if an object's
3765    /// length is 15 bytes, a ReadObjectRequest with `read_offset` = -5 and
3766    /// `read_limit` = 3 would return bytes 10 through 12 of the object. Requesting
3767    /// a negative offset with magnitude larger than the size of the object will
3768    /// return the entire object.
3769    pub read_offset: i64,
3770
3771    /// Optional. The maximum number of `data` bytes the server is allowed to
3772    /// return in the sum of all `Object` messages. A `read_limit` of zero
3773    /// indicates that there is no limit, and a negative `read_limit` will cause an
3774    /// error.
3775    ///
3776    /// If the stream returns fewer bytes than allowed by the `read_limit` and no
3777    /// error occurred, the stream includes all data from the `read_offset` to the
3778    /// end of the resource.
3779    pub read_limit: i64,
3780
3781    /// Makes the operation conditional on whether the object's current generation
3782    /// matches the given value. Setting to 0 makes the operation succeed only if
3783    /// there are no live versions of the object.
3784    pub if_generation_match: std::option::Option<i64>,
3785
3786    /// Makes the operation conditional on whether the object's live generation
3787    /// does not match the given value. If no live object exists, the precondition
3788    /// fails. Setting to 0 makes the operation succeed only if there is a live
3789    /// version of the object.
3790    pub if_generation_not_match: std::option::Option<i64>,
3791
3792    /// Makes the operation conditional on whether the object's current
3793    /// metageneration matches the given value.
3794    pub if_metageneration_match: std::option::Option<i64>,
3795
3796    /// Makes the operation conditional on whether the object's current
3797    /// metageneration does not match the given value.
3798    pub if_metageneration_not_match: std::option::Option<i64>,
3799
3800    /// Optional. A set of parameters common to Storage API requests concerning an
3801    /// object.
3802    pub common_object_request_params: std::option::Option<crate::model::CommonObjectRequestParams>,
3803
3804    /// Mask specifying which fields to read.
3805    /// The checksummed_data field and its children will always be present.
3806    /// If no mask is specified, will default to all fields except metadata.owner
3807    /// and metadata.acl.
3808    ///
3809    /// * may be used to mean "all fields".
3810    pub read_mask: std::option::Option<wkt::FieldMask>,
3811
3812    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3813}
3814
3815impl ReadObjectRequest {
3816    pub fn new() -> Self {
3817        std::default::Default::default()
3818    }
3819
3820    /// Sets the value of [bucket][crate::model::ReadObjectRequest::bucket].
3821    pub fn set_bucket<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3822        self.bucket = v.into();
3823        self
3824    }
3825
3826    /// Sets the value of [object][crate::model::ReadObjectRequest::object].
3827    pub fn set_object<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3828        self.object = v.into();
3829        self
3830    }
3831
3832    /// Sets the value of [generation][crate::model::ReadObjectRequest::generation].
3833    pub fn set_generation<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
3834        self.generation = v.into();
3835        self
3836    }
3837
3838    /// Sets the value of [read_offset][crate::model::ReadObjectRequest::read_offset].
3839    pub fn set_read_offset<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
3840        self.read_offset = v.into();
3841        self
3842    }
3843
3844    /// Sets the value of [read_limit][crate::model::ReadObjectRequest::read_limit].
3845    pub fn set_read_limit<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
3846        self.read_limit = v.into();
3847        self
3848    }
3849
3850    /// Sets the value of [if_generation_match][crate::model::ReadObjectRequest::if_generation_match].
3851    pub fn set_if_generation_match<T>(mut self, v: T) -> Self
3852    where
3853        T: std::convert::Into<i64>,
3854    {
3855        self.if_generation_match = std::option::Option::Some(v.into());
3856        self
3857    }
3858
3859    /// Sets or clears the value of [if_generation_match][crate::model::ReadObjectRequest::if_generation_match].
3860    pub fn set_or_clear_if_generation_match<T>(mut self, v: std::option::Option<T>) -> Self
3861    where
3862        T: std::convert::Into<i64>,
3863    {
3864        self.if_generation_match = v.map(|x| x.into());
3865        self
3866    }
3867
3868    /// Sets the value of [if_generation_not_match][crate::model::ReadObjectRequest::if_generation_not_match].
3869    pub fn set_if_generation_not_match<T>(mut self, v: T) -> Self
3870    where
3871        T: std::convert::Into<i64>,
3872    {
3873        self.if_generation_not_match = std::option::Option::Some(v.into());
3874        self
3875    }
3876
3877    /// Sets or clears the value of [if_generation_not_match][crate::model::ReadObjectRequest::if_generation_not_match].
3878    pub fn set_or_clear_if_generation_not_match<T>(mut self, v: std::option::Option<T>) -> Self
3879    where
3880        T: std::convert::Into<i64>,
3881    {
3882        self.if_generation_not_match = v.map(|x| x.into());
3883        self
3884    }
3885
3886    /// Sets the value of [if_metageneration_match][crate::model::ReadObjectRequest::if_metageneration_match].
3887    pub fn set_if_metageneration_match<T>(mut self, v: T) -> Self
3888    where
3889        T: std::convert::Into<i64>,
3890    {
3891        self.if_metageneration_match = std::option::Option::Some(v.into());
3892        self
3893    }
3894
3895    /// Sets or clears the value of [if_metageneration_match][crate::model::ReadObjectRequest::if_metageneration_match].
3896    pub fn set_or_clear_if_metageneration_match<T>(mut self, v: std::option::Option<T>) -> Self
3897    where
3898        T: std::convert::Into<i64>,
3899    {
3900        self.if_metageneration_match = v.map(|x| x.into());
3901        self
3902    }
3903
3904    /// Sets the value of [if_metageneration_not_match][crate::model::ReadObjectRequest::if_metageneration_not_match].
3905    pub fn set_if_metageneration_not_match<T>(mut self, v: T) -> Self
3906    where
3907        T: std::convert::Into<i64>,
3908    {
3909        self.if_metageneration_not_match = std::option::Option::Some(v.into());
3910        self
3911    }
3912
3913    /// Sets or clears the value of [if_metageneration_not_match][crate::model::ReadObjectRequest::if_metageneration_not_match].
3914    pub fn set_or_clear_if_metageneration_not_match<T>(mut self, v: std::option::Option<T>) -> Self
3915    where
3916        T: std::convert::Into<i64>,
3917    {
3918        self.if_metageneration_not_match = v.map(|x| x.into());
3919        self
3920    }
3921
3922    /// Sets the value of [common_object_request_params][crate::model::ReadObjectRequest::common_object_request_params].
3923    pub fn set_common_object_request_params<T>(mut self, v: T) -> Self
3924    where
3925        T: std::convert::Into<crate::model::CommonObjectRequestParams>,
3926    {
3927        self.common_object_request_params = std::option::Option::Some(v.into());
3928        self
3929    }
3930
3931    /// Sets or clears the value of [common_object_request_params][crate::model::ReadObjectRequest::common_object_request_params].
3932    pub fn set_or_clear_common_object_request_params<T>(mut self, v: std::option::Option<T>) -> Self
3933    where
3934        T: std::convert::Into<crate::model::CommonObjectRequestParams>,
3935    {
3936        self.common_object_request_params = v.map(|x| x.into());
3937        self
3938    }
3939
3940    /// Sets the value of [read_mask][crate::model::ReadObjectRequest::read_mask].
3941    pub fn set_read_mask<T>(mut self, v: T) -> Self
3942    where
3943        T: std::convert::Into<wkt::FieldMask>,
3944    {
3945        self.read_mask = std::option::Option::Some(v.into());
3946        self
3947    }
3948
3949    /// Sets or clears the value of [read_mask][crate::model::ReadObjectRequest::read_mask].
3950    pub fn set_or_clear_read_mask<T>(mut self, v: std::option::Option<T>) -> Self
3951    where
3952        T: std::convert::Into<wkt::FieldMask>,
3953    {
3954        self.read_mask = v.map(|x| x.into());
3955        self
3956    }
3957}
3958
3959impl wkt::message::Message for ReadObjectRequest {
3960    fn typename() -> &'static str {
3961        "type.googleapis.com/google.storage.v2.ReadObjectRequest"
3962    }
3963}
3964
3965#[doc(hidden)]
3966impl<'de> serde::de::Deserialize<'de> for ReadObjectRequest {
3967    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
3968    where
3969        D: serde::Deserializer<'de>,
3970    {
3971        #[allow(non_camel_case_types)]
3972        #[doc(hidden)]
3973        #[derive(PartialEq, Eq, Hash)]
3974        enum __FieldTag {
3975            __bucket,
3976            __object,
3977            __generation,
3978            __read_offset,
3979            __read_limit,
3980            __if_generation_match,
3981            __if_generation_not_match,
3982            __if_metageneration_match,
3983            __if_metageneration_not_match,
3984            __common_object_request_params,
3985            __read_mask,
3986            Unknown(std::string::String),
3987        }
3988        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
3989            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
3990            where
3991                D: serde::Deserializer<'de>,
3992            {
3993                struct Visitor;
3994                impl<'de> serde::de::Visitor<'de> for Visitor {
3995                    type Value = __FieldTag;
3996                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
3997                        formatter.write_str("a field name for ReadObjectRequest")
3998                    }
3999                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
4000                    where
4001                        E: serde::de::Error,
4002                    {
4003                        use std::result::Result::Ok;
4004                        use std::string::ToString;
4005                        match value {
4006                            "bucket" => Ok(__FieldTag::__bucket),
4007                            "object" => Ok(__FieldTag::__object),
4008                            "generation" => Ok(__FieldTag::__generation),
4009                            "readOffset" => Ok(__FieldTag::__read_offset),
4010                            "read_offset" => Ok(__FieldTag::__read_offset),
4011                            "readLimit" => Ok(__FieldTag::__read_limit),
4012                            "read_limit" => Ok(__FieldTag::__read_limit),
4013                            "ifGenerationMatch" => Ok(__FieldTag::__if_generation_match),
4014                            "if_generation_match" => Ok(__FieldTag::__if_generation_match),
4015                            "ifGenerationNotMatch" => Ok(__FieldTag::__if_generation_not_match),
4016                            "if_generation_not_match" => Ok(__FieldTag::__if_generation_not_match),
4017                            "ifMetagenerationMatch" => Ok(__FieldTag::__if_metageneration_match),
4018                            "if_metageneration_match" => Ok(__FieldTag::__if_metageneration_match),
4019                            "ifMetagenerationNotMatch" => {
4020                                Ok(__FieldTag::__if_metageneration_not_match)
4021                            }
4022                            "if_metageneration_not_match" => {
4023                                Ok(__FieldTag::__if_metageneration_not_match)
4024                            }
4025                            "commonObjectRequestParams" => {
4026                                Ok(__FieldTag::__common_object_request_params)
4027                            }
4028                            "common_object_request_params" => {
4029                                Ok(__FieldTag::__common_object_request_params)
4030                            }
4031                            "readMask" => Ok(__FieldTag::__read_mask),
4032                            "read_mask" => Ok(__FieldTag::__read_mask),
4033                            _ => Ok(__FieldTag::Unknown(value.to_string())),
4034                        }
4035                    }
4036                }
4037                deserializer.deserialize_identifier(Visitor)
4038            }
4039        }
4040        struct Visitor;
4041        impl<'de> serde::de::Visitor<'de> for Visitor {
4042            type Value = ReadObjectRequest;
4043            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
4044                formatter.write_str("struct ReadObjectRequest")
4045            }
4046            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
4047            where
4048                A: serde::de::MapAccess<'de>,
4049            {
4050                #[allow(unused_imports)]
4051                use serde::de::Error;
4052                use std::option::Option::Some;
4053                let mut fields = std::collections::HashSet::new();
4054                let mut result = Self::Value::new();
4055                while let Some(tag) = map.next_key::<__FieldTag>()? {
4056                    #[allow(clippy::match_single_binding)]
4057                    match tag {
4058                        __FieldTag::__bucket => {
4059                            if !fields.insert(__FieldTag::__bucket) {
4060                                return std::result::Result::Err(A::Error::duplicate_field(
4061                                    "multiple values for bucket",
4062                                ));
4063                            }
4064                            result.bucket = map
4065                                .next_value::<std::option::Option<std::string::String>>()?
4066                                .unwrap_or_default();
4067                        }
4068                        __FieldTag::__object => {
4069                            if !fields.insert(__FieldTag::__object) {
4070                                return std::result::Result::Err(A::Error::duplicate_field(
4071                                    "multiple values for object",
4072                                ));
4073                            }
4074                            result.object = map
4075                                .next_value::<std::option::Option<std::string::String>>()?
4076                                .unwrap_or_default();
4077                        }
4078                        __FieldTag::__generation => {
4079                            if !fields.insert(__FieldTag::__generation) {
4080                                return std::result::Result::Err(A::Error::duplicate_field(
4081                                    "multiple values for generation",
4082                                ));
4083                            }
4084                            struct __With(std::option::Option<i64>);
4085                            impl<'de> serde::de::Deserialize<'de> for __With {
4086                                fn deserialize<D>(
4087                                    deserializer: D,
4088                                ) -> std::result::Result<Self, D::Error>
4089                                where
4090                                    D: serde::de::Deserializer<'de>,
4091                                {
4092                                    serde_with::As::< std::option::Option<wkt::internal::I64> >::deserialize(deserializer).map(__With)
4093                                }
4094                            }
4095                            result.generation = map.next_value::<__With>()?.0.unwrap_or_default();
4096                        }
4097                        __FieldTag::__read_offset => {
4098                            if !fields.insert(__FieldTag::__read_offset) {
4099                                return std::result::Result::Err(A::Error::duplicate_field(
4100                                    "multiple values for read_offset",
4101                                ));
4102                            }
4103                            struct __With(std::option::Option<i64>);
4104                            impl<'de> serde::de::Deserialize<'de> for __With {
4105                                fn deserialize<D>(
4106                                    deserializer: D,
4107                                ) -> std::result::Result<Self, D::Error>
4108                                where
4109                                    D: serde::de::Deserializer<'de>,
4110                                {
4111                                    serde_with::As::< std::option::Option<wkt::internal::I64> >::deserialize(deserializer).map(__With)
4112                                }
4113                            }
4114                            result.read_offset = map.next_value::<__With>()?.0.unwrap_or_default();
4115                        }
4116                        __FieldTag::__read_limit => {
4117                            if !fields.insert(__FieldTag::__read_limit) {
4118                                return std::result::Result::Err(A::Error::duplicate_field(
4119                                    "multiple values for read_limit",
4120                                ));
4121                            }
4122                            struct __With(std::option::Option<i64>);
4123                            impl<'de> serde::de::Deserialize<'de> for __With {
4124                                fn deserialize<D>(
4125                                    deserializer: D,
4126                                ) -> std::result::Result<Self, D::Error>
4127                                where
4128                                    D: serde::de::Deserializer<'de>,
4129                                {
4130                                    serde_with::As::< std::option::Option<wkt::internal::I64> >::deserialize(deserializer).map(__With)
4131                                }
4132                            }
4133                            result.read_limit = map.next_value::<__With>()?.0.unwrap_or_default();
4134                        }
4135                        __FieldTag::__if_generation_match => {
4136                            if !fields.insert(__FieldTag::__if_generation_match) {
4137                                return std::result::Result::Err(A::Error::duplicate_field(
4138                                    "multiple values for if_generation_match",
4139                                ));
4140                            }
4141                            struct __With(std::option::Option<i64>);
4142                            impl<'de> serde::de::Deserialize<'de> for __With {
4143                                fn deserialize<D>(
4144                                    deserializer: D,
4145                                ) -> std::result::Result<Self, D::Error>
4146                                where
4147                                    D: serde::de::Deserializer<'de>,
4148                                {
4149                                    serde_with::As::< std::option::Option<wkt::internal::I64> >::deserialize(deserializer).map(__With)
4150                                }
4151                            }
4152                            result.if_generation_match = map.next_value::<__With>()?.0;
4153                        }
4154                        __FieldTag::__if_generation_not_match => {
4155                            if !fields.insert(__FieldTag::__if_generation_not_match) {
4156                                return std::result::Result::Err(A::Error::duplicate_field(
4157                                    "multiple values for if_generation_not_match",
4158                                ));
4159                            }
4160                            struct __With(std::option::Option<i64>);
4161                            impl<'de> serde::de::Deserialize<'de> for __With {
4162                                fn deserialize<D>(
4163                                    deserializer: D,
4164                                ) -> std::result::Result<Self, D::Error>
4165                                where
4166                                    D: serde::de::Deserializer<'de>,
4167                                {
4168                                    serde_with::As::< std::option::Option<wkt::internal::I64> >::deserialize(deserializer).map(__With)
4169                                }
4170                            }
4171                            result.if_generation_not_match = map.next_value::<__With>()?.0;
4172                        }
4173                        __FieldTag::__if_metageneration_match => {
4174                            if !fields.insert(__FieldTag::__if_metageneration_match) {
4175                                return std::result::Result::Err(A::Error::duplicate_field(
4176                                    "multiple values for if_metageneration_match",
4177                                ));
4178                            }
4179                            struct __With(std::option::Option<i64>);
4180                            impl<'de> serde::de::Deserialize<'de> for __With {
4181                                fn deserialize<D>(
4182                                    deserializer: D,
4183                                ) -> std::result::Result<Self, D::Error>
4184                                where
4185                                    D: serde::de::Deserializer<'de>,
4186                                {
4187                                    serde_with::As::< std::option::Option<wkt::internal::I64> >::deserialize(deserializer).map(__With)
4188                                }
4189                            }
4190                            result.if_metageneration_match = map.next_value::<__With>()?.0;
4191                        }
4192                        __FieldTag::__if_metageneration_not_match => {
4193                            if !fields.insert(__FieldTag::__if_metageneration_not_match) {
4194                                return std::result::Result::Err(A::Error::duplicate_field(
4195                                    "multiple values for if_metageneration_not_match",
4196                                ));
4197                            }
4198                            struct __With(std::option::Option<i64>);
4199                            impl<'de> serde::de::Deserialize<'de> for __With {
4200                                fn deserialize<D>(
4201                                    deserializer: D,
4202                                ) -> std::result::Result<Self, D::Error>
4203                                where
4204                                    D: serde::de::Deserializer<'de>,
4205                                {
4206                                    serde_with::As::< std::option::Option<wkt::internal::I64> >::deserialize(deserializer).map(__With)
4207                                }
4208                            }
4209                            result.if_metageneration_not_match = map.next_value::<__With>()?.0;
4210                        }
4211                        __FieldTag::__common_object_request_params => {
4212                            if !fields.insert(__FieldTag::__common_object_request_params) {
4213                                return std::result::Result::Err(A::Error::duplicate_field(
4214                                    "multiple values for common_object_request_params",
4215                                ));
4216                            }
4217                            result.common_object_request_params = map.next_value::<std::option::Option<crate::model::CommonObjectRequestParams>>()?
4218                                ;
4219                        }
4220                        __FieldTag::__read_mask => {
4221                            if !fields.insert(__FieldTag::__read_mask) {
4222                                return std::result::Result::Err(A::Error::duplicate_field(
4223                                    "multiple values for read_mask",
4224                                ));
4225                            }
4226                            result.read_mask =
4227                                map.next_value::<std::option::Option<wkt::FieldMask>>()?;
4228                        }
4229                        __FieldTag::Unknown(key) => {
4230                            let value = map.next_value::<serde_json::Value>()?;
4231                            result._unknown_fields.insert(key, value);
4232                        }
4233                    }
4234                }
4235                std::result::Result::Ok(result)
4236            }
4237        }
4238        deserializer.deserialize_any(Visitor)
4239    }
4240}
4241
4242#[doc(hidden)]
4243impl serde::ser::Serialize for ReadObjectRequest {
4244    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
4245    where
4246        S: serde::ser::Serializer,
4247    {
4248        use serde::ser::SerializeMap;
4249        #[allow(unused_imports)]
4250        use std::option::Option::Some;
4251        let mut state = serializer.serialize_map(std::option::Option::None)?;
4252        if !self.bucket.is_empty() {
4253            state.serialize_entry("bucket", &self.bucket)?;
4254        }
4255        if !self.object.is_empty() {
4256            state.serialize_entry("object", &self.object)?;
4257        }
4258        if !wkt::internal::is_default(&self.generation) {
4259            struct __With<'a>(&'a i64);
4260            impl<'a> serde::ser::Serialize for __With<'a> {
4261                fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
4262                where
4263                    S: serde::ser::Serializer,
4264                {
4265                    serde_with::As::<wkt::internal::I64>::serialize(self.0, serializer)
4266                }
4267            }
4268            state.serialize_entry("generation", &__With(&self.generation))?;
4269        }
4270        if !wkt::internal::is_default(&self.read_offset) {
4271            struct __With<'a>(&'a i64);
4272            impl<'a> serde::ser::Serialize for __With<'a> {
4273                fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
4274                where
4275                    S: serde::ser::Serializer,
4276                {
4277                    serde_with::As::<wkt::internal::I64>::serialize(self.0, serializer)
4278                }
4279            }
4280            state.serialize_entry("readOffset", &__With(&self.read_offset))?;
4281        }
4282        if !wkt::internal::is_default(&self.read_limit) {
4283            struct __With<'a>(&'a i64);
4284            impl<'a> serde::ser::Serialize for __With<'a> {
4285                fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
4286                where
4287                    S: serde::ser::Serializer,
4288                {
4289                    serde_with::As::<wkt::internal::I64>::serialize(self.0, serializer)
4290                }
4291            }
4292            state.serialize_entry("readLimit", &__With(&self.read_limit))?;
4293        }
4294        if self.if_generation_match.is_some() {
4295            struct __With<'a>(&'a std::option::Option<i64>);
4296            impl<'a> serde::ser::Serialize for __With<'a> {
4297                fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
4298                where
4299                    S: serde::ser::Serializer,
4300                {
4301                    serde_with::As::<std::option::Option<wkt::internal::I64>>::serialize(
4302                        self.0, serializer,
4303                    )
4304                }
4305            }
4306            state.serialize_entry("ifGenerationMatch", &__With(&self.if_generation_match))?;
4307        }
4308        if self.if_generation_not_match.is_some() {
4309            struct __With<'a>(&'a std::option::Option<i64>);
4310            impl<'a> serde::ser::Serialize for __With<'a> {
4311                fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
4312                where
4313                    S: serde::ser::Serializer,
4314                {
4315                    serde_with::As::<std::option::Option<wkt::internal::I64>>::serialize(
4316                        self.0, serializer,
4317                    )
4318                }
4319            }
4320            state.serialize_entry(
4321                "ifGenerationNotMatch",
4322                &__With(&self.if_generation_not_match),
4323            )?;
4324        }
4325        if self.if_metageneration_match.is_some() {
4326            struct __With<'a>(&'a std::option::Option<i64>);
4327            impl<'a> serde::ser::Serialize for __With<'a> {
4328                fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
4329                where
4330                    S: serde::ser::Serializer,
4331                {
4332                    serde_with::As::<std::option::Option<wkt::internal::I64>>::serialize(
4333                        self.0, serializer,
4334                    )
4335                }
4336            }
4337            state.serialize_entry(
4338                "ifMetagenerationMatch",
4339                &__With(&self.if_metageneration_match),
4340            )?;
4341        }
4342        if self.if_metageneration_not_match.is_some() {
4343            struct __With<'a>(&'a std::option::Option<i64>);
4344            impl<'a> serde::ser::Serialize for __With<'a> {
4345                fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
4346                where
4347                    S: serde::ser::Serializer,
4348                {
4349                    serde_with::As::<std::option::Option<wkt::internal::I64>>::serialize(
4350                        self.0, serializer,
4351                    )
4352                }
4353            }
4354            state.serialize_entry(
4355                "ifMetagenerationNotMatch",
4356                &__With(&self.if_metageneration_not_match),
4357            )?;
4358        }
4359        if self.common_object_request_params.is_some() {
4360            state.serialize_entry(
4361                "commonObjectRequestParams",
4362                &self.common_object_request_params,
4363            )?;
4364        }
4365        if self.read_mask.is_some() {
4366            state.serialize_entry("readMask", &self.read_mask)?;
4367        }
4368        if !self._unknown_fields.is_empty() {
4369            for (key, value) in self._unknown_fields.iter() {
4370                state.serialize_entry(key, &value)?;
4371            }
4372        }
4373        state.end()
4374    }
4375}
4376
4377/// Request message for GetObject.
4378#[derive(Clone, Debug, Default, PartialEq)]
4379#[non_exhaustive]
4380pub struct GetObjectRequest {
4381    /// Required. Name of the bucket in which the object resides.
4382    pub bucket: std::string::String,
4383
4384    /// Required. Name of the object.
4385    pub object: std::string::String,
4386
4387    /// Optional. If present, selects a specific revision of this object (as
4388    /// opposed to the latest version, the default).
4389    pub generation: i64,
4390
4391    /// If true, return the soft-deleted version of this object.
4392    pub soft_deleted: std::option::Option<bool>,
4393
4394    /// Makes the operation conditional on whether the object's current generation
4395    /// matches the given value. Setting to 0 makes the operation succeed only if
4396    /// there are no live versions of the object.
4397    pub if_generation_match: std::option::Option<i64>,
4398
4399    /// Makes the operation conditional on whether the object's live generation
4400    /// does not match the given value. If no live object exists, the precondition
4401    /// fails. Setting to 0 makes the operation succeed only if there is a live
4402    /// version of the object.
4403    pub if_generation_not_match: std::option::Option<i64>,
4404
4405    /// Makes the operation conditional on whether the object's current
4406    /// metageneration matches the given value.
4407    pub if_metageneration_match: std::option::Option<i64>,
4408
4409    /// Makes the operation conditional on whether the object's current
4410    /// metageneration does not match the given value.
4411    pub if_metageneration_not_match: std::option::Option<i64>,
4412
4413    /// Optional. A set of parameters common to Storage API requests concerning an
4414    /// object.
4415    pub common_object_request_params: std::option::Option<crate::model::CommonObjectRequestParams>,
4416
4417    /// Mask specifying which fields to read.
4418    /// If no mask is specified, will default to all fields except metadata.acl and
4419    /// metadata.owner.
4420    ///
4421    /// * may be used to mean "all fields".
4422    pub read_mask: std::option::Option<wkt::FieldMask>,
4423
4424    /// Optional. Restore token used to differentiate soft-deleted objects with the
4425    /// same name and generation. Only applicable for hierarchical namespace
4426    /// buckets and if soft_deleted is set to true. This parameter is optional, and
4427    /// is only required in the rare case when there are multiple soft-deleted
4428    /// objects with the same name and generation.
4429    pub restore_token: std::string::String,
4430
4431    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4432}
4433
4434impl GetObjectRequest {
4435    pub fn new() -> Self {
4436        std::default::Default::default()
4437    }
4438
4439    /// Sets the value of [bucket][crate::model::GetObjectRequest::bucket].
4440    pub fn set_bucket<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4441        self.bucket = v.into();
4442        self
4443    }
4444
4445    /// Sets the value of [object][crate::model::GetObjectRequest::object].
4446    pub fn set_object<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4447        self.object = v.into();
4448        self
4449    }
4450
4451    /// Sets the value of [generation][crate::model::GetObjectRequest::generation].
4452    pub fn set_generation<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
4453        self.generation = v.into();
4454        self
4455    }
4456
4457    /// Sets the value of [soft_deleted][crate::model::GetObjectRequest::soft_deleted].
4458    pub fn set_soft_deleted<T>(mut self, v: T) -> Self
4459    where
4460        T: std::convert::Into<bool>,
4461    {
4462        self.soft_deleted = std::option::Option::Some(v.into());
4463        self
4464    }
4465
4466    /// Sets or clears the value of [soft_deleted][crate::model::GetObjectRequest::soft_deleted].
4467    pub fn set_or_clear_soft_deleted<T>(mut self, v: std::option::Option<T>) -> Self
4468    where
4469        T: std::convert::Into<bool>,
4470    {
4471        self.soft_deleted = v.map(|x| x.into());
4472        self
4473    }
4474
4475    /// Sets the value of [if_generation_match][crate::model::GetObjectRequest::if_generation_match].
4476    pub fn set_if_generation_match<T>(mut self, v: T) -> Self
4477    where
4478        T: std::convert::Into<i64>,
4479    {
4480        self.if_generation_match = std::option::Option::Some(v.into());
4481        self
4482    }
4483
4484    /// Sets or clears the value of [if_generation_match][crate::model::GetObjectRequest::if_generation_match].
4485    pub fn set_or_clear_if_generation_match<T>(mut self, v: std::option::Option<T>) -> Self
4486    where
4487        T: std::convert::Into<i64>,
4488    {
4489        self.if_generation_match = v.map(|x| x.into());
4490        self
4491    }
4492
4493    /// Sets the value of [if_generation_not_match][crate::model::GetObjectRequest::if_generation_not_match].
4494    pub fn set_if_generation_not_match<T>(mut self, v: T) -> Self
4495    where
4496        T: std::convert::Into<i64>,
4497    {
4498        self.if_generation_not_match = std::option::Option::Some(v.into());
4499        self
4500    }
4501
4502    /// Sets or clears the value of [if_generation_not_match][crate::model::GetObjectRequest::if_generation_not_match].
4503    pub fn set_or_clear_if_generation_not_match<T>(mut self, v: std::option::Option<T>) -> Self
4504    where
4505        T: std::convert::Into<i64>,
4506    {
4507        self.if_generation_not_match = v.map(|x| x.into());
4508        self
4509    }
4510
4511    /// Sets the value of [if_metageneration_match][crate::model::GetObjectRequest::if_metageneration_match].
4512    pub fn set_if_metageneration_match<T>(mut self, v: T) -> Self
4513    where
4514        T: std::convert::Into<i64>,
4515    {
4516        self.if_metageneration_match = std::option::Option::Some(v.into());
4517        self
4518    }
4519
4520    /// Sets or clears the value of [if_metageneration_match][crate::model::GetObjectRequest::if_metageneration_match].
4521    pub fn set_or_clear_if_metageneration_match<T>(mut self, v: std::option::Option<T>) -> Self
4522    where
4523        T: std::convert::Into<i64>,
4524    {
4525        self.if_metageneration_match = v.map(|x| x.into());
4526        self
4527    }
4528
4529    /// Sets the value of [if_metageneration_not_match][crate::model::GetObjectRequest::if_metageneration_not_match].
4530    pub fn set_if_metageneration_not_match<T>(mut self, v: T) -> Self
4531    where
4532        T: std::convert::Into<i64>,
4533    {
4534        self.if_metageneration_not_match = std::option::Option::Some(v.into());
4535        self
4536    }
4537
4538    /// Sets or clears the value of [if_metageneration_not_match][crate::model::GetObjectRequest::if_metageneration_not_match].
4539    pub fn set_or_clear_if_metageneration_not_match<T>(mut self, v: std::option::Option<T>) -> Self
4540    where
4541        T: std::convert::Into<i64>,
4542    {
4543        self.if_metageneration_not_match = v.map(|x| x.into());
4544        self
4545    }
4546
4547    /// Sets the value of [common_object_request_params][crate::model::GetObjectRequest::common_object_request_params].
4548    pub fn set_common_object_request_params<T>(mut self, v: T) -> Self
4549    where
4550        T: std::convert::Into<crate::model::CommonObjectRequestParams>,
4551    {
4552        self.common_object_request_params = std::option::Option::Some(v.into());
4553        self
4554    }
4555
4556    /// Sets or clears the value of [common_object_request_params][crate::model::GetObjectRequest::common_object_request_params].
4557    pub fn set_or_clear_common_object_request_params<T>(mut self, v: std::option::Option<T>) -> Self
4558    where
4559        T: std::convert::Into<crate::model::CommonObjectRequestParams>,
4560    {
4561        self.common_object_request_params = v.map(|x| x.into());
4562        self
4563    }
4564
4565    /// Sets the value of [read_mask][crate::model::GetObjectRequest::read_mask].
4566    pub fn set_read_mask<T>(mut self, v: T) -> Self
4567    where
4568        T: std::convert::Into<wkt::FieldMask>,
4569    {
4570        self.read_mask = std::option::Option::Some(v.into());
4571        self
4572    }
4573
4574    /// Sets or clears the value of [read_mask][crate::model::GetObjectRequest::read_mask].
4575    pub fn set_or_clear_read_mask<T>(mut self, v: std::option::Option<T>) -> Self
4576    where
4577        T: std::convert::Into<wkt::FieldMask>,
4578    {
4579        self.read_mask = v.map(|x| x.into());
4580        self
4581    }
4582
4583    /// Sets the value of [restore_token][crate::model::GetObjectRequest::restore_token].
4584    pub fn set_restore_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4585        self.restore_token = v.into();
4586        self
4587    }
4588}
4589
4590impl wkt::message::Message for GetObjectRequest {
4591    fn typename() -> &'static str {
4592        "type.googleapis.com/google.storage.v2.GetObjectRequest"
4593    }
4594}
4595
4596#[doc(hidden)]
4597impl<'de> serde::de::Deserialize<'de> for GetObjectRequest {
4598    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
4599    where
4600        D: serde::Deserializer<'de>,
4601    {
4602        #[allow(non_camel_case_types)]
4603        #[doc(hidden)]
4604        #[derive(PartialEq, Eq, Hash)]
4605        enum __FieldTag {
4606            __bucket,
4607            __object,
4608            __generation,
4609            __soft_deleted,
4610            __if_generation_match,
4611            __if_generation_not_match,
4612            __if_metageneration_match,
4613            __if_metageneration_not_match,
4614            __common_object_request_params,
4615            __read_mask,
4616            __restore_token,
4617            Unknown(std::string::String),
4618        }
4619        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
4620            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
4621            where
4622                D: serde::Deserializer<'de>,
4623            {
4624                struct Visitor;
4625                impl<'de> serde::de::Visitor<'de> for Visitor {
4626                    type Value = __FieldTag;
4627                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
4628                        formatter.write_str("a field name for GetObjectRequest")
4629                    }
4630                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
4631                    where
4632                        E: serde::de::Error,
4633                    {
4634                        use std::result::Result::Ok;
4635                        use std::string::ToString;
4636                        match value {
4637                            "bucket" => Ok(__FieldTag::__bucket),
4638                            "object" => Ok(__FieldTag::__object),
4639                            "generation" => Ok(__FieldTag::__generation),
4640                            "softDeleted" => Ok(__FieldTag::__soft_deleted),
4641                            "soft_deleted" => Ok(__FieldTag::__soft_deleted),
4642                            "ifGenerationMatch" => Ok(__FieldTag::__if_generation_match),
4643                            "if_generation_match" => Ok(__FieldTag::__if_generation_match),
4644                            "ifGenerationNotMatch" => Ok(__FieldTag::__if_generation_not_match),
4645                            "if_generation_not_match" => Ok(__FieldTag::__if_generation_not_match),
4646                            "ifMetagenerationMatch" => Ok(__FieldTag::__if_metageneration_match),
4647                            "if_metageneration_match" => Ok(__FieldTag::__if_metageneration_match),
4648                            "ifMetagenerationNotMatch" => {
4649                                Ok(__FieldTag::__if_metageneration_not_match)
4650                            }
4651                            "if_metageneration_not_match" => {
4652                                Ok(__FieldTag::__if_metageneration_not_match)
4653                            }
4654                            "commonObjectRequestParams" => {
4655                                Ok(__FieldTag::__common_object_request_params)
4656                            }
4657                            "common_object_request_params" => {
4658                                Ok(__FieldTag::__common_object_request_params)
4659                            }
4660                            "readMask" => Ok(__FieldTag::__read_mask),
4661                            "read_mask" => Ok(__FieldTag::__read_mask),
4662                            "restoreToken" => Ok(__FieldTag::__restore_token),
4663                            "restore_token" => Ok(__FieldTag::__restore_token),
4664                            _ => Ok(__FieldTag::Unknown(value.to_string())),
4665                        }
4666                    }
4667                }
4668                deserializer.deserialize_identifier(Visitor)
4669            }
4670        }
4671        struct Visitor;
4672        impl<'de> serde::de::Visitor<'de> for Visitor {
4673            type Value = GetObjectRequest;
4674            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
4675                formatter.write_str("struct GetObjectRequest")
4676            }
4677            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
4678            where
4679                A: serde::de::MapAccess<'de>,
4680            {
4681                #[allow(unused_imports)]
4682                use serde::de::Error;
4683                use std::option::Option::Some;
4684                let mut fields = std::collections::HashSet::new();
4685                let mut result = Self::Value::new();
4686                while let Some(tag) = map.next_key::<__FieldTag>()? {
4687                    #[allow(clippy::match_single_binding)]
4688                    match tag {
4689                        __FieldTag::__bucket => {
4690                            if !fields.insert(__FieldTag::__bucket) {
4691                                return std::result::Result::Err(A::Error::duplicate_field(
4692                                    "multiple values for bucket",
4693                                ));
4694                            }
4695                            result.bucket = map
4696                                .next_value::<std::option::Option<std::string::String>>()?
4697                                .unwrap_or_default();
4698                        }
4699                        __FieldTag::__object => {
4700                            if !fields.insert(__FieldTag::__object) {
4701                                return std::result::Result::Err(A::Error::duplicate_field(
4702                                    "multiple values for object",
4703                                ));
4704                            }
4705                            result.object = map
4706                                .next_value::<std::option::Option<std::string::String>>()?
4707                                .unwrap_or_default();
4708                        }
4709                        __FieldTag::__generation => {
4710                            if !fields.insert(__FieldTag::__generation) {
4711                                return std::result::Result::Err(A::Error::duplicate_field(
4712                                    "multiple values for generation",
4713                                ));
4714                            }
4715                            struct __With(std::option::Option<i64>);
4716                            impl<'de> serde::de::Deserialize<'de> for __With {
4717                                fn deserialize<D>(
4718                                    deserializer: D,
4719                                ) -> std::result::Result<Self, D::Error>
4720                                where
4721                                    D: serde::de::Deserializer<'de>,
4722                                {
4723                                    serde_with::As::< std::option::Option<wkt::internal::I64> >::deserialize(deserializer).map(__With)
4724                                }
4725                            }
4726                            result.generation = map.next_value::<__With>()?.0.unwrap_or_default();
4727                        }
4728                        __FieldTag::__soft_deleted => {
4729                            if !fields.insert(__FieldTag::__soft_deleted) {
4730                                return std::result::Result::Err(A::Error::duplicate_field(
4731                                    "multiple values for soft_deleted",
4732                                ));
4733                            }
4734                            result.soft_deleted = map.next_value::<std::option::Option<bool>>()?;
4735                        }
4736                        __FieldTag::__if_generation_match => {
4737                            if !fields.insert(__FieldTag::__if_generation_match) {
4738                                return std::result::Result::Err(A::Error::duplicate_field(
4739                                    "multiple values for if_generation_match",
4740                                ));
4741                            }
4742                            struct __With(std::option::Option<i64>);
4743                            impl<'de> serde::de::Deserialize<'de> for __With {
4744                                fn deserialize<D>(
4745                                    deserializer: D,
4746                                ) -> std::result::Result<Self, D::Error>
4747                                where
4748                                    D: serde::de::Deserializer<'de>,
4749                                {
4750                                    serde_with::As::< std::option::Option<wkt::internal::I64> >::deserialize(deserializer).map(__With)
4751                                }
4752                            }
4753                            result.if_generation_match = map.next_value::<__With>()?.0;
4754                        }
4755                        __FieldTag::__if_generation_not_match => {
4756                            if !fields.insert(__FieldTag::__if_generation_not_match) {
4757                                return std::result::Result::Err(A::Error::duplicate_field(
4758                                    "multiple values for if_generation_not_match",
4759                                ));
4760                            }
4761                            struct __With(std::option::Option<i64>);
4762                            impl<'de> serde::de::Deserialize<'de> for __With {
4763                                fn deserialize<D>(
4764                                    deserializer: D,
4765                                ) -> std::result::Result<Self, D::Error>
4766                                where
4767                                    D: serde::de::Deserializer<'de>,
4768                                {
4769                                    serde_with::As::< std::option::Option<wkt::internal::I64> >::deserialize(deserializer).map(__With)
4770                                }
4771                            }
4772                            result.if_generation_not_match = map.next_value::<__With>()?.0;
4773                        }
4774                        __FieldTag::__if_metageneration_match => {
4775                            if !fields.insert(__FieldTag::__if_metageneration_match) {
4776                                return std::result::Result::Err(A::Error::duplicate_field(
4777                                    "multiple values for if_metageneration_match",
4778                                ));
4779                            }
4780                            struct __With(std::option::Option<i64>);
4781                            impl<'de> serde::de::Deserialize<'de> for __With {
4782                                fn deserialize<D>(
4783                                    deserializer: D,
4784                                ) -> std::result::Result<Self, D::Error>
4785                                where
4786                                    D: serde::de::Deserializer<'de>,
4787                                {
4788                                    serde_with::As::< std::option::Option<wkt::internal::I64> >::deserialize(deserializer).map(__With)
4789                                }
4790                            }
4791                            result.if_metageneration_match = map.next_value::<__With>()?.0;
4792                        }
4793                        __FieldTag::__if_metageneration_not_match => {
4794                            if !fields.insert(__FieldTag::__if_metageneration_not_match) {
4795                                return std::result::Result::Err(A::Error::duplicate_field(
4796                                    "multiple values for if_metageneration_not_match",
4797                                ));
4798                            }
4799                            struct __With(std::option::Option<i64>);
4800                            impl<'de> serde::de::Deserialize<'de> for __With {
4801                                fn deserialize<D>(
4802                                    deserializer: D,
4803                                ) -> std::result::Result<Self, D::Error>
4804                                where
4805                                    D: serde::de::Deserializer<'de>,
4806                                {
4807                                    serde_with::As::< std::option::Option<wkt::internal::I64> >::deserialize(deserializer).map(__With)
4808                                }
4809                            }
4810                            result.if_metageneration_not_match = map.next_value::<__With>()?.0;
4811                        }
4812                        __FieldTag::__common_object_request_params => {
4813                            if !fields.insert(__FieldTag::__common_object_request_params) {
4814                                return std::result::Result::Err(A::Error::duplicate_field(
4815                                    "multiple values for common_object_request_params",
4816                                ));
4817                            }
4818                            result.common_object_request_params = map.next_value::<std::option::Option<crate::model::CommonObjectRequestParams>>()?
4819                                ;
4820                        }
4821                        __FieldTag::__read_mask => {
4822                            if !fields.insert(__FieldTag::__read_mask) {
4823                                return std::result::Result::Err(A::Error::duplicate_field(
4824                                    "multiple values for read_mask",
4825                                ));
4826                            }
4827                            result.read_mask =
4828                                map.next_value::<std::option::Option<wkt::FieldMask>>()?;
4829                        }
4830                        __FieldTag::__restore_token => {
4831                            if !fields.insert(__FieldTag::__restore_token) {
4832                                return std::result::Result::Err(A::Error::duplicate_field(
4833                                    "multiple values for restore_token",
4834                                ));
4835                            }
4836                            result.restore_token = map
4837                                .next_value::<std::option::Option<std::string::String>>()?
4838                                .unwrap_or_default();
4839                        }
4840                        __FieldTag::Unknown(key) => {
4841                            let value = map.next_value::<serde_json::Value>()?;
4842                            result._unknown_fields.insert(key, value);
4843                        }
4844                    }
4845                }
4846                std::result::Result::Ok(result)
4847            }
4848        }
4849        deserializer.deserialize_any(Visitor)
4850    }
4851}
4852
4853#[doc(hidden)]
4854impl serde::ser::Serialize for GetObjectRequest {
4855    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
4856    where
4857        S: serde::ser::Serializer,
4858    {
4859        use serde::ser::SerializeMap;
4860        #[allow(unused_imports)]
4861        use std::option::Option::Some;
4862        let mut state = serializer.serialize_map(std::option::Option::None)?;
4863        if !self.bucket.is_empty() {
4864            state.serialize_entry("bucket", &self.bucket)?;
4865        }
4866        if !self.object.is_empty() {
4867            state.serialize_entry("object", &self.object)?;
4868        }
4869        if !wkt::internal::is_default(&self.generation) {
4870            struct __With<'a>(&'a i64);
4871            impl<'a> serde::ser::Serialize for __With<'a> {
4872                fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
4873                where
4874                    S: serde::ser::Serializer,
4875                {
4876                    serde_with::As::<wkt::internal::I64>::serialize(self.0, serializer)
4877                }
4878            }
4879            state.serialize_entry("generation", &__With(&self.generation))?;
4880        }
4881        if self.soft_deleted.is_some() {
4882            state.serialize_entry("softDeleted", &self.soft_deleted)?;
4883        }
4884        if self.if_generation_match.is_some() {
4885            struct __With<'a>(&'a std::option::Option<i64>);
4886            impl<'a> serde::ser::Serialize for __With<'a> {
4887                fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
4888                where
4889                    S: serde::ser::Serializer,
4890                {
4891                    serde_with::As::<std::option::Option<wkt::internal::I64>>::serialize(
4892                        self.0, serializer,
4893                    )
4894                }
4895            }
4896            state.serialize_entry("ifGenerationMatch", &__With(&self.if_generation_match))?;
4897        }
4898        if self.if_generation_not_match.is_some() {
4899            struct __With<'a>(&'a std::option::Option<i64>);
4900            impl<'a> serde::ser::Serialize for __With<'a> {
4901                fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
4902                where
4903                    S: serde::ser::Serializer,
4904                {
4905                    serde_with::As::<std::option::Option<wkt::internal::I64>>::serialize(
4906                        self.0, serializer,
4907                    )
4908                }
4909            }
4910            state.serialize_entry(
4911                "ifGenerationNotMatch",
4912                &__With(&self.if_generation_not_match),
4913            )?;
4914        }
4915        if self.if_metageneration_match.is_some() {
4916            struct __With<'a>(&'a std::option::Option<i64>);
4917            impl<'a> serde::ser::Serialize for __With<'a> {
4918                fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
4919                where
4920                    S: serde::ser::Serializer,
4921                {
4922                    serde_with::As::<std::option::Option<wkt::internal::I64>>::serialize(
4923                        self.0, serializer,
4924                    )
4925                }
4926            }
4927            state.serialize_entry(
4928                "ifMetagenerationMatch",
4929                &__With(&self.if_metageneration_match),
4930            )?;
4931        }
4932        if self.if_metageneration_not_match.is_some() {
4933            struct __With<'a>(&'a std::option::Option<i64>);
4934            impl<'a> serde::ser::Serialize for __With<'a> {
4935                fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
4936                where
4937                    S: serde::ser::Serializer,
4938                {
4939                    serde_with::As::<std::option::Option<wkt::internal::I64>>::serialize(
4940                        self.0, serializer,
4941                    )
4942                }
4943            }
4944            state.serialize_entry(
4945                "ifMetagenerationNotMatch",
4946                &__With(&self.if_metageneration_not_match),
4947            )?;
4948        }
4949        if self.common_object_request_params.is_some() {
4950            state.serialize_entry(
4951                "commonObjectRequestParams",
4952                &self.common_object_request_params,
4953            )?;
4954        }
4955        if self.read_mask.is_some() {
4956            state.serialize_entry("readMask", &self.read_mask)?;
4957        }
4958        if !self.restore_token.is_empty() {
4959            state.serialize_entry("restoreToken", &self.restore_token)?;
4960        }
4961        if !self._unknown_fields.is_empty() {
4962            for (key, value) in self._unknown_fields.iter() {
4963                state.serialize_entry(key, &value)?;
4964            }
4965        }
4966        state.end()
4967    }
4968}
4969
4970/// Describes an attempt to insert an object, possibly over multiple requests.
4971#[derive(Clone, Debug, Default, PartialEq)]
4972#[non_exhaustive]
4973pub(crate) struct WriteObjectSpec {
4974    /// Required. Destination object, including its name and its metadata.
4975    pub resource: std::option::Option<crate::model::Object>,
4976
4977    /// Optional. Apply a predefined set of access controls to this object.
4978    /// Valid values are "authenticatedRead", "bucketOwnerFullControl",
4979    /// "bucketOwnerRead", "private", "projectPrivate", or "publicRead".
4980    pub predefined_acl: std::string::String,
4981
4982    /// Makes the operation conditional on whether the object's current
4983    /// generation matches the given value. Setting to 0 makes the operation
4984    /// succeed only if there are no live versions of the object.
4985    pub if_generation_match: std::option::Option<i64>,
4986
4987    /// Makes the operation conditional on whether the object's live
4988    /// generation does not match the given value. If no live object exists, the
4989    /// precondition fails. Setting to 0 makes the operation succeed only if
4990    /// there is a live version of the object.
4991    pub if_generation_not_match: std::option::Option<i64>,
4992
4993    /// Makes the operation conditional on whether the object's current
4994    /// metageneration matches the given value.
4995    pub if_metageneration_match: std::option::Option<i64>,
4996
4997    /// Makes the operation conditional on whether the object's current
4998    /// metageneration does not match the given value.
4999    pub if_metageneration_not_match: std::option::Option<i64>,
5000
5001    /// The expected final object size being uploaded.
5002    /// If this value is set, closing the stream after writing fewer or more than
5003    /// `object_size` bytes will result in an OUT_OF_RANGE error.
5004    ///
5005    /// This situation is considered a client error, and if such an error occurs
5006    /// you must start the upload over from scratch, this time sending the correct
5007    /// number of bytes.
5008    pub object_size: std::option::Option<i64>,
5009
5010    /// If true, the object will be created in appendable mode.
5011    /// This field may only be set when using BidiWriteObject.
5012    pub appendable: std::option::Option<bool>,
5013
5014    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5015}
5016
5017impl WriteObjectSpec {
5018    pub fn new() -> Self {
5019        std::default::Default::default()
5020    }
5021
5022    /// Sets the value of [resource][crate::model::WriteObjectSpec::resource].
5023    pub fn set_resource<T>(mut self, v: T) -> Self
5024    where
5025        T: std::convert::Into<crate::model::Object>,
5026    {
5027        self.resource = std::option::Option::Some(v.into());
5028        self
5029    }
5030
5031    /// Sets or clears the value of [resource][crate::model::WriteObjectSpec::resource].
5032    pub fn set_or_clear_resource<T>(mut self, v: std::option::Option<T>) -> Self
5033    where
5034        T: std::convert::Into<crate::model::Object>,
5035    {
5036        self.resource = v.map(|x| x.into());
5037        self
5038    }
5039
5040    /// Sets the value of [predefined_acl][crate::model::WriteObjectSpec::predefined_acl].
5041    pub fn set_predefined_acl<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5042        self.predefined_acl = v.into();
5043        self
5044    }
5045
5046    /// Sets the value of [if_generation_match][crate::model::WriteObjectSpec::if_generation_match].
5047    pub fn set_if_generation_match<T>(mut self, v: T) -> Self
5048    where
5049        T: std::convert::Into<i64>,
5050    {
5051        self.if_generation_match = std::option::Option::Some(v.into());
5052        self
5053    }
5054
5055    /// Sets or clears the value of [if_generation_match][crate::model::WriteObjectSpec::if_generation_match].
5056    pub fn set_or_clear_if_generation_match<T>(mut self, v: std::option::Option<T>) -> Self
5057    where
5058        T: std::convert::Into<i64>,
5059    {
5060        self.if_generation_match = v.map(|x| x.into());
5061        self
5062    }
5063
5064    /// Sets the value of [if_generation_not_match][crate::model::WriteObjectSpec::if_generation_not_match].
5065    pub fn set_if_generation_not_match<T>(mut self, v: T) -> Self
5066    where
5067        T: std::convert::Into<i64>,
5068    {
5069        self.if_generation_not_match = std::option::Option::Some(v.into());
5070        self
5071    }
5072
5073    /// Sets or clears the value of [if_generation_not_match][crate::model::WriteObjectSpec::if_generation_not_match].
5074    pub fn set_or_clear_if_generation_not_match<T>(mut self, v: std::option::Option<T>) -> Self
5075    where
5076        T: std::convert::Into<i64>,
5077    {
5078        self.if_generation_not_match = v.map(|x| x.into());
5079        self
5080    }
5081
5082    /// Sets the value of [if_metageneration_match][crate::model::WriteObjectSpec::if_metageneration_match].
5083    pub fn set_if_metageneration_match<T>(mut self, v: T) -> Self
5084    where
5085        T: std::convert::Into<i64>,
5086    {
5087        self.if_metageneration_match = std::option::Option::Some(v.into());
5088        self
5089    }
5090
5091    /// Sets or clears the value of [if_metageneration_match][crate::model::WriteObjectSpec::if_metageneration_match].
5092    pub fn set_or_clear_if_metageneration_match<T>(mut self, v: std::option::Option<T>) -> Self
5093    where
5094        T: std::convert::Into<i64>,
5095    {
5096        self.if_metageneration_match = v.map(|x| x.into());
5097        self
5098    }
5099
5100    /// Sets the value of [if_metageneration_not_match][crate::model::WriteObjectSpec::if_metageneration_not_match].
5101    pub fn set_if_metageneration_not_match<T>(mut self, v: T) -> Self
5102    where
5103        T: std::convert::Into<i64>,
5104    {
5105        self.if_metageneration_not_match = std::option::Option::Some(v.into());
5106        self
5107    }
5108
5109    /// Sets or clears the value of [if_metageneration_not_match][crate::model::WriteObjectSpec::if_metageneration_not_match].
5110    pub fn set_or_clear_if_metageneration_not_match<T>(mut self, v: std::option::Option<T>) -> Self
5111    where
5112        T: std::convert::Into<i64>,
5113    {
5114        self.if_metageneration_not_match = v.map(|x| x.into());
5115        self
5116    }
5117
5118    /// Sets the value of [object_size][crate::model::WriteObjectSpec::object_size].
5119    pub fn set_object_size<T>(mut self, v: T) -> Self
5120    where
5121        T: std::convert::Into<i64>,
5122    {
5123        self.object_size = std::option::Option::Some(v.into());
5124        self
5125    }
5126
5127    /// Sets or clears the value of [object_size][crate::model::WriteObjectSpec::object_size].
5128    pub fn set_or_clear_object_size<T>(mut self, v: std::option::Option<T>) -> Self
5129    where
5130        T: std::convert::Into<i64>,
5131    {
5132        self.object_size = v.map(|x| x.into());
5133        self
5134    }
5135
5136    /// Sets the value of [appendable][crate::model::WriteObjectSpec::appendable].
5137    pub fn set_appendable<T>(mut self, v: T) -> Self
5138    where
5139        T: std::convert::Into<bool>,
5140    {
5141        self.appendable = std::option::Option::Some(v.into());
5142        self
5143    }
5144
5145    /// Sets or clears the value of [appendable][crate::model::WriteObjectSpec::appendable].
5146    pub fn set_or_clear_appendable<T>(mut self, v: std::option::Option<T>) -> Self
5147    where
5148        T: std::convert::Into<bool>,
5149    {
5150        self.appendable = v.map(|x| x.into());
5151        self
5152    }
5153}
5154
5155impl wkt::message::Message for WriteObjectSpec {
5156    fn typename() -> &'static str {
5157        "type.googleapis.com/google.storage.v2.WriteObjectSpec"
5158    }
5159}
5160
5161#[doc(hidden)]
5162impl<'de> serde::de::Deserialize<'de> for WriteObjectSpec {
5163    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
5164    where
5165        D: serde::Deserializer<'de>,
5166    {
5167        #[allow(non_camel_case_types)]
5168        #[doc(hidden)]
5169        #[derive(PartialEq, Eq, Hash)]
5170        enum __FieldTag {
5171            __resource,
5172            __predefined_acl,
5173            __if_generation_match,
5174            __if_generation_not_match,
5175            __if_metageneration_match,
5176            __if_metageneration_not_match,
5177            __object_size,
5178            __appendable,
5179            Unknown(std::string::String),
5180        }
5181        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
5182            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
5183            where
5184                D: serde::Deserializer<'de>,
5185            {
5186                struct Visitor;
5187                impl<'de> serde::de::Visitor<'de> for Visitor {
5188                    type Value = __FieldTag;
5189                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
5190                        formatter.write_str("a field name for WriteObjectSpec")
5191                    }
5192                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
5193                    where
5194                        E: serde::de::Error,
5195                    {
5196                        use std::result::Result::Ok;
5197                        use std::string::ToString;
5198                        match value {
5199                            "resource" => Ok(__FieldTag::__resource),
5200                            "predefinedAcl" => Ok(__FieldTag::__predefined_acl),
5201                            "predefined_acl" => Ok(__FieldTag::__predefined_acl),
5202                            "ifGenerationMatch" => Ok(__FieldTag::__if_generation_match),
5203                            "if_generation_match" => Ok(__FieldTag::__if_generation_match),
5204                            "ifGenerationNotMatch" => Ok(__FieldTag::__if_generation_not_match),
5205                            "if_generation_not_match" => Ok(__FieldTag::__if_generation_not_match),
5206                            "ifMetagenerationMatch" => Ok(__FieldTag::__if_metageneration_match),
5207                            "if_metageneration_match" => Ok(__FieldTag::__if_metageneration_match),
5208                            "ifMetagenerationNotMatch" => {
5209                                Ok(__FieldTag::__if_metageneration_not_match)
5210                            }
5211                            "if_metageneration_not_match" => {
5212                                Ok(__FieldTag::__if_metageneration_not_match)
5213                            }
5214                            "objectSize" => Ok(__FieldTag::__object_size),
5215                            "object_size" => Ok(__FieldTag::__object_size),
5216                            "appendable" => Ok(__FieldTag::__appendable),
5217                            _ => Ok(__FieldTag::Unknown(value.to_string())),
5218                        }
5219                    }
5220                }
5221                deserializer.deserialize_identifier(Visitor)
5222            }
5223        }
5224        struct Visitor;
5225        impl<'de> serde::de::Visitor<'de> for Visitor {
5226            type Value = WriteObjectSpec;
5227            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
5228                formatter.write_str("struct WriteObjectSpec")
5229            }
5230            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
5231            where
5232                A: serde::de::MapAccess<'de>,
5233            {
5234                #[allow(unused_imports)]
5235                use serde::de::Error;
5236                use std::option::Option::Some;
5237                let mut fields = std::collections::HashSet::new();
5238                let mut result = Self::Value::new();
5239                while let Some(tag) = map.next_key::<__FieldTag>()? {
5240                    #[allow(clippy::match_single_binding)]
5241                    match tag {
5242                        __FieldTag::__resource => {
5243                            if !fields.insert(__FieldTag::__resource) {
5244                                return std::result::Result::Err(A::Error::duplicate_field(
5245                                    "multiple values for resource",
5246                                ));
5247                            }
5248                            result.resource =
5249                                map.next_value::<std::option::Option<crate::model::Object>>()?;
5250                        }
5251                        __FieldTag::__predefined_acl => {
5252                            if !fields.insert(__FieldTag::__predefined_acl) {
5253                                return std::result::Result::Err(A::Error::duplicate_field(
5254                                    "multiple values for predefined_acl",
5255                                ));
5256                            }
5257                            result.predefined_acl = map
5258                                .next_value::<std::option::Option<std::string::String>>()?
5259                                .unwrap_or_default();
5260                        }
5261                        __FieldTag::__if_generation_match => {
5262                            if !fields.insert(__FieldTag::__if_generation_match) {
5263                                return std::result::Result::Err(A::Error::duplicate_field(
5264                                    "multiple values for if_generation_match",
5265                                ));
5266                            }
5267                            struct __With(std::option::Option<i64>);
5268                            impl<'de> serde::de::Deserialize<'de> for __With {
5269                                fn deserialize<D>(
5270                                    deserializer: D,
5271                                ) -> std::result::Result<Self, D::Error>
5272                                where
5273                                    D: serde::de::Deserializer<'de>,
5274                                {
5275                                    serde_with::As::< std::option::Option<wkt::internal::I64> >::deserialize(deserializer).map(__With)
5276                                }
5277                            }
5278                            result.if_generation_match = map.next_value::<__With>()?.0;
5279                        }
5280                        __FieldTag::__if_generation_not_match => {
5281                            if !fields.insert(__FieldTag::__if_generation_not_match) {
5282                                return std::result::Result::Err(A::Error::duplicate_field(
5283                                    "multiple values for if_generation_not_match",
5284                                ));
5285                            }
5286                            struct __With(std::option::Option<i64>);
5287                            impl<'de> serde::de::Deserialize<'de> for __With {
5288                                fn deserialize<D>(
5289                                    deserializer: D,
5290                                ) -> std::result::Result<Self, D::Error>
5291                                where
5292                                    D: serde::de::Deserializer<'de>,
5293                                {
5294                                    serde_with::As::< std::option::Option<wkt::internal::I64> >::deserialize(deserializer).map(__With)
5295                                }
5296                            }
5297                            result.if_generation_not_match = map.next_value::<__With>()?.0;
5298                        }
5299                        __FieldTag::__if_metageneration_match => {
5300                            if !fields.insert(__FieldTag::__if_metageneration_match) {
5301                                return std::result::Result::Err(A::Error::duplicate_field(
5302                                    "multiple values for if_metageneration_match",
5303                                ));
5304                            }
5305                            struct __With(std::option::Option<i64>);
5306                            impl<'de> serde::de::Deserialize<'de> for __With {
5307                                fn deserialize<D>(
5308                                    deserializer: D,
5309                                ) -> std::result::Result<Self, D::Error>
5310                                where
5311                                    D: serde::de::Deserializer<'de>,
5312                                {
5313                                    serde_with::As::< std::option::Option<wkt::internal::I64> >::deserialize(deserializer).map(__With)
5314                                }
5315                            }
5316                            result.if_metageneration_match = map.next_value::<__With>()?.0;
5317                        }
5318                        __FieldTag::__if_metageneration_not_match => {
5319                            if !fields.insert(__FieldTag::__if_metageneration_not_match) {
5320                                return std::result::Result::Err(A::Error::duplicate_field(
5321                                    "multiple values for if_metageneration_not_match",
5322                                ));
5323                            }
5324                            struct __With(std::option::Option<i64>);
5325                            impl<'de> serde::de::Deserialize<'de> for __With {
5326                                fn deserialize<D>(
5327                                    deserializer: D,
5328                                ) -> std::result::Result<Self, D::Error>
5329                                where
5330                                    D: serde::de::Deserializer<'de>,
5331                                {
5332                                    serde_with::As::< std::option::Option<wkt::internal::I64> >::deserialize(deserializer).map(__With)
5333                                }
5334                            }
5335                            result.if_metageneration_not_match = map.next_value::<__With>()?.0;
5336                        }
5337                        __FieldTag::__object_size => {
5338                            if !fields.insert(__FieldTag::__object_size) {
5339                                return std::result::Result::Err(A::Error::duplicate_field(
5340                                    "multiple values for object_size",
5341                                ));
5342                            }
5343                            struct __With(std::option::Option<i64>);
5344                            impl<'de> serde::de::Deserialize<'de> for __With {
5345                                fn deserialize<D>(
5346                                    deserializer: D,
5347                                ) -> std::result::Result<Self, D::Error>
5348                                where
5349                                    D: serde::de::Deserializer<'de>,
5350                                {
5351                                    serde_with::As::< std::option::Option<wkt::internal::I64> >::deserialize(deserializer).map(__With)
5352                                }
5353                            }
5354                            result.object_size = map.next_value::<__With>()?.0;
5355                        }
5356                        __FieldTag::__appendable => {
5357                            if !fields.insert(__FieldTag::__appendable) {
5358                                return std::result::Result::Err(A::Error::duplicate_field(
5359                                    "multiple values for appendable",
5360                                ));
5361                            }
5362                            result.appendable = map.next_value::<std::option::Option<bool>>()?;
5363                        }
5364                        __FieldTag::Unknown(key) => {
5365                            let value = map.next_value::<serde_json::Value>()?;
5366                            result._unknown_fields.insert(key, value);
5367                        }
5368                    }
5369                }
5370                std::result::Result::Ok(result)
5371            }
5372        }
5373        deserializer.deserialize_any(Visitor)
5374    }
5375}
5376
5377#[doc(hidden)]
5378impl serde::ser::Serialize for WriteObjectSpec {
5379    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
5380    where
5381        S: serde::ser::Serializer,
5382    {
5383        use serde::ser::SerializeMap;
5384        #[allow(unused_imports)]
5385        use std::option::Option::Some;
5386        let mut state = serializer.serialize_map(std::option::Option::None)?;
5387        if self.resource.is_some() {
5388            state.serialize_entry("resource", &self.resource)?;
5389        }
5390        if !self.predefined_acl.is_empty() {
5391            state.serialize_entry("predefinedAcl", &self.predefined_acl)?;
5392        }
5393        if self.if_generation_match.is_some() {
5394            struct __With<'a>(&'a std::option::Option<i64>);
5395            impl<'a> serde::ser::Serialize for __With<'a> {
5396                fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
5397                where
5398                    S: serde::ser::Serializer,
5399                {
5400                    serde_with::As::<std::option::Option<wkt::internal::I64>>::serialize(
5401                        self.0, serializer,
5402                    )
5403                }
5404            }
5405            state.serialize_entry("ifGenerationMatch", &__With(&self.if_generation_match))?;
5406        }
5407        if self.if_generation_not_match.is_some() {
5408            struct __With<'a>(&'a std::option::Option<i64>);
5409            impl<'a> serde::ser::Serialize for __With<'a> {
5410                fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
5411                where
5412                    S: serde::ser::Serializer,
5413                {
5414                    serde_with::As::<std::option::Option<wkt::internal::I64>>::serialize(
5415                        self.0, serializer,
5416                    )
5417                }
5418            }
5419            state.serialize_entry(
5420                "ifGenerationNotMatch",
5421                &__With(&self.if_generation_not_match),
5422            )?;
5423        }
5424        if self.if_metageneration_match.is_some() {
5425            struct __With<'a>(&'a std::option::Option<i64>);
5426            impl<'a> serde::ser::Serialize for __With<'a> {
5427                fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
5428                where
5429                    S: serde::ser::Serializer,
5430                {
5431                    serde_with::As::<std::option::Option<wkt::internal::I64>>::serialize(
5432                        self.0, serializer,
5433                    )
5434                }
5435            }
5436            state.serialize_entry(
5437                "ifMetagenerationMatch",
5438                &__With(&self.if_metageneration_match),
5439            )?;
5440        }
5441        if self.if_metageneration_not_match.is_some() {
5442            struct __With<'a>(&'a std::option::Option<i64>);
5443            impl<'a> serde::ser::Serialize for __With<'a> {
5444                fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
5445                where
5446                    S: serde::ser::Serializer,
5447                {
5448                    serde_with::As::<std::option::Option<wkt::internal::I64>>::serialize(
5449                        self.0, serializer,
5450                    )
5451                }
5452            }
5453            state.serialize_entry(
5454                "ifMetagenerationNotMatch",
5455                &__With(&self.if_metageneration_not_match),
5456            )?;
5457        }
5458        if self.object_size.is_some() {
5459            struct __With<'a>(&'a std::option::Option<i64>);
5460            impl<'a> serde::ser::Serialize for __With<'a> {
5461                fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
5462                where
5463                    S: serde::ser::Serializer,
5464                {
5465                    serde_with::As::<std::option::Option<wkt::internal::I64>>::serialize(
5466                        self.0, serializer,
5467                    )
5468                }
5469            }
5470            state.serialize_entry("objectSize", &__With(&self.object_size))?;
5471        }
5472        if self.appendable.is_some() {
5473            state.serialize_entry("appendable", &self.appendable)?;
5474        }
5475        if !self._unknown_fields.is_empty() {
5476            for (key, value) in self._unknown_fields.iter() {
5477                state.serialize_entry(key, &value)?;
5478            }
5479        }
5480        state.end()
5481    }
5482}
5483
5484/// Request message for ListObjects.
5485#[derive(Clone, Debug, Default, PartialEq)]
5486#[non_exhaustive]
5487pub struct ListObjectsRequest {
5488    /// Required. Name of the bucket in which to look for objects.
5489    pub parent: std::string::String,
5490
5491    /// Optional. Maximum number of `items` plus `prefixes` to return
5492    /// in a single page of responses. As duplicate `prefixes` are
5493    /// omitted, fewer total results may be returned than requested. The service
5494    /// will use this parameter or 1,000 items, whichever is smaller.
5495    pub page_size: i32,
5496
5497    /// Optional. A previously-returned page token representing part of the larger
5498    /// set of results to view.
5499    pub page_token: std::string::String,
5500
5501    /// Optional. If set, returns results in a directory-like mode. `items` will
5502    /// contain only objects whose names, aside from the `prefix`, do not contain
5503    /// `delimiter`. Objects whose names, aside from the `prefix`, contain
5504    /// `delimiter` will have their name, truncated after the `delimiter`, returned
5505    /// in `prefixes`. Duplicate `prefixes` are omitted.
5506    pub delimiter: std::string::String,
5507
5508    /// Optional. If true, objects that end in exactly one instance of `delimiter`
5509    /// will have their metadata included in `items` in addition to
5510    /// `prefixes`.
5511    pub include_trailing_delimiter: bool,
5512
5513    /// Optional. Filter results to objects whose names begin with this prefix.
5514    pub prefix: std::string::String,
5515
5516    /// Optional. If `true`, lists all versions of an object as distinct results.
5517    /// For more information, see
5518    /// [Object
5519    /// Versioning](https://cloud.google.com/storage/docs/object-versioning).
5520    pub versions: bool,
5521
5522    /// Mask specifying which fields to read from each result.
5523    /// If no mask is specified, will default to all fields except items.acl and
5524    /// items.owner.
5525    ///
5526    /// * may be used to mean "all fields".
5527    pub read_mask: std::option::Option<wkt::FieldMask>,
5528
5529    /// Optional. Filter results to objects whose names are lexicographically equal
5530    /// to or after lexicographic_start. If lexicographic_end is also set, the
5531    /// objects listed have names between lexicographic_start (inclusive) and
5532    /// lexicographic_end (exclusive).
5533    pub lexicographic_start: std::string::String,
5534
5535    /// Optional. Filter results to objects whose names are lexicographically
5536    /// before lexicographic_end. If lexicographic_start is also set, the objects
5537    /// listed have names between lexicographic_start (inclusive) and
5538    /// lexicographic_end (exclusive).
5539    pub lexicographic_end: std::string::String,
5540
5541    /// Optional. If true, only list all soft-deleted versions of the object.
5542    /// Soft delete policy is required to set this option.
5543    pub soft_deleted: bool,
5544
5545    /// Optional. If true, will also include folders and managed folders (besides
5546    /// objects) in the returned `prefixes`. Requires `delimiter` to be set to '/'.
5547    pub include_folders_as_prefixes: bool,
5548
5549    /// Optional. Filter results to objects and prefixes that match this glob
5550    /// pattern. See [List Objects Using
5551    /// Glob](https://cloud.google.com/storage/docs/json_api/v1/objects/list#list-objects-and-prefixes-using-glob)
5552    /// for the full syntax.
5553    pub match_glob: std::string::String,
5554
5555    /// Optional. Filter the returned objects. Currently only supported for the
5556    /// `contexts` field. If `delimiter` is set, the returned `prefixes` are exempt
5557    /// from this filter.
5558    pub filter: std::string::String,
5559
5560    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5561}
5562
5563impl ListObjectsRequest {
5564    pub fn new() -> Self {
5565        std::default::Default::default()
5566    }
5567
5568    /// Sets the value of [parent][crate::model::ListObjectsRequest::parent].
5569    pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5570        self.parent = v.into();
5571        self
5572    }
5573
5574    /// Sets the value of [page_size][crate::model::ListObjectsRequest::page_size].
5575    pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
5576        self.page_size = v.into();
5577        self
5578    }
5579
5580    /// Sets the value of [page_token][crate::model::ListObjectsRequest::page_token].
5581    pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5582        self.page_token = v.into();
5583        self
5584    }
5585
5586    /// Sets the value of [delimiter][crate::model::ListObjectsRequest::delimiter].
5587    pub fn set_delimiter<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5588        self.delimiter = v.into();
5589        self
5590    }
5591
5592    /// Sets the value of [include_trailing_delimiter][crate::model::ListObjectsRequest::include_trailing_delimiter].
5593    pub fn set_include_trailing_delimiter<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
5594        self.include_trailing_delimiter = v.into();
5595        self
5596    }
5597
5598    /// Sets the value of [prefix][crate::model::ListObjectsRequest::prefix].
5599    pub fn set_prefix<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5600        self.prefix = v.into();
5601        self
5602    }
5603
5604    /// Sets the value of [versions][crate::model::ListObjectsRequest::versions].
5605    pub fn set_versions<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
5606        self.versions = v.into();
5607        self
5608    }
5609
5610    /// Sets the value of [read_mask][crate::model::ListObjectsRequest::read_mask].
5611    pub fn set_read_mask<T>(mut self, v: T) -> Self
5612    where
5613        T: std::convert::Into<wkt::FieldMask>,
5614    {
5615        self.read_mask = std::option::Option::Some(v.into());
5616        self
5617    }
5618
5619    /// Sets or clears the value of [read_mask][crate::model::ListObjectsRequest::read_mask].
5620    pub fn set_or_clear_read_mask<T>(mut self, v: std::option::Option<T>) -> Self
5621    where
5622        T: std::convert::Into<wkt::FieldMask>,
5623    {
5624        self.read_mask = v.map(|x| x.into());
5625        self
5626    }
5627
5628    /// Sets the value of [lexicographic_start][crate::model::ListObjectsRequest::lexicographic_start].
5629    pub fn set_lexicographic_start<T: std::convert::Into<std::string::String>>(
5630        mut self,
5631        v: T,
5632    ) -> Self {
5633        self.lexicographic_start = v.into();
5634        self
5635    }
5636
5637    /// Sets the value of [lexicographic_end][crate::model::ListObjectsRequest::lexicographic_end].
5638    pub fn set_lexicographic_end<T: std::convert::Into<std::string::String>>(
5639        mut self,
5640        v: T,
5641    ) -> Self {
5642        self.lexicographic_end = v.into();
5643        self
5644    }
5645
5646    /// Sets the value of [soft_deleted][crate::model::ListObjectsRequest::soft_deleted].
5647    pub fn set_soft_deleted<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
5648        self.soft_deleted = v.into();
5649        self
5650    }
5651
5652    /// Sets the value of [include_folders_as_prefixes][crate::model::ListObjectsRequest::include_folders_as_prefixes].
5653    pub fn set_include_folders_as_prefixes<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
5654        self.include_folders_as_prefixes = v.into();
5655        self
5656    }
5657
5658    /// Sets the value of [match_glob][crate::model::ListObjectsRequest::match_glob].
5659    pub fn set_match_glob<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5660        self.match_glob = v.into();
5661        self
5662    }
5663
5664    /// Sets the value of [filter][crate::model::ListObjectsRequest::filter].
5665    pub fn set_filter<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5666        self.filter = v.into();
5667        self
5668    }
5669}
5670
5671impl wkt::message::Message for ListObjectsRequest {
5672    fn typename() -> &'static str {
5673        "type.googleapis.com/google.storage.v2.ListObjectsRequest"
5674    }
5675}
5676
5677#[doc(hidden)]
5678impl<'de> serde::de::Deserialize<'de> for ListObjectsRequest {
5679    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
5680    where
5681        D: serde::Deserializer<'de>,
5682    {
5683        #[allow(non_camel_case_types)]
5684        #[doc(hidden)]
5685        #[derive(PartialEq, Eq, Hash)]
5686        enum __FieldTag {
5687            __parent,
5688            __page_size,
5689            __page_token,
5690            __delimiter,
5691            __include_trailing_delimiter,
5692            __prefix,
5693            __versions,
5694            __read_mask,
5695            __lexicographic_start,
5696            __lexicographic_end,
5697            __soft_deleted,
5698            __include_folders_as_prefixes,
5699            __match_glob,
5700            __filter,
5701            Unknown(std::string::String),
5702        }
5703        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
5704            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
5705            where
5706                D: serde::Deserializer<'de>,
5707            {
5708                struct Visitor;
5709                impl<'de> serde::de::Visitor<'de> for Visitor {
5710                    type Value = __FieldTag;
5711                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
5712                        formatter.write_str("a field name for ListObjectsRequest")
5713                    }
5714                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
5715                    where
5716                        E: serde::de::Error,
5717                    {
5718                        use std::result::Result::Ok;
5719                        use std::string::ToString;
5720                        match value {
5721                            "parent" => Ok(__FieldTag::__parent),
5722                            "pageSize" => Ok(__FieldTag::__page_size),
5723                            "page_size" => Ok(__FieldTag::__page_size),
5724                            "pageToken" => Ok(__FieldTag::__page_token),
5725                            "page_token" => Ok(__FieldTag::__page_token),
5726                            "delimiter" => Ok(__FieldTag::__delimiter),
5727                            "includeTrailingDelimiter" => {
5728                                Ok(__FieldTag::__include_trailing_delimiter)
5729                            }
5730                            "include_trailing_delimiter" => {
5731                                Ok(__FieldTag::__include_trailing_delimiter)
5732                            }
5733                            "prefix" => Ok(__FieldTag::__prefix),
5734                            "versions" => Ok(__FieldTag::__versions),
5735                            "readMask" => Ok(__FieldTag::__read_mask),
5736                            "read_mask" => Ok(__FieldTag::__read_mask),
5737                            "lexicographicStart" => Ok(__FieldTag::__lexicographic_start),
5738                            "lexicographic_start" => Ok(__FieldTag::__lexicographic_start),
5739                            "lexicographicEnd" => Ok(__FieldTag::__lexicographic_end),
5740                            "lexicographic_end" => Ok(__FieldTag::__lexicographic_end),
5741                            "softDeleted" => Ok(__FieldTag::__soft_deleted),
5742                            "soft_deleted" => Ok(__FieldTag::__soft_deleted),
5743                            "includeFoldersAsPrefixes" => {
5744                                Ok(__FieldTag::__include_folders_as_prefixes)
5745                            }
5746                            "include_folders_as_prefixes" => {
5747                                Ok(__FieldTag::__include_folders_as_prefixes)
5748                            }
5749                            "matchGlob" => Ok(__FieldTag::__match_glob),
5750                            "match_glob" => Ok(__FieldTag::__match_glob),
5751                            "filter" => Ok(__FieldTag::__filter),
5752                            _ => Ok(__FieldTag::Unknown(value.to_string())),
5753                        }
5754                    }
5755                }
5756                deserializer.deserialize_identifier(Visitor)
5757            }
5758        }
5759        struct Visitor;
5760        impl<'de> serde::de::Visitor<'de> for Visitor {
5761            type Value = ListObjectsRequest;
5762            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
5763                formatter.write_str("struct ListObjectsRequest")
5764            }
5765            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
5766            where
5767                A: serde::de::MapAccess<'de>,
5768            {
5769                #[allow(unused_imports)]
5770                use serde::de::Error;
5771                use std::option::Option::Some;
5772                let mut fields = std::collections::HashSet::new();
5773                let mut result = Self::Value::new();
5774                while let Some(tag) = map.next_key::<__FieldTag>()? {
5775                    #[allow(clippy::match_single_binding)]
5776                    match tag {
5777                        __FieldTag::__parent => {
5778                            if !fields.insert(__FieldTag::__parent) {
5779                                return std::result::Result::Err(A::Error::duplicate_field(
5780                                    "multiple values for parent",
5781                                ));
5782                            }
5783                            result.parent = map
5784                                .next_value::<std::option::Option<std::string::String>>()?
5785                                .unwrap_or_default();
5786                        }
5787                        __FieldTag::__page_size => {
5788                            if !fields.insert(__FieldTag::__page_size) {
5789                                return std::result::Result::Err(A::Error::duplicate_field(
5790                                    "multiple values for page_size",
5791                                ));
5792                            }
5793                            struct __With(std::option::Option<i32>);
5794                            impl<'de> serde::de::Deserialize<'de> for __With {
5795                                fn deserialize<D>(
5796                                    deserializer: D,
5797                                ) -> std::result::Result<Self, D::Error>
5798                                where
5799                                    D: serde::de::Deserializer<'de>,
5800                                {
5801                                    serde_with::As::< std::option::Option<wkt::internal::I32> >::deserialize(deserializer).map(__With)
5802                                }
5803                            }
5804                            result.page_size = map.next_value::<__With>()?.0.unwrap_or_default();
5805                        }
5806                        __FieldTag::__page_token => {
5807                            if !fields.insert(__FieldTag::__page_token) {
5808                                return std::result::Result::Err(A::Error::duplicate_field(
5809                                    "multiple values for page_token",
5810                                ));
5811                            }
5812                            result.page_token = map
5813                                .next_value::<std::option::Option<std::string::String>>()?
5814                                .unwrap_or_default();
5815                        }
5816                        __FieldTag::__delimiter => {
5817                            if !fields.insert(__FieldTag::__delimiter) {
5818                                return std::result::Result::Err(A::Error::duplicate_field(
5819                                    "multiple values for delimiter",
5820                                ));
5821                            }
5822                            result.delimiter = map
5823                                .next_value::<std::option::Option<std::string::String>>()?
5824                                .unwrap_or_default();
5825                        }
5826                        __FieldTag::__include_trailing_delimiter => {
5827                            if !fields.insert(__FieldTag::__include_trailing_delimiter) {
5828                                return std::result::Result::Err(A::Error::duplicate_field(
5829                                    "multiple values for include_trailing_delimiter",
5830                                ));
5831                            }
5832                            result.include_trailing_delimiter = map
5833                                .next_value::<std::option::Option<bool>>()?
5834                                .unwrap_or_default();
5835                        }
5836                        __FieldTag::__prefix => {
5837                            if !fields.insert(__FieldTag::__prefix) {
5838                                return std::result::Result::Err(A::Error::duplicate_field(
5839                                    "multiple values for prefix",
5840                                ));
5841                            }
5842                            result.prefix = map
5843                                .next_value::<std::option::Option<std::string::String>>()?
5844                                .unwrap_or_default();
5845                        }
5846                        __FieldTag::__versions => {
5847                            if !fields.insert(__FieldTag::__versions) {
5848                                return std::result::Result::Err(A::Error::duplicate_field(
5849                                    "multiple values for versions",
5850                                ));
5851                            }
5852                            result.versions = map
5853                                .next_value::<std::option::Option<bool>>()?
5854                                .unwrap_or_default();
5855                        }
5856                        __FieldTag::__read_mask => {
5857                            if !fields.insert(__FieldTag::__read_mask) {
5858                                return std::result::Result::Err(A::Error::duplicate_field(
5859                                    "multiple values for read_mask",
5860                                ));
5861                            }
5862                            result.read_mask =
5863                                map.next_value::<std::option::Option<wkt::FieldMask>>()?;
5864                        }
5865                        __FieldTag::__lexicographic_start => {
5866                            if !fields.insert(__FieldTag::__lexicographic_start) {
5867                                return std::result::Result::Err(A::Error::duplicate_field(
5868                                    "multiple values for lexicographic_start",
5869                                ));
5870                            }
5871                            result.lexicographic_start = map
5872                                .next_value::<std::option::Option<std::string::String>>()?
5873                                .unwrap_or_default();
5874                        }
5875                        __FieldTag::__lexicographic_end => {
5876                            if !fields.insert(__FieldTag::__lexicographic_end) {
5877                                return std::result::Result::Err(A::Error::duplicate_field(
5878                                    "multiple values for lexicographic_end",
5879                                ));
5880                            }
5881                            result.lexicographic_end = map
5882                                .next_value::<std::option::Option<std::string::String>>()?
5883                                .unwrap_or_default();
5884                        }
5885                        __FieldTag::__soft_deleted => {
5886                            if !fields.insert(__FieldTag::__soft_deleted) {
5887                                return std::result::Result::Err(A::Error::duplicate_field(
5888                                    "multiple values for soft_deleted",
5889                                ));
5890                            }
5891                            result.soft_deleted = map
5892                                .next_value::<std::option::Option<bool>>()?
5893                                .unwrap_or_default();
5894                        }
5895                        __FieldTag::__include_folders_as_prefixes => {
5896                            if !fields.insert(__FieldTag::__include_folders_as_prefixes) {
5897                                return std::result::Result::Err(A::Error::duplicate_field(
5898                                    "multiple values for include_folders_as_prefixes",
5899                                ));
5900                            }
5901                            result.include_folders_as_prefixes = map
5902                                .next_value::<std::option::Option<bool>>()?
5903                                .unwrap_or_default();
5904                        }
5905                        __FieldTag::__match_glob => {
5906                            if !fields.insert(__FieldTag::__match_glob) {
5907                                return std::result::Result::Err(A::Error::duplicate_field(
5908                                    "multiple values for match_glob",
5909                                ));
5910                            }
5911                            result.match_glob = map
5912                                .next_value::<std::option::Option<std::string::String>>()?
5913                                .unwrap_or_default();
5914                        }
5915                        __FieldTag::__filter => {
5916                            if !fields.insert(__FieldTag::__filter) {
5917                                return std::result::Result::Err(A::Error::duplicate_field(
5918                                    "multiple values for filter",
5919                                ));
5920                            }
5921                            result.filter = map
5922                                .next_value::<std::option::Option<std::string::String>>()?
5923                                .unwrap_or_default();
5924                        }
5925                        __FieldTag::Unknown(key) => {
5926                            let value = map.next_value::<serde_json::Value>()?;
5927                            result._unknown_fields.insert(key, value);
5928                        }
5929                    }
5930                }
5931                std::result::Result::Ok(result)
5932            }
5933        }
5934        deserializer.deserialize_any(Visitor)
5935    }
5936}
5937
5938#[doc(hidden)]
5939impl serde::ser::Serialize for ListObjectsRequest {
5940    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
5941    where
5942        S: serde::ser::Serializer,
5943    {
5944        use serde::ser::SerializeMap;
5945        #[allow(unused_imports)]
5946        use std::option::Option::Some;
5947        let mut state = serializer.serialize_map(std::option::Option::None)?;
5948        if !self.parent.is_empty() {
5949            state.serialize_entry("parent", &self.parent)?;
5950        }
5951        if !wkt::internal::is_default(&self.page_size) {
5952            struct __With<'a>(&'a i32);
5953            impl<'a> serde::ser::Serialize for __With<'a> {
5954                fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
5955                where
5956                    S: serde::ser::Serializer,
5957                {
5958                    serde_with::As::<wkt::internal::I32>::serialize(self.0, serializer)
5959                }
5960            }
5961            state.serialize_entry("pageSize", &__With(&self.page_size))?;
5962        }
5963        if !self.page_token.is_empty() {
5964            state.serialize_entry("pageToken", &self.page_token)?;
5965        }
5966        if !self.delimiter.is_empty() {
5967            state.serialize_entry("delimiter", &self.delimiter)?;
5968        }
5969        if !wkt::internal::is_default(&self.include_trailing_delimiter) {
5970            state.serialize_entry("includeTrailingDelimiter", &self.include_trailing_delimiter)?;
5971        }
5972        if !self.prefix.is_empty() {
5973            state.serialize_entry("prefix", &self.prefix)?;
5974        }
5975        if !wkt::internal::is_default(&self.versions) {
5976            state.serialize_entry("versions", &self.versions)?;
5977        }
5978        if self.read_mask.is_some() {
5979            state.serialize_entry("readMask", &self.read_mask)?;
5980        }
5981        if !self.lexicographic_start.is_empty() {
5982            state.serialize_entry("lexicographicStart", &self.lexicographic_start)?;
5983        }
5984        if !self.lexicographic_end.is_empty() {
5985            state.serialize_entry("lexicographicEnd", &self.lexicographic_end)?;
5986        }
5987        if !wkt::internal::is_default(&self.soft_deleted) {
5988            state.serialize_entry("softDeleted", &self.soft_deleted)?;
5989        }
5990        if !wkt::internal::is_default(&self.include_folders_as_prefixes) {
5991            state.serialize_entry(
5992                "includeFoldersAsPrefixes",
5993                &self.include_folders_as_prefixes,
5994            )?;
5995        }
5996        if !self.match_glob.is_empty() {
5997            state.serialize_entry("matchGlob", &self.match_glob)?;
5998        }
5999        if !self.filter.is_empty() {
6000            state.serialize_entry("filter", &self.filter)?;
6001        }
6002        if !self._unknown_fields.is_empty() {
6003            for (key, value) in self._unknown_fields.iter() {
6004                state.serialize_entry(key, &value)?;
6005            }
6006        }
6007        state.end()
6008    }
6009}
6010
6011/// Request message for RewriteObject.
6012/// If the source object is encrypted using a Customer-Supplied Encryption Key
6013/// the key information must be provided in the copy_source_encryption_algorithm,
6014/// copy_source_encryption_key_bytes, and copy_source_encryption_key_sha256_bytes
6015/// fields. If the destination object should be encrypted the keying information
6016/// should be provided in the encryption_algorithm, encryption_key_bytes, and
6017/// encryption_key_sha256_bytes fields of the
6018/// common_object_request_params.customer_encryption field.
6019#[derive(Clone, Debug, Default, PartialEq)]
6020#[non_exhaustive]
6021pub struct RewriteObjectRequest {
6022    /// Required. Immutable. The name of the destination object.
6023    /// See the
6024    /// [Naming Guidelines](https://cloud.google.com/storage/docs/objects#naming).
6025    /// Example: `test.txt`
6026    /// The `name` field by itself does not uniquely identify a Cloud Storage
6027    /// object. A Cloud Storage object is uniquely identified by the tuple of
6028    /// (bucket, object, generation).
6029    pub destination_name: std::string::String,
6030
6031    /// Required. Immutable. The name of the bucket containing the destination
6032    /// object.
6033    pub destination_bucket: std::string::String,
6034
6035    /// Optional. The name of the Cloud KMS key that will be used to encrypt the
6036    /// destination object. The Cloud KMS key must be located in same location as
6037    /// the object. If the parameter is not specified, the request uses the
6038    /// destination bucket's default encryption key, if any, or else the
6039    /// Google-managed encryption key.
6040    pub destination_kms_key: std::string::String,
6041
6042    /// Optional. Properties of the destination, post-rewrite object.
6043    /// The `name`, `bucket` and `kms_key` fields must not be populated (these
6044    /// values are specified in the `destination_name`, `destination_bucket`, and
6045    /// `destination_kms_key` fields).
6046    /// If `destination` is present it will be used to construct the destination
6047    /// object's metadata; otherwise the destination object's metadata will be
6048    /// copied from the source object.
6049    pub destination: std::option::Option<crate::model::Object>,
6050
6051    /// Required. Name of the bucket in which to find the source object.
6052    pub source_bucket: std::string::String,
6053
6054    /// Required. Name of the source object.
6055    pub source_object: std::string::String,
6056
6057    /// Optional. If present, selects a specific revision of the source object (as
6058    /// opposed to the latest version, the default).
6059    pub source_generation: i64,
6060
6061    /// Optional. Include this field (from the previous rewrite response) on each
6062    /// rewrite request after the first one, until the rewrite response 'done' flag
6063    /// is true. Calls that provide a rewriteToken can omit all other request
6064    /// fields, but if included those fields must match the values provided in the
6065    /// first rewrite request.
6066    pub rewrite_token: std::string::String,
6067
6068    /// Optional. Apply a predefined set of access controls to the destination
6069    /// object. Valid values are "authenticatedRead", "bucketOwnerFullControl",
6070    /// "bucketOwnerRead", "private", "projectPrivate", or "publicRead".
6071    pub destination_predefined_acl: std::string::String,
6072
6073    /// Makes the operation conditional on whether the object's current generation
6074    /// matches the given value. Setting to 0 makes the operation succeed only if
6075    /// there are no live versions of the object.
6076    pub if_generation_match: std::option::Option<i64>,
6077
6078    /// Makes the operation conditional on whether the object's live generation
6079    /// does not match the given value. If no live object exists, the precondition
6080    /// fails. Setting to 0 makes the operation succeed only if there is a live
6081    /// version of the object.
6082    pub if_generation_not_match: std::option::Option<i64>,
6083
6084    /// Makes the operation conditional on whether the destination object's current
6085    /// metageneration matches the given value.
6086    pub if_metageneration_match: std::option::Option<i64>,
6087
6088    /// Makes the operation conditional on whether the destination object's current
6089    /// metageneration does not match the given value.
6090    pub if_metageneration_not_match: std::option::Option<i64>,
6091
6092    /// Makes the operation conditional on whether the source object's live
6093    /// generation matches the given value.
6094    pub if_source_generation_match: std::option::Option<i64>,
6095
6096    /// Makes the operation conditional on whether the source object's live
6097    /// generation does not match the given value.
6098    pub if_source_generation_not_match: std::option::Option<i64>,
6099
6100    /// Makes the operation conditional on whether the source object's current
6101    /// metageneration matches the given value.
6102    pub if_source_metageneration_match: std::option::Option<i64>,
6103
6104    /// Makes the operation conditional on whether the source object's current
6105    /// metageneration does not match the given value.
6106    pub if_source_metageneration_not_match: std::option::Option<i64>,
6107
6108    /// Optional. The maximum number of bytes that will be rewritten per rewrite
6109    /// request. Most callers shouldn't need to specify this parameter - it is
6110    /// primarily in place to support testing. If specified the value must be an
6111    /// integral multiple of 1 MiB (1048576). Also, this only applies to requests
6112    /// where the source and destination span locations and/or storage classes.
6113    /// Finally, this value must not change across rewrite calls else you'll get an
6114    /// error that the `rewriteToken` is invalid.
6115    pub max_bytes_rewritten_per_call: i64,
6116
6117    /// Optional. The algorithm used to encrypt the source object, if any. Used if
6118    /// the source object was encrypted with a Customer-Supplied Encryption Key.
6119    pub copy_source_encryption_algorithm: std::string::String,
6120
6121    /// Optional. The raw bytes (not base64-encoded) AES-256 encryption key used to
6122    /// encrypt the source object, if it was encrypted with a Customer-Supplied
6123    /// Encryption Key.
6124    pub copy_source_encryption_key_bytes: ::bytes::Bytes,
6125
6126    /// Optional. The raw bytes (not base64-encoded) SHA256 hash of the encryption
6127    /// key used to encrypt the source object, if it was encrypted with a
6128    /// Customer-Supplied Encryption Key.
6129    pub copy_source_encryption_key_sha256_bytes: ::bytes::Bytes,
6130
6131    /// Optional. A set of parameters common to Storage API requests concerning an
6132    /// object.
6133    pub common_object_request_params: std::option::Option<crate::model::CommonObjectRequestParams>,
6134
6135    /// Optional. The checksums of the complete object. This will be used to
6136    /// validate the destination object after rewriting.
6137    pub object_checksums: std::option::Option<crate::model::ObjectChecksums>,
6138
6139    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
6140}
6141
6142impl RewriteObjectRequest {
6143    pub fn new() -> Self {
6144        std::default::Default::default()
6145    }
6146
6147    /// Sets the value of [destination_name][crate::model::RewriteObjectRequest::destination_name].
6148    pub fn set_destination_name<T: std::convert::Into<std::string::String>>(
6149        mut self,
6150        v: T,
6151    ) -> Self {
6152        self.destination_name = v.into();
6153        self
6154    }
6155
6156    /// Sets the value of [destination_bucket][crate::model::RewriteObjectRequest::destination_bucket].
6157    pub fn set_destination_bucket<T: std::convert::Into<std::string::String>>(
6158        mut self,
6159        v: T,
6160    ) -> Self {
6161        self.destination_bucket = v.into();
6162        self
6163    }
6164
6165    /// Sets the value of [destination_kms_key][crate::model::RewriteObjectRequest::destination_kms_key].
6166    pub fn set_destination_kms_key<T: std::convert::Into<std::string::String>>(
6167        mut self,
6168        v: T,
6169    ) -> Self {
6170        self.destination_kms_key = v.into();
6171        self
6172    }
6173
6174    /// Sets the value of [destination][crate::model::RewriteObjectRequest::destination].
6175    pub fn set_destination<T>(mut self, v: T) -> Self
6176    where
6177        T: std::convert::Into<crate::model::Object>,
6178    {
6179        self.destination = std::option::Option::Some(v.into());
6180        self
6181    }
6182
6183    /// Sets or clears the value of [destination][crate::model::RewriteObjectRequest::destination].
6184    pub fn set_or_clear_destination<T>(mut self, v: std::option::Option<T>) -> Self
6185    where
6186        T: std::convert::Into<crate::model::Object>,
6187    {
6188        self.destination = v.map(|x| x.into());
6189        self
6190    }
6191
6192    /// Sets the value of [source_bucket][crate::model::RewriteObjectRequest::source_bucket].
6193    pub fn set_source_bucket<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6194        self.source_bucket = v.into();
6195        self
6196    }
6197
6198    /// Sets the value of [source_object][crate::model::RewriteObjectRequest::source_object].
6199    pub fn set_source_object<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6200        self.source_object = v.into();
6201        self
6202    }
6203
6204    /// Sets the value of [source_generation][crate::model::RewriteObjectRequest::source_generation].
6205    pub fn set_source_generation<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
6206        self.source_generation = v.into();
6207        self
6208    }
6209
6210    /// Sets the value of [rewrite_token][crate::model::RewriteObjectRequest::rewrite_token].
6211    pub fn set_rewrite_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6212        self.rewrite_token = v.into();
6213        self
6214    }
6215
6216    /// Sets the value of [destination_predefined_acl][crate::model::RewriteObjectRequest::destination_predefined_acl].
6217    pub fn set_destination_predefined_acl<T: std::convert::Into<std::string::String>>(
6218        mut self,
6219        v: T,
6220    ) -> Self {
6221        self.destination_predefined_acl = v.into();
6222        self
6223    }
6224
6225    /// Sets the value of [if_generation_match][crate::model::RewriteObjectRequest::if_generation_match].
6226    pub fn set_if_generation_match<T>(mut self, v: T) -> Self
6227    where
6228        T: std::convert::Into<i64>,
6229    {
6230        self.if_generation_match = std::option::Option::Some(v.into());
6231        self
6232    }
6233
6234    /// Sets or clears the value of [if_generation_match][crate::model::RewriteObjectRequest::if_generation_match].
6235    pub fn set_or_clear_if_generation_match<T>(mut self, v: std::option::Option<T>) -> Self
6236    where
6237        T: std::convert::Into<i64>,
6238    {
6239        self.if_generation_match = v.map(|x| x.into());
6240        self
6241    }
6242
6243    /// Sets the value of [if_generation_not_match][crate::model::RewriteObjectRequest::if_generation_not_match].
6244    pub fn set_if_generation_not_match<T>(mut self, v: T) -> Self
6245    where
6246        T: std::convert::Into<i64>,
6247    {
6248        self.if_generation_not_match = std::option::Option::Some(v.into());
6249        self
6250    }
6251
6252    /// Sets or clears the value of [if_generation_not_match][crate::model::RewriteObjectRequest::if_generation_not_match].
6253    pub fn set_or_clear_if_generation_not_match<T>(mut self, v: std::option::Option<T>) -> Self
6254    where
6255        T: std::convert::Into<i64>,
6256    {
6257        self.if_generation_not_match = v.map(|x| x.into());
6258        self
6259    }
6260
6261    /// Sets the value of [if_metageneration_match][crate::model::RewriteObjectRequest::if_metageneration_match].
6262    pub fn set_if_metageneration_match<T>(mut self, v: T) -> Self
6263    where
6264        T: std::convert::Into<i64>,
6265    {
6266        self.if_metageneration_match = std::option::Option::Some(v.into());
6267        self
6268    }
6269
6270    /// Sets or clears the value of [if_metageneration_match][crate::model::RewriteObjectRequest::if_metageneration_match].
6271    pub fn set_or_clear_if_metageneration_match<T>(mut self, v: std::option::Option<T>) -> Self
6272    where
6273        T: std::convert::Into<i64>,
6274    {
6275        self.if_metageneration_match = v.map(|x| x.into());
6276        self
6277    }
6278
6279    /// Sets the value of [if_metageneration_not_match][crate::model::RewriteObjectRequest::if_metageneration_not_match].
6280    pub fn set_if_metageneration_not_match<T>(mut self, v: T) -> Self
6281    where
6282        T: std::convert::Into<i64>,
6283    {
6284        self.if_metageneration_not_match = std::option::Option::Some(v.into());
6285        self
6286    }
6287
6288    /// Sets or clears the value of [if_metageneration_not_match][crate::model::RewriteObjectRequest::if_metageneration_not_match].
6289    pub fn set_or_clear_if_metageneration_not_match<T>(mut self, v: std::option::Option<T>) -> Self
6290    where
6291        T: std::convert::Into<i64>,
6292    {
6293        self.if_metageneration_not_match = v.map(|x| x.into());
6294        self
6295    }
6296
6297    /// Sets the value of [if_source_generation_match][crate::model::RewriteObjectRequest::if_source_generation_match].
6298    pub fn set_if_source_generation_match<T>(mut self, v: T) -> Self
6299    where
6300        T: std::convert::Into<i64>,
6301    {
6302        self.if_source_generation_match = std::option::Option::Some(v.into());
6303        self
6304    }
6305
6306    /// Sets or clears the value of [if_source_generation_match][crate::model::RewriteObjectRequest::if_source_generation_match].
6307    pub fn set_or_clear_if_source_generation_match<T>(mut self, v: std::option::Option<T>) -> Self
6308    where
6309        T: std::convert::Into<i64>,
6310    {
6311        self.if_source_generation_match = v.map(|x| x.into());
6312        self
6313    }
6314
6315    /// Sets the value of [if_source_generation_not_match][crate::model::RewriteObjectRequest::if_source_generation_not_match].
6316    pub fn set_if_source_generation_not_match<T>(mut self, v: T) -> Self
6317    where
6318        T: std::convert::Into<i64>,
6319    {
6320        self.if_source_generation_not_match = std::option::Option::Some(v.into());
6321        self
6322    }
6323
6324    /// Sets or clears the value of [if_source_generation_not_match][crate::model::RewriteObjectRequest::if_source_generation_not_match].
6325    pub fn set_or_clear_if_source_generation_not_match<T>(
6326        mut self,
6327        v: std::option::Option<T>,
6328    ) -> Self
6329    where
6330        T: std::convert::Into<i64>,
6331    {
6332        self.if_source_generation_not_match = v.map(|x| x.into());
6333        self
6334    }
6335
6336    /// Sets the value of [if_source_metageneration_match][crate::model::RewriteObjectRequest::if_source_metageneration_match].
6337    pub fn set_if_source_metageneration_match<T>(mut self, v: T) -> Self
6338    where
6339        T: std::convert::Into<i64>,
6340    {
6341        self.if_source_metageneration_match = std::option::Option::Some(v.into());
6342        self
6343    }
6344
6345    /// Sets or clears the value of [if_source_metageneration_match][crate::model::RewriteObjectRequest::if_source_metageneration_match].
6346    pub fn set_or_clear_if_source_metageneration_match<T>(
6347        mut self,
6348        v: std::option::Option<T>,
6349    ) -> Self
6350    where
6351        T: std::convert::Into<i64>,
6352    {
6353        self.if_source_metageneration_match = v.map(|x| x.into());
6354        self
6355    }
6356
6357    /// Sets the value of [if_source_metageneration_not_match][crate::model::RewriteObjectRequest::if_source_metageneration_not_match].
6358    pub fn set_if_source_metageneration_not_match<T>(mut self, v: T) -> Self
6359    where
6360        T: std::convert::Into<i64>,
6361    {
6362        self.if_source_metageneration_not_match = std::option::Option::Some(v.into());
6363        self
6364    }
6365
6366    /// Sets or clears the value of [if_source_metageneration_not_match][crate::model::RewriteObjectRequest::if_source_metageneration_not_match].
6367    pub fn set_or_clear_if_source_metageneration_not_match<T>(
6368        mut self,
6369        v: std::option::Option<T>,
6370    ) -> Self
6371    where
6372        T: std::convert::Into<i64>,
6373    {
6374        self.if_source_metageneration_not_match = v.map(|x| x.into());
6375        self
6376    }
6377
6378    /// Sets the value of [max_bytes_rewritten_per_call][crate::model::RewriteObjectRequest::max_bytes_rewritten_per_call].
6379    pub fn set_max_bytes_rewritten_per_call<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
6380        self.max_bytes_rewritten_per_call = v.into();
6381        self
6382    }
6383
6384    /// Sets the value of [copy_source_encryption_algorithm][crate::model::RewriteObjectRequest::copy_source_encryption_algorithm].
6385    pub fn set_copy_source_encryption_algorithm<T: std::convert::Into<std::string::String>>(
6386        mut self,
6387        v: T,
6388    ) -> Self {
6389        self.copy_source_encryption_algorithm = v.into();
6390        self
6391    }
6392
6393    /// Sets the value of [copy_source_encryption_key_bytes][crate::model::RewriteObjectRequest::copy_source_encryption_key_bytes].
6394    pub fn set_copy_source_encryption_key_bytes<T: std::convert::Into<::bytes::Bytes>>(
6395        mut self,
6396        v: T,
6397    ) -> Self {
6398        self.copy_source_encryption_key_bytes = v.into();
6399        self
6400    }
6401
6402    /// Sets the value of [copy_source_encryption_key_sha256_bytes][crate::model::RewriteObjectRequest::copy_source_encryption_key_sha256_bytes].
6403    pub fn set_copy_source_encryption_key_sha256_bytes<T: std::convert::Into<::bytes::Bytes>>(
6404        mut self,
6405        v: T,
6406    ) -> Self {
6407        self.copy_source_encryption_key_sha256_bytes = v.into();
6408        self
6409    }
6410
6411    /// Sets the value of [common_object_request_params][crate::model::RewriteObjectRequest::common_object_request_params].
6412    pub fn set_common_object_request_params<T>(mut self, v: T) -> Self
6413    where
6414        T: std::convert::Into<crate::model::CommonObjectRequestParams>,
6415    {
6416        self.common_object_request_params = std::option::Option::Some(v.into());
6417        self
6418    }
6419
6420    /// Sets or clears the value of [common_object_request_params][crate::model::RewriteObjectRequest::common_object_request_params].
6421    pub fn set_or_clear_common_object_request_params<T>(mut self, v: std::option::Option<T>) -> Self
6422    where
6423        T: std::convert::Into<crate::model::CommonObjectRequestParams>,
6424    {
6425        self.common_object_request_params = v.map(|x| x.into());
6426        self
6427    }
6428
6429    /// Sets the value of [object_checksums][crate::model::RewriteObjectRequest::object_checksums].
6430    pub fn set_object_checksums<T>(mut self, v: T) -> Self
6431    where
6432        T: std::convert::Into<crate::model::ObjectChecksums>,
6433    {
6434        self.object_checksums = std::option::Option::Some(v.into());
6435        self
6436    }
6437
6438    /// Sets or clears the value of [object_checksums][crate::model::RewriteObjectRequest::object_checksums].
6439    pub fn set_or_clear_object_checksums<T>(mut self, v: std::option::Option<T>) -> Self
6440    where
6441        T: std::convert::Into<crate::model::ObjectChecksums>,
6442    {
6443        self.object_checksums = v.map(|x| x.into());
6444        self
6445    }
6446}
6447
6448impl wkt::message::Message for RewriteObjectRequest {
6449    fn typename() -> &'static str {
6450        "type.googleapis.com/google.storage.v2.RewriteObjectRequest"
6451    }
6452}
6453
6454#[doc(hidden)]
6455impl<'de> serde::de::Deserialize<'de> for RewriteObjectRequest {
6456    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
6457    where
6458        D: serde::Deserializer<'de>,
6459    {
6460        #[allow(non_camel_case_types)]
6461        #[doc(hidden)]
6462        #[derive(PartialEq, Eq, Hash)]
6463        enum __FieldTag {
6464            __destination_name,
6465            __destination_bucket,
6466            __destination_kms_key,
6467            __destination,
6468            __source_bucket,
6469            __source_object,
6470            __source_generation,
6471            __rewrite_token,
6472            __destination_predefined_acl,
6473            __if_generation_match,
6474            __if_generation_not_match,
6475            __if_metageneration_match,
6476            __if_metageneration_not_match,
6477            __if_source_generation_match,
6478            __if_source_generation_not_match,
6479            __if_source_metageneration_match,
6480            __if_source_metageneration_not_match,
6481            __max_bytes_rewritten_per_call,
6482            __copy_source_encryption_algorithm,
6483            __copy_source_encryption_key_bytes,
6484            __copy_source_encryption_key_sha256_bytes,
6485            __common_object_request_params,
6486            __object_checksums,
6487            Unknown(std::string::String),
6488        }
6489        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
6490            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
6491            where
6492                D: serde::Deserializer<'de>,
6493            {
6494                struct Visitor;
6495                impl<'de> serde::de::Visitor<'de> for Visitor {
6496                    type Value = __FieldTag;
6497                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
6498                        formatter.write_str("a field name for RewriteObjectRequest")
6499                    }
6500                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
6501                    where
6502                        E: serde::de::Error,
6503                    {
6504                        use std::result::Result::Ok;
6505                        use std::string::ToString;
6506                        match value {
6507                            "destinationName" => Ok(__FieldTag::__destination_name),
6508                            "destination_name" => Ok(__FieldTag::__destination_name),
6509                            "destinationBucket" => Ok(__FieldTag::__destination_bucket),
6510                            "destination_bucket" => Ok(__FieldTag::__destination_bucket),
6511                            "destinationKmsKey" => Ok(__FieldTag::__destination_kms_key),
6512                            "destination_kms_key" => Ok(__FieldTag::__destination_kms_key),
6513                            "destination" => Ok(__FieldTag::__destination),
6514                            "sourceBucket" => Ok(__FieldTag::__source_bucket),
6515                            "source_bucket" => Ok(__FieldTag::__source_bucket),
6516                            "sourceObject" => Ok(__FieldTag::__source_object),
6517                            "source_object" => Ok(__FieldTag::__source_object),
6518                            "sourceGeneration" => Ok(__FieldTag::__source_generation),
6519                            "source_generation" => Ok(__FieldTag::__source_generation),
6520                            "rewriteToken" => Ok(__FieldTag::__rewrite_token),
6521                            "rewrite_token" => Ok(__FieldTag::__rewrite_token),
6522                            "destinationPredefinedAcl" => {
6523                                Ok(__FieldTag::__destination_predefined_acl)
6524                            }
6525                            "destination_predefined_acl" => {
6526                                Ok(__FieldTag::__destination_predefined_acl)
6527                            }
6528                            "ifGenerationMatch" => Ok(__FieldTag::__if_generation_match),
6529                            "if_generation_match" => Ok(__FieldTag::__if_generation_match),
6530                            "ifGenerationNotMatch" => Ok(__FieldTag::__if_generation_not_match),
6531                            "if_generation_not_match" => Ok(__FieldTag::__if_generation_not_match),
6532                            "ifMetagenerationMatch" => Ok(__FieldTag::__if_metageneration_match),
6533                            "if_metageneration_match" => Ok(__FieldTag::__if_metageneration_match),
6534                            "ifMetagenerationNotMatch" => {
6535                                Ok(__FieldTag::__if_metageneration_not_match)
6536                            }
6537                            "if_metageneration_not_match" => {
6538                                Ok(__FieldTag::__if_metageneration_not_match)
6539                            }
6540                            "ifSourceGenerationMatch" => {
6541                                Ok(__FieldTag::__if_source_generation_match)
6542                            }
6543                            "if_source_generation_match" => {
6544                                Ok(__FieldTag::__if_source_generation_match)
6545                            }
6546                            "ifSourceGenerationNotMatch" => {
6547                                Ok(__FieldTag::__if_source_generation_not_match)
6548                            }
6549                            "if_source_generation_not_match" => {
6550                                Ok(__FieldTag::__if_source_generation_not_match)
6551                            }
6552                            "ifSourceMetagenerationMatch" => {
6553                                Ok(__FieldTag::__if_source_metageneration_match)
6554                            }
6555                            "if_source_metageneration_match" => {
6556                                Ok(__FieldTag::__if_source_metageneration_match)
6557                            }
6558                            "ifSourceMetagenerationNotMatch" => {
6559                                Ok(__FieldTag::__if_source_metageneration_not_match)
6560                            }
6561                            "if_source_metageneration_not_match" => {
6562                                Ok(__FieldTag::__if_source_metageneration_not_match)
6563                            }
6564                            "maxBytesRewrittenPerCall" => {
6565                                Ok(__FieldTag::__max_bytes_rewritten_per_call)
6566                            }
6567                            "max_bytes_rewritten_per_call" => {
6568                                Ok(__FieldTag::__max_bytes_rewritten_per_call)
6569                            }
6570                            "copySourceEncryptionAlgorithm" => {
6571                                Ok(__FieldTag::__copy_source_encryption_algorithm)
6572                            }
6573                            "copy_source_encryption_algorithm" => {
6574                                Ok(__FieldTag::__copy_source_encryption_algorithm)
6575                            }
6576                            "copySourceEncryptionKeyBytes" => {
6577                                Ok(__FieldTag::__copy_source_encryption_key_bytes)
6578                            }
6579                            "copy_source_encryption_key_bytes" => {
6580                                Ok(__FieldTag::__copy_source_encryption_key_bytes)
6581                            }
6582                            "copySourceEncryptionKeySha256Bytes" => {
6583                                Ok(__FieldTag::__copy_source_encryption_key_sha256_bytes)
6584                            }
6585                            "copy_source_encryption_key_sha256_bytes" => {
6586                                Ok(__FieldTag::__copy_source_encryption_key_sha256_bytes)
6587                            }
6588                            "commonObjectRequestParams" => {
6589                                Ok(__FieldTag::__common_object_request_params)
6590                            }
6591                            "common_object_request_params" => {
6592                                Ok(__FieldTag::__common_object_request_params)
6593                            }
6594                            "objectChecksums" => Ok(__FieldTag::__object_checksums),
6595                            "object_checksums" => Ok(__FieldTag::__object_checksums),
6596                            _ => Ok(__FieldTag::Unknown(value.to_string())),
6597                        }
6598                    }
6599                }
6600                deserializer.deserialize_identifier(Visitor)
6601            }
6602        }
6603        struct Visitor;
6604        impl<'de> serde::de::Visitor<'de> for Visitor {
6605            type Value = RewriteObjectRequest;
6606            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
6607                formatter.write_str("struct RewriteObjectRequest")
6608            }
6609            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
6610            where
6611                A: serde::de::MapAccess<'de>,
6612            {
6613                #[allow(unused_imports)]
6614                use serde::de::Error;
6615                use std::option::Option::Some;
6616                let mut fields = std::collections::HashSet::new();
6617                let mut result = Self::Value::new();
6618                while let Some(tag) = map.next_key::<__FieldTag>()? {
6619                    #[allow(clippy::match_single_binding)]
6620                    match tag {
6621                        __FieldTag::__destination_name => {
6622                            if !fields.insert(__FieldTag::__destination_name) {
6623                                return std::result::Result::Err(A::Error::duplicate_field(
6624                                    "multiple values for destination_name",
6625                                ));
6626                            }
6627                            result.destination_name = map
6628                                .next_value::<std::option::Option<std::string::String>>()?
6629                                .unwrap_or_default();
6630                        }
6631                        __FieldTag::__destination_bucket => {
6632                            if !fields.insert(__FieldTag::__destination_bucket) {
6633                                return std::result::Result::Err(A::Error::duplicate_field(
6634                                    "multiple values for destination_bucket",
6635                                ));
6636                            }
6637                            result.destination_bucket = map
6638                                .next_value::<std::option::Option<std::string::String>>()?
6639                                .unwrap_or_default();
6640                        }
6641                        __FieldTag::__destination_kms_key => {
6642                            if !fields.insert(__FieldTag::__destination_kms_key) {
6643                                return std::result::Result::Err(A::Error::duplicate_field(
6644                                    "multiple values for destination_kms_key",
6645                                ));
6646                            }
6647                            result.destination_kms_key = map
6648                                .next_value::<std::option::Option<std::string::String>>()?
6649                                .unwrap_or_default();
6650                        }
6651                        __FieldTag::__destination => {
6652                            if !fields.insert(__FieldTag::__destination) {
6653                                return std::result::Result::Err(A::Error::duplicate_field(
6654                                    "multiple values for destination",
6655                                ));
6656                            }
6657                            result.destination =
6658                                map.next_value::<std::option::Option<crate::model::Object>>()?;
6659                        }
6660                        __FieldTag::__source_bucket => {
6661                            if !fields.insert(__FieldTag::__source_bucket) {
6662                                return std::result::Result::Err(A::Error::duplicate_field(
6663                                    "multiple values for source_bucket",
6664                                ));
6665                            }
6666                            result.source_bucket = map
6667                                .next_value::<std::option::Option<std::string::String>>()?
6668                                .unwrap_or_default();
6669                        }
6670                        __FieldTag::__source_object => {
6671                            if !fields.insert(__FieldTag::__source_object) {
6672                                return std::result::Result::Err(A::Error::duplicate_field(
6673                                    "multiple values for source_object",
6674                                ));
6675                            }
6676                            result.source_object = map
6677                                .next_value::<std::option::Option<std::string::String>>()?
6678                                .unwrap_or_default();
6679                        }
6680                        __FieldTag::__source_generation => {
6681                            if !fields.insert(__FieldTag::__source_generation) {
6682                                return std::result::Result::Err(A::Error::duplicate_field(
6683                                    "multiple values for source_generation",
6684                                ));
6685                            }
6686                            struct __With(std::option::Option<i64>);
6687                            impl<'de> serde::de::Deserialize<'de> for __With {
6688                                fn deserialize<D>(
6689                                    deserializer: D,
6690                                ) -> std::result::Result<Self, D::Error>
6691                                where
6692                                    D: serde::de::Deserializer<'de>,
6693                                {
6694                                    serde_with::As::< std::option::Option<wkt::internal::I64> >::deserialize(deserializer).map(__With)
6695                                }
6696                            }
6697                            result.source_generation =
6698                                map.next_value::<__With>()?.0.unwrap_or_default();
6699                        }
6700                        __FieldTag::__rewrite_token => {
6701                            if !fields.insert(__FieldTag::__rewrite_token) {
6702                                return std::result::Result::Err(A::Error::duplicate_field(
6703                                    "multiple values for rewrite_token",
6704                                ));
6705                            }
6706                            result.rewrite_token = map
6707                                .next_value::<std::option::Option<std::string::String>>()?
6708                                .unwrap_or_default();
6709                        }
6710                        __FieldTag::__destination_predefined_acl => {
6711                            if !fields.insert(__FieldTag::__destination_predefined_acl) {
6712                                return std::result::Result::Err(A::Error::duplicate_field(
6713                                    "multiple values for destination_predefined_acl",
6714                                ));
6715                            }
6716                            result.destination_predefined_acl = map
6717                                .next_value::<std::option::Option<std::string::String>>()?
6718                                .unwrap_or_default();
6719                        }
6720                        __FieldTag::__if_generation_match => {
6721                            if !fields.insert(__FieldTag::__if_generation_match) {
6722                                return std::result::Result::Err(A::Error::duplicate_field(
6723                                    "multiple values for if_generation_match",
6724                                ));
6725                            }
6726                            struct __With(std::option::Option<i64>);
6727                            impl<'de> serde::de::Deserialize<'de> for __With {
6728                                fn deserialize<D>(
6729                                    deserializer: D,
6730                                ) -> std::result::Result<Self, D::Error>
6731                                where
6732                                    D: serde::de::Deserializer<'de>,
6733                                {
6734                                    serde_with::As::< std::option::Option<wkt::internal::I64> >::deserialize(deserializer).map(__With)
6735                                }
6736                            }
6737                            result.if_generation_match = map.next_value::<__With>()?.0;
6738                        }
6739                        __FieldTag::__if_generation_not_match => {
6740                            if !fields.insert(__FieldTag::__if_generation_not_match) {
6741                                return std::result::Result::Err(A::Error::duplicate_field(
6742                                    "multiple values for if_generation_not_match",
6743                                ));
6744                            }
6745                            struct __With(std::option::Option<i64>);
6746                            impl<'de> serde::de::Deserialize<'de> for __With {
6747                                fn deserialize<D>(
6748                                    deserializer: D,
6749                                ) -> std::result::Result<Self, D::Error>
6750                                where
6751                                    D: serde::de::Deserializer<'de>,
6752                                {
6753                                    serde_with::As::< std::option::Option<wkt::internal::I64> >::deserialize(deserializer).map(__With)
6754                                }
6755                            }
6756                            result.if_generation_not_match = map.next_value::<__With>()?.0;
6757                        }
6758                        __FieldTag::__if_metageneration_match => {
6759                            if !fields.insert(__FieldTag::__if_metageneration_match) {
6760                                return std::result::Result::Err(A::Error::duplicate_field(
6761                                    "multiple values for if_metageneration_match",
6762                                ));
6763                            }
6764                            struct __With(std::option::Option<i64>);
6765                            impl<'de> serde::de::Deserialize<'de> for __With {
6766                                fn deserialize<D>(
6767                                    deserializer: D,
6768                                ) -> std::result::Result<Self, D::Error>
6769                                where
6770                                    D: serde::de::Deserializer<'de>,
6771                                {
6772                                    serde_with::As::< std::option::Option<wkt::internal::I64> >::deserialize(deserializer).map(__With)
6773                                }
6774                            }
6775                            result.if_metageneration_match = map.next_value::<__With>()?.0;
6776                        }
6777                        __FieldTag::__if_metageneration_not_match => {
6778                            if !fields.insert(__FieldTag::__if_metageneration_not_match) {
6779                                return std::result::Result::Err(A::Error::duplicate_field(
6780                                    "multiple values for if_metageneration_not_match",
6781                                ));
6782                            }
6783                            struct __With(std::option::Option<i64>);
6784                            impl<'de> serde::de::Deserialize<'de> for __With {
6785                                fn deserialize<D>(
6786                                    deserializer: D,
6787                                ) -> std::result::Result<Self, D::Error>
6788                                where
6789                                    D: serde::de::Deserializer<'de>,
6790                                {
6791                                    serde_with::As::< std::option::Option<wkt::internal::I64> >::deserialize(deserializer).map(__With)
6792                                }
6793                            }
6794                            result.if_metageneration_not_match = map.next_value::<__With>()?.0;
6795                        }
6796                        __FieldTag::__if_source_generation_match => {
6797                            if !fields.insert(__FieldTag::__if_source_generation_match) {
6798                                return std::result::Result::Err(A::Error::duplicate_field(
6799                                    "multiple values for if_source_generation_match",
6800                                ));
6801                            }
6802                            struct __With(std::option::Option<i64>);
6803                            impl<'de> serde::de::Deserialize<'de> for __With {
6804                                fn deserialize<D>(
6805                                    deserializer: D,
6806                                ) -> std::result::Result<Self, D::Error>
6807                                where
6808                                    D: serde::de::Deserializer<'de>,
6809                                {
6810                                    serde_with::As::< std::option::Option<wkt::internal::I64> >::deserialize(deserializer).map(__With)
6811                                }
6812                            }
6813                            result.if_source_generation_match = map.next_value::<__With>()?.0;
6814                        }
6815                        __FieldTag::__if_source_generation_not_match => {
6816                            if !fields.insert(__FieldTag::__if_source_generation_not_match) {
6817                                return std::result::Result::Err(A::Error::duplicate_field(
6818                                    "multiple values for if_source_generation_not_match",
6819                                ));
6820                            }
6821                            struct __With(std::option::Option<i64>);
6822                            impl<'de> serde::de::Deserialize<'de> for __With {
6823                                fn deserialize<D>(
6824                                    deserializer: D,
6825                                ) -> std::result::Result<Self, D::Error>
6826                                where
6827                                    D: serde::de::Deserializer<'de>,
6828                                {
6829                                    serde_with::As::< std::option::Option<wkt::internal::I64> >::deserialize(deserializer).map(__With)
6830                                }
6831                            }
6832                            result.if_source_generation_not_match = map.next_value::<__With>()?.0;
6833                        }
6834                        __FieldTag::__if_source_metageneration_match => {
6835                            if !fields.insert(__FieldTag::__if_source_metageneration_match) {
6836                                return std::result::Result::Err(A::Error::duplicate_field(
6837                                    "multiple values for if_source_metageneration_match",
6838                                ));
6839                            }
6840                            struct __With(std::option::Option<i64>);
6841                            impl<'de> serde::de::Deserialize<'de> for __With {
6842                                fn deserialize<D>(
6843                                    deserializer: D,
6844                                ) -> std::result::Result<Self, D::Error>
6845                                where
6846                                    D: serde::de::Deserializer<'de>,
6847                                {
6848                                    serde_with::As::< std::option::Option<wkt::internal::I64> >::deserialize(deserializer).map(__With)
6849                                }
6850                            }
6851                            result.if_source_metageneration_match = map.next_value::<__With>()?.0;
6852                        }
6853                        __FieldTag::__if_source_metageneration_not_match => {
6854                            if !fields.insert(__FieldTag::__if_source_metageneration_not_match) {
6855                                return std::result::Result::Err(A::Error::duplicate_field(
6856                                    "multiple values for if_source_metageneration_not_match",
6857                                ));
6858                            }
6859                            struct __With(std::option::Option<i64>);
6860                            impl<'de> serde::de::Deserialize<'de> for __With {
6861                                fn deserialize<D>(
6862                                    deserializer: D,
6863                                ) -> std::result::Result<Self, D::Error>
6864                                where
6865                                    D: serde::de::Deserializer<'de>,
6866                                {
6867                                    serde_with::As::< std::option::Option<wkt::internal::I64> >::deserialize(deserializer).map(__With)
6868                                }
6869                            }
6870                            result.if_source_metageneration_not_match =
6871                                map.next_value::<__With>()?.0;
6872                        }
6873                        __FieldTag::__max_bytes_rewritten_per_call => {
6874                            if !fields.insert(__FieldTag::__max_bytes_rewritten_per_call) {
6875                                return std::result::Result::Err(A::Error::duplicate_field(
6876                                    "multiple values for max_bytes_rewritten_per_call",
6877                                ));
6878                            }
6879                            struct __With(std::option::Option<i64>);
6880                            impl<'de> serde::de::Deserialize<'de> for __With {
6881                                fn deserialize<D>(
6882                                    deserializer: D,
6883                                ) -> std::result::Result<Self, D::Error>
6884                                where
6885                                    D: serde::de::Deserializer<'de>,
6886                                {
6887                                    serde_with::As::< std::option::Option<wkt::internal::I64> >::deserialize(deserializer).map(__With)
6888                                }
6889                            }
6890                            result.max_bytes_rewritten_per_call =
6891                                map.next_value::<__With>()?.0.unwrap_or_default();
6892                        }
6893                        __FieldTag::__copy_source_encryption_algorithm => {
6894                            if !fields.insert(__FieldTag::__copy_source_encryption_algorithm) {
6895                                return std::result::Result::Err(A::Error::duplicate_field(
6896                                    "multiple values for copy_source_encryption_algorithm",
6897                                ));
6898                            }
6899                            result.copy_source_encryption_algorithm = map
6900                                .next_value::<std::option::Option<std::string::String>>()?
6901                                .unwrap_or_default();
6902                        }
6903                        __FieldTag::__copy_source_encryption_key_bytes => {
6904                            if !fields.insert(__FieldTag::__copy_source_encryption_key_bytes) {
6905                                return std::result::Result::Err(A::Error::duplicate_field(
6906                                    "multiple values for copy_source_encryption_key_bytes",
6907                                ));
6908                            }
6909                            struct __With(std::option::Option<::bytes::Bytes>);
6910                            impl<'de> serde::de::Deserialize<'de> for __With {
6911                                fn deserialize<D>(
6912                                    deserializer: D,
6913                                ) -> std::result::Result<Self, D::Error>
6914                                where
6915                                    D: serde::de::Deserializer<'de>,
6916                                {
6917                                    serde_with::As::< std::option::Option<serde_with::base64::Base64> >::deserialize(deserializer).map(__With)
6918                                }
6919                            }
6920                            result.copy_source_encryption_key_bytes =
6921                                map.next_value::<__With>()?.0.unwrap_or_default();
6922                        }
6923                        __FieldTag::__copy_source_encryption_key_sha256_bytes => {
6924                            if !fields.insert(__FieldTag::__copy_source_encryption_key_sha256_bytes)
6925                            {
6926                                return std::result::Result::Err(A::Error::duplicate_field(
6927                                    "multiple values for copy_source_encryption_key_sha256_bytes",
6928                                ));
6929                            }
6930                            struct __With(std::option::Option<::bytes::Bytes>);
6931                            impl<'de> serde::de::Deserialize<'de> for __With {
6932                                fn deserialize<D>(
6933                                    deserializer: D,
6934                                ) -> std::result::Result<Self, D::Error>
6935                                where
6936                                    D: serde::de::Deserializer<'de>,
6937                                {
6938                                    serde_with::As::< std::option::Option<serde_with::base64::Base64> >::deserialize(deserializer).map(__With)
6939                                }
6940                            }
6941                            result.copy_source_encryption_key_sha256_bytes =
6942                                map.next_value::<__With>()?.0.unwrap_or_default();
6943                        }
6944                        __FieldTag::__common_object_request_params => {
6945                            if !fields.insert(__FieldTag::__common_object_request_params) {
6946                                return std::result::Result::Err(A::Error::duplicate_field(
6947                                    "multiple values for common_object_request_params",
6948                                ));
6949                            }
6950                            result.common_object_request_params = map.next_value::<std::option::Option<crate::model::CommonObjectRequestParams>>()?
6951                                ;
6952                        }
6953                        __FieldTag::__object_checksums => {
6954                            if !fields.insert(__FieldTag::__object_checksums) {
6955                                return std::result::Result::Err(A::Error::duplicate_field(
6956                                    "multiple values for object_checksums",
6957                                ));
6958                            }
6959                            result.object_checksums = map
6960                                .next_value::<std::option::Option<crate::model::ObjectChecksums>>(
6961                                )?;
6962                        }
6963                        __FieldTag::Unknown(key) => {
6964                            let value = map.next_value::<serde_json::Value>()?;
6965                            result._unknown_fields.insert(key, value);
6966                        }
6967                    }
6968                }
6969                std::result::Result::Ok(result)
6970            }
6971        }
6972        deserializer.deserialize_any(Visitor)
6973    }
6974}
6975
6976#[doc(hidden)]
6977impl serde::ser::Serialize for RewriteObjectRequest {
6978    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
6979    where
6980        S: serde::ser::Serializer,
6981    {
6982        use serde::ser::SerializeMap;
6983        #[allow(unused_imports)]
6984        use std::option::Option::Some;
6985        let mut state = serializer.serialize_map(std::option::Option::None)?;
6986        if !self.destination_name.is_empty() {
6987            state.serialize_entry("destinationName", &self.destination_name)?;
6988        }
6989        if !self.destination_bucket.is_empty() {
6990            state.serialize_entry("destinationBucket", &self.destination_bucket)?;
6991        }
6992        if !self.destination_kms_key.is_empty() {
6993            state.serialize_entry("destinationKmsKey", &self.destination_kms_key)?;
6994        }
6995        if self.destination.is_some() {
6996            state.serialize_entry("destination", &self.destination)?;
6997        }
6998        if !self.source_bucket.is_empty() {
6999            state.serialize_entry("sourceBucket", &self.source_bucket)?;
7000        }
7001        if !self.source_object.is_empty() {
7002            state.serialize_entry("sourceObject", &self.source_object)?;
7003        }
7004        if !wkt::internal::is_default(&self.source_generation) {
7005            struct __With<'a>(&'a i64);
7006            impl<'a> serde::ser::Serialize for __With<'a> {
7007                fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
7008                where
7009                    S: serde::ser::Serializer,
7010                {
7011                    serde_with::As::<wkt::internal::I64>::serialize(self.0, serializer)
7012                }
7013            }
7014            state.serialize_entry("sourceGeneration", &__With(&self.source_generation))?;
7015        }
7016        if !self.rewrite_token.is_empty() {
7017            state.serialize_entry("rewriteToken", &self.rewrite_token)?;
7018        }
7019        if !self.destination_predefined_acl.is_empty() {
7020            state.serialize_entry("destinationPredefinedAcl", &self.destination_predefined_acl)?;
7021        }
7022        if self.if_generation_match.is_some() {
7023            struct __With<'a>(&'a std::option::Option<i64>);
7024            impl<'a> serde::ser::Serialize for __With<'a> {
7025                fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
7026                where
7027                    S: serde::ser::Serializer,
7028                {
7029                    serde_with::As::<std::option::Option<wkt::internal::I64>>::serialize(
7030                        self.0, serializer,
7031                    )
7032                }
7033            }
7034            state.serialize_entry("ifGenerationMatch", &__With(&self.if_generation_match))?;
7035        }
7036        if self.if_generation_not_match.is_some() {
7037            struct __With<'a>(&'a std::option::Option<i64>);
7038            impl<'a> serde::ser::Serialize for __With<'a> {
7039                fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
7040                where
7041                    S: serde::ser::Serializer,
7042                {
7043                    serde_with::As::<std::option::Option<wkt::internal::I64>>::serialize(
7044                        self.0, serializer,
7045                    )
7046                }
7047            }
7048            state.serialize_entry(
7049                "ifGenerationNotMatch",
7050                &__With(&self.if_generation_not_match),
7051            )?;
7052        }
7053        if self.if_metageneration_match.is_some() {
7054            struct __With<'a>(&'a std::option::Option<i64>);
7055            impl<'a> serde::ser::Serialize for __With<'a> {
7056                fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
7057                where
7058                    S: serde::ser::Serializer,
7059                {
7060                    serde_with::As::<std::option::Option<wkt::internal::I64>>::serialize(
7061                        self.0, serializer,
7062                    )
7063                }
7064            }
7065            state.serialize_entry(
7066                "ifMetagenerationMatch",
7067                &__With(&self.if_metageneration_match),
7068            )?;
7069        }
7070        if self.if_metageneration_not_match.is_some() {
7071            struct __With<'a>(&'a std::option::Option<i64>);
7072            impl<'a> serde::ser::Serialize for __With<'a> {
7073                fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
7074                where
7075                    S: serde::ser::Serializer,
7076                {
7077                    serde_with::As::<std::option::Option<wkt::internal::I64>>::serialize(
7078                        self.0, serializer,
7079                    )
7080                }
7081            }
7082            state.serialize_entry(
7083                "ifMetagenerationNotMatch",
7084                &__With(&self.if_metageneration_not_match),
7085            )?;
7086        }
7087        if self.if_source_generation_match.is_some() {
7088            struct __With<'a>(&'a std::option::Option<i64>);
7089            impl<'a> serde::ser::Serialize for __With<'a> {
7090                fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
7091                where
7092                    S: serde::ser::Serializer,
7093                {
7094                    serde_with::As::<std::option::Option<wkt::internal::I64>>::serialize(
7095                        self.0, serializer,
7096                    )
7097                }
7098            }
7099            state.serialize_entry(
7100                "ifSourceGenerationMatch",
7101                &__With(&self.if_source_generation_match),
7102            )?;
7103        }
7104        if self.if_source_generation_not_match.is_some() {
7105            struct __With<'a>(&'a std::option::Option<i64>);
7106            impl<'a> serde::ser::Serialize for __With<'a> {
7107                fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
7108                where
7109                    S: serde::ser::Serializer,
7110                {
7111                    serde_with::As::<std::option::Option<wkt::internal::I64>>::serialize(
7112                        self.0, serializer,
7113                    )
7114                }
7115            }
7116            state.serialize_entry(
7117                "ifSourceGenerationNotMatch",
7118                &__With(&self.if_source_generation_not_match),
7119            )?;
7120        }
7121        if self.if_source_metageneration_match.is_some() {
7122            struct __With<'a>(&'a std::option::Option<i64>);
7123            impl<'a> serde::ser::Serialize for __With<'a> {
7124                fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
7125                where
7126                    S: serde::ser::Serializer,
7127                {
7128                    serde_with::As::<std::option::Option<wkt::internal::I64>>::serialize(
7129                        self.0, serializer,
7130                    )
7131                }
7132            }
7133            state.serialize_entry(
7134                "ifSourceMetagenerationMatch",
7135                &__With(&self.if_source_metageneration_match),
7136            )?;
7137        }
7138        if self.if_source_metageneration_not_match.is_some() {
7139            struct __With<'a>(&'a std::option::Option<i64>);
7140            impl<'a> serde::ser::Serialize for __With<'a> {
7141                fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
7142                where
7143                    S: serde::ser::Serializer,
7144                {
7145                    serde_with::As::<std::option::Option<wkt::internal::I64>>::serialize(
7146                        self.0, serializer,
7147                    )
7148                }
7149            }
7150            state.serialize_entry(
7151                "ifSourceMetagenerationNotMatch",
7152                &__With(&self.if_source_metageneration_not_match),
7153            )?;
7154        }
7155        if !wkt::internal::is_default(&self.max_bytes_rewritten_per_call) {
7156            struct __With<'a>(&'a i64);
7157            impl<'a> serde::ser::Serialize for __With<'a> {
7158                fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
7159                where
7160                    S: serde::ser::Serializer,
7161                {
7162                    serde_with::As::<wkt::internal::I64>::serialize(self.0, serializer)
7163                }
7164            }
7165            state.serialize_entry(
7166                "maxBytesRewrittenPerCall",
7167                &__With(&self.max_bytes_rewritten_per_call),
7168            )?;
7169        }
7170        if !self.copy_source_encryption_algorithm.is_empty() {
7171            state.serialize_entry(
7172                "copySourceEncryptionAlgorithm",
7173                &self.copy_source_encryption_algorithm,
7174            )?;
7175        }
7176        if !self.copy_source_encryption_key_bytes.is_empty() {
7177            struct __With<'a>(&'a ::bytes::Bytes);
7178            impl<'a> serde::ser::Serialize for __With<'a> {
7179                fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
7180                where
7181                    S: serde::ser::Serializer,
7182                {
7183                    serde_with::As::<serde_with::base64::Base64>::serialize(self.0, serializer)
7184                }
7185            }
7186            state.serialize_entry(
7187                "copySourceEncryptionKeyBytes",
7188                &__With(&self.copy_source_encryption_key_bytes),
7189            )?;
7190        }
7191        if !self.copy_source_encryption_key_sha256_bytes.is_empty() {
7192            struct __With<'a>(&'a ::bytes::Bytes);
7193            impl<'a> serde::ser::Serialize for __With<'a> {
7194                fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
7195                where
7196                    S: serde::ser::Serializer,
7197                {
7198                    serde_with::As::<serde_with::base64::Base64>::serialize(self.0, serializer)
7199                }
7200            }
7201            state.serialize_entry(
7202                "copySourceEncryptionKeySha256Bytes",
7203                &__With(&self.copy_source_encryption_key_sha256_bytes),
7204            )?;
7205        }
7206        if self.common_object_request_params.is_some() {
7207            state.serialize_entry(
7208                "commonObjectRequestParams",
7209                &self.common_object_request_params,
7210            )?;
7211        }
7212        if self.object_checksums.is_some() {
7213            state.serialize_entry("objectChecksums", &self.object_checksums)?;
7214        }
7215        if !self._unknown_fields.is_empty() {
7216            for (key, value) in self._unknown_fields.iter() {
7217                state.serialize_entry(key, &value)?;
7218            }
7219        }
7220        state.end()
7221    }
7222}
7223
7224/// A rewrite response.
7225#[derive(Clone, Debug, Default, PartialEq)]
7226#[non_exhaustive]
7227pub struct RewriteResponse {
7228    /// The total bytes written so far, which can be used to provide a waiting user
7229    /// with a progress indicator. This property is always present in the response.
7230    pub total_bytes_rewritten: i64,
7231
7232    /// The total size of the object being copied in bytes. This property is always
7233    /// present in the response.
7234    pub object_size: i64,
7235
7236    /// `true` if the copy is finished; otherwise, `false` if
7237    /// the copy is in progress. This property is always present in the response.
7238    pub done: bool,
7239
7240    /// A token to use in subsequent requests to continue copying data. This token
7241    /// is present in the response only when there is more data to copy.
7242    pub rewrite_token: std::string::String,
7243
7244    /// A resource containing the metadata for the copied-to object. This property
7245    /// is present in the response only when copying completes.
7246    pub resource: std::option::Option<crate::model::Object>,
7247
7248    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
7249}
7250
7251impl RewriteResponse {
7252    pub fn new() -> Self {
7253        std::default::Default::default()
7254    }
7255
7256    /// Sets the value of [total_bytes_rewritten][crate::model::RewriteResponse::total_bytes_rewritten].
7257    pub fn set_total_bytes_rewritten<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
7258        self.total_bytes_rewritten = v.into();
7259        self
7260    }
7261
7262    /// Sets the value of [object_size][crate::model::RewriteResponse::object_size].
7263    pub fn set_object_size<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
7264        self.object_size = v.into();
7265        self
7266    }
7267
7268    /// Sets the value of [done][crate::model::RewriteResponse::done].
7269    pub fn set_done<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
7270        self.done = v.into();
7271        self
7272    }
7273
7274    /// Sets the value of [rewrite_token][crate::model::RewriteResponse::rewrite_token].
7275    pub fn set_rewrite_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
7276        self.rewrite_token = v.into();
7277        self
7278    }
7279
7280    /// Sets the value of [resource][crate::model::RewriteResponse::resource].
7281    pub fn set_resource<T>(mut self, v: T) -> Self
7282    where
7283        T: std::convert::Into<crate::model::Object>,
7284    {
7285        self.resource = std::option::Option::Some(v.into());
7286        self
7287    }
7288
7289    /// Sets or clears the value of [resource][crate::model::RewriteResponse::resource].
7290    pub fn set_or_clear_resource<T>(mut self, v: std::option::Option<T>) -> Self
7291    where
7292        T: std::convert::Into<crate::model::Object>,
7293    {
7294        self.resource = v.map(|x| x.into());
7295        self
7296    }
7297}
7298
7299impl wkt::message::Message for RewriteResponse {
7300    fn typename() -> &'static str {
7301        "type.googleapis.com/google.storage.v2.RewriteResponse"
7302    }
7303}
7304
7305#[doc(hidden)]
7306impl<'de> serde::de::Deserialize<'de> for RewriteResponse {
7307    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
7308    where
7309        D: serde::Deserializer<'de>,
7310    {
7311        #[allow(non_camel_case_types)]
7312        #[doc(hidden)]
7313        #[derive(PartialEq, Eq, Hash)]
7314        enum __FieldTag {
7315            __total_bytes_rewritten,
7316            __object_size,
7317            __done,
7318            __rewrite_token,
7319            __resource,
7320            Unknown(std::string::String),
7321        }
7322        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
7323            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
7324            where
7325                D: serde::Deserializer<'de>,
7326            {
7327                struct Visitor;
7328                impl<'de> serde::de::Visitor<'de> for Visitor {
7329                    type Value = __FieldTag;
7330                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
7331                        formatter.write_str("a field name for RewriteResponse")
7332                    }
7333                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
7334                    where
7335                        E: serde::de::Error,
7336                    {
7337                        use std::result::Result::Ok;
7338                        use std::string::ToString;
7339                        match value {
7340                            "totalBytesRewritten" => Ok(__FieldTag::__total_bytes_rewritten),
7341                            "total_bytes_rewritten" => Ok(__FieldTag::__total_bytes_rewritten),
7342                            "objectSize" => Ok(__FieldTag::__object_size),
7343                            "object_size" => Ok(__FieldTag::__object_size),
7344                            "done" => Ok(__FieldTag::__done),
7345                            "rewriteToken" => Ok(__FieldTag::__rewrite_token),
7346                            "rewrite_token" => Ok(__FieldTag::__rewrite_token),
7347                            "resource" => Ok(__FieldTag::__resource),
7348                            _ => Ok(__FieldTag::Unknown(value.to_string())),
7349                        }
7350                    }
7351                }
7352                deserializer.deserialize_identifier(Visitor)
7353            }
7354        }
7355        struct Visitor;
7356        impl<'de> serde::de::Visitor<'de> for Visitor {
7357            type Value = RewriteResponse;
7358            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
7359                formatter.write_str("struct RewriteResponse")
7360            }
7361            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
7362            where
7363                A: serde::de::MapAccess<'de>,
7364            {
7365                #[allow(unused_imports)]
7366                use serde::de::Error;
7367                use std::option::Option::Some;
7368                let mut fields = std::collections::HashSet::new();
7369                let mut result = Self::Value::new();
7370                while let Some(tag) = map.next_key::<__FieldTag>()? {
7371                    #[allow(clippy::match_single_binding)]
7372                    match tag {
7373                        __FieldTag::__total_bytes_rewritten => {
7374                            if !fields.insert(__FieldTag::__total_bytes_rewritten) {
7375                                return std::result::Result::Err(A::Error::duplicate_field(
7376                                    "multiple values for total_bytes_rewritten",
7377                                ));
7378                            }
7379                            struct __With(std::option::Option<i64>);
7380                            impl<'de> serde::de::Deserialize<'de> for __With {
7381                                fn deserialize<D>(
7382                                    deserializer: D,
7383                                ) -> std::result::Result<Self, D::Error>
7384                                where
7385                                    D: serde::de::Deserializer<'de>,
7386                                {
7387                                    serde_with::As::< std::option::Option<wkt::internal::I64> >::deserialize(deserializer).map(__With)
7388                                }
7389                            }
7390                            result.total_bytes_rewritten =
7391                                map.next_value::<__With>()?.0.unwrap_or_default();
7392                        }
7393                        __FieldTag::__object_size => {
7394                            if !fields.insert(__FieldTag::__object_size) {
7395                                return std::result::Result::Err(A::Error::duplicate_field(
7396                                    "multiple values for object_size",
7397                                ));
7398                            }
7399                            struct __With(std::option::Option<i64>);
7400                            impl<'de> serde::de::Deserialize<'de> for __With {
7401                                fn deserialize<D>(
7402                                    deserializer: D,
7403                                ) -> std::result::Result<Self, D::Error>
7404                                where
7405                                    D: serde::de::Deserializer<'de>,
7406                                {
7407                                    serde_with::As::< std::option::Option<wkt::internal::I64> >::deserialize(deserializer).map(__With)
7408                                }
7409                            }
7410                            result.object_size = map.next_value::<__With>()?.0.unwrap_or_default();
7411                        }
7412                        __FieldTag::__done => {
7413                            if !fields.insert(__FieldTag::__done) {
7414                                return std::result::Result::Err(A::Error::duplicate_field(
7415                                    "multiple values for done",
7416                                ));
7417                            }
7418                            result.done = map
7419                                .next_value::<std::option::Option<bool>>()?
7420                                .unwrap_or_default();
7421                        }
7422                        __FieldTag::__rewrite_token => {
7423                            if !fields.insert(__FieldTag::__rewrite_token) {
7424                                return std::result::Result::Err(A::Error::duplicate_field(
7425                                    "multiple values for rewrite_token",
7426                                ));
7427                            }
7428                            result.rewrite_token = map
7429                                .next_value::<std::option::Option<std::string::String>>()?
7430                                .unwrap_or_default();
7431                        }
7432                        __FieldTag::__resource => {
7433                            if !fields.insert(__FieldTag::__resource) {
7434                                return std::result::Result::Err(A::Error::duplicate_field(
7435                                    "multiple values for resource",
7436                                ));
7437                            }
7438                            result.resource =
7439                                map.next_value::<std::option::Option<crate::model::Object>>()?;
7440                        }
7441                        __FieldTag::Unknown(key) => {
7442                            let value = map.next_value::<serde_json::Value>()?;
7443                            result._unknown_fields.insert(key, value);
7444                        }
7445                    }
7446                }
7447                std::result::Result::Ok(result)
7448            }
7449        }
7450        deserializer.deserialize_any(Visitor)
7451    }
7452}
7453
7454#[doc(hidden)]
7455impl serde::ser::Serialize for RewriteResponse {
7456    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
7457    where
7458        S: serde::ser::Serializer,
7459    {
7460        use serde::ser::SerializeMap;
7461        #[allow(unused_imports)]
7462        use std::option::Option::Some;
7463        let mut state = serializer.serialize_map(std::option::Option::None)?;
7464        if !wkt::internal::is_default(&self.total_bytes_rewritten) {
7465            struct __With<'a>(&'a i64);
7466            impl<'a> serde::ser::Serialize for __With<'a> {
7467                fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
7468                where
7469                    S: serde::ser::Serializer,
7470                {
7471                    serde_with::As::<wkt::internal::I64>::serialize(self.0, serializer)
7472                }
7473            }
7474            state.serialize_entry("totalBytesRewritten", &__With(&self.total_bytes_rewritten))?;
7475        }
7476        if !wkt::internal::is_default(&self.object_size) {
7477            struct __With<'a>(&'a i64);
7478            impl<'a> serde::ser::Serialize for __With<'a> {
7479                fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
7480                where
7481                    S: serde::ser::Serializer,
7482                {
7483                    serde_with::As::<wkt::internal::I64>::serialize(self.0, serializer)
7484                }
7485            }
7486            state.serialize_entry("objectSize", &__With(&self.object_size))?;
7487        }
7488        if !wkt::internal::is_default(&self.done) {
7489            state.serialize_entry("done", &self.done)?;
7490        }
7491        if !self.rewrite_token.is_empty() {
7492            state.serialize_entry("rewriteToken", &self.rewrite_token)?;
7493        }
7494        if self.resource.is_some() {
7495            state.serialize_entry("resource", &self.resource)?;
7496        }
7497        if !self._unknown_fields.is_empty() {
7498            for (key, value) in self._unknown_fields.iter() {
7499                state.serialize_entry(key, &value)?;
7500            }
7501        }
7502        state.end()
7503    }
7504}
7505
7506/// Request message for MoveObject.
7507#[derive(Clone, Debug, Default, PartialEq)]
7508#[non_exhaustive]
7509pub struct MoveObjectRequest {
7510    /// Required. Name of the bucket in which the object resides.
7511    pub bucket: std::string::String,
7512
7513    /// Required. Name of the source object.
7514    pub source_object: std::string::String,
7515
7516    /// Required. Name of the destination object.
7517    pub destination_object: std::string::String,
7518
7519    /// Optional. Makes the operation conditional on whether the source object's
7520    /// current generation matches the given value. `if_source_generation_match`
7521    /// and `if_source_generation_not_match` conditions are mutually exclusive:
7522    /// it's an error for both of them to be set in the request.
7523    pub if_source_generation_match: std::option::Option<i64>,
7524
7525    /// Optional. Makes the operation conditional on whether the source object's
7526    /// current generation does not match the given value.
7527    /// `if_source_generation_match` and `if_source_generation_not_match`
7528    /// conditions are mutually exclusive: it's an error for both of them to be set
7529    /// in the request.
7530    pub if_source_generation_not_match: std::option::Option<i64>,
7531
7532    /// Optional. Makes the operation conditional on whether the source object's
7533    /// current metageneration matches the given value.
7534    /// `if_source_metageneration_match` and `if_source_metageneration_not_match`
7535    /// conditions are mutually exclusive: it's an error for both of them to be set
7536    /// in the request.
7537    pub if_source_metageneration_match: std::option::Option<i64>,
7538
7539    /// Optional. Makes the operation conditional on whether the source object's
7540    /// current metageneration does not match the given value.
7541    /// `if_source_metageneration_match` and `if_source_metageneration_not_match`
7542    /// conditions are mutually exclusive: it's an error for both of them to be set
7543    /// in the request.
7544    pub if_source_metageneration_not_match: std::option::Option<i64>,
7545
7546    /// Optional. Makes the operation conditional on whether the destination
7547    /// object's current generation matches the given value. Setting to 0 makes the
7548    /// operation succeed only if there are no live versions of the object.
7549    /// `if_generation_match` and `if_generation_not_match` conditions are mutually
7550    /// exclusive: it's an error for both of them to be set in the request.
7551    pub if_generation_match: std::option::Option<i64>,
7552
7553    /// Optional. Makes the operation conditional on whether the destination
7554    /// object's current generation does not match the given value. If no live
7555    /// object exists, the precondition fails. Setting to 0 makes the operation
7556    /// succeed only if there is a live version of the object.
7557    /// `if_generation_match` and `if_generation_not_match` conditions are mutually
7558    /// exclusive: it's an error for both of them to be set in the request.
7559    pub if_generation_not_match: std::option::Option<i64>,
7560
7561    /// Optional. Makes the operation conditional on whether the destination
7562    /// object's current metageneration matches the given value.
7563    /// `if_metageneration_match` and `if_metageneration_not_match` conditions are
7564    /// mutually exclusive: it's an error for both of them to be set in the
7565    /// request.
7566    pub if_metageneration_match: std::option::Option<i64>,
7567
7568    /// Optional. Makes the operation conditional on whether the destination
7569    /// object's current metageneration does not match the given value.
7570    /// `if_metageneration_match` and `if_metageneration_not_match` conditions are
7571    /// mutually exclusive: it's an error for both of them to be set in the
7572    /// request.
7573    pub if_metageneration_not_match: std::option::Option<i64>,
7574
7575    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
7576}
7577
7578impl MoveObjectRequest {
7579    pub fn new() -> Self {
7580        std::default::Default::default()
7581    }
7582
7583    /// Sets the value of [bucket][crate::model::MoveObjectRequest::bucket].
7584    pub fn set_bucket<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
7585        self.bucket = v.into();
7586        self
7587    }
7588
7589    /// Sets the value of [source_object][crate::model::MoveObjectRequest::source_object].
7590    pub fn set_source_object<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
7591        self.source_object = v.into();
7592        self
7593    }
7594
7595    /// Sets the value of [destination_object][crate::model::MoveObjectRequest::destination_object].
7596    pub fn set_destination_object<T: std::convert::Into<std::string::String>>(
7597        mut self,
7598        v: T,
7599    ) -> Self {
7600        self.destination_object = v.into();
7601        self
7602    }
7603
7604    /// Sets the value of [if_source_generation_match][crate::model::MoveObjectRequest::if_source_generation_match].
7605    pub fn set_if_source_generation_match<T>(mut self, v: T) -> Self
7606    where
7607        T: std::convert::Into<i64>,
7608    {
7609        self.if_source_generation_match = std::option::Option::Some(v.into());
7610        self
7611    }
7612
7613    /// Sets or clears the value of [if_source_generation_match][crate::model::MoveObjectRequest::if_source_generation_match].
7614    pub fn set_or_clear_if_source_generation_match<T>(mut self, v: std::option::Option<T>) -> Self
7615    where
7616        T: std::convert::Into<i64>,
7617    {
7618        self.if_source_generation_match = v.map(|x| x.into());
7619        self
7620    }
7621
7622    /// Sets the value of [if_source_generation_not_match][crate::model::MoveObjectRequest::if_source_generation_not_match].
7623    pub fn set_if_source_generation_not_match<T>(mut self, v: T) -> Self
7624    where
7625        T: std::convert::Into<i64>,
7626    {
7627        self.if_source_generation_not_match = std::option::Option::Some(v.into());
7628        self
7629    }
7630
7631    /// Sets or clears the value of [if_source_generation_not_match][crate::model::MoveObjectRequest::if_source_generation_not_match].
7632    pub fn set_or_clear_if_source_generation_not_match<T>(
7633        mut self,
7634        v: std::option::Option<T>,
7635    ) -> Self
7636    where
7637        T: std::convert::Into<i64>,
7638    {
7639        self.if_source_generation_not_match = v.map(|x| x.into());
7640        self
7641    }
7642
7643    /// Sets the value of [if_source_metageneration_match][crate::model::MoveObjectRequest::if_source_metageneration_match].
7644    pub fn set_if_source_metageneration_match<T>(mut self, v: T) -> Self
7645    where
7646        T: std::convert::Into<i64>,
7647    {
7648        self.if_source_metageneration_match = std::option::Option::Some(v.into());
7649        self
7650    }
7651
7652    /// Sets or clears the value of [if_source_metageneration_match][crate::model::MoveObjectRequest::if_source_metageneration_match].
7653    pub fn set_or_clear_if_source_metageneration_match<T>(
7654        mut self,
7655        v: std::option::Option<T>,
7656    ) -> Self
7657    where
7658        T: std::convert::Into<i64>,
7659    {
7660        self.if_source_metageneration_match = v.map(|x| x.into());
7661        self
7662    }
7663
7664    /// Sets the value of [if_source_metageneration_not_match][crate::model::MoveObjectRequest::if_source_metageneration_not_match].
7665    pub fn set_if_source_metageneration_not_match<T>(mut self, v: T) -> Self
7666    where
7667        T: std::convert::Into<i64>,
7668    {
7669        self.if_source_metageneration_not_match = std::option::Option::Some(v.into());
7670        self
7671    }
7672
7673    /// Sets or clears the value of [if_source_metageneration_not_match][crate::model::MoveObjectRequest::if_source_metageneration_not_match].
7674    pub fn set_or_clear_if_source_metageneration_not_match<T>(
7675        mut self,
7676        v: std::option::Option<T>,
7677    ) -> Self
7678    where
7679        T: std::convert::Into<i64>,
7680    {
7681        self.if_source_metageneration_not_match = v.map(|x| x.into());
7682        self
7683    }
7684
7685    /// Sets the value of [if_generation_match][crate::model::MoveObjectRequest::if_generation_match].
7686    pub fn set_if_generation_match<T>(mut self, v: T) -> Self
7687    where
7688        T: std::convert::Into<i64>,
7689    {
7690        self.if_generation_match = std::option::Option::Some(v.into());
7691        self
7692    }
7693
7694    /// Sets or clears the value of [if_generation_match][crate::model::MoveObjectRequest::if_generation_match].
7695    pub fn set_or_clear_if_generation_match<T>(mut self, v: std::option::Option<T>) -> Self
7696    where
7697        T: std::convert::Into<i64>,
7698    {
7699        self.if_generation_match = v.map(|x| x.into());
7700        self
7701    }
7702
7703    /// Sets the value of [if_generation_not_match][crate::model::MoveObjectRequest::if_generation_not_match].
7704    pub fn set_if_generation_not_match<T>(mut self, v: T) -> Self
7705    where
7706        T: std::convert::Into<i64>,
7707    {
7708        self.if_generation_not_match = std::option::Option::Some(v.into());
7709        self
7710    }
7711
7712    /// Sets or clears the value of [if_generation_not_match][crate::model::MoveObjectRequest::if_generation_not_match].
7713    pub fn set_or_clear_if_generation_not_match<T>(mut self, v: std::option::Option<T>) -> Self
7714    where
7715        T: std::convert::Into<i64>,
7716    {
7717        self.if_generation_not_match = v.map(|x| x.into());
7718        self
7719    }
7720
7721    /// Sets the value of [if_metageneration_match][crate::model::MoveObjectRequest::if_metageneration_match].
7722    pub fn set_if_metageneration_match<T>(mut self, v: T) -> Self
7723    where
7724        T: std::convert::Into<i64>,
7725    {
7726        self.if_metageneration_match = std::option::Option::Some(v.into());
7727        self
7728    }
7729
7730    /// Sets or clears the value of [if_metageneration_match][crate::model::MoveObjectRequest::if_metageneration_match].
7731    pub fn set_or_clear_if_metageneration_match<T>(mut self, v: std::option::Option<T>) -> Self
7732    where
7733        T: std::convert::Into<i64>,
7734    {
7735        self.if_metageneration_match = v.map(|x| x.into());
7736        self
7737    }
7738
7739    /// Sets the value of [if_metageneration_not_match][crate::model::MoveObjectRequest::if_metageneration_not_match].
7740    pub fn set_if_metageneration_not_match<T>(mut self, v: T) -> Self
7741    where
7742        T: std::convert::Into<i64>,
7743    {
7744        self.if_metageneration_not_match = std::option::Option::Some(v.into());
7745        self
7746    }
7747
7748    /// Sets or clears the value of [if_metageneration_not_match][crate::model::MoveObjectRequest::if_metageneration_not_match].
7749    pub fn set_or_clear_if_metageneration_not_match<T>(mut self, v: std::option::Option<T>) -> Self
7750    where
7751        T: std::convert::Into<i64>,
7752    {
7753        self.if_metageneration_not_match = v.map(|x| x.into());
7754        self
7755    }
7756}
7757
7758impl wkt::message::Message for MoveObjectRequest {
7759    fn typename() -> &'static str {
7760        "type.googleapis.com/google.storage.v2.MoveObjectRequest"
7761    }
7762}
7763
7764#[doc(hidden)]
7765impl<'de> serde::de::Deserialize<'de> for MoveObjectRequest {
7766    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
7767    where
7768        D: serde::Deserializer<'de>,
7769    {
7770        #[allow(non_camel_case_types)]
7771        #[doc(hidden)]
7772        #[derive(PartialEq, Eq, Hash)]
7773        enum __FieldTag {
7774            __bucket,
7775            __source_object,
7776            __destination_object,
7777            __if_source_generation_match,
7778            __if_source_generation_not_match,
7779            __if_source_metageneration_match,
7780            __if_source_metageneration_not_match,
7781            __if_generation_match,
7782            __if_generation_not_match,
7783            __if_metageneration_match,
7784            __if_metageneration_not_match,
7785            Unknown(std::string::String),
7786        }
7787        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
7788            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
7789            where
7790                D: serde::Deserializer<'de>,
7791            {
7792                struct Visitor;
7793                impl<'de> serde::de::Visitor<'de> for Visitor {
7794                    type Value = __FieldTag;
7795                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
7796                        formatter.write_str("a field name for MoveObjectRequest")
7797                    }
7798                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
7799                    where
7800                        E: serde::de::Error,
7801                    {
7802                        use std::result::Result::Ok;
7803                        use std::string::ToString;
7804                        match value {
7805                            "bucket" => Ok(__FieldTag::__bucket),
7806                            "sourceObject" => Ok(__FieldTag::__source_object),
7807                            "source_object" => Ok(__FieldTag::__source_object),
7808                            "destinationObject" => Ok(__FieldTag::__destination_object),
7809                            "destination_object" => Ok(__FieldTag::__destination_object),
7810                            "ifSourceGenerationMatch" => {
7811                                Ok(__FieldTag::__if_source_generation_match)
7812                            }
7813                            "if_source_generation_match" => {
7814                                Ok(__FieldTag::__if_source_generation_match)
7815                            }
7816                            "ifSourceGenerationNotMatch" => {
7817                                Ok(__FieldTag::__if_source_generation_not_match)
7818                            }
7819                            "if_source_generation_not_match" => {
7820                                Ok(__FieldTag::__if_source_generation_not_match)
7821                            }
7822                            "ifSourceMetagenerationMatch" => {
7823                                Ok(__FieldTag::__if_source_metageneration_match)
7824                            }
7825                            "if_source_metageneration_match" => {
7826                                Ok(__FieldTag::__if_source_metageneration_match)
7827                            }
7828                            "ifSourceMetagenerationNotMatch" => {
7829                                Ok(__FieldTag::__if_source_metageneration_not_match)
7830                            }
7831                            "if_source_metageneration_not_match" => {
7832                                Ok(__FieldTag::__if_source_metageneration_not_match)
7833                            }
7834                            "ifGenerationMatch" => Ok(__FieldTag::__if_generation_match),
7835                            "if_generation_match" => Ok(__FieldTag::__if_generation_match),
7836                            "ifGenerationNotMatch" => Ok(__FieldTag::__if_generation_not_match),
7837                            "if_generation_not_match" => Ok(__FieldTag::__if_generation_not_match),
7838                            "ifMetagenerationMatch" => Ok(__FieldTag::__if_metageneration_match),
7839                            "if_metageneration_match" => Ok(__FieldTag::__if_metageneration_match),
7840                            "ifMetagenerationNotMatch" => {
7841                                Ok(__FieldTag::__if_metageneration_not_match)
7842                            }
7843                            "if_metageneration_not_match" => {
7844                                Ok(__FieldTag::__if_metageneration_not_match)
7845                            }
7846                            _ => Ok(__FieldTag::Unknown(value.to_string())),
7847                        }
7848                    }
7849                }
7850                deserializer.deserialize_identifier(Visitor)
7851            }
7852        }
7853        struct Visitor;
7854        impl<'de> serde::de::Visitor<'de> for Visitor {
7855            type Value = MoveObjectRequest;
7856            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
7857                formatter.write_str("struct MoveObjectRequest")
7858            }
7859            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
7860            where
7861                A: serde::de::MapAccess<'de>,
7862            {
7863                #[allow(unused_imports)]
7864                use serde::de::Error;
7865                use std::option::Option::Some;
7866                let mut fields = std::collections::HashSet::new();
7867                let mut result = Self::Value::new();
7868                while let Some(tag) = map.next_key::<__FieldTag>()? {
7869                    #[allow(clippy::match_single_binding)]
7870                    match tag {
7871                        __FieldTag::__bucket => {
7872                            if !fields.insert(__FieldTag::__bucket) {
7873                                return std::result::Result::Err(A::Error::duplicate_field(
7874                                    "multiple values for bucket",
7875                                ));
7876                            }
7877                            result.bucket = map
7878                                .next_value::<std::option::Option<std::string::String>>()?
7879                                .unwrap_or_default();
7880                        }
7881                        __FieldTag::__source_object => {
7882                            if !fields.insert(__FieldTag::__source_object) {
7883                                return std::result::Result::Err(A::Error::duplicate_field(
7884                                    "multiple values for source_object",
7885                                ));
7886                            }
7887                            result.source_object = map
7888                                .next_value::<std::option::Option<std::string::String>>()?
7889                                .unwrap_or_default();
7890                        }
7891                        __FieldTag::__destination_object => {
7892                            if !fields.insert(__FieldTag::__destination_object) {
7893                                return std::result::Result::Err(A::Error::duplicate_field(
7894                                    "multiple values for destination_object",
7895                                ));
7896                            }
7897                            result.destination_object = map
7898                                .next_value::<std::option::Option<std::string::String>>()?
7899                                .unwrap_or_default();
7900                        }
7901                        __FieldTag::__if_source_generation_match => {
7902                            if !fields.insert(__FieldTag::__if_source_generation_match) {
7903                                return std::result::Result::Err(A::Error::duplicate_field(
7904                                    "multiple values for if_source_generation_match",
7905                                ));
7906                            }
7907                            struct __With(std::option::Option<i64>);
7908                            impl<'de> serde::de::Deserialize<'de> for __With {
7909                                fn deserialize<D>(
7910                                    deserializer: D,
7911                                ) -> std::result::Result<Self, D::Error>
7912                                where
7913                                    D: serde::de::Deserializer<'de>,
7914                                {
7915                                    serde_with::As::< std::option::Option<wkt::internal::I64> >::deserialize(deserializer).map(__With)
7916                                }
7917                            }
7918                            result.if_source_generation_match = map.next_value::<__With>()?.0;
7919                        }
7920                        __FieldTag::__if_source_generation_not_match => {
7921                            if !fields.insert(__FieldTag::__if_source_generation_not_match) {
7922                                return std::result::Result::Err(A::Error::duplicate_field(
7923                                    "multiple values for if_source_generation_not_match",
7924                                ));
7925                            }
7926                            struct __With(std::option::Option<i64>);
7927                            impl<'de> serde::de::Deserialize<'de> for __With {
7928                                fn deserialize<D>(
7929                                    deserializer: D,
7930                                ) -> std::result::Result<Self, D::Error>
7931                                where
7932                                    D: serde::de::Deserializer<'de>,
7933                                {
7934                                    serde_with::As::< std::option::Option<wkt::internal::I64> >::deserialize(deserializer).map(__With)
7935                                }
7936                            }
7937                            result.if_source_generation_not_match = map.next_value::<__With>()?.0;
7938                        }
7939                        __FieldTag::__if_source_metageneration_match => {
7940                            if !fields.insert(__FieldTag::__if_source_metageneration_match) {
7941                                return std::result::Result::Err(A::Error::duplicate_field(
7942                                    "multiple values for if_source_metageneration_match",
7943                                ));
7944                            }
7945                            struct __With(std::option::Option<i64>);
7946                            impl<'de> serde::de::Deserialize<'de> for __With {
7947                                fn deserialize<D>(
7948                                    deserializer: D,
7949                                ) -> std::result::Result<Self, D::Error>
7950                                where
7951                                    D: serde::de::Deserializer<'de>,
7952                                {
7953                                    serde_with::As::< std::option::Option<wkt::internal::I64> >::deserialize(deserializer).map(__With)
7954                                }
7955                            }
7956                            result.if_source_metageneration_match = map.next_value::<__With>()?.0;
7957                        }
7958                        __FieldTag::__if_source_metageneration_not_match => {
7959                            if !fields.insert(__FieldTag::__if_source_metageneration_not_match) {
7960                                return std::result::Result::Err(A::Error::duplicate_field(
7961                                    "multiple values for if_source_metageneration_not_match",
7962                                ));
7963                            }
7964                            struct __With(std::option::Option<i64>);
7965                            impl<'de> serde::de::Deserialize<'de> for __With {
7966                                fn deserialize<D>(
7967                                    deserializer: D,
7968                                ) -> std::result::Result<Self, D::Error>
7969                                where
7970                                    D: serde::de::Deserializer<'de>,
7971                                {
7972                                    serde_with::As::< std::option::Option<wkt::internal::I64> >::deserialize(deserializer).map(__With)
7973                                }
7974                            }
7975                            result.if_source_metageneration_not_match =
7976                                map.next_value::<__With>()?.0;
7977                        }
7978                        __FieldTag::__if_generation_match => {
7979                            if !fields.insert(__FieldTag::__if_generation_match) {
7980                                return std::result::Result::Err(A::Error::duplicate_field(
7981                                    "multiple values for if_generation_match",
7982                                ));
7983                            }
7984                            struct __With(std::option::Option<i64>);
7985                            impl<'de> serde::de::Deserialize<'de> for __With {
7986                                fn deserialize<D>(
7987                                    deserializer: D,
7988                                ) -> std::result::Result<Self, D::Error>
7989                                where
7990                                    D: serde::de::Deserializer<'de>,
7991                                {
7992                                    serde_with::As::< std::option::Option<wkt::internal::I64> >::deserialize(deserializer).map(__With)
7993                                }
7994                            }
7995                            result.if_generation_match = map.next_value::<__With>()?.0;
7996                        }
7997                        __FieldTag::__if_generation_not_match => {
7998                            if !fields.insert(__FieldTag::__if_generation_not_match) {
7999                                return std::result::Result::Err(A::Error::duplicate_field(
8000                                    "multiple values for if_generation_not_match",
8001                                ));
8002                            }
8003                            struct __With(std::option::Option<i64>);
8004                            impl<'de> serde::de::Deserialize<'de> for __With {
8005                                fn deserialize<D>(
8006                                    deserializer: D,
8007                                ) -> std::result::Result<Self, D::Error>
8008                                where
8009                                    D: serde::de::Deserializer<'de>,
8010                                {
8011                                    serde_with::As::< std::option::Option<wkt::internal::I64> >::deserialize(deserializer).map(__With)
8012                                }
8013                            }
8014                            result.if_generation_not_match = map.next_value::<__With>()?.0;
8015                        }
8016                        __FieldTag::__if_metageneration_match => {
8017                            if !fields.insert(__FieldTag::__if_metageneration_match) {
8018                                return std::result::Result::Err(A::Error::duplicate_field(
8019                                    "multiple values for if_metageneration_match",
8020                                ));
8021                            }
8022                            struct __With(std::option::Option<i64>);
8023                            impl<'de> serde::de::Deserialize<'de> for __With {
8024                                fn deserialize<D>(
8025                                    deserializer: D,
8026                                ) -> std::result::Result<Self, D::Error>
8027                                where
8028                                    D: serde::de::Deserializer<'de>,
8029                                {
8030                                    serde_with::As::< std::option::Option<wkt::internal::I64> >::deserialize(deserializer).map(__With)
8031                                }
8032                            }
8033                            result.if_metageneration_match = map.next_value::<__With>()?.0;
8034                        }
8035                        __FieldTag::__if_metageneration_not_match => {
8036                            if !fields.insert(__FieldTag::__if_metageneration_not_match) {
8037                                return std::result::Result::Err(A::Error::duplicate_field(
8038                                    "multiple values for if_metageneration_not_match",
8039                                ));
8040                            }
8041                            struct __With(std::option::Option<i64>);
8042                            impl<'de> serde::de::Deserialize<'de> for __With {
8043                                fn deserialize<D>(
8044                                    deserializer: D,
8045                                ) -> std::result::Result<Self, D::Error>
8046                                where
8047                                    D: serde::de::Deserializer<'de>,
8048                                {
8049                                    serde_with::As::< std::option::Option<wkt::internal::I64> >::deserialize(deserializer).map(__With)
8050                                }
8051                            }
8052                            result.if_metageneration_not_match = map.next_value::<__With>()?.0;
8053                        }
8054                        __FieldTag::Unknown(key) => {
8055                            let value = map.next_value::<serde_json::Value>()?;
8056                            result._unknown_fields.insert(key, value);
8057                        }
8058                    }
8059                }
8060                std::result::Result::Ok(result)
8061            }
8062        }
8063        deserializer.deserialize_any(Visitor)
8064    }
8065}
8066
8067#[doc(hidden)]
8068impl serde::ser::Serialize for MoveObjectRequest {
8069    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
8070    where
8071        S: serde::ser::Serializer,
8072    {
8073        use serde::ser::SerializeMap;
8074        #[allow(unused_imports)]
8075        use std::option::Option::Some;
8076        let mut state = serializer.serialize_map(std::option::Option::None)?;
8077        if !self.bucket.is_empty() {
8078            state.serialize_entry("bucket", &self.bucket)?;
8079        }
8080        if !self.source_object.is_empty() {
8081            state.serialize_entry("sourceObject", &self.source_object)?;
8082        }
8083        if !self.destination_object.is_empty() {
8084            state.serialize_entry("destinationObject", &self.destination_object)?;
8085        }
8086        if self.if_source_generation_match.is_some() {
8087            struct __With<'a>(&'a std::option::Option<i64>);
8088            impl<'a> serde::ser::Serialize for __With<'a> {
8089                fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
8090                where
8091                    S: serde::ser::Serializer,
8092                {
8093                    serde_with::As::<std::option::Option<wkt::internal::I64>>::serialize(
8094                        self.0, serializer,
8095                    )
8096                }
8097            }
8098            state.serialize_entry(
8099                "ifSourceGenerationMatch",
8100                &__With(&self.if_source_generation_match),
8101            )?;
8102        }
8103        if self.if_source_generation_not_match.is_some() {
8104            struct __With<'a>(&'a std::option::Option<i64>);
8105            impl<'a> serde::ser::Serialize for __With<'a> {
8106                fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
8107                where
8108                    S: serde::ser::Serializer,
8109                {
8110                    serde_with::As::<std::option::Option<wkt::internal::I64>>::serialize(
8111                        self.0, serializer,
8112                    )
8113                }
8114            }
8115            state.serialize_entry(
8116                "ifSourceGenerationNotMatch",
8117                &__With(&self.if_source_generation_not_match),
8118            )?;
8119        }
8120        if self.if_source_metageneration_match.is_some() {
8121            struct __With<'a>(&'a std::option::Option<i64>);
8122            impl<'a> serde::ser::Serialize for __With<'a> {
8123                fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
8124                where
8125                    S: serde::ser::Serializer,
8126                {
8127                    serde_with::As::<std::option::Option<wkt::internal::I64>>::serialize(
8128                        self.0, serializer,
8129                    )
8130                }
8131            }
8132            state.serialize_entry(
8133                "ifSourceMetagenerationMatch",
8134                &__With(&self.if_source_metageneration_match),
8135            )?;
8136        }
8137        if self.if_source_metageneration_not_match.is_some() {
8138            struct __With<'a>(&'a std::option::Option<i64>);
8139            impl<'a> serde::ser::Serialize for __With<'a> {
8140                fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
8141                where
8142                    S: serde::ser::Serializer,
8143                {
8144                    serde_with::As::<std::option::Option<wkt::internal::I64>>::serialize(
8145                        self.0, serializer,
8146                    )
8147                }
8148            }
8149            state.serialize_entry(
8150                "ifSourceMetagenerationNotMatch",
8151                &__With(&self.if_source_metageneration_not_match),
8152            )?;
8153        }
8154        if self.if_generation_match.is_some() {
8155            struct __With<'a>(&'a std::option::Option<i64>);
8156            impl<'a> serde::ser::Serialize for __With<'a> {
8157                fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
8158                where
8159                    S: serde::ser::Serializer,
8160                {
8161                    serde_with::As::<std::option::Option<wkt::internal::I64>>::serialize(
8162                        self.0, serializer,
8163                    )
8164                }
8165            }
8166            state.serialize_entry("ifGenerationMatch", &__With(&self.if_generation_match))?;
8167        }
8168        if self.if_generation_not_match.is_some() {
8169            struct __With<'a>(&'a std::option::Option<i64>);
8170            impl<'a> serde::ser::Serialize for __With<'a> {
8171                fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
8172                where
8173                    S: serde::ser::Serializer,
8174                {
8175                    serde_with::As::<std::option::Option<wkt::internal::I64>>::serialize(
8176                        self.0, serializer,
8177                    )
8178                }
8179            }
8180            state.serialize_entry(
8181                "ifGenerationNotMatch",
8182                &__With(&self.if_generation_not_match),
8183            )?;
8184        }
8185        if self.if_metageneration_match.is_some() {
8186            struct __With<'a>(&'a std::option::Option<i64>);
8187            impl<'a> serde::ser::Serialize for __With<'a> {
8188                fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
8189                where
8190                    S: serde::ser::Serializer,
8191                {
8192                    serde_with::As::<std::option::Option<wkt::internal::I64>>::serialize(
8193                        self.0, serializer,
8194                    )
8195                }
8196            }
8197            state.serialize_entry(
8198                "ifMetagenerationMatch",
8199                &__With(&self.if_metageneration_match),
8200            )?;
8201        }
8202        if self.if_metageneration_not_match.is_some() {
8203            struct __With<'a>(&'a std::option::Option<i64>);
8204            impl<'a> serde::ser::Serialize for __With<'a> {
8205                fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
8206                where
8207                    S: serde::ser::Serializer,
8208                {
8209                    serde_with::As::<std::option::Option<wkt::internal::I64>>::serialize(
8210                        self.0, serializer,
8211                    )
8212                }
8213            }
8214            state.serialize_entry(
8215                "ifMetagenerationNotMatch",
8216                &__With(&self.if_metageneration_not_match),
8217            )?;
8218        }
8219        if !self._unknown_fields.is_empty() {
8220            for (key, value) in self._unknown_fields.iter() {
8221                state.serialize_entry(key, &value)?;
8222            }
8223        }
8224        state.end()
8225    }
8226}
8227
8228/// Request message for UpdateObject.
8229#[derive(Clone, Debug, Default, PartialEq)]
8230#[non_exhaustive]
8231pub struct UpdateObjectRequest {
8232    /// Required. The object to update.
8233    /// The object's bucket and name fields are used to identify the object to
8234    /// update. If present, the object's generation field selects a specific
8235    /// revision of this object whose metadata should be updated. Otherwise,
8236    /// assumes the live version of the object.
8237    pub object: std::option::Option<crate::model::Object>,
8238
8239    /// Makes the operation conditional on whether the object's current generation
8240    /// matches the given value. Setting to 0 makes the operation succeed only if
8241    /// there are no live versions of the object.
8242    pub if_generation_match: std::option::Option<i64>,
8243
8244    /// Makes the operation conditional on whether the object's live generation
8245    /// does not match the given value. If no live object exists, the precondition
8246    /// fails. Setting to 0 makes the operation succeed only if there is a live
8247    /// version of the object.
8248    pub if_generation_not_match: std::option::Option<i64>,
8249
8250    /// Makes the operation conditional on whether the object's current
8251    /// metageneration matches the given value.
8252    pub if_metageneration_match: std::option::Option<i64>,
8253
8254    /// Makes the operation conditional on whether the object's current
8255    /// metageneration does not match the given value.
8256    pub if_metageneration_not_match: std::option::Option<i64>,
8257
8258    /// Optional. Apply a predefined set of access controls to this object.
8259    /// Valid values are "authenticatedRead", "bucketOwnerFullControl",
8260    /// "bucketOwnerRead", "private", "projectPrivate", or "publicRead".
8261    pub predefined_acl: std::string::String,
8262
8263    /// Required. List of fields to be updated.
8264    ///
8265    /// To specify ALL fields, equivalent to the JSON API's "update" function,
8266    /// specify a single field with the value `*`. Note: not recommended. If a new
8267    /// field is introduced at a later time, an older client updating with the `*`
8268    /// may accidentally reset the new field's value.
8269    ///
8270    /// Not specifying any fields is an error.
8271    pub update_mask: std::option::Option<wkt::FieldMask>,
8272
8273    /// Optional. A set of parameters common to Storage API requests concerning an
8274    /// object.
8275    pub common_object_request_params: std::option::Option<crate::model::CommonObjectRequestParams>,
8276
8277    /// Optional. Overrides the unlocked retention config on the object.
8278    pub override_unlocked_retention: bool,
8279
8280    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
8281}
8282
8283impl UpdateObjectRequest {
8284    pub fn new() -> Self {
8285        std::default::Default::default()
8286    }
8287
8288    /// Sets the value of [object][crate::model::UpdateObjectRequest::object].
8289    pub fn set_object<T>(mut self, v: T) -> Self
8290    where
8291        T: std::convert::Into<crate::model::Object>,
8292    {
8293        self.object = std::option::Option::Some(v.into());
8294        self
8295    }
8296
8297    /// Sets or clears the value of [object][crate::model::UpdateObjectRequest::object].
8298    pub fn set_or_clear_object<T>(mut self, v: std::option::Option<T>) -> Self
8299    where
8300        T: std::convert::Into<crate::model::Object>,
8301    {
8302        self.object = v.map(|x| x.into());
8303        self
8304    }
8305
8306    /// Sets the value of [if_generation_match][crate::model::UpdateObjectRequest::if_generation_match].
8307    pub fn set_if_generation_match<T>(mut self, v: T) -> Self
8308    where
8309        T: std::convert::Into<i64>,
8310    {
8311        self.if_generation_match = std::option::Option::Some(v.into());
8312        self
8313    }
8314
8315    /// Sets or clears the value of [if_generation_match][crate::model::UpdateObjectRequest::if_generation_match].
8316    pub fn set_or_clear_if_generation_match<T>(mut self, v: std::option::Option<T>) -> Self
8317    where
8318        T: std::convert::Into<i64>,
8319    {
8320        self.if_generation_match = v.map(|x| x.into());
8321        self
8322    }
8323
8324    /// Sets the value of [if_generation_not_match][crate::model::UpdateObjectRequest::if_generation_not_match].
8325    pub fn set_if_generation_not_match<T>(mut self, v: T) -> Self
8326    where
8327        T: std::convert::Into<i64>,
8328    {
8329        self.if_generation_not_match = std::option::Option::Some(v.into());
8330        self
8331    }
8332
8333    /// Sets or clears the value of [if_generation_not_match][crate::model::UpdateObjectRequest::if_generation_not_match].
8334    pub fn set_or_clear_if_generation_not_match<T>(mut self, v: std::option::Option<T>) -> Self
8335    where
8336        T: std::convert::Into<i64>,
8337    {
8338        self.if_generation_not_match = v.map(|x| x.into());
8339        self
8340    }
8341
8342    /// Sets the value of [if_metageneration_match][crate::model::UpdateObjectRequest::if_metageneration_match].
8343    pub fn set_if_metageneration_match<T>(mut self, v: T) -> Self
8344    where
8345        T: std::convert::Into<i64>,
8346    {
8347        self.if_metageneration_match = std::option::Option::Some(v.into());
8348        self
8349    }
8350
8351    /// Sets or clears the value of [if_metageneration_match][crate::model::UpdateObjectRequest::if_metageneration_match].
8352    pub fn set_or_clear_if_metageneration_match<T>(mut self, v: std::option::Option<T>) -> Self
8353    where
8354        T: std::convert::Into<i64>,
8355    {
8356        self.if_metageneration_match = v.map(|x| x.into());
8357        self
8358    }
8359
8360    /// Sets the value of [if_metageneration_not_match][crate::model::UpdateObjectRequest::if_metageneration_not_match].
8361    pub fn set_if_metageneration_not_match<T>(mut self, v: T) -> Self
8362    where
8363        T: std::convert::Into<i64>,
8364    {
8365        self.if_metageneration_not_match = std::option::Option::Some(v.into());
8366        self
8367    }
8368
8369    /// Sets or clears the value of [if_metageneration_not_match][crate::model::UpdateObjectRequest::if_metageneration_not_match].
8370    pub fn set_or_clear_if_metageneration_not_match<T>(mut self, v: std::option::Option<T>) -> Self
8371    where
8372        T: std::convert::Into<i64>,
8373    {
8374        self.if_metageneration_not_match = v.map(|x| x.into());
8375        self
8376    }
8377
8378    /// Sets the value of [predefined_acl][crate::model::UpdateObjectRequest::predefined_acl].
8379    pub fn set_predefined_acl<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
8380        self.predefined_acl = v.into();
8381        self
8382    }
8383
8384    /// Sets the value of [update_mask][crate::model::UpdateObjectRequest::update_mask].
8385    pub fn set_update_mask<T>(mut self, v: T) -> Self
8386    where
8387        T: std::convert::Into<wkt::FieldMask>,
8388    {
8389        self.update_mask = std::option::Option::Some(v.into());
8390        self
8391    }
8392
8393    /// Sets or clears the value of [update_mask][crate::model::UpdateObjectRequest::update_mask].
8394    pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
8395    where
8396        T: std::convert::Into<wkt::FieldMask>,
8397    {
8398        self.update_mask = v.map(|x| x.into());
8399        self
8400    }
8401
8402    /// Sets the value of [common_object_request_params][crate::model::UpdateObjectRequest::common_object_request_params].
8403    pub fn set_common_object_request_params<T>(mut self, v: T) -> Self
8404    where
8405        T: std::convert::Into<crate::model::CommonObjectRequestParams>,
8406    {
8407        self.common_object_request_params = std::option::Option::Some(v.into());
8408        self
8409    }
8410
8411    /// Sets or clears the value of [common_object_request_params][crate::model::UpdateObjectRequest::common_object_request_params].
8412    pub fn set_or_clear_common_object_request_params<T>(mut self, v: std::option::Option<T>) -> Self
8413    where
8414        T: std::convert::Into<crate::model::CommonObjectRequestParams>,
8415    {
8416        self.common_object_request_params = v.map(|x| x.into());
8417        self
8418    }
8419
8420    /// Sets the value of [override_unlocked_retention][crate::model::UpdateObjectRequest::override_unlocked_retention].
8421    pub fn set_override_unlocked_retention<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
8422        self.override_unlocked_retention = v.into();
8423        self
8424    }
8425}
8426
8427impl wkt::message::Message for UpdateObjectRequest {
8428    fn typename() -> &'static str {
8429        "type.googleapis.com/google.storage.v2.UpdateObjectRequest"
8430    }
8431}
8432
8433#[doc(hidden)]
8434impl<'de> serde::de::Deserialize<'de> for UpdateObjectRequest {
8435    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
8436    where
8437        D: serde::Deserializer<'de>,
8438    {
8439        #[allow(non_camel_case_types)]
8440        #[doc(hidden)]
8441        #[derive(PartialEq, Eq, Hash)]
8442        enum __FieldTag {
8443            __object,
8444            __if_generation_match,
8445            __if_generation_not_match,
8446            __if_metageneration_match,
8447            __if_metageneration_not_match,
8448            __predefined_acl,
8449            __update_mask,
8450            __common_object_request_params,
8451            __override_unlocked_retention,
8452            Unknown(std::string::String),
8453        }
8454        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
8455            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
8456            where
8457                D: serde::Deserializer<'de>,
8458            {
8459                struct Visitor;
8460                impl<'de> serde::de::Visitor<'de> for Visitor {
8461                    type Value = __FieldTag;
8462                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
8463                        formatter.write_str("a field name for UpdateObjectRequest")
8464                    }
8465                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
8466                    where
8467                        E: serde::de::Error,
8468                    {
8469                        use std::result::Result::Ok;
8470                        use std::string::ToString;
8471                        match value {
8472                            "object" => Ok(__FieldTag::__object),
8473                            "ifGenerationMatch" => Ok(__FieldTag::__if_generation_match),
8474                            "if_generation_match" => Ok(__FieldTag::__if_generation_match),
8475                            "ifGenerationNotMatch" => Ok(__FieldTag::__if_generation_not_match),
8476                            "if_generation_not_match" => Ok(__FieldTag::__if_generation_not_match),
8477                            "ifMetagenerationMatch" => Ok(__FieldTag::__if_metageneration_match),
8478                            "if_metageneration_match" => Ok(__FieldTag::__if_metageneration_match),
8479                            "ifMetagenerationNotMatch" => {
8480                                Ok(__FieldTag::__if_metageneration_not_match)
8481                            }
8482                            "if_metageneration_not_match" => {
8483                                Ok(__FieldTag::__if_metageneration_not_match)
8484                            }
8485                            "predefinedAcl" => Ok(__FieldTag::__predefined_acl),
8486                            "predefined_acl" => Ok(__FieldTag::__predefined_acl),
8487                            "updateMask" => Ok(__FieldTag::__update_mask),
8488                            "update_mask" => Ok(__FieldTag::__update_mask),
8489                            "commonObjectRequestParams" => {
8490                                Ok(__FieldTag::__common_object_request_params)
8491                            }
8492                            "common_object_request_params" => {
8493                                Ok(__FieldTag::__common_object_request_params)
8494                            }
8495                            "overrideUnlockedRetention" => {
8496                                Ok(__FieldTag::__override_unlocked_retention)
8497                            }
8498                            "override_unlocked_retention" => {
8499                                Ok(__FieldTag::__override_unlocked_retention)
8500                            }
8501                            _ => Ok(__FieldTag::Unknown(value.to_string())),
8502                        }
8503                    }
8504                }
8505                deserializer.deserialize_identifier(Visitor)
8506            }
8507        }
8508        struct Visitor;
8509        impl<'de> serde::de::Visitor<'de> for Visitor {
8510            type Value = UpdateObjectRequest;
8511            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
8512                formatter.write_str("struct UpdateObjectRequest")
8513            }
8514            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
8515            where
8516                A: serde::de::MapAccess<'de>,
8517            {
8518                #[allow(unused_imports)]
8519                use serde::de::Error;
8520                use std::option::Option::Some;
8521                let mut fields = std::collections::HashSet::new();
8522                let mut result = Self::Value::new();
8523                while let Some(tag) = map.next_key::<__FieldTag>()? {
8524                    #[allow(clippy::match_single_binding)]
8525                    match tag {
8526                        __FieldTag::__object => {
8527                            if !fields.insert(__FieldTag::__object) {
8528                                return std::result::Result::Err(A::Error::duplicate_field(
8529                                    "multiple values for object",
8530                                ));
8531                            }
8532                            result.object =
8533                                map.next_value::<std::option::Option<crate::model::Object>>()?;
8534                        }
8535                        __FieldTag::__if_generation_match => {
8536                            if !fields.insert(__FieldTag::__if_generation_match) {
8537                                return std::result::Result::Err(A::Error::duplicate_field(
8538                                    "multiple values for if_generation_match",
8539                                ));
8540                            }
8541                            struct __With(std::option::Option<i64>);
8542                            impl<'de> serde::de::Deserialize<'de> for __With {
8543                                fn deserialize<D>(
8544                                    deserializer: D,
8545                                ) -> std::result::Result<Self, D::Error>
8546                                where
8547                                    D: serde::de::Deserializer<'de>,
8548                                {
8549                                    serde_with::As::< std::option::Option<wkt::internal::I64> >::deserialize(deserializer).map(__With)
8550                                }
8551                            }
8552                            result.if_generation_match = map.next_value::<__With>()?.0;
8553                        }
8554                        __FieldTag::__if_generation_not_match => {
8555                            if !fields.insert(__FieldTag::__if_generation_not_match) {
8556                                return std::result::Result::Err(A::Error::duplicate_field(
8557                                    "multiple values for if_generation_not_match",
8558                                ));
8559                            }
8560                            struct __With(std::option::Option<i64>);
8561                            impl<'de> serde::de::Deserialize<'de> for __With {
8562                                fn deserialize<D>(
8563                                    deserializer: D,
8564                                ) -> std::result::Result<Self, D::Error>
8565                                where
8566                                    D: serde::de::Deserializer<'de>,
8567                                {
8568                                    serde_with::As::< std::option::Option<wkt::internal::I64> >::deserialize(deserializer).map(__With)
8569                                }
8570                            }
8571                            result.if_generation_not_match = map.next_value::<__With>()?.0;
8572                        }
8573                        __FieldTag::__if_metageneration_match => {
8574                            if !fields.insert(__FieldTag::__if_metageneration_match) {
8575                                return std::result::Result::Err(A::Error::duplicate_field(
8576                                    "multiple values for if_metageneration_match",
8577                                ));
8578                            }
8579                            struct __With(std::option::Option<i64>);
8580                            impl<'de> serde::de::Deserialize<'de> for __With {
8581                                fn deserialize<D>(
8582                                    deserializer: D,
8583                                ) -> std::result::Result<Self, D::Error>
8584                                where
8585                                    D: serde::de::Deserializer<'de>,
8586                                {
8587                                    serde_with::As::< std::option::Option<wkt::internal::I64> >::deserialize(deserializer).map(__With)
8588                                }
8589                            }
8590                            result.if_metageneration_match = map.next_value::<__With>()?.0;
8591                        }
8592                        __FieldTag::__if_metageneration_not_match => {
8593                            if !fields.insert(__FieldTag::__if_metageneration_not_match) {
8594                                return std::result::Result::Err(A::Error::duplicate_field(
8595                                    "multiple values for if_metageneration_not_match",
8596                                ));
8597                            }
8598                            struct __With(std::option::Option<i64>);
8599                            impl<'de> serde::de::Deserialize<'de> for __With {
8600                                fn deserialize<D>(
8601                                    deserializer: D,
8602                                ) -> std::result::Result<Self, D::Error>
8603                                where
8604                                    D: serde::de::Deserializer<'de>,
8605                                {
8606                                    serde_with::As::< std::option::Option<wkt::internal::I64> >::deserialize(deserializer).map(__With)
8607                                }
8608                            }
8609                            result.if_metageneration_not_match = map.next_value::<__With>()?.0;
8610                        }
8611                        __FieldTag::__predefined_acl => {
8612                            if !fields.insert(__FieldTag::__predefined_acl) {
8613                                return std::result::Result::Err(A::Error::duplicate_field(
8614                                    "multiple values for predefined_acl",
8615                                ));
8616                            }
8617                            result.predefined_acl = map
8618                                .next_value::<std::option::Option<std::string::String>>()?
8619                                .unwrap_or_default();
8620                        }
8621                        __FieldTag::__update_mask => {
8622                            if !fields.insert(__FieldTag::__update_mask) {
8623                                return std::result::Result::Err(A::Error::duplicate_field(
8624                                    "multiple values for update_mask",
8625                                ));
8626                            }
8627                            result.update_mask =
8628                                map.next_value::<std::option::Option<wkt::FieldMask>>()?;
8629                        }
8630                        __FieldTag::__common_object_request_params => {
8631                            if !fields.insert(__FieldTag::__common_object_request_params) {
8632                                return std::result::Result::Err(A::Error::duplicate_field(
8633                                    "multiple values for common_object_request_params",
8634                                ));
8635                            }
8636                            result.common_object_request_params = map.next_value::<std::option::Option<crate::model::CommonObjectRequestParams>>()?
8637                                ;
8638                        }
8639                        __FieldTag::__override_unlocked_retention => {
8640                            if !fields.insert(__FieldTag::__override_unlocked_retention) {
8641                                return std::result::Result::Err(A::Error::duplicate_field(
8642                                    "multiple values for override_unlocked_retention",
8643                                ));
8644                            }
8645                            result.override_unlocked_retention = map
8646                                .next_value::<std::option::Option<bool>>()?
8647                                .unwrap_or_default();
8648                        }
8649                        __FieldTag::Unknown(key) => {
8650                            let value = map.next_value::<serde_json::Value>()?;
8651                            result._unknown_fields.insert(key, value);
8652                        }
8653                    }
8654                }
8655                std::result::Result::Ok(result)
8656            }
8657        }
8658        deserializer.deserialize_any(Visitor)
8659    }
8660}
8661
8662#[doc(hidden)]
8663impl serde::ser::Serialize for UpdateObjectRequest {
8664    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
8665    where
8666        S: serde::ser::Serializer,
8667    {
8668        use serde::ser::SerializeMap;
8669        #[allow(unused_imports)]
8670        use std::option::Option::Some;
8671        let mut state = serializer.serialize_map(std::option::Option::None)?;
8672        if self.object.is_some() {
8673            state.serialize_entry("object", &self.object)?;
8674        }
8675        if self.if_generation_match.is_some() {
8676            struct __With<'a>(&'a std::option::Option<i64>);
8677            impl<'a> serde::ser::Serialize for __With<'a> {
8678                fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
8679                where
8680                    S: serde::ser::Serializer,
8681                {
8682                    serde_with::As::<std::option::Option<wkt::internal::I64>>::serialize(
8683                        self.0, serializer,
8684                    )
8685                }
8686            }
8687            state.serialize_entry("ifGenerationMatch", &__With(&self.if_generation_match))?;
8688        }
8689        if self.if_generation_not_match.is_some() {
8690            struct __With<'a>(&'a std::option::Option<i64>);
8691            impl<'a> serde::ser::Serialize for __With<'a> {
8692                fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
8693                where
8694                    S: serde::ser::Serializer,
8695                {
8696                    serde_with::As::<std::option::Option<wkt::internal::I64>>::serialize(
8697                        self.0, serializer,
8698                    )
8699                }
8700            }
8701            state.serialize_entry(
8702                "ifGenerationNotMatch",
8703                &__With(&self.if_generation_not_match),
8704            )?;
8705        }
8706        if self.if_metageneration_match.is_some() {
8707            struct __With<'a>(&'a std::option::Option<i64>);
8708            impl<'a> serde::ser::Serialize for __With<'a> {
8709                fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
8710                where
8711                    S: serde::ser::Serializer,
8712                {
8713                    serde_with::As::<std::option::Option<wkt::internal::I64>>::serialize(
8714                        self.0, serializer,
8715                    )
8716                }
8717            }
8718            state.serialize_entry(
8719                "ifMetagenerationMatch",
8720                &__With(&self.if_metageneration_match),
8721            )?;
8722        }
8723        if self.if_metageneration_not_match.is_some() {
8724            struct __With<'a>(&'a std::option::Option<i64>);
8725            impl<'a> serde::ser::Serialize for __With<'a> {
8726                fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
8727                where
8728                    S: serde::ser::Serializer,
8729                {
8730                    serde_with::As::<std::option::Option<wkt::internal::I64>>::serialize(
8731                        self.0, serializer,
8732                    )
8733                }
8734            }
8735            state.serialize_entry(
8736                "ifMetagenerationNotMatch",
8737                &__With(&self.if_metageneration_not_match),
8738            )?;
8739        }
8740        if !self.predefined_acl.is_empty() {
8741            state.serialize_entry("predefinedAcl", &self.predefined_acl)?;
8742        }
8743        if self.update_mask.is_some() {
8744            state.serialize_entry("updateMask", &self.update_mask)?;
8745        }
8746        if self.common_object_request_params.is_some() {
8747            state.serialize_entry(
8748                "commonObjectRequestParams",
8749                &self.common_object_request_params,
8750            )?;
8751        }
8752        if !wkt::internal::is_default(&self.override_unlocked_retention) {
8753            state.serialize_entry(
8754                "overrideUnlockedRetention",
8755                &self.override_unlocked_retention,
8756            )?;
8757        }
8758        if !self._unknown_fields.is_empty() {
8759            for (key, value) in self._unknown_fields.iter() {
8760                state.serialize_entry(key, &value)?;
8761            }
8762        }
8763        state.end()
8764    }
8765}
8766
8767/// Parameters that can be passed to any object request.
8768#[derive(Clone, Debug, Default, PartialEq)]
8769#[non_exhaustive]
8770pub struct CommonObjectRequestParams {
8771    /// Optional. Encryption algorithm used with the Customer-Supplied Encryption
8772    /// Keys feature.
8773    pub encryption_algorithm: std::string::String,
8774
8775    /// Optional. Encryption key used with the Customer-Supplied Encryption Keys
8776    /// feature. In raw bytes format (not base64-encoded).
8777    pub encryption_key_bytes: ::bytes::Bytes,
8778
8779    /// Optional. SHA256 hash of encryption key used with the Customer-Supplied
8780    /// Encryption Keys feature.
8781    pub encryption_key_sha256_bytes: ::bytes::Bytes,
8782
8783    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
8784}
8785
8786impl CommonObjectRequestParams {
8787    pub fn new() -> Self {
8788        std::default::Default::default()
8789    }
8790
8791    /// Sets the value of [encryption_algorithm][crate::model::CommonObjectRequestParams::encryption_algorithm].
8792    pub fn set_encryption_algorithm<T: std::convert::Into<std::string::String>>(
8793        mut self,
8794        v: T,
8795    ) -> Self {
8796        self.encryption_algorithm = v.into();
8797        self
8798    }
8799
8800    /// Sets the value of [encryption_key_bytes][crate::model::CommonObjectRequestParams::encryption_key_bytes].
8801    pub fn set_encryption_key_bytes<T: std::convert::Into<::bytes::Bytes>>(mut self, v: T) -> Self {
8802        self.encryption_key_bytes = v.into();
8803        self
8804    }
8805
8806    /// Sets the value of [encryption_key_sha256_bytes][crate::model::CommonObjectRequestParams::encryption_key_sha256_bytes].
8807    pub fn set_encryption_key_sha256_bytes<T: std::convert::Into<::bytes::Bytes>>(
8808        mut self,
8809        v: T,
8810    ) -> Self {
8811        self.encryption_key_sha256_bytes = v.into();
8812        self
8813    }
8814}
8815
8816impl wkt::message::Message for CommonObjectRequestParams {
8817    fn typename() -> &'static str {
8818        "type.googleapis.com/google.storage.v2.CommonObjectRequestParams"
8819    }
8820}
8821
8822#[doc(hidden)]
8823impl<'de> serde::de::Deserialize<'de> for CommonObjectRequestParams {
8824    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
8825    where
8826        D: serde::Deserializer<'de>,
8827    {
8828        #[allow(non_camel_case_types)]
8829        #[doc(hidden)]
8830        #[derive(PartialEq, Eq, Hash)]
8831        enum __FieldTag {
8832            __encryption_algorithm,
8833            __encryption_key_bytes,
8834            __encryption_key_sha256_bytes,
8835            Unknown(std::string::String),
8836        }
8837        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
8838            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
8839            where
8840                D: serde::Deserializer<'de>,
8841            {
8842                struct Visitor;
8843                impl<'de> serde::de::Visitor<'de> for Visitor {
8844                    type Value = __FieldTag;
8845                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
8846                        formatter.write_str("a field name for CommonObjectRequestParams")
8847                    }
8848                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
8849                    where
8850                        E: serde::de::Error,
8851                    {
8852                        use std::result::Result::Ok;
8853                        use std::string::ToString;
8854                        match value {
8855                            "encryptionAlgorithm" => Ok(__FieldTag::__encryption_algorithm),
8856                            "encryption_algorithm" => Ok(__FieldTag::__encryption_algorithm),
8857                            "encryptionKeyBytes" => Ok(__FieldTag::__encryption_key_bytes),
8858                            "encryption_key_bytes" => Ok(__FieldTag::__encryption_key_bytes),
8859                            "encryptionKeySha256Bytes" => {
8860                                Ok(__FieldTag::__encryption_key_sha256_bytes)
8861                            }
8862                            "encryption_key_sha256_bytes" => {
8863                                Ok(__FieldTag::__encryption_key_sha256_bytes)
8864                            }
8865                            _ => Ok(__FieldTag::Unknown(value.to_string())),
8866                        }
8867                    }
8868                }
8869                deserializer.deserialize_identifier(Visitor)
8870            }
8871        }
8872        struct Visitor;
8873        impl<'de> serde::de::Visitor<'de> for Visitor {
8874            type Value = CommonObjectRequestParams;
8875            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
8876                formatter.write_str("struct CommonObjectRequestParams")
8877            }
8878            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
8879            where
8880                A: serde::de::MapAccess<'de>,
8881            {
8882                #[allow(unused_imports)]
8883                use serde::de::Error;
8884                use std::option::Option::Some;
8885                let mut fields = std::collections::HashSet::new();
8886                let mut result = Self::Value::new();
8887                while let Some(tag) = map.next_key::<__FieldTag>()? {
8888                    #[allow(clippy::match_single_binding)]
8889                    match tag {
8890                        __FieldTag::__encryption_algorithm => {
8891                            if !fields.insert(__FieldTag::__encryption_algorithm) {
8892                                return std::result::Result::Err(A::Error::duplicate_field(
8893                                    "multiple values for encryption_algorithm",
8894                                ));
8895                            }
8896                            result.encryption_algorithm = map
8897                                .next_value::<std::option::Option<std::string::String>>()?
8898                                .unwrap_or_default();
8899                        }
8900                        __FieldTag::__encryption_key_bytes => {
8901                            if !fields.insert(__FieldTag::__encryption_key_bytes) {
8902                                return std::result::Result::Err(A::Error::duplicate_field(
8903                                    "multiple values for encryption_key_bytes",
8904                                ));
8905                            }
8906                            struct __With(std::option::Option<::bytes::Bytes>);
8907                            impl<'de> serde::de::Deserialize<'de> for __With {
8908                                fn deserialize<D>(
8909                                    deserializer: D,
8910                                ) -> std::result::Result<Self, D::Error>
8911                                where
8912                                    D: serde::de::Deserializer<'de>,
8913                                {
8914                                    serde_with::As::< std::option::Option<serde_with::base64::Base64> >::deserialize(deserializer).map(__With)
8915                                }
8916                            }
8917                            result.encryption_key_bytes =
8918                                map.next_value::<__With>()?.0.unwrap_or_default();
8919                        }
8920                        __FieldTag::__encryption_key_sha256_bytes => {
8921                            if !fields.insert(__FieldTag::__encryption_key_sha256_bytes) {
8922                                return std::result::Result::Err(A::Error::duplicate_field(
8923                                    "multiple values for encryption_key_sha256_bytes",
8924                                ));
8925                            }
8926                            struct __With(std::option::Option<::bytes::Bytes>);
8927                            impl<'de> serde::de::Deserialize<'de> for __With {
8928                                fn deserialize<D>(
8929                                    deserializer: D,
8930                                ) -> std::result::Result<Self, D::Error>
8931                                where
8932                                    D: serde::de::Deserializer<'de>,
8933                                {
8934                                    serde_with::As::< std::option::Option<serde_with::base64::Base64> >::deserialize(deserializer).map(__With)
8935                                }
8936                            }
8937                            result.encryption_key_sha256_bytes =
8938                                map.next_value::<__With>()?.0.unwrap_or_default();
8939                        }
8940                        __FieldTag::Unknown(key) => {
8941                            let value = map.next_value::<serde_json::Value>()?;
8942                            result._unknown_fields.insert(key, value);
8943                        }
8944                    }
8945                }
8946                std::result::Result::Ok(result)
8947            }
8948        }
8949        deserializer.deserialize_any(Visitor)
8950    }
8951}
8952
8953#[doc(hidden)]
8954impl serde::ser::Serialize for CommonObjectRequestParams {
8955    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
8956    where
8957        S: serde::ser::Serializer,
8958    {
8959        use serde::ser::SerializeMap;
8960        #[allow(unused_imports)]
8961        use std::option::Option::Some;
8962        let mut state = serializer.serialize_map(std::option::Option::None)?;
8963        if !self.encryption_algorithm.is_empty() {
8964            state.serialize_entry("encryptionAlgorithm", &self.encryption_algorithm)?;
8965        }
8966        if !self.encryption_key_bytes.is_empty() {
8967            struct __With<'a>(&'a ::bytes::Bytes);
8968            impl<'a> serde::ser::Serialize for __With<'a> {
8969                fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
8970                where
8971                    S: serde::ser::Serializer,
8972                {
8973                    serde_with::As::<serde_with::base64::Base64>::serialize(self.0, serializer)
8974                }
8975            }
8976            state.serialize_entry("encryptionKeyBytes", &__With(&self.encryption_key_bytes))?;
8977        }
8978        if !self.encryption_key_sha256_bytes.is_empty() {
8979            struct __With<'a>(&'a ::bytes::Bytes);
8980            impl<'a> serde::ser::Serialize for __With<'a> {
8981                fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
8982                where
8983                    S: serde::ser::Serializer,
8984                {
8985                    serde_with::As::<serde_with::base64::Base64>::serialize(self.0, serializer)
8986                }
8987            }
8988            state.serialize_entry(
8989                "encryptionKeySha256Bytes",
8990                &__With(&self.encryption_key_sha256_bytes),
8991            )?;
8992        }
8993        if !self._unknown_fields.is_empty() {
8994            for (key, value) in self._unknown_fields.iter() {
8995                state.serialize_entry(key, &value)?;
8996            }
8997        }
8998        state.end()
8999    }
9000}
9001
9002/// A bucket.
9003#[derive(Clone, Debug, Default, PartialEq)]
9004#[non_exhaustive]
9005pub struct Bucket {
9006    /// Identifier. The name of the bucket.
9007    /// Format: `projects/{project}/buckets/{bucket}`
9008    pub name: std::string::String,
9009
9010    /// Output only. The user-chosen part of the bucket name. The `{bucket}`
9011    /// portion of the `name` field. For globally unique buckets, this is equal to
9012    /// the "bucket name" of other Cloud Storage APIs. Example: "pub".
9013    pub bucket_id: std::string::String,
9014
9015    /// The etag of the bucket.
9016    /// If included in the metadata of an UpdateBucketRequest, the operation will
9017    /// only be performed if the etag matches that of the bucket.
9018    pub etag: std::string::String,
9019
9020    /// Immutable. The project which owns this bucket, in the format of
9021    /// "projects/{projectIdentifier}".
9022    /// {projectIdentifier} can be the project ID or project number.
9023    /// Output values will always be in project number format.
9024    pub project: std::string::String,
9025
9026    /// Output only. The metadata generation of this bucket.
9027    pub metageneration: i64,
9028
9029    /// Immutable. The location of the bucket. Object data for objects in the
9030    /// bucket resides in physical storage within this region.  Defaults to `US`.
9031    /// See the
9032    /// [<https://developers.google.com/storage/docs/concepts-techniques#specifyinglocations>"][developer's
9033    /// guide] for the authoritative list. Attempting to update this field after
9034    /// the bucket is created will result in an error.
9035    pub location: std::string::String,
9036
9037    /// Output only. The location type of the bucket (region, dual-region,
9038    /// multi-region, etc).
9039    pub location_type: std::string::String,
9040
9041    /// Optional. The bucket's default storage class, used whenever no storageClass
9042    /// is specified for a newly-created object. This defines how objects in the
9043    /// bucket are stored and determines the SLA and the cost of storage.
9044    /// If this value is not specified when the bucket is created, it will default
9045    /// to `STANDARD`. For more information, see
9046    /// <https://developers.google.com/storage/docs/storage-classes>.
9047    pub storage_class: std::string::String,
9048
9049    /// Optional. The recovery point objective for cross-region replication of the
9050    /// bucket. Applicable only for dual- and multi-region buckets. "DEFAULT" uses
9051    /// default replication. "ASYNC_TURBO" enables turbo replication, valid for
9052    /// dual-region buckets only. If rpo is not specified when the bucket is
9053    /// created, it defaults to "DEFAULT". For more information, see
9054    /// <https://cloud.google.com/storage/docs/availability-durability#turbo-replication>.
9055    pub rpo: std::string::String,
9056
9057    /// Optional. Access controls on the bucket.
9058    /// If iam_config.uniform_bucket_level_access is enabled on this bucket,
9059    /// requests to set, read, or modify acl is an error.
9060    pub acl: std::vec::Vec<crate::model::BucketAccessControl>,
9061
9062    /// Optional. Default access controls to apply to new objects when no ACL is
9063    /// provided. If iam_config.uniform_bucket_level_access is enabled on this
9064    /// bucket, requests to set, read, or modify acl is an error.
9065    pub default_object_acl: std::vec::Vec<crate::model::ObjectAccessControl>,
9066
9067    /// Optional. The bucket's lifecycle config. See
9068    /// [<https://developers.google.com/storage/docs/lifecycle>]Lifecycle Management]
9069    /// for more information.
9070    pub lifecycle: std::option::Option<crate::model::bucket::Lifecycle>,
9071
9072    /// Output only. The creation time of the bucket.
9073    pub create_time: std::option::Option<wkt::Timestamp>,
9074
9075    /// Optional. The bucket's [<https://www.w3.org/TR/cors/>][Cross-Origin Resource
9076    /// Sharing] (CORS) config.
9077    pub cors: std::vec::Vec<crate::model::bucket::Cors>,
9078
9079    /// Output only. The modification time of the bucket.
9080    pub update_time: std::option::Option<wkt::Timestamp>,
9081
9082    /// Optional. The default value for event-based hold on newly created objects
9083    /// in this bucket.  Event-based hold is a way to retain objects indefinitely
9084    /// until an event occurs, signified by the hold's release. After being
9085    /// released, such objects will be subject to bucket-level retention (if any).
9086    /// One sample use case of this flag is for banks to hold loan documents for at
9087    /// least 3 years after loan is paid in full. Here, bucket-level retention is 3
9088    /// years and the event is loan being paid in full. In this example, these
9089    /// objects will be held intact for any number of years until the event has
9090    /// occurred (event-based hold on the object is released) and then 3 more years
9091    /// after that. That means retention duration of the objects begins from the
9092    /// moment event-based hold transitioned from true to false.  Objects under
9093    /// event-based hold cannot be deleted, overwritten or archived until the hold
9094    /// is removed.
9095    pub default_event_based_hold: bool,
9096
9097    /// Optional. User-provided labels, in key/value pairs.
9098    pub labels: std::collections::HashMap<std::string::String, std::string::String>,
9099
9100    /// Optional. The bucket's website config, controlling how the service behaves
9101    /// when accessing bucket contents as a web site. See the
9102    /// [<https://cloud.google.com/storage/docs/static-website>][Static Website
9103    /// Examples] for more information.
9104    pub website: std::option::Option<crate::model::bucket::Website>,
9105
9106    /// Optional. The bucket's versioning config.
9107    pub versioning: std::option::Option<crate::model::bucket::Versioning>,
9108
9109    /// Optional. The bucket's logging config, which defines the destination bucket
9110    /// and name prefix (if any) for the current bucket's logs.
9111    pub logging: std::option::Option<crate::model::bucket::Logging>,
9112
9113    /// Output only. The owner of the bucket. This is always the project team's
9114    /// owner group.
9115    pub owner: std::option::Option<crate::model::Owner>,
9116
9117    /// Optional. Encryption config for a bucket.
9118    pub encryption: std::option::Option<crate::model::bucket::Encryption>,
9119
9120    /// Optional. The bucket's billing config.
9121    pub billing: std::option::Option<crate::model::bucket::Billing>,
9122
9123    /// Optional. The bucket's retention policy. The retention policy enforces a
9124    /// minimum retention time for all objects contained in the bucket, based on
9125    /// their creation time. Any attempt to overwrite or delete objects younger
9126    /// than the retention period will result in a PERMISSION_DENIED error.  An
9127    /// unlocked retention policy can be modified or removed from the bucket via a
9128    /// storage.buckets.update operation. A locked retention policy cannot be
9129    /// removed or shortened in duration for the lifetime of the bucket.
9130    /// Attempting to remove or decrease period of a locked retention policy will
9131    /// result in a PERMISSION_DENIED error.
9132    pub retention_policy: std::option::Option<crate::model::bucket::RetentionPolicy>,
9133
9134    /// Optional. The bucket's IAM config.
9135    pub iam_config: std::option::Option<crate::model::bucket::IamConfig>,
9136
9137    /// Optional. Reserved for future use.
9138    pub satisfies_pzs: bool,
9139
9140    /// Optional. Configuration that, if present, specifies the data placement for
9141    /// a
9142    /// [<https://cloud.google.com/storage/docs/locations#location-dr>][configurable
9143    /// dual-region].
9144    pub custom_placement_config: std::option::Option<crate::model::bucket::CustomPlacementConfig>,
9145
9146    /// Optional. The bucket's Autoclass configuration. If there is no
9147    /// configuration, the Autoclass feature will be disabled and have no effect on
9148    /// the bucket.
9149    pub autoclass: std::option::Option<crate::model::bucket::Autoclass>,
9150
9151    /// Optional. The bucket's hierarchical namespace configuration. If there is no
9152    /// configuration, the hierarchical namespace feature will be disabled and have
9153    /// no effect on the bucket.
9154    pub hierarchical_namespace: std::option::Option<crate::model::bucket::HierarchicalNamespace>,
9155
9156    /// Optional. The bucket's soft delete policy. The soft delete policy prevents
9157    /// soft-deleted objects from being permanently deleted.
9158    pub soft_delete_policy: std::option::Option<crate::model::bucket::SoftDeletePolicy>,
9159
9160    /// Optional. The bucket's object retention configuration. Must be enabled
9161    /// before objects in the bucket may have retention configured.
9162    pub object_retention: std::option::Option<crate::model::bucket::ObjectRetention>,
9163
9164    /// Optional. The bucket's IP filter configuration.
9165    pub ip_filter: std::option::Option<crate::model::bucket::IpFilter>,
9166
9167    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
9168}
9169
9170impl Bucket {
9171    pub fn new() -> Self {
9172        std::default::Default::default()
9173    }
9174
9175    /// Sets the value of [name][crate::model::Bucket::name].
9176    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9177        self.name = v.into();
9178        self
9179    }
9180
9181    /// Sets the value of [bucket_id][crate::model::Bucket::bucket_id].
9182    pub fn set_bucket_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9183        self.bucket_id = v.into();
9184        self
9185    }
9186
9187    /// Sets the value of [etag][crate::model::Bucket::etag].
9188    pub fn set_etag<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9189        self.etag = v.into();
9190        self
9191    }
9192
9193    /// Sets the value of [project][crate::model::Bucket::project].
9194    pub fn set_project<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9195        self.project = v.into();
9196        self
9197    }
9198
9199    /// Sets the value of [metageneration][crate::model::Bucket::metageneration].
9200    pub fn set_metageneration<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
9201        self.metageneration = v.into();
9202        self
9203    }
9204
9205    /// Sets the value of [location][crate::model::Bucket::location].
9206    pub fn set_location<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9207        self.location = v.into();
9208        self
9209    }
9210
9211    /// Sets the value of [location_type][crate::model::Bucket::location_type].
9212    pub fn set_location_type<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9213        self.location_type = v.into();
9214        self
9215    }
9216
9217    /// Sets the value of [storage_class][crate::model::Bucket::storage_class].
9218    pub fn set_storage_class<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9219        self.storage_class = v.into();
9220        self
9221    }
9222
9223    /// Sets the value of [rpo][crate::model::Bucket::rpo].
9224    pub fn set_rpo<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9225        self.rpo = v.into();
9226        self
9227    }
9228
9229    /// Sets the value of [acl][crate::model::Bucket::acl].
9230    pub fn set_acl<T, V>(mut self, v: T) -> Self
9231    where
9232        T: std::iter::IntoIterator<Item = V>,
9233        V: std::convert::Into<crate::model::BucketAccessControl>,
9234    {
9235        use std::iter::Iterator;
9236        self.acl = v.into_iter().map(|i| i.into()).collect();
9237        self
9238    }
9239
9240    /// Sets the value of [default_object_acl][crate::model::Bucket::default_object_acl].
9241    pub fn set_default_object_acl<T, V>(mut self, v: T) -> Self
9242    where
9243        T: std::iter::IntoIterator<Item = V>,
9244        V: std::convert::Into<crate::model::ObjectAccessControl>,
9245    {
9246        use std::iter::Iterator;
9247        self.default_object_acl = v.into_iter().map(|i| i.into()).collect();
9248        self
9249    }
9250
9251    /// Sets the value of [lifecycle][crate::model::Bucket::lifecycle].
9252    pub fn set_lifecycle<T>(mut self, v: T) -> Self
9253    where
9254        T: std::convert::Into<crate::model::bucket::Lifecycle>,
9255    {
9256        self.lifecycle = std::option::Option::Some(v.into());
9257        self
9258    }
9259
9260    /// Sets or clears the value of [lifecycle][crate::model::Bucket::lifecycle].
9261    pub fn set_or_clear_lifecycle<T>(mut self, v: std::option::Option<T>) -> Self
9262    where
9263        T: std::convert::Into<crate::model::bucket::Lifecycle>,
9264    {
9265        self.lifecycle = v.map(|x| x.into());
9266        self
9267    }
9268
9269    /// Sets the value of [create_time][crate::model::Bucket::create_time].
9270    pub fn set_create_time<T>(mut self, v: T) -> Self
9271    where
9272        T: std::convert::Into<wkt::Timestamp>,
9273    {
9274        self.create_time = std::option::Option::Some(v.into());
9275        self
9276    }
9277
9278    /// Sets or clears the value of [create_time][crate::model::Bucket::create_time].
9279    pub fn set_or_clear_create_time<T>(mut self, v: std::option::Option<T>) -> Self
9280    where
9281        T: std::convert::Into<wkt::Timestamp>,
9282    {
9283        self.create_time = v.map(|x| x.into());
9284        self
9285    }
9286
9287    /// Sets the value of [cors][crate::model::Bucket::cors].
9288    pub fn set_cors<T, V>(mut self, v: T) -> Self
9289    where
9290        T: std::iter::IntoIterator<Item = V>,
9291        V: std::convert::Into<crate::model::bucket::Cors>,
9292    {
9293        use std::iter::Iterator;
9294        self.cors = v.into_iter().map(|i| i.into()).collect();
9295        self
9296    }
9297
9298    /// Sets the value of [update_time][crate::model::Bucket::update_time].
9299    pub fn set_update_time<T>(mut self, v: T) -> Self
9300    where
9301        T: std::convert::Into<wkt::Timestamp>,
9302    {
9303        self.update_time = std::option::Option::Some(v.into());
9304        self
9305    }
9306
9307    /// Sets or clears the value of [update_time][crate::model::Bucket::update_time].
9308    pub fn set_or_clear_update_time<T>(mut self, v: std::option::Option<T>) -> Self
9309    where
9310        T: std::convert::Into<wkt::Timestamp>,
9311    {
9312        self.update_time = v.map(|x| x.into());
9313        self
9314    }
9315
9316    /// Sets the value of [default_event_based_hold][crate::model::Bucket::default_event_based_hold].
9317    pub fn set_default_event_based_hold<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
9318        self.default_event_based_hold = v.into();
9319        self
9320    }
9321
9322    /// Sets the value of [labels][crate::model::Bucket::labels].
9323    pub fn set_labels<T, K, V>(mut self, v: T) -> Self
9324    where
9325        T: std::iter::IntoIterator<Item = (K, V)>,
9326        K: std::convert::Into<std::string::String>,
9327        V: std::convert::Into<std::string::String>,
9328    {
9329        use std::iter::Iterator;
9330        self.labels = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
9331        self
9332    }
9333
9334    /// Sets the value of [website][crate::model::Bucket::website].
9335    pub fn set_website<T>(mut self, v: T) -> Self
9336    where
9337        T: std::convert::Into<crate::model::bucket::Website>,
9338    {
9339        self.website = std::option::Option::Some(v.into());
9340        self
9341    }
9342
9343    /// Sets or clears the value of [website][crate::model::Bucket::website].
9344    pub fn set_or_clear_website<T>(mut self, v: std::option::Option<T>) -> Self
9345    where
9346        T: std::convert::Into<crate::model::bucket::Website>,
9347    {
9348        self.website = v.map(|x| x.into());
9349        self
9350    }
9351
9352    /// Sets the value of [versioning][crate::model::Bucket::versioning].
9353    pub fn set_versioning<T>(mut self, v: T) -> Self
9354    where
9355        T: std::convert::Into<crate::model::bucket::Versioning>,
9356    {
9357        self.versioning = std::option::Option::Some(v.into());
9358        self
9359    }
9360
9361    /// Sets or clears the value of [versioning][crate::model::Bucket::versioning].
9362    pub fn set_or_clear_versioning<T>(mut self, v: std::option::Option<T>) -> Self
9363    where
9364        T: std::convert::Into<crate::model::bucket::Versioning>,
9365    {
9366        self.versioning = v.map(|x| x.into());
9367        self
9368    }
9369
9370    /// Sets the value of [logging][crate::model::Bucket::logging].
9371    pub fn set_logging<T>(mut self, v: T) -> Self
9372    where
9373        T: std::convert::Into<crate::model::bucket::Logging>,
9374    {
9375        self.logging = std::option::Option::Some(v.into());
9376        self
9377    }
9378
9379    /// Sets or clears the value of [logging][crate::model::Bucket::logging].
9380    pub fn set_or_clear_logging<T>(mut self, v: std::option::Option<T>) -> Self
9381    where
9382        T: std::convert::Into<crate::model::bucket::Logging>,
9383    {
9384        self.logging = v.map(|x| x.into());
9385        self
9386    }
9387
9388    /// Sets the value of [owner][crate::model::Bucket::owner].
9389    pub fn set_owner<T>(mut self, v: T) -> Self
9390    where
9391        T: std::convert::Into<crate::model::Owner>,
9392    {
9393        self.owner = std::option::Option::Some(v.into());
9394        self
9395    }
9396
9397    /// Sets or clears the value of [owner][crate::model::Bucket::owner].
9398    pub fn set_or_clear_owner<T>(mut self, v: std::option::Option<T>) -> Self
9399    where
9400        T: std::convert::Into<crate::model::Owner>,
9401    {
9402        self.owner = v.map(|x| x.into());
9403        self
9404    }
9405
9406    /// Sets the value of [encryption][crate::model::Bucket::encryption].
9407    pub fn set_encryption<T>(mut self, v: T) -> Self
9408    where
9409        T: std::convert::Into<crate::model::bucket::Encryption>,
9410    {
9411        self.encryption = std::option::Option::Some(v.into());
9412        self
9413    }
9414
9415    /// Sets or clears the value of [encryption][crate::model::Bucket::encryption].
9416    pub fn set_or_clear_encryption<T>(mut self, v: std::option::Option<T>) -> Self
9417    where
9418        T: std::convert::Into<crate::model::bucket::Encryption>,
9419    {
9420        self.encryption = v.map(|x| x.into());
9421        self
9422    }
9423
9424    /// Sets the value of [billing][crate::model::Bucket::billing].
9425    pub fn set_billing<T>(mut self, v: T) -> Self
9426    where
9427        T: std::convert::Into<crate::model::bucket::Billing>,
9428    {
9429        self.billing = std::option::Option::Some(v.into());
9430        self
9431    }
9432
9433    /// Sets or clears the value of [billing][crate::model::Bucket::billing].
9434    pub fn set_or_clear_billing<T>(mut self, v: std::option::Option<T>) -> Self
9435    where
9436        T: std::convert::Into<crate::model::bucket::Billing>,
9437    {
9438        self.billing = v.map(|x| x.into());
9439        self
9440    }
9441
9442    /// Sets the value of [retention_policy][crate::model::Bucket::retention_policy].
9443    pub fn set_retention_policy<T>(mut self, v: T) -> Self
9444    where
9445        T: std::convert::Into<crate::model::bucket::RetentionPolicy>,
9446    {
9447        self.retention_policy = std::option::Option::Some(v.into());
9448        self
9449    }
9450
9451    /// Sets or clears the value of [retention_policy][crate::model::Bucket::retention_policy].
9452    pub fn set_or_clear_retention_policy<T>(mut self, v: std::option::Option<T>) -> Self
9453    where
9454        T: std::convert::Into<crate::model::bucket::RetentionPolicy>,
9455    {
9456        self.retention_policy = v.map(|x| x.into());
9457        self
9458    }
9459
9460    /// Sets the value of [iam_config][crate::model::Bucket::iam_config].
9461    pub fn set_iam_config<T>(mut self, v: T) -> Self
9462    where
9463        T: std::convert::Into<crate::model::bucket::IamConfig>,
9464    {
9465        self.iam_config = std::option::Option::Some(v.into());
9466        self
9467    }
9468
9469    /// Sets or clears the value of [iam_config][crate::model::Bucket::iam_config].
9470    pub fn set_or_clear_iam_config<T>(mut self, v: std::option::Option<T>) -> Self
9471    where
9472        T: std::convert::Into<crate::model::bucket::IamConfig>,
9473    {
9474        self.iam_config = v.map(|x| x.into());
9475        self
9476    }
9477
9478    /// Sets the value of [satisfies_pzs][crate::model::Bucket::satisfies_pzs].
9479    pub fn set_satisfies_pzs<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
9480        self.satisfies_pzs = v.into();
9481        self
9482    }
9483
9484    /// Sets the value of [custom_placement_config][crate::model::Bucket::custom_placement_config].
9485    pub fn set_custom_placement_config<T>(mut self, v: T) -> Self
9486    where
9487        T: std::convert::Into<crate::model::bucket::CustomPlacementConfig>,
9488    {
9489        self.custom_placement_config = std::option::Option::Some(v.into());
9490        self
9491    }
9492
9493    /// Sets or clears the value of [custom_placement_config][crate::model::Bucket::custom_placement_config].
9494    pub fn set_or_clear_custom_placement_config<T>(mut self, v: std::option::Option<T>) -> Self
9495    where
9496        T: std::convert::Into<crate::model::bucket::CustomPlacementConfig>,
9497    {
9498        self.custom_placement_config = v.map(|x| x.into());
9499        self
9500    }
9501
9502    /// Sets the value of [autoclass][crate::model::Bucket::autoclass].
9503    pub fn set_autoclass<T>(mut self, v: T) -> Self
9504    where
9505        T: std::convert::Into<crate::model::bucket::Autoclass>,
9506    {
9507        self.autoclass = std::option::Option::Some(v.into());
9508        self
9509    }
9510
9511    /// Sets or clears the value of [autoclass][crate::model::Bucket::autoclass].
9512    pub fn set_or_clear_autoclass<T>(mut self, v: std::option::Option<T>) -> Self
9513    where
9514        T: std::convert::Into<crate::model::bucket::Autoclass>,
9515    {
9516        self.autoclass = v.map(|x| x.into());
9517        self
9518    }
9519
9520    /// Sets the value of [hierarchical_namespace][crate::model::Bucket::hierarchical_namespace].
9521    pub fn set_hierarchical_namespace<T>(mut self, v: T) -> Self
9522    where
9523        T: std::convert::Into<crate::model::bucket::HierarchicalNamespace>,
9524    {
9525        self.hierarchical_namespace = std::option::Option::Some(v.into());
9526        self
9527    }
9528
9529    /// Sets or clears the value of [hierarchical_namespace][crate::model::Bucket::hierarchical_namespace].
9530    pub fn set_or_clear_hierarchical_namespace<T>(mut self, v: std::option::Option<T>) -> Self
9531    where
9532        T: std::convert::Into<crate::model::bucket::HierarchicalNamespace>,
9533    {
9534        self.hierarchical_namespace = v.map(|x| x.into());
9535        self
9536    }
9537
9538    /// Sets the value of [soft_delete_policy][crate::model::Bucket::soft_delete_policy].
9539    pub fn set_soft_delete_policy<T>(mut self, v: T) -> Self
9540    where
9541        T: std::convert::Into<crate::model::bucket::SoftDeletePolicy>,
9542    {
9543        self.soft_delete_policy = std::option::Option::Some(v.into());
9544        self
9545    }
9546
9547    /// Sets or clears the value of [soft_delete_policy][crate::model::Bucket::soft_delete_policy].
9548    pub fn set_or_clear_soft_delete_policy<T>(mut self, v: std::option::Option<T>) -> Self
9549    where
9550        T: std::convert::Into<crate::model::bucket::SoftDeletePolicy>,
9551    {
9552        self.soft_delete_policy = v.map(|x| x.into());
9553        self
9554    }
9555
9556    /// Sets the value of [object_retention][crate::model::Bucket::object_retention].
9557    pub fn set_object_retention<T>(mut self, v: T) -> Self
9558    where
9559        T: std::convert::Into<crate::model::bucket::ObjectRetention>,
9560    {
9561        self.object_retention = std::option::Option::Some(v.into());
9562        self
9563    }
9564
9565    /// Sets or clears the value of [object_retention][crate::model::Bucket::object_retention].
9566    pub fn set_or_clear_object_retention<T>(mut self, v: std::option::Option<T>) -> Self
9567    where
9568        T: std::convert::Into<crate::model::bucket::ObjectRetention>,
9569    {
9570        self.object_retention = v.map(|x| x.into());
9571        self
9572    }
9573
9574    /// Sets the value of [ip_filter][crate::model::Bucket::ip_filter].
9575    pub fn set_ip_filter<T>(mut self, v: T) -> Self
9576    where
9577        T: std::convert::Into<crate::model::bucket::IpFilter>,
9578    {
9579        self.ip_filter = std::option::Option::Some(v.into());
9580        self
9581    }
9582
9583    /// Sets or clears the value of [ip_filter][crate::model::Bucket::ip_filter].
9584    pub fn set_or_clear_ip_filter<T>(mut self, v: std::option::Option<T>) -> Self
9585    where
9586        T: std::convert::Into<crate::model::bucket::IpFilter>,
9587    {
9588        self.ip_filter = v.map(|x| x.into());
9589        self
9590    }
9591}
9592
9593impl wkt::message::Message for Bucket {
9594    fn typename() -> &'static str {
9595        "type.googleapis.com/google.storage.v2.Bucket"
9596    }
9597}
9598
9599#[doc(hidden)]
9600impl<'de> serde::de::Deserialize<'de> for Bucket {
9601    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
9602    where
9603        D: serde::Deserializer<'de>,
9604    {
9605        #[allow(non_camel_case_types)]
9606        #[doc(hidden)]
9607        #[derive(PartialEq, Eq, Hash)]
9608        enum __FieldTag {
9609            __name,
9610            __bucket_id,
9611            __etag,
9612            __project,
9613            __metageneration,
9614            __location,
9615            __location_type,
9616            __storage_class,
9617            __rpo,
9618            __acl,
9619            __default_object_acl,
9620            __lifecycle,
9621            __create_time,
9622            __cors,
9623            __update_time,
9624            __default_event_based_hold,
9625            __labels,
9626            __website,
9627            __versioning,
9628            __logging,
9629            __owner,
9630            __encryption,
9631            __billing,
9632            __retention_policy,
9633            __iam_config,
9634            __satisfies_pzs,
9635            __custom_placement_config,
9636            __autoclass,
9637            __hierarchical_namespace,
9638            __soft_delete_policy,
9639            __object_retention,
9640            __ip_filter,
9641            Unknown(std::string::String),
9642        }
9643        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
9644            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
9645            where
9646                D: serde::Deserializer<'de>,
9647            {
9648                struct Visitor;
9649                impl<'de> serde::de::Visitor<'de> for Visitor {
9650                    type Value = __FieldTag;
9651                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
9652                        formatter.write_str("a field name for Bucket")
9653                    }
9654                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
9655                    where
9656                        E: serde::de::Error,
9657                    {
9658                        use std::result::Result::Ok;
9659                        use std::string::ToString;
9660                        match value {
9661                            "name" => Ok(__FieldTag::__name),
9662                            "bucketId" => Ok(__FieldTag::__bucket_id),
9663                            "bucket_id" => Ok(__FieldTag::__bucket_id),
9664                            "etag" => Ok(__FieldTag::__etag),
9665                            "project" => Ok(__FieldTag::__project),
9666                            "metageneration" => Ok(__FieldTag::__metageneration),
9667                            "location" => Ok(__FieldTag::__location),
9668                            "locationType" => Ok(__FieldTag::__location_type),
9669                            "location_type" => Ok(__FieldTag::__location_type),
9670                            "storageClass" => Ok(__FieldTag::__storage_class),
9671                            "storage_class" => Ok(__FieldTag::__storage_class),
9672                            "rpo" => Ok(__FieldTag::__rpo),
9673                            "acl" => Ok(__FieldTag::__acl),
9674                            "defaultObjectAcl" => Ok(__FieldTag::__default_object_acl),
9675                            "default_object_acl" => Ok(__FieldTag::__default_object_acl),
9676                            "lifecycle" => Ok(__FieldTag::__lifecycle),
9677                            "createTime" => Ok(__FieldTag::__create_time),
9678                            "create_time" => Ok(__FieldTag::__create_time),
9679                            "cors" => Ok(__FieldTag::__cors),
9680                            "updateTime" => Ok(__FieldTag::__update_time),
9681                            "update_time" => Ok(__FieldTag::__update_time),
9682                            "defaultEventBasedHold" => Ok(__FieldTag::__default_event_based_hold),
9683                            "default_event_based_hold" => {
9684                                Ok(__FieldTag::__default_event_based_hold)
9685                            }
9686                            "labels" => Ok(__FieldTag::__labels),
9687                            "website" => Ok(__FieldTag::__website),
9688                            "versioning" => Ok(__FieldTag::__versioning),
9689                            "logging" => Ok(__FieldTag::__logging),
9690                            "owner" => Ok(__FieldTag::__owner),
9691                            "encryption" => Ok(__FieldTag::__encryption),
9692                            "billing" => Ok(__FieldTag::__billing),
9693                            "retentionPolicy" => Ok(__FieldTag::__retention_policy),
9694                            "retention_policy" => Ok(__FieldTag::__retention_policy),
9695                            "iamConfig" => Ok(__FieldTag::__iam_config),
9696                            "iam_config" => Ok(__FieldTag::__iam_config),
9697                            "satisfiesPzs" => Ok(__FieldTag::__satisfies_pzs),
9698                            "satisfies_pzs" => Ok(__FieldTag::__satisfies_pzs),
9699                            "customPlacementConfig" => Ok(__FieldTag::__custom_placement_config),
9700                            "custom_placement_config" => Ok(__FieldTag::__custom_placement_config),
9701                            "autoclass" => Ok(__FieldTag::__autoclass),
9702                            "hierarchicalNamespace" => Ok(__FieldTag::__hierarchical_namespace),
9703                            "hierarchical_namespace" => Ok(__FieldTag::__hierarchical_namespace),
9704                            "softDeletePolicy" => Ok(__FieldTag::__soft_delete_policy),
9705                            "soft_delete_policy" => Ok(__FieldTag::__soft_delete_policy),
9706                            "objectRetention" => Ok(__FieldTag::__object_retention),
9707                            "object_retention" => Ok(__FieldTag::__object_retention),
9708                            "ipFilter" => Ok(__FieldTag::__ip_filter),
9709                            "ip_filter" => Ok(__FieldTag::__ip_filter),
9710                            _ => Ok(__FieldTag::Unknown(value.to_string())),
9711                        }
9712                    }
9713                }
9714                deserializer.deserialize_identifier(Visitor)
9715            }
9716        }
9717        struct Visitor;
9718        impl<'de> serde::de::Visitor<'de> for Visitor {
9719            type Value = Bucket;
9720            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
9721                formatter.write_str("struct Bucket")
9722            }
9723            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
9724            where
9725                A: serde::de::MapAccess<'de>,
9726            {
9727                #[allow(unused_imports)]
9728                use serde::de::Error;
9729                use std::option::Option::Some;
9730                let mut fields = std::collections::HashSet::new();
9731                let mut result = Self::Value::new();
9732                while let Some(tag) = map.next_key::<__FieldTag>()? {
9733                    #[allow(clippy::match_single_binding)]
9734                    match tag {
9735                        __FieldTag::__name => {
9736                            if !fields.insert(__FieldTag::__name) {
9737                                return std::result::Result::Err(A::Error::duplicate_field(
9738                                    "multiple values for name",
9739                                ));
9740                            }
9741                            result.name = map
9742                                .next_value::<std::option::Option<std::string::String>>()?
9743                                .unwrap_or_default();
9744                        }
9745                        __FieldTag::__bucket_id => {
9746                            if !fields.insert(__FieldTag::__bucket_id) {
9747                                return std::result::Result::Err(A::Error::duplicate_field(
9748                                    "multiple values for bucket_id",
9749                                ));
9750                            }
9751                            result.bucket_id = map
9752                                .next_value::<std::option::Option<std::string::String>>()?
9753                                .unwrap_or_default();
9754                        }
9755                        __FieldTag::__etag => {
9756                            if !fields.insert(__FieldTag::__etag) {
9757                                return std::result::Result::Err(A::Error::duplicate_field(
9758                                    "multiple values for etag",
9759                                ));
9760                            }
9761                            result.etag = map
9762                                .next_value::<std::option::Option<std::string::String>>()?
9763                                .unwrap_or_default();
9764                        }
9765                        __FieldTag::__project => {
9766                            if !fields.insert(__FieldTag::__project) {
9767                                return std::result::Result::Err(A::Error::duplicate_field(
9768                                    "multiple values for project",
9769                                ));
9770                            }
9771                            result.project = map
9772                                .next_value::<std::option::Option<std::string::String>>()?
9773                                .unwrap_or_default();
9774                        }
9775                        __FieldTag::__metageneration => {
9776                            if !fields.insert(__FieldTag::__metageneration) {
9777                                return std::result::Result::Err(A::Error::duplicate_field(
9778                                    "multiple values for metageneration",
9779                                ));
9780                            }
9781                            struct __With(std::option::Option<i64>);
9782                            impl<'de> serde::de::Deserialize<'de> for __With {
9783                                fn deserialize<D>(
9784                                    deserializer: D,
9785                                ) -> std::result::Result<Self, D::Error>
9786                                where
9787                                    D: serde::de::Deserializer<'de>,
9788                                {
9789                                    serde_with::As::< std::option::Option<wkt::internal::I64> >::deserialize(deserializer).map(__With)
9790                                }
9791                            }
9792                            result.metageneration =
9793                                map.next_value::<__With>()?.0.unwrap_or_default();
9794                        }
9795                        __FieldTag::__location => {
9796                            if !fields.insert(__FieldTag::__location) {
9797                                return std::result::Result::Err(A::Error::duplicate_field(
9798                                    "multiple values for location",
9799                                ));
9800                            }
9801                            result.location = map
9802                                .next_value::<std::option::Option<std::string::String>>()?
9803                                .unwrap_or_default();
9804                        }
9805                        __FieldTag::__location_type => {
9806                            if !fields.insert(__FieldTag::__location_type) {
9807                                return std::result::Result::Err(A::Error::duplicate_field(
9808                                    "multiple values for location_type",
9809                                ));
9810                            }
9811                            result.location_type = map
9812                                .next_value::<std::option::Option<std::string::String>>()?
9813                                .unwrap_or_default();
9814                        }
9815                        __FieldTag::__storage_class => {
9816                            if !fields.insert(__FieldTag::__storage_class) {
9817                                return std::result::Result::Err(A::Error::duplicate_field(
9818                                    "multiple values for storage_class",
9819                                ));
9820                            }
9821                            result.storage_class = map
9822                                .next_value::<std::option::Option<std::string::String>>()?
9823                                .unwrap_or_default();
9824                        }
9825                        __FieldTag::__rpo => {
9826                            if !fields.insert(__FieldTag::__rpo) {
9827                                return std::result::Result::Err(A::Error::duplicate_field(
9828                                    "multiple values for rpo",
9829                                ));
9830                            }
9831                            result.rpo = map
9832                                .next_value::<std::option::Option<std::string::String>>()?
9833                                .unwrap_or_default();
9834                        }
9835                        __FieldTag::__acl => {
9836                            if !fields.insert(__FieldTag::__acl) {
9837                                return std::result::Result::Err(A::Error::duplicate_field(
9838                                    "multiple values for acl",
9839                                ));
9840                            }
9841                            result.acl = map
9842                                .next_value::<std::option::Option<
9843                                    std::vec::Vec<crate::model::BucketAccessControl>,
9844                                >>()?
9845                                .unwrap_or_default();
9846                        }
9847                        __FieldTag::__default_object_acl => {
9848                            if !fields.insert(__FieldTag::__default_object_acl) {
9849                                return std::result::Result::Err(A::Error::duplicate_field(
9850                                    "multiple values for default_object_acl",
9851                                ));
9852                            }
9853                            result.default_object_acl = map
9854                                .next_value::<std::option::Option<
9855                                    std::vec::Vec<crate::model::ObjectAccessControl>,
9856                                >>()?
9857                                .unwrap_or_default();
9858                        }
9859                        __FieldTag::__lifecycle => {
9860                            if !fields.insert(__FieldTag::__lifecycle) {
9861                                return std::result::Result::Err(A::Error::duplicate_field(
9862                                    "multiple values for lifecycle",
9863                                ));
9864                            }
9865                            result.lifecycle = map
9866                                .next_value::<std::option::Option<crate::model::bucket::Lifecycle>>(
9867                                )?;
9868                        }
9869                        __FieldTag::__create_time => {
9870                            if !fields.insert(__FieldTag::__create_time) {
9871                                return std::result::Result::Err(A::Error::duplicate_field(
9872                                    "multiple values for create_time",
9873                                ));
9874                            }
9875                            result.create_time =
9876                                map.next_value::<std::option::Option<wkt::Timestamp>>()?;
9877                        }
9878                        __FieldTag::__cors => {
9879                            if !fields.insert(__FieldTag::__cors) {
9880                                return std::result::Result::Err(A::Error::duplicate_field(
9881                                    "multiple values for cors",
9882                                ));
9883                            }
9884                            result.cors = map.next_value::<std::option::Option<std::vec::Vec<crate::model::bucket::Cors>>>()?.unwrap_or_default();
9885                        }
9886                        __FieldTag::__update_time => {
9887                            if !fields.insert(__FieldTag::__update_time) {
9888                                return std::result::Result::Err(A::Error::duplicate_field(
9889                                    "multiple values for update_time",
9890                                ));
9891                            }
9892                            result.update_time =
9893                                map.next_value::<std::option::Option<wkt::Timestamp>>()?;
9894                        }
9895                        __FieldTag::__default_event_based_hold => {
9896                            if !fields.insert(__FieldTag::__default_event_based_hold) {
9897                                return std::result::Result::Err(A::Error::duplicate_field(
9898                                    "multiple values for default_event_based_hold",
9899                                ));
9900                            }
9901                            result.default_event_based_hold = map
9902                                .next_value::<std::option::Option<bool>>()?
9903                                .unwrap_or_default();
9904                        }
9905                        __FieldTag::__labels => {
9906                            if !fields.insert(__FieldTag::__labels) {
9907                                return std::result::Result::Err(A::Error::duplicate_field(
9908                                    "multiple values for labels",
9909                                ));
9910                            }
9911                            result.labels = map
9912                                .next_value::<std::option::Option<
9913                                    std::collections::HashMap<
9914                                        std::string::String,
9915                                        std::string::String,
9916                                    >,
9917                                >>()?
9918                                .unwrap_or_default();
9919                        }
9920                        __FieldTag::__website => {
9921                            if !fields.insert(__FieldTag::__website) {
9922                                return std::result::Result::Err(A::Error::duplicate_field(
9923                                    "multiple values for website",
9924                                ));
9925                            }
9926                            result.website = map
9927                                .next_value::<std::option::Option<crate::model::bucket::Website>>(
9928                                )?;
9929                        }
9930                        __FieldTag::__versioning => {
9931                            if !fields.insert(__FieldTag::__versioning) {
9932                                return std::result::Result::Err(A::Error::duplicate_field(
9933                                    "multiple values for versioning",
9934                                ));
9935                            }
9936                            result.versioning = map.next_value::<std::option::Option<crate::model::bucket::Versioning>>()?
9937                                ;
9938                        }
9939                        __FieldTag::__logging => {
9940                            if !fields.insert(__FieldTag::__logging) {
9941                                return std::result::Result::Err(A::Error::duplicate_field(
9942                                    "multiple values for logging",
9943                                ));
9944                            }
9945                            result.logging = map
9946                                .next_value::<std::option::Option<crate::model::bucket::Logging>>(
9947                                )?;
9948                        }
9949                        __FieldTag::__owner => {
9950                            if !fields.insert(__FieldTag::__owner) {
9951                                return std::result::Result::Err(A::Error::duplicate_field(
9952                                    "multiple values for owner",
9953                                ));
9954                            }
9955                            result.owner =
9956                                map.next_value::<std::option::Option<crate::model::Owner>>()?;
9957                        }
9958                        __FieldTag::__encryption => {
9959                            if !fields.insert(__FieldTag::__encryption) {
9960                                return std::result::Result::Err(A::Error::duplicate_field(
9961                                    "multiple values for encryption",
9962                                ));
9963                            }
9964                            result.encryption = map.next_value::<std::option::Option<crate::model::bucket::Encryption>>()?
9965                                ;
9966                        }
9967                        __FieldTag::__billing => {
9968                            if !fields.insert(__FieldTag::__billing) {
9969                                return std::result::Result::Err(A::Error::duplicate_field(
9970                                    "multiple values for billing",
9971                                ));
9972                            }
9973                            result.billing = map
9974                                .next_value::<std::option::Option<crate::model::bucket::Billing>>(
9975                                )?;
9976                        }
9977                        __FieldTag::__retention_policy => {
9978                            if !fields.insert(__FieldTag::__retention_policy) {
9979                                return std::result::Result::Err(A::Error::duplicate_field(
9980                                    "multiple values for retention_policy",
9981                                ));
9982                            }
9983                            result.retention_policy = map.next_value::<std::option::Option<crate::model::bucket::RetentionPolicy>>()?
9984                                ;
9985                        }
9986                        __FieldTag::__iam_config => {
9987                            if !fields.insert(__FieldTag::__iam_config) {
9988                                return std::result::Result::Err(A::Error::duplicate_field(
9989                                    "multiple values for iam_config",
9990                                ));
9991                            }
9992                            result.iam_config = map
9993                                .next_value::<std::option::Option<crate::model::bucket::IamConfig>>(
9994                                )?;
9995                        }
9996                        __FieldTag::__satisfies_pzs => {
9997                            if !fields.insert(__FieldTag::__satisfies_pzs) {
9998                                return std::result::Result::Err(A::Error::duplicate_field(
9999                                    "multiple values for satisfies_pzs",
10000                                ));
10001                            }
10002                            result.satisfies_pzs = map
10003                                .next_value::<std::option::Option<bool>>()?
10004                                .unwrap_or_default();
10005                        }
10006                        __FieldTag::__custom_placement_config => {
10007                            if !fields.insert(__FieldTag::__custom_placement_config) {
10008                                return std::result::Result::Err(A::Error::duplicate_field(
10009                                    "multiple values for custom_placement_config",
10010                                ));
10011                            }
10012                            result.custom_placement_config =
10013                                map.next_value::<std::option::Option<
10014                                    crate::model::bucket::CustomPlacementConfig,
10015                                >>()?;
10016                        }
10017                        __FieldTag::__autoclass => {
10018                            if !fields.insert(__FieldTag::__autoclass) {
10019                                return std::result::Result::Err(A::Error::duplicate_field(
10020                                    "multiple values for autoclass",
10021                                ));
10022                            }
10023                            result.autoclass = map
10024                                .next_value::<std::option::Option<crate::model::bucket::Autoclass>>(
10025                                )?;
10026                        }
10027                        __FieldTag::__hierarchical_namespace => {
10028                            if !fields.insert(__FieldTag::__hierarchical_namespace) {
10029                                return std::result::Result::Err(A::Error::duplicate_field(
10030                                    "multiple values for hierarchical_namespace",
10031                                ));
10032                            }
10033                            result.hierarchical_namespace =
10034                                map.next_value::<std::option::Option<
10035                                    crate::model::bucket::HierarchicalNamespace,
10036                                >>()?;
10037                        }
10038                        __FieldTag::__soft_delete_policy => {
10039                            if !fields.insert(__FieldTag::__soft_delete_policy) {
10040                                return std::result::Result::Err(A::Error::duplicate_field(
10041                                    "multiple values for soft_delete_policy",
10042                                ));
10043                            }
10044                            result.soft_delete_policy = map.next_value::<std::option::Option<crate::model::bucket::SoftDeletePolicy>>()?
10045                                ;
10046                        }
10047                        __FieldTag::__object_retention => {
10048                            if !fields.insert(__FieldTag::__object_retention) {
10049                                return std::result::Result::Err(A::Error::duplicate_field(
10050                                    "multiple values for object_retention",
10051                                ));
10052                            }
10053                            result.object_retention = map.next_value::<std::option::Option<crate::model::bucket::ObjectRetention>>()?
10054                                ;
10055                        }
10056                        __FieldTag::__ip_filter => {
10057                            if !fields.insert(__FieldTag::__ip_filter) {
10058                                return std::result::Result::Err(A::Error::duplicate_field(
10059                                    "multiple values for ip_filter",
10060                                ));
10061                            }
10062                            result.ip_filter = map
10063                                .next_value::<std::option::Option<crate::model::bucket::IpFilter>>(
10064                                )?;
10065                        }
10066                        __FieldTag::Unknown(key) => {
10067                            let value = map.next_value::<serde_json::Value>()?;
10068                            result._unknown_fields.insert(key, value);
10069                        }
10070                    }
10071                }
10072                std::result::Result::Ok(result)
10073            }
10074        }
10075        deserializer.deserialize_any(Visitor)
10076    }
10077}
10078
10079#[doc(hidden)]
10080impl serde::ser::Serialize for Bucket {
10081    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
10082    where
10083        S: serde::ser::Serializer,
10084    {
10085        use serde::ser::SerializeMap;
10086        #[allow(unused_imports)]
10087        use std::option::Option::Some;
10088        let mut state = serializer.serialize_map(std::option::Option::None)?;
10089        if !self.name.is_empty() {
10090            state.serialize_entry("name", &self.name)?;
10091        }
10092        if !self.bucket_id.is_empty() {
10093            state.serialize_entry("bucketId", &self.bucket_id)?;
10094        }
10095        if !self.etag.is_empty() {
10096            state.serialize_entry("etag", &self.etag)?;
10097        }
10098        if !self.project.is_empty() {
10099            state.serialize_entry("project", &self.project)?;
10100        }
10101        if !wkt::internal::is_default(&self.metageneration) {
10102            struct __With<'a>(&'a i64);
10103            impl<'a> serde::ser::Serialize for __With<'a> {
10104                fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
10105                where
10106                    S: serde::ser::Serializer,
10107                {
10108                    serde_with::As::<wkt::internal::I64>::serialize(self.0, serializer)
10109                }
10110            }
10111            state.serialize_entry("metageneration", &__With(&self.metageneration))?;
10112        }
10113        if !self.location.is_empty() {
10114            state.serialize_entry("location", &self.location)?;
10115        }
10116        if !self.location_type.is_empty() {
10117            state.serialize_entry("locationType", &self.location_type)?;
10118        }
10119        if !self.storage_class.is_empty() {
10120            state.serialize_entry("storageClass", &self.storage_class)?;
10121        }
10122        if !self.rpo.is_empty() {
10123            state.serialize_entry("rpo", &self.rpo)?;
10124        }
10125        if !self.acl.is_empty() {
10126            state.serialize_entry("acl", &self.acl)?;
10127        }
10128        if !self.default_object_acl.is_empty() {
10129            state.serialize_entry("defaultObjectAcl", &self.default_object_acl)?;
10130        }
10131        if self.lifecycle.is_some() {
10132            state.serialize_entry("lifecycle", &self.lifecycle)?;
10133        }
10134        if self.create_time.is_some() {
10135            state.serialize_entry("createTime", &self.create_time)?;
10136        }
10137        if !self.cors.is_empty() {
10138            state.serialize_entry("cors", &self.cors)?;
10139        }
10140        if self.update_time.is_some() {
10141            state.serialize_entry("updateTime", &self.update_time)?;
10142        }
10143        if !wkt::internal::is_default(&self.default_event_based_hold) {
10144            state.serialize_entry("defaultEventBasedHold", &self.default_event_based_hold)?;
10145        }
10146        if !self.labels.is_empty() {
10147            state.serialize_entry("labels", &self.labels)?;
10148        }
10149        if self.website.is_some() {
10150            state.serialize_entry("website", &self.website)?;
10151        }
10152        if self.versioning.is_some() {
10153            state.serialize_entry("versioning", &self.versioning)?;
10154        }
10155        if self.logging.is_some() {
10156            state.serialize_entry("logging", &self.logging)?;
10157        }
10158        if self.owner.is_some() {
10159            state.serialize_entry("owner", &self.owner)?;
10160        }
10161        if self.encryption.is_some() {
10162            state.serialize_entry("encryption", &self.encryption)?;
10163        }
10164        if self.billing.is_some() {
10165            state.serialize_entry("billing", &self.billing)?;
10166        }
10167        if self.retention_policy.is_some() {
10168            state.serialize_entry("retentionPolicy", &self.retention_policy)?;
10169        }
10170        if self.iam_config.is_some() {
10171            state.serialize_entry("iamConfig", &self.iam_config)?;
10172        }
10173        if !wkt::internal::is_default(&self.satisfies_pzs) {
10174            state.serialize_entry("satisfiesPzs", &self.satisfies_pzs)?;
10175        }
10176        if self.custom_placement_config.is_some() {
10177            state.serialize_entry("customPlacementConfig", &self.custom_placement_config)?;
10178        }
10179        if self.autoclass.is_some() {
10180            state.serialize_entry("autoclass", &self.autoclass)?;
10181        }
10182        if self.hierarchical_namespace.is_some() {
10183            state.serialize_entry("hierarchicalNamespace", &self.hierarchical_namespace)?;
10184        }
10185        if self.soft_delete_policy.is_some() {
10186            state.serialize_entry("softDeletePolicy", &self.soft_delete_policy)?;
10187        }
10188        if self.object_retention.is_some() {
10189            state.serialize_entry("objectRetention", &self.object_retention)?;
10190        }
10191        if self.ip_filter.is_some() {
10192            state.serialize_entry("ipFilter", &self.ip_filter)?;
10193        }
10194        if !self._unknown_fields.is_empty() {
10195            for (key, value) in self._unknown_fields.iter() {
10196                state.serialize_entry(key, &value)?;
10197            }
10198        }
10199        state.end()
10200    }
10201}
10202
10203/// Defines additional types related to [Bucket].
10204pub mod bucket {
10205    #[allow(unused_imports)]
10206    use super::*;
10207
10208    /// Billing properties of a bucket.
10209    #[derive(Clone, Debug, Default, PartialEq)]
10210    #[non_exhaustive]
10211    pub struct Billing {
10212        /// Optional. When set to true, Requester Pays is enabled for this bucket.
10213        pub requester_pays: bool,
10214
10215        _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
10216    }
10217
10218    impl Billing {
10219        pub fn new() -> Self {
10220            std::default::Default::default()
10221        }
10222
10223        /// Sets the value of [requester_pays][crate::model::bucket::Billing::requester_pays].
10224        pub fn set_requester_pays<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
10225            self.requester_pays = v.into();
10226            self
10227        }
10228    }
10229
10230    impl wkt::message::Message for Billing {
10231        fn typename() -> &'static str {
10232            "type.googleapis.com/google.storage.v2.Bucket.Billing"
10233        }
10234    }
10235
10236    #[doc(hidden)]
10237    impl<'de> serde::de::Deserialize<'de> for Billing {
10238        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
10239        where
10240            D: serde::Deserializer<'de>,
10241        {
10242            #[allow(non_camel_case_types)]
10243            #[doc(hidden)]
10244            #[derive(PartialEq, Eq, Hash)]
10245            enum __FieldTag {
10246                __requester_pays,
10247                Unknown(std::string::String),
10248            }
10249            impl<'de> serde::de::Deserialize<'de> for __FieldTag {
10250                fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
10251                where
10252                    D: serde::Deserializer<'de>,
10253                {
10254                    struct Visitor;
10255                    impl<'de> serde::de::Visitor<'de> for Visitor {
10256                        type Value = __FieldTag;
10257                        fn expecting(
10258                            &self,
10259                            formatter: &mut std::fmt::Formatter,
10260                        ) -> std::fmt::Result {
10261                            formatter.write_str("a field name for Billing")
10262                        }
10263                        fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
10264                        where
10265                            E: serde::de::Error,
10266                        {
10267                            use std::result::Result::Ok;
10268                            use std::string::ToString;
10269                            match value {
10270                                "requesterPays" => Ok(__FieldTag::__requester_pays),
10271                                "requester_pays" => Ok(__FieldTag::__requester_pays),
10272                                _ => Ok(__FieldTag::Unknown(value.to_string())),
10273                            }
10274                        }
10275                    }
10276                    deserializer.deserialize_identifier(Visitor)
10277                }
10278            }
10279            struct Visitor;
10280            impl<'de> serde::de::Visitor<'de> for Visitor {
10281                type Value = Billing;
10282                fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
10283                    formatter.write_str("struct Billing")
10284                }
10285                fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
10286                where
10287                    A: serde::de::MapAccess<'de>,
10288                {
10289                    #[allow(unused_imports)]
10290                    use serde::de::Error;
10291                    use std::option::Option::Some;
10292                    let mut fields = std::collections::HashSet::new();
10293                    let mut result = Self::Value::new();
10294                    while let Some(tag) = map.next_key::<__FieldTag>()? {
10295                        #[allow(clippy::match_single_binding)]
10296                        match tag {
10297                            __FieldTag::__requester_pays => {
10298                                if !fields.insert(__FieldTag::__requester_pays) {
10299                                    return std::result::Result::Err(A::Error::duplicate_field(
10300                                        "multiple values for requester_pays",
10301                                    ));
10302                                }
10303                                result.requester_pays = map
10304                                    .next_value::<std::option::Option<bool>>()?
10305                                    .unwrap_or_default();
10306                            }
10307                            __FieldTag::Unknown(key) => {
10308                                let value = map.next_value::<serde_json::Value>()?;
10309                                result._unknown_fields.insert(key, value);
10310                            }
10311                        }
10312                    }
10313                    std::result::Result::Ok(result)
10314                }
10315            }
10316            deserializer.deserialize_any(Visitor)
10317        }
10318    }
10319
10320    #[doc(hidden)]
10321    impl serde::ser::Serialize for Billing {
10322        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
10323        where
10324            S: serde::ser::Serializer,
10325        {
10326            use serde::ser::SerializeMap;
10327            #[allow(unused_imports)]
10328            use std::option::Option::Some;
10329            let mut state = serializer.serialize_map(std::option::Option::None)?;
10330            if !wkt::internal::is_default(&self.requester_pays) {
10331                state.serialize_entry("requesterPays", &self.requester_pays)?;
10332            }
10333            if !self._unknown_fields.is_empty() {
10334                for (key, value) in self._unknown_fields.iter() {
10335                    state.serialize_entry(key, &value)?;
10336                }
10337            }
10338            state.end()
10339        }
10340    }
10341
10342    /// Cross-Origin Response sharing (CORS) properties for a bucket.
10343    /// For more on Cloud Storage and CORS, see
10344    /// <https://cloud.google.com/storage/docs/cross-origin>.
10345    /// For more on CORS in general, see <https://tools.ietf.org/html/rfc6454>.
10346    #[derive(Clone, Debug, Default, PartialEq)]
10347    #[non_exhaustive]
10348    pub struct Cors {
10349        /// Optional. The list of Origins eligible to receive CORS response headers.
10350        /// See [<https://tools.ietf.org/html/rfc6454>][RFC 6454] for more on origins.
10351        /// Note: "*" is permitted in the list of origins, and means "any Origin".
10352        pub origin: std::vec::Vec<std::string::String>,
10353
10354        /// Optional. The list of HTTP methods on which to include CORS response
10355        /// headers,
10356        /// (`GET`, `OPTIONS`, `POST`, etc) Note: "*" is permitted in the list of
10357        /// methods, and means "any method".
10358        pub method: std::vec::Vec<std::string::String>,
10359
10360        /// Optional. The list of HTTP headers other than the
10361        /// [<https://www.w3.org/TR/cors/#simple-response-header>][simple response
10362        /// headers] to give permission for the user-agent to share across domains.
10363        pub response_header: std::vec::Vec<std::string::String>,
10364
10365        /// Optional. The value, in seconds, to return in the
10366        /// [<https://www.w3.org/TR/cors/#access-control-max-age-response-header>][Access-Control-Max-Age
10367        /// header] used in preflight responses.
10368        pub max_age_seconds: i32,
10369
10370        _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
10371    }
10372
10373    impl Cors {
10374        pub fn new() -> Self {
10375            std::default::Default::default()
10376        }
10377
10378        /// Sets the value of [origin][crate::model::bucket::Cors::origin].
10379        pub fn set_origin<T, V>(mut self, v: T) -> Self
10380        where
10381            T: std::iter::IntoIterator<Item = V>,
10382            V: std::convert::Into<std::string::String>,
10383        {
10384            use std::iter::Iterator;
10385            self.origin = v.into_iter().map(|i| i.into()).collect();
10386            self
10387        }
10388
10389        /// Sets the value of [method][crate::model::bucket::Cors::method].
10390        pub fn set_method<T, V>(mut self, v: T) -> Self
10391        where
10392            T: std::iter::IntoIterator<Item = V>,
10393            V: std::convert::Into<std::string::String>,
10394        {
10395            use std::iter::Iterator;
10396            self.method = v.into_iter().map(|i| i.into()).collect();
10397            self
10398        }
10399
10400        /// Sets the value of [response_header][crate::model::bucket::Cors::response_header].
10401        pub fn set_response_header<T, V>(mut self, v: T) -> Self
10402        where
10403            T: std::iter::IntoIterator<Item = V>,
10404            V: std::convert::Into<std::string::String>,
10405        {
10406            use std::iter::Iterator;
10407            self.response_header = v.into_iter().map(|i| i.into()).collect();
10408            self
10409        }
10410
10411        /// Sets the value of [max_age_seconds][crate::model::bucket::Cors::max_age_seconds].
10412        pub fn set_max_age_seconds<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
10413            self.max_age_seconds = v.into();
10414            self
10415        }
10416    }
10417
10418    impl wkt::message::Message for Cors {
10419        fn typename() -> &'static str {
10420            "type.googleapis.com/google.storage.v2.Bucket.Cors"
10421        }
10422    }
10423
10424    #[doc(hidden)]
10425    impl<'de> serde::de::Deserialize<'de> for Cors {
10426        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
10427        where
10428            D: serde::Deserializer<'de>,
10429        {
10430            #[allow(non_camel_case_types)]
10431            #[doc(hidden)]
10432            #[derive(PartialEq, Eq, Hash)]
10433            enum __FieldTag {
10434                __origin,
10435                __method,
10436                __response_header,
10437                __max_age_seconds,
10438                Unknown(std::string::String),
10439            }
10440            impl<'de> serde::de::Deserialize<'de> for __FieldTag {
10441                fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
10442                where
10443                    D: serde::Deserializer<'de>,
10444                {
10445                    struct Visitor;
10446                    impl<'de> serde::de::Visitor<'de> for Visitor {
10447                        type Value = __FieldTag;
10448                        fn expecting(
10449                            &self,
10450                            formatter: &mut std::fmt::Formatter,
10451                        ) -> std::fmt::Result {
10452                            formatter.write_str("a field name for Cors")
10453                        }
10454                        fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
10455                        where
10456                            E: serde::de::Error,
10457                        {
10458                            use std::result::Result::Ok;
10459                            use std::string::ToString;
10460                            match value {
10461                                "origin" => Ok(__FieldTag::__origin),
10462                                "method" => Ok(__FieldTag::__method),
10463                                "responseHeader" => Ok(__FieldTag::__response_header),
10464                                "response_header" => Ok(__FieldTag::__response_header),
10465                                "maxAgeSeconds" => Ok(__FieldTag::__max_age_seconds),
10466                                "max_age_seconds" => Ok(__FieldTag::__max_age_seconds),
10467                                _ => Ok(__FieldTag::Unknown(value.to_string())),
10468                            }
10469                        }
10470                    }
10471                    deserializer.deserialize_identifier(Visitor)
10472                }
10473            }
10474            struct Visitor;
10475            impl<'de> serde::de::Visitor<'de> for Visitor {
10476                type Value = Cors;
10477                fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
10478                    formatter.write_str("struct Cors")
10479                }
10480                fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
10481                where
10482                    A: serde::de::MapAccess<'de>,
10483                {
10484                    #[allow(unused_imports)]
10485                    use serde::de::Error;
10486                    use std::option::Option::Some;
10487                    let mut fields = std::collections::HashSet::new();
10488                    let mut result = Self::Value::new();
10489                    while let Some(tag) = map.next_key::<__FieldTag>()? {
10490                        #[allow(clippy::match_single_binding)]
10491                        match tag {
10492                            __FieldTag::__origin => {
10493                                if !fields.insert(__FieldTag::__origin) {
10494                                    return std::result::Result::Err(A::Error::duplicate_field(
10495                                        "multiple values for origin",
10496                                    ));
10497                                }
10498                                result.origin = map.next_value::<std::option::Option<std::vec::Vec<std::string::String>>>()?.unwrap_or_default();
10499                            }
10500                            __FieldTag::__method => {
10501                                if !fields.insert(__FieldTag::__method) {
10502                                    return std::result::Result::Err(A::Error::duplicate_field(
10503                                        "multiple values for method",
10504                                    ));
10505                                }
10506                                result.method = map.next_value::<std::option::Option<std::vec::Vec<std::string::String>>>()?.unwrap_or_default();
10507                            }
10508                            __FieldTag::__response_header => {
10509                                if !fields.insert(__FieldTag::__response_header) {
10510                                    return std::result::Result::Err(A::Error::duplicate_field(
10511                                        "multiple values for response_header",
10512                                    ));
10513                                }
10514                                result.response_header = map.next_value::<std::option::Option<std::vec::Vec<std::string::String>>>()?.unwrap_or_default();
10515                            }
10516                            __FieldTag::__max_age_seconds => {
10517                                if !fields.insert(__FieldTag::__max_age_seconds) {
10518                                    return std::result::Result::Err(A::Error::duplicate_field(
10519                                        "multiple values for max_age_seconds",
10520                                    ));
10521                                }
10522                                struct __With(std::option::Option<i32>);
10523                                impl<'de> serde::de::Deserialize<'de> for __With {
10524                                    fn deserialize<D>(
10525                                        deserializer: D,
10526                                    ) -> std::result::Result<Self, D::Error>
10527                                    where
10528                                        D: serde::de::Deserializer<'de>,
10529                                    {
10530                                        serde_with::As::< std::option::Option<wkt::internal::I32> >::deserialize(deserializer).map(__With)
10531                                    }
10532                                }
10533                                result.max_age_seconds =
10534                                    map.next_value::<__With>()?.0.unwrap_or_default();
10535                            }
10536                            __FieldTag::Unknown(key) => {
10537                                let value = map.next_value::<serde_json::Value>()?;
10538                                result._unknown_fields.insert(key, value);
10539                            }
10540                        }
10541                    }
10542                    std::result::Result::Ok(result)
10543                }
10544            }
10545            deserializer.deserialize_any(Visitor)
10546        }
10547    }
10548
10549    #[doc(hidden)]
10550    impl serde::ser::Serialize for Cors {
10551        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
10552        where
10553            S: serde::ser::Serializer,
10554        {
10555            use serde::ser::SerializeMap;
10556            #[allow(unused_imports)]
10557            use std::option::Option::Some;
10558            let mut state = serializer.serialize_map(std::option::Option::None)?;
10559            if !self.origin.is_empty() {
10560                state.serialize_entry("origin", &self.origin)?;
10561            }
10562            if !self.method.is_empty() {
10563                state.serialize_entry("method", &self.method)?;
10564            }
10565            if !self.response_header.is_empty() {
10566                state.serialize_entry("responseHeader", &self.response_header)?;
10567            }
10568            if !wkt::internal::is_default(&self.max_age_seconds) {
10569                struct __With<'a>(&'a i32);
10570                impl<'a> serde::ser::Serialize for __With<'a> {
10571                    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
10572                    where
10573                        S: serde::ser::Serializer,
10574                    {
10575                        serde_with::As::<wkt::internal::I32>::serialize(self.0, serializer)
10576                    }
10577                }
10578                state.serialize_entry("maxAgeSeconds", &__With(&self.max_age_seconds))?;
10579            }
10580            if !self._unknown_fields.is_empty() {
10581                for (key, value) in self._unknown_fields.iter() {
10582                    state.serialize_entry(key, &value)?;
10583                }
10584            }
10585            state.end()
10586        }
10587    }
10588
10589    /// Encryption properties of a bucket.
10590    #[derive(Clone, Debug, Default, PartialEq)]
10591    #[non_exhaustive]
10592    pub struct Encryption {
10593        /// Optional. The name of the Cloud KMS key that will be used to encrypt
10594        /// objects inserted into this bucket, if no encryption method is specified.
10595        pub default_kms_key: std::string::String,
10596
10597        /// Optional. If omitted, then new objects with GMEK encryption-type is
10598        /// allowed. If set, then new objects created in this bucket must comply with
10599        /// enforcement config. Changing this has no effect on existing objects; it
10600        /// applies to new objects only.
10601        pub google_managed_encryption_enforcement_config: std::option::Option<
10602            crate::model::bucket::encryption::GoogleManagedEncryptionEnforcementConfig,
10603        >,
10604
10605        /// Optional. If omitted, then new objects with CMEK encryption-type is
10606        /// allowed. If set, then new objects created in this bucket must comply with
10607        /// enforcement config. Changing this has no effect on existing objects; it
10608        /// applies to new objects only.
10609        pub customer_managed_encryption_enforcement_config: std::option::Option<
10610            crate::model::bucket::encryption::CustomerManagedEncryptionEnforcementConfig,
10611        >,
10612
10613        /// Optional. If omitted, then new objects with CSEK encryption-type is
10614        /// allowed. If set, then new objects created in this bucket must comply with
10615        /// enforcement config. Changing this has no effect on existing objects; it
10616        /// applies to new objects only.
10617        pub customer_supplied_encryption_enforcement_config: std::option::Option<
10618            crate::model::bucket::encryption::CustomerSuppliedEncryptionEnforcementConfig,
10619        >,
10620
10621        _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
10622    }
10623
10624    impl Encryption {
10625        pub fn new() -> Self {
10626            std::default::Default::default()
10627        }
10628
10629        /// Sets the value of [default_kms_key][crate::model::bucket::Encryption::default_kms_key].
10630        pub fn set_default_kms_key<T: std::convert::Into<std::string::String>>(
10631            mut self,
10632            v: T,
10633        ) -> Self {
10634            self.default_kms_key = v.into();
10635            self
10636        }
10637
10638        /// Sets the value of [google_managed_encryption_enforcement_config][crate::model::bucket::Encryption::google_managed_encryption_enforcement_config].
10639        pub fn set_google_managed_encryption_enforcement_config<T>(mut self, v: T) -> Self
10640        where
10641            T: std::convert::Into<
10642                    crate::model::bucket::encryption::GoogleManagedEncryptionEnforcementConfig,
10643                >,
10644        {
10645            self.google_managed_encryption_enforcement_config = std::option::Option::Some(v.into());
10646            self
10647        }
10648
10649        /// Sets or clears the value of [google_managed_encryption_enforcement_config][crate::model::bucket::Encryption::google_managed_encryption_enforcement_config].
10650        pub fn set_or_clear_google_managed_encryption_enforcement_config<T>(
10651            mut self,
10652            v: std::option::Option<T>,
10653        ) -> Self
10654        where
10655            T: std::convert::Into<
10656                    crate::model::bucket::encryption::GoogleManagedEncryptionEnforcementConfig,
10657                >,
10658        {
10659            self.google_managed_encryption_enforcement_config = v.map(|x| x.into());
10660            self
10661        }
10662
10663        /// Sets the value of [customer_managed_encryption_enforcement_config][crate::model::bucket::Encryption::customer_managed_encryption_enforcement_config].
10664        pub fn set_customer_managed_encryption_enforcement_config<T>(mut self, v: T) -> Self
10665        where
10666            T: std::convert::Into<
10667                    crate::model::bucket::encryption::CustomerManagedEncryptionEnforcementConfig,
10668                >,
10669        {
10670            self.customer_managed_encryption_enforcement_config =
10671                std::option::Option::Some(v.into());
10672            self
10673        }
10674
10675        /// Sets or clears the value of [customer_managed_encryption_enforcement_config][crate::model::bucket::Encryption::customer_managed_encryption_enforcement_config].
10676        pub fn set_or_clear_customer_managed_encryption_enforcement_config<T>(
10677            mut self,
10678            v: std::option::Option<T>,
10679        ) -> Self
10680        where
10681            T: std::convert::Into<
10682                    crate::model::bucket::encryption::CustomerManagedEncryptionEnforcementConfig,
10683                >,
10684        {
10685            self.customer_managed_encryption_enforcement_config = v.map(|x| x.into());
10686            self
10687        }
10688
10689        /// Sets the value of [customer_supplied_encryption_enforcement_config][crate::model::bucket::Encryption::customer_supplied_encryption_enforcement_config].
10690        pub fn set_customer_supplied_encryption_enforcement_config<T>(mut self, v: T) -> Self
10691        where
10692            T: std::convert::Into<
10693                    crate::model::bucket::encryption::CustomerSuppliedEncryptionEnforcementConfig,
10694                >,
10695        {
10696            self.customer_supplied_encryption_enforcement_config =
10697                std::option::Option::Some(v.into());
10698            self
10699        }
10700
10701        /// Sets or clears the value of [customer_supplied_encryption_enforcement_config][crate::model::bucket::Encryption::customer_supplied_encryption_enforcement_config].
10702        pub fn set_or_clear_customer_supplied_encryption_enforcement_config<T>(
10703            mut self,
10704            v: std::option::Option<T>,
10705        ) -> Self
10706        where
10707            T: std::convert::Into<
10708                    crate::model::bucket::encryption::CustomerSuppliedEncryptionEnforcementConfig,
10709                >,
10710        {
10711            self.customer_supplied_encryption_enforcement_config = v.map(|x| x.into());
10712            self
10713        }
10714    }
10715
10716    impl wkt::message::Message for Encryption {
10717        fn typename() -> &'static str {
10718            "type.googleapis.com/google.storage.v2.Bucket.Encryption"
10719        }
10720    }
10721
10722    #[doc(hidden)]
10723    impl<'de> serde::de::Deserialize<'de> for Encryption {
10724        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
10725        where
10726            D: serde::Deserializer<'de>,
10727        {
10728            #[allow(non_camel_case_types)]
10729            #[doc(hidden)]
10730            #[derive(PartialEq, Eq, Hash)]
10731            enum __FieldTag {
10732                __default_kms_key,
10733                __google_managed_encryption_enforcement_config,
10734                __customer_managed_encryption_enforcement_config,
10735                __customer_supplied_encryption_enforcement_config,
10736                Unknown(std::string::String),
10737            }
10738            impl<'de> serde::de::Deserialize<'de> for __FieldTag {
10739                fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
10740                where
10741                    D: serde::Deserializer<'de>,
10742                {
10743                    struct Visitor;
10744                    impl<'de> serde::de::Visitor<'de> for Visitor {
10745                        type Value = __FieldTag;
10746                        fn expecting(
10747                            &self,
10748                            formatter: &mut std::fmt::Formatter,
10749                        ) -> std::fmt::Result {
10750                            formatter.write_str("a field name for Encryption")
10751                        }
10752                        fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
10753                        where
10754                            E: serde::de::Error,
10755                        {
10756                            use std::result::Result::Ok;
10757                            use std::string::ToString;
10758                            match value {
10759                                "defaultKmsKey" => Ok(__FieldTag::__default_kms_key),
10760                                "default_kms_key" => Ok(__FieldTag::__default_kms_key),
10761                                "googleManagedEncryptionEnforcementConfig" => {
10762                                    Ok(__FieldTag::__google_managed_encryption_enforcement_config)
10763                                }
10764                                "google_managed_encryption_enforcement_config" => {
10765                                    Ok(__FieldTag::__google_managed_encryption_enforcement_config)
10766                                }
10767                                "customerManagedEncryptionEnforcementConfig" => {
10768                                    Ok(__FieldTag::__customer_managed_encryption_enforcement_config)
10769                                }
10770                                "customer_managed_encryption_enforcement_config" => {
10771                                    Ok(__FieldTag::__customer_managed_encryption_enforcement_config)
10772                                }
10773                                "customerSuppliedEncryptionEnforcementConfig" => Ok(
10774                                    __FieldTag::__customer_supplied_encryption_enforcement_config,
10775                                ),
10776                                "customer_supplied_encryption_enforcement_config" => Ok(
10777                                    __FieldTag::__customer_supplied_encryption_enforcement_config,
10778                                ),
10779                                _ => Ok(__FieldTag::Unknown(value.to_string())),
10780                            }
10781                        }
10782                    }
10783                    deserializer.deserialize_identifier(Visitor)
10784                }
10785            }
10786            struct Visitor;
10787            impl<'de> serde::de::Visitor<'de> for Visitor {
10788                type Value = Encryption;
10789                fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
10790                    formatter.write_str("struct Encryption")
10791                }
10792                fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
10793                where
10794                    A: serde::de::MapAccess<'de>,
10795                {
10796                    #[allow(unused_imports)]
10797                    use serde::de::Error;
10798                    use std::option::Option::Some;
10799                    let mut fields = std::collections::HashSet::new();
10800                    let mut result = Self::Value::new();
10801                    while let Some(tag) = map.next_key::<__FieldTag>()? {
10802                        #[allow(clippy::match_single_binding)]
10803                        match tag {
10804                            __FieldTag::__default_kms_key => {
10805                                if !fields.insert(__FieldTag::__default_kms_key) {
10806                                    return std::result::Result::Err(A::Error::duplicate_field(
10807                                        "multiple values for default_kms_key",
10808                                    ));
10809                                }
10810                                result.default_kms_key = map
10811                                    .next_value::<std::option::Option<std::string::String>>()?
10812                                    .unwrap_or_default();
10813                            }
10814                            __FieldTag::__google_managed_encryption_enforcement_config => {
10815                                if !fields.insert(
10816                                    __FieldTag::__google_managed_encryption_enforcement_config,
10817                                ) {
10818                                    return std::result::Result::Err(A::Error::duplicate_field(
10819                                        "multiple values for google_managed_encryption_enforcement_config",
10820                                    ));
10821                                }
10822                                result.google_managed_encryption_enforcement_config = map.next_value::<std::option::Option<crate::model::bucket::encryption::GoogleManagedEncryptionEnforcementConfig>>()?
10823                                    ;
10824                            }
10825                            __FieldTag::__customer_managed_encryption_enforcement_config => {
10826                                if !fields.insert(
10827                                    __FieldTag::__customer_managed_encryption_enforcement_config,
10828                                ) {
10829                                    return std::result::Result::Err(A::Error::duplicate_field(
10830                                        "multiple values for customer_managed_encryption_enforcement_config",
10831                                    ));
10832                                }
10833                                result.customer_managed_encryption_enforcement_config = map.next_value::<std::option::Option<crate::model::bucket::encryption::CustomerManagedEncryptionEnforcementConfig>>()?
10834                                    ;
10835                            }
10836                            __FieldTag::__customer_supplied_encryption_enforcement_config => {
10837                                if !fields.insert(
10838                                    __FieldTag::__customer_supplied_encryption_enforcement_config,
10839                                ) {
10840                                    return std::result::Result::Err(A::Error::duplicate_field(
10841                                        "multiple values for customer_supplied_encryption_enforcement_config",
10842                                    ));
10843                                }
10844                                result.customer_supplied_encryption_enforcement_config = map.next_value::<std::option::Option<crate::model::bucket::encryption::CustomerSuppliedEncryptionEnforcementConfig>>()?
10845                                    ;
10846                            }
10847                            __FieldTag::Unknown(key) => {
10848                                let value = map.next_value::<serde_json::Value>()?;
10849                                result._unknown_fields.insert(key, value);
10850                            }
10851                        }
10852                    }
10853                    std::result::Result::Ok(result)
10854                }
10855            }
10856            deserializer.deserialize_any(Visitor)
10857        }
10858    }
10859
10860    #[doc(hidden)]
10861    impl serde::ser::Serialize for Encryption {
10862        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
10863        where
10864            S: serde::ser::Serializer,
10865        {
10866            use serde::ser::SerializeMap;
10867            #[allow(unused_imports)]
10868            use std::option::Option::Some;
10869            let mut state = serializer.serialize_map(std::option::Option::None)?;
10870            if !self.default_kms_key.is_empty() {
10871                state.serialize_entry("defaultKmsKey", &self.default_kms_key)?;
10872            }
10873            if self.google_managed_encryption_enforcement_config.is_some() {
10874                state.serialize_entry(
10875                    "googleManagedEncryptionEnforcementConfig",
10876                    &self.google_managed_encryption_enforcement_config,
10877                )?;
10878            }
10879            if self
10880                .customer_managed_encryption_enforcement_config
10881                .is_some()
10882            {
10883                state.serialize_entry(
10884                    "customerManagedEncryptionEnforcementConfig",
10885                    &self.customer_managed_encryption_enforcement_config,
10886                )?;
10887            }
10888            if self
10889                .customer_supplied_encryption_enforcement_config
10890                .is_some()
10891            {
10892                state.serialize_entry(
10893                    "customerSuppliedEncryptionEnforcementConfig",
10894                    &self.customer_supplied_encryption_enforcement_config,
10895                )?;
10896            }
10897            if !self._unknown_fields.is_empty() {
10898                for (key, value) in self._unknown_fields.iter() {
10899                    state.serialize_entry(key, &value)?;
10900                }
10901            }
10902            state.end()
10903        }
10904    }
10905
10906    /// Defines additional types related to [Encryption].
10907    pub mod encryption {
10908        #[allow(unused_imports)]
10909        use super::*;
10910
10911        /// Google Managed Encryption (GMEK) enforcement config of a bucket.
10912        #[derive(Clone, Debug, Default, PartialEq)]
10913        #[non_exhaustive]
10914        pub struct GoogleManagedEncryptionEnforcementConfig {
10915            /// Restriction mode for google-managed encryption for new objects within
10916            /// the bucket. Valid values are: "NotRestricted", "FullyRestricted".
10917            /// If `NotRestricted` or unset, creation of new objects with
10918            /// google-managed encryption is allowed.
10919            /// If `FullyRestricted`, new objects can't be created using google-managed
10920            /// encryption.
10921            pub restriction_mode: std::option::Option<std::string::String>,
10922
10923            /// Time from which the config was effective. This is service-provided.
10924            pub effective_time: std::option::Option<wkt::Timestamp>,
10925
10926            _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
10927        }
10928
10929        impl GoogleManagedEncryptionEnforcementConfig {
10930            pub fn new() -> Self {
10931                std::default::Default::default()
10932            }
10933
10934            /// Sets the value of [restriction_mode][crate::model::bucket::encryption::GoogleManagedEncryptionEnforcementConfig::restriction_mode].
10935            pub fn set_restriction_mode<T>(mut self, v: T) -> Self
10936            where
10937                T: std::convert::Into<std::string::String>,
10938            {
10939                self.restriction_mode = std::option::Option::Some(v.into());
10940                self
10941            }
10942
10943            /// Sets or clears the value of [restriction_mode][crate::model::bucket::encryption::GoogleManagedEncryptionEnforcementConfig::restriction_mode].
10944            pub fn set_or_clear_restriction_mode<T>(mut self, v: std::option::Option<T>) -> Self
10945            where
10946                T: std::convert::Into<std::string::String>,
10947            {
10948                self.restriction_mode = v.map(|x| x.into());
10949                self
10950            }
10951
10952            /// Sets the value of [effective_time][crate::model::bucket::encryption::GoogleManagedEncryptionEnforcementConfig::effective_time].
10953            pub fn set_effective_time<T>(mut self, v: T) -> Self
10954            where
10955                T: std::convert::Into<wkt::Timestamp>,
10956            {
10957                self.effective_time = std::option::Option::Some(v.into());
10958                self
10959            }
10960
10961            /// Sets or clears the value of [effective_time][crate::model::bucket::encryption::GoogleManagedEncryptionEnforcementConfig::effective_time].
10962            pub fn set_or_clear_effective_time<T>(mut self, v: std::option::Option<T>) -> Self
10963            where
10964                T: std::convert::Into<wkt::Timestamp>,
10965            {
10966                self.effective_time = v.map(|x| x.into());
10967                self
10968            }
10969        }
10970
10971        impl wkt::message::Message for GoogleManagedEncryptionEnforcementConfig {
10972            fn typename() -> &'static str {
10973                "type.googleapis.com/google.storage.v2.Bucket.Encryption.GoogleManagedEncryptionEnforcementConfig"
10974            }
10975        }
10976
10977        #[doc(hidden)]
10978        impl<'de> serde::de::Deserialize<'de> for GoogleManagedEncryptionEnforcementConfig {
10979            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
10980            where
10981                D: serde::Deserializer<'de>,
10982            {
10983                #[allow(non_camel_case_types)]
10984                #[doc(hidden)]
10985                #[derive(PartialEq, Eq, Hash)]
10986                enum __FieldTag {
10987                    __restriction_mode,
10988                    __effective_time,
10989                    Unknown(std::string::String),
10990                }
10991                impl<'de> serde::de::Deserialize<'de> for __FieldTag {
10992                    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
10993                    where
10994                        D: serde::Deserializer<'de>,
10995                    {
10996                        struct Visitor;
10997                        impl<'de> serde::de::Visitor<'de> for Visitor {
10998                            type Value = __FieldTag;
10999                            fn expecting(
11000                                &self,
11001                                formatter: &mut std::fmt::Formatter,
11002                            ) -> std::fmt::Result {
11003                                formatter.write_str(
11004                                    "a field name for GoogleManagedEncryptionEnforcementConfig",
11005                                )
11006                            }
11007                            fn visit_str<E>(
11008                                self,
11009                                value: &str,
11010                            ) -> std::result::Result<Self::Value, E>
11011                            where
11012                                E: serde::de::Error,
11013                            {
11014                                use std::result::Result::Ok;
11015                                use std::string::ToString;
11016                                match value {
11017                                    "restrictionMode" => Ok(__FieldTag::__restriction_mode),
11018                                    "restriction_mode" => Ok(__FieldTag::__restriction_mode),
11019                                    "effectiveTime" => Ok(__FieldTag::__effective_time),
11020                                    "effective_time" => Ok(__FieldTag::__effective_time),
11021                                    _ => Ok(__FieldTag::Unknown(value.to_string())),
11022                                }
11023                            }
11024                        }
11025                        deserializer.deserialize_identifier(Visitor)
11026                    }
11027                }
11028                struct Visitor;
11029                impl<'de> serde::de::Visitor<'de> for Visitor {
11030                    type Value = GoogleManagedEncryptionEnforcementConfig;
11031                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
11032                        formatter.write_str("struct GoogleManagedEncryptionEnforcementConfig")
11033                    }
11034                    fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
11035                    where
11036                        A: serde::de::MapAccess<'de>,
11037                    {
11038                        #[allow(unused_imports)]
11039                        use serde::de::Error;
11040                        use std::option::Option::Some;
11041                        let mut fields = std::collections::HashSet::new();
11042                        let mut result = Self::Value::new();
11043                        while let Some(tag) = map.next_key::<__FieldTag>()? {
11044                            #[allow(clippy::match_single_binding)]
11045                            match tag {
11046                                __FieldTag::__restriction_mode => {
11047                                    if !fields.insert(__FieldTag::__restriction_mode) {
11048                                        return std::result::Result::Err(
11049                                            A::Error::duplicate_field(
11050                                                "multiple values for restriction_mode",
11051                                            ),
11052                                        );
11053                                    }
11054                                    result.restriction_mode = map
11055                                        .next_value::<std::option::Option<std::string::String>>()?;
11056                                }
11057                                __FieldTag::__effective_time => {
11058                                    if !fields.insert(__FieldTag::__effective_time) {
11059                                        return std::result::Result::Err(
11060                                            A::Error::duplicate_field(
11061                                                "multiple values for effective_time",
11062                                            ),
11063                                        );
11064                                    }
11065                                    result.effective_time =
11066                                        map.next_value::<std::option::Option<wkt::Timestamp>>()?;
11067                                }
11068                                __FieldTag::Unknown(key) => {
11069                                    let value = map.next_value::<serde_json::Value>()?;
11070                                    result._unknown_fields.insert(key, value);
11071                                }
11072                            }
11073                        }
11074                        std::result::Result::Ok(result)
11075                    }
11076                }
11077                deserializer.deserialize_any(Visitor)
11078            }
11079        }
11080
11081        #[doc(hidden)]
11082        impl serde::ser::Serialize for GoogleManagedEncryptionEnforcementConfig {
11083            fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
11084            where
11085                S: serde::ser::Serializer,
11086            {
11087                use serde::ser::SerializeMap;
11088                #[allow(unused_imports)]
11089                use std::option::Option::Some;
11090                let mut state = serializer.serialize_map(std::option::Option::None)?;
11091                if self.restriction_mode.is_some() {
11092                    state.serialize_entry("restrictionMode", &self.restriction_mode)?;
11093                }
11094                if self.effective_time.is_some() {
11095                    state.serialize_entry("effectiveTime", &self.effective_time)?;
11096                }
11097                if !self._unknown_fields.is_empty() {
11098                    for (key, value) in self._unknown_fields.iter() {
11099                        state.serialize_entry(key, &value)?;
11100                    }
11101                }
11102                state.end()
11103            }
11104        }
11105
11106        /// Customer Managed Encryption (CMEK) enforcement config of a bucket.
11107        #[derive(Clone, Debug, Default, PartialEq)]
11108        #[non_exhaustive]
11109        pub struct CustomerManagedEncryptionEnforcementConfig {
11110            /// Restriction mode for customer-managed encryption for new objects within
11111            /// the bucket. Valid values are: "NotRestricted", "FullyRestricted".
11112            /// If `NotRestricted` or unset, creation of new objects with
11113            /// customer-managed encryption is allowed.
11114            /// If `FullyRestricted`, new objects can't be created using
11115            /// customer-managed encryption.
11116            pub restriction_mode: std::option::Option<std::string::String>,
11117
11118            /// Time from which the config was effective. This is service-provided.
11119            pub effective_time: std::option::Option<wkt::Timestamp>,
11120
11121            _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
11122        }
11123
11124        impl CustomerManagedEncryptionEnforcementConfig {
11125            pub fn new() -> Self {
11126                std::default::Default::default()
11127            }
11128
11129            /// Sets the value of [restriction_mode][crate::model::bucket::encryption::CustomerManagedEncryptionEnforcementConfig::restriction_mode].
11130            pub fn set_restriction_mode<T>(mut self, v: T) -> Self
11131            where
11132                T: std::convert::Into<std::string::String>,
11133            {
11134                self.restriction_mode = std::option::Option::Some(v.into());
11135                self
11136            }
11137
11138            /// Sets or clears the value of [restriction_mode][crate::model::bucket::encryption::CustomerManagedEncryptionEnforcementConfig::restriction_mode].
11139            pub fn set_or_clear_restriction_mode<T>(mut self, v: std::option::Option<T>) -> Self
11140            where
11141                T: std::convert::Into<std::string::String>,
11142            {
11143                self.restriction_mode = v.map(|x| x.into());
11144                self
11145            }
11146
11147            /// Sets the value of [effective_time][crate::model::bucket::encryption::CustomerManagedEncryptionEnforcementConfig::effective_time].
11148            pub fn set_effective_time<T>(mut self, v: T) -> Self
11149            where
11150                T: std::convert::Into<wkt::Timestamp>,
11151            {
11152                self.effective_time = std::option::Option::Some(v.into());
11153                self
11154            }
11155
11156            /// Sets or clears the value of [effective_time][crate::model::bucket::encryption::CustomerManagedEncryptionEnforcementConfig::effective_time].
11157            pub fn set_or_clear_effective_time<T>(mut self, v: std::option::Option<T>) -> Self
11158            where
11159                T: std::convert::Into<wkt::Timestamp>,
11160            {
11161                self.effective_time = v.map(|x| x.into());
11162                self
11163            }
11164        }
11165
11166        impl wkt::message::Message for CustomerManagedEncryptionEnforcementConfig {
11167            fn typename() -> &'static str {
11168                "type.googleapis.com/google.storage.v2.Bucket.Encryption.CustomerManagedEncryptionEnforcementConfig"
11169            }
11170        }
11171
11172        #[doc(hidden)]
11173        impl<'de> serde::de::Deserialize<'de> for CustomerManagedEncryptionEnforcementConfig {
11174            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
11175            where
11176                D: serde::Deserializer<'de>,
11177            {
11178                #[allow(non_camel_case_types)]
11179                #[doc(hidden)]
11180                #[derive(PartialEq, Eq, Hash)]
11181                enum __FieldTag {
11182                    __restriction_mode,
11183                    __effective_time,
11184                    Unknown(std::string::String),
11185                }
11186                impl<'de> serde::de::Deserialize<'de> for __FieldTag {
11187                    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
11188                    where
11189                        D: serde::Deserializer<'de>,
11190                    {
11191                        struct Visitor;
11192                        impl<'de> serde::de::Visitor<'de> for Visitor {
11193                            type Value = __FieldTag;
11194                            fn expecting(
11195                                &self,
11196                                formatter: &mut std::fmt::Formatter,
11197                            ) -> std::fmt::Result {
11198                                formatter.write_str(
11199                                    "a field name for CustomerManagedEncryptionEnforcementConfig",
11200                                )
11201                            }
11202                            fn visit_str<E>(
11203                                self,
11204                                value: &str,
11205                            ) -> std::result::Result<Self::Value, E>
11206                            where
11207                                E: serde::de::Error,
11208                            {
11209                                use std::result::Result::Ok;
11210                                use std::string::ToString;
11211                                match value {
11212                                    "restrictionMode" => Ok(__FieldTag::__restriction_mode),
11213                                    "restriction_mode" => Ok(__FieldTag::__restriction_mode),
11214                                    "effectiveTime" => Ok(__FieldTag::__effective_time),
11215                                    "effective_time" => Ok(__FieldTag::__effective_time),
11216                                    _ => Ok(__FieldTag::Unknown(value.to_string())),
11217                                }
11218                            }
11219                        }
11220                        deserializer.deserialize_identifier(Visitor)
11221                    }
11222                }
11223                struct Visitor;
11224                impl<'de> serde::de::Visitor<'de> for Visitor {
11225                    type Value = CustomerManagedEncryptionEnforcementConfig;
11226                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
11227                        formatter.write_str("struct CustomerManagedEncryptionEnforcementConfig")
11228                    }
11229                    fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
11230                    where
11231                        A: serde::de::MapAccess<'de>,
11232                    {
11233                        #[allow(unused_imports)]
11234                        use serde::de::Error;
11235                        use std::option::Option::Some;
11236                        let mut fields = std::collections::HashSet::new();
11237                        let mut result = Self::Value::new();
11238                        while let Some(tag) = map.next_key::<__FieldTag>()? {
11239                            #[allow(clippy::match_single_binding)]
11240                            match tag {
11241                                __FieldTag::__restriction_mode => {
11242                                    if !fields.insert(__FieldTag::__restriction_mode) {
11243                                        return std::result::Result::Err(
11244                                            A::Error::duplicate_field(
11245                                                "multiple values for restriction_mode",
11246                                            ),
11247                                        );
11248                                    }
11249                                    result.restriction_mode = map
11250                                        .next_value::<std::option::Option<std::string::String>>()?;
11251                                }
11252                                __FieldTag::__effective_time => {
11253                                    if !fields.insert(__FieldTag::__effective_time) {
11254                                        return std::result::Result::Err(
11255                                            A::Error::duplicate_field(
11256                                                "multiple values for effective_time",
11257                                            ),
11258                                        );
11259                                    }
11260                                    result.effective_time =
11261                                        map.next_value::<std::option::Option<wkt::Timestamp>>()?;
11262                                }
11263                                __FieldTag::Unknown(key) => {
11264                                    let value = map.next_value::<serde_json::Value>()?;
11265                                    result._unknown_fields.insert(key, value);
11266                                }
11267                            }
11268                        }
11269                        std::result::Result::Ok(result)
11270                    }
11271                }
11272                deserializer.deserialize_any(Visitor)
11273            }
11274        }
11275
11276        #[doc(hidden)]
11277        impl serde::ser::Serialize for CustomerManagedEncryptionEnforcementConfig {
11278            fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
11279            where
11280                S: serde::ser::Serializer,
11281            {
11282                use serde::ser::SerializeMap;
11283                #[allow(unused_imports)]
11284                use std::option::Option::Some;
11285                let mut state = serializer.serialize_map(std::option::Option::None)?;
11286                if self.restriction_mode.is_some() {
11287                    state.serialize_entry("restrictionMode", &self.restriction_mode)?;
11288                }
11289                if self.effective_time.is_some() {
11290                    state.serialize_entry("effectiveTime", &self.effective_time)?;
11291                }
11292                if !self._unknown_fields.is_empty() {
11293                    for (key, value) in self._unknown_fields.iter() {
11294                        state.serialize_entry(key, &value)?;
11295                    }
11296                }
11297                state.end()
11298            }
11299        }
11300
11301        /// Customer Supplied Encryption (CSEK) enforcement config of a bucket.
11302        #[derive(Clone, Debug, Default, PartialEq)]
11303        #[non_exhaustive]
11304        pub struct CustomerSuppliedEncryptionEnforcementConfig {
11305            /// Restriction mode for customer-supplied encryption for new objects
11306            /// within the bucket. Valid values are: "NotRestricted",
11307            /// "FullyRestricted".
11308            /// If `NotRestricted` or unset, creation of new objects with
11309            /// customer-supplied encryption is allowed.
11310            /// If `FullyRestricted`, new objects can't be created using
11311            /// customer-supplied encryption.
11312            pub restriction_mode: std::option::Option<std::string::String>,
11313
11314            /// Time from which the config was effective. This is service-provided.
11315            pub effective_time: std::option::Option<wkt::Timestamp>,
11316
11317            _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
11318        }
11319
11320        impl CustomerSuppliedEncryptionEnforcementConfig {
11321            pub fn new() -> Self {
11322                std::default::Default::default()
11323            }
11324
11325            /// Sets the value of [restriction_mode][crate::model::bucket::encryption::CustomerSuppliedEncryptionEnforcementConfig::restriction_mode].
11326            pub fn set_restriction_mode<T>(mut self, v: T) -> Self
11327            where
11328                T: std::convert::Into<std::string::String>,
11329            {
11330                self.restriction_mode = std::option::Option::Some(v.into());
11331                self
11332            }
11333
11334            /// Sets or clears the value of [restriction_mode][crate::model::bucket::encryption::CustomerSuppliedEncryptionEnforcementConfig::restriction_mode].
11335            pub fn set_or_clear_restriction_mode<T>(mut self, v: std::option::Option<T>) -> Self
11336            where
11337                T: std::convert::Into<std::string::String>,
11338            {
11339                self.restriction_mode = v.map(|x| x.into());
11340                self
11341            }
11342
11343            /// Sets the value of [effective_time][crate::model::bucket::encryption::CustomerSuppliedEncryptionEnforcementConfig::effective_time].
11344            pub fn set_effective_time<T>(mut self, v: T) -> Self
11345            where
11346                T: std::convert::Into<wkt::Timestamp>,
11347            {
11348                self.effective_time = std::option::Option::Some(v.into());
11349                self
11350            }
11351
11352            /// Sets or clears the value of [effective_time][crate::model::bucket::encryption::CustomerSuppliedEncryptionEnforcementConfig::effective_time].
11353            pub fn set_or_clear_effective_time<T>(mut self, v: std::option::Option<T>) -> Self
11354            where
11355                T: std::convert::Into<wkt::Timestamp>,
11356            {
11357                self.effective_time = v.map(|x| x.into());
11358                self
11359            }
11360        }
11361
11362        impl wkt::message::Message for CustomerSuppliedEncryptionEnforcementConfig {
11363            fn typename() -> &'static str {
11364                "type.googleapis.com/google.storage.v2.Bucket.Encryption.CustomerSuppliedEncryptionEnforcementConfig"
11365            }
11366        }
11367
11368        #[doc(hidden)]
11369        impl<'de> serde::de::Deserialize<'de> for CustomerSuppliedEncryptionEnforcementConfig {
11370            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
11371            where
11372                D: serde::Deserializer<'de>,
11373            {
11374                #[allow(non_camel_case_types)]
11375                #[doc(hidden)]
11376                #[derive(PartialEq, Eq, Hash)]
11377                enum __FieldTag {
11378                    __restriction_mode,
11379                    __effective_time,
11380                    Unknown(std::string::String),
11381                }
11382                impl<'de> serde::de::Deserialize<'de> for __FieldTag {
11383                    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
11384                    where
11385                        D: serde::Deserializer<'de>,
11386                    {
11387                        struct Visitor;
11388                        impl<'de> serde::de::Visitor<'de> for Visitor {
11389                            type Value = __FieldTag;
11390                            fn expecting(
11391                                &self,
11392                                formatter: &mut std::fmt::Formatter,
11393                            ) -> std::fmt::Result {
11394                                formatter.write_str(
11395                                    "a field name for CustomerSuppliedEncryptionEnforcementConfig",
11396                                )
11397                            }
11398                            fn visit_str<E>(
11399                                self,
11400                                value: &str,
11401                            ) -> std::result::Result<Self::Value, E>
11402                            where
11403                                E: serde::de::Error,
11404                            {
11405                                use std::result::Result::Ok;
11406                                use std::string::ToString;
11407                                match value {
11408                                    "restrictionMode" => Ok(__FieldTag::__restriction_mode),
11409                                    "restriction_mode" => Ok(__FieldTag::__restriction_mode),
11410                                    "effectiveTime" => Ok(__FieldTag::__effective_time),
11411                                    "effective_time" => Ok(__FieldTag::__effective_time),
11412                                    _ => Ok(__FieldTag::Unknown(value.to_string())),
11413                                }
11414                            }
11415                        }
11416                        deserializer.deserialize_identifier(Visitor)
11417                    }
11418                }
11419                struct Visitor;
11420                impl<'de> serde::de::Visitor<'de> for Visitor {
11421                    type Value = CustomerSuppliedEncryptionEnforcementConfig;
11422                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
11423                        formatter.write_str("struct CustomerSuppliedEncryptionEnforcementConfig")
11424                    }
11425                    fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
11426                    where
11427                        A: serde::de::MapAccess<'de>,
11428                    {
11429                        #[allow(unused_imports)]
11430                        use serde::de::Error;
11431                        use std::option::Option::Some;
11432                        let mut fields = std::collections::HashSet::new();
11433                        let mut result = Self::Value::new();
11434                        while let Some(tag) = map.next_key::<__FieldTag>()? {
11435                            #[allow(clippy::match_single_binding)]
11436                            match tag {
11437                                __FieldTag::__restriction_mode => {
11438                                    if !fields.insert(__FieldTag::__restriction_mode) {
11439                                        return std::result::Result::Err(
11440                                            A::Error::duplicate_field(
11441                                                "multiple values for restriction_mode",
11442                                            ),
11443                                        );
11444                                    }
11445                                    result.restriction_mode = map
11446                                        .next_value::<std::option::Option<std::string::String>>()?;
11447                                }
11448                                __FieldTag::__effective_time => {
11449                                    if !fields.insert(__FieldTag::__effective_time) {
11450                                        return std::result::Result::Err(
11451                                            A::Error::duplicate_field(
11452                                                "multiple values for effective_time",
11453                                            ),
11454                                        );
11455                                    }
11456                                    result.effective_time =
11457                                        map.next_value::<std::option::Option<wkt::Timestamp>>()?;
11458                                }
11459                                __FieldTag::Unknown(key) => {
11460                                    let value = map.next_value::<serde_json::Value>()?;
11461                                    result._unknown_fields.insert(key, value);
11462                                }
11463                            }
11464                        }
11465                        std::result::Result::Ok(result)
11466                    }
11467                }
11468                deserializer.deserialize_any(Visitor)
11469            }
11470        }
11471
11472        #[doc(hidden)]
11473        impl serde::ser::Serialize for CustomerSuppliedEncryptionEnforcementConfig {
11474            fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
11475            where
11476                S: serde::ser::Serializer,
11477            {
11478                use serde::ser::SerializeMap;
11479                #[allow(unused_imports)]
11480                use std::option::Option::Some;
11481                let mut state = serializer.serialize_map(std::option::Option::None)?;
11482                if self.restriction_mode.is_some() {
11483                    state.serialize_entry("restrictionMode", &self.restriction_mode)?;
11484                }
11485                if self.effective_time.is_some() {
11486                    state.serialize_entry("effectiveTime", &self.effective_time)?;
11487                }
11488                if !self._unknown_fields.is_empty() {
11489                    for (key, value) in self._unknown_fields.iter() {
11490                        state.serialize_entry(key, &value)?;
11491                    }
11492                }
11493                state.end()
11494            }
11495        }
11496    }
11497
11498    /// Bucket restriction options.
11499    #[derive(Clone, Debug, Default, PartialEq)]
11500    #[non_exhaustive]
11501    pub struct IamConfig {
11502        /// Optional. Bucket restriction options currently enforced on the bucket.
11503        pub uniform_bucket_level_access:
11504            std::option::Option<crate::model::bucket::iam_config::UniformBucketLevelAccess>,
11505
11506        /// Optional. Whether IAM will enforce public access prevention. Valid values
11507        /// are "enforced" or "inherited".
11508        pub public_access_prevention: std::string::String,
11509
11510        _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
11511    }
11512
11513    impl IamConfig {
11514        pub fn new() -> Self {
11515            std::default::Default::default()
11516        }
11517
11518        /// Sets the value of [uniform_bucket_level_access][crate::model::bucket::IamConfig::uniform_bucket_level_access].
11519        pub fn set_uniform_bucket_level_access<T>(mut self, v: T) -> Self
11520        where
11521            T: std::convert::Into<crate::model::bucket::iam_config::UniformBucketLevelAccess>,
11522        {
11523            self.uniform_bucket_level_access = std::option::Option::Some(v.into());
11524            self
11525        }
11526
11527        /// Sets or clears the value of [uniform_bucket_level_access][crate::model::bucket::IamConfig::uniform_bucket_level_access].
11528        pub fn set_or_clear_uniform_bucket_level_access<T>(
11529            mut self,
11530            v: std::option::Option<T>,
11531        ) -> Self
11532        where
11533            T: std::convert::Into<crate::model::bucket::iam_config::UniformBucketLevelAccess>,
11534        {
11535            self.uniform_bucket_level_access = v.map(|x| x.into());
11536            self
11537        }
11538
11539        /// Sets the value of [public_access_prevention][crate::model::bucket::IamConfig::public_access_prevention].
11540        pub fn set_public_access_prevention<T: std::convert::Into<std::string::String>>(
11541            mut self,
11542            v: T,
11543        ) -> Self {
11544            self.public_access_prevention = v.into();
11545            self
11546        }
11547    }
11548
11549    impl wkt::message::Message for IamConfig {
11550        fn typename() -> &'static str {
11551            "type.googleapis.com/google.storage.v2.Bucket.IamConfig"
11552        }
11553    }
11554
11555    #[doc(hidden)]
11556    impl<'de> serde::de::Deserialize<'de> for IamConfig {
11557        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
11558        where
11559            D: serde::Deserializer<'de>,
11560        {
11561            #[allow(non_camel_case_types)]
11562            #[doc(hidden)]
11563            #[derive(PartialEq, Eq, Hash)]
11564            enum __FieldTag {
11565                __uniform_bucket_level_access,
11566                __public_access_prevention,
11567                Unknown(std::string::String),
11568            }
11569            impl<'de> serde::de::Deserialize<'de> for __FieldTag {
11570                fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
11571                where
11572                    D: serde::Deserializer<'de>,
11573                {
11574                    struct Visitor;
11575                    impl<'de> serde::de::Visitor<'de> for Visitor {
11576                        type Value = __FieldTag;
11577                        fn expecting(
11578                            &self,
11579                            formatter: &mut std::fmt::Formatter,
11580                        ) -> std::fmt::Result {
11581                            formatter.write_str("a field name for IamConfig")
11582                        }
11583                        fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
11584                        where
11585                            E: serde::de::Error,
11586                        {
11587                            use std::result::Result::Ok;
11588                            use std::string::ToString;
11589                            match value {
11590                                "uniformBucketLevelAccess" => {
11591                                    Ok(__FieldTag::__uniform_bucket_level_access)
11592                                }
11593                                "uniform_bucket_level_access" => {
11594                                    Ok(__FieldTag::__uniform_bucket_level_access)
11595                                }
11596                                "publicAccessPrevention" => {
11597                                    Ok(__FieldTag::__public_access_prevention)
11598                                }
11599                                "public_access_prevention" => {
11600                                    Ok(__FieldTag::__public_access_prevention)
11601                                }
11602                                _ => Ok(__FieldTag::Unknown(value.to_string())),
11603                            }
11604                        }
11605                    }
11606                    deserializer.deserialize_identifier(Visitor)
11607                }
11608            }
11609            struct Visitor;
11610            impl<'de> serde::de::Visitor<'de> for Visitor {
11611                type Value = IamConfig;
11612                fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
11613                    formatter.write_str("struct IamConfig")
11614                }
11615                fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
11616                where
11617                    A: serde::de::MapAccess<'de>,
11618                {
11619                    #[allow(unused_imports)]
11620                    use serde::de::Error;
11621                    use std::option::Option::Some;
11622                    let mut fields = std::collections::HashSet::new();
11623                    let mut result = Self::Value::new();
11624                    while let Some(tag) = map.next_key::<__FieldTag>()? {
11625                        #[allow(clippy::match_single_binding)]
11626                        match tag {
11627                            __FieldTag::__uniform_bucket_level_access => {
11628                                if !fields.insert(__FieldTag::__uniform_bucket_level_access) {
11629                                    return std::result::Result::Err(A::Error::duplicate_field(
11630                                        "multiple values for uniform_bucket_level_access",
11631                                    ));
11632                                }
11633                                result.uniform_bucket_level_access = map
11634                                    .next_value::<std::option::Option<
11635                                        crate::model::bucket::iam_config::UniformBucketLevelAccess,
11636                                    >>()?;
11637                            }
11638                            __FieldTag::__public_access_prevention => {
11639                                if !fields.insert(__FieldTag::__public_access_prevention) {
11640                                    return std::result::Result::Err(A::Error::duplicate_field(
11641                                        "multiple values for public_access_prevention",
11642                                    ));
11643                                }
11644                                result.public_access_prevention = map
11645                                    .next_value::<std::option::Option<std::string::String>>()?
11646                                    .unwrap_or_default();
11647                            }
11648                            __FieldTag::Unknown(key) => {
11649                                let value = map.next_value::<serde_json::Value>()?;
11650                                result._unknown_fields.insert(key, value);
11651                            }
11652                        }
11653                    }
11654                    std::result::Result::Ok(result)
11655                }
11656            }
11657            deserializer.deserialize_any(Visitor)
11658        }
11659    }
11660
11661    #[doc(hidden)]
11662    impl serde::ser::Serialize for IamConfig {
11663        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
11664        where
11665            S: serde::ser::Serializer,
11666        {
11667            use serde::ser::SerializeMap;
11668            #[allow(unused_imports)]
11669            use std::option::Option::Some;
11670            let mut state = serializer.serialize_map(std::option::Option::None)?;
11671            if self.uniform_bucket_level_access.is_some() {
11672                state.serialize_entry(
11673                    "uniformBucketLevelAccess",
11674                    &self.uniform_bucket_level_access,
11675                )?;
11676            }
11677            if !self.public_access_prevention.is_empty() {
11678                state.serialize_entry("publicAccessPrevention", &self.public_access_prevention)?;
11679            }
11680            if !self._unknown_fields.is_empty() {
11681                for (key, value) in self._unknown_fields.iter() {
11682                    state.serialize_entry(key, &value)?;
11683                }
11684            }
11685            state.end()
11686        }
11687    }
11688
11689    /// Defines additional types related to [IamConfig].
11690    pub mod iam_config {
11691        #[allow(unused_imports)]
11692        use super::*;
11693
11694        /// Settings for Uniform Bucket level access.
11695        /// See <https://cloud.google.com/storage/docs/uniform-bucket-level-access>.
11696        #[derive(Clone, Debug, Default, PartialEq)]
11697        #[non_exhaustive]
11698        pub struct UniformBucketLevelAccess {
11699            /// Optional. If set, access checks only use bucket-level IAM policies or
11700            /// above.
11701            pub enabled: bool,
11702
11703            /// Optional. The deadline time for changing
11704            /// `iam_config.uniform_bucket_level_access.enabled` from `true` to
11705            /// `false`. Mutable until the specified deadline is reached, but not
11706            /// afterward.
11707            pub lock_time: std::option::Option<wkt::Timestamp>,
11708
11709            _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
11710        }
11711
11712        impl UniformBucketLevelAccess {
11713            pub fn new() -> Self {
11714                std::default::Default::default()
11715            }
11716
11717            /// Sets the value of [enabled][crate::model::bucket::iam_config::UniformBucketLevelAccess::enabled].
11718            pub fn set_enabled<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
11719                self.enabled = v.into();
11720                self
11721            }
11722
11723            /// Sets the value of [lock_time][crate::model::bucket::iam_config::UniformBucketLevelAccess::lock_time].
11724            pub fn set_lock_time<T>(mut self, v: T) -> Self
11725            where
11726                T: std::convert::Into<wkt::Timestamp>,
11727            {
11728                self.lock_time = std::option::Option::Some(v.into());
11729                self
11730            }
11731
11732            /// Sets or clears the value of [lock_time][crate::model::bucket::iam_config::UniformBucketLevelAccess::lock_time].
11733            pub fn set_or_clear_lock_time<T>(mut self, v: std::option::Option<T>) -> Self
11734            where
11735                T: std::convert::Into<wkt::Timestamp>,
11736            {
11737                self.lock_time = v.map(|x| x.into());
11738                self
11739            }
11740        }
11741
11742        impl wkt::message::Message for UniformBucketLevelAccess {
11743            fn typename() -> &'static str {
11744                "type.googleapis.com/google.storage.v2.Bucket.IamConfig.UniformBucketLevelAccess"
11745            }
11746        }
11747
11748        #[doc(hidden)]
11749        impl<'de> serde::de::Deserialize<'de> for UniformBucketLevelAccess {
11750            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
11751            where
11752                D: serde::Deserializer<'de>,
11753            {
11754                #[allow(non_camel_case_types)]
11755                #[doc(hidden)]
11756                #[derive(PartialEq, Eq, Hash)]
11757                enum __FieldTag {
11758                    __enabled,
11759                    __lock_time,
11760                    Unknown(std::string::String),
11761                }
11762                impl<'de> serde::de::Deserialize<'de> for __FieldTag {
11763                    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
11764                    where
11765                        D: serde::Deserializer<'de>,
11766                    {
11767                        struct Visitor;
11768                        impl<'de> serde::de::Visitor<'de> for Visitor {
11769                            type Value = __FieldTag;
11770                            fn expecting(
11771                                &self,
11772                                formatter: &mut std::fmt::Formatter,
11773                            ) -> std::fmt::Result {
11774                                formatter.write_str("a field name for UniformBucketLevelAccess")
11775                            }
11776                            fn visit_str<E>(
11777                                self,
11778                                value: &str,
11779                            ) -> std::result::Result<Self::Value, E>
11780                            where
11781                                E: serde::de::Error,
11782                            {
11783                                use std::result::Result::Ok;
11784                                use std::string::ToString;
11785                                match value {
11786                                    "enabled" => Ok(__FieldTag::__enabled),
11787                                    "lockTime" => Ok(__FieldTag::__lock_time),
11788                                    "lock_time" => Ok(__FieldTag::__lock_time),
11789                                    _ => Ok(__FieldTag::Unknown(value.to_string())),
11790                                }
11791                            }
11792                        }
11793                        deserializer.deserialize_identifier(Visitor)
11794                    }
11795                }
11796                struct Visitor;
11797                impl<'de> serde::de::Visitor<'de> for Visitor {
11798                    type Value = UniformBucketLevelAccess;
11799                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
11800                        formatter.write_str("struct UniformBucketLevelAccess")
11801                    }
11802                    fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
11803                    where
11804                        A: serde::de::MapAccess<'de>,
11805                    {
11806                        #[allow(unused_imports)]
11807                        use serde::de::Error;
11808                        use std::option::Option::Some;
11809                        let mut fields = std::collections::HashSet::new();
11810                        let mut result = Self::Value::new();
11811                        while let Some(tag) = map.next_key::<__FieldTag>()? {
11812                            #[allow(clippy::match_single_binding)]
11813                            match tag {
11814                                __FieldTag::__enabled => {
11815                                    if !fields.insert(__FieldTag::__enabled) {
11816                                        return std::result::Result::Err(
11817                                            A::Error::duplicate_field(
11818                                                "multiple values for enabled",
11819                                            ),
11820                                        );
11821                                    }
11822                                    result.enabled = map
11823                                        .next_value::<std::option::Option<bool>>()?
11824                                        .unwrap_or_default();
11825                                }
11826                                __FieldTag::__lock_time => {
11827                                    if !fields.insert(__FieldTag::__lock_time) {
11828                                        return std::result::Result::Err(
11829                                            A::Error::duplicate_field(
11830                                                "multiple values for lock_time",
11831                                            ),
11832                                        );
11833                                    }
11834                                    result.lock_time =
11835                                        map.next_value::<std::option::Option<wkt::Timestamp>>()?;
11836                                }
11837                                __FieldTag::Unknown(key) => {
11838                                    let value = map.next_value::<serde_json::Value>()?;
11839                                    result._unknown_fields.insert(key, value);
11840                                }
11841                            }
11842                        }
11843                        std::result::Result::Ok(result)
11844                    }
11845                }
11846                deserializer.deserialize_any(Visitor)
11847            }
11848        }
11849
11850        #[doc(hidden)]
11851        impl serde::ser::Serialize for UniformBucketLevelAccess {
11852            fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
11853            where
11854                S: serde::ser::Serializer,
11855            {
11856                use serde::ser::SerializeMap;
11857                #[allow(unused_imports)]
11858                use std::option::Option::Some;
11859                let mut state = serializer.serialize_map(std::option::Option::None)?;
11860                if !wkt::internal::is_default(&self.enabled) {
11861                    state.serialize_entry("enabled", &self.enabled)?;
11862                }
11863                if self.lock_time.is_some() {
11864                    state.serialize_entry("lockTime", &self.lock_time)?;
11865                }
11866                if !self._unknown_fields.is_empty() {
11867                    for (key, value) in self._unknown_fields.iter() {
11868                        state.serialize_entry(key, &value)?;
11869                    }
11870                }
11871                state.end()
11872            }
11873        }
11874    }
11875
11876    /// Lifecycle properties of a bucket.
11877    /// For more information, see <https://cloud.google.com/storage/docs/lifecycle>.
11878    #[derive(Clone, Debug, Default, PartialEq)]
11879    #[non_exhaustive]
11880    pub struct Lifecycle {
11881        /// Optional. A lifecycle management rule, which is made of an action to take
11882        /// and the condition(s) under which the action will be taken.
11883        pub rule: std::vec::Vec<crate::model::bucket::lifecycle::Rule>,
11884
11885        _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
11886    }
11887
11888    impl Lifecycle {
11889        pub fn new() -> Self {
11890            std::default::Default::default()
11891        }
11892
11893        /// Sets the value of [rule][crate::model::bucket::Lifecycle::rule].
11894        pub fn set_rule<T, V>(mut self, v: T) -> Self
11895        where
11896            T: std::iter::IntoIterator<Item = V>,
11897            V: std::convert::Into<crate::model::bucket::lifecycle::Rule>,
11898        {
11899            use std::iter::Iterator;
11900            self.rule = v.into_iter().map(|i| i.into()).collect();
11901            self
11902        }
11903    }
11904
11905    impl wkt::message::Message for Lifecycle {
11906        fn typename() -> &'static str {
11907            "type.googleapis.com/google.storage.v2.Bucket.Lifecycle"
11908        }
11909    }
11910
11911    #[doc(hidden)]
11912    impl<'de> serde::de::Deserialize<'de> for Lifecycle {
11913        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
11914        where
11915            D: serde::Deserializer<'de>,
11916        {
11917            #[allow(non_camel_case_types)]
11918            #[doc(hidden)]
11919            #[derive(PartialEq, Eq, Hash)]
11920            enum __FieldTag {
11921                __rule,
11922                Unknown(std::string::String),
11923            }
11924            impl<'de> serde::de::Deserialize<'de> for __FieldTag {
11925                fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
11926                where
11927                    D: serde::Deserializer<'de>,
11928                {
11929                    struct Visitor;
11930                    impl<'de> serde::de::Visitor<'de> for Visitor {
11931                        type Value = __FieldTag;
11932                        fn expecting(
11933                            &self,
11934                            formatter: &mut std::fmt::Formatter,
11935                        ) -> std::fmt::Result {
11936                            formatter.write_str("a field name for Lifecycle")
11937                        }
11938                        fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
11939                        where
11940                            E: serde::de::Error,
11941                        {
11942                            use std::result::Result::Ok;
11943                            use std::string::ToString;
11944                            match value {
11945                                "rule" => Ok(__FieldTag::__rule),
11946                                _ => Ok(__FieldTag::Unknown(value.to_string())),
11947                            }
11948                        }
11949                    }
11950                    deserializer.deserialize_identifier(Visitor)
11951                }
11952            }
11953            struct Visitor;
11954            impl<'de> serde::de::Visitor<'de> for Visitor {
11955                type Value = Lifecycle;
11956                fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
11957                    formatter.write_str("struct Lifecycle")
11958                }
11959                fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
11960                where
11961                    A: serde::de::MapAccess<'de>,
11962                {
11963                    #[allow(unused_imports)]
11964                    use serde::de::Error;
11965                    use std::option::Option::Some;
11966                    let mut fields = std::collections::HashSet::new();
11967                    let mut result = Self::Value::new();
11968                    while let Some(tag) = map.next_key::<__FieldTag>()? {
11969                        #[allow(clippy::match_single_binding)]
11970                        match tag {
11971                            __FieldTag::__rule => {
11972                                if !fields.insert(__FieldTag::__rule) {
11973                                    return std::result::Result::Err(A::Error::duplicate_field(
11974                                        "multiple values for rule",
11975                                    ));
11976                                }
11977                                result.rule = map
11978                                    .next_value::<std::option::Option<
11979                                        std::vec::Vec<crate::model::bucket::lifecycle::Rule>,
11980                                    >>()?
11981                                    .unwrap_or_default();
11982                            }
11983                            __FieldTag::Unknown(key) => {
11984                                let value = map.next_value::<serde_json::Value>()?;
11985                                result._unknown_fields.insert(key, value);
11986                            }
11987                        }
11988                    }
11989                    std::result::Result::Ok(result)
11990                }
11991            }
11992            deserializer.deserialize_any(Visitor)
11993        }
11994    }
11995
11996    #[doc(hidden)]
11997    impl serde::ser::Serialize for Lifecycle {
11998        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
11999        where
12000            S: serde::ser::Serializer,
12001        {
12002            use serde::ser::SerializeMap;
12003            #[allow(unused_imports)]
12004            use std::option::Option::Some;
12005            let mut state = serializer.serialize_map(std::option::Option::None)?;
12006            if !self.rule.is_empty() {
12007                state.serialize_entry("rule", &self.rule)?;
12008            }
12009            if !self._unknown_fields.is_empty() {
12010                for (key, value) in self._unknown_fields.iter() {
12011                    state.serialize_entry(key, &value)?;
12012                }
12013            }
12014            state.end()
12015        }
12016    }
12017
12018    /// Defines additional types related to [Lifecycle].
12019    pub mod lifecycle {
12020        #[allow(unused_imports)]
12021        use super::*;
12022
12023        /// A lifecycle Rule, combining an action to take on an object and a
12024        /// condition which will trigger that action.
12025        #[derive(Clone, Debug, Default, PartialEq)]
12026        #[non_exhaustive]
12027        pub struct Rule {
12028            /// Optional. The action to take.
12029            pub action: std::option::Option<crate::model::bucket::lifecycle::rule::Action>,
12030
12031            /// Optional. The condition(s) under which the action will be taken.
12032            pub condition: std::option::Option<crate::model::bucket::lifecycle::rule::Condition>,
12033
12034            _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
12035        }
12036
12037        impl Rule {
12038            pub fn new() -> Self {
12039                std::default::Default::default()
12040            }
12041
12042            /// Sets the value of [action][crate::model::bucket::lifecycle::Rule::action].
12043            pub fn set_action<T>(mut self, v: T) -> Self
12044            where
12045                T: std::convert::Into<crate::model::bucket::lifecycle::rule::Action>,
12046            {
12047                self.action = std::option::Option::Some(v.into());
12048                self
12049            }
12050
12051            /// Sets or clears the value of [action][crate::model::bucket::lifecycle::Rule::action].
12052            pub fn set_or_clear_action<T>(mut self, v: std::option::Option<T>) -> Self
12053            where
12054                T: std::convert::Into<crate::model::bucket::lifecycle::rule::Action>,
12055            {
12056                self.action = v.map(|x| x.into());
12057                self
12058            }
12059
12060            /// Sets the value of [condition][crate::model::bucket::lifecycle::Rule::condition].
12061            pub fn set_condition<T>(mut self, v: T) -> Self
12062            where
12063                T: std::convert::Into<crate::model::bucket::lifecycle::rule::Condition>,
12064            {
12065                self.condition = std::option::Option::Some(v.into());
12066                self
12067            }
12068
12069            /// Sets or clears the value of [condition][crate::model::bucket::lifecycle::Rule::condition].
12070            pub fn set_or_clear_condition<T>(mut self, v: std::option::Option<T>) -> Self
12071            where
12072                T: std::convert::Into<crate::model::bucket::lifecycle::rule::Condition>,
12073            {
12074                self.condition = v.map(|x| x.into());
12075                self
12076            }
12077        }
12078
12079        impl wkt::message::Message for Rule {
12080            fn typename() -> &'static str {
12081                "type.googleapis.com/google.storage.v2.Bucket.Lifecycle.Rule"
12082            }
12083        }
12084
12085        #[doc(hidden)]
12086        impl<'de> serde::de::Deserialize<'de> for Rule {
12087            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
12088            where
12089                D: serde::Deserializer<'de>,
12090            {
12091                #[allow(non_camel_case_types)]
12092                #[doc(hidden)]
12093                #[derive(PartialEq, Eq, Hash)]
12094                enum __FieldTag {
12095                    __action,
12096                    __condition,
12097                    Unknown(std::string::String),
12098                }
12099                impl<'de> serde::de::Deserialize<'de> for __FieldTag {
12100                    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
12101                    where
12102                        D: serde::Deserializer<'de>,
12103                    {
12104                        struct Visitor;
12105                        impl<'de> serde::de::Visitor<'de> for Visitor {
12106                            type Value = __FieldTag;
12107                            fn expecting(
12108                                &self,
12109                                formatter: &mut std::fmt::Formatter,
12110                            ) -> std::fmt::Result {
12111                                formatter.write_str("a field name for Rule")
12112                            }
12113                            fn visit_str<E>(
12114                                self,
12115                                value: &str,
12116                            ) -> std::result::Result<Self::Value, E>
12117                            where
12118                                E: serde::de::Error,
12119                            {
12120                                use std::result::Result::Ok;
12121                                use std::string::ToString;
12122                                match value {
12123                                    "action" => Ok(__FieldTag::__action),
12124                                    "condition" => Ok(__FieldTag::__condition),
12125                                    _ => Ok(__FieldTag::Unknown(value.to_string())),
12126                                }
12127                            }
12128                        }
12129                        deserializer.deserialize_identifier(Visitor)
12130                    }
12131                }
12132                struct Visitor;
12133                impl<'de> serde::de::Visitor<'de> for Visitor {
12134                    type Value = Rule;
12135                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
12136                        formatter.write_str("struct Rule")
12137                    }
12138                    fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
12139                    where
12140                        A: serde::de::MapAccess<'de>,
12141                    {
12142                        #[allow(unused_imports)]
12143                        use serde::de::Error;
12144                        use std::option::Option::Some;
12145                        let mut fields = std::collections::HashSet::new();
12146                        let mut result = Self::Value::new();
12147                        while let Some(tag) = map.next_key::<__FieldTag>()? {
12148                            #[allow(clippy::match_single_binding)]
12149                            match tag {
12150                                __FieldTag::__action => {
12151                                    if !fields.insert(__FieldTag::__action) {
12152                                        return std::result::Result::Err(
12153                                            A::Error::duplicate_field("multiple values for action"),
12154                                        );
12155                                    }
12156                                    result.action = map.next_value::<std::option::Option<
12157                                        crate::model::bucket::lifecycle::rule::Action,
12158                                    >>()?;
12159                                }
12160                                __FieldTag::__condition => {
12161                                    if !fields.insert(__FieldTag::__condition) {
12162                                        return std::result::Result::Err(
12163                                            A::Error::duplicate_field(
12164                                                "multiple values for condition",
12165                                            ),
12166                                        );
12167                                    }
12168                                    result.condition = map
12169                                        .next_value::<std::option::Option<
12170                                            crate::model::bucket::lifecycle::rule::Condition,
12171                                        >>()?;
12172                                }
12173                                __FieldTag::Unknown(key) => {
12174                                    let value = map.next_value::<serde_json::Value>()?;
12175                                    result._unknown_fields.insert(key, value);
12176                                }
12177                            }
12178                        }
12179                        std::result::Result::Ok(result)
12180                    }
12181                }
12182                deserializer.deserialize_any(Visitor)
12183            }
12184        }
12185
12186        #[doc(hidden)]
12187        impl serde::ser::Serialize for Rule {
12188            fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
12189            where
12190                S: serde::ser::Serializer,
12191            {
12192                use serde::ser::SerializeMap;
12193                #[allow(unused_imports)]
12194                use std::option::Option::Some;
12195                let mut state = serializer.serialize_map(std::option::Option::None)?;
12196                if self.action.is_some() {
12197                    state.serialize_entry("action", &self.action)?;
12198                }
12199                if self.condition.is_some() {
12200                    state.serialize_entry("condition", &self.condition)?;
12201                }
12202                if !self._unknown_fields.is_empty() {
12203                    for (key, value) in self._unknown_fields.iter() {
12204                        state.serialize_entry(key, &value)?;
12205                    }
12206                }
12207                state.end()
12208            }
12209        }
12210
12211        /// Defines additional types related to [Rule].
12212        pub mod rule {
12213            #[allow(unused_imports)]
12214            use super::*;
12215
12216            /// An action to take on an object.
12217            #[derive(Clone, Debug, Default, PartialEq)]
12218            #[non_exhaustive]
12219            pub struct Action {
12220                /// Optional. Type of the action. Currently, only `Delete`,
12221                /// `SetStorageClass`, and `AbortIncompleteMultipartUpload` are
12222                /// supported.
12223                pub r#type: std::string::String,
12224
12225                /// Optional. Target storage class. Required iff the type of the action
12226                /// is SetStorageClass.
12227                pub storage_class: std::string::String,
12228
12229                _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
12230            }
12231
12232            impl Action {
12233                pub fn new() -> Self {
12234                    std::default::Default::default()
12235                }
12236
12237                /// Sets the value of [r#type][crate::model::bucket::lifecycle::rule::Action::type].
12238                pub fn set_type<T: std::convert::Into<std::string::String>>(
12239                    mut self,
12240                    v: T,
12241                ) -> Self {
12242                    self.r#type = v.into();
12243                    self
12244                }
12245
12246                /// Sets the value of [storage_class][crate::model::bucket::lifecycle::rule::Action::storage_class].
12247                pub fn set_storage_class<T: std::convert::Into<std::string::String>>(
12248                    mut self,
12249                    v: T,
12250                ) -> Self {
12251                    self.storage_class = v.into();
12252                    self
12253                }
12254            }
12255
12256            impl wkt::message::Message for Action {
12257                fn typename() -> &'static str {
12258                    "type.googleapis.com/google.storage.v2.Bucket.Lifecycle.Rule.Action"
12259                }
12260            }
12261
12262            #[doc(hidden)]
12263            impl<'de> serde::de::Deserialize<'de> for Action {
12264                fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
12265                where
12266                    D: serde::Deserializer<'de>,
12267                {
12268                    #[allow(non_camel_case_types)]
12269                    #[doc(hidden)]
12270                    #[derive(PartialEq, Eq, Hash)]
12271                    enum __FieldTag {
12272                        __type,
12273                        __storage_class,
12274                        Unknown(std::string::String),
12275                    }
12276                    impl<'de> serde::de::Deserialize<'de> for __FieldTag {
12277                        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
12278                        where
12279                            D: serde::Deserializer<'de>,
12280                        {
12281                            struct Visitor;
12282                            impl<'de> serde::de::Visitor<'de> for Visitor {
12283                                type Value = __FieldTag;
12284                                fn expecting(
12285                                    &self,
12286                                    formatter: &mut std::fmt::Formatter,
12287                                ) -> std::fmt::Result {
12288                                    formatter.write_str("a field name for Action")
12289                                }
12290                                fn visit_str<E>(
12291                                    self,
12292                                    value: &str,
12293                                ) -> std::result::Result<Self::Value, E>
12294                                where
12295                                    E: serde::de::Error,
12296                                {
12297                                    use std::result::Result::Ok;
12298                                    use std::string::ToString;
12299                                    match value {
12300                                        "type" => Ok(__FieldTag::__type),
12301                                        "storageClass" => Ok(__FieldTag::__storage_class),
12302                                        "storage_class" => Ok(__FieldTag::__storage_class),
12303                                        _ => Ok(__FieldTag::Unknown(value.to_string())),
12304                                    }
12305                                }
12306                            }
12307                            deserializer.deserialize_identifier(Visitor)
12308                        }
12309                    }
12310                    struct Visitor;
12311                    impl<'de> serde::de::Visitor<'de> for Visitor {
12312                        type Value = Action;
12313                        fn expecting(
12314                            &self,
12315                            formatter: &mut std::fmt::Formatter,
12316                        ) -> std::fmt::Result {
12317                            formatter.write_str("struct Action")
12318                        }
12319                        fn visit_map<A>(
12320                            self,
12321                            mut map: A,
12322                        ) -> std::result::Result<Self::Value, A::Error>
12323                        where
12324                            A: serde::de::MapAccess<'de>,
12325                        {
12326                            #[allow(unused_imports)]
12327                            use serde::de::Error;
12328                            use std::option::Option::Some;
12329                            let mut fields = std::collections::HashSet::new();
12330                            let mut result = Self::Value::new();
12331                            while let Some(tag) = map.next_key::<__FieldTag>()? {
12332                                #[allow(clippy::match_single_binding)]
12333                                match tag {
12334                                    __FieldTag::__type => {
12335                                        if !fields.insert(__FieldTag::__type) {
12336                                            return std::result::Result::Err(
12337                                                A::Error::duplicate_field(
12338                                                    "multiple values for type",
12339                                                ),
12340                                            );
12341                                        }
12342                                        result.r#type = map
12343                                            .next_value::<std::option::Option<std::string::String>>(
12344                                            )?
12345                                            .unwrap_or_default();
12346                                    }
12347                                    __FieldTag::__storage_class => {
12348                                        if !fields.insert(__FieldTag::__storage_class) {
12349                                            return std::result::Result::Err(
12350                                                A::Error::duplicate_field(
12351                                                    "multiple values for storage_class",
12352                                                ),
12353                                            );
12354                                        }
12355                                        result.storage_class = map
12356                                            .next_value::<std::option::Option<std::string::String>>(
12357                                            )?
12358                                            .unwrap_or_default();
12359                                    }
12360                                    __FieldTag::Unknown(key) => {
12361                                        let value = map.next_value::<serde_json::Value>()?;
12362                                        result._unknown_fields.insert(key, value);
12363                                    }
12364                                }
12365                            }
12366                            std::result::Result::Ok(result)
12367                        }
12368                    }
12369                    deserializer.deserialize_any(Visitor)
12370                }
12371            }
12372
12373            #[doc(hidden)]
12374            impl serde::ser::Serialize for Action {
12375                fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
12376                where
12377                    S: serde::ser::Serializer,
12378                {
12379                    use serde::ser::SerializeMap;
12380                    #[allow(unused_imports)]
12381                    use std::option::Option::Some;
12382                    let mut state = serializer.serialize_map(std::option::Option::None)?;
12383                    if !self.r#type.is_empty() {
12384                        state.serialize_entry("type", &self.r#type)?;
12385                    }
12386                    if !self.storage_class.is_empty() {
12387                        state.serialize_entry("storageClass", &self.storage_class)?;
12388                    }
12389                    if !self._unknown_fields.is_empty() {
12390                        for (key, value) in self._unknown_fields.iter() {
12391                            state.serialize_entry(key, &value)?;
12392                        }
12393                    }
12394                    state.end()
12395                }
12396            }
12397
12398            /// A condition of an object which triggers some action.
12399            #[derive(Clone, Debug, Default, PartialEq)]
12400            #[non_exhaustive]
12401            pub struct Condition {
12402                /// Age of an object (in days). This condition is satisfied when an
12403                /// object reaches the specified age.
12404                /// A value of 0 indicates that all objects immediately match this
12405                /// condition.
12406                pub age_days: std::option::Option<i32>,
12407
12408                /// Optional. This condition is satisfied when an object is created
12409                /// before midnight of the specified date in UTC.
12410                pub created_before: std::option::Option<gtype::model::Date>,
12411
12412                /// Relevant only for versioned objects. If the value is
12413                /// `true`, this condition matches live objects; if the value
12414                /// is `false`, it matches archived objects.
12415                pub is_live: std::option::Option<bool>,
12416
12417                /// Relevant only for versioned objects. If the value is N, this
12418                /// condition is satisfied when there are at least N versions (including
12419                /// the live version) newer than this version of the object.
12420                pub num_newer_versions: std::option::Option<i32>,
12421
12422                /// Optional. Objects having any of the storage classes specified by this
12423                /// condition will be matched. Values include `MULTI_REGIONAL`,
12424                /// `REGIONAL`, `NEARLINE`, `COLDLINE`, `STANDARD`, and
12425                /// `DURABLE_REDUCED_AVAILABILITY`.
12426                pub matches_storage_class: std::vec::Vec<std::string::String>,
12427
12428                /// Number of days that have elapsed since the custom timestamp set on an
12429                /// object.
12430                /// The value of the field must be a nonnegative integer.
12431                pub days_since_custom_time: std::option::Option<i32>,
12432
12433                /// Optional. An object matches this condition if the custom timestamp
12434                /// set on the object is before the specified date in UTC.
12435                pub custom_time_before: std::option::Option<gtype::model::Date>,
12436
12437                /// This condition is relevant only for versioned objects. An object
12438                /// version satisfies this condition only if these many days have been
12439                /// passed since it became noncurrent. The value of the field must be a
12440                /// nonnegative integer. If it's zero, the object version will become
12441                /// eligible for Lifecycle action as soon as it becomes noncurrent.
12442                pub days_since_noncurrent_time: std::option::Option<i32>,
12443
12444                /// Optional. This condition is relevant only for versioned objects. An
12445                /// object version satisfies this condition only if it became noncurrent
12446                /// before the specified date in UTC.
12447                pub noncurrent_time_before: std::option::Option<gtype::model::Date>,
12448
12449                /// Optional. List of object name prefixes. If any prefix exactly matches
12450                /// the beginning of the object name, the condition evaluates to true.
12451                pub matches_prefix: std::vec::Vec<std::string::String>,
12452
12453                /// Optional. List of object name suffixes. If any suffix exactly matches
12454                /// the end of the object name, the condition evaluates to true.
12455                pub matches_suffix: std::vec::Vec<std::string::String>,
12456
12457                _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
12458            }
12459
12460            impl Condition {
12461                pub fn new() -> Self {
12462                    std::default::Default::default()
12463                }
12464
12465                /// Sets the value of [age_days][crate::model::bucket::lifecycle::rule::Condition::age_days].
12466                pub fn set_age_days<T>(mut self, v: T) -> Self
12467                where
12468                    T: std::convert::Into<i32>,
12469                {
12470                    self.age_days = std::option::Option::Some(v.into());
12471                    self
12472                }
12473
12474                /// Sets or clears the value of [age_days][crate::model::bucket::lifecycle::rule::Condition::age_days].
12475                pub fn set_or_clear_age_days<T>(mut self, v: std::option::Option<T>) -> Self
12476                where
12477                    T: std::convert::Into<i32>,
12478                {
12479                    self.age_days = v.map(|x| x.into());
12480                    self
12481                }
12482
12483                /// Sets the value of [created_before][crate::model::bucket::lifecycle::rule::Condition::created_before].
12484                pub fn set_created_before<T>(mut self, v: T) -> Self
12485                where
12486                    T: std::convert::Into<gtype::model::Date>,
12487                {
12488                    self.created_before = std::option::Option::Some(v.into());
12489                    self
12490                }
12491
12492                /// Sets or clears the value of [created_before][crate::model::bucket::lifecycle::rule::Condition::created_before].
12493                pub fn set_or_clear_created_before<T>(mut self, v: std::option::Option<T>) -> Self
12494                where
12495                    T: std::convert::Into<gtype::model::Date>,
12496                {
12497                    self.created_before = v.map(|x| x.into());
12498                    self
12499                }
12500
12501                /// Sets the value of [is_live][crate::model::bucket::lifecycle::rule::Condition::is_live].
12502                pub fn set_is_live<T>(mut self, v: T) -> Self
12503                where
12504                    T: std::convert::Into<bool>,
12505                {
12506                    self.is_live = std::option::Option::Some(v.into());
12507                    self
12508                }
12509
12510                /// Sets or clears the value of [is_live][crate::model::bucket::lifecycle::rule::Condition::is_live].
12511                pub fn set_or_clear_is_live<T>(mut self, v: std::option::Option<T>) -> Self
12512                where
12513                    T: std::convert::Into<bool>,
12514                {
12515                    self.is_live = v.map(|x| x.into());
12516                    self
12517                }
12518
12519                /// Sets the value of [num_newer_versions][crate::model::bucket::lifecycle::rule::Condition::num_newer_versions].
12520                pub fn set_num_newer_versions<T>(mut self, v: T) -> Self
12521                where
12522                    T: std::convert::Into<i32>,
12523                {
12524                    self.num_newer_versions = std::option::Option::Some(v.into());
12525                    self
12526                }
12527
12528                /// Sets or clears the value of [num_newer_versions][crate::model::bucket::lifecycle::rule::Condition::num_newer_versions].
12529                pub fn set_or_clear_num_newer_versions<T>(
12530                    mut self,
12531                    v: std::option::Option<T>,
12532                ) -> Self
12533                where
12534                    T: std::convert::Into<i32>,
12535                {
12536                    self.num_newer_versions = v.map(|x| x.into());
12537                    self
12538                }
12539
12540                /// Sets the value of [matches_storage_class][crate::model::bucket::lifecycle::rule::Condition::matches_storage_class].
12541                pub fn set_matches_storage_class<T, V>(mut self, v: T) -> Self
12542                where
12543                    T: std::iter::IntoIterator<Item = V>,
12544                    V: std::convert::Into<std::string::String>,
12545                {
12546                    use std::iter::Iterator;
12547                    self.matches_storage_class = v.into_iter().map(|i| i.into()).collect();
12548                    self
12549                }
12550
12551                /// Sets the value of [days_since_custom_time][crate::model::bucket::lifecycle::rule::Condition::days_since_custom_time].
12552                pub fn set_days_since_custom_time<T>(mut self, v: T) -> Self
12553                where
12554                    T: std::convert::Into<i32>,
12555                {
12556                    self.days_since_custom_time = std::option::Option::Some(v.into());
12557                    self
12558                }
12559
12560                /// Sets or clears the value of [days_since_custom_time][crate::model::bucket::lifecycle::rule::Condition::days_since_custom_time].
12561                pub fn set_or_clear_days_since_custom_time<T>(
12562                    mut self,
12563                    v: std::option::Option<T>,
12564                ) -> Self
12565                where
12566                    T: std::convert::Into<i32>,
12567                {
12568                    self.days_since_custom_time = v.map(|x| x.into());
12569                    self
12570                }
12571
12572                /// Sets the value of [custom_time_before][crate::model::bucket::lifecycle::rule::Condition::custom_time_before].
12573                pub fn set_custom_time_before<T>(mut self, v: T) -> Self
12574                where
12575                    T: std::convert::Into<gtype::model::Date>,
12576                {
12577                    self.custom_time_before = std::option::Option::Some(v.into());
12578                    self
12579                }
12580
12581                /// Sets or clears the value of [custom_time_before][crate::model::bucket::lifecycle::rule::Condition::custom_time_before].
12582                pub fn set_or_clear_custom_time_before<T>(
12583                    mut self,
12584                    v: std::option::Option<T>,
12585                ) -> Self
12586                where
12587                    T: std::convert::Into<gtype::model::Date>,
12588                {
12589                    self.custom_time_before = v.map(|x| x.into());
12590                    self
12591                }
12592
12593                /// Sets the value of [days_since_noncurrent_time][crate::model::bucket::lifecycle::rule::Condition::days_since_noncurrent_time].
12594                pub fn set_days_since_noncurrent_time<T>(mut self, v: T) -> Self
12595                where
12596                    T: std::convert::Into<i32>,
12597                {
12598                    self.days_since_noncurrent_time = std::option::Option::Some(v.into());
12599                    self
12600                }
12601
12602                /// Sets or clears the value of [days_since_noncurrent_time][crate::model::bucket::lifecycle::rule::Condition::days_since_noncurrent_time].
12603                pub fn set_or_clear_days_since_noncurrent_time<T>(
12604                    mut self,
12605                    v: std::option::Option<T>,
12606                ) -> Self
12607                where
12608                    T: std::convert::Into<i32>,
12609                {
12610                    self.days_since_noncurrent_time = v.map(|x| x.into());
12611                    self
12612                }
12613
12614                /// Sets the value of [noncurrent_time_before][crate::model::bucket::lifecycle::rule::Condition::noncurrent_time_before].
12615                pub fn set_noncurrent_time_before<T>(mut self, v: T) -> Self
12616                where
12617                    T: std::convert::Into<gtype::model::Date>,
12618                {
12619                    self.noncurrent_time_before = std::option::Option::Some(v.into());
12620                    self
12621                }
12622
12623                /// Sets or clears the value of [noncurrent_time_before][crate::model::bucket::lifecycle::rule::Condition::noncurrent_time_before].
12624                pub fn set_or_clear_noncurrent_time_before<T>(
12625                    mut self,
12626                    v: std::option::Option<T>,
12627                ) -> Self
12628                where
12629                    T: std::convert::Into<gtype::model::Date>,
12630                {
12631                    self.noncurrent_time_before = v.map(|x| x.into());
12632                    self
12633                }
12634
12635                /// Sets the value of [matches_prefix][crate::model::bucket::lifecycle::rule::Condition::matches_prefix].
12636                pub fn set_matches_prefix<T, V>(mut self, v: T) -> Self
12637                where
12638                    T: std::iter::IntoIterator<Item = V>,
12639                    V: std::convert::Into<std::string::String>,
12640                {
12641                    use std::iter::Iterator;
12642                    self.matches_prefix = v.into_iter().map(|i| i.into()).collect();
12643                    self
12644                }
12645
12646                /// Sets the value of [matches_suffix][crate::model::bucket::lifecycle::rule::Condition::matches_suffix].
12647                pub fn set_matches_suffix<T, V>(mut self, v: T) -> Self
12648                where
12649                    T: std::iter::IntoIterator<Item = V>,
12650                    V: std::convert::Into<std::string::String>,
12651                {
12652                    use std::iter::Iterator;
12653                    self.matches_suffix = v.into_iter().map(|i| i.into()).collect();
12654                    self
12655                }
12656            }
12657
12658            impl wkt::message::Message for Condition {
12659                fn typename() -> &'static str {
12660                    "type.googleapis.com/google.storage.v2.Bucket.Lifecycle.Rule.Condition"
12661                }
12662            }
12663
12664            #[doc(hidden)]
12665            impl<'de> serde::de::Deserialize<'de> for Condition {
12666                fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
12667                where
12668                    D: serde::Deserializer<'de>,
12669                {
12670                    #[allow(non_camel_case_types)]
12671                    #[doc(hidden)]
12672                    #[derive(PartialEq, Eq, Hash)]
12673                    enum __FieldTag {
12674                        __age_days,
12675                        __created_before,
12676                        __is_live,
12677                        __num_newer_versions,
12678                        __matches_storage_class,
12679                        __days_since_custom_time,
12680                        __custom_time_before,
12681                        __days_since_noncurrent_time,
12682                        __noncurrent_time_before,
12683                        __matches_prefix,
12684                        __matches_suffix,
12685                        Unknown(std::string::String),
12686                    }
12687                    impl<'de> serde::de::Deserialize<'de> for __FieldTag {
12688                        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
12689                        where
12690                            D: serde::Deserializer<'de>,
12691                        {
12692                            struct Visitor;
12693                            impl<'de> serde::de::Visitor<'de> for Visitor {
12694                                type Value = __FieldTag;
12695                                fn expecting(
12696                                    &self,
12697                                    formatter: &mut std::fmt::Formatter,
12698                                ) -> std::fmt::Result {
12699                                    formatter.write_str("a field name for Condition")
12700                                }
12701                                fn visit_str<E>(
12702                                    self,
12703                                    value: &str,
12704                                ) -> std::result::Result<Self::Value, E>
12705                                where
12706                                    E: serde::de::Error,
12707                                {
12708                                    use std::result::Result::Ok;
12709                                    use std::string::ToString;
12710                                    match value {
12711                                        "ageDays" => Ok(__FieldTag::__age_days),
12712                                        "age_days" => Ok(__FieldTag::__age_days),
12713                                        "createdBefore" => Ok(__FieldTag::__created_before),
12714                                        "created_before" => Ok(__FieldTag::__created_before),
12715                                        "isLive" => Ok(__FieldTag::__is_live),
12716                                        "is_live" => Ok(__FieldTag::__is_live),
12717                                        "numNewerVersions" => Ok(__FieldTag::__num_newer_versions),
12718                                        "num_newer_versions" => {
12719                                            Ok(__FieldTag::__num_newer_versions)
12720                                        }
12721                                        "matchesStorageClass" => {
12722                                            Ok(__FieldTag::__matches_storage_class)
12723                                        }
12724                                        "matches_storage_class" => {
12725                                            Ok(__FieldTag::__matches_storage_class)
12726                                        }
12727                                        "daysSinceCustomTime" => {
12728                                            Ok(__FieldTag::__days_since_custom_time)
12729                                        }
12730                                        "days_since_custom_time" => {
12731                                            Ok(__FieldTag::__days_since_custom_time)
12732                                        }
12733                                        "customTimeBefore" => Ok(__FieldTag::__custom_time_before),
12734                                        "custom_time_before" => {
12735                                            Ok(__FieldTag::__custom_time_before)
12736                                        }
12737                                        "daysSinceNoncurrentTime" => {
12738                                            Ok(__FieldTag::__days_since_noncurrent_time)
12739                                        }
12740                                        "days_since_noncurrent_time" => {
12741                                            Ok(__FieldTag::__days_since_noncurrent_time)
12742                                        }
12743                                        "noncurrentTimeBefore" => {
12744                                            Ok(__FieldTag::__noncurrent_time_before)
12745                                        }
12746                                        "noncurrent_time_before" => {
12747                                            Ok(__FieldTag::__noncurrent_time_before)
12748                                        }
12749                                        "matchesPrefix" => Ok(__FieldTag::__matches_prefix),
12750                                        "matches_prefix" => Ok(__FieldTag::__matches_prefix),
12751                                        "matchesSuffix" => Ok(__FieldTag::__matches_suffix),
12752                                        "matches_suffix" => Ok(__FieldTag::__matches_suffix),
12753                                        _ => Ok(__FieldTag::Unknown(value.to_string())),
12754                                    }
12755                                }
12756                            }
12757                            deserializer.deserialize_identifier(Visitor)
12758                        }
12759                    }
12760                    struct Visitor;
12761                    impl<'de> serde::de::Visitor<'de> for Visitor {
12762                        type Value = Condition;
12763                        fn expecting(
12764                            &self,
12765                            formatter: &mut std::fmt::Formatter,
12766                        ) -> std::fmt::Result {
12767                            formatter.write_str("struct Condition")
12768                        }
12769                        fn visit_map<A>(
12770                            self,
12771                            mut map: A,
12772                        ) -> std::result::Result<Self::Value, A::Error>
12773                        where
12774                            A: serde::de::MapAccess<'de>,
12775                        {
12776                            #[allow(unused_imports)]
12777                            use serde::de::Error;
12778                            use std::option::Option::Some;
12779                            let mut fields = std::collections::HashSet::new();
12780                            let mut result = Self::Value::new();
12781                            while let Some(tag) = map.next_key::<__FieldTag>()? {
12782                                #[allow(clippy::match_single_binding)]
12783                                match tag {
12784                                    __FieldTag::__age_days => {
12785                                        if !fields.insert(__FieldTag::__age_days) {
12786                                            return std::result::Result::Err(
12787                                                A::Error::duplicate_field(
12788                                                    "multiple values for age_days",
12789                                                ),
12790                                            );
12791                                        }
12792                                        struct __With(std::option::Option<i32>);
12793                                        impl<'de> serde::de::Deserialize<'de> for __With {
12794                                            fn deserialize<D>(
12795                                                deserializer: D,
12796                                            ) -> std::result::Result<Self, D::Error>
12797                                            where
12798                                                D: serde::de::Deserializer<'de>,
12799                                            {
12800                                                serde_with::As::<
12801                                                    std::option::Option<wkt::internal::I32>,
12802                                                >::deserialize(
12803                                                    deserializer
12804                                                )
12805                                                .map(__With)
12806                                            }
12807                                        }
12808                                        result.age_days = map.next_value::<__With>()?.0;
12809                                    }
12810                                    __FieldTag::__created_before => {
12811                                        if !fields.insert(__FieldTag::__created_before) {
12812                                            return std::result::Result::Err(
12813                                                A::Error::duplicate_field(
12814                                                    "multiple values for created_before",
12815                                                ),
12816                                            );
12817                                        }
12818                                        result.created_before = map
12819                                            .next_value::<std::option::Option<gtype::model::Date>>(
12820                                            )?;
12821                                    }
12822                                    __FieldTag::__is_live => {
12823                                        if !fields.insert(__FieldTag::__is_live) {
12824                                            return std::result::Result::Err(
12825                                                A::Error::duplicate_field(
12826                                                    "multiple values for is_live",
12827                                                ),
12828                                            );
12829                                        }
12830                                        result.is_live =
12831                                            map.next_value::<std::option::Option<bool>>()?;
12832                                    }
12833                                    __FieldTag::__num_newer_versions => {
12834                                        if !fields.insert(__FieldTag::__num_newer_versions) {
12835                                            return std::result::Result::Err(
12836                                                A::Error::duplicate_field(
12837                                                    "multiple values for num_newer_versions",
12838                                                ),
12839                                            );
12840                                        }
12841                                        struct __With(std::option::Option<i32>);
12842                                        impl<'de> serde::de::Deserialize<'de> for __With {
12843                                            fn deserialize<D>(
12844                                                deserializer: D,
12845                                            ) -> std::result::Result<Self, D::Error>
12846                                            where
12847                                                D: serde::de::Deserializer<'de>,
12848                                            {
12849                                                serde_with::As::<
12850                                                    std::option::Option<wkt::internal::I32>,
12851                                                >::deserialize(
12852                                                    deserializer
12853                                                )
12854                                                .map(__With)
12855                                            }
12856                                        }
12857                                        result.num_newer_versions = map.next_value::<__With>()?.0;
12858                                    }
12859                                    __FieldTag::__matches_storage_class => {
12860                                        if !fields.insert(__FieldTag::__matches_storage_class) {
12861                                            return std::result::Result::Err(
12862                                                A::Error::duplicate_field(
12863                                                    "multiple values for matches_storage_class",
12864                                                ),
12865                                            );
12866                                        }
12867                                        result.matches_storage_class =
12868                                            map.next_value::<std::option::Option<
12869                                                std::vec::Vec<std::string::String>,
12870                                            >>()?
12871                                            .unwrap_or_default();
12872                                    }
12873                                    __FieldTag::__days_since_custom_time => {
12874                                        if !fields.insert(__FieldTag::__days_since_custom_time) {
12875                                            return std::result::Result::Err(
12876                                                A::Error::duplicate_field(
12877                                                    "multiple values for days_since_custom_time",
12878                                                ),
12879                                            );
12880                                        }
12881                                        struct __With(std::option::Option<i32>);
12882                                        impl<'de> serde::de::Deserialize<'de> for __With {
12883                                            fn deserialize<D>(
12884                                                deserializer: D,
12885                                            ) -> std::result::Result<Self, D::Error>
12886                                            where
12887                                                D: serde::de::Deserializer<'de>,
12888                                            {
12889                                                serde_with::As::<
12890                                                    std::option::Option<wkt::internal::I32>,
12891                                                >::deserialize(
12892                                                    deserializer
12893                                                )
12894                                                .map(__With)
12895                                            }
12896                                        }
12897                                        result.days_since_custom_time =
12898                                            map.next_value::<__With>()?.0;
12899                                    }
12900                                    __FieldTag::__custom_time_before => {
12901                                        if !fields.insert(__FieldTag::__custom_time_before) {
12902                                            return std::result::Result::Err(
12903                                                A::Error::duplicate_field(
12904                                                    "multiple values for custom_time_before",
12905                                                ),
12906                                            );
12907                                        }
12908                                        result.custom_time_before = map
12909                                            .next_value::<std::option::Option<gtype::model::Date>>(
12910                                            )?;
12911                                    }
12912                                    __FieldTag::__days_since_noncurrent_time => {
12913                                        if !fields.insert(__FieldTag::__days_since_noncurrent_time)
12914                                        {
12915                                            return std::result::Result::Err(
12916                                                A::Error::duplicate_field(
12917                                                    "multiple values for days_since_noncurrent_time",
12918                                                ),
12919                                            );
12920                                        }
12921                                        struct __With(std::option::Option<i32>);
12922                                        impl<'de> serde::de::Deserialize<'de> for __With {
12923                                            fn deserialize<D>(
12924                                                deserializer: D,
12925                                            ) -> std::result::Result<Self, D::Error>
12926                                            where
12927                                                D: serde::de::Deserializer<'de>,
12928                                            {
12929                                                serde_with::As::<
12930                                                    std::option::Option<wkt::internal::I32>,
12931                                                >::deserialize(
12932                                                    deserializer
12933                                                )
12934                                                .map(__With)
12935                                            }
12936                                        }
12937                                        result.days_since_noncurrent_time =
12938                                            map.next_value::<__With>()?.0;
12939                                    }
12940                                    __FieldTag::__noncurrent_time_before => {
12941                                        if !fields.insert(__FieldTag::__noncurrent_time_before) {
12942                                            return std::result::Result::Err(
12943                                                A::Error::duplicate_field(
12944                                                    "multiple values for noncurrent_time_before",
12945                                                ),
12946                                            );
12947                                        }
12948                                        result.noncurrent_time_before = map
12949                                            .next_value::<std::option::Option<gtype::model::Date>>(
12950                                            )?;
12951                                    }
12952                                    __FieldTag::__matches_prefix => {
12953                                        if !fields.insert(__FieldTag::__matches_prefix) {
12954                                            return std::result::Result::Err(
12955                                                A::Error::duplicate_field(
12956                                                    "multiple values for matches_prefix",
12957                                                ),
12958                                            );
12959                                        }
12960                                        result.matches_prefix =
12961                                            map.next_value::<std::option::Option<
12962                                                std::vec::Vec<std::string::String>,
12963                                            >>()?
12964                                            .unwrap_or_default();
12965                                    }
12966                                    __FieldTag::__matches_suffix => {
12967                                        if !fields.insert(__FieldTag::__matches_suffix) {
12968                                            return std::result::Result::Err(
12969                                                A::Error::duplicate_field(
12970                                                    "multiple values for matches_suffix",
12971                                                ),
12972                                            );
12973                                        }
12974                                        result.matches_suffix =
12975                                            map.next_value::<std::option::Option<
12976                                                std::vec::Vec<std::string::String>,
12977                                            >>()?
12978                                            .unwrap_or_default();
12979                                    }
12980                                    __FieldTag::Unknown(key) => {
12981                                        let value = map.next_value::<serde_json::Value>()?;
12982                                        result._unknown_fields.insert(key, value);
12983                                    }
12984                                }
12985                            }
12986                            std::result::Result::Ok(result)
12987                        }
12988                    }
12989                    deserializer.deserialize_any(Visitor)
12990                }
12991            }
12992
12993            #[doc(hidden)]
12994            impl serde::ser::Serialize for Condition {
12995                fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
12996                where
12997                    S: serde::ser::Serializer,
12998                {
12999                    use serde::ser::SerializeMap;
13000                    #[allow(unused_imports)]
13001                    use std::option::Option::Some;
13002                    let mut state = serializer.serialize_map(std::option::Option::None)?;
13003                    if self.age_days.is_some() {
13004                        struct __With<'a>(&'a std::option::Option<i32>);
13005                        impl<'a> serde::ser::Serialize for __With<'a> {
13006                            fn serialize<S>(
13007                                &self,
13008                                serializer: S,
13009                            ) -> std::result::Result<S::Ok, S::Error>
13010                            where
13011                                S: serde::ser::Serializer,
13012                            {
13013                                serde_with::As::<std::option::Option<wkt::internal::I32>>::serialize(
13014                                    self.0, serializer,
13015                                )
13016                            }
13017                        }
13018                        state.serialize_entry("ageDays", &__With(&self.age_days))?;
13019                    }
13020                    if self.created_before.is_some() {
13021                        state.serialize_entry("createdBefore", &self.created_before)?;
13022                    }
13023                    if self.is_live.is_some() {
13024                        state.serialize_entry("isLive", &self.is_live)?;
13025                    }
13026                    if self.num_newer_versions.is_some() {
13027                        struct __With<'a>(&'a std::option::Option<i32>);
13028                        impl<'a> serde::ser::Serialize for __With<'a> {
13029                            fn serialize<S>(
13030                                &self,
13031                                serializer: S,
13032                            ) -> std::result::Result<S::Ok, S::Error>
13033                            where
13034                                S: serde::ser::Serializer,
13035                            {
13036                                serde_with::As::<std::option::Option<wkt::internal::I32>>::serialize(
13037                                    self.0, serializer,
13038                                )
13039                            }
13040                        }
13041                        state.serialize_entry(
13042                            "numNewerVersions",
13043                            &__With(&self.num_newer_versions),
13044                        )?;
13045                    }
13046                    if !self.matches_storage_class.is_empty() {
13047                        state
13048                            .serialize_entry("matchesStorageClass", &self.matches_storage_class)?;
13049                    }
13050                    if self.days_since_custom_time.is_some() {
13051                        struct __With<'a>(&'a std::option::Option<i32>);
13052                        impl<'a> serde::ser::Serialize for __With<'a> {
13053                            fn serialize<S>(
13054                                &self,
13055                                serializer: S,
13056                            ) -> std::result::Result<S::Ok, S::Error>
13057                            where
13058                                S: serde::ser::Serializer,
13059                            {
13060                                serde_with::As::<std::option::Option<wkt::internal::I32>>::serialize(
13061                                    self.0, serializer,
13062                                )
13063                            }
13064                        }
13065                        state.serialize_entry(
13066                            "daysSinceCustomTime",
13067                            &__With(&self.days_since_custom_time),
13068                        )?;
13069                    }
13070                    if self.custom_time_before.is_some() {
13071                        state.serialize_entry("customTimeBefore", &self.custom_time_before)?;
13072                    }
13073                    if self.days_since_noncurrent_time.is_some() {
13074                        struct __With<'a>(&'a std::option::Option<i32>);
13075                        impl<'a> serde::ser::Serialize for __With<'a> {
13076                            fn serialize<S>(
13077                                &self,
13078                                serializer: S,
13079                            ) -> std::result::Result<S::Ok, S::Error>
13080                            where
13081                                S: serde::ser::Serializer,
13082                            {
13083                                serde_with::As::<std::option::Option<wkt::internal::I32>>::serialize(
13084                                    self.0, serializer,
13085                                )
13086                            }
13087                        }
13088                        state.serialize_entry(
13089                            "daysSinceNoncurrentTime",
13090                            &__With(&self.days_since_noncurrent_time),
13091                        )?;
13092                    }
13093                    if self.noncurrent_time_before.is_some() {
13094                        state.serialize_entry(
13095                            "noncurrentTimeBefore",
13096                            &self.noncurrent_time_before,
13097                        )?;
13098                    }
13099                    if !self.matches_prefix.is_empty() {
13100                        state.serialize_entry("matchesPrefix", &self.matches_prefix)?;
13101                    }
13102                    if !self.matches_suffix.is_empty() {
13103                        state.serialize_entry("matchesSuffix", &self.matches_suffix)?;
13104                    }
13105                    if !self._unknown_fields.is_empty() {
13106                        for (key, value) in self._unknown_fields.iter() {
13107                            state.serialize_entry(key, &value)?;
13108                        }
13109                    }
13110                    state.end()
13111                }
13112            }
13113        }
13114    }
13115
13116    /// Logging-related properties of a bucket.
13117    #[derive(Clone, Debug, Default, PartialEq)]
13118    #[non_exhaustive]
13119    pub struct Logging {
13120        /// Optional. The destination bucket where the current bucket's logs should
13121        /// be placed, using path format (like `projects/123456/buckets/foo`).
13122        pub log_bucket: std::string::String,
13123
13124        /// Optional. A prefix for log object names.
13125        pub log_object_prefix: std::string::String,
13126
13127        _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
13128    }
13129
13130    impl Logging {
13131        pub fn new() -> Self {
13132            std::default::Default::default()
13133        }
13134
13135        /// Sets the value of [log_bucket][crate::model::bucket::Logging::log_bucket].
13136        pub fn set_log_bucket<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
13137            self.log_bucket = v.into();
13138            self
13139        }
13140
13141        /// Sets the value of [log_object_prefix][crate::model::bucket::Logging::log_object_prefix].
13142        pub fn set_log_object_prefix<T: std::convert::Into<std::string::String>>(
13143            mut self,
13144            v: T,
13145        ) -> Self {
13146            self.log_object_prefix = v.into();
13147            self
13148        }
13149    }
13150
13151    impl wkt::message::Message for Logging {
13152        fn typename() -> &'static str {
13153            "type.googleapis.com/google.storage.v2.Bucket.Logging"
13154        }
13155    }
13156
13157    #[doc(hidden)]
13158    impl<'de> serde::de::Deserialize<'de> for Logging {
13159        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
13160        where
13161            D: serde::Deserializer<'de>,
13162        {
13163            #[allow(non_camel_case_types)]
13164            #[doc(hidden)]
13165            #[derive(PartialEq, Eq, Hash)]
13166            enum __FieldTag {
13167                __log_bucket,
13168                __log_object_prefix,
13169                Unknown(std::string::String),
13170            }
13171            impl<'de> serde::de::Deserialize<'de> for __FieldTag {
13172                fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
13173                where
13174                    D: serde::Deserializer<'de>,
13175                {
13176                    struct Visitor;
13177                    impl<'de> serde::de::Visitor<'de> for Visitor {
13178                        type Value = __FieldTag;
13179                        fn expecting(
13180                            &self,
13181                            formatter: &mut std::fmt::Formatter,
13182                        ) -> std::fmt::Result {
13183                            formatter.write_str("a field name for Logging")
13184                        }
13185                        fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
13186                        where
13187                            E: serde::de::Error,
13188                        {
13189                            use std::result::Result::Ok;
13190                            use std::string::ToString;
13191                            match value {
13192                                "logBucket" => Ok(__FieldTag::__log_bucket),
13193                                "log_bucket" => Ok(__FieldTag::__log_bucket),
13194                                "logObjectPrefix" => Ok(__FieldTag::__log_object_prefix),
13195                                "log_object_prefix" => Ok(__FieldTag::__log_object_prefix),
13196                                _ => Ok(__FieldTag::Unknown(value.to_string())),
13197                            }
13198                        }
13199                    }
13200                    deserializer.deserialize_identifier(Visitor)
13201                }
13202            }
13203            struct Visitor;
13204            impl<'de> serde::de::Visitor<'de> for Visitor {
13205                type Value = Logging;
13206                fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
13207                    formatter.write_str("struct Logging")
13208                }
13209                fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
13210                where
13211                    A: serde::de::MapAccess<'de>,
13212                {
13213                    #[allow(unused_imports)]
13214                    use serde::de::Error;
13215                    use std::option::Option::Some;
13216                    let mut fields = std::collections::HashSet::new();
13217                    let mut result = Self::Value::new();
13218                    while let Some(tag) = map.next_key::<__FieldTag>()? {
13219                        #[allow(clippy::match_single_binding)]
13220                        match tag {
13221                            __FieldTag::__log_bucket => {
13222                                if !fields.insert(__FieldTag::__log_bucket) {
13223                                    return std::result::Result::Err(A::Error::duplicate_field(
13224                                        "multiple values for log_bucket",
13225                                    ));
13226                                }
13227                                result.log_bucket = map
13228                                    .next_value::<std::option::Option<std::string::String>>()?
13229                                    .unwrap_or_default();
13230                            }
13231                            __FieldTag::__log_object_prefix => {
13232                                if !fields.insert(__FieldTag::__log_object_prefix) {
13233                                    return std::result::Result::Err(A::Error::duplicate_field(
13234                                        "multiple values for log_object_prefix",
13235                                    ));
13236                                }
13237                                result.log_object_prefix = map
13238                                    .next_value::<std::option::Option<std::string::String>>()?
13239                                    .unwrap_or_default();
13240                            }
13241                            __FieldTag::Unknown(key) => {
13242                                let value = map.next_value::<serde_json::Value>()?;
13243                                result._unknown_fields.insert(key, value);
13244                            }
13245                        }
13246                    }
13247                    std::result::Result::Ok(result)
13248                }
13249            }
13250            deserializer.deserialize_any(Visitor)
13251        }
13252    }
13253
13254    #[doc(hidden)]
13255    impl serde::ser::Serialize for Logging {
13256        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
13257        where
13258            S: serde::ser::Serializer,
13259        {
13260            use serde::ser::SerializeMap;
13261            #[allow(unused_imports)]
13262            use std::option::Option::Some;
13263            let mut state = serializer.serialize_map(std::option::Option::None)?;
13264            if !self.log_bucket.is_empty() {
13265                state.serialize_entry("logBucket", &self.log_bucket)?;
13266            }
13267            if !self.log_object_prefix.is_empty() {
13268                state.serialize_entry("logObjectPrefix", &self.log_object_prefix)?;
13269            }
13270            if !self._unknown_fields.is_empty() {
13271                for (key, value) in self._unknown_fields.iter() {
13272                    state.serialize_entry(key, &value)?;
13273                }
13274            }
13275            state.end()
13276        }
13277    }
13278
13279    /// Object Retention related properties of a bucket.
13280    #[derive(Clone, Debug, Default, PartialEq)]
13281    #[non_exhaustive]
13282    pub struct ObjectRetention {
13283        /// Optional. Output only. If true, object retention is enabled for the
13284        /// bucket.
13285        pub enabled: bool,
13286
13287        _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
13288    }
13289
13290    impl ObjectRetention {
13291        pub fn new() -> Self {
13292            std::default::Default::default()
13293        }
13294
13295        /// Sets the value of [enabled][crate::model::bucket::ObjectRetention::enabled].
13296        pub fn set_enabled<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
13297            self.enabled = v.into();
13298            self
13299        }
13300    }
13301
13302    impl wkt::message::Message for ObjectRetention {
13303        fn typename() -> &'static str {
13304            "type.googleapis.com/google.storage.v2.Bucket.ObjectRetention"
13305        }
13306    }
13307
13308    #[doc(hidden)]
13309    impl<'de> serde::de::Deserialize<'de> for ObjectRetention {
13310        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
13311        where
13312            D: serde::Deserializer<'de>,
13313        {
13314            #[allow(non_camel_case_types)]
13315            #[doc(hidden)]
13316            #[derive(PartialEq, Eq, Hash)]
13317            enum __FieldTag {
13318                __enabled,
13319                Unknown(std::string::String),
13320            }
13321            impl<'de> serde::de::Deserialize<'de> for __FieldTag {
13322                fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
13323                where
13324                    D: serde::Deserializer<'de>,
13325                {
13326                    struct Visitor;
13327                    impl<'de> serde::de::Visitor<'de> for Visitor {
13328                        type Value = __FieldTag;
13329                        fn expecting(
13330                            &self,
13331                            formatter: &mut std::fmt::Formatter,
13332                        ) -> std::fmt::Result {
13333                            formatter.write_str("a field name for ObjectRetention")
13334                        }
13335                        fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
13336                        where
13337                            E: serde::de::Error,
13338                        {
13339                            use std::result::Result::Ok;
13340                            use std::string::ToString;
13341                            match value {
13342                                "enabled" => Ok(__FieldTag::__enabled),
13343                                _ => Ok(__FieldTag::Unknown(value.to_string())),
13344                            }
13345                        }
13346                    }
13347                    deserializer.deserialize_identifier(Visitor)
13348                }
13349            }
13350            struct Visitor;
13351            impl<'de> serde::de::Visitor<'de> for Visitor {
13352                type Value = ObjectRetention;
13353                fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
13354                    formatter.write_str("struct ObjectRetention")
13355                }
13356                fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
13357                where
13358                    A: serde::de::MapAccess<'de>,
13359                {
13360                    #[allow(unused_imports)]
13361                    use serde::de::Error;
13362                    use std::option::Option::Some;
13363                    let mut fields = std::collections::HashSet::new();
13364                    let mut result = Self::Value::new();
13365                    while let Some(tag) = map.next_key::<__FieldTag>()? {
13366                        #[allow(clippy::match_single_binding)]
13367                        match tag {
13368                            __FieldTag::__enabled => {
13369                                if !fields.insert(__FieldTag::__enabled) {
13370                                    return std::result::Result::Err(A::Error::duplicate_field(
13371                                        "multiple values for enabled",
13372                                    ));
13373                                }
13374                                result.enabled = map
13375                                    .next_value::<std::option::Option<bool>>()?
13376                                    .unwrap_or_default();
13377                            }
13378                            __FieldTag::Unknown(key) => {
13379                                let value = map.next_value::<serde_json::Value>()?;
13380                                result._unknown_fields.insert(key, value);
13381                            }
13382                        }
13383                    }
13384                    std::result::Result::Ok(result)
13385                }
13386            }
13387            deserializer.deserialize_any(Visitor)
13388        }
13389    }
13390
13391    #[doc(hidden)]
13392    impl serde::ser::Serialize for ObjectRetention {
13393        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
13394        where
13395            S: serde::ser::Serializer,
13396        {
13397            use serde::ser::SerializeMap;
13398            #[allow(unused_imports)]
13399            use std::option::Option::Some;
13400            let mut state = serializer.serialize_map(std::option::Option::None)?;
13401            if !wkt::internal::is_default(&self.enabled) {
13402                state.serialize_entry("enabled", &self.enabled)?;
13403            }
13404            if !self._unknown_fields.is_empty() {
13405                for (key, value) in self._unknown_fields.iter() {
13406                    state.serialize_entry(key, &value)?;
13407                }
13408            }
13409            state.end()
13410        }
13411    }
13412
13413    /// Retention policy properties of a bucket.
13414    #[derive(Clone, Debug, Default, PartialEq)]
13415    #[non_exhaustive]
13416    pub struct RetentionPolicy {
13417        /// Optional. Server-determined value that indicates the time from which
13418        /// policy was enforced and effective.
13419        pub effective_time: std::option::Option<wkt::Timestamp>,
13420
13421        /// Optional. Once locked, an object retention policy cannot be modified.
13422        pub is_locked: bool,
13423
13424        /// Optional. The duration that objects need to be retained. Retention
13425        /// duration must be greater than zero and less than 100 years. Note that
13426        /// enforcement of retention periods less than a day is not guaranteed. Such
13427        /// periods should only be used for testing purposes. Any `nanos` value
13428        /// specified will be rounded down to the nearest second.
13429        pub retention_duration: std::option::Option<wkt::Duration>,
13430
13431        _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
13432    }
13433
13434    impl RetentionPolicy {
13435        pub fn new() -> Self {
13436            std::default::Default::default()
13437        }
13438
13439        /// Sets the value of [effective_time][crate::model::bucket::RetentionPolicy::effective_time].
13440        pub fn set_effective_time<T>(mut self, v: T) -> Self
13441        where
13442            T: std::convert::Into<wkt::Timestamp>,
13443        {
13444            self.effective_time = std::option::Option::Some(v.into());
13445            self
13446        }
13447
13448        /// Sets or clears the value of [effective_time][crate::model::bucket::RetentionPolicy::effective_time].
13449        pub fn set_or_clear_effective_time<T>(mut self, v: std::option::Option<T>) -> Self
13450        where
13451            T: std::convert::Into<wkt::Timestamp>,
13452        {
13453            self.effective_time = v.map(|x| x.into());
13454            self
13455        }
13456
13457        /// Sets the value of [is_locked][crate::model::bucket::RetentionPolicy::is_locked].
13458        pub fn set_is_locked<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
13459            self.is_locked = v.into();
13460            self
13461        }
13462
13463        /// Sets the value of [retention_duration][crate::model::bucket::RetentionPolicy::retention_duration].
13464        pub fn set_retention_duration<T>(mut self, v: T) -> Self
13465        where
13466            T: std::convert::Into<wkt::Duration>,
13467        {
13468            self.retention_duration = std::option::Option::Some(v.into());
13469            self
13470        }
13471
13472        /// Sets or clears the value of [retention_duration][crate::model::bucket::RetentionPolicy::retention_duration].
13473        pub fn set_or_clear_retention_duration<T>(mut self, v: std::option::Option<T>) -> Self
13474        where
13475            T: std::convert::Into<wkt::Duration>,
13476        {
13477            self.retention_duration = v.map(|x| x.into());
13478            self
13479        }
13480    }
13481
13482    impl wkt::message::Message for RetentionPolicy {
13483        fn typename() -> &'static str {
13484            "type.googleapis.com/google.storage.v2.Bucket.RetentionPolicy"
13485        }
13486    }
13487
13488    #[doc(hidden)]
13489    impl<'de> serde::de::Deserialize<'de> for RetentionPolicy {
13490        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
13491        where
13492            D: serde::Deserializer<'de>,
13493        {
13494            #[allow(non_camel_case_types)]
13495            #[doc(hidden)]
13496            #[derive(PartialEq, Eq, Hash)]
13497            enum __FieldTag {
13498                __effective_time,
13499                __is_locked,
13500                __retention_duration,
13501                Unknown(std::string::String),
13502            }
13503            impl<'de> serde::de::Deserialize<'de> for __FieldTag {
13504                fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
13505                where
13506                    D: serde::Deserializer<'de>,
13507                {
13508                    struct Visitor;
13509                    impl<'de> serde::de::Visitor<'de> for Visitor {
13510                        type Value = __FieldTag;
13511                        fn expecting(
13512                            &self,
13513                            formatter: &mut std::fmt::Formatter,
13514                        ) -> std::fmt::Result {
13515                            formatter.write_str("a field name for RetentionPolicy")
13516                        }
13517                        fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
13518                        where
13519                            E: serde::de::Error,
13520                        {
13521                            use std::result::Result::Ok;
13522                            use std::string::ToString;
13523                            match value {
13524                                "effectiveTime" => Ok(__FieldTag::__effective_time),
13525                                "effective_time" => Ok(__FieldTag::__effective_time),
13526                                "isLocked" => Ok(__FieldTag::__is_locked),
13527                                "is_locked" => Ok(__FieldTag::__is_locked),
13528                                "retentionDuration" => Ok(__FieldTag::__retention_duration),
13529                                "retention_duration" => Ok(__FieldTag::__retention_duration),
13530                                _ => Ok(__FieldTag::Unknown(value.to_string())),
13531                            }
13532                        }
13533                    }
13534                    deserializer.deserialize_identifier(Visitor)
13535                }
13536            }
13537            struct Visitor;
13538            impl<'de> serde::de::Visitor<'de> for Visitor {
13539                type Value = RetentionPolicy;
13540                fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
13541                    formatter.write_str("struct RetentionPolicy")
13542                }
13543                fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
13544                where
13545                    A: serde::de::MapAccess<'de>,
13546                {
13547                    #[allow(unused_imports)]
13548                    use serde::de::Error;
13549                    use std::option::Option::Some;
13550                    let mut fields = std::collections::HashSet::new();
13551                    let mut result = Self::Value::new();
13552                    while let Some(tag) = map.next_key::<__FieldTag>()? {
13553                        #[allow(clippy::match_single_binding)]
13554                        match tag {
13555                            __FieldTag::__effective_time => {
13556                                if !fields.insert(__FieldTag::__effective_time) {
13557                                    return std::result::Result::Err(A::Error::duplicate_field(
13558                                        "multiple values for effective_time",
13559                                    ));
13560                                }
13561                                result.effective_time =
13562                                    map.next_value::<std::option::Option<wkt::Timestamp>>()?;
13563                            }
13564                            __FieldTag::__is_locked => {
13565                                if !fields.insert(__FieldTag::__is_locked) {
13566                                    return std::result::Result::Err(A::Error::duplicate_field(
13567                                        "multiple values for is_locked",
13568                                    ));
13569                                }
13570                                result.is_locked = map
13571                                    .next_value::<std::option::Option<bool>>()?
13572                                    .unwrap_or_default();
13573                            }
13574                            __FieldTag::__retention_duration => {
13575                                if !fields.insert(__FieldTag::__retention_duration) {
13576                                    return std::result::Result::Err(A::Error::duplicate_field(
13577                                        "multiple values for retention_duration",
13578                                    ));
13579                                }
13580                                result.retention_duration =
13581                                    map.next_value::<std::option::Option<wkt::Duration>>()?;
13582                            }
13583                            __FieldTag::Unknown(key) => {
13584                                let value = map.next_value::<serde_json::Value>()?;
13585                                result._unknown_fields.insert(key, value);
13586                            }
13587                        }
13588                    }
13589                    std::result::Result::Ok(result)
13590                }
13591            }
13592            deserializer.deserialize_any(Visitor)
13593        }
13594    }
13595
13596    #[doc(hidden)]
13597    impl serde::ser::Serialize for RetentionPolicy {
13598        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
13599        where
13600            S: serde::ser::Serializer,
13601        {
13602            use serde::ser::SerializeMap;
13603            #[allow(unused_imports)]
13604            use std::option::Option::Some;
13605            let mut state = serializer.serialize_map(std::option::Option::None)?;
13606            if self.effective_time.is_some() {
13607                state.serialize_entry("effectiveTime", &self.effective_time)?;
13608            }
13609            if !wkt::internal::is_default(&self.is_locked) {
13610                state.serialize_entry("isLocked", &self.is_locked)?;
13611            }
13612            if self.retention_duration.is_some() {
13613                state.serialize_entry("retentionDuration", &self.retention_duration)?;
13614            }
13615            if !self._unknown_fields.is_empty() {
13616                for (key, value) in self._unknown_fields.iter() {
13617                    state.serialize_entry(key, &value)?;
13618                }
13619            }
13620            state.end()
13621        }
13622    }
13623
13624    /// Soft delete policy properties of a bucket.
13625    #[derive(Clone, Debug, Default, PartialEq)]
13626    #[non_exhaustive]
13627    pub struct SoftDeletePolicy {
13628        /// The period of time that soft-deleted objects in the bucket must be
13629        /// retained and cannot be permanently deleted. The duration must be greater
13630        /// than or equal to 7 days and less than 1 year.
13631        pub retention_duration: std::option::Option<wkt::Duration>,
13632
13633        /// Time from which the policy was effective. This is service-provided.
13634        pub effective_time: std::option::Option<wkt::Timestamp>,
13635
13636        _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
13637    }
13638
13639    impl SoftDeletePolicy {
13640        pub fn new() -> Self {
13641            std::default::Default::default()
13642        }
13643
13644        /// Sets the value of [retention_duration][crate::model::bucket::SoftDeletePolicy::retention_duration].
13645        pub fn set_retention_duration<T>(mut self, v: T) -> Self
13646        where
13647            T: std::convert::Into<wkt::Duration>,
13648        {
13649            self.retention_duration = std::option::Option::Some(v.into());
13650            self
13651        }
13652
13653        /// Sets or clears the value of [retention_duration][crate::model::bucket::SoftDeletePolicy::retention_duration].
13654        pub fn set_or_clear_retention_duration<T>(mut self, v: std::option::Option<T>) -> Self
13655        where
13656            T: std::convert::Into<wkt::Duration>,
13657        {
13658            self.retention_duration = v.map(|x| x.into());
13659            self
13660        }
13661
13662        /// Sets the value of [effective_time][crate::model::bucket::SoftDeletePolicy::effective_time].
13663        pub fn set_effective_time<T>(mut self, v: T) -> Self
13664        where
13665            T: std::convert::Into<wkt::Timestamp>,
13666        {
13667            self.effective_time = std::option::Option::Some(v.into());
13668            self
13669        }
13670
13671        /// Sets or clears the value of [effective_time][crate::model::bucket::SoftDeletePolicy::effective_time].
13672        pub fn set_or_clear_effective_time<T>(mut self, v: std::option::Option<T>) -> Self
13673        where
13674            T: std::convert::Into<wkt::Timestamp>,
13675        {
13676            self.effective_time = v.map(|x| x.into());
13677            self
13678        }
13679    }
13680
13681    impl wkt::message::Message for SoftDeletePolicy {
13682        fn typename() -> &'static str {
13683            "type.googleapis.com/google.storage.v2.Bucket.SoftDeletePolicy"
13684        }
13685    }
13686
13687    #[doc(hidden)]
13688    impl<'de> serde::de::Deserialize<'de> for SoftDeletePolicy {
13689        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
13690        where
13691            D: serde::Deserializer<'de>,
13692        {
13693            #[allow(non_camel_case_types)]
13694            #[doc(hidden)]
13695            #[derive(PartialEq, Eq, Hash)]
13696            enum __FieldTag {
13697                __retention_duration,
13698                __effective_time,
13699                Unknown(std::string::String),
13700            }
13701            impl<'de> serde::de::Deserialize<'de> for __FieldTag {
13702                fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
13703                where
13704                    D: serde::Deserializer<'de>,
13705                {
13706                    struct Visitor;
13707                    impl<'de> serde::de::Visitor<'de> for Visitor {
13708                        type Value = __FieldTag;
13709                        fn expecting(
13710                            &self,
13711                            formatter: &mut std::fmt::Formatter,
13712                        ) -> std::fmt::Result {
13713                            formatter.write_str("a field name for SoftDeletePolicy")
13714                        }
13715                        fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
13716                        where
13717                            E: serde::de::Error,
13718                        {
13719                            use std::result::Result::Ok;
13720                            use std::string::ToString;
13721                            match value {
13722                                "retentionDuration" => Ok(__FieldTag::__retention_duration),
13723                                "retention_duration" => Ok(__FieldTag::__retention_duration),
13724                                "effectiveTime" => Ok(__FieldTag::__effective_time),
13725                                "effective_time" => Ok(__FieldTag::__effective_time),
13726                                _ => Ok(__FieldTag::Unknown(value.to_string())),
13727                            }
13728                        }
13729                    }
13730                    deserializer.deserialize_identifier(Visitor)
13731                }
13732            }
13733            struct Visitor;
13734            impl<'de> serde::de::Visitor<'de> for Visitor {
13735                type Value = SoftDeletePolicy;
13736                fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
13737                    formatter.write_str("struct SoftDeletePolicy")
13738                }
13739                fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
13740                where
13741                    A: serde::de::MapAccess<'de>,
13742                {
13743                    #[allow(unused_imports)]
13744                    use serde::de::Error;
13745                    use std::option::Option::Some;
13746                    let mut fields = std::collections::HashSet::new();
13747                    let mut result = Self::Value::new();
13748                    while let Some(tag) = map.next_key::<__FieldTag>()? {
13749                        #[allow(clippy::match_single_binding)]
13750                        match tag {
13751                            __FieldTag::__retention_duration => {
13752                                if !fields.insert(__FieldTag::__retention_duration) {
13753                                    return std::result::Result::Err(A::Error::duplicate_field(
13754                                        "multiple values for retention_duration",
13755                                    ));
13756                                }
13757                                result.retention_duration =
13758                                    map.next_value::<std::option::Option<wkt::Duration>>()?;
13759                            }
13760                            __FieldTag::__effective_time => {
13761                                if !fields.insert(__FieldTag::__effective_time) {
13762                                    return std::result::Result::Err(A::Error::duplicate_field(
13763                                        "multiple values for effective_time",
13764                                    ));
13765                                }
13766                                result.effective_time =
13767                                    map.next_value::<std::option::Option<wkt::Timestamp>>()?;
13768                            }
13769                            __FieldTag::Unknown(key) => {
13770                                let value = map.next_value::<serde_json::Value>()?;
13771                                result._unknown_fields.insert(key, value);
13772                            }
13773                        }
13774                    }
13775                    std::result::Result::Ok(result)
13776                }
13777            }
13778            deserializer.deserialize_any(Visitor)
13779        }
13780    }
13781
13782    #[doc(hidden)]
13783    impl serde::ser::Serialize for SoftDeletePolicy {
13784        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
13785        where
13786            S: serde::ser::Serializer,
13787        {
13788            use serde::ser::SerializeMap;
13789            #[allow(unused_imports)]
13790            use std::option::Option::Some;
13791            let mut state = serializer.serialize_map(std::option::Option::None)?;
13792            if self.retention_duration.is_some() {
13793                state.serialize_entry("retentionDuration", &self.retention_duration)?;
13794            }
13795            if self.effective_time.is_some() {
13796                state.serialize_entry("effectiveTime", &self.effective_time)?;
13797            }
13798            if !self._unknown_fields.is_empty() {
13799                for (key, value) in self._unknown_fields.iter() {
13800                    state.serialize_entry(key, &value)?;
13801                }
13802            }
13803            state.end()
13804        }
13805    }
13806
13807    /// Properties of a bucket related to versioning.
13808    /// For more on Cloud Storage versioning, see
13809    /// <https://cloud.google.com/storage/docs/object-versioning>.
13810    #[derive(Clone, Debug, Default, PartialEq)]
13811    #[non_exhaustive]
13812    pub struct Versioning {
13813        /// Optional. While set to true, versioning is fully enabled for this bucket.
13814        pub enabled: bool,
13815
13816        _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
13817    }
13818
13819    impl Versioning {
13820        pub fn new() -> Self {
13821            std::default::Default::default()
13822        }
13823
13824        /// Sets the value of [enabled][crate::model::bucket::Versioning::enabled].
13825        pub fn set_enabled<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
13826            self.enabled = v.into();
13827            self
13828        }
13829    }
13830
13831    impl wkt::message::Message for Versioning {
13832        fn typename() -> &'static str {
13833            "type.googleapis.com/google.storage.v2.Bucket.Versioning"
13834        }
13835    }
13836
13837    #[doc(hidden)]
13838    impl<'de> serde::de::Deserialize<'de> for Versioning {
13839        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
13840        where
13841            D: serde::Deserializer<'de>,
13842        {
13843            #[allow(non_camel_case_types)]
13844            #[doc(hidden)]
13845            #[derive(PartialEq, Eq, Hash)]
13846            enum __FieldTag {
13847                __enabled,
13848                Unknown(std::string::String),
13849            }
13850            impl<'de> serde::de::Deserialize<'de> for __FieldTag {
13851                fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
13852                where
13853                    D: serde::Deserializer<'de>,
13854                {
13855                    struct Visitor;
13856                    impl<'de> serde::de::Visitor<'de> for Visitor {
13857                        type Value = __FieldTag;
13858                        fn expecting(
13859                            &self,
13860                            formatter: &mut std::fmt::Formatter,
13861                        ) -> std::fmt::Result {
13862                            formatter.write_str("a field name for Versioning")
13863                        }
13864                        fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
13865                        where
13866                            E: serde::de::Error,
13867                        {
13868                            use std::result::Result::Ok;
13869                            use std::string::ToString;
13870                            match value {
13871                                "enabled" => Ok(__FieldTag::__enabled),
13872                                _ => Ok(__FieldTag::Unknown(value.to_string())),
13873                            }
13874                        }
13875                    }
13876                    deserializer.deserialize_identifier(Visitor)
13877                }
13878            }
13879            struct Visitor;
13880            impl<'de> serde::de::Visitor<'de> for Visitor {
13881                type Value = Versioning;
13882                fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
13883                    formatter.write_str("struct Versioning")
13884                }
13885                fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
13886                where
13887                    A: serde::de::MapAccess<'de>,
13888                {
13889                    #[allow(unused_imports)]
13890                    use serde::de::Error;
13891                    use std::option::Option::Some;
13892                    let mut fields = std::collections::HashSet::new();
13893                    let mut result = Self::Value::new();
13894                    while let Some(tag) = map.next_key::<__FieldTag>()? {
13895                        #[allow(clippy::match_single_binding)]
13896                        match tag {
13897                            __FieldTag::__enabled => {
13898                                if !fields.insert(__FieldTag::__enabled) {
13899                                    return std::result::Result::Err(A::Error::duplicate_field(
13900                                        "multiple values for enabled",
13901                                    ));
13902                                }
13903                                result.enabled = map
13904                                    .next_value::<std::option::Option<bool>>()?
13905                                    .unwrap_or_default();
13906                            }
13907                            __FieldTag::Unknown(key) => {
13908                                let value = map.next_value::<serde_json::Value>()?;
13909                                result._unknown_fields.insert(key, value);
13910                            }
13911                        }
13912                    }
13913                    std::result::Result::Ok(result)
13914                }
13915            }
13916            deserializer.deserialize_any(Visitor)
13917        }
13918    }
13919
13920    #[doc(hidden)]
13921    impl serde::ser::Serialize for Versioning {
13922        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
13923        where
13924            S: serde::ser::Serializer,
13925        {
13926            use serde::ser::SerializeMap;
13927            #[allow(unused_imports)]
13928            use std::option::Option::Some;
13929            let mut state = serializer.serialize_map(std::option::Option::None)?;
13930            if !wkt::internal::is_default(&self.enabled) {
13931                state.serialize_entry("enabled", &self.enabled)?;
13932            }
13933            if !self._unknown_fields.is_empty() {
13934                for (key, value) in self._unknown_fields.iter() {
13935                    state.serialize_entry(key, &value)?;
13936                }
13937            }
13938            state.end()
13939        }
13940    }
13941
13942    /// Properties of a bucket related to accessing the contents as a static
13943    /// website. For more on hosting a static website via Cloud Storage, see
13944    /// <https://cloud.google.com/storage/docs/hosting-static-website>.
13945    #[derive(Clone, Debug, Default, PartialEq)]
13946    #[non_exhaustive]
13947    pub struct Website {
13948        /// Optional. If the requested object path is missing, the service will
13949        /// ensure the path has a trailing '/', append this suffix, and attempt to
13950        /// retrieve the resulting object. This allows the creation of `index.html`
13951        /// objects to represent directory pages.
13952        pub main_page_suffix: std::string::String,
13953
13954        /// Optional. If the requested object path is missing, and any
13955        /// `mainPageSuffix` object is missing, if applicable, the service
13956        /// will return the named object from this bucket as the content for a
13957        /// [<https://tools.ietf.org/html/rfc7231#section-6.5.4>][404 Not Found]
13958        /// result.
13959        pub not_found_page: std::string::String,
13960
13961        _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
13962    }
13963
13964    impl Website {
13965        pub fn new() -> Self {
13966            std::default::Default::default()
13967        }
13968
13969        /// Sets the value of [main_page_suffix][crate::model::bucket::Website::main_page_suffix].
13970        pub fn set_main_page_suffix<T: std::convert::Into<std::string::String>>(
13971            mut self,
13972            v: T,
13973        ) -> Self {
13974            self.main_page_suffix = v.into();
13975            self
13976        }
13977
13978        /// Sets the value of [not_found_page][crate::model::bucket::Website::not_found_page].
13979        pub fn set_not_found_page<T: std::convert::Into<std::string::String>>(
13980            mut self,
13981            v: T,
13982        ) -> Self {
13983            self.not_found_page = v.into();
13984            self
13985        }
13986    }
13987
13988    impl wkt::message::Message for Website {
13989        fn typename() -> &'static str {
13990            "type.googleapis.com/google.storage.v2.Bucket.Website"
13991        }
13992    }
13993
13994    #[doc(hidden)]
13995    impl<'de> serde::de::Deserialize<'de> for Website {
13996        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
13997        where
13998            D: serde::Deserializer<'de>,
13999        {
14000            #[allow(non_camel_case_types)]
14001            #[doc(hidden)]
14002            #[derive(PartialEq, Eq, Hash)]
14003            enum __FieldTag {
14004                __main_page_suffix,
14005                __not_found_page,
14006                Unknown(std::string::String),
14007            }
14008            impl<'de> serde::de::Deserialize<'de> for __FieldTag {
14009                fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
14010                where
14011                    D: serde::Deserializer<'de>,
14012                {
14013                    struct Visitor;
14014                    impl<'de> serde::de::Visitor<'de> for Visitor {
14015                        type Value = __FieldTag;
14016                        fn expecting(
14017                            &self,
14018                            formatter: &mut std::fmt::Formatter,
14019                        ) -> std::fmt::Result {
14020                            formatter.write_str("a field name for Website")
14021                        }
14022                        fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
14023                        where
14024                            E: serde::de::Error,
14025                        {
14026                            use std::result::Result::Ok;
14027                            use std::string::ToString;
14028                            match value {
14029                                "mainPageSuffix" => Ok(__FieldTag::__main_page_suffix),
14030                                "main_page_suffix" => Ok(__FieldTag::__main_page_suffix),
14031                                "notFoundPage" => Ok(__FieldTag::__not_found_page),
14032                                "not_found_page" => Ok(__FieldTag::__not_found_page),
14033                                _ => Ok(__FieldTag::Unknown(value.to_string())),
14034                            }
14035                        }
14036                    }
14037                    deserializer.deserialize_identifier(Visitor)
14038                }
14039            }
14040            struct Visitor;
14041            impl<'de> serde::de::Visitor<'de> for Visitor {
14042                type Value = Website;
14043                fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
14044                    formatter.write_str("struct Website")
14045                }
14046                fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
14047                where
14048                    A: serde::de::MapAccess<'de>,
14049                {
14050                    #[allow(unused_imports)]
14051                    use serde::de::Error;
14052                    use std::option::Option::Some;
14053                    let mut fields = std::collections::HashSet::new();
14054                    let mut result = Self::Value::new();
14055                    while let Some(tag) = map.next_key::<__FieldTag>()? {
14056                        #[allow(clippy::match_single_binding)]
14057                        match tag {
14058                            __FieldTag::__main_page_suffix => {
14059                                if !fields.insert(__FieldTag::__main_page_suffix) {
14060                                    return std::result::Result::Err(A::Error::duplicate_field(
14061                                        "multiple values for main_page_suffix",
14062                                    ));
14063                                }
14064                                result.main_page_suffix = map
14065                                    .next_value::<std::option::Option<std::string::String>>()?
14066                                    .unwrap_or_default();
14067                            }
14068                            __FieldTag::__not_found_page => {
14069                                if !fields.insert(__FieldTag::__not_found_page) {
14070                                    return std::result::Result::Err(A::Error::duplicate_field(
14071                                        "multiple values for not_found_page",
14072                                    ));
14073                                }
14074                                result.not_found_page = map
14075                                    .next_value::<std::option::Option<std::string::String>>()?
14076                                    .unwrap_or_default();
14077                            }
14078                            __FieldTag::Unknown(key) => {
14079                                let value = map.next_value::<serde_json::Value>()?;
14080                                result._unknown_fields.insert(key, value);
14081                            }
14082                        }
14083                    }
14084                    std::result::Result::Ok(result)
14085                }
14086            }
14087            deserializer.deserialize_any(Visitor)
14088        }
14089    }
14090
14091    #[doc(hidden)]
14092    impl serde::ser::Serialize for Website {
14093        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
14094        where
14095            S: serde::ser::Serializer,
14096        {
14097            use serde::ser::SerializeMap;
14098            #[allow(unused_imports)]
14099            use std::option::Option::Some;
14100            let mut state = serializer.serialize_map(std::option::Option::None)?;
14101            if !self.main_page_suffix.is_empty() {
14102                state.serialize_entry("mainPageSuffix", &self.main_page_suffix)?;
14103            }
14104            if !self.not_found_page.is_empty() {
14105                state.serialize_entry("notFoundPage", &self.not_found_page)?;
14106            }
14107            if !self._unknown_fields.is_empty() {
14108                for (key, value) in self._unknown_fields.iter() {
14109                    state.serialize_entry(key, &value)?;
14110                }
14111            }
14112            state.end()
14113        }
14114    }
14115
14116    /// Configuration for Custom Dual Regions.  It should specify precisely two
14117    /// eligible regions within the same Multiregion. More information on regions
14118    /// may be found [here](https://cloud.google.com/storage/docs/locations).
14119    #[derive(Clone, Debug, Default, PartialEq)]
14120    #[non_exhaustive]
14121    pub struct CustomPlacementConfig {
14122        /// Optional. List of locations to use for data placement.
14123        pub data_locations: std::vec::Vec<std::string::String>,
14124
14125        _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
14126    }
14127
14128    impl CustomPlacementConfig {
14129        pub fn new() -> Self {
14130            std::default::Default::default()
14131        }
14132
14133        /// Sets the value of [data_locations][crate::model::bucket::CustomPlacementConfig::data_locations].
14134        pub fn set_data_locations<T, V>(mut self, v: T) -> Self
14135        where
14136            T: std::iter::IntoIterator<Item = V>,
14137            V: std::convert::Into<std::string::String>,
14138        {
14139            use std::iter::Iterator;
14140            self.data_locations = v.into_iter().map(|i| i.into()).collect();
14141            self
14142        }
14143    }
14144
14145    impl wkt::message::Message for CustomPlacementConfig {
14146        fn typename() -> &'static str {
14147            "type.googleapis.com/google.storage.v2.Bucket.CustomPlacementConfig"
14148        }
14149    }
14150
14151    #[doc(hidden)]
14152    impl<'de> serde::de::Deserialize<'de> for CustomPlacementConfig {
14153        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
14154        where
14155            D: serde::Deserializer<'de>,
14156        {
14157            #[allow(non_camel_case_types)]
14158            #[doc(hidden)]
14159            #[derive(PartialEq, Eq, Hash)]
14160            enum __FieldTag {
14161                __data_locations,
14162                Unknown(std::string::String),
14163            }
14164            impl<'de> serde::de::Deserialize<'de> for __FieldTag {
14165                fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
14166                where
14167                    D: serde::Deserializer<'de>,
14168                {
14169                    struct Visitor;
14170                    impl<'de> serde::de::Visitor<'de> for Visitor {
14171                        type Value = __FieldTag;
14172                        fn expecting(
14173                            &self,
14174                            formatter: &mut std::fmt::Formatter,
14175                        ) -> std::fmt::Result {
14176                            formatter.write_str("a field name for CustomPlacementConfig")
14177                        }
14178                        fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
14179                        where
14180                            E: serde::de::Error,
14181                        {
14182                            use std::result::Result::Ok;
14183                            use std::string::ToString;
14184                            match value {
14185                                "dataLocations" => Ok(__FieldTag::__data_locations),
14186                                "data_locations" => Ok(__FieldTag::__data_locations),
14187                                _ => Ok(__FieldTag::Unknown(value.to_string())),
14188                            }
14189                        }
14190                    }
14191                    deserializer.deserialize_identifier(Visitor)
14192                }
14193            }
14194            struct Visitor;
14195            impl<'de> serde::de::Visitor<'de> for Visitor {
14196                type Value = CustomPlacementConfig;
14197                fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
14198                    formatter.write_str("struct CustomPlacementConfig")
14199                }
14200                fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
14201                where
14202                    A: serde::de::MapAccess<'de>,
14203                {
14204                    #[allow(unused_imports)]
14205                    use serde::de::Error;
14206                    use std::option::Option::Some;
14207                    let mut fields = std::collections::HashSet::new();
14208                    let mut result = Self::Value::new();
14209                    while let Some(tag) = map.next_key::<__FieldTag>()? {
14210                        #[allow(clippy::match_single_binding)]
14211                        match tag {
14212                            __FieldTag::__data_locations => {
14213                                if !fields.insert(__FieldTag::__data_locations) {
14214                                    return std::result::Result::Err(A::Error::duplicate_field(
14215                                        "multiple values for data_locations",
14216                                    ));
14217                                }
14218                                result.data_locations = map.next_value::<std::option::Option<std::vec::Vec<std::string::String>>>()?.unwrap_or_default();
14219                            }
14220                            __FieldTag::Unknown(key) => {
14221                                let value = map.next_value::<serde_json::Value>()?;
14222                                result._unknown_fields.insert(key, value);
14223                            }
14224                        }
14225                    }
14226                    std::result::Result::Ok(result)
14227                }
14228            }
14229            deserializer.deserialize_any(Visitor)
14230        }
14231    }
14232
14233    #[doc(hidden)]
14234    impl serde::ser::Serialize for CustomPlacementConfig {
14235        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
14236        where
14237            S: serde::ser::Serializer,
14238        {
14239            use serde::ser::SerializeMap;
14240            #[allow(unused_imports)]
14241            use std::option::Option::Some;
14242            let mut state = serializer.serialize_map(std::option::Option::None)?;
14243            if !self.data_locations.is_empty() {
14244                state.serialize_entry("dataLocations", &self.data_locations)?;
14245            }
14246            if !self._unknown_fields.is_empty() {
14247                for (key, value) in self._unknown_fields.iter() {
14248                    state.serialize_entry(key, &value)?;
14249                }
14250            }
14251            state.end()
14252        }
14253    }
14254
14255    /// Configuration for a bucket's Autoclass feature.
14256    #[derive(Clone, Debug, Default, PartialEq)]
14257    #[non_exhaustive]
14258    pub struct Autoclass {
14259        /// Optional. Enables Autoclass.
14260        pub enabled: bool,
14261
14262        /// Output only. Latest instant at which the `enabled` field was set to true
14263        /// after being disabled/unconfigured or set to false after being enabled. If
14264        /// Autoclass is enabled when the bucket is created, the toggle_time is set
14265        /// to the bucket creation time.
14266        pub toggle_time: std::option::Option<wkt::Timestamp>,
14267
14268        /// An object in an Autoclass bucket will eventually cool down to the
14269        /// terminal storage class if there is no access to the object.
14270        /// The only valid values are NEARLINE and ARCHIVE.
14271        pub terminal_storage_class: std::option::Option<std::string::String>,
14272
14273        /// Output only. Latest instant at which the autoclass terminal storage class
14274        /// was updated.
14275        pub terminal_storage_class_update_time: std::option::Option<wkt::Timestamp>,
14276
14277        _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
14278    }
14279
14280    impl Autoclass {
14281        pub fn new() -> Self {
14282            std::default::Default::default()
14283        }
14284
14285        /// Sets the value of [enabled][crate::model::bucket::Autoclass::enabled].
14286        pub fn set_enabled<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
14287            self.enabled = v.into();
14288            self
14289        }
14290
14291        /// Sets the value of [toggle_time][crate::model::bucket::Autoclass::toggle_time].
14292        pub fn set_toggle_time<T>(mut self, v: T) -> Self
14293        where
14294            T: std::convert::Into<wkt::Timestamp>,
14295        {
14296            self.toggle_time = std::option::Option::Some(v.into());
14297            self
14298        }
14299
14300        /// Sets or clears the value of [toggle_time][crate::model::bucket::Autoclass::toggle_time].
14301        pub fn set_or_clear_toggle_time<T>(mut self, v: std::option::Option<T>) -> Self
14302        where
14303            T: std::convert::Into<wkt::Timestamp>,
14304        {
14305            self.toggle_time = v.map(|x| x.into());
14306            self
14307        }
14308
14309        /// Sets the value of [terminal_storage_class][crate::model::bucket::Autoclass::terminal_storage_class].
14310        pub fn set_terminal_storage_class<T>(mut self, v: T) -> Self
14311        where
14312            T: std::convert::Into<std::string::String>,
14313        {
14314            self.terminal_storage_class = std::option::Option::Some(v.into());
14315            self
14316        }
14317
14318        /// Sets or clears the value of [terminal_storage_class][crate::model::bucket::Autoclass::terminal_storage_class].
14319        pub fn set_or_clear_terminal_storage_class<T>(mut self, v: std::option::Option<T>) -> Self
14320        where
14321            T: std::convert::Into<std::string::String>,
14322        {
14323            self.terminal_storage_class = v.map(|x| x.into());
14324            self
14325        }
14326
14327        /// Sets the value of [terminal_storage_class_update_time][crate::model::bucket::Autoclass::terminal_storage_class_update_time].
14328        pub fn set_terminal_storage_class_update_time<T>(mut self, v: T) -> Self
14329        where
14330            T: std::convert::Into<wkt::Timestamp>,
14331        {
14332            self.terminal_storage_class_update_time = std::option::Option::Some(v.into());
14333            self
14334        }
14335
14336        /// Sets or clears the value of [terminal_storage_class_update_time][crate::model::bucket::Autoclass::terminal_storage_class_update_time].
14337        pub fn set_or_clear_terminal_storage_class_update_time<T>(
14338            mut self,
14339            v: std::option::Option<T>,
14340        ) -> Self
14341        where
14342            T: std::convert::Into<wkt::Timestamp>,
14343        {
14344            self.terminal_storage_class_update_time = v.map(|x| x.into());
14345            self
14346        }
14347    }
14348
14349    impl wkt::message::Message for Autoclass {
14350        fn typename() -> &'static str {
14351            "type.googleapis.com/google.storage.v2.Bucket.Autoclass"
14352        }
14353    }
14354
14355    #[doc(hidden)]
14356    impl<'de> serde::de::Deserialize<'de> for Autoclass {
14357        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
14358        where
14359            D: serde::Deserializer<'de>,
14360        {
14361            #[allow(non_camel_case_types)]
14362            #[doc(hidden)]
14363            #[derive(PartialEq, Eq, Hash)]
14364            enum __FieldTag {
14365                __enabled,
14366                __toggle_time,
14367                __terminal_storage_class,
14368                __terminal_storage_class_update_time,
14369                Unknown(std::string::String),
14370            }
14371            impl<'de> serde::de::Deserialize<'de> for __FieldTag {
14372                fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
14373                where
14374                    D: serde::Deserializer<'de>,
14375                {
14376                    struct Visitor;
14377                    impl<'de> serde::de::Visitor<'de> for Visitor {
14378                        type Value = __FieldTag;
14379                        fn expecting(
14380                            &self,
14381                            formatter: &mut std::fmt::Formatter,
14382                        ) -> std::fmt::Result {
14383                            formatter.write_str("a field name for Autoclass")
14384                        }
14385                        fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
14386                        where
14387                            E: serde::de::Error,
14388                        {
14389                            use std::result::Result::Ok;
14390                            use std::string::ToString;
14391                            match value {
14392                                "enabled" => Ok(__FieldTag::__enabled),
14393                                "toggleTime" => Ok(__FieldTag::__toggle_time),
14394                                "toggle_time" => Ok(__FieldTag::__toggle_time),
14395                                "terminalStorageClass" => Ok(__FieldTag::__terminal_storage_class),
14396                                "terminal_storage_class" => {
14397                                    Ok(__FieldTag::__terminal_storage_class)
14398                                }
14399                                "terminalStorageClassUpdateTime" => {
14400                                    Ok(__FieldTag::__terminal_storage_class_update_time)
14401                                }
14402                                "terminal_storage_class_update_time" => {
14403                                    Ok(__FieldTag::__terminal_storage_class_update_time)
14404                                }
14405                                _ => Ok(__FieldTag::Unknown(value.to_string())),
14406                            }
14407                        }
14408                    }
14409                    deserializer.deserialize_identifier(Visitor)
14410                }
14411            }
14412            struct Visitor;
14413            impl<'de> serde::de::Visitor<'de> for Visitor {
14414                type Value = Autoclass;
14415                fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
14416                    formatter.write_str("struct Autoclass")
14417                }
14418                fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
14419                where
14420                    A: serde::de::MapAccess<'de>,
14421                {
14422                    #[allow(unused_imports)]
14423                    use serde::de::Error;
14424                    use std::option::Option::Some;
14425                    let mut fields = std::collections::HashSet::new();
14426                    let mut result = Self::Value::new();
14427                    while let Some(tag) = map.next_key::<__FieldTag>()? {
14428                        #[allow(clippy::match_single_binding)]
14429                        match tag {
14430                            __FieldTag::__enabled => {
14431                                if !fields.insert(__FieldTag::__enabled) {
14432                                    return std::result::Result::Err(A::Error::duplicate_field(
14433                                        "multiple values for enabled",
14434                                    ));
14435                                }
14436                                result.enabled = map
14437                                    .next_value::<std::option::Option<bool>>()?
14438                                    .unwrap_or_default();
14439                            }
14440                            __FieldTag::__toggle_time => {
14441                                if !fields.insert(__FieldTag::__toggle_time) {
14442                                    return std::result::Result::Err(A::Error::duplicate_field(
14443                                        "multiple values for toggle_time",
14444                                    ));
14445                                }
14446                                result.toggle_time =
14447                                    map.next_value::<std::option::Option<wkt::Timestamp>>()?;
14448                            }
14449                            __FieldTag::__terminal_storage_class => {
14450                                if !fields.insert(__FieldTag::__terminal_storage_class) {
14451                                    return std::result::Result::Err(A::Error::duplicate_field(
14452                                        "multiple values for terminal_storage_class",
14453                                    ));
14454                                }
14455                                result.terminal_storage_class =
14456                                    map.next_value::<std::option::Option<std::string::String>>()?;
14457                            }
14458                            __FieldTag::__terminal_storage_class_update_time => {
14459                                if !fields.insert(__FieldTag::__terminal_storage_class_update_time)
14460                                {
14461                                    return std::result::Result::Err(A::Error::duplicate_field(
14462                                        "multiple values for terminal_storage_class_update_time",
14463                                    ));
14464                                }
14465                                result.terminal_storage_class_update_time =
14466                                    map.next_value::<std::option::Option<wkt::Timestamp>>()?;
14467                            }
14468                            __FieldTag::Unknown(key) => {
14469                                let value = map.next_value::<serde_json::Value>()?;
14470                                result._unknown_fields.insert(key, value);
14471                            }
14472                        }
14473                    }
14474                    std::result::Result::Ok(result)
14475                }
14476            }
14477            deserializer.deserialize_any(Visitor)
14478        }
14479    }
14480
14481    #[doc(hidden)]
14482    impl serde::ser::Serialize for Autoclass {
14483        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
14484        where
14485            S: serde::ser::Serializer,
14486        {
14487            use serde::ser::SerializeMap;
14488            #[allow(unused_imports)]
14489            use std::option::Option::Some;
14490            let mut state = serializer.serialize_map(std::option::Option::None)?;
14491            if !wkt::internal::is_default(&self.enabled) {
14492                state.serialize_entry("enabled", &self.enabled)?;
14493            }
14494            if self.toggle_time.is_some() {
14495                state.serialize_entry("toggleTime", &self.toggle_time)?;
14496            }
14497            if self.terminal_storage_class.is_some() {
14498                state.serialize_entry("terminalStorageClass", &self.terminal_storage_class)?;
14499            }
14500            if self.terminal_storage_class_update_time.is_some() {
14501                state.serialize_entry(
14502                    "terminalStorageClassUpdateTime",
14503                    &self.terminal_storage_class_update_time,
14504                )?;
14505            }
14506            if !self._unknown_fields.is_empty() {
14507                for (key, value) in self._unknown_fields.iter() {
14508                    state.serialize_entry(key, &value)?;
14509                }
14510            }
14511            state.end()
14512        }
14513    }
14514
14515    /// The [bucket IP
14516    /// filtering](https://cloud.google.com/storage/docs/ip-filtering-overview)
14517    /// configuration. Specifies the network sources that can access the bucket, as
14518    /// well as its underlying objects.
14519    #[derive(Clone, Debug, Default, PartialEq)]
14520    #[non_exhaustive]
14521    pub struct IpFilter {
14522        /// The state of the IP filter configuration. Valid values are `Enabled` and
14523        /// `Disabled`. When set to `Enabled`, IP filtering rules are applied to a
14524        /// bucket and all incoming requests to the bucket are evaluated against
14525        /// these rules. When set to `Disabled`, IP filtering rules are not applied
14526        /// to a bucket.".
14527        pub mode: std::option::Option<std::string::String>,
14528
14529        /// Public IPs allowed to operate or access the bucket.
14530        pub public_network_source:
14531            std::option::Option<crate::model::bucket::ip_filter::PublicNetworkSource>,
14532
14533        /// Optional. The list of network sources that are allowed to access
14534        /// operations on the bucket or the underlying objects.
14535        pub vpc_network_sources: std::vec::Vec<crate::model::bucket::ip_filter::VpcNetworkSource>,
14536
14537        /// Optional. Whether or not to allow VPCs from orgs different than the
14538        /// bucket's parent org to access the bucket. When set to true, validations
14539        /// on the existence of the VPCs won't be performed. If set to false, each
14540        /// VPC network source will be checked to belong to the same org as the
14541        /// bucket as well as validated for existence.
14542        pub allow_cross_org_vpcs: bool,
14543
14544        /// Whether or not to allow all P4SA access to the bucket. When set to true,
14545        /// IP filter config validation will not apply.
14546        pub allow_all_service_agent_access: std::option::Option<bool>,
14547
14548        _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
14549    }
14550
14551    impl IpFilter {
14552        pub fn new() -> Self {
14553            std::default::Default::default()
14554        }
14555
14556        /// Sets the value of [mode][crate::model::bucket::IpFilter::mode].
14557        pub fn set_mode<T>(mut self, v: T) -> Self
14558        where
14559            T: std::convert::Into<std::string::String>,
14560        {
14561            self.mode = std::option::Option::Some(v.into());
14562            self
14563        }
14564
14565        /// Sets or clears the value of [mode][crate::model::bucket::IpFilter::mode].
14566        pub fn set_or_clear_mode<T>(mut self, v: std::option::Option<T>) -> Self
14567        where
14568            T: std::convert::Into<std::string::String>,
14569        {
14570            self.mode = v.map(|x| x.into());
14571            self
14572        }
14573
14574        /// Sets the value of [public_network_source][crate::model::bucket::IpFilter::public_network_source].
14575        pub fn set_public_network_source<T>(mut self, v: T) -> Self
14576        where
14577            T: std::convert::Into<crate::model::bucket::ip_filter::PublicNetworkSource>,
14578        {
14579            self.public_network_source = std::option::Option::Some(v.into());
14580            self
14581        }
14582
14583        /// Sets or clears the value of [public_network_source][crate::model::bucket::IpFilter::public_network_source].
14584        pub fn set_or_clear_public_network_source<T>(mut self, v: std::option::Option<T>) -> Self
14585        where
14586            T: std::convert::Into<crate::model::bucket::ip_filter::PublicNetworkSource>,
14587        {
14588            self.public_network_source = v.map(|x| x.into());
14589            self
14590        }
14591
14592        /// Sets the value of [vpc_network_sources][crate::model::bucket::IpFilter::vpc_network_sources].
14593        pub fn set_vpc_network_sources<T, V>(mut self, v: T) -> Self
14594        where
14595            T: std::iter::IntoIterator<Item = V>,
14596            V: std::convert::Into<crate::model::bucket::ip_filter::VpcNetworkSource>,
14597        {
14598            use std::iter::Iterator;
14599            self.vpc_network_sources = v.into_iter().map(|i| i.into()).collect();
14600            self
14601        }
14602
14603        /// Sets the value of [allow_cross_org_vpcs][crate::model::bucket::IpFilter::allow_cross_org_vpcs].
14604        pub fn set_allow_cross_org_vpcs<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
14605            self.allow_cross_org_vpcs = v.into();
14606            self
14607        }
14608
14609        /// Sets the value of [allow_all_service_agent_access][crate::model::bucket::IpFilter::allow_all_service_agent_access].
14610        pub fn set_allow_all_service_agent_access<T>(mut self, v: T) -> Self
14611        where
14612            T: std::convert::Into<bool>,
14613        {
14614            self.allow_all_service_agent_access = std::option::Option::Some(v.into());
14615            self
14616        }
14617
14618        /// Sets or clears the value of [allow_all_service_agent_access][crate::model::bucket::IpFilter::allow_all_service_agent_access].
14619        pub fn set_or_clear_allow_all_service_agent_access<T>(
14620            mut self,
14621            v: std::option::Option<T>,
14622        ) -> Self
14623        where
14624            T: std::convert::Into<bool>,
14625        {
14626            self.allow_all_service_agent_access = v.map(|x| x.into());
14627            self
14628        }
14629    }
14630
14631    impl wkt::message::Message for IpFilter {
14632        fn typename() -> &'static str {
14633            "type.googleapis.com/google.storage.v2.Bucket.IpFilter"
14634        }
14635    }
14636
14637    #[doc(hidden)]
14638    impl<'de> serde::de::Deserialize<'de> for IpFilter {
14639        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
14640        where
14641            D: serde::Deserializer<'de>,
14642        {
14643            #[allow(non_camel_case_types)]
14644            #[doc(hidden)]
14645            #[derive(PartialEq, Eq, Hash)]
14646            enum __FieldTag {
14647                __mode,
14648                __public_network_source,
14649                __vpc_network_sources,
14650                __allow_cross_org_vpcs,
14651                __allow_all_service_agent_access,
14652                Unknown(std::string::String),
14653            }
14654            impl<'de> serde::de::Deserialize<'de> for __FieldTag {
14655                fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
14656                where
14657                    D: serde::Deserializer<'de>,
14658                {
14659                    struct Visitor;
14660                    impl<'de> serde::de::Visitor<'de> for Visitor {
14661                        type Value = __FieldTag;
14662                        fn expecting(
14663                            &self,
14664                            formatter: &mut std::fmt::Formatter,
14665                        ) -> std::fmt::Result {
14666                            formatter.write_str("a field name for IpFilter")
14667                        }
14668                        fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
14669                        where
14670                            E: serde::de::Error,
14671                        {
14672                            use std::result::Result::Ok;
14673                            use std::string::ToString;
14674                            match value {
14675                                "mode" => Ok(__FieldTag::__mode),
14676                                "publicNetworkSource" => Ok(__FieldTag::__public_network_source),
14677                                "public_network_source" => Ok(__FieldTag::__public_network_source),
14678                                "vpcNetworkSources" => Ok(__FieldTag::__vpc_network_sources),
14679                                "vpc_network_sources" => Ok(__FieldTag::__vpc_network_sources),
14680                                "allowCrossOrgVpcs" => Ok(__FieldTag::__allow_cross_org_vpcs),
14681                                "allow_cross_org_vpcs" => Ok(__FieldTag::__allow_cross_org_vpcs),
14682                                "allowAllServiceAgentAccess" => {
14683                                    Ok(__FieldTag::__allow_all_service_agent_access)
14684                                }
14685                                "allow_all_service_agent_access" => {
14686                                    Ok(__FieldTag::__allow_all_service_agent_access)
14687                                }
14688                                _ => Ok(__FieldTag::Unknown(value.to_string())),
14689                            }
14690                        }
14691                    }
14692                    deserializer.deserialize_identifier(Visitor)
14693                }
14694            }
14695            struct Visitor;
14696            impl<'de> serde::de::Visitor<'de> for Visitor {
14697                type Value = IpFilter;
14698                fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
14699                    formatter.write_str("struct IpFilter")
14700                }
14701                fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
14702                where
14703                    A: serde::de::MapAccess<'de>,
14704                {
14705                    #[allow(unused_imports)]
14706                    use serde::de::Error;
14707                    use std::option::Option::Some;
14708                    let mut fields = std::collections::HashSet::new();
14709                    let mut result = Self::Value::new();
14710                    while let Some(tag) = map.next_key::<__FieldTag>()? {
14711                        #[allow(clippy::match_single_binding)]
14712                        match tag {
14713                            __FieldTag::__mode => {
14714                                if !fields.insert(__FieldTag::__mode) {
14715                                    return std::result::Result::Err(A::Error::duplicate_field(
14716                                        "multiple values for mode",
14717                                    ));
14718                                }
14719                                result.mode =
14720                                    map.next_value::<std::option::Option<std::string::String>>()?;
14721                            }
14722                            __FieldTag::__public_network_source => {
14723                                if !fields.insert(__FieldTag::__public_network_source) {
14724                                    return std::result::Result::Err(A::Error::duplicate_field(
14725                                        "multiple values for public_network_source",
14726                                    ));
14727                                }
14728                                result.public_network_source = map
14729                                    .next_value::<std::option::Option<
14730                                        crate::model::bucket::ip_filter::PublicNetworkSource,
14731                                    >>()?;
14732                            }
14733                            __FieldTag::__vpc_network_sources => {
14734                                if !fields.insert(__FieldTag::__vpc_network_sources) {
14735                                    return std::result::Result::Err(A::Error::duplicate_field(
14736                                        "multiple values for vpc_network_sources",
14737                                    ));
14738                                }
14739                                result.vpc_network_sources = map
14740                                    .next_value::<std::option::Option<
14741                                        std::vec::Vec<
14742                                            crate::model::bucket::ip_filter::VpcNetworkSource,
14743                                        >,
14744                                    >>()?
14745                                    .unwrap_or_default();
14746                            }
14747                            __FieldTag::__allow_cross_org_vpcs => {
14748                                if !fields.insert(__FieldTag::__allow_cross_org_vpcs) {
14749                                    return std::result::Result::Err(A::Error::duplicate_field(
14750                                        "multiple values for allow_cross_org_vpcs",
14751                                    ));
14752                                }
14753                                result.allow_cross_org_vpcs = map
14754                                    .next_value::<std::option::Option<bool>>()?
14755                                    .unwrap_or_default();
14756                            }
14757                            __FieldTag::__allow_all_service_agent_access => {
14758                                if !fields.insert(__FieldTag::__allow_all_service_agent_access) {
14759                                    return std::result::Result::Err(A::Error::duplicate_field(
14760                                        "multiple values for allow_all_service_agent_access",
14761                                    ));
14762                                }
14763                                result.allow_all_service_agent_access =
14764                                    map.next_value::<std::option::Option<bool>>()?;
14765                            }
14766                            __FieldTag::Unknown(key) => {
14767                                let value = map.next_value::<serde_json::Value>()?;
14768                                result._unknown_fields.insert(key, value);
14769                            }
14770                        }
14771                    }
14772                    std::result::Result::Ok(result)
14773                }
14774            }
14775            deserializer.deserialize_any(Visitor)
14776        }
14777    }
14778
14779    #[doc(hidden)]
14780    impl serde::ser::Serialize for IpFilter {
14781        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
14782        where
14783            S: serde::ser::Serializer,
14784        {
14785            use serde::ser::SerializeMap;
14786            #[allow(unused_imports)]
14787            use std::option::Option::Some;
14788            let mut state = serializer.serialize_map(std::option::Option::None)?;
14789            if self.mode.is_some() {
14790                state.serialize_entry("mode", &self.mode)?;
14791            }
14792            if self.public_network_source.is_some() {
14793                state.serialize_entry("publicNetworkSource", &self.public_network_source)?;
14794            }
14795            if !self.vpc_network_sources.is_empty() {
14796                state.serialize_entry("vpcNetworkSources", &self.vpc_network_sources)?;
14797            }
14798            if !wkt::internal::is_default(&self.allow_cross_org_vpcs) {
14799                state.serialize_entry("allowCrossOrgVpcs", &self.allow_cross_org_vpcs)?;
14800            }
14801            if self.allow_all_service_agent_access.is_some() {
14802                state.serialize_entry(
14803                    "allowAllServiceAgentAccess",
14804                    &self.allow_all_service_agent_access,
14805                )?;
14806            }
14807            if !self._unknown_fields.is_empty() {
14808                for (key, value) in self._unknown_fields.iter() {
14809                    state.serialize_entry(key, &value)?;
14810                }
14811            }
14812            state.end()
14813        }
14814    }
14815
14816    /// Defines additional types related to [IpFilter].
14817    pub mod ip_filter {
14818        #[allow(unused_imports)]
14819        use super::*;
14820
14821        /// The public network IP address ranges that can access the bucket and its
14822        /// data.
14823        #[derive(Clone, Debug, Default, PartialEq)]
14824        #[non_exhaustive]
14825        pub struct PublicNetworkSource {
14826            /// Optional. The list of IPv4 and IPv6 cidr blocks that are allowed to
14827            /// operate or access the bucket and its underlying objects.
14828            pub allowed_ip_cidr_ranges: std::vec::Vec<std::string::String>,
14829
14830            _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
14831        }
14832
14833        impl PublicNetworkSource {
14834            pub fn new() -> Self {
14835                std::default::Default::default()
14836            }
14837
14838            /// Sets the value of [allowed_ip_cidr_ranges][crate::model::bucket::ip_filter::PublicNetworkSource::allowed_ip_cidr_ranges].
14839            pub fn set_allowed_ip_cidr_ranges<T, V>(mut self, v: T) -> Self
14840            where
14841                T: std::iter::IntoIterator<Item = V>,
14842                V: std::convert::Into<std::string::String>,
14843            {
14844                use std::iter::Iterator;
14845                self.allowed_ip_cidr_ranges = v.into_iter().map(|i| i.into()).collect();
14846                self
14847            }
14848        }
14849
14850        impl wkt::message::Message for PublicNetworkSource {
14851            fn typename() -> &'static str {
14852                "type.googleapis.com/google.storage.v2.Bucket.IpFilter.PublicNetworkSource"
14853            }
14854        }
14855
14856        #[doc(hidden)]
14857        impl<'de> serde::de::Deserialize<'de> for PublicNetworkSource {
14858            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
14859            where
14860                D: serde::Deserializer<'de>,
14861            {
14862                #[allow(non_camel_case_types)]
14863                #[doc(hidden)]
14864                #[derive(PartialEq, Eq, Hash)]
14865                enum __FieldTag {
14866                    __allowed_ip_cidr_ranges,
14867                    Unknown(std::string::String),
14868                }
14869                impl<'de> serde::de::Deserialize<'de> for __FieldTag {
14870                    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
14871                    where
14872                        D: serde::Deserializer<'de>,
14873                    {
14874                        struct Visitor;
14875                        impl<'de> serde::de::Visitor<'de> for Visitor {
14876                            type Value = __FieldTag;
14877                            fn expecting(
14878                                &self,
14879                                formatter: &mut std::fmt::Formatter,
14880                            ) -> std::fmt::Result {
14881                                formatter.write_str("a field name for PublicNetworkSource")
14882                            }
14883                            fn visit_str<E>(
14884                                self,
14885                                value: &str,
14886                            ) -> std::result::Result<Self::Value, E>
14887                            where
14888                                E: serde::de::Error,
14889                            {
14890                                use std::result::Result::Ok;
14891                                use std::string::ToString;
14892                                match value {
14893                                    "allowedIpCidrRanges" => {
14894                                        Ok(__FieldTag::__allowed_ip_cidr_ranges)
14895                                    }
14896                                    "allowed_ip_cidr_ranges" => {
14897                                        Ok(__FieldTag::__allowed_ip_cidr_ranges)
14898                                    }
14899                                    _ => Ok(__FieldTag::Unknown(value.to_string())),
14900                                }
14901                            }
14902                        }
14903                        deserializer.deserialize_identifier(Visitor)
14904                    }
14905                }
14906                struct Visitor;
14907                impl<'de> serde::de::Visitor<'de> for Visitor {
14908                    type Value = PublicNetworkSource;
14909                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
14910                        formatter.write_str("struct PublicNetworkSource")
14911                    }
14912                    fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
14913                    where
14914                        A: serde::de::MapAccess<'de>,
14915                    {
14916                        #[allow(unused_imports)]
14917                        use serde::de::Error;
14918                        use std::option::Option::Some;
14919                        let mut fields = std::collections::HashSet::new();
14920                        let mut result = Self::Value::new();
14921                        while let Some(tag) = map.next_key::<__FieldTag>()? {
14922                            #[allow(clippy::match_single_binding)]
14923                            match tag {
14924                                __FieldTag::__allowed_ip_cidr_ranges => {
14925                                    if !fields.insert(__FieldTag::__allowed_ip_cidr_ranges) {
14926                                        return std::result::Result::Err(
14927                                            A::Error::duplicate_field(
14928                                                "multiple values for allowed_ip_cidr_ranges",
14929                                            ),
14930                                        );
14931                                    }
14932                                    result.allowed_ip_cidr_ranges = map.next_value::<std::option::Option<std::vec::Vec<std::string::String>>>()?.unwrap_or_default();
14933                                }
14934                                __FieldTag::Unknown(key) => {
14935                                    let value = map.next_value::<serde_json::Value>()?;
14936                                    result._unknown_fields.insert(key, value);
14937                                }
14938                            }
14939                        }
14940                        std::result::Result::Ok(result)
14941                    }
14942                }
14943                deserializer.deserialize_any(Visitor)
14944            }
14945        }
14946
14947        #[doc(hidden)]
14948        impl serde::ser::Serialize for PublicNetworkSource {
14949            fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
14950            where
14951                S: serde::ser::Serializer,
14952            {
14953                use serde::ser::SerializeMap;
14954                #[allow(unused_imports)]
14955                use std::option::Option::Some;
14956                let mut state = serializer.serialize_map(std::option::Option::None)?;
14957                if !self.allowed_ip_cidr_ranges.is_empty() {
14958                    state.serialize_entry("allowedIpCidrRanges", &self.allowed_ip_cidr_ranges)?;
14959                }
14960                if !self._unknown_fields.is_empty() {
14961                    for (key, value) in self._unknown_fields.iter() {
14962                        state.serialize_entry(key, &value)?;
14963                    }
14964                }
14965                state.end()
14966            }
14967        }
14968
14969        /// The list of VPC networks that can access the bucket.
14970        #[derive(Clone, Debug, Default, PartialEq)]
14971        #[non_exhaustive]
14972        pub struct VpcNetworkSource {
14973            /// Name of the network.
14974            ///
14975            /// Format: `projects/PROJECT_ID/global/networks/NETWORK_NAME`
14976            pub network: std::option::Option<std::string::String>,
14977
14978            /// Optional. The list of public or private IPv4 and IPv6 CIDR ranges that
14979            /// can access the bucket. In the CIDR IP address block, the specified IP
14980            /// address must be properly truncated, meaning all the host bits must be
14981            /// zero or else the input is considered malformed. For example,
14982            /// `192.0.2.0/24` is accepted but `192.0.2.1/24` is not. Similarly, for
14983            /// IPv6, `2001:db8::/32` is accepted whereas `2001:db8::1/32` is not.
14984            pub allowed_ip_cidr_ranges: std::vec::Vec<std::string::String>,
14985
14986            _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
14987        }
14988
14989        impl VpcNetworkSource {
14990            pub fn new() -> Self {
14991                std::default::Default::default()
14992            }
14993
14994            /// Sets the value of [network][crate::model::bucket::ip_filter::VpcNetworkSource::network].
14995            pub fn set_network<T>(mut self, v: T) -> Self
14996            where
14997                T: std::convert::Into<std::string::String>,
14998            {
14999                self.network = std::option::Option::Some(v.into());
15000                self
15001            }
15002
15003            /// Sets or clears the value of [network][crate::model::bucket::ip_filter::VpcNetworkSource::network].
15004            pub fn set_or_clear_network<T>(mut self, v: std::option::Option<T>) -> Self
15005            where
15006                T: std::convert::Into<std::string::String>,
15007            {
15008                self.network = v.map(|x| x.into());
15009                self
15010            }
15011
15012            /// Sets the value of [allowed_ip_cidr_ranges][crate::model::bucket::ip_filter::VpcNetworkSource::allowed_ip_cidr_ranges].
15013            pub fn set_allowed_ip_cidr_ranges<T, V>(mut self, v: T) -> Self
15014            where
15015                T: std::iter::IntoIterator<Item = V>,
15016                V: std::convert::Into<std::string::String>,
15017            {
15018                use std::iter::Iterator;
15019                self.allowed_ip_cidr_ranges = v.into_iter().map(|i| i.into()).collect();
15020                self
15021            }
15022        }
15023
15024        impl wkt::message::Message for VpcNetworkSource {
15025            fn typename() -> &'static str {
15026                "type.googleapis.com/google.storage.v2.Bucket.IpFilter.VpcNetworkSource"
15027            }
15028        }
15029
15030        #[doc(hidden)]
15031        impl<'de> serde::de::Deserialize<'de> for VpcNetworkSource {
15032            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
15033            where
15034                D: serde::Deserializer<'de>,
15035            {
15036                #[allow(non_camel_case_types)]
15037                #[doc(hidden)]
15038                #[derive(PartialEq, Eq, Hash)]
15039                enum __FieldTag {
15040                    __network,
15041                    __allowed_ip_cidr_ranges,
15042                    Unknown(std::string::String),
15043                }
15044                impl<'de> serde::de::Deserialize<'de> for __FieldTag {
15045                    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
15046                    where
15047                        D: serde::Deserializer<'de>,
15048                    {
15049                        struct Visitor;
15050                        impl<'de> serde::de::Visitor<'de> for Visitor {
15051                            type Value = __FieldTag;
15052                            fn expecting(
15053                                &self,
15054                                formatter: &mut std::fmt::Formatter,
15055                            ) -> std::fmt::Result {
15056                                formatter.write_str("a field name for VpcNetworkSource")
15057                            }
15058                            fn visit_str<E>(
15059                                self,
15060                                value: &str,
15061                            ) -> std::result::Result<Self::Value, E>
15062                            where
15063                                E: serde::de::Error,
15064                            {
15065                                use std::result::Result::Ok;
15066                                use std::string::ToString;
15067                                match value {
15068                                    "network" => Ok(__FieldTag::__network),
15069                                    "allowedIpCidrRanges" => {
15070                                        Ok(__FieldTag::__allowed_ip_cidr_ranges)
15071                                    }
15072                                    "allowed_ip_cidr_ranges" => {
15073                                        Ok(__FieldTag::__allowed_ip_cidr_ranges)
15074                                    }
15075                                    _ => Ok(__FieldTag::Unknown(value.to_string())),
15076                                }
15077                            }
15078                        }
15079                        deserializer.deserialize_identifier(Visitor)
15080                    }
15081                }
15082                struct Visitor;
15083                impl<'de> serde::de::Visitor<'de> for Visitor {
15084                    type Value = VpcNetworkSource;
15085                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
15086                        formatter.write_str("struct VpcNetworkSource")
15087                    }
15088                    fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
15089                    where
15090                        A: serde::de::MapAccess<'de>,
15091                    {
15092                        #[allow(unused_imports)]
15093                        use serde::de::Error;
15094                        use std::option::Option::Some;
15095                        let mut fields = std::collections::HashSet::new();
15096                        let mut result = Self::Value::new();
15097                        while let Some(tag) = map.next_key::<__FieldTag>()? {
15098                            #[allow(clippy::match_single_binding)]
15099                            match tag {
15100                                __FieldTag::__network => {
15101                                    if !fields.insert(__FieldTag::__network) {
15102                                        return std::result::Result::Err(
15103                                            A::Error::duplicate_field(
15104                                                "multiple values for network",
15105                                            ),
15106                                        );
15107                                    }
15108                                    result.network = map
15109                                        .next_value::<std::option::Option<std::string::String>>()?;
15110                                }
15111                                __FieldTag::__allowed_ip_cidr_ranges => {
15112                                    if !fields.insert(__FieldTag::__allowed_ip_cidr_ranges) {
15113                                        return std::result::Result::Err(
15114                                            A::Error::duplicate_field(
15115                                                "multiple values for allowed_ip_cidr_ranges",
15116                                            ),
15117                                        );
15118                                    }
15119                                    result.allowed_ip_cidr_ranges = map.next_value::<std::option::Option<std::vec::Vec<std::string::String>>>()?.unwrap_or_default();
15120                                }
15121                                __FieldTag::Unknown(key) => {
15122                                    let value = map.next_value::<serde_json::Value>()?;
15123                                    result._unknown_fields.insert(key, value);
15124                                }
15125                            }
15126                        }
15127                        std::result::Result::Ok(result)
15128                    }
15129                }
15130                deserializer.deserialize_any(Visitor)
15131            }
15132        }
15133
15134        #[doc(hidden)]
15135        impl serde::ser::Serialize for VpcNetworkSource {
15136            fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
15137            where
15138                S: serde::ser::Serializer,
15139            {
15140                use serde::ser::SerializeMap;
15141                #[allow(unused_imports)]
15142                use std::option::Option::Some;
15143                let mut state = serializer.serialize_map(std::option::Option::None)?;
15144                if self.network.is_some() {
15145                    state.serialize_entry("network", &self.network)?;
15146                }
15147                if !self.allowed_ip_cidr_ranges.is_empty() {
15148                    state.serialize_entry("allowedIpCidrRanges", &self.allowed_ip_cidr_ranges)?;
15149                }
15150                if !self._unknown_fields.is_empty() {
15151                    for (key, value) in self._unknown_fields.iter() {
15152                        state.serialize_entry(key, &value)?;
15153                    }
15154                }
15155                state.end()
15156            }
15157        }
15158    }
15159
15160    /// Configuration for a bucket's hierarchical namespace feature.
15161    #[derive(Clone, Debug, Default, PartialEq)]
15162    #[non_exhaustive]
15163    pub struct HierarchicalNamespace {
15164        /// Optional. Enables the hierarchical namespace feature.
15165        pub enabled: bool,
15166
15167        _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
15168    }
15169
15170    impl HierarchicalNamespace {
15171        pub fn new() -> Self {
15172            std::default::Default::default()
15173        }
15174
15175        /// Sets the value of [enabled][crate::model::bucket::HierarchicalNamespace::enabled].
15176        pub fn set_enabled<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
15177            self.enabled = v.into();
15178            self
15179        }
15180    }
15181
15182    impl wkt::message::Message for HierarchicalNamespace {
15183        fn typename() -> &'static str {
15184            "type.googleapis.com/google.storage.v2.Bucket.HierarchicalNamespace"
15185        }
15186    }
15187
15188    #[doc(hidden)]
15189    impl<'de> serde::de::Deserialize<'de> for HierarchicalNamespace {
15190        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
15191        where
15192            D: serde::Deserializer<'de>,
15193        {
15194            #[allow(non_camel_case_types)]
15195            #[doc(hidden)]
15196            #[derive(PartialEq, Eq, Hash)]
15197            enum __FieldTag {
15198                __enabled,
15199                Unknown(std::string::String),
15200            }
15201            impl<'de> serde::de::Deserialize<'de> for __FieldTag {
15202                fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
15203                where
15204                    D: serde::Deserializer<'de>,
15205                {
15206                    struct Visitor;
15207                    impl<'de> serde::de::Visitor<'de> for Visitor {
15208                        type Value = __FieldTag;
15209                        fn expecting(
15210                            &self,
15211                            formatter: &mut std::fmt::Formatter,
15212                        ) -> std::fmt::Result {
15213                            formatter.write_str("a field name for HierarchicalNamespace")
15214                        }
15215                        fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
15216                        where
15217                            E: serde::de::Error,
15218                        {
15219                            use std::result::Result::Ok;
15220                            use std::string::ToString;
15221                            match value {
15222                                "enabled" => Ok(__FieldTag::__enabled),
15223                                _ => Ok(__FieldTag::Unknown(value.to_string())),
15224                            }
15225                        }
15226                    }
15227                    deserializer.deserialize_identifier(Visitor)
15228                }
15229            }
15230            struct Visitor;
15231            impl<'de> serde::de::Visitor<'de> for Visitor {
15232                type Value = HierarchicalNamespace;
15233                fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
15234                    formatter.write_str("struct HierarchicalNamespace")
15235                }
15236                fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
15237                where
15238                    A: serde::de::MapAccess<'de>,
15239                {
15240                    #[allow(unused_imports)]
15241                    use serde::de::Error;
15242                    use std::option::Option::Some;
15243                    let mut fields = std::collections::HashSet::new();
15244                    let mut result = Self::Value::new();
15245                    while let Some(tag) = map.next_key::<__FieldTag>()? {
15246                        #[allow(clippy::match_single_binding)]
15247                        match tag {
15248                            __FieldTag::__enabled => {
15249                                if !fields.insert(__FieldTag::__enabled) {
15250                                    return std::result::Result::Err(A::Error::duplicate_field(
15251                                        "multiple values for enabled",
15252                                    ));
15253                                }
15254                                result.enabled = map
15255                                    .next_value::<std::option::Option<bool>>()?
15256                                    .unwrap_or_default();
15257                            }
15258                            __FieldTag::Unknown(key) => {
15259                                let value = map.next_value::<serde_json::Value>()?;
15260                                result._unknown_fields.insert(key, value);
15261                            }
15262                        }
15263                    }
15264                    std::result::Result::Ok(result)
15265                }
15266            }
15267            deserializer.deserialize_any(Visitor)
15268        }
15269    }
15270
15271    #[doc(hidden)]
15272    impl serde::ser::Serialize for HierarchicalNamespace {
15273        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
15274        where
15275            S: serde::ser::Serializer,
15276        {
15277            use serde::ser::SerializeMap;
15278            #[allow(unused_imports)]
15279            use std::option::Option::Some;
15280            let mut state = serializer.serialize_map(std::option::Option::None)?;
15281            if !wkt::internal::is_default(&self.enabled) {
15282                state.serialize_entry("enabled", &self.enabled)?;
15283            }
15284            if !self._unknown_fields.is_empty() {
15285                for (key, value) in self._unknown_fields.iter() {
15286                    state.serialize_entry(key, &value)?;
15287                }
15288            }
15289            state.end()
15290        }
15291    }
15292}
15293
15294/// An access-control entry.
15295#[derive(Clone, Debug, Default, PartialEq)]
15296#[non_exhaustive]
15297pub struct BucketAccessControl {
15298    /// Optional. The access permission for the entity.
15299    pub role: std::string::String,
15300
15301    /// Optional. The ID of the access-control entry.
15302    pub id: std::string::String,
15303
15304    /// Optional. The entity holding the permission, in one of the following forms:
15305    ///
15306    /// * `user-{userid}`
15307    /// * `user-{email}`
15308    /// * `group-{groupid}`
15309    /// * `group-{email}`
15310    /// * `domain-{domain}`
15311    /// * `project-{team}-{projectnumber}`
15312    /// * `project-{team}-{projectid}`
15313    /// * `allUsers`
15314    /// * `allAuthenticatedUsers`
15315    ///   Examples:
15316    /// * The user `liz@example.com` would be `user-liz@example.com`.
15317    /// * The group `example@googlegroups.com` would be
15318    ///   `group-example@googlegroups.com`
15319    /// * All members of the Google Apps for Business domain `example.com` would be
15320    ///   `domain-example.com`
15321    ///   For project entities, `project-{team}-{projectnumber}` format will be
15322    ///   returned on response.
15323    pub entity: std::string::String,
15324
15325    /// Output only. The alternative entity format, if exists. For project
15326    /// entities, `project-{team}-{projectid}` format will be returned on response.
15327    pub entity_alt: std::string::String,
15328
15329    /// Optional. The ID for the entity, if any.
15330    pub entity_id: std::string::String,
15331
15332    /// Optional. The etag of the BucketAccessControl.
15333    /// If included in the metadata of an update or delete request message, the
15334    /// operation operation will only be performed if the etag matches that of the
15335    /// bucket's BucketAccessControl.
15336    pub etag: std::string::String,
15337
15338    /// Optional. The email address associated with the entity, if any.
15339    pub email: std::string::String,
15340
15341    /// Optional. The domain associated with the entity, if any.
15342    pub domain: std::string::String,
15343
15344    /// Optional. The project team associated with the entity, if any.
15345    pub project_team: std::option::Option<crate::model::ProjectTeam>,
15346
15347    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
15348}
15349
15350impl BucketAccessControl {
15351    pub fn new() -> Self {
15352        std::default::Default::default()
15353    }
15354
15355    /// Sets the value of [role][crate::model::BucketAccessControl::role].
15356    pub fn set_role<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
15357        self.role = v.into();
15358        self
15359    }
15360
15361    /// Sets the value of [id][crate::model::BucketAccessControl::id].
15362    pub fn set_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
15363        self.id = v.into();
15364        self
15365    }
15366
15367    /// Sets the value of [entity][crate::model::BucketAccessControl::entity].
15368    pub fn set_entity<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
15369        self.entity = v.into();
15370        self
15371    }
15372
15373    /// Sets the value of [entity_alt][crate::model::BucketAccessControl::entity_alt].
15374    pub fn set_entity_alt<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
15375        self.entity_alt = v.into();
15376        self
15377    }
15378
15379    /// Sets the value of [entity_id][crate::model::BucketAccessControl::entity_id].
15380    pub fn set_entity_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
15381        self.entity_id = v.into();
15382        self
15383    }
15384
15385    /// Sets the value of [etag][crate::model::BucketAccessControl::etag].
15386    pub fn set_etag<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
15387        self.etag = v.into();
15388        self
15389    }
15390
15391    /// Sets the value of [email][crate::model::BucketAccessControl::email].
15392    pub fn set_email<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
15393        self.email = v.into();
15394        self
15395    }
15396
15397    /// Sets the value of [domain][crate::model::BucketAccessControl::domain].
15398    pub fn set_domain<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
15399        self.domain = v.into();
15400        self
15401    }
15402
15403    /// Sets the value of [project_team][crate::model::BucketAccessControl::project_team].
15404    pub fn set_project_team<T>(mut self, v: T) -> Self
15405    where
15406        T: std::convert::Into<crate::model::ProjectTeam>,
15407    {
15408        self.project_team = std::option::Option::Some(v.into());
15409        self
15410    }
15411
15412    /// Sets or clears the value of [project_team][crate::model::BucketAccessControl::project_team].
15413    pub fn set_or_clear_project_team<T>(mut self, v: std::option::Option<T>) -> Self
15414    where
15415        T: std::convert::Into<crate::model::ProjectTeam>,
15416    {
15417        self.project_team = v.map(|x| x.into());
15418        self
15419    }
15420}
15421
15422impl wkt::message::Message for BucketAccessControl {
15423    fn typename() -> &'static str {
15424        "type.googleapis.com/google.storage.v2.BucketAccessControl"
15425    }
15426}
15427
15428#[doc(hidden)]
15429impl<'de> serde::de::Deserialize<'de> for BucketAccessControl {
15430    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
15431    where
15432        D: serde::Deserializer<'de>,
15433    {
15434        #[allow(non_camel_case_types)]
15435        #[doc(hidden)]
15436        #[derive(PartialEq, Eq, Hash)]
15437        enum __FieldTag {
15438            __role,
15439            __id,
15440            __entity,
15441            __entity_alt,
15442            __entity_id,
15443            __etag,
15444            __email,
15445            __domain,
15446            __project_team,
15447            Unknown(std::string::String),
15448        }
15449        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
15450            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
15451            where
15452                D: serde::Deserializer<'de>,
15453            {
15454                struct Visitor;
15455                impl<'de> serde::de::Visitor<'de> for Visitor {
15456                    type Value = __FieldTag;
15457                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
15458                        formatter.write_str("a field name for BucketAccessControl")
15459                    }
15460                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
15461                    where
15462                        E: serde::de::Error,
15463                    {
15464                        use std::result::Result::Ok;
15465                        use std::string::ToString;
15466                        match value {
15467                            "role" => Ok(__FieldTag::__role),
15468                            "id" => Ok(__FieldTag::__id),
15469                            "entity" => Ok(__FieldTag::__entity),
15470                            "entityAlt" => Ok(__FieldTag::__entity_alt),
15471                            "entity_alt" => Ok(__FieldTag::__entity_alt),
15472                            "entityId" => Ok(__FieldTag::__entity_id),
15473                            "entity_id" => Ok(__FieldTag::__entity_id),
15474                            "etag" => Ok(__FieldTag::__etag),
15475                            "email" => Ok(__FieldTag::__email),
15476                            "domain" => Ok(__FieldTag::__domain),
15477                            "projectTeam" => Ok(__FieldTag::__project_team),
15478                            "project_team" => Ok(__FieldTag::__project_team),
15479                            _ => Ok(__FieldTag::Unknown(value.to_string())),
15480                        }
15481                    }
15482                }
15483                deserializer.deserialize_identifier(Visitor)
15484            }
15485        }
15486        struct Visitor;
15487        impl<'de> serde::de::Visitor<'de> for Visitor {
15488            type Value = BucketAccessControl;
15489            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
15490                formatter.write_str("struct BucketAccessControl")
15491            }
15492            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
15493            where
15494                A: serde::de::MapAccess<'de>,
15495            {
15496                #[allow(unused_imports)]
15497                use serde::de::Error;
15498                use std::option::Option::Some;
15499                let mut fields = std::collections::HashSet::new();
15500                let mut result = Self::Value::new();
15501                while let Some(tag) = map.next_key::<__FieldTag>()? {
15502                    #[allow(clippy::match_single_binding)]
15503                    match tag {
15504                        __FieldTag::__role => {
15505                            if !fields.insert(__FieldTag::__role) {
15506                                return std::result::Result::Err(A::Error::duplicate_field(
15507                                    "multiple values for role",
15508                                ));
15509                            }
15510                            result.role = map
15511                                .next_value::<std::option::Option<std::string::String>>()?
15512                                .unwrap_or_default();
15513                        }
15514                        __FieldTag::__id => {
15515                            if !fields.insert(__FieldTag::__id) {
15516                                return std::result::Result::Err(A::Error::duplicate_field(
15517                                    "multiple values for id",
15518                                ));
15519                            }
15520                            result.id = map
15521                                .next_value::<std::option::Option<std::string::String>>()?
15522                                .unwrap_or_default();
15523                        }
15524                        __FieldTag::__entity => {
15525                            if !fields.insert(__FieldTag::__entity) {
15526                                return std::result::Result::Err(A::Error::duplicate_field(
15527                                    "multiple values for entity",
15528                                ));
15529                            }
15530                            result.entity = map
15531                                .next_value::<std::option::Option<std::string::String>>()?
15532                                .unwrap_or_default();
15533                        }
15534                        __FieldTag::__entity_alt => {
15535                            if !fields.insert(__FieldTag::__entity_alt) {
15536                                return std::result::Result::Err(A::Error::duplicate_field(
15537                                    "multiple values for entity_alt",
15538                                ));
15539                            }
15540                            result.entity_alt = map
15541                                .next_value::<std::option::Option<std::string::String>>()?
15542                                .unwrap_or_default();
15543                        }
15544                        __FieldTag::__entity_id => {
15545                            if !fields.insert(__FieldTag::__entity_id) {
15546                                return std::result::Result::Err(A::Error::duplicate_field(
15547                                    "multiple values for entity_id",
15548                                ));
15549                            }
15550                            result.entity_id = map
15551                                .next_value::<std::option::Option<std::string::String>>()?
15552                                .unwrap_or_default();
15553                        }
15554                        __FieldTag::__etag => {
15555                            if !fields.insert(__FieldTag::__etag) {
15556                                return std::result::Result::Err(A::Error::duplicate_field(
15557                                    "multiple values for etag",
15558                                ));
15559                            }
15560                            result.etag = map
15561                                .next_value::<std::option::Option<std::string::String>>()?
15562                                .unwrap_or_default();
15563                        }
15564                        __FieldTag::__email => {
15565                            if !fields.insert(__FieldTag::__email) {
15566                                return std::result::Result::Err(A::Error::duplicate_field(
15567                                    "multiple values for email",
15568                                ));
15569                            }
15570                            result.email = map
15571                                .next_value::<std::option::Option<std::string::String>>()?
15572                                .unwrap_or_default();
15573                        }
15574                        __FieldTag::__domain => {
15575                            if !fields.insert(__FieldTag::__domain) {
15576                                return std::result::Result::Err(A::Error::duplicate_field(
15577                                    "multiple values for domain",
15578                                ));
15579                            }
15580                            result.domain = map
15581                                .next_value::<std::option::Option<std::string::String>>()?
15582                                .unwrap_or_default();
15583                        }
15584                        __FieldTag::__project_team => {
15585                            if !fields.insert(__FieldTag::__project_team) {
15586                                return std::result::Result::Err(A::Error::duplicate_field(
15587                                    "multiple values for project_team",
15588                                ));
15589                            }
15590                            result.project_team =
15591                                map.next_value::<std::option::Option<crate::model::ProjectTeam>>()?;
15592                        }
15593                        __FieldTag::Unknown(key) => {
15594                            let value = map.next_value::<serde_json::Value>()?;
15595                            result._unknown_fields.insert(key, value);
15596                        }
15597                    }
15598                }
15599                std::result::Result::Ok(result)
15600            }
15601        }
15602        deserializer.deserialize_any(Visitor)
15603    }
15604}
15605
15606#[doc(hidden)]
15607impl serde::ser::Serialize for BucketAccessControl {
15608    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
15609    where
15610        S: serde::ser::Serializer,
15611    {
15612        use serde::ser::SerializeMap;
15613        #[allow(unused_imports)]
15614        use std::option::Option::Some;
15615        let mut state = serializer.serialize_map(std::option::Option::None)?;
15616        if !self.role.is_empty() {
15617            state.serialize_entry("role", &self.role)?;
15618        }
15619        if !self.id.is_empty() {
15620            state.serialize_entry("id", &self.id)?;
15621        }
15622        if !self.entity.is_empty() {
15623            state.serialize_entry("entity", &self.entity)?;
15624        }
15625        if !self.entity_alt.is_empty() {
15626            state.serialize_entry("entityAlt", &self.entity_alt)?;
15627        }
15628        if !self.entity_id.is_empty() {
15629            state.serialize_entry("entityId", &self.entity_id)?;
15630        }
15631        if !self.etag.is_empty() {
15632            state.serialize_entry("etag", &self.etag)?;
15633        }
15634        if !self.email.is_empty() {
15635            state.serialize_entry("email", &self.email)?;
15636        }
15637        if !self.domain.is_empty() {
15638            state.serialize_entry("domain", &self.domain)?;
15639        }
15640        if self.project_team.is_some() {
15641            state.serialize_entry("projectTeam", &self.project_team)?;
15642        }
15643        if !self._unknown_fields.is_empty() {
15644            for (key, value) in self._unknown_fields.iter() {
15645                state.serialize_entry(key, &value)?;
15646            }
15647        }
15648        state.end()
15649    }
15650}
15651
15652/// Message used for storing full (not subrange) object checksums.
15653#[derive(Clone, Debug, Default, PartialEq)]
15654#[non_exhaustive]
15655pub struct ObjectChecksums {
15656    /// CRC32C digest of the object data. Computed by the Cloud Storage service for
15657    /// all written objects.
15658    /// If set in a WriteObjectRequest, service will validate that the stored
15659    /// object matches this checksum.
15660    pub crc32c: std::option::Option<u32>,
15661
15662    /// Optional. 128 bit MD5 hash of the object data.
15663    /// For more information about using the MD5 hash, see
15664    /// [<https://cloud.google.com/storage/docs/hashes-etags#json-api>][Hashes and
15665    /// ETags: Best Practices].
15666    /// Not all objects will provide an MD5 hash. For example, composite objects
15667    /// provide only crc32c hashes. This value is equivalent to running `cat
15668    /// object.txt | openssl md5 -binary`
15669    pub md5_hash: ::bytes::Bytes,
15670
15671    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
15672}
15673
15674impl ObjectChecksums {
15675    pub fn new() -> Self {
15676        std::default::Default::default()
15677    }
15678
15679    /// Sets the value of [crc32c][crate::model::ObjectChecksums::crc32c].
15680    pub fn set_crc32c<T>(mut self, v: T) -> Self
15681    where
15682        T: std::convert::Into<u32>,
15683    {
15684        self.crc32c = std::option::Option::Some(v.into());
15685        self
15686    }
15687
15688    /// Sets or clears the value of [crc32c][crate::model::ObjectChecksums::crc32c].
15689    pub fn set_or_clear_crc32c<T>(mut self, v: std::option::Option<T>) -> Self
15690    where
15691        T: std::convert::Into<u32>,
15692    {
15693        self.crc32c = v.map(|x| x.into());
15694        self
15695    }
15696
15697    /// Sets the value of [md5_hash][crate::model::ObjectChecksums::md5_hash].
15698    pub fn set_md5_hash<T: std::convert::Into<::bytes::Bytes>>(mut self, v: T) -> Self {
15699        self.md5_hash = v.into();
15700        self
15701    }
15702}
15703
15704impl wkt::message::Message for ObjectChecksums {
15705    fn typename() -> &'static str {
15706        "type.googleapis.com/google.storage.v2.ObjectChecksums"
15707    }
15708}
15709
15710#[doc(hidden)]
15711impl<'de> serde::de::Deserialize<'de> for ObjectChecksums {
15712    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
15713    where
15714        D: serde::Deserializer<'de>,
15715    {
15716        #[allow(non_camel_case_types)]
15717        #[doc(hidden)]
15718        #[derive(PartialEq, Eq, Hash)]
15719        enum __FieldTag {
15720            __crc32c,
15721            __md5_hash,
15722            Unknown(std::string::String),
15723        }
15724        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
15725            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
15726            where
15727                D: serde::Deserializer<'de>,
15728            {
15729                struct Visitor;
15730                impl<'de> serde::de::Visitor<'de> for Visitor {
15731                    type Value = __FieldTag;
15732                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
15733                        formatter.write_str("a field name for ObjectChecksums")
15734                    }
15735                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
15736                    where
15737                        E: serde::de::Error,
15738                    {
15739                        use std::result::Result::Ok;
15740                        use std::string::ToString;
15741                        match value {
15742                            "crc32c" => Ok(__FieldTag::__crc32c),
15743                            "md5Hash" => Ok(__FieldTag::__md5_hash),
15744                            "md5_hash" => Ok(__FieldTag::__md5_hash),
15745                            _ => Ok(__FieldTag::Unknown(value.to_string())),
15746                        }
15747                    }
15748                }
15749                deserializer.deserialize_identifier(Visitor)
15750            }
15751        }
15752        struct Visitor;
15753        impl<'de> serde::de::Visitor<'de> for Visitor {
15754            type Value = ObjectChecksums;
15755            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
15756                formatter.write_str("struct ObjectChecksums")
15757            }
15758            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
15759            where
15760                A: serde::de::MapAccess<'de>,
15761            {
15762                #[allow(unused_imports)]
15763                use serde::de::Error;
15764                use std::option::Option::Some;
15765                let mut fields = std::collections::HashSet::new();
15766                let mut result = Self::Value::new();
15767                while let Some(tag) = map.next_key::<__FieldTag>()? {
15768                    #[allow(clippy::match_single_binding)]
15769                    match tag {
15770                        __FieldTag::__crc32c => {
15771                            if !fields.insert(__FieldTag::__crc32c) {
15772                                return std::result::Result::Err(A::Error::duplicate_field(
15773                                    "multiple values for crc32c",
15774                                ));
15775                            }
15776                            struct __With(std::option::Option<u32>);
15777                            impl<'de> serde::de::Deserialize<'de> for __With {
15778                                fn deserialize<D>(
15779                                    deserializer: D,
15780                                ) -> std::result::Result<Self, D::Error>
15781                                where
15782                                    D: serde::de::Deserializer<'de>,
15783                                {
15784                                    serde_with::As::< std::option::Option<wkt::internal::U32> >::deserialize(deserializer).map(__With)
15785                                }
15786                            }
15787                            result.crc32c = map.next_value::<__With>()?.0;
15788                        }
15789                        __FieldTag::__md5_hash => {
15790                            if !fields.insert(__FieldTag::__md5_hash) {
15791                                return std::result::Result::Err(A::Error::duplicate_field(
15792                                    "multiple values for md5_hash",
15793                                ));
15794                            }
15795                            struct __With(std::option::Option<::bytes::Bytes>);
15796                            impl<'de> serde::de::Deserialize<'de> for __With {
15797                                fn deserialize<D>(
15798                                    deserializer: D,
15799                                ) -> std::result::Result<Self, D::Error>
15800                                where
15801                                    D: serde::de::Deserializer<'de>,
15802                                {
15803                                    serde_with::As::< std::option::Option<serde_with::base64::Base64> >::deserialize(deserializer).map(__With)
15804                                }
15805                            }
15806                            result.md5_hash = map.next_value::<__With>()?.0.unwrap_or_default();
15807                        }
15808                        __FieldTag::Unknown(key) => {
15809                            let value = map.next_value::<serde_json::Value>()?;
15810                            result._unknown_fields.insert(key, value);
15811                        }
15812                    }
15813                }
15814                std::result::Result::Ok(result)
15815            }
15816        }
15817        deserializer.deserialize_any(Visitor)
15818    }
15819}
15820
15821#[doc(hidden)]
15822impl serde::ser::Serialize for ObjectChecksums {
15823    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
15824    where
15825        S: serde::ser::Serializer,
15826    {
15827        use serde::ser::SerializeMap;
15828        #[allow(unused_imports)]
15829        use std::option::Option::Some;
15830        let mut state = serializer.serialize_map(std::option::Option::None)?;
15831        if self.crc32c.is_some() {
15832            struct __With<'a>(&'a std::option::Option<u32>);
15833            impl<'a> serde::ser::Serialize for __With<'a> {
15834                fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
15835                where
15836                    S: serde::ser::Serializer,
15837                {
15838                    serde_with::As::<std::option::Option<wkt::internal::U32>>::serialize(
15839                        self.0, serializer,
15840                    )
15841                }
15842            }
15843            state.serialize_entry("crc32c", &__With(&self.crc32c))?;
15844        }
15845        if !self.md5_hash.is_empty() {
15846            struct __With<'a>(&'a ::bytes::Bytes);
15847            impl<'a> serde::ser::Serialize for __With<'a> {
15848                fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
15849                where
15850                    S: serde::ser::Serializer,
15851                {
15852                    serde_with::As::<serde_with::base64::Base64>::serialize(self.0, serializer)
15853                }
15854            }
15855            state.serialize_entry("md5Hash", &__With(&self.md5_hash))?;
15856        }
15857        if !self._unknown_fields.is_empty() {
15858            for (key, value) in self._unknown_fields.iter() {
15859                state.serialize_entry(key, &value)?;
15860            }
15861        }
15862        state.end()
15863    }
15864}
15865
15866/// The payload of a single user-defined object context.
15867#[derive(Clone, Debug, Default, PartialEq)]
15868#[non_exhaustive]
15869pub struct ObjectCustomContextPayload {
15870    /// Required. The value of the object context.
15871    pub value: std::string::String,
15872
15873    /// Output only. The time at which the object context was created.
15874    pub create_time: std::option::Option<wkt::Timestamp>,
15875
15876    /// Output only. The time at which the object context was last updated.
15877    pub update_time: std::option::Option<wkt::Timestamp>,
15878
15879    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
15880}
15881
15882impl ObjectCustomContextPayload {
15883    pub fn new() -> Self {
15884        std::default::Default::default()
15885    }
15886
15887    /// Sets the value of [value][crate::model::ObjectCustomContextPayload::value].
15888    pub fn set_value<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
15889        self.value = v.into();
15890        self
15891    }
15892
15893    /// Sets the value of [create_time][crate::model::ObjectCustomContextPayload::create_time].
15894    pub fn set_create_time<T>(mut self, v: T) -> Self
15895    where
15896        T: std::convert::Into<wkt::Timestamp>,
15897    {
15898        self.create_time = std::option::Option::Some(v.into());
15899        self
15900    }
15901
15902    /// Sets or clears the value of [create_time][crate::model::ObjectCustomContextPayload::create_time].
15903    pub fn set_or_clear_create_time<T>(mut self, v: std::option::Option<T>) -> Self
15904    where
15905        T: std::convert::Into<wkt::Timestamp>,
15906    {
15907        self.create_time = v.map(|x| x.into());
15908        self
15909    }
15910
15911    /// Sets the value of [update_time][crate::model::ObjectCustomContextPayload::update_time].
15912    pub fn set_update_time<T>(mut self, v: T) -> Self
15913    where
15914        T: std::convert::Into<wkt::Timestamp>,
15915    {
15916        self.update_time = std::option::Option::Some(v.into());
15917        self
15918    }
15919
15920    /// Sets or clears the value of [update_time][crate::model::ObjectCustomContextPayload::update_time].
15921    pub fn set_or_clear_update_time<T>(mut self, v: std::option::Option<T>) -> Self
15922    where
15923        T: std::convert::Into<wkt::Timestamp>,
15924    {
15925        self.update_time = v.map(|x| x.into());
15926        self
15927    }
15928}
15929
15930impl wkt::message::Message for ObjectCustomContextPayload {
15931    fn typename() -> &'static str {
15932        "type.googleapis.com/google.storage.v2.ObjectCustomContextPayload"
15933    }
15934}
15935
15936#[doc(hidden)]
15937impl<'de> serde::de::Deserialize<'de> for ObjectCustomContextPayload {
15938    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
15939    where
15940        D: serde::Deserializer<'de>,
15941    {
15942        #[allow(non_camel_case_types)]
15943        #[doc(hidden)]
15944        #[derive(PartialEq, Eq, Hash)]
15945        enum __FieldTag {
15946            __value,
15947            __create_time,
15948            __update_time,
15949            Unknown(std::string::String),
15950        }
15951        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
15952            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
15953            where
15954                D: serde::Deserializer<'de>,
15955            {
15956                struct Visitor;
15957                impl<'de> serde::de::Visitor<'de> for Visitor {
15958                    type Value = __FieldTag;
15959                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
15960                        formatter.write_str("a field name for ObjectCustomContextPayload")
15961                    }
15962                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
15963                    where
15964                        E: serde::de::Error,
15965                    {
15966                        use std::result::Result::Ok;
15967                        use std::string::ToString;
15968                        match value {
15969                            "value" => Ok(__FieldTag::__value),
15970                            "createTime" => Ok(__FieldTag::__create_time),
15971                            "create_time" => Ok(__FieldTag::__create_time),
15972                            "updateTime" => Ok(__FieldTag::__update_time),
15973                            "update_time" => Ok(__FieldTag::__update_time),
15974                            _ => Ok(__FieldTag::Unknown(value.to_string())),
15975                        }
15976                    }
15977                }
15978                deserializer.deserialize_identifier(Visitor)
15979            }
15980        }
15981        struct Visitor;
15982        impl<'de> serde::de::Visitor<'de> for Visitor {
15983            type Value = ObjectCustomContextPayload;
15984            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
15985                formatter.write_str("struct ObjectCustomContextPayload")
15986            }
15987            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
15988            where
15989                A: serde::de::MapAccess<'de>,
15990            {
15991                #[allow(unused_imports)]
15992                use serde::de::Error;
15993                use std::option::Option::Some;
15994                let mut fields = std::collections::HashSet::new();
15995                let mut result = Self::Value::new();
15996                while let Some(tag) = map.next_key::<__FieldTag>()? {
15997                    #[allow(clippy::match_single_binding)]
15998                    match tag {
15999                        __FieldTag::__value => {
16000                            if !fields.insert(__FieldTag::__value) {
16001                                return std::result::Result::Err(A::Error::duplicate_field(
16002                                    "multiple values for value",
16003                                ));
16004                            }
16005                            result.value = map
16006                                .next_value::<std::option::Option<std::string::String>>()?
16007                                .unwrap_or_default();
16008                        }
16009                        __FieldTag::__create_time => {
16010                            if !fields.insert(__FieldTag::__create_time) {
16011                                return std::result::Result::Err(A::Error::duplicate_field(
16012                                    "multiple values for create_time",
16013                                ));
16014                            }
16015                            result.create_time =
16016                                map.next_value::<std::option::Option<wkt::Timestamp>>()?;
16017                        }
16018                        __FieldTag::__update_time => {
16019                            if !fields.insert(__FieldTag::__update_time) {
16020                                return std::result::Result::Err(A::Error::duplicate_field(
16021                                    "multiple values for update_time",
16022                                ));
16023                            }
16024                            result.update_time =
16025                                map.next_value::<std::option::Option<wkt::Timestamp>>()?;
16026                        }
16027                        __FieldTag::Unknown(key) => {
16028                            let value = map.next_value::<serde_json::Value>()?;
16029                            result._unknown_fields.insert(key, value);
16030                        }
16031                    }
16032                }
16033                std::result::Result::Ok(result)
16034            }
16035        }
16036        deserializer.deserialize_any(Visitor)
16037    }
16038}
16039
16040#[doc(hidden)]
16041impl serde::ser::Serialize for ObjectCustomContextPayload {
16042    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
16043    where
16044        S: serde::ser::Serializer,
16045    {
16046        use serde::ser::SerializeMap;
16047        #[allow(unused_imports)]
16048        use std::option::Option::Some;
16049        let mut state = serializer.serialize_map(std::option::Option::None)?;
16050        if !self.value.is_empty() {
16051            state.serialize_entry("value", &self.value)?;
16052        }
16053        if self.create_time.is_some() {
16054            state.serialize_entry("createTime", &self.create_time)?;
16055        }
16056        if self.update_time.is_some() {
16057            state.serialize_entry("updateTime", &self.update_time)?;
16058        }
16059        if !self._unknown_fields.is_empty() {
16060            for (key, value) in self._unknown_fields.iter() {
16061                state.serialize_entry(key, &value)?;
16062            }
16063        }
16064        state.end()
16065    }
16066}
16067
16068/// All contexts of an object grouped by type.
16069#[derive(Clone, Debug, Default, PartialEq)]
16070#[non_exhaustive]
16071pub struct ObjectContexts {
16072    /// Optional. User-defined object contexts.
16073    pub custom:
16074        std::collections::HashMap<std::string::String, crate::model::ObjectCustomContextPayload>,
16075
16076    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
16077}
16078
16079impl ObjectContexts {
16080    pub fn new() -> Self {
16081        std::default::Default::default()
16082    }
16083
16084    /// Sets the value of [custom][crate::model::ObjectContexts::custom].
16085    pub fn set_custom<T, K, V>(mut self, v: T) -> Self
16086    where
16087        T: std::iter::IntoIterator<Item = (K, V)>,
16088        K: std::convert::Into<std::string::String>,
16089        V: std::convert::Into<crate::model::ObjectCustomContextPayload>,
16090    {
16091        use std::iter::Iterator;
16092        self.custom = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
16093        self
16094    }
16095}
16096
16097impl wkt::message::Message for ObjectContexts {
16098    fn typename() -> &'static str {
16099        "type.googleapis.com/google.storage.v2.ObjectContexts"
16100    }
16101}
16102
16103#[doc(hidden)]
16104impl<'de> serde::de::Deserialize<'de> for ObjectContexts {
16105    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
16106    where
16107        D: serde::Deserializer<'de>,
16108    {
16109        #[allow(non_camel_case_types)]
16110        #[doc(hidden)]
16111        #[derive(PartialEq, Eq, Hash)]
16112        enum __FieldTag {
16113            __custom,
16114            Unknown(std::string::String),
16115        }
16116        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
16117            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
16118            where
16119                D: serde::Deserializer<'de>,
16120            {
16121                struct Visitor;
16122                impl<'de> serde::de::Visitor<'de> for Visitor {
16123                    type Value = __FieldTag;
16124                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
16125                        formatter.write_str("a field name for ObjectContexts")
16126                    }
16127                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
16128                    where
16129                        E: serde::de::Error,
16130                    {
16131                        use std::result::Result::Ok;
16132                        use std::string::ToString;
16133                        match value {
16134                            "custom" => Ok(__FieldTag::__custom),
16135                            _ => Ok(__FieldTag::Unknown(value.to_string())),
16136                        }
16137                    }
16138                }
16139                deserializer.deserialize_identifier(Visitor)
16140            }
16141        }
16142        struct Visitor;
16143        impl<'de> serde::de::Visitor<'de> for Visitor {
16144            type Value = ObjectContexts;
16145            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
16146                formatter.write_str("struct ObjectContexts")
16147            }
16148            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
16149            where
16150                A: serde::de::MapAccess<'de>,
16151            {
16152                #[allow(unused_imports)]
16153                use serde::de::Error;
16154                use std::option::Option::Some;
16155                let mut fields = std::collections::HashSet::new();
16156                let mut result = Self::Value::new();
16157                while let Some(tag) = map.next_key::<__FieldTag>()? {
16158                    #[allow(clippy::match_single_binding)]
16159                    match tag {
16160                        __FieldTag::__custom => {
16161                            if !fields.insert(__FieldTag::__custom) {
16162                                return std::result::Result::Err(A::Error::duplicate_field(
16163                                    "multiple values for custom",
16164                                ));
16165                            }
16166                            result.custom = map
16167                                .next_value::<std::option::Option<
16168                                    std::collections::HashMap<
16169                                        std::string::String,
16170                                        crate::model::ObjectCustomContextPayload,
16171                                    >,
16172                                >>()?
16173                                .unwrap_or_default();
16174                        }
16175                        __FieldTag::Unknown(key) => {
16176                            let value = map.next_value::<serde_json::Value>()?;
16177                            result._unknown_fields.insert(key, value);
16178                        }
16179                    }
16180                }
16181                std::result::Result::Ok(result)
16182            }
16183        }
16184        deserializer.deserialize_any(Visitor)
16185    }
16186}
16187
16188#[doc(hidden)]
16189impl serde::ser::Serialize for ObjectContexts {
16190    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
16191    where
16192        S: serde::ser::Serializer,
16193    {
16194        use serde::ser::SerializeMap;
16195        #[allow(unused_imports)]
16196        use std::option::Option::Some;
16197        let mut state = serializer.serialize_map(std::option::Option::None)?;
16198        if !self.custom.is_empty() {
16199            state.serialize_entry("custom", &self.custom)?;
16200        }
16201        if !self._unknown_fields.is_empty() {
16202            for (key, value) in self._unknown_fields.iter() {
16203                state.serialize_entry(key, &value)?;
16204            }
16205        }
16206        state.end()
16207    }
16208}
16209
16210/// Describes the Customer-Supplied Encryption Key mechanism used to store an
16211/// Object's data at rest.
16212#[derive(Clone, Debug, Default, PartialEq)]
16213#[non_exhaustive]
16214pub struct CustomerEncryption {
16215    /// Optional. The encryption algorithm.
16216    pub encryption_algorithm: std::string::String,
16217
16218    /// Optional. SHA256 hash value of the encryption key.
16219    /// In raw bytes format (not base64-encoded).
16220    pub key_sha256_bytes: ::bytes::Bytes,
16221
16222    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
16223}
16224
16225impl CustomerEncryption {
16226    pub fn new() -> Self {
16227        std::default::Default::default()
16228    }
16229
16230    /// Sets the value of [encryption_algorithm][crate::model::CustomerEncryption::encryption_algorithm].
16231    pub fn set_encryption_algorithm<T: std::convert::Into<std::string::String>>(
16232        mut self,
16233        v: T,
16234    ) -> Self {
16235        self.encryption_algorithm = v.into();
16236        self
16237    }
16238
16239    /// Sets the value of [key_sha256_bytes][crate::model::CustomerEncryption::key_sha256_bytes].
16240    pub fn set_key_sha256_bytes<T: std::convert::Into<::bytes::Bytes>>(mut self, v: T) -> Self {
16241        self.key_sha256_bytes = v.into();
16242        self
16243    }
16244}
16245
16246impl wkt::message::Message for CustomerEncryption {
16247    fn typename() -> &'static str {
16248        "type.googleapis.com/google.storage.v2.CustomerEncryption"
16249    }
16250}
16251
16252#[doc(hidden)]
16253impl<'de> serde::de::Deserialize<'de> for CustomerEncryption {
16254    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
16255    where
16256        D: serde::Deserializer<'de>,
16257    {
16258        #[allow(non_camel_case_types)]
16259        #[doc(hidden)]
16260        #[derive(PartialEq, Eq, Hash)]
16261        enum __FieldTag {
16262            __encryption_algorithm,
16263            __key_sha256_bytes,
16264            Unknown(std::string::String),
16265        }
16266        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
16267            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
16268            where
16269                D: serde::Deserializer<'de>,
16270            {
16271                struct Visitor;
16272                impl<'de> serde::de::Visitor<'de> for Visitor {
16273                    type Value = __FieldTag;
16274                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
16275                        formatter.write_str("a field name for CustomerEncryption")
16276                    }
16277                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
16278                    where
16279                        E: serde::de::Error,
16280                    {
16281                        use std::result::Result::Ok;
16282                        use std::string::ToString;
16283                        match value {
16284                            "encryptionAlgorithm" => Ok(__FieldTag::__encryption_algorithm),
16285                            "encryption_algorithm" => Ok(__FieldTag::__encryption_algorithm),
16286                            "keySha256Bytes" => Ok(__FieldTag::__key_sha256_bytes),
16287                            "key_sha256_bytes" => Ok(__FieldTag::__key_sha256_bytes),
16288                            _ => Ok(__FieldTag::Unknown(value.to_string())),
16289                        }
16290                    }
16291                }
16292                deserializer.deserialize_identifier(Visitor)
16293            }
16294        }
16295        struct Visitor;
16296        impl<'de> serde::de::Visitor<'de> for Visitor {
16297            type Value = CustomerEncryption;
16298            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
16299                formatter.write_str("struct CustomerEncryption")
16300            }
16301            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
16302            where
16303                A: serde::de::MapAccess<'de>,
16304            {
16305                #[allow(unused_imports)]
16306                use serde::de::Error;
16307                use std::option::Option::Some;
16308                let mut fields = std::collections::HashSet::new();
16309                let mut result = Self::Value::new();
16310                while let Some(tag) = map.next_key::<__FieldTag>()? {
16311                    #[allow(clippy::match_single_binding)]
16312                    match tag {
16313                        __FieldTag::__encryption_algorithm => {
16314                            if !fields.insert(__FieldTag::__encryption_algorithm) {
16315                                return std::result::Result::Err(A::Error::duplicate_field(
16316                                    "multiple values for encryption_algorithm",
16317                                ));
16318                            }
16319                            result.encryption_algorithm = map
16320                                .next_value::<std::option::Option<std::string::String>>()?
16321                                .unwrap_or_default();
16322                        }
16323                        __FieldTag::__key_sha256_bytes => {
16324                            if !fields.insert(__FieldTag::__key_sha256_bytes) {
16325                                return std::result::Result::Err(A::Error::duplicate_field(
16326                                    "multiple values for key_sha256_bytes",
16327                                ));
16328                            }
16329                            struct __With(std::option::Option<::bytes::Bytes>);
16330                            impl<'de> serde::de::Deserialize<'de> for __With {
16331                                fn deserialize<D>(
16332                                    deserializer: D,
16333                                ) -> std::result::Result<Self, D::Error>
16334                                where
16335                                    D: serde::de::Deserializer<'de>,
16336                                {
16337                                    serde_with::As::< std::option::Option<serde_with::base64::Base64> >::deserialize(deserializer).map(__With)
16338                                }
16339                            }
16340                            result.key_sha256_bytes =
16341                                map.next_value::<__With>()?.0.unwrap_or_default();
16342                        }
16343                        __FieldTag::Unknown(key) => {
16344                            let value = map.next_value::<serde_json::Value>()?;
16345                            result._unknown_fields.insert(key, value);
16346                        }
16347                    }
16348                }
16349                std::result::Result::Ok(result)
16350            }
16351        }
16352        deserializer.deserialize_any(Visitor)
16353    }
16354}
16355
16356#[doc(hidden)]
16357impl serde::ser::Serialize for CustomerEncryption {
16358    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
16359    where
16360        S: serde::ser::Serializer,
16361    {
16362        use serde::ser::SerializeMap;
16363        #[allow(unused_imports)]
16364        use std::option::Option::Some;
16365        let mut state = serializer.serialize_map(std::option::Option::None)?;
16366        if !self.encryption_algorithm.is_empty() {
16367            state.serialize_entry("encryptionAlgorithm", &self.encryption_algorithm)?;
16368        }
16369        if !self.key_sha256_bytes.is_empty() {
16370            struct __With<'a>(&'a ::bytes::Bytes);
16371            impl<'a> serde::ser::Serialize for __With<'a> {
16372                fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
16373                where
16374                    S: serde::ser::Serializer,
16375                {
16376                    serde_with::As::<serde_with::base64::Base64>::serialize(self.0, serializer)
16377                }
16378            }
16379            state.serialize_entry("keySha256Bytes", &__With(&self.key_sha256_bytes))?;
16380        }
16381        if !self._unknown_fields.is_empty() {
16382            for (key, value) in self._unknown_fields.iter() {
16383                state.serialize_entry(key, &value)?;
16384            }
16385        }
16386        state.end()
16387    }
16388}
16389
16390/// An object.
16391#[derive(Clone, Debug, Default, PartialEq)]
16392#[non_exhaustive]
16393pub struct Object {
16394    /// Immutable. The name of this object. Nearly any sequence of unicode
16395    /// characters is valid. See
16396    /// [Guidelines](https://cloud.google.com/storage/docs/objects#naming).
16397    /// Example: `test.txt`
16398    /// The `name` field by itself does not uniquely identify a Cloud Storage
16399    /// object. A Cloud Storage object is uniquely identified by the tuple of
16400    /// (bucket, object, generation).
16401    pub name: std::string::String,
16402
16403    /// Immutable. The name of the bucket containing this object.
16404    pub bucket: std::string::String,
16405
16406    /// Optional. The etag of the object.
16407    /// If included in the metadata of an update or delete request message, the
16408    /// operation will only be performed if the etag matches that of the live
16409    /// object.
16410    pub etag: std::string::String,
16411
16412    /// Immutable. The content generation of this object. Used for object
16413    /// versioning.
16414    pub generation: i64,
16415
16416    /// Output only. Restore token used to differentiate deleted objects with the
16417    /// same name and generation. This field is output only, and only set for
16418    /// deleted objects in HNS buckets.
16419    pub restore_token: std::option::Option<std::string::String>,
16420
16421    /// Output only. The version of the metadata for this generation of this
16422    /// object. Used for preconditions and for detecting changes in metadata. A
16423    /// metageneration number is only meaningful in the context of a particular
16424    /// generation of a particular object.
16425    pub metageneration: i64,
16426
16427    /// Optional. Storage class of the object.
16428    pub storage_class: std::string::String,
16429
16430    /// Output only. Content-Length of the object data in bytes, matching
16431    /// [<https://tools.ietf.org/html/rfc7230#section-3.3.2>][RFC 7230 §3.3.2].
16432    pub size: i64,
16433
16434    /// Optional. Content-Encoding of the object data, matching
16435    /// [<https://tools.ietf.org/html/rfc7231#section-3.1.2.2>][RFC 7231 §3.1.2.2]
16436    pub content_encoding: std::string::String,
16437
16438    /// Optional. Content-Disposition of the object data, matching
16439    /// [<https://tools.ietf.org/html/rfc6266>][RFC 6266].
16440    pub content_disposition: std::string::String,
16441
16442    /// Optional. Cache-Control directive for the object data, matching
16443    /// [<https://tools.ietf.org/html/rfc7234#section-5.2>"][RFC 7234 §5.2].
16444    /// If omitted, and the object is accessible to all anonymous users, the
16445    /// default will be `public, max-age=3600`.
16446    pub cache_control: std::string::String,
16447
16448    /// Optional. Access controls on the object.
16449    /// If iam_config.uniform_bucket_level_access is enabled on the parent
16450    /// bucket, requests to set, read, or modify acl is an error.
16451    pub acl: std::vec::Vec<crate::model::ObjectAccessControl>,
16452
16453    /// Optional. Content-Language of the object data, matching
16454    /// [<https://tools.ietf.org/html/rfc7231#section-3.1.3.2>][RFC 7231 §3.1.3.2].
16455    pub content_language: std::string::String,
16456
16457    /// Output only. If this object is noncurrent, this is the time when the object
16458    /// became noncurrent.
16459    pub delete_time: std::option::Option<wkt::Timestamp>,
16460
16461    /// Output only. The time when the object was finalized.
16462    pub finalize_time: std::option::Option<wkt::Timestamp>,
16463
16464    /// Optional. Content-Type of the object data, matching
16465    /// [<https://tools.ietf.org/html/rfc7231#section-3.1.1.5>][RFC 7231 §3.1.1.5].
16466    /// If an object is stored without a Content-Type, it is served as
16467    /// `application/octet-stream`.
16468    pub content_type: std::string::String,
16469
16470    /// Output only. The creation time of the object.
16471    pub create_time: std::option::Option<wkt::Timestamp>,
16472
16473    /// Output only. Number of underlying components that make up this object.
16474    /// Components are accumulated by compose operations.
16475    pub component_count: i32,
16476
16477    /// Output only. Hashes for the data part of this object. This field is used
16478    /// for output only and will be silently ignored if provided in requests. The
16479    /// checksums of the complete object regardless of data range. If the object is
16480    /// downloaded in full, the client should compute one of these checksums over
16481    /// the downloaded object and compare it against the value provided here.
16482    pub checksums: std::option::Option<crate::model::ObjectChecksums>,
16483
16484    /// Output only. The modification time of the object metadata.
16485    /// Set initially to object creation time and then updated whenever any
16486    /// metadata of the object changes. This includes changes made by a requester,
16487    /// such as modifying custom metadata, as well as changes made by Cloud Storage
16488    /// on behalf of a requester, such as changing the storage class based on an
16489    /// Object Lifecycle Configuration.
16490    pub update_time: std::option::Option<wkt::Timestamp>,
16491
16492    /// Optional. Cloud KMS Key used to encrypt this object, if the object is
16493    /// encrypted by such a key.
16494    pub kms_key: std::string::String,
16495
16496    /// Output only. The time at which the object's storage class was last changed.
16497    /// When the object is initially created, it will be set to time_created.
16498    pub update_storage_class_time: std::option::Option<wkt::Timestamp>,
16499
16500    /// Optional. Whether an object is under temporary hold. While this flag is set
16501    /// to true, the object is protected against deletion and overwrites.  A common
16502    /// use case of this flag is regulatory investigations where objects need to be
16503    /// retained while the investigation is ongoing. Note that unlike event-based
16504    /// hold, temporary hold does not impact retention expiration time of an
16505    /// object.
16506    pub temporary_hold: bool,
16507
16508    /// Optional. A server-determined value that specifies the earliest time that
16509    /// the object's retention period expires. Note 1: This field is not provided
16510    /// for objects with an active event-based hold, since retention expiration is
16511    /// unknown until the hold is removed. Note 2: This value can be provided even
16512    /// when temporary hold is set (so that the user can reason about policy
16513    /// without having to first unset the temporary hold).
16514    pub retention_expire_time: std::option::Option<wkt::Timestamp>,
16515
16516    /// Optional. User-provided metadata, in key/value pairs.
16517    pub metadata: std::collections::HashMap<std::string::String, std::string::String>,
16518
16519    /// Optional. User-defined or system-defined object contexts. Each object
16520    /// context is a key-payload pair, where the key provides the identification
16521    /// and the payload holds the associated value and additional metadata.
16522    pub contexts: std::option::Option<crate::model::ObjectContexts>,
16523
16524    /// Whether an object is under event-based hold.
16525    /// An event-based hold is a way to force the retention of an object until
16526    /// after some event occurs. Once the hold is released by explicitly setting
16527    /// this field to false, the object will become subject to any bucket-level
16528    /// retention policy, except that the retention duration will be calculated
16529    /// from the time the event based hold was lifted, rather than the time the
16530    /// object was created.
16531    ///
16532    /// In a WriteObject request, not setting this field implies that the value
16533    /// should be taken from the parent bucket's "default_event_based_hold" field.
16534    /// In a response, this field will always be set to true or false.
16535    pub event_based_hold: std::option::Option<bool>,
16536
16537    /// Output only. The owner of the object. This will always be the uploader of
16538    /// the object.
16539    pub owner: std::option::Option<crate::model::Owner>,
16540
16541    /// Optional. Metadata of Customer-Supplied Encryption Key, if the object is
16542    /// encrypted by such a key.
16543    pub customer_encryption: std::option::Option<crate::model::CustomerEncryption>,
16544
16545    /// Optional. A user-specified timestamp set on an object.
16546    pub custom_time: std::option::Option<wkt::Timestamp>,
16547
16548    /// Output only. This is the time when the object became soft-deleted.
16549    ///
16550    /// Soft-deleted objects are only accessible if a soft_delete_policy is
16551    /// enabled. Also see hard_delete_time.
16552    pub soft_delete_time: std::option::Option<wkt::Timestamp>,
16553
16554    /// Output only. The time when the object will be permanently deleted.
16555    ///
16556    /// Only set when an object becomes soft-deleted with a soft_delete_policy.
16557    /// Otherwise, the object will not be accessible.
16558    pub hard_delete_time: std::option::Option<wkt::Timestamp>,
16559
16560    /// Optional. Retention configuration of this object.
16561    /// May only be configured if the bucket has object retention enabled.
16562    pub retention: std::option::Option<crate::model::object::Retention>,
16563
16564    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
16565}
16566
16567impl Object {
16568    pub fn new() -> Self {
16569        std::default::Default::default()
16570    }
16571
16572    /// Sets the value of [name][crate::model::Object::name].
16573    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
16574        self.name = v.into();
16575        self
16576    }
16577
16578    /// Sets the value of [bucket][crate::model::Object::bucket].
16579    pub fn set_bucket<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
16580        self.bucket = v.into();
16581        self
16582    }
16583
16584    /// Sets the value of [etag][crate::model::Object::etag].
16585    pub fn set_etag<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
16586        self.etag = v.into();
16587        self
16588    }
16589
16590    /// Sets the value of [generation][crate::model::Object::generation].
16591    pub fn set_generation<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
16592        self.generation = v.into();
16593        self
16594    }
16595
16596    /// Sets the value of [restore_token][crate::model::Object::restore_token].
16597    pub fn set_restore_token<T>(mut self, v: T) -> Self
16598    where
16599        T: std::convert::Into<std::string::String>,
16600    {
16601        self.restore_token = std::option::Option::Some(v.into());
16602        self
16603    }
16604
16605    /// Sets or clears the value of [restore_token][crate::model::Object::restore_token].
16606    pub fn set_or_clear_restore_token<T>(mut self, v: std::option::Option<T>) -> Self
16607    where
16608        T: std::convert::Into<std::string::String>,
16609    {
16610        self.restore_token = v.map(|x| x.into());
16611        self
16612    }
16613
16614    /// Sets the value of [metageneration][crate::model::Object::metageneration].
16615    pub fn set_metageneration<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
16616        self.metageneration = v.into();
16617        self
16618    }
16619
16620    /// Sets the value of [storage_class][crate::model::Object::storage_class].
16621    pub fn set_storage_class<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
16622        self.storage_class = v.into();
16623        self
16624    }
16625
16626    /// Sets the value of [size][crate::model::Object::size].
16627    pub fn set_size<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
16628        self.size = v.into();
16629        self
16630    }
16631
16632    /// Sets the value of [content_encoding][crate::model::Object::content_encoding].
16633    pub fn set_content_encoding<T: std::convert::Into<std::string::String>>(
16634        mut self,
16635        v: T,
16636    ) -> Self {
16637        self.content_encoding = v.into();
16638        self
16639    }
16640
16641    /// Sets the value of [content_disposition][crate::model::Object::content_disposition].
16642    pub fn set_content_disposition<T: std::convert::Into<std::string::String>>(
16643        mut self,
16644        v: T,
16645    ) -> Self {
16646        self.content_disposition = v.into();
16647        self
16648    }
16649
16650    /// Sets the value of [cache_control][crate::model::Object::cache_control].
16651    pub fn set_cache_control<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
16652        self.cache_control = v.into();
16653        self
16654    }
16655
16656    /// Sets the value of [acl][crate::model::Object::acl].
16657    pub fn set_acl<T, V>(mut self, v: T) -> Self
16658    where
16659        T: std::iter::IntoIterator<Item = V>,
16660        V: std::convert::Into<crate::model::ObjectAccessControl>,
16661    {
16662        use std::iter::Iterator;
16663        self.acl = v.into_iter().map(|i| i.into()).collect();
16664        self
16665    }
16666
16667    /// Sets the value of [content_language][crate::model::Object::content_language].
16668    pub fn set_content_language<T: std::convert::Into<std::string::String>>(
16669        mut self,
16670        v: T,
16671    ) -> Self {
16672        self.content_language = v.into();
16673        self
16674    }
16675
16676    /// Sets the value of [delete_time][crate::model::Object::delete_time].
16677    pub fn set_delete_time<T>(mut self, v: T) -> Self
16678    where
16679        T: std::convert::Into<wkt::Timestamp>,
16680    {
16681        self.delete_time = std::option::Option::Some(v.into());
16682        self
16683    }
16684
16685    /// Sets or clears the value of [delete_time][crate::model::Object::delete_time].
16686    pub fn set_or_clear_delete_time<T>(mut self, v: std::option::Option<T>) -> Self
16687    where
16688        T: std::convert::Into<wkt::Timestamp>,
16689    {
16690        self.delete_time = v.map(|x| x.into());
16691        self
16692    }
16693
16694    /// Sets the value of [finalize_time][crate::model::Object::finalize_time].
16695    pub fn set_finalize_time<T>(mut self, v: T) -> Self
16696    where
16697        T: std::convert::Into<wkt::Timestamp>,
16698    {
16699        self.finalize_time = std::option::Option::Some(v.into());
16700        self
16701    }
16702
16703    /// Sets or clears the value of [finalize_time][crate::model::Object::finalize_time].
16704    pub fn set_or_clear_finalize_time<T>(mut self, v: std::option::Option<T>) -> Self
16705    where
16706        T: std::convert::Into<wkt::Timestamp>,
16707    {
16708        self.finalize_time = v.map(|x| x.into());
16709        self
16710    }
16711
16712    /// Sets the value of [content_type][crate::model::Object::content_type].
16713    pub fn set_content_type<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
16714        self.content_type = v.into();
16715        self
16716    }
16717
16718    /// Sets the value of [create_time][crate::model::Object::create_time].
16719    pub fn set_create_time<T>(mut self, v: T) -> Self
16720    where
16721        T: std::convert::Into<wkt::Timestamp>,
16722    {
16723        self.create_time = std::option::Option::Some(v.into());
16724        self
16725    }
16726
16727    /// Sets or clears the value of [create_time][crate::model::Object::create_time].
16728    pub fn set_or_clear_create_time<T>(mut self, v: std::option::Option<T>) -> Self
16729    where
16730        T: std::convert::Into<wkt::Timestamp>,
16731    {
16732        self.create_time = v.map(|x| x.into());
16733        self
16734    }
16735
16736    /// Sets the value of [component_count][crate::model::Object::component_count].
16737    pub fn set_component_count<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
16738        self.component_count = v.into();
16739        self
16740    }
16741
16742    /// Sets the value of [checksums][crate::model::Object::checksums].
16743    pub fn set_checksums<T>(mut self, v: T) -> Self
16744    where
16745        T: std::convert::Into<crate::model::ObjectChecksums>,
16746    {
16747        self.checksums = std::option::Option::Some(v.into());
16748        self
16749    }
16750
16751    /// Sets or clears the value of [checksums][crate::model::Object::checksums].
16752    pub fn set_or_clear_checksums<T>(mut self, v: std::option::Option<T>) -> Self
16753    where
16754        T: std::convert::Into<crate::model::ObjectChecksums>,
16755    {
16756        self.checksums = v.map(|x| x.into());
16757        self
16758    }
16759
16760    /// Sets the value of [update_time][crate::model::Object::update_time].
16761    pub fn set_update_time<T>(mut self, v: T) -> Self
16762    where
16763        T: std::convert::Into<wkt::Timestamp>,
16764    {
16765        self.update_time = std::option::Option::Some(v.into());
16766        self
16767    }
16768
16769    /// Sets or clears the value of [update_time][crate::model::Object::update_time].
16770    pub fn set_or_clear_update_time<T>(mut self, v: std::option::Option<T>) -> Self
16771    where
16772        T: std::convert::Into<wkt::Timestamp>,
16773    {
16774        self.update_time = v.map(|x| x.into());
16775        self
16776    }
16777
16778    /// Sets the value of [kms_key][crate::model::Object::kms_key].
16779    pub fn set_kms_key<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
16780        self.kms_key = v.into();
16781        self
16782    }
16783
16784    /// Sets the value of [update_storage_class_time][crate::model::Object::update_storage_class_time].
16785    pub fn set_update_storage_class_time<T>(mut self, v: T) -> Self
16786    where
16787        T: std::convert::Into<wkt::Timestamp>,
16788    {
16789        self.update_storage_class_time = std::option::Option::Some(v.into());
16790        self
16791    }
16792
16793    /// Sets or clears the value of [update_storage_class_time][crate::model::Object::update_storage_class_time].
16794    pub fn set_or_clear_update_storage_class_time<T>(mut self, v: std::option::Option<T>) -> Self
16795    where
16796        T: std::convert::Into<wkt::Timestamp>,
16797    {
16798        self.update_storage_class_time = v.map(|x| x.into());
16799        self
16800    }
16801
16802    /// Sets the value of [temporary_hold][crate::model::Object::temporary_hold].
16803    pub fn set_temporary_hold<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
16804        self.temporary_hold = v.into();
16805        self
16806    }
16807
16808    /// Sets the value of [retention_expire_time][crate::model::Object::retention_expire_time].
16809    pub fn set_retention_expire_time<T>(mut self, v: T) -> Self
16810    where
16811        T: std::convert::Into<wkt::Timestamp>,
16812    {
16813        self.retention_expire_time = std::option::Option::Some(v.into());
16814        self
16815    }
16816
16817    /// Sets or clears the value of [retention_expire_time][crate::model::Object::retention_expire_time].
16818    pub fn set_or_clear_retention_expire_time<T>(mut self, v: std::option::Option<T>) -> Self
16819    where
16820        T: std::convert::Into<wkt::Timestamp>,
16821    {
16822        self.retention_expire_time = v.map(|x| x.into());
16823        self
16824    }
16825
16826    /// Sets the value of [metadata][crate::model::Object::metadata].
16827    pub fn set_metadata<T, K, V>(mut self, v: T) -> Self
16828    where
16829        T: std::iter::IntoIterator<Item = (K, V)>,
16830        K: std::convert::Into<std::string::String>,
16831        V: std::convert::Into<std::string::String>,
16832    {
16833        use std::iter::Iterator;
16834        self.metadata = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
16835        self
16836    }
16837
16838    /// Sets the value of [contexts][crate::model::Object::contexts].
16839    pub fn set_contexts<T>(mut self, v: T) -> Self
16840    where
16841        T: std::convert::Into<crate::model::ObjectContexts>,
16842    {
16843        self.contexts = std::option::Option::Some(v.into());
16844        self
16845    }
16846
16847    /// Sets or clears the value of [contexts][crate::model::Object::contexts].
16848    pub fn set_or_clear_contexts<T>(mut self, v: std::option::Option<T>) -> Self
16849    where
16850        T: std::convert::Into<crate::model::ObjectContexts>,
16851    {
16852        self.contexts = v.map(|x| x.into());
16853        self
16854    }
16855
16856    /// Sets the value of [event_based_hold][crate::model::Object::event_based_hold].
16857    pub fn set_event_based_hold<T>(mut self, v: T) -> Self
16858    where
16859        T: std::convert::Into<bool>,
16860    {
16861        self.event_based_hold = std::option::Option::Some(v.into());
16862        self
16863    }
16864
16865    /// Sets or clears the value of [event_based_hold][crate::model::Object::event_based_hold].
16866    pub fn set_or_clear_event_based_hold<T>(mut self, v: std::option::Option<T>) -> Self
16867    where
16868        T: std::convert::Into<bool>,
16869    {
16870        self.event_based_hold = v.map(|x| x.into());
16871        self
16872    }
16873
16874    /// Sets the value of [owner][crate::model::Object::owner].
16875    pub fn set_owner<T>(mut self, v: T) -> Self
16876    where
16877        T: std::convert::Into<crate::model::Owner>,
16878    {
16879        self.owner = std::option::Option::Some(v.into());
16880        self
16881    }
16882
16883    /// Sets or clears the value of [owner][crate::model::Object::owner].
16884    pub fn set_or_clear_owner<T>(mut self, v: std::option::Option<T>) -> Self
16885    where
16886        T: std::convert::Into<crate::model::Owner>,
16887    {
16888        self.owner = v.map(|x| x.into());
16889        self
16890    }
16891
16892    /// Sets the value of [customer_encryption][crate::model::Object::customer_encryption].
16893    pub fn set_customer_encryption<T>(mut self, v: T) -> Self
16894    where
16895        T: std::convert::Into<crate::model::CustomerEncryption>,
16896    {
16897        self.customer_encryption = std::option::Option::Some(v.into());
16898        self
16899    }
16900
16901    /// Sets or clears the value of [customer_encryption][crate::model::Object::customer_encryption].
16902    pub fn set_or_clear_customer_encryption<T>(mut self, v: std::option::Option<T>) -> Self
16903    where
16904        T: std::convert::Into<crate::model::CustomerEncryption>,
16905    {
16906        self.customer_encryption = v.map(|x| x.into());
16907        self
16908    }
16909
16910    /// Sets the value of [custom_time][crate::model::Object::custom_time].
16911    pub fn set_custom_time<T>(mut self, v: T) -> Self
16912    where
16913        T: std::convert::Into<wkt::Timestamp>,
16914    {
16915        self.custom_time = std::option::Option::Some(v.into());
16916        self
16917    }
16918
16919    /// Sets or clears the value of [custom_time][crate::model::Object::custom_time].
16920    pub fn set_or_clear_custom_time<T>(mut self, v: std::option::Option<T>) -> Self
16921    where
16922        T: std::convert::Into<wkt::Timestamp>,
16923    {
16924        self.custom_time = v.map(|x| x.into());
16925        self
16926    }
16927
16928    /// Sets the value of [soft_delete_time][crate::model::Object::soft_delete_time].
16929    pub fn set_soft_delete_time<T>(mut self, v: T) -> Self
16930    where
16931        T: std::convert::Into<wkt::Timestamp>,
16932    {
16933        self.soft_delete_time = std::option::Option::Some(v.into());
16934        self
16935    }
16936
16937    /// Sets or clears the value of [soft_delete_time][crate::model::Object::soft_delete_time].
16938    pub fn set_or_clear_soft_delete_time<T>(mut self, v: std::option::Option<T>) -> Self
16939    where
16940        T: std::convert::Into<wkt::Timestamp>,
16941    {
16942        self.soft_delete_time = v.map(|x| x.into());
16943        self
16944    }
16945
16946    /// Sets the value of [hard_delete_time][crate::model::Object::hard_delete_time].
16947    pub fn set_hard_delete_time<T>(mut self, v: T) -> Self
16948    where
16949        T: std::convert::Into<wkt::Timestamp>,
16950    {
16951        self.hard_delete_time = std::option::Option::Some(v.into());
16952        self
16953    }
16954
16955    /// Sets or clears the value of [hard_delete_time][crate::model::Object::hard_delete_time].
16956    pub fn set_or_clear_hard_delete_time<T>(mut self, v: std::option::Option<T>) -> Self
16957    where
16958        T: std::convert::Into<wkt::Timestamp>,
16959    {
16960        self.hard_delete_time = v.map(|x| x.into());
16961        self
16962    }
16963
16964    /// Sets the value of [retention][crate::model::Object::retention].
16965    pub fn set_retention<T>(mut self, v: T) -> Self
16966    where
16967        T: std::convert::Into<crate::model::object::Retention>,
16968    {
16969        self.retention = std::option::Option::Some(v.into());
16970        self
16971    }
16972
16973    /// Sets or clears the value of [retention][crate::model::Object::retention].
16974    pub fn set_or_clear_retention<T>(mut self, v: std::option::Option<T>) -> Self
16975    where
16976        T: std::convert::Into<crate::model::object::Retention>,
16977    {
16978        self.retention = v.map(|x| x.into());
16979        self
16980    }
16981}
16982
16983impl wkt::message::Message for Object {
16984    fn typename() -> &'static str {
16985        "type.googleapis.com/google.storage.v2.Object"
16986    }
16987}
16988
16989#[doc(hidden)]
16990impl<'de> serde::de::Deserialize<'de> for Object {
16991    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
16992    where
16993        D: serde::Deserializer<'de>,
16994    {
16995        #[allow(non_camel_case_types)]
16996        #[doc(hidden)]
16997        #[derive(PartialEq, Eq, Hash)]
16998        enum __FieldTag {
16999            __name,
17000            __bucket,
17001            __etag,
17002            __generation,
17003            __restore_token,
17004            __metageneration,
17005            __storage_class,
17006            __size,
17007            __content_encoding,
17008            __content_disposition,
17009            __cache_control,
17010            __acl,
17011            __content_language,
17012            __delete_time,
17013            __finalize_time,
17014            __content_type,
17015            __create_time,
17016            __component_count,
17017            __checksums,
17018            __update_time,
17019            __kms_key,
17020            __update_storage_class_time,
17021            __temporary_hold,
17022            __retention_expire_time,
17023            __metadata,
17024            __contexts,
17025            __event_based_hold,
17026            __owner,
17027            __customer_encryption,
17028            __custom_time,
17029            __soft_delete_time,
17030            __hard_delete_time,
17031            __retention,
17032            Unknown(std::string::String),
17033        }
17034        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
17035            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
17036            where
17037                D: serde::Deserializer<'de>,
17038            {
17039                struct Visitor;
17040                impl<'de> serde::de::Visitor<'de> for Visitor {
17041                    type Value = __FieldTag;
17042                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
17043                        formatter.write_str("a field name for Object")
17044                    }
17045                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
17046                    where
17047                        E: serde::de::Error,
17048                    {
17049                        use std::result::Result::Ok;
17050                        use std::string::ToString;
17051                        match value {
17052                            "name" => Ok(__FieldTag::__name),
17053                            "bucket" => Ok(__FieldTag::__bucket),
17054                            "etag" => Ok(__FieldTag::__etag),
17055                            "generation" => Ok(__FieldTag::__generation),
17056                            "restoreToken" => Ok(__FieldTag::__restore_token),
17057                            "restore_token" => Ok(__FieldTag::__restore_token),
17058                            "metageneration" => Ok(__FieldTag::__metageneration),
17059                            "storageClass" => Ok(__FieldTag::__storage_class),
17060                            "storage_class" => Ok(__FieldTag::__storage_class),
17061                            "size" => Ok(__FieldTag::__size),
17062                            "contentEncoding" => Ok(__FieldTag::__content_encoding),
17063                            "content_encoding" => Ok(__FieldTag::__content_encoding),
17064                            "contentDisposition" => Ok(__FieldTag::__content_disposition),
17065                            "content_disposition" => Ok(__FieldTag::__content_disposition),
17066                            "cacheControl" => Ok(__FieldTag::__cache_control),
17067                            "cache_control" => Ok(__FieldTag::__cache_control),
17068                            "acl" => Ok(__FieldTag::__acl),
17069                            "contentLanguage" => Ok(__FieldTag::__content_language),
17070                            "content_language" => Ok(__FieldTag::__content_language),
17071                            "deleteTime" => Ok(__FieldTag::__delete_time),
17072                            "delete_time" => Ok(__FieldTag::__delete_time),
17073                            "finalizeTime" => Ok(__FieldTag::__finalize_time),
17074                            "finalize_time" => Ok(__FieldTag::__finalize_time),
17075                            "contentType" => Ok(__FieldTag::__content_type),
17076                            "content_type" => Ok(__FieldTag::__content_type),
17077                            "createTime" => Ok(__FieldTag::__create_time),
17078                            "create_time" => Ok(__FieldTag::__create_time),
17079                            "componentCount" => Ok(__FieldTag::__component_count),
17080                            "component_count" => Ok(__FieldTag::__component_count),
17081                            "checksums" => Ok(__FieldTag::__checksums),
17082                            "updateTime" => Ok(__FieldTag::__update_time),
17083                            "update_time" => Ok(__FieldTag::__update_time),
17084                            "kmsKey" => Ok(__FieldTag::__kms_key),
17085                            "kms_key" => Ok(__FieldTag::__kms_key),
17086                            "updateStorageClassTime" => Ok(__FieldTag::__update_storage_class_time),
17087                            "update_storage_class_time" => {
17088                                Ok(__FieldTag::__update_storage_class_time)
17089                            }
17090                            "temporaryHold" => Ok(__FieldTag::__temporary_hold),
17091                            "temporary_hold" => Ok(__FieldTag::__temporary_hold),
17092                            "retentionExpireTime" => Ok(__FieldTag::__retention_expire_time),
17093                            "retention_expire_time" => Ok(__FieldTag::__retention_expire_time),
17094                            "metadata" => Ok(__FieldTag::__metadata),
17095                            "contexts" => Ok(__FieldTag::__contexts),
17096                            "eventBasedHold" => Ok(__FieldTag::__event_based_hold),
17097                            "event_based_hold" => Ok(__FieldTag::__event_based_hold),
17098                            "owner" => Ok(__FieldTag::__owner),
17099                            "customerEncryption" => Ok(__FieldTag::__customer_encryption),
17100                            "customer_encryption" => Ok(__FieldTag::__customer_encryption),
17101                            "customTime" => Ok(__FieldTag::__custom_time),
17102                            "custom_time" => Ok(__FieldTag::__custom_time),
17103                            "softDeleteTime" => Ok(__FieldTag::__soft_delete_time),
17104                            "soft_delete_time" => Ok(__FieldTag::__soft_delete_time),
17105                            "hardDeleteTime" => Ok(__FieldTag::__hard_delete_time),
17106                            "hard_delete_time" => Ok(__FieldTag::__hard_delete_time),
17107                            "retention" => Ok(__FieldTag::__retention),
17108                            _ => Ok(__FieldTag::Unknown(value.to_string())),
17109                        }
17110                    }
17111                }
17112                deserializer.deserialize_identifier(Visitor)
17113            }
17114        }
17115        struct Visitor;
17116        impl<'de> serde::de::Visitor<'de> for Visitor {
17117            type Value = Object;
17118            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
17119                formatter.write_str("struct Object")
17120            }
17121            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
17122            where
17123                A: serde::de::MapAccess<'de>,
17124            {
17125                #[allow(unused_imports)]
17126                use serde::de::Error;
17127                use std::option::Option::Some;
17128                let mut fields = std::collections::HashSet::new();
17129                let mut result = Self::Value::new();
17130                while let Some(tag) = map.next_key::<__FieldTag>()? {
17131                    #[allow(clippy::match_single_binding)]
17132                    match tag {
17133                        __FieldTag::__name => {
17134                            if !fields.insert(__FieldTag::__name) {
17135                                return std::result::Result::Err(A::Error::duplicate_field(
17136                                    "multiple values for name",
17137                                ));
17138                            }
17139                            result.name = map
17140                                .next_value::<std::option::Option<std::string::String>>()?
17141                                .unwrap_or_default();
17142                        }
17143                        __FieldTag::__bucket => {
17144                            if !fields.insert(__FieldTag::__bucket) {
17145                                return std::result::Result::Err(A::Error::duplicate_field(
17146                                    "multiple values for bucket",
17147                                ));
17148                            }
17149                            result.bucket = map
17150                                .next_value::<std::option::Option<std::string::String>>()?
17151                                .unwrap_or_default();
17152                        }
17153                        __FieldTag::__etag => {
17154                            if !fields.insert(__FieldTag::__etag) {
17155                                return std::result::Result::Err(A::Error::duplicate_field(
17156                                    "multiple values for etag",
17157                                ));
17158                            }
17159                            result.etag = map
17160                                .next_value::<std::option::Option<std::string::String>>()?
17161                                .unwrap_or_default();
17162                        }
17163                        __FieldTag::__generation => {
17164                            if !fields.insert(__FieldTag::__generation) {
17165                                return std::result::Result::Err(A::Error::duplicate_field(
17166                                    "multiple values for generation",
17167                                ));
17168                            }
17169                            struct __With(std::option::Option<i64>);
17170                            impl<'de> serde::de::Deserialize<'de> for __With {
17171                                fn deserialize<D>(
17172                                    deserializer: D,
17173                                ) -> std::result::Result<Self, D::Error>
17174                                where
17175                                    D: serde::de::Deserializer<'de>,
17176                                {
17177                                    serde_with::As::< std::option::Option<wkt::internal::I64> >::deserialize(deserializer).map(__With)
17178                                }
17179                            }
17180                            result.generation = map.next_value::<__With>()?.0.unwrap_or_default();
17181                        }
17182                        __FieldTag::__restore_token => {
17183                            if !fields.insert(__FieldTag::__restore_token) {
17184                                return std::result::Result::Err(A::Error::duplicate_field(
17185                                    "multiple values for restore_token",
17186                                ));
17187                            }
17188                            result.restore_token =
17189                                map.next_value::<std::option::Option<std::string::String>>()?;
17190                        }
17191                        __FieldTag::__metageneration => {
17192                            if !fields.insert(__FieldTag::__metageneration) {
17193                                return std::result::Result::Err(A::Error::duplicate_field(
17194                                    "multiple values for metageneration",
17195                                ));
17196                            }
17197                            struct __With(std::option::Option<i64>);
17198                            impl<'de> serde::de::Deserialize<'de> for __With {
17199                                fn deserialize<D>(
17200                                    deserializer: D,
17201                                ) -> std::result::Result<Self, D::Error>
17202                                where
17203                                    D: serde::de::Deserializer<'de>,
17204                                {
17205                                    serde_with::As::< std::option::Option<wkt::internal::I64> >::deserialize(deserializer).map(__With)
17206                                }
17207                            }
17208                            result.metageneration =
17209                                map.next_value::<__With>()?.0.unwrap_or_default();
17210                        }
17211                        __FieldTag::__storage_class => {
17212                            if !fields.insert(__FieldTag::__storage_class) {
17213                                return std::result::Result::Err(A::Error::duplicate_field(
17214                                    "multiple values for storage_class",
17215                                ));
17216                            }
17217                            result.storage_class = map
17218                                .next_value::<std::option::Option<std::string::String>>()?
17219                                .unwrap_or_default();
17220                        }
17221                        __FieldTag::__size => {
17222                            if !fields.insert(__FieldTag::__size) {
17223                                return std::result::Result::Err(A::Error::duplicate_field(
17224                                    "multiple values for size",
17225                                ));
17226                            }
17227                            struct __With(std::option::Option<i64>);
17228                            impl<'de> serde::de::Deserialize<'de> for __With {
17229                                fn deserialize<D>(
17230                                    deserializer: D,
17231                                ) -> std::result::Result<Self, D::Error>
17232                                where
17233                                    D: serde::de::Deserializer<'de>,
17234                                {
17235                                    serde_with::As::< std::option::Option<wkt::internal::I64> >::deserialize(deserializer).map(__With)
17236                                }
17237                            }
17238                            result.size = map.next_value::<__With>()?.0.unwrap_or_default();
17239                        }
17240                        __FieldTag::__content_encoding => {
17241                            if !fields.insert(__FieldTag::__content_encoding) {
17242                                return std::result::Result::Err(A::Error::duplicate_field(
17243                                    "multiple values for content_encoding",
17244                                ));
17245                            }
17246                            result.content_encoding = map
17247                                .next_value::<std::option::Option<std::string::String>>()?
17248                                .unwrap_or_default();
17249                        }
17250                        __FieldTag::__content_disposition => {
17251                            if !fields.insert(__FieldTag::__content_disposition) {
17252                                return std::result::Result::Err(A::Error::duplicate_field(
17253                                    "multiple values for content_disposition",
17254                                ));
17255                            }
17256                            result.content_disposition = map
17257                                .next_value::<std::option::Option<std::string::String>>()?
17258                                .unwrap_or_default();
17259                        }
17260                        __FieldTag::__cache_control => {
17261                            if !fields.insert(__FieldTag::__cache_control) {
17262                                return std::result::Result::Err(A::Error::duplicate_field(
17263                                    "multiple values for cache_control",
17264                                ));
17265                            }
17266                            result.cache_control = map
17267                                .next_value::<std::option::Option<std::string::String>>()?
17268                                .unwrap_or_default();
17269                        }
17270                        __FieldTag::__acl => {
17271                            if !fields.insert(__FieldTag::__acl) {
17272                                return std::result::Result::Err(A::Error::duplicate_field(
17273                                    "multiple values for acl",
17274                                ));
17275                            }
17276                            result.acl = map
17277                                .next_value::<std::option::Option<
17278                                    std::vec::Vec<crate::model::ObjectAccessControl>,
17279                                >>()?
17280                                .unwrap_or_default();
17281                        }
17282                        __FieldTag::__content_language => {
17283                            if !fields.insert(__FieldTag::__content_language) {
17284                                return std::result::Result::Err(A::Error::duplicate_field(
17285                                    "multiple values for content_language",
17286                                ));
17287                            }
17288                            result.content_language = map
17289                                .next_value::<std::option::Option<std::string::String>>()?
17290                                .unwrap_or_default();
17291                        }
17292                        __FieldTag::__delete_time => {
17293                            if !fields.insert(__FieldTag::__delete_time) {
17294                                return std::result::Result::Err(A::Error::duplicate_field(
17295                                    "multiple values for delete_time",
17296                                ));
17297                            }
17298                            result.delete_time =
17299                                map.next_value::<std::option::Option<wkt::Timestamp>>()?;
17300                        }
17301                        __FieldTag::__finalize_time => {
17302                            if !fields.insert(__FieldTag::__finalize_time) {
17303                                return std::result::Result::Err(A::Error::duplicate_field(
17304                                    "multiple values for finalize_time",
17305                                ));
17306                            }
17307                            result.finalize_time =
17308                                map.next_value::<std::option::Option<wkt::Timestamp>>()?;
17309                        }
17310                        __FieldTag::__content_type => {
17311                            if !fields.insert(__FieldTag::__content_type) {
17312                                return std::result::Result::Err(A::Error::duplicate_field(
17313                                    "multiple values for content_type",
17314                                ));
17315                            }
17316                            result.content_type = map
17317                                .next_value::<std::option::Option<std::string::String>>()?
17318                                .unwrap_or_default();
17319                        }
17320                        __FieldTag::__create_time => {
17321                            if !fields.insert(__FieldTag::__create_time) {
17322                                return std::result::Result::Err(A::Error::duplicate_field(
17323                                    "multiple values for create_time",
17324                                ));
17325                            }
17326                            result.create_time =
17327                                map.next_value::<std::option::Option<wkt::Timestamp>>()?;
17328                        }
17329                        __FieldTag::__component_count => {
17330                            if !fields.insert(__FieldTag::__component_count) {
17331                                return std::result::Result::Err(A::Error::duplicate_field(
17332                                    "multiple values for component_count",
17333                                ));
17334                            }
17335                            struct __With(std::option::Option<i32>);
17336                            impl<'de> serde::de::Deserialize<'de> for __With {
17337                                fn deserialize<D>(
17338                                    deserializer: D,
17339                                ) -> std::result::Result<Self, D::Error>
17340                                where
17341                                    D: serde::de::Deserializer<'de>,
17342                                {
17343                                    serde_with::As::< std::option::Option<wkt::internal::I32> >::deserialize(deserializer).map(__With)
17344                                }
17345                            }
17346                            result.component_count =
17347                                map.next_value::<__With>()?.0.unwrap_or_default();
17348                        }
17349                        __FieldTag::__checksums => {
17350                            if !fields.insert(__FieldTag::__checksums) {
17351                                return std::result::Result::Err(A::Error::duplicate_field(
17352                                    "multiple values for checksums",
17353                                ));
17354                            }
17355                            result.checksums = map
17356                                .next_value::<std::option::Option<crate::model::ObjectChecksums>>(
17357                                )?;
17358                        }
17359                        __FieldTag::__update_time => {
17360                            if !fields.insert(__FieldTag::__update_time) {
17361                                return std::result::Result::Err(A::Error::duplicate_field(
17362                                    "multiple values for update_time",
17363                                ));
17364                            }
17365                            result.update_time =
17366                                map.next_value::<std::option::Option<wkt::Timestamp>>()?;
17367                        }
17368                        __FieldTag::__kms_key => {
17369                            if !fields.insert(__FieldTag::__kms_key) {
17370                                return std::result::Result::Err(A::Error::duplicate_field(
17371                                    "multiple values for kms_key",
17372                                ));
17373                            }
17374                            result.kms_key = map
17375                                .next_value::<std::option::Option<std::string::String>>()?
17376                                .unwrap_or_default();
17377                        }
17378                        __FieldTag::__update_storage_class_time => {
17379                            if !fields.insert(__FieldTag::__update_storage_class_time) {
17380                                return std::result::Result::Err(A::Error::duplicate_field(
17381                                    "multiple values for update_storage_class_time",
17382                                ));
17383                            }
17384                            result.update_storage_class_time =
17385                                map.next_value::<std::option::Option<wkt::Timestamp>>()?;
17386                        }
17387                        __FieldTag::__temporary_hold => {
17388                            if !fields.insert(__FieldTag::__temporary_hold) {
17389                                return std::result::Result::Err(A::Error::duplicate_field(
17390                                    "multiple values for temporary_hold",
17391                                ));
17392                            }
17393                            result.temporary_hold = map
17394                                .next_value::<std::option::Option<bool>>()?
17395                                .unwrap_or_default();
17396                        }
17397                        __FieldTag::__retention_expire_time => {
17398                            if !fields.insert(__FieldTag::__retention_expire_time) {
17399                                return std::result::Result::Err(A::Error::duplicate_field(
17400                                    "multiple values for retention_expire_time",
17401                                ));
17402                            }
17403                            result.retention_expire_time =
17404                                map.next_value::<std::option::Option<wkt::Timestamp>>()?;
17405                        }
17406                        __FieldTag::__metadata => {
17407                            if !fields.insert(__FieldTag::__metadata) {
17408                                return std::result::Result::Err(A::Error::duplicate_field(
17409                                    "multiple values for metadata",
17410                                ));
17411                            }
17412                            result.metadata = map
17413                                .next_value::<std::option::Option<
17414                                    std::collections::HashMap<
17415                                        std::string::String,
17416                                        std::string::String,
17417                                    >,
17418                                >>()?
17419                                .unwrap_or_default();
17420                        }
17421                        __FieldTag::__contexts => {
17422                            if !fields.insert(__FieldTag::__contexts) {
17423                                return std::result::Result::Err(A::Error::duplicate_field(
17424                                    "multiple values for contexts",
17425                                ));
17426                            }
17427                            result.contexts = map
17428                                .next_value::<std::option::Option<crate::model::ObjectContexts>>(
17429                                )?;
17430                        }
17431                        __FieldTag::__event_based_hold => {
17432                            if !fields.insert(__FieldTag::__event_based_hold) {
17433                                return std::result::Result::Err(A::Error::duplicate_field(
17434                                    "multiple values for event_based_hold",
17435                                ));
17436                            }
17437                            result.event_based_hold =
17438                                map.next_value::<std::option::Option<bool>>()?;
17439                        }
17440                        __FieldTag::__owner => {
17441                            if !fields.insert(__FieldTag::__owner) {
17442                                return std::result::Result::Err(A::Error::duplicate_field(
17443                                    "multiple values for owner",
17444                                ));
17445                            }
17446                            result.owner =
17447                                map.next_value::<std::option::Option<crate::model::Owner>>()?;
17448                        }
17449                        __FieldTag::__customer_encryption => {
17450                            if !fields.insert(__FieldTag::__customer_encryption) {
17451                                return std::result::Result::Err(A::Error::duplicate_field(
17452                                    "multiple values for customer_encryption",
17453                                ));
17454                            }
17455                            result.customer_encryption = map.next_value::<std::option::Option<crate::model::CustomerEncryption>>()?
17456                                ;
17457                        }
17458                        __FieldTag::__custom_time => {
17459                            if !fields.insert(__FieldTag::__custom_time) {
17460                                return std::result::Result::Err(A::Error::duplicate_field(
17461                                    "multiple values for custom_time",
17462                                ));
17463                            }
17464                            result.custom_time =
17465                                map.next_value::<std::option::Option<wkt::Timestamp>>()?;
17466                        }
17467                        __FieldTag::__soft_delete_time => {
17468                            if !fields.insert(__FieldTag::__soft_delete_time) {
17469                                return std::result::Result::Err(A::Error::duplicate_field(
17470                                    "multiple values for soft_delete_time",
17471                                ));
17472                            }
17473                            result.soft_delete_time =
17474                                map.next_value::<std::option::Option<wkt::Timestamp>>()?;
17475                        }
17476                        __FieldTag::__hard_delete_time => {
17477                            if !fields.insert(__FieldTag::__hard_delete_time) {
17478                                return std::result::Result::Err(A::Error::duplicate_field(
17479                                    "multiple values for hard_delete_time",
17480                                ));
17481                            }
17482                            result.hard_delete_time =
17483                                map.next_value::<std::option::Option<wkt::Timestamp>>()?;
17484                        }
17485                        __FieldTag::__retention => {
17486                            if !fields.insert(__FieldTag::__retention) {
17487                                return std::result::Result::Err(A::Error::duplicate_field(
17488                                    "multiple values for retention",
17489                                ));
17490                            }
17491                            result.retention = map
17492                                .next_value::<std::option::Option<crate::model::object::Retention>>(
17493                                )?;
17494                        }
17495                        __FieldTag::Unknown(key) => {
17496                            let value = map.next_value::<serde_json::Value>()?;
17497                            result._unknown_fields.insert(key, value);
17498                        }
17499                    }
17500                }
17501                std::result::Result::Ok(result)
17502            }
17503        }
17504        deserializer.deserialize_any(Visitor)
17505    }
17506}
17507
17508#[doc(hidden)]
17509impl serde::ser::Serialize for Object {
17510    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
17511    where
17512        S: serde::ser::Serializer,
17513    {
17514        use serde::ser::SerializeMap;
17515        #[allow(unused_imports)]
17516        use std::option::Option::Some;
17517        let mut state = serializer.serialize_map(std::option::Option::None)?;
17518        if !self.name.is_empty() {
17519            state.serialize_entry("name", &self.name)?;
17520        }
17521        if !self.bucket.is_empty() {
17522            state.serialize_entry("bucket", &self.bucket)?;
17523        }
17524        if !self.etag.is_empty() {
17525            state.serialize_entry("etag", &self.etag)?;
17526        }
17527        if !wkt::internal::is_default(&self.generation) {
17528            struct __With<'a>(&'a i64);
17529            impl<'a> serde::ser::Serialize for __With<'a> {
17530                fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
17531                where
17532                    S: serde::ser::Serializer,
17533                {
17534                    serde_with::As::<wkt::internal::I64>::serialize(self.0, serializer)
17535                }
17536            }
17537            state.serialize_entry("generation", &__With(&self.generation))?;
17538        }
17539        if self.restore_token.is_some() {
17540            state.serialize_entry("restoreToken", &self.restore_token)?;
17541        }
17542        if !wkt::internal::is_default(&self.metageneration) {
17543            struct __With<'a>(&'a i64);
17544            impl<'a> serde::ser::Serialize for __With<'a> {
17545                fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
17546                where
17547                    S: serde::ser::Serializer,
17548                {
17549                    serde_with::As::<wkt::internal::I64>::serialize(self.0, serializer)
17550                }
17551            }
17552            state.serialize_entry("metageneration", &__With(&self.metageneration))?;
17553        }
17554        if !self.storage_class.is_empty() {
17555            state.serialize_entry("storageClass", &self.storage_class)?;
17556        }
17557        if !wkt::internal::is_default(&self.size) {
17558            struct __With<'a>(&'a i64);
17559            impl<'a> serde::ser::Serialize for __With<'a> {
17560                fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
17561                where
17562                    S: serde::ser::Serializer,
17563                {
17564                    serde_with::As::<wkt::internal::I64>::serialize(self.0, serializer)
17565                }
17566            }
17567            state.serialize_entry("size", &__With(&self.size))?;
17568        }
17569        if !self.content_encoding.is_empty() {
17570            state.serialize_entry("contentEncoding", &self.content_encoding)?;
17571        }
17572        if !self.content_disposition.is_empty() {
17573            state.serialize_entry("contentDisposition", &self.content_disposition)?;
17574        }
17575        if !self.cache_control.is_empty() {
17576            state.serialize_entry("cacheControl", &self.cache_control)?;
17577        }
17578        if !self.acl.is_empty() {
17579            state.serialize_entry("acl", &self.acl)?;
17580        }
17581        if !self.content_language.is_empty() {
17582            state.serialize_entry("contentLanguage", &self.content_language)?;
17583        }
17584        if self.delete_time.is_some() {
17585            state.serialize_entry("deleteTime", &self.delete_time)?;
17586        }
17587        if self.finalize_time.is_some() {
17588            state.serialize_entry("finalizeTime", &self.finalize_time)?;
17589        }
17590        if !self.content_type.is_empty() {
17591            state.serialize_entry("contentType", &self.content_type)?;
17592        }
17593        if self.create_time.is_some() {
17594            state.serialize_entry("createTime", &self.create_time)?;
17595        }
17596        if !wkt::internal::is_default(&self.component_count) {
17597            struct __With<'a>(&'a i32);
17598            impl<'a> serde::ser::Serialize for __With<'a> {
17599                fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
17600                where
17601                    S: serde::ser::Serializer,
17602                {
17603                    serde_with::As::<wkt::internal::I32>::serialize(self.0, serializer)
17604                }
17605            }
17606            state.serialize_entry("componentCount", &__With(&self.component_count))?;
17607        }
17608        if self.checksums.is_some() {
17609            state.serialize_entry("checksums", &self.checksums)?;
17610        }
17611        if self.update_time.is_some() {
17612            state.serialize_entry("updateTime", &self.update_time)?;
17613        }
17614        if !self.kms_key.is_empty() {
17615            state.serialize_entry("kmsKey", &self.kms_key)?;
17616        }
17617        if self.update_storage_class_time.is_some() {
17618            state.serialize_entry("updateStorageClassTime", &self.update_storage_class_time)?;
17619        }
17620        if !wkt::internal::is_default(&self.temporary_hold) {
17621            state.serialize_entry("temporaryHold", &self.temporary_hold)?;
17622        }
17623        if self.retention_expire_time.is_some() {
17624            state.serialize_entry("retentionExpireTime", &self.retention_expire_time)?;
17625        }
17626        if !self.metadata.is_empty() {
17627            state.serialize_entry("metadata", &self.metadata)?;
17628        }
17629        if self.contexts.is_some() {
17630            state.serialize_entry("contexts", &self.contexts)?;
17631        }
17632        if self.event_based_hold.is_some() {
17633            state.serialize_entry("eventBasedHold", &self.event_based_hold)?;
17634        }
17635        if self.owner.is_some() {
17636            state.serialize_entry("owner", &self.owner)?;
17637        }
17638        if self.customer_encryption.is_some() {
17639            state.serialize_entry("customerEncryption", &self.customer_encryption)?;
17640        }
17641        if self.custom_time.is_some() {
17642            state.serialize_entry("customTime", &self.custom_time)?;
17643        }
17644        if self.soft_delete_time.is_some() {
17645            state.serialize_entry("softDeleteTime", &self.soft_delete_time)?;
17646        }
17647        if self.hard_delete_time.is_some() {
17648            state.serialize_entry("hardDeleteTime", &self.hard_delete_time)?;
17649        }
17650        if self.retention.is_some() {
17651            state.serialize_entry("retention", &self.retention)?;
17652        }
17653        if !self._unknown_fields.is_empty() {
17654            for (key, value) in self._unknown_fields.iter() {
17655                state.serialize_entry(key, &value)?;
17656            }
17657        }
17658        state.end()
17659    }
17660}
17661
17662/// Defines additional types related to [Object].
17663pub mod object {
17664    #[allow(unused_imports)]
17665    use super::*;
17666
17667    /// Specifies retention parameters of the object. Objects under retention
17668    /// cannot be deleted or overwritten until their retention expires.
17669    #[derive(Clone, Debug, Default, PartialEq)]
17670    #[non_exhaustive]
17671    pub struct Retention {
17672        /// Optional. The mode of the Retention.
17673        pub mode: crate::model::object::retention::Mode,
17674
17675        /// Optional. The timestamp that the object needs to be retained until.
17676        /// Value cannot be set in the past or more than 100 years in the future.
17677        pub retain_until_time: std::option::Option<wkt::Timestamp>,
17678
17679        _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
17680    }
17681
17682    impl Retention {
17683        pub fn new() -> Self {
17684            std::default::Default::default()
17685        }
17686
17687        /// Sets the value of [mode][crate::model::object::Retention::mode].
17688        pub fn set_mode<T: std::convert::Into<crate::model::object::retention::Mode>>(
17689            mut self,
17690            v: T,
17691        ) -> Self {
17692            self.mode = v.into();
17693            self
17694        }
17695
17696        /// Sets the value of [retain_until_time][crate::model::object::Retention::retain_until_time].
17697        pub fn set_retain_until_time<T>(mut self, v: T) -> Self
17698        where
17699            T: std::convert::Into<wkt::Timestamp>,
17700        {
17701            self.retain_until_time = std::option::Option::Some(v.into());
17702            self
17703        }
17704
17705        /// Sets or clears the value of [retain_until_time][crate::model::object::Retention::retain_until_time].
17706        pub fn set_or_clear_retain_until_time<T>(mut self, v: std::option::Option<T>) -> Self
17707        where
17708            T: std::convert::Into<wkt::Timestamp>,
17709        {
17710            self.retain_until_time = v.map(|x| x.into());
17711            self
17712        }
17713    }
17714
17715    impl wkt::message::Message for Retention {
17716        fn typename() -> &'static str {
17717            "type.googleapis.com/google.storage.v2.Object.Retention"
17718        }
17719    }
17720
17721    #[doc(hidden)]
17722    impl<'de> serde::de::Deserialize<'de> for Retention {
17723        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
17724        where
17725            D: serde::Deserializer<'de>,
17726        {
17727            #[allow(non_camel_case_types)]
17728            #[doc(hidden)]
17729            #[derive(PartialEq, Eq, Hash)]
17730            enum __FieldTag {
17731                __mode,
17732                __retain_until_time,
17733                Unknown(std::string::String),
17734            }
17735            impl<'de> serde::de::Deserialize<'de> for __FieldTag {
17736                fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
17737                where
17738                    D: serde::Deserializer<'de>,
17739                {
17740                    struct Visitor;
17741                    impl<'de> serde::de::Visitor<'de> for Visitor {
17742                        type Value = __FieldTag;
17743                        fn expecting(
17744                            &self,
17745                            formatter: &mut std::fmt::Formatter,
17746                        ) -> std::fmt::Result {
17747                            formatter.write_str("a field name for Retention")
17748                        }
17749                        fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
17750                        where
17751                            E: serde::de::Error,
17752                        {
17753                            use std::result::Result::Ok;
17754                            use std::string::ToString;
17755                            match value {
17756                                "mode" => Ok(__FieldTag::__mode),
17757                                "retainUntilTime" => Ok(__FieldTag::__retain_until_time),
17758                                "retain_until_time" => Ok(__FieldTag::__retain_until_time),
17759                                _ => Ok(__FieldTag::Unknown(value.to_string())),
17760                            }
17761                        }
17762                    }
17763                    deserializer.deserialize_identifier(Visitor)
17764                }
17765            }
17766            struct Visitor;
17767            impl<'de> serde::de::Visitor<'de> for Visitor {
17768                type Value = Retention;
17769                fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
17770                    formatter.write_str("struct Retention")
17771                }
17772                fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
17773                where
17774                    A: serde::de::MapAccess<'de>,
17775                {
17776                    #[allow(unused_imports)]
17777                    use serde::de::Error;
17778                    use std::option::Option::Some;
17779                    let mut fields = std::collections::HashSet::new();
17780                    let mut result = Self::Value::new();
17781                    while let Some(tag) = map.next_key::<__FieldTag>()? {
17782                        #[allow(clippy::match_single_binding)]
17783                        match tag {
17784                            __FieldTag::__mode => {
17785                                if !fields.insert(__FieldTag::__mode) {
17786                                    return std::result::Result::Err(A::Error::duplicate_field(
17787                                        "multiple values for mode",
17788                                    ));
17789                                }
17790                                result.mode = map.next_value::<std::option::Option<crate::model::object::retention::Mode>>()?.unwrap_or_default();
17791                            }
17792                            __FieldTag::__retain_until_time => {
17793                                if !fields.insert(__FieldTag::__retain_until_time) {
17794                                    return std::result::Result::Err(A::Error::duplicate_field(
17795                                        "multiple values for retain_until_time",
17796                                    ));
17797                                }
17798                                result.retain_until_time =
17799                                    map.next_value::<std::option::Option<wkt::Timestamp>>()?;
17800                            }
17801                            __FieldTag::Unknown(key) => {
17802                                let value = map.next_value::<serde_json::Value>()?;
17803                                result._unknown_fields.insert(key, value);
17804                            }
17805                        }
17806                    }
17807                    std::result::Result::Ok(result)
17808                }
17809            }
17810            deserializer.deserialize_any(Visitor)
17811        }
17812    }
17813
17814    #[doc(hidden)]
17815    impl serde::ser::Serialize for Retention {
17816        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
17817        where
17818            S: serde::ser::Serializer,
17819        {
17820            use serde::ser::SerializeMap;
17821            #[allow(unused_imports)]
17822            use std::option::Option::Some;
17823            let mut state = serializer.serialize_map(std::option::Option::None)?;
17824            if !wkt::internal::is_default(&self.mode) {
17825                state.serialize_entry("mode", &self.mode)?;
17826            }
17827            if self.retain_until_time.is_some() {
17828                state.serialize_entry("retainUntilTime", &self.retain_until_time)?;
17829            }
17830            if !self._unknown_fields.is_empty() {
17831                for (key, value) in self._unknown_fields.iter() {
17832                    state.serialize_entry(key, &value)?;
17833                }
17834            }
17835            state.end()
17836        }
17837    }
17838
17839    /// Defines additional types related to [Retention].
17840    pub mod retention {
17841        #[allow(unused_imports)]
17842        use super::*;
17843
17844        /// Retention mode values.
17845        ///
17846        /// # Working with unknown values
17847        ///
17848        /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
17849        /// additional enum variants at any time. Adding new variants is not considered
17850        /// a breaking change. Applications should write their code in anticipation of:
17851        ///
17852        /// - New values appearing in future releases of the client library, **and**
17853        /// - New values received dynamically, without application changes.
17854        ///
17855        /// Please consult the [Working with enums] section in the user guide for some
17856        /// guidelines.
17857        ///
17858        /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
17859        #[derive(Clone, Debug, PartialEq)]
17860        #[non_exhaustive]
17861        pub enum Mode {
17862            /// No specified mode. Object is not under retention.
17863            Unspecified,
17864            /// Retention period may be decreased or increased.
17865            /// The Retention configuration may be removed.
17866            /// The mode may be changed to locked.
17867            Unlocked,
17868            /// Retention period may be increased.
17869            /// The Retention configuration cannot be removed.
17870            /// The mode cannot be changed.
17871            Locked,
17872            /// If set, the enum was initialized with an unknown value.
17873            ///
17874            /// Applications can examine the value using [Mode::value] or
17875            /// [Mode::name].
17876            UnknownValue(mode::UnknownValue),
17877        }
17878
17879        #[doc(hidden)]
17880        pub mod mode {
17881            #[allow(unused_imports)]
17882            use super::*;
17883            #[derive(Clone, Debug, PartialEq)]
17884            pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
17885        }
17886
17887        impl Mode {
17888            /// Gets the enum value.
17889            ///
17890            /// Returns `None` if the enum contains an unknown value deserialized from
17891            /// the string representation of enums.
17892            pub fn value(&self) -> std::option::Option<i32> {
17893                match self {
17894                    Self::Unspecified => std::option::Option::Some(0),
17895                    Self::Unlocked => std::option::Option::Some(1),
17896                    Self::Locked => std::option::Option::Some(2),
17897                    Self::UnknownValue(u) => u.0.value(),
17898                }
17899            }
17900
17901            /// Gets the enum value as a string.
17902            ///
17903            /// Returns `None` if the enum contains an unknown value deserialized from
17904            /// the integer representation of enums.
17905            pub fn name(&self) -> std::option::Option<&str> {
17906                match self {
17907                    Self::Unspecified => std::option::Option::Some("MODE_UNSPECIFIED"),
17908                    Self::Unlocked => std::option::Option::Some("UNLOCKED"),
17909                    Self::Locked => std::option::Option::Some("LOCKED"),
17910                    Self::UnknownValue(u) => u.0.name(),
17911                }
17912            }
17913        }
17914
17915        impl std::default::Default for Mode {
17916            fn default() -> Self {
17917                use std::convert::From;
17918                Self::from(0)
17919            }
17920        }
17921
17922        impl std::fmt::Display for Mode {
17923            fn fmt(
17924                &self,
17925                f: &mut std::fmt::Formatter<'_>,
17926            ) -> std::result::Result<(), std::fmt::Error> {
17927                wkt::internal::display_enum(f, self.name(), self.value())
17928            }
17929        }
17930
17931        impl std::convert::From<i32> for Mode {
17932            fn from(value: i32) -> Self {
17933                match value {
17934                    0 => Self::Unspecified,
17935                    1 => Self::Unlocked,
17936                    2 => Self::Locked,
17937                    _ => Self::UnknownValue(mode::UnknownValue(
17938                        wkt::internal::UnknownEnumValue::Integer(value),
17939                    )),
17940                }
17941            }
17942        }
17943
17944        impl std::convert::From<&str> for Mode {
17945            fn from(value: &str) -> Self {
17946                use std::string::ToString;
17947                match value {
17948                    "MODE_UNSPECIFIED" => Self::Unspecified,
17949                    "UNLOCKED" => Self::Unlocked,
17950                    "LOCKED" => Self::Locked,
17951                    _ => Self::UnknownValue(mode::UnknownValue(
17952                        wkt::internal::UnknownEnumValue::String(value.to_string()),
17953                    )),
17954                }
17955            }
17956        }
17957
17958        impl serde::ser::Serialize for Mode {
17959            fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
17960            where
17961                S: serde::Serializer,
17962            {
17963                match self {
17964                    Self::Unspecified => serializer.serialize_i32(0),
17965                    Self::Unlocked => serializer.serialize_i32(1),
17966                    Self::Locked => serializer.serialize_i32(2),
17967                    Self::UnknownValue(u) => u.0.serialize(serializer),
17968                }
17969            }
17970        }
17971
17972        impl<'de> serde::de::Deserialize<'de> for Mode {
17973            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
17974            where
17975                D: serde::Deserializer<'de>,
17976            {
17977                deserializer.deserialize_any(wkt::internal::EnumVisitor::<Mode>::new(
17978                    ".google.storage.v2.Object.Retention.Mode",
17979                ))
17980            }
17981        }
17982    }
17983}
17984
17985/// An access-control entry.
17986#[derive(Clone, Debug, Default, PartialEq)]
17987#[non_exhaustive]
17988pub struct ObjectAccessControl {
17989    /// Optional. The access permission for the entity. One of the following
17990    /// values:
17991    ///
17992    /// * `READER`
17993    /// * `WRITER`
17994    /// * `OWNER`
17995    pub role: std::string::String,
17996
17997    /// Optional. The ID of the access-control entry.
17998    pub id: std::string::String,
17999
18000    /// Optional. The entity holding the permission, in one of the following forms:
18001    ///
18002    /// * `user-{userid}`
18003    /// * `user-{email}`
18004    /// * `group-{groupid}`
18005    /// * `group-{email}`
18006    /// * `domain-{domain}`
18007    /// * `project-{team}-{projectnumber}`
18008    /// * `project-{team}-{projectid}`
18009    /// * `allUsers`
18010    /// * `allAuthenticatedUsers`
18011    ///   Examples:
18012    /// * The user `liz@example.com` would be `user-liz@example.com`.
18013    /// * The group `example@googlegroups.com` would be
18014    ///   `group-example@googlegroups.com`.
18015    /// * All members of the Google Apps for Business domain `example.com` would be
18016    ///   `domain-example.com`.
18017    ///   For project entities, `project-{team}-{projectnumber}` format will be
18018    ///   returned on response.
18019    pub entity: std::string::String,
18020
18021    /// Output only. The alternative entity format, if exists. For project
18022    /// entities, `project-{team}-{projectid}` format will be returned on response.
18023    pub entity_alt: std::string::String,
18024
18025    /// Optional. The ID for the entity, if any.
18026    pub entity_id: std::string::String,
18027
18028    /// Optional. The etag of the ObjectAccessControl.
18029    /// If included in the metadata of an update or delete request message, the
18030    /// operation will only be performed if the etag matches that of the live
18031    /// object's ObjectAccessControl.
18032    pub etag: std::string::String,
18033
18034    /// Optional. The email address associated with the entity, if any.
18035    pub email: std::string::String,
18036
18037    /// Optional. The domain associated with the entity, if any.
18038    pub domain: std::string::String,
18039
18040    /// Optional. The project team associated with the entity, if any.
18041    pub project_team: std::option::Option<crate::model::ProjectTeam>,
18042
18043    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
18044}
18045
18046impl ObjectAccessControl {
18047    pub fn new() -> Self {
18048        std::default::Default::default()
18049    }
18050
18051    /// Sets the value of [role][crate::model::ObjectAccessControl::role].
18052    pub fn set_role<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
18053        self.role = v.into();
18054        self
18055    }
18056
18057    /// Sets the value of [id][crate::model::ObjectAccessControl::id].
18058    pub fn set_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
18059        self.id = v.into();
18060        self
18061    }
18062
18063    /// Sets the value of [entity][crate::model::ObjectAccessControl::entity].
18064    pub fn set_entity<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
18065        self.entity = v.into();
18066        self
18067    }
18068
18069    /// Sets the value of [entity_alt][crate::model::ObjectAccessControl::entity_alt].
18070    pub fn set_entity_alt<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
18071        self.entity_alt = v.into();
18072        self
18073    }
18074
18075    /// Sets the value of [entity_id][crate::model::ObjectAccessControl::entity_id].
18076    pub fn set_entity_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
18077        self.entity_id = v.into();
18078        self
18079    }
18080
18081    /// Sets the value of [etag][crate::model::ObjectAccessControl::etag].
18082    pub fn set_etag<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
18083        self.etag = v.into();
18084        self
18085    }
18086
18087    /// Sets the value of [email][crate::model::ObjectAccessControl::email].
18088    pub fn set_email<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
18089        self.email = v.into();
18090        self
18091    }
18092
18093    /// Sets the value of [domain][crate::model::ObjectAccessControl::domain].
18094    pub fn set_domain<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
18095        self.domain = v.into();
18096        self
18097    }
18098
18099    /// Sets the value of [project_team][crate::model::ObjectAccessControl::project_team].
18100    pub fn set_project_team<T>(mut self, v: T) -> Self
18101    where
18102        T: std::convert::Into<crate::model::ProjectTeam>,
18103    {
18104        self.project_team = std::option::Option::Some(v.into());
18105        self
18106    }
18107
18108    /// Sets or clears the value of [project_team][crate::model::ObjectAccessControl::project_team].
18109    pub fn set_or_clear_project_team<T>(mut self, v: std::option::Option<T>) -> Self
18110    where
18111        T: std::convert::Into<crate::model::ProjectTeam>,
18112    {
18113        self.project_team = v.map(|x| x.into());
18114        self
18115    }
18116}
18117
18118impl wkt::message::Message for ObjectAccessControl {
18119    fn typename() -> &'static str {
18120        "type.googleapis.com/google.storage.v2.ObjectAccessControl"
18121    }
18122}
18123
18124#[doc(hidden)]
18125impl<'de> serde::de::Deserialize<'de> for ObjectAccessControl {
18126    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
18127    where
18128        D: serde::Deserializer<'de>,
18129    {
18130        #[allow(non_camel_case_types)]
18131        #[doc(hidden)]
18132        #[derive(PartialEq, Eq, Hash)]
18133        enum __FieldTag {
18134            __role,
18135            __id,
18136            __entity,
18137            __entity_alt,
18138            __entity_id,
18139            __etag,
18140            __email,
18141            __domain,
18142            __project_team,
18143            Unknown(std::string::String),
18144        }
18145        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
18146            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
18147            where
18148                D: serde::Deserializer<'de>,
18149            {
18150                struct Visitor;
18151                impl<'de> serde::de::Visitor<'de> for Visitor {
18152                    type Value = __FieldTag;
18153                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
18154                        formatter.write_str("a field name for ObjectAccessControl")
18155                    }
18156                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
18157                    where
18158                        E: serde::de::Error,
18159                    {
18160                        use std::result::Result::Ok;
18161                        use std::string::ToString;
18162                        match value {
18163                            "role" => Ok(__FieldTag::__role),
18164                            "id" => Ok(__FieldTag::__id),
18165                            "entity" => Ok(__FieldTag::__entity),
18166                            "entityAlt" => Ok(__FieldTag::__entity_alt),
18167                            "entity_alt" => Ok(__FieldTag::__entity_alt),
18168                            "entityId" => Ok(__FieldTag::__entity_id),
18169                            "entity_id" => Ok(__FieldTag::__entity_id),
18170                            "etag" => Ok(__FieldTag::__etag),
18171                            "email" => Ok(__FieldTag::__email),
18172                            "domain" => Ok(__FieldTag::__domain),
18173                            "projectTeam" => Ok(__FieldTag::__project_team),
18174                            "project_team" => Ok(__FieldTag::__project_team),
18175                            _ => Ok(__FieldTag::Unknown(value.to_string())),
18176                        }
18177                    }
18178                }
18179                deserializer.deserialize_identifier(Visitor)
18180            }
18181        }
18182        struct Visitor;
18183        impl<'de> serde::de::Visitor<'de> for Visitor {
18184            type Value = ObjectAccessControl;
18185            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
18186                formatter.write_str("struct ObjectAccessControl")
18187            }
18188            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
18189            where
18190                A: serde::de::MapAccess<'de>,
18191            {
18192                #[allow(unused_imports)]
18193                use serde::de::Error;
18194                use std::option::Option::Some;
18195                let mut fields = std::collections::HashSet::new();
18196                let mut result = Self::Value::new();
18197                while let Some(tag) = map.next_key::<__FieldTag>()? {
18198                    #[allow(clippy::match_single_binding)]
18199                    match tag {
18200                        __FieldTag::__role => {
18201                            if !fields.insert(__FieldTag::__role) {
18202                                return std::result::Result::Err(A::Error::duplicate_field(
18203                                    "multiple values for role",
18204                                ));
18205                            }
18206                            result.role = map
18207                                .next_value::<std::option::Option<std::string::String>>()?
18208                                .unwrap_or_default();
18209                        }
18210                        __FieldTag::__id => {
18211                            if !fields.insert(__FieldTag::__id) {
18212                                return std::result::Result::Err(A::Error::duplicate_field(
18213                                    "multiple values for id",
18214                                ));
18215                            }
18216                            result.id = map
18217                                .next_value::<std::option::Option<std::string::String>>()?
18218                                .unwrap_or_default();
18219                        }
18220                        __FieldTag::__entity => {
18221                            if !fields.insert(__FieldTag::__entity) {
18222                                return std::result::Result::Err(A::Error::duplicate_field(
18223                                    "multiple values for entity",
18224                                ));
18225                            }
18226                            result.entity = map
18227                                .next_value::<std::option::Option<std::string::String>>()?
18228                                .unwrap_or_default();
18229                        }
18230                        __FieldTag::__entity_alt => {
18231                            if !fields.insert(__FieldTag::__entity_alt) {
18232                                return std::result::Result::Err(A::Error::duplicate_field(
18233                                    "multiple values for entity_alt",
18234                                ));
18235                            }
18236                            result.entity_alt = map
18237                                .next_value::<std::option::Option<std::string::String>>()?
18238                                .unwrap_or_default();
18239                        }
18240                        __FieldTag::__entity_id => {
18241                            if !fields.insert(__FieldTag::__entity_id) {
18242                                return std::result::Result::Err(A::Error::duplicate_field(
18243                                    "multiple values for entity_id",
18244                                ));
18245                            }
18246                            result.entity_id = map
18247                                .next_value::<std::option::Option<std::string::String>>()?
18248                                .unwrap_or_default();
18249                        }
18250                        __FieldTag::__etag => {
18251                            if !fields.insert(__FieldTag::__etag) {
18252                                return std::result::Result::Err(A::Error::duplicate_field(
18253                                    "multiple values for etag",
18254                                ));
18255                            }
18256                            result.etag = map
18257                                .next_value::<std::option::Option<std::string::String>>()?
18258                                .unwrap_or_default();
18259                        }
18260                        __FieldTag::__email => {
18261                            if !fields.insert(__FieldTag::__email) {
18262                                return std::result::Result::Err(A::Error::duplicate_field(
18263                                    "multiple values for email",
18264                                ));
18265                            }
18266                            result.email = map
18267                                .next_value::<std::option::Option<std::string::String>>()?
18268                                .unwrap_or_default();
18269                        }
18270                        __FieldTag::__domain => {
18271                            if !fields.insert(__FieldTag::__domain) {
18272                                return std::result::Result::Err(A::Error::duplicate_field(
18273                                    "multiple values for domain",
18274                                ));
18275                            }
18276                            result.domain = map
18277                                .next_value::<std::option::Option<std::string::String>>()?
18278                                .unwrap_or_default();
18279                        }
18280                        __FieldTag::__project_team => {
18281                            if !fields.insert(__FieldTag::__project_team) {
18282                                return std::result::Result::Err(A::Error::duplicate_field(
18283                                    "multiple values for project_team",
18284                                ));
18285                            }
18286                            result.project_team =
18287                                map.next_value::<std::option::Option<crate::model::ProjectTeam>>()?;
18288                        }
18289                        __FieldTag::Unknown(key) => {
18290                            let value = map.next_value::<serde_json::Value>()?;
18291                            result._unknown_fields.insert(key, value);
18292                        }
18293                    }
18294                }
18295                std::result::Result::Ok(result)
18296            }
18297        }
18298        deserializer.deserialize_any(Visitor)
18299    }
18300}
18301
18302#[doc(hidden)]
18303impl serde::ser::Serialize for ObjectAccessControl {
18304    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
18305    where
18306        S: serde::ser::Serializer,
18307    {
18308        use serde::ser::SerializeMap;
18309        #[allow(unused_imports)]
18310        use std::option::Option::Some;
18311        let mut state = serializer.serialize_map(std::option::Option::None)?;
18312        if !self.role.is_empty() {
18313            state.serialize_entry("role", &self.role)?;
18314        }
18315        if !self.id.is_empty() {
18316            state.serialize_entry("id", &self.id)?;
18317        }
18318        if !self.entity.is_empty() {
18319            state.serialize_entry("entity", &self.entity)?;
18320        }
18321        if !self.entity_alt.is_empty() {
18322            state.serialize_entry("entityAlt", &self.entity_alt)?;
18323        }
18324        if !self.entity_id.is_empty() {
18325            state.serialize_entry("entityId", &self.entity_id)?;
18326        }
18327        if !self.etag.is_empty() {
18328            state.serialize_entry("etag", &self.etag)?;
18329        }
18330        if !self.email.is_empty() {
18331            state.serialize_entry("email", &self.email)?;
18332        }
18333        if !self.domain.is_empty() {
18334            state.serialize_entry("domain", &self.domain)?;
18335        }
18336        if self.project_team.is_some() {
18337            state.serialize_entry("projectTeam", &self.project_team)?;
18338        }
18339        if !self._unknown_fields.is_empty() {
18340            for (key, value) in self._unknown_fields.iter() {
18341                state.serialize_entry(key, &value)?;
18342            }
18343        }
18344        state.end()
18345    }
18346}
18347
18348/// The result of a call to Objects.ListObjects
18349#[derive(Clone, Debug, Default, PartialEq)]
18350#[non_exhaustive]
18351pub struct ListObjectsResponse {
18352    /// The list of items.
18353    pub objects: std::vec::Vec<crate::model::Object>,
18354
18355    /// The list of prefixes of objects matching-but-not-listed up to and including
18356    /// the requested delimiter.
18357    pub prefixes: std::vec::Vec<std::string::String>,
18358
18359    /// The continuation token, used to page through large result sets. Provide
18360    /// this value in a subsequent request to return the next page of results.
18361    pub next_page_token: std::string::String,
18362
18363    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
18364}
18365
18366impl ListObjectsResponse {
18367    pub fn new() -> Self {
18368        std::default::Default::default()
18369    }
18370
18371    /// Sets the value of [objects][crate::model::ListObjectsResponse::objects].
18372    pub fn set_objects<T, V>(mut self, v: T) -> Self
18373    where
18374        T: std::iter::IntoIterator<Item = V>,
18375        V: std::convert::Into<crate::model::Object>,
18376    {
18377        use std::iter::Iterator;
18378        self.objects = v.into_iter().map(|i| i.into()).collect();
18379        self
18380    }
18381
18382    /// Sets the value of [prefixes][crate::model::ListObjectsResponse::prefixes].
18383    pub fn set_prefixes<T, V>(mut self, v: T) -> Self
18384    where
18385        T: std::iter::IntoIterator<Item = V>,
18386        V: std::convert::Into<std::string::String>,
18387    {
18388        use std::iter::Iterator;
18389        self.prefixes = v.into_iter().map(|i| i.into()).collect();
18390        self
18391    }
18392
18393    /// Sets the value of [next_page_token][crate::model::ListObjectsResponse::next_page_token].
18394    pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
18395        self.next_page_token = v.into();
18396        self
18397    }
18398}
18399
18400impl wkt::message::Message for ListObjectsResponse {
18401    fn typename() -> &'static str {
18402        "type.googleapis.com/google.storage.v2.ListObjectsResponse"
18403    }
18404}
18405
18406#[doc(hidden)]
18407impl gax::paginator::internal::PageableResponse for ListObjectsResponse {
18408    type PageItem = crate::model::Object;
18409
18410    fn items(self) -> std::vec::Vec<Self::PageItem> {
18411        self.objects
18412    }
18413
18414    fn next_page_token(&self) -> std::string::String {
18415        use std::clone::Clone;
18416        self.next_page_token.clone()
18417    }
18418}
18419
18420#[doc(hidden)]
18421impl<'de> serde::de::Deserialize<'de> for ListObjectsResponse {
18422    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
18423    where
18424        D: serde::Deserializer<'de>,
18425    {
18426        #[allow(non_camel_case_types)]
18427        #[doc(hidden)]
18428        #[derive(PartialEq, Eq, Hash)]
18429        enum __FieldTag {
18430            __objects,
18431            __prefixes,
18432            __next_page_token,
18433            Unknown(std::string::String),
18434        }
18435        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
18436            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
18437            where
18438                D: serde::Deserializer<'de>,
18439            {
18440                struct Visitor;
18441                impl<'de> serde::de::Visitor<'de> for Visitor {
18442                    type Value = __FieldTag;
18443                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
18444                        formatter.write_str("a field name for ListObjectsResponse")
18445                    }
18446                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
18447                    where
18448                        E: serde::de::Error,
18449                    {
18450                        use std::result::Result::Ok;
18451                        use std::string::ToString;
18452                        match value {
18453                            "objects" => Ok(__FieldTag::__objects),
18454                            "prefixes" => Ok(__FieldTag::__prefixes),
18455                            "nextPageToken" => Ok(__FieldTag::__next_page_token),
18456                            "next_page_token" => Ok(__FieldTag::__next_page_token),
18457                            _ => Ok(__FieldTag::Unknown(value.to_string())),
18458                        }
18459                    }
18460                }
18461                deserializer.deserialize_identifier(Visitor)
18462            }
18463        }
18464        struct Visitor;
18465        impl<'de> serde::de::Visitor<'de> for Visitor {
18466            type Value = ListObjectsResponse;
18467            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
18468                formatter.write_str("struct ListObjectsResponse")
18469            }
18470            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
18471            where
18472                A: serde::de::MapAccess<'de>,
18473            {
18474                #[allow(unused_imports)]
18475                use serde::de::Error;
18476                use std::option::Option::Some;
18477                let mut fields = std::collections::HashSet::new();
18478                let mut result = Self::Value::new();
18479                while let Some(tag) = map.next_key::<__FieldTag>()? {
18480                    #[allow(clippy::match_single_binding)]
18481                    match tag {
18482                        __FieldTag::__objects => {
18483                            if !fields.insert(__FieldTag::__objects) {
18484                                return std::result::Result::Err(A::Error::duplicate_field(
18485                                    "multiple values for objects",
18486                                ));
18487                            }
18488                            result.objects = map.next_value::<std::option::Option<std::vec::Vec<crate::model::Object>>>()?.unwrap_or_default();
18489                        }
18490                        __FieldTag::__prefixes => {
18491                            if !fields.insert(__FieldTag::__prefixes) {
18492                                return std::result::Result::Err(A::Error::duplicate_field(
18493                                    "multiple values for prefixes",
18494                                ));
18495                            }
18496                            result.prefixes = map.next_value::<std::option::Option<std::vec::Vec<std::string::String>>>()?.unwrap_or_default();
18497                        }
18498                        __FieldTag::__next_page_token => {
18499                            if !fields.insert(__FieldTag::__next_page_token) {
18500                                return std::result::Result::Err(A::Error::duplicate_field(
18501                                    "multiple values for next_page_token",
18502                                ));
18503                            }
18504                            result.next_page_token = map
18505                                .next_value::<std::option::Option<std::string::String>>()?
18506                                .unwrap_or_default();
18507                        }
18508                        __FieldTag::Unknown(key) => {
18509                            let value = map.next_value::<serde_json::Value>()?;
18510                            result._unknown_fields.insert(key, value);
18511                        }
18512                    }
18513                }
18514                std::result::Result::Ok(result)
18515            }
18516        }
18517        deserializer.deserialize_any(Visitor)
18518    }
18519}
18520
18521#[doc(hidden)]
18522impl serde::ser::Serialize for ListObjectsResponse {
18523    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
18524    where
18525        S: serde::ser::Serializer,
18526    {
18527        use serde::ser::SerializeMap;
18528        #[allow(unused_imports)]
18529        use std::option::Option::Some;
18530        let mut state = serializer.serialize_map(std::option::Option::None)?;
18531        if !self.objects.is_empty() {
18532            state.serialize_entry("objects", &self.objects)?;
18533        }
18534        if !self.prefixes.is_empty() {
18535            state.serialize_entry("prefixes", &self.prefixes)?;
18536        }
18537        if !self.next_page_token.is_empty() {
18538            state.serialize_entry("nextPageToken", &self.next_page_token)?;
18539        }
18540        if !self._unknown_fields.is_empty() {
18541            for (key, value) in self._unknown_fields.iter() {
18542                state.serialize_entry(key, &value)?;
18543            }
18544        }
18545        state.end()
18546    }
18547}
18548
18549/// Represents the Viewers, Editors, or Owners of a given project.
18550#[derive(Clone, Debug, Default, PartialEq)]
18551#[non_exhaustive]
18552pub struct ProjectTeam {
18553    /// Optional. The project number.
18554    pub project_number: std::string::String,
18555
18556    /// Optional. The team.
18557    pub team: std::string::String,
18558
18559    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
18560}
18561
18562impl ProjectTeam {
18563    pub fn new() -> Self {
18564        std::default::Default::default()
18565    }
18566
18567    /// Sets the value of [project_number][crate::model::ProjectTeam::project_number].
18568    pub fn set_project_number<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
18569        self.project_number = v.into();
18570        self
18571    }
18572
18573    /// Sets the value of [team][crate::model::ProjectTeam::team].
18574    pub fn set_team<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
18575        self.team = v.into();
18576        self
18577    }
18578}
18579
18580impl wkt::message::Message for ProjectTeam {
18581    fn typename() -> &'static str {
18582        "type.googleapis.com/google.storage.v2.ProjectTeam"
18583    }
18584}
18585
18586#[doc(hidden)]
18587impl<'de> serde::de::Deserialize<'de> for ProjectTeam {
18588    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
18589    where
18590        D: serde::Deserializer<'de>,
18591    {
18592        #[allow(non_camel_case_types)]
18593        #[doc(hidden)]
18594        #[derive(PartialEq, Eq, Hash)]
18595        enum __FieldTag {
18596            __project_number,
18597            __team,
18598            Unknown(std::string::String),
18599        }
18600        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
18601            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
18602            where
18603                D: serde::Deserializer<'de>,
18604            {
18605                struct Visitor;
18606                impl<'de> serde::de::Visitor<'de> for Visitor {
18607                    type Value = __FieldTag;
18608                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
18609                        formatter.write_str("a field name for ProjectTeam")
18610                    }
18611                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
18612                    where
18613                        E: serde::de::Error,
18614                    {
18615                        use std::result::Result::Ok;
18616                        use std::string::ToString;
18617                        match value {
18618                            "projectNumber" => Ok(__FieldTag::__project_number),
18619                            "project_number" => Ok(__FieldTag::__project_number),
18620                            "team" => Ok(__FieldTag::__team),
18621                            _ => Ok(__FieldTag::Unknown(value.to_string())),
18622                        }
18623                    }
18624                }
18625                deserializer.deserialize_identifier(Visitor)
18626            }
18627        }
18628        struct Visitor;
18629        impl<'de> serde::de::Visitor<'de> for Visitor {
18630            type Value = ProjectTeam;
18631            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
18632                formatter.write_str("struct ProjectTeam")
18633            }
18634            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
18635            where
18636                A: serde::de::MapAccess<'de>,
18637            {
18638                #[allow(unused_imports)]
18639                use serde::de::Error;
18640                use std::option::Option::Some;
18641                let mut fields = std::collections::HashSet::new();
18642                let mut result = Self::Value::new();
18643                while let Some(tag) = map.next_key::<__FieldTag>()? {
18644                    #[allow(clippy::match_single_binding)]
18645                    match tag {
18646                        __FieldTag::__project_number => {
18647                            if !fields.insert(__FieldTag::__project_number) {
18648                                return std::result::Result::Err(A::Error::duplicate_field(
18649                                    "multiple values for project_number",
18650                                ));
18651                            }
18652                            result.project_number = map
18653                                .next_value::<std::option::Option<std::string::String>>()?
18654                                .unwrap_or_default();
18655                        }
18656                        __FieldTag::__team => {
18657                            if !fields.insert(__FieldTag::__team) {
18658                                return std::result::Result::Err(A::Error::duplicate_field(
18659                                    "multiple values for team",
18660                                ));
18661                            }
18662                            result.team = map
18663                                .next_value::<std::option::Option<std::string::String>>()?
18664                                .unwrap_or_default();
18665                        }
18666                        __FieldTag::Unknown(key) => {
18667                            let value = map.next_value::<serde_json::Value>()?;
18668                            result._unknown_fields.insert(key, value);
18669                        }
18670                    }
18671                }
18672                std::result::Result::Ok(result)
18673            }
18674        }
18675        deserializer.deserialize_any(Visitor)
18676    }
18677}
18678
18679#[doc(hidden)]
18680impl serde::ser::Serialize for ProjectTeam {
18681    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
18682    where
18683        S: serde::ser::Serializer,
18684    {
18685        use serde::ser::SerializeMap;
18686        #[allow(unused_imports)]
18687        use std::option::Option::Some;
18688        let mut state = serializer.serialize_map(std::option::Option::None)?;
18689        if !self.project_number.is_empty() {
18690            state.serialize_entry("projectNumber", &self.project_number)?;
18691        }
18692        if !self.team.is_empty() {
18693            state.serialize_entry("team", &self.team)?;
18694        }
18695        if !self._unknown_fields.is_empty() {
18696            for (key, value) in self._unknown_fields.iter() {
18697                state.serialize_entry(key, &value)?;
18698            }
18699        }
18700        state.end()
18701    }
18702}
18703
18704/// The owner of a specific resource.
18705#[derive(Clone, Debug, Default, PartialEq)]
18706#[non_exhaustive]
18707pub struct Owner {
18708    /// Optional. The entity, in the form `user-`*userId*.
18709    pub entity: std::string::String,
18710
18711    /// Optional. The ID for the entity.
18712    pub entity_id: std::string::String,
18713
18714    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
18715}
18716
18717impl Owner {
18718    pub fn new() -> Self {
18719        std::default::Default::default()
18720    }
18721
18722    /// Sets the value of [entity][crate::model::Owner::entity].
18723    pub fn set_entity<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
18724        self.entity = v.into();
18725        self
18726    }
18727
18728    /// Sets the value of [entity_id][crate::model::Owner::entity_id].
18729    pub fn set_entity_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
18730        self.entity_id = v.into();
18731        self
18732    }
18733}
18734
18735impl wkt::message::Message for Owner {
18736    fn typename() -> &'static str {
18737        "type.googleapis.com/google.storage.v2.Owner"
18738    }
18739}
18740
18741#[doc(hidden)]
18742impl<'de> serde::de::Deserialize<'de> for Owner {
18743    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
18744    where
18745        D: serde::Deserializer<'de>,
18746    {
18747        #[allow(non_camel_case_types)]
18748        #[doc(hidden)]
18749        #[derive(PartialEq, Eq, Hash)]
18750        enum __FieldTag {
18751            __entity,
18752            __entity_id,
18753            Unknown(std::string::String),
18754        }
18755        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
18756            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
18757            where
18758                D: serde::Deserializer<'de>,
18759            {
18760                struct Visitor;
18761                impl<'de> serde::de::Visitor<'de> for Visitor {
18762                    type Value = __FieldTag;
18763                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
18764                        formatter.write_str("a field name for Owner")
18765                    }
18766                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
18767                    where
18768                        E: serde::de::Error,
18769                    {
18770                        use std::result::Result::Ok;
18771                        use std::string::ToString;
18772                        match value {
18773                            "entity" => Ok(__FieldTag::__entity),
18774                            "entityId" => Ok(__FieldTag::__entity_id),
18775                            "entity_id" => Ok(__FieldTag::__entity_id),
18776                            _ => Ok(__FieldTag::Unknown(value.to_string())),
18777                        }
18778                    }
18779                }
18780                deserializer.deserialize_identifier(Visitor)
18781            }
18782        }
18783        struct Visitor;
18784        impl<'de> serde::de::Visitor<'de> for Visitor {
18785            type Value = Owner;
18786            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
18787                formatter.write_str("struct Owner")
18788            }
18789            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
18790            where
18791                A: serde::de::MapAccess<'de>,
18792            {
18793                #[allow(unused_imports)]
18794                use serde::de::Error;
18795                use std::option::Option::Some;
18796                let mut fields = std::collections::HashSet::new();
18797                let mut result = Self::Value::new();
18798                while let Some(tag) = map.next_key::<__FieldTag>()? {
18799                    #[allow(clippy::match_single_binding)]
18800                    match tag {
18801                        __FieldTag::__entity => {
18802                            if !fields.insert(__FieldTag::__entity) {
18803                                return std::result::Result::Err(A::Error::duplicate_field(
18804                                    "multiple values for entity",
18805                                ));
18806                            }
18807                            result.entity = map
18808                                .next_value::<std::option::Option<std::string::String>>()?
18809                                .unwrap_or_default();
18810                        }
18811                        __FieldTag::__entity_id => {
18812                            if !fields.insert(__FieldTag::__entity_id) {
18813                                return std::result::Result::Err(A::Error::duplicate_field(
18814                                    "multiple values for entity_id",
18815                                ));
18816                            }
18817                            result.entity_id = map
18818                                .next_value::<std::option::Option<std::string::String>>()?
18819                                .unwrap_or_default();
18820                        }
18821                        __FieldTag::Unknown(key) => {
18822                            let value = map.next_value::<serde_json::Value>()?;
18823                            result._unknown_fields.insert(key, value);
18824                        }
18825                    }
18826                }
18827                std::result::Result::Ok(result)
18828            }
18829        }
18830        deserializer.deserialize_any(Visitor)
18831    }
18832}
18833
18834#[doc(hidden)]
18835impl serde::ser::Serialize for Owner {
18836    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
18837    where
18838        S: serde::ser::Serializer,
18839    {
18840        use serde::ser::SerializeMap;
18841        #[allow(unused_imports)]
18842        use std::option::Option::Some;
18843        let mut state = serializer.serialize_map(std::option::Option::None)?;
18844        if !self.entity.is_empty() {
18845            state.serialize_entry("entity", &self.entity)?;
18846        }
18847        if !self.entity_id.is_empty() {
18848            state.serialize_entry("entityId", &self.entity_id)?;
18849        }
18850        if !self._unknown_fields.is_empty() {
18851            for (key, value) in self._unknown_fields.iter() {
18852                state.serialize_entry(key, &value)?;
18853            }
18854        }
18855        state.end()
18856    }
18857}