Skip to main content

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
20mod debug;
21mod deserialize;
22mod serialize;
23
24/// Request message for [DeleteBucket][google.storage.v2.Storage.DeleteBucket].
25///
26/// [google.storage.v2.Storage.DeleteBucket]: crate::client::StorageControl::delete_bucket
27#[derive(Clone, Default, PartialEq)]
28#[non_exhaustive]
29pub struct DeleteBucketRequest {
30    /// Required. Name of a bucket to delete.
31    pub name: std::string::String,
32
33    /// If set, only deletes the bucket if its metageneration matches this value.
34    pub if_metageneration_match: std::option::Option<i64>,
35
36    /// If set, only deletes the bucket if its metageneration does not match this
37    /// value.
38    pub if_metageneration_not_match: std::option::Option<i64>,
39
40    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
41}
42
43impl DeleteBucketRequest {
44    /// Creates a new default instance.
45    pub fn new() -> Self {
46        std::default::Default::default()
47    }
48
49    /// Sets the value of [name][crate::model::DeleteBucketRequest::name].
50    ///
51    /// # Example
52    /// ```ignore,no_run
53    /// # use google_cloud_storage::model::DeleteBucketRequest;
54    /// # let project_id = "project_id";
55    /// # let bucket_id = "bucket_id";
56    /// let x = DeleteBucketRequest::new().set_name(format!("projects/{project_id}/buckets/{bucket_id}"));
57    /// ```
58    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
59        self.name = v.into();
60        self
61    }
62
63    /// Sets the value of [if_metageneration_match][crate::model::DeleteBucketRequest::if_metageneration_match].
64    ///
65    /// # Example
66    /// ```ignore,no_run
67    /// # use google_cloud_storage::model::DeleteBucketRequest;
68    /// let x = DeleteBucketRequest::new().set_if_metageneration_match(42);
69    /// ```
70    pub fn set_if_metageneration_match<T>(mut self, v: T) -> Self
71    where
72        T: std::convert::Into<i64>,
73    {
74        self.if_metageneration_match = std::option::Option::Some(v.into());
75        self
76    }
77
78    /// Sets or clears the value of [if_metageneration_match][crate::model::DeleteBucketRequest::if_metageneration_match].
79    ///
80    /// # Example
81    /// ```ignore,no_run
82    /// # use google_cloud_storage::model::DeleteBucketRequest;
83    /// let x = DeleteBucketRequest::new().set_or_clear_if_metageneration_match(Some(42));
84    /// let x = DeleteBucketRequest::new().set_or_clear_if_metageneration_match(None::<i32>);
85    /// ```
86    pub fn set_or_clear_if_metageneration_match<T>(mut self, v: std::option::Option<T>) -> Self
87    where
88        T: std::convert::Into<i64>,
89    {
90        self.if_metageneration_match = v.map(|x| x.into());
91        self
92    }
93
94    /// Sets the value of [if_metageneration_not_match][crate::model::DeleteBucketRequest::if_metageneration_not_match].
95    ///
96    /// # Example
97    /// ```ignore,no_run
98    /// # use google_cloud_storage::model::DeleteBucketRequest;
99    /// let x = DeleteBucketRequest::new().set_if_metageneration_not_match(42);
100    /// ```
101    pub fn set_if_metageneration_not_match<T>(mut self, v: T) -> Self
102    where
103        T: std::convert::Into<i64>,
104    {
105        self.if_metageneration_not_match = std::option::Option::Some(v.into());
106        self
107    }
108
109    /// Sets or clears the value of [if_metageneration_not_match][crate::model::DeleteBucketRequest::if_metageneration_not_match].
110    ///
111    /// # Example
112    /// ```ignore,no_run
113    /// # use google_cloud_storage::model::DeleteBucketRequest;
114    /// let x = DeleteBucketRequest::new().set_or_clear_if_metageneration_not_match(Some(42));
115    /// let x = DeleteBucketRequest::new().set_or_clear_if_metageneration_not_match(None::<i32>);
116    /// ```
117    pub fn set_or_clear_if_metageneration_not_match<T>(mut self, v: std::option::Option<T>) -> Self
118    where
119        T: std::convert::Into<i64>,
120    {
121        self.if_metageneration_not_match = v.map(|x| x.into());
122        self
123    }
124}
125
126impl wkt::message::Message for DeleteBucketRequest {
127    fn typename() -> &'static str {
128        "type.googleapis.com/google.storage.v2.DeleteBucketRequest"
129    }
130}
131
132/// Request message for [GetBucket][google.storage.v2.Storage.GetBucket].
133///
134/// [google.storage.v2.Storage.GetBucket]: crate::client::StorageControl::get_bucket
135#[derive(Clone, Default, PartialEq)]
136#[non_exhaustive]
137pub struct GetBucketRequest {
138    /// Required. Name of a bucket.
139    pub name: std::string::String,
140
141    /// If set, only gets the bucket metadata if its metageneration matches this
142    /// value.
143    pub if_metageneration_match: std::option::Option<i64>,
144
145    /// If set, and if the bucket's current metageneration matches the specified
146    /// value, the request returns an error.
147    pub if_metageneration_not_match: std::option::Option<i64>,
148
149    /// Mask specifying which fields to read.
150    /// A `*` field might be used to indicate all fields.
151    /// If no mask is specified, it defaults to all fields.
152    pub read_mask: std::option::Option<wkt::FieldMask>,
153
154    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
155}
156
157impl GetBucketRequest {
158    /// Creates a new default instance.
159    pub fn new() -> Self {
160        std::default::Default::default()
161    }
162
163    /// Sets the value of [name][crate::model::GetBucketRequest::name].
164    ///
165    /// # Example
166    /// ```ignore,no_run
167    /// # use google_cloud_storage::model::GetBucketRequest;
168    /// # let project_id = "project_id";
169    /// # let bucket_id = "bucket_id";
170    /// let x = GetBucketRequest::new().set_name(format!("projects/{project_id}/buckets/{bucket_id}"));
171    /// ```
172    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
173        self.name = v.into();
174        self
175    }
176
177    /// Sets the value of [if_metageneration_match][crate::model::GetBucketRequest::if_metageneration_match].
178    ///
179    /// # Example
180    /// ```ignore,no_run
181    /// # use google_cloud_storage::model::GetBucketRequest;
182    /// let x = GetBucketRequest::new().set_if_metageneration_match(42);
183    /// ```
184    pub fn set_if_metageneration_match<T>(mut self, v: T) -> Self
185    where
186        T: std::convert::Into<i64>,
187    {
188        self.if_metageneration_match = std::option::Option::Some(v.into());
189        self
190    }
191
192    /// Sets or clears the value of [if_metageneration_match][crate::model::GetBucketRequest::if_metageneration_match].
193    ///
194    /// # Example
195    /// ```ignore,no_run
196    /// # use google_cloud_storage::model::GetBucketRequest;
197    /// let x = GetBucketRequest::new().set_or_clear_if_metageneration_match(Some(42));
198    /// let x = GetBucketRequest::new().set_or_clear_if_metageneration_match(None::<i32>);
199    /// ```
200    pub fn set_or_clear_if_metageneration_match<T>(mut self, v: std::option::Option<T>) -> Self
201    where
202        T: std::convert::Into<i64>,
203    {
204        self.if_metageneration_match = v.map(|x| x.into());
205        self
206    }
207
208    /// Sets the value of [if_metageneration_not_match][crate::model::GetBucketRequest::if_metageneration_not_match].
209    ///
210    /// # Example
211    /// ```ignore,no_run
212    /// # use google_cloud_storage::model::GetBucketRequest;
213    /// let x = GetBucketRequest::new().set_if_metageneration_not_match(42);
214    /// ```
215    pub fn set_if_metageneration_not_match<T>(mut self, v: T) -> Self
216    where
217        T: std::convert::Into<i64>,
218    {
219        self.if_metageneration_not_match = std::option::Option::Some(v.into());
220        self
221    }
222
223    /// Sets or clears the value of [if_metageneration_not_match][crate::model::GetBucketRequest::if_metageneration_not_match].
224    ///
225    /// # Example
226    /// ```ignore,no_run
227    /// # use google_cloud_storage::model::GetBucketRequest;
228    /// let x = GetBucketRequest::new().set_or_clear_if_metageneration_not_match(Some(42));
229    /// let x = GetBucketRequest::new().set_or_clear_if_metageneration_not_match(None::<i32>);
230    /// ```
231    pub fn set_or_clear_if_metageneration_not_match<T>(mut self, v: std::option::Option<T>) -> Self
232    where
233        T: std::convert::Into<i64>,
234    {
235        self.if_metageneration_not_match = v.map(|x| x.into());
236        self
237    }
238
239    /// Sets the value of [read_mask][crate::model::GetBucketRequest::read_mask].
240    ///
241    /// # Example
242    /// ```ignore,no_run
243    /// # use google_cloud_storage::model::GetBucketRequest;
244    /// use wkt::FieldMask;
245    /// let x = GetBucketRequest::new().set_read_mask(FieldMask::default()/* use setters */);
246    /// ```
247    pub fn set_read_mask<T>(mut self, v: T) -> Self
248    where
249        T: std::convert::Into<wkt::FieldMask>,
250    {
251        self.read_mask = std::option::Option::Some(v.into());
252        self
253    }
254
255    /// Sets or clears the value of [read_mask][crate::model::GetBucketRequest::read_mask].
256    ///
257    /// # Example
258    /// ```ignore,no_run
259    /// # use google_cloud_storage::model::GetBucketRequest;
260    /// use wkt::FieldMask;
261    /// let x = GetBucketRequest::new().set_or_clear_read_mask(Some(FieldMask::default()/* use setters */));
262    /// let x = GetBucketRequest::new().set_or_clear_read_mask(None::<FieldMask>);
263    /// ```
264    pub fn set_or_clear_read_mask<T>(mut self, v: std::option::Option<T>) -> Self
265    where
266        T: std::convert::Into<wkt::FieldMask>,
267    {
268        self.read_mask = v.map(|x| x.into());
269        self
270    }
271}
272
273impl wkt::message::Message for GetBucketRequest {
274    fn typename() -> &'static str {
275        "type.googleapis.com/google.storage.v2.GetBucketRequest"
276    }
277}
278
279/// Request message for [CreateBucket][google.storage.v2.Storage.CreateBucket].
280///
281/// [google.storage.v2.Storage.CreateBucket]: crate::client::StorageControl::create_bucket
282#[derive(Clone, Default, PartialEq)]
283#[non_exhaustive]
284pub struct CreateBucketRequest {
285    /// Required. The project to which this bucket belongs. This field must either
286    /// be empty or `projects/_`. The project ID that owns this bucket should be
287    /// specified in the `bucket.project` field.
288    pub parent: std::string::String,
289
290    /// Optional. Properties of the new bucket being inserted.
291    /// The name of the bucket is specified in the `bucket_id` field. Populating
292    /// `bucket.name` field results in an error.
293    /// The project of the bucket must be specified in the `bucket.project` field.
294    /// This field must be in `projects/{projectIdentifier}` format,
295    /// {projectIdentifier} can be the project ID or project number. The `parent`
296    /// field must be either empty or `projects/_`.
297    pub bucket: std::option::Option<crate::model::Bucket>,
298
299    /// Required. The ID to use for this bucket, which becomes the final component
300    /// of the bucket's resource name. For example, the value `foo` might result in
301    /// a bucket with the name `projects/123456/buckets/foo`.
302    pub bucket_id: std::string::String,
303
304    /// Optional. Apply a predefined set of access controls to this bucket.
305    /// Valid values are `authenticatedRead`, `private`, `projectPrivate`,
306    /// `publicRead`, or `publicReadWrite`.
307    pub predefined_acl: std::string::String,
308
309    /// Optional. Apply a predefined set of default object access controls to this
310    /// bucket. Valid values are `authenticatedRead`, `bucketOwnerFullControl`,
311    /// `bucketOwnerRead`, `private`, `projectPrivate`, or `publicRead`.
312    pub predefined_default_object_acl: std::string::String,
313
314    /// Optional. If true, enable object retention on the bucket.
315    pub enable_object_retention: bool,
316
317    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
318}
319
320impl CreateBucketRequest {
321    /// Creates a new default instance.
322    pub fn new() -> Self {
323        std::default::Default::default()
324    }
325
326    /// Sets the value of [parent][crate::model::CreateBucketRequest::parent].
327    ///
328    /// # Example
329    /// ```ignore,no_run
330    /// # use google_cloud_storage::model::CreateBucketRequest;
331    /// # let project_id = "project_id";
332    /// let x = CreateBucketRequest::new().set_parent(format!("projects/{project_id}"));
333    /// ```
334    pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
335        self.parent = v.into();
336        self
337    }
338
339    /// Sets the value of [bucket][crate::model::CreateBucketRequest::bucket].
340    ///
341    /// # Example
342    /// ```ignore,no_run
343    /// # use google_cloud_storage::model::CreateBucketRequest;
344    /// use google_cloud_storage::model::Bucket;
345    /// let x = CreateBucketRequest::new().set_bucket(Bucket::default()/* use setters */);
346    /// ```
347    pub fn set_bucket<T>(mut self, v: T) -> Self
348    where
349        T: std::convert::Into<crate::model::Bucket>,
350    {
351        self.bucket = std::option::Option::Some(v.into());
352        self
353    }
354
355    /// Sets or clears the value of [bucket][crate::model::CreateBucketRequest::bucket].
356    ///
357    /// # Example
358    /// ```ignore,no_run
359    /// # use google_cloud_storage::model::CreateBucketRequest;
360    /// use google_cloud_storage::model::Bucket;
361    /// let x = CreateBucketRequest::new().set_or_clear_bucket(Some(Bucket::default()/* use setters */));
362    /// let x = CreateBucketRequest::new().set_or_clear_bucket(None::<Bucket>);
363    /// ```
364    pub fn set_or_clear_bucket<T>(mut self, v: std::option::Option<T>) -> Self
365    where
366        T: std::convert::Into<crate::model::Bucket>,
367    {
368        self.bucket = v.map(|x| x.into());
369        self
370    }
371
372    /// Sets the value of [bucket_id][crate::model::CreateBucketRequest::bucket_id].
373    ///
374    /// # Example
375    /// ```ignore,no_run
376    /// # use google_cloud_storage::model::CreateBucketRequest;
377    /// let x = CreateBucketRequest::new().set_bucket_id("example");
378    /// ```
379    pub fn set_bucket_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
380        self.bucket_id = v.into();
381        self
382    }
383
384    /// Sets the value of [predefined_acl][crate::model::CreateBucketRequest::predefined_acl].
385    ///
386    /// # Example
387    /// ```ignore,no_run
388    /// # use google_cloud_storage::model::CreateBucketRequest;
389    /// let x = CreateBucketRequest::new().set_predefined_acl("example");
390    /// ```
391    pub fn set_predefined_acl<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
392        self.predefined_acl = v.into();
393        self
394    }
395
396    /// Sets the value of [predefined_default_object_acl][crate::model::CreateBucketRequest::predefined_default_object_acl].
397    ///
398    /// # Example
399    /// ```ignore,no_run
400    /// # use google_cloud_storage::model::CreateBucketRequest;
401    /// let x = CreateBucketRequest::new().set_predefined_default_object_acl("example");
402    /// ```
403    pub fn set_predefined_default_object_acl<T: std::convert::Into<std::string::String>>(
404        mut self,
405        v: T,
406    ) -> Self {
407        self.predefined_default_object_acl = v.into();
408        self
409    }
410
411    /// Sets the value of [enable_object_retention][crate::model::CreateBucketRequest::enable_object_retention].
412    ///
413    /// # Example
414    /// ```ignore,no_run
415    /// # use google_cloud_storage::model::CreateBucketRequest;
416    /// let x = CreateBucketRequest::new().set_enable_object_retention(true);
417    /// ```
418    pub fn set_enable_object_retention<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
419        self.enable_object_retention = v.into();
420        self
421    }
422}
423
424impl wkt::message::Message for CreateBucketRequest {
425    fn typename() -> &'static str {
426        "type.googleapis.com/google.storage.v2.CreateBucketRequest"
427    }
428}
429
430/// Request message for [ListBuckets][google.storage.v2.Storage.ListBuckets].
431///
432/// [google.storage.v2.Storage.ListBuckets]: crate::client::StorageControl::list_buckets
433#[derive(Clone, Default, PartialEq)]
434#[non_exhaustive]
435pub struct ListBucketsRequest {
436    /// Required. The project whose buckets we are listing.
437    pub parent: std::string::String,
438
439    /// Optional. Maximum number of buckets to return in a single response. The
440    /// service uses this parameter or `1,000` items, whichever is smaller. If
441    /// `acl` is present in the `read_mask`, the service uses this parameter of
442    /// `200` items, whichever is smaller.
443    pub page_size: i32,
444
445    /// Optional. A previously-returned page token representing part of the larger
446    /// set of results to view.
447    pub page_token: std::string::String,
448
449    /// Optional. Filter results to buckets whose names begin with this prefix.
450    pub prefix: std::string::String,
451
452    /// Mask specifying which fields to read from each result.
453    /// If no mask is specified, it defaults to all fields except `items.
454    /// owner`, `items.acl`, and `items.default_object_acl`.
455    /// `*` might be used to mean "all fields".
456    pub read_mask: std::option::Option<wkt::FieldMask>,
457
458    /// Optional. Allows listing of buckets, even if there are buckets that are
459    /// unreachable.
460    pub return_partial_success: bool,
461
462    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
463}
464
465impl ListBucketsRequest {
466    /// Creates a new default instance.
467    pub fn new() -> Self {
468        std::default::Default::default()
469    }
470
471    /// Sets the value of [parent][crate::model::ListBucketsRequest::parent].
472    ///
473    /// # Example
474    /// ```ignore,no_run
475    /// # use google_cloud_storage::model::ListBucketsRequest;
476    /// # let project_id = "project_id";
477    /// let x = ListBucketsRequest::new().set_parent(format!("projects/{project_id}"));
478    /// ```
479    pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
480        self.parent = v.into();
481        self
482    }
483
484    /// Sets the value of [page_size][crate::model::ListBucketsRequest::page_size].
485    ///
486    /// # Example
487    /// ```ignore,no_run
488    /// # use google_cloud_storage::model::ListBucketsRequest;
489    /// let x = ListBucketsRequest::new().set_page_size(42);
490    /// ```
491    pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
492        self.page_size = v.into();
493        self
494    }
495
496    /// Sets the value of [page_token][crate::model::ListBucketsRequest::page_token].
497    ///
498    /// # Example
499    /// ```ignore,no_run
500    /// # use google_cloud_storage::model::ListBucketsRequest;
501    /// let x = ListBucketsRequest::new().set_page_token("example");
502    /// ```
503    pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
504        self.page_token = v.into();
505        self
506    }
507
508    /// Sets the value of [prefix][crate::model::ListBucketsRequest::prefix].
509    ///
510    /// # Example
511    /// ```ignore,no_run
512    /// # use google_cloud_storage::model::ListBucketsRequest;
513    /// let x = ListBucketsRequest::new().set_prefix("example");
514    /// ```
515    pub fn set_prefix<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
516        self.prefix = v.into();
517        self
518    }
519
520    /// Sets the value of [read_mask][crate::model::ListBucketsRequest::read_mask].
521    ///
522    /// # Example
523    /// ```ignore,no_run
524    /// # use google_cloud_storage::model::ListBucketsRequest;
525    /// use wkt::FieldMask;
526    /// let x = ListBucketsRequest::new().set_read_mask(FieldMask::default()/* use setters */);
527    /// ```
528    pub fn set_read_mask<T>(mut self, v: T) -> Self
529    where
530        T: std::convert::Into<wkt::FieldMask>,
531    {
532        self.read_mask = std::option::Option::Some(v.into());
533        self
534    }
535
536    /// Sets or clears the value of [read_mask][crate::model::ListBucketsRequest::read_mask].
537    ///
538    /// # Example
539    /// ```ignore,no_run
540    /// # use google_cloud_storage::model::ListBucketsRequest;
541    /// use wkt::FieldMask;
542    /// let x = ListBucketsRequest::new().set_or_clear_read_mask(Some(FieldMask::default()/* use setters */));
543    /// let x = ListBucketsRequest::new().set_or_clear_read_mask(None::<FieldMask>);
544    /// ```
545    pub fn set_or_clear_read_mask<T>(mut self, v: std::option::Option<T>) -> Self
546    where
547        T: std::convert::Into<wkt::FieldMask>,
548    {
549        self.read_mask = v.map(|x| x.into());
550        self
551    }
552
553    /// Sets the value of [return_partial_success][crate::model::ListBucketsRequest::return_partial_success].
554    ///
555    /// # Example
556    /// ```ignore,no_run
557    /// # use google_cloud_storage::model::ListBucketsRequest;
558    /// let x = ListBucketsRequest::new().set_return_partial_success(true);
559    /// ```
560    pub fn set_return_partial_success<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
561        self.return_partial_success = v.into();
562        self
563    }
564}
565
566impl wkt::message::Message for ListBucketsRequest {
567    fn typename() -> &'static str {
568        "type.googleapis.com/google.storage.v2.ListBucketsRequest"
569    }
570}
571
572/// Response message for [ListBuckets][google.storage.v2.Storage.ListBuckets].
573///
574/// [google.storage.v2.Storage.ListBuckets]: crate::client::StorageControl::list_buckets
575#[derive(Clone, Default, PartialEq)]
576#[non_exhaustive]
577pub struct ListBucketsResponse {
578    /// The list of items.
579    pub buckets: std::vec::Vec<crate::model::Bucket>,
580
581    /// The continuation token, used to page through large result sets. Provide
582    /// this value in a subsequent request to return the next page of results.
583    pub next_page_token: std::string::String,
584
585    /// Unreachable resources.
586    /// This field can only be present if the caller specified
587    /// return_partial_success to be true in the request to receive indications
588    /// of temporarily missing resources.
589    /// unreachable might be:
590    /// unreachable = [
591    /// "projects/_/buckets/bucket1",
592    /// "projects/_/buckets/bucket2",
593    /// "projects/_/buckets/bucket3",
594    /// ]
595    pub unreachable: std::vec::Vec<std::string::String>,
596
597    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
598}
599
600impl ListBucketsResponse {
601    /// Creates a new default instance.
602    pub fn new() -> Self {
603        std::default::Default::default()
604    }
605
606    /// Sets the value of [buckets][crate::model::ListBucketsResponse::buckets].
607    ///
608    /// # Example
609    /// ```ignore,no_run
610    /// # use google_cloud_storage::model::ListBucketsResponse;
611    /// use google_cloud_storage::model::Bucket;
612    /// let x = ListBucketsResponse::new()
613    ///     .set_buckets([
614    ///         Bucket::default()/* use setters */,
615    ///         Bucket::default()/* use (different) setters */,
616    ///     ]);
617    /// ```
618    pub fn set_buckets<T, V>(mut self, v: T) -> Self
619    where
620        T: std::iter::IntoIterator<Item = V>,
621        V: std::convert::Into<crate::model::Bucket>,
622    {
623        use std::iter::Iterator;
624        self.buckets = v.into_iter().map(|i| i.into()).collect();
625        self
626    }
627
628    /// Sets the value of [next_page_token][crate::model::ListBucketsResponse::next_page_token].
629    ///
630    /// # Example
631    /// ```ignore,no_run
632    /// # use google_cloud_storage::model::ListBucketsResponse;
633    /// let x = ListBucketsResponse::new().set_next_page_token("example");
634    /// ```
635    pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
636        self.next_page_token = v.into();
637        self
638    }
639
640    /// Sets the value of [unreachable][crate::model::ListBucketsResponse::unreachable].
641    ///
642    /// # Example
643    /// ```ignore,no_run
644    /// # use google_cloud_storage::model::ListBucketsResponse;
645    /// let x = ListBucketsResponse::new().set_unreachable(["a", "b", "c"]);
646    /// ```
647    pub fn set_unreachable<T, V>(mut self, v: T) -> Self
648    where
649        T: std::iter::IntoIterator<Item = V>,
650        V: std::convert::Into<std::string::String>,
651    {
652        use std::iter::Iterator;
653        self.unreachable = v.into_iter().map(|i| i.into()).collect();
654        self
655    }
656}
657
658impl wkt::message::Message for ListBucketsResponse {
659    fn typename() -> &'static str {
660        "type.googleapis.com/google.storage.v2.ListBucketsResponse"
661    }
662}
663
664#[doc(hidden)]
665impl google_cloud_gax::paginator::internal::PageableResponse for ListBucketsResponse {
666    type PageItem = crate::model::Bucket;
667
668    fn items(self) -> std::vec::Vec<Self::PageItem> {
669        self.buckets
670    }
671
672    fn next_page_token(&self) -> std::string::String {
673        use std::clone::Clone;
674        self.next_page_token.clone()
675    }
676}
677
678/// Request message for
679/// [LockBucketRetentionPolicy][google.storage.v2.Storage.LockBucketRetentionPolicy].
680///
681/// [google.storage.v2.Storage.LockBucketRetentionPolicy]: crate::client::StorageControl::lock_bucket_retention_policy
682#[derive(Clone, Default, PartialEq)]
683#[non_exhaustive]
684pub struct LockBucketRetentionPolicyRequest {
685    /// Required. Name of a bucket.
686    pub bucket: std::string::String,
687
688    /// Required. Makes the operation conditional on whether bucket's current
689    /// metageneration matches the given value. Must be positive.
690    pub if_metageneration_match: i64,
691
692    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
693}
694
695impl LockBucketRetentionPolicyRequest {
696    /// Creates a new default instance.
697    pub fn new() -> Self {
698        std::default::Default::default()
699    }
700
701    /// Sets the value of [bucket][crate::model::LockBucketRetentionPolicyRequest::bucket].
702    ///
703    /// # Example
704    /// ```ignore,no_run
705    /// # use google_cloud_storage::model::LockBucketRetentionPolicyRequest;
706    /// # let project_id = "project_id";
707    /// # let bucket_id = "bucket_id";
708    /// let x = LockBucketRetentionPolicyRequest::new().set_bucket(format!("projects/{project_id}/buckets/{bucket_id}"));
709    /// ```
710    pub fn set_bucket<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
711        self.bucket = v.into();
712        self
713    }
714
715    /// Sets the value of [if_metageneration_match][crate::model::LockBucketRetentionPolicyRequest::if_metageneration_match].
716    ///
717    /// # Example
718    /// ```ignore,no_run
719    /// # use google_cloud_storage::model::LockBucketRetentionPolicyRequest;
720    /// let x = LockBucketRetentionPolicyRequest::new().set_if_metageneration_match(42);
721    /// ```
722    pub fn set_if_metageneration_match<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
723        self.if_metageneration_match = v.into();
724        self
725    }
726}
727
728impl wkt::message::Message for LockBucketRetentionPolicyRequest {
729    fn typename() -> &'static str {
730        "type.googleapis.com/google.storage.v2.LockBucketRetentionPolicyRequest"
731    }
732}
733
734/// Request for [UpdateBucket][google.storage.v2.Storage.UpdateBucket] method.
735///
736/// [google.storage.v2.Storage.UpdateBucket]: crate::client::StorageControl::update_bucket
737#[derive(Clone, Default, PartialEq)]
738#[non_exhaustive]
739pub struct UpdateBucketRequest {
740    /// Required. The bucket to update.
741    /// The bucket's `name` field is used to identify the bucket.
742    pub bucket: std::option::Option<crate::model::Bucket>,
743
744    /// If set, the request modifies the bucket if its metageneration matches this
745    /// value.
746    pub if_metageneration_match: std::option::Option<i64>,
747
748    /// If set, the request modifies the bucket if its metageneration doesn't
749    /// match this value.
750    pub if_metageneration_not_match: std::option::Option<i64>,
751
752    /// Optional. Apply a predefined set of access controls to this bucket.
753    /// Valid values are `authenticatedRead`, `private`, `projectPrivate`,
754    /// `publicRead`, or `publicReadWrite`.
755    pub predefined_acl: std::string::String,
756
757    /// Optional. Apply a predefined set of default object access controls to this
758    /// bucket. Valid values are `authenticatedRead`, `bucketOwnerFullControl`,
759    /// `bucketOwnerRead`, `private`, `projectPrivate`, or `publicRead`.
760    pub predefined_default_object_acl: std::string::String,
761
762    /// Required. List of fields to be updated.
763    ///
764    /// To specify ALL fields, equivalent to the JSON API's "update" function,
765    /// specify a single field with the value `*`. Note: not recommended. If a new
766    /// field is introduced at a later time, an older client updating with the `*`
767    /// might accidentally reset the new field's value.
768    ///
769    /// Not specifying any fields is an error.
770    pub update_mask: std::option::Option<wkt::FieldMask>,
771
772    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
773}
774
775impl UpdateBucketRequest {
776    /// Creates a new default instance.
777    pub fn new() -> Self {
778        std::default::Default::default()
779    }
780
781    /// Sets the value of [bucket][crate::model::UpdateBucketRequest::bucket].
782    ///
783    /// # Example
784    /// ```ignore,no_run
785    /// # use google_cloud_storage::model::UpdateBucketRequest;
786    /// use google_cloud_storage::model::Bucket;
787    /// let x = UpdateBucketRequest::new().set_bucket(Bucket::default()/* use setters */);
788    /// ```
789    pub fn set_bucket<T>(mut self, v: T) -> Self
790    where
791        T: std::convert::Into<crate::model::Bucket>,
792    {
793        self.bucket = std::option::Option::Some(v.into());
794        self
795    }
796
797    /// Sets or clears the value of [bucket][crate::model::UpdateBucketRequest::bucket].
798    ///
799    /// # Example
800    /// ```ignore,no_run
801    /// # use google_cloud_storage::model::UpdateBucketRequest;
802    /// use google_cloud_storage::model::Bucket;
803    /// let x = UpdateBucketRequest::new().set_or_clear_bucket(Some(Bucket::default()/* use setters */));
804    /// let x = UpdateBucketRequest::new().set_or_clear_bucket(None::<Bucket>);
805    /// ```
806    pub fn set_or_clear_bucket<T>(mut self, v: std::option::Option<T>) -> Self
807    where
808        T: std::convert::Into<crate::model::Bucket>,
809    {
810        self.bucket = v.map(|x| x.into());
811        self
812    }
813
814    /// Sets the value of [if_metageneration_match][crate::model::UpdateBucketRequest::if_metageneration_match].
815    ///
816    /// # Example
817    /// ```ignore,no_run
818    /// # use google_cloud_storage::model::UpdateBucketRequest;
819    /// let x = UpdateBucketRequest::new().set_if_metageneration_match(42);
820    /// ```
821    pub fn set_if_metageneration_match<T>(mut self, v: T) -> Self
822    where
823        T: std::convert::Into<i64>,
824    {
825        self.if_metageneration_match = std::option::Option::Some(v.into());
826        self
827    }
828
829    /// Sets or clears the value of [if_metageneration_match][crate::model::UpdateBucketRequest::if_metageneration_match].
830    ///
831    /// # Example
832    /// ```ignore,no_run
833    /// # use google_cloud_storage::model::UpdateBucketRequest;
834    /// let x = UpdateBucketRequest::new().set_or_clear_if_metageneration_match(Some(42));
835    /// let x = UpdateBucketRequest::new().set_or_clear_if_metageneration_match(None::<i32>);
836    /// ```
837    pub fn set_or_clear_if_metageneration_match<T>(mut self, v: std::option::Option<T>) -> Self
838    where
839        T: std::convert::Into<i64>,
840    {
841        self.if_metageneration_match = v.map(|x| x.into());
842        self
843    }
844
845    /// Sets the value of [if_metageneration_not_match][crate::model::UpdateBucketRequest::if_metageneration_not_match].
846    ///
847    /// # Example
848    /// ```ignore,no_run
849    /// # use google_cloud_storage::model::UpdateBucketRequest;
850    /// let x = UpdateBucketRequest::new().set_if_metageneration_not_match(42);
851    /// ```
852    pub fn set_if_metageneration_not_match<T>(mut self, v: T) -> Self
853    where
854        T: std::convert::Into<i64>,
855    {
856        self.if_metageneration_not_match = std::option::Option::Some(v.into());
857        self
858    }
859
860    /// Sets or clears the value of [if_metageneration_not_match][crate::model::UpdateBucketRequest::if_metageneration_not_match].
861    ///
862    /// # Example
863    /// ```ignore,no_run
864    /// # use google_cloud_storage::model::UpdateBucketRequest;
865    /// let x = UpdateBucketRequest::new().set_or_clear_if_metageneration_not_match(Some(42));
866    /// let x = UpdateBucketRequest::new().set_or_clear_if_metageneration_not_match(None::<i32>);
867    /// ```
868    pub fn set_or_clear_if_metageneration_not_match<T>(mut self, v: std::option::Option<T>) -> Self
869    where
870        T: std::convert::Into<i64>,
871    {
872        self.if_metageneration_not_match = v.map(|x| x.into());
873        self
874    }
875
876    /// Sets the value of [predefined_acl][crate::model::UpdateBucketRequest::predefined_acl].
877    ///
878    /// # Example
879    /// ```ignore,no_run
880    /// # use google_cloud_storage::model::UpdateBucketRequest;
881    /// let x = UpdateBucketRequest::new().set_predefined_acl("example");
882    /// ```
883    pub fn set_predefined_acl<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
884        self.predefined_acl = v.into();
885        self
886    }
887
888    /// Sets the value of [predefined_default_object_acl][crate::model::UpdateBucketRequest::predefined_default_object_acl].
889    ///
890    /// # Example
891    /// ```ignore,no_run
892    /// # use google_cloud_storage::model::UpdateBucketRequest;
893    /// let x = UpdateBucketRequest::new().set_predefined_default_object_acl("example");
894    /// ```
895    pub fn set_predefined_default_object_acl<T: std::convert::Into<std::string::String>>(
896        mut self,
897        v: T,
898    ) -> Self {
899        self.predefined_default_object_acl = v.into();
900        self
901    }
902
903    /// Sets the value of [update_mask][crate::model::UpdateBucketRequest::update_mask].
904    ///
905    /// # Example
906    /// ```ignore,no_run
907    /// # use google_cloud_storage::model::UpdateBucketRequest;
908    /// use wkt::FieldMask;
909    /// let x = UpdateBucketRequest::new().set_update_mask(FieldMask::default()/* use setters */);
910    /// ```
911    pub fn set_update_mask<T>(mut self, v: T) -> Self
912    where
913        T: std::convert::Into<wkt::FieldMask>,
914    {
915        self.update_mask = std::option::Option::Some(v.into());
916        self
917    }
918
919    /// Sets or clears the value of [update_mask][crate::model::UpdateBucketRequest::update_mask].
920    ///
921    /// # Example
922    /// ```ignore,no_run
923    /// # use google_cloud_storage::model::UpdateBucketRequest;
924    /// use wkt::FieldMask;
925    /// let x = UpdateBucketRequest::new().set_or_clear_update_mask(Some(FieldMask::default()/* use setters */));
926    /// let x = UpdateBucketRequest::new().set_or_clear_update_mask(None::<FieldMask>);
927    /// ```
928    pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
929    where
930        T: std::convert::Into<wkt::FieldMask>,
931    {
932        self.update_mask = v.map(|x| x.into());
933        self
934    }
935}
936
937impl wkt::message::Message for UpdateBucketRequest {
938    fn typename() -> &'static str {
939        "type.googleapis.com/google.storage.v2.UpdateBucketRequest"
940    }
941}
942
943/// Request message for [ComposeObject][google.storage.v2.Storage.ComposeObject].
944///
945/// [google.storage.v2.Storage.ComposeObject]: crate::client::StorageControl::compose_object
946#[derive(Clone, Default, PartialEq)]
947#[non_exhaustive]
948pub struct ComposeObjectRequest {
949    /// Required. Properties of the resulting object.
950    pub destination: std::option::Option<crate::model::Object>,
951
952    /// Optional. The list of source objects that is concatenated into a single
953    /// object.
954    pub source_objects: std::vec::Vec<crate::model::compose_object_request::SourceObject>,
955
956    /// Optional. Apply a predefined set of access controls to the destination
957    /// object. Valid values are `authenticatedRead`, `bucketOwnerFullControl`,
958    /// `bucketOwnerRead`, `private`, `projectPrivate`, or `publicRead`.
959    pub destination_predefined_acl: std::string::String,
960
961    /// Makes the operation conditional on whether the object's current generation
962    /// matches the given value. Setting to 0 makes the operation succeed only if
963    /// there are no live versions of the object.
964    pub if_generation_match: std::option::Option<i64>,
965
966    /// Makes the operation conditional on whether the object's current
967    /// metageneration matches the given value.
968    pub if_metageneration_match: std::option::Option<i64>,
969
970    /// Optional. Resource name of the Cloud KMS key, of the form
971    /// `projects/my-project/locations/my-location/keyRings/my-kr/cryptoKeys/my-key`,
972    /// that is used to encrypt the object. Overrides the object
973    /// metadata's `kms_key_name` value, if any.
974    pub kms_key: std::string::String,
975
976    /// Optional. A set of parameters common to Storage API requests concerning an
977    /// object.
978    pub common_object_request_params: std::option::Option<crate::model::CommonObjectRequestParams>,
979
980    /// Optional. The checksums of the complete object. This is validated against
981    /// the combined checksums of the component objects.
982    pub object_checksums: std::option::Option<crate::model::ObjectChecksums>,
983
984    /// Whether the source objects should be deleted in the compose request.
985    pub delete_source_objects: std::option::Option<bool>,
986
987    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
988}
989
990impl ComposeObjectRequest {
991    /// Creates a new default instance.
992    pub fn new() -> Self {
993        std::default::Default::default()
994    }
995
996    /// Sets the value of [destination][crate::model::ComposeObjectRequest::destination].
997    ///
998    /// # Example
999    /// ```ignore,no_run
1000    /// # use google_cloud_storage::model::ComposeObjectRequest;
1001    /// use google_cloud_storage::model::Object;
1002    /// let x = ComposeObjectRequest::new().set_destination(Object::default()/* use setters */);
1003    /// ```
1004    pub fn set_destination<T>(mut self, v: T) -> Self
1005    where
1006        T: std::convert::Into<crate::model::Object>,
1007    {
1008        self.destination = std::option::Option::Some(v.into());
1009        self
1010    }
1011
1012    /// Sets or clears the value of [destination][crate::model::ComposeObjectRequest::destination].
1013    ///
1014    /// # Example
1015    /// ```ignore,no_run
1016    /// # use google_cloud_storage::model::ComposeObjectRequest;
1017    /// use google_cloud_storage::model::Object;
1018    /// let x = ComposeObjectRequest::new().set_or_clear_destination(Some(Object::default()/* use setters */));
1019    /// let x = ComposeObjectRequest::new().set_or_clear_destination(None::<Object>);
1020    /// ```
1021    pub fn set_or_clear_destination<T>(mut self, v: std::option::Option<T>) -> Self
1022    where
1023        T: std::convert::Into<crate::model::Object>,
1024    {
1025        self.destination = v.map(|x| x.into());
1026        self
1027    }
1028
1029    /// Sets the value of [source_objects][crate::model::ComposeObjectRequest::source_objects].
1030    ///
1031    /// # Example
1032    /// ```ignore,no_run
1033    /// # use google_cloud_storage::model::ComposeObjectRequest;
1034    /// use google_cloud_storage::model::compose_object_request::SourceObject;
1035    /// let x = ComposeObjectRequest::new()
1036    ///     .set_source_objects([
1037    ///         SourceObject::default()/* use setters */,
1038    ///         SourceObject::default()/* use (different) setters */,
1039    ///     ]);
1040    /// ```
1041    pub fn set_source_objects<T, V>(mut self, v: T) -> Self
1042    where
1043        T: std::iter::IntoIterator<Item = V>,
1044        V: std::convert::Into<crate::model::compose_object_request::SourceObject>,
1045    {
1046        use std::iter::Iterator;
1047        self.source_objects = v.into_iter().map(|i| i.into()).collect();
1048        self
1049    }
1050
1051    /// Sets the value of [destination_predefined_acl][crate::model::ComposeObjectRequest::destination_predefined_acl].
1052    ///
1053    /// # Example
1054    /// ```ignore,no_run
1055    /// # use google_cloud_storage::model::ComposeObjectRequest;
1056    /// let x = ComposeObjectRequest::new().set_destination_predefined_acl("example");
1057    /// ```
1058    pub fn set_destination_predefined_acl<T: std::convert::Into<std::string::String>>(
1059        mut self,
1060        v: T,
1061    ) -> Self {
1062        self.destination_predefined_acl = v.into();
1063        self
1064    }
1065
1066    /// Sets the value of [if_generation_match][crate::model::ComposeObjectRequest::if_generation_match].
1067    ///
1068    /// # Example
1069    /// ```ignore,no_run
1070    /// # use google_cloud_storage::model::ComposeObjectRequest;
1071    /// let x = ComposeObjectRequest::new().set_if_generation_match(42);
1072    /// ```
1073    pub fn set_if_generation_match<T>(mut self, v: T) -> Self
1074    where
1075        T: std::convert::Into<i64>,
1076    {
1077        self.if_generation_match = std::option::Option::Some(v.into());
1078        self
1079    }
1080
1081    /// Sets or clears the value of [if_generation_match][crate::model::ComposeObjectRequest::if_generation_match].
1082    ///
1083    /// # Example
1084    /// ```ignore,no_run
1085    /// # use google_cloud_storage::model::ComposeObjectRequest;
1086    /// let x = ComposeObjectRequest::new().set_or_clear_if_generation_match(Some(42));
1087    /// let x = ComposeObjectRequest::new().set_or_clear_if_generation_match(None::<i32>);
1088    /// ```
1089    pub fn set_or_clear_if_generation_match<T>(mut self, v: std::option::Option<T>) -> Self
1090    where
1091        T: std::convert::Into<i64>,
1092    {
1093        self.if_generation_match = v.map(|x| x.into());
1094        self
1095    }
1096
1097    /// Sets the value of [if_metageneration_match][crate::model::ComposeObjectRequest::if_metageneration_match].
1098    ///
1099    /// # Example
1100    /// ```ignore,no_run
1101    /// # use google_cloud_storage::model::ComposeObjectRequest;
1102    /// let x = ComposeObjectRequest::new().set_if_metageneration_match(42);
1103    /// ```
1104    pub fn set_if_metageneration_match<T>(mut self, v: T) -> Self
1105    where
1106        T: std::convert::Into<i64>,
1107    {
1108        self.if_metageneration_match = std::option::Option::Some(v.into());
1109        self
1110    }
1111
1112    /// Sets or clears the value of [if_metageneration_match][crate::model::ComposeObjectRequest::if_metageneration_match].
1113    ///
1114    /// # Example
1115    /// ```ignore,no_run
1116    /// # use google_cloud_storage::model::ComposeObjectRequest;
1117    /// let x = ComposeObjectRequest::new().set_or_clear_if_metageneration_match(Some(42));
1118    /// let x = ComposeObjectRequest::new().set_or_clear_if_metageneration_match(None::<i32>);
1119    /// ```
1120    pub fn set_or_clear_if_metageneration_match<T>(mut self, v: std::option::Option<T>) -> Self
1121    where
1122        T: std::convert::Into<i64>,
1123    {
1124        self.if_metageneration_match = v.map(|x| x.into());
1125        self
1126    }
1127
1128    /// Sets the value of [kms_key][crate::model::ComposeObjectRequest::kms_key].
1129    ///
1130    /// # Example
1131    /// ```ignore,no_run
1132    /// # use google_cloud_storage::model::ComposeObjectRequest;
1133    /// let x = ComposeObjectRequest::new().set_kms_key("example");
1134    /// ```
1135    pub fn set_kms_key<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1136        self.kms_key = v.into();
1137        self
1138    }
1139
1140    /// Sets the value of [common_object_request_params][crate::model::ComposeObjectRequest::common_object_request_params].
1141    ///
1142    /// # Example
1143    /// ```ignore,no_run
1144    /// # use google_cloud_storage::model::ComposeObjectRequest;
1145    /// use google_cloud_storage::model::CommonObjectRequestParams;
1146    /// let x = ComposeObjectRequest::new().set_common_object_request_params(CommonObjectRequestParams::default()/* use setters */);
1147    /// ```
1148    pub fn set_common_object_request_params<T>(mut self, v: T) -> Self
1149    where
1150        T: std::convert::Into<crate::model::CommonObjectRequestParams>,
1151    {
1152        self.common_object_request_params = std::option::Option::Some(v.into());
1153        self
1154    }
1155
1156    /// Sets or clears the value of [common_object_request_params][crate::model::ComposeObjectRequest::common_object_request_params].
1157    ///
1158    /// # Example
1159    /// ```ignore,no_run
1160    /// # use google_cloud_storage::model::ComposeObjectRequest;
1161    /// use google_cloud_storage::model::CommonObjectRequestParams;
1162    /// let x = ComposeObjectRequest::new().set_or_clear_common_object_request_params(Some(CommonObjectRequestParams::default()/* use setters */));
1163    /// let x = ComposeObjectRequest::new().set_or_clear_common_object_request_params(None::<CommonObjectRequestParams>);
1164    /// ```
1165    pub fn set_or_clear_common_object_request_params<T>(mut self, v: std::option::Option<T>) -> Self
1166    where
1167        T: std::convert::Into<crate::model::CommonObjectRequestParams>,
1168    {
1169        self.common_object_request_params = v.map(|x| x.into());
1170        self
1171    }
1172
1173    /// Sets the value of [object_checksums][crate::model::ComposeObjectRequest::object_checksums].
1174    ///
1175    /// # Example
1176    /// ```ignore,no_run
1177    /// # use google_cloud_storage::model::ComposeObjectRequest;
1178    /// use google_cloud_storage::model::ObjectChecksums;
1179    /// let x = ComposeObjectRequest::new().set_object_checksums(ObjectChecksums::default()/* use setters */);
1180    /// ```
1181    pub fn set_object_checksums<T>(mut self, v: T) -> Self
1182    where
1183        T: std::convert::Into<crate::model::ObjectChecksums>,
1184    {
1185        self.object_checksums = std::option::Option::Some(v.into());
1186        self
1187    }
1188
1189    /// Sets or clears the value of [object_checksums][crate::model::ComposeObjectRequest::object_checksums].
1190    ///
1191    /// # Example
1192    /// ```ignore,no_run
1193    /// # use google_cloud_storage::model::ComposeObjectRequest;
1194    /// use google_cloud_storage::model::ObjectChecksums;
1195    /// let x = ComposeObjectRequest::new().set_or_clear_object_checksums(Some(ObjectChecksums::default()/* use setters */));
1196    /// let x = ComposeObjectRequest::new().set_or_clear_object_checksums(None::<ObjectChecksums>);
1197    /// ```
1198    pub fn set_or_clear_object_checksums<T>(mut self, v: std::option::Option<T>) -> Self
1199    where
1200        T: std::convert::Into<crate::model::ObjectChecksums>,
1201    {
1202        self.object_checksums = v.map(|x| x.into());
1203        self
1204    }
1205
1206    /// Sets the value of [delete_source_objects][crate::model::ComposeObjectRequest::delete_source_objects].
1207    ///
1208    /// # Example
1209    /// ```ignore,no_run
1210    /// # use google_cloud_storage::model::ComposeObjectRequest;
1211    /// let x = ComposeObjectRequest::new().set_delete_source_objects(true);
1212    /// ```
1213    pub fn set_delete_source_objects<T>(mut self, v: T) -> Self
1214    where
1215        T: std::convert::Into<bool>,
1216    {
1217        self.delete_source_objects = std::option::Option::Some(v.into());
1218        self
1219    }
1220
1221    /// Sets or clears the value of [delete_source_objects][crate::model::ComposeObjectRequest::delete_source_objects].
1222    ///
1223    /// # Example
1224    /// ```ignore,no_run
1225    /// # use google_cloud_storage::model::ComposeObjectRequest;
1226    /// let x = ComposeObjectRequest::new().set_or_clear_delete_source_objects(Some(false));
1227    /// let x = ComposeObjectRequest::new().set_or_clear_delete_source_objects(None::<bool>);
1228    /// ```
1229    pub fn set_or_clear_delete_source_objects<T>(mut self, v: std::option::Option<T>) -> Self
1230    where
1231        T: std::convert::Into<bool>,
1232    {
1233        self.delete_source_objects = v.map(|x| x.into());
1234        self
1235    }
1236}
1237
1238impl wkt::message::Message for ComposeObjectRequest {
1239    fn typename() -> &'static str {
1240        "type.googleapis.com/google.storage.v2.ComposeObjectRequest"
1241    }
1242}
1243
1244/// Defines additional types related to [ComposeObjectRequest].
1245pub mod compose_object_request {
1246    #[allow(unused_imports)]
1247    use super::*;
1248
1249    /// Description of a source object for a composition request.
1250    #[derive(Clone, Default, PartialEq)]
1251    #[non_exhaustive]
1252    pub struct SourceObject {
1253        /// Required. The source object's name. All source objects must reside in the
1254        /// same bucket.
1255        pub name: std::string::String,
1256
1257        /// Optional. The generation of this object to use as the source.
1258        pub generation: i64,
1259
1260        /// Optional. Conditions that must be met for this operation to execute.
1261        pub object_preconditions: std::option::Option<
1262            crate::model::compose_object_request::source_object::ObjectPreconditions,
1263        >,
1264
1265        pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1266    }
1267
1268    impl SourceObject {
1269        /// Creates a new default instance.
1270        pub fn new() -> Self {
1271            std::default::Default::default()
1272        }
1273
1274        /// Sets the value of [name][crate::model::compose_object_request::SourceObject::name].
1275        ///
1276        /// # Example
1277        /// ```ignore,no_run
1278        /// # use google_cloud_storage::model::compose_object_request::SourceObject;
1279        /// let x = SourceObject::new().set_name("example");
1280        /// ```
1281        pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1282            self.name = v.into();
1283            self
1284        }
1285
1286        /// Sets the value of [generation][crate::model::compose_object_request::SourceObject::generation].
1287        ///
1288        /// # Example
1289        /// ```ignore,no_run
1290        /// # use google_cloud_storage::model::compose_object_request::SourceObject;
1291        /// let x = SourceObject::new().set_generation(42);
1292        /// ```
1293        pub fn set_generation<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
1294            self.generation = v.into();
1295            self
1296        }
1297
1298        /// Sets the value of [object_preconditions][crate::model::compose_object_request::SourceObject::object_preconditions].
1299        ///
1300        /// # Example
1301        /// ```ignore,no_run
1302        /// # use google_cloud_storage::model::compose_object_request::SourceObject;
1303        /// use google_cloud_storage::model::compose_object_request::source_object::ObjectPreconditions;
1304        /// let x = SourceObject::new().set_object_preconditions(ObjectPreconditions::default()/* use setters */);
1305        /// ```
1306        pub fn set_object_preconditions<T>(mut self, v: T) -> Self
1307        where
1308            T: std::convert::Into<
1309                    crate::model::compose_object_request::source_object::ObjectPreconditions,
1310                >,
1311        {
1312            self.object_preconditions = std::option::Option::Some(v.into());
1313            self
1314        }
1315
1316        /// Sets or clears the value of [object_preconditions][crate::model::compose_object_request::SourceObject::object_preconditions].
1317        ///
1318        /// # Example
1319        /// ```ignore,no_run
1320        /// # use google_cloud_storage::model::compose_object_request::SourceObject;
1321        /// use google_cloud_storage::model::compose_object_request::source_object::ObjectPreconditions;
1322        /// let x = SourceObject::new().set_or_clear_object_preconditions(Some(ObjectPreconditions::default()/* use setters */));
1323        /// let x = SourceObject::new().set_or_clear_object_preconditions(None::<ObjectPreconditions>);
1324        /// ```
1325        pub fn set_or_clear_object_preconditions<T>(mut self, v: std::option::Option<T>) -> Self
1326        where
1327            T: std::convert::Into<
1328                    crate::model::compose_object_request::source_object::ObjectPreconditions,
1329                >,
1330        {
1331            self.object_preconditions = v.map(|x| x.into());
1332            self
1333        }
1334    }
1335
1336    impl wkt::message::Message for SourceObject {
1337        fn typename() -> &'static str {
1338            "type.googleapis.com/google.storage.v2.ComposeObjectRequest.SourceObject"
1339        }
1340    }
1341
1342    /// Defines additional types related to [SourceObject].
1343    pub mod source_object {
1344        #[allow(unused_imports)]
1345        use super::*;
1346
1347        /// Preconditions for a source object of a composition request.
1348        #[derive(Clone, Default, PartialEq)]
1349        #[non_exhaustive]
1350        pub struct ObjectPreconditions {
1351            /// Only perform the composition if the generation of the source object
1352            /// that would be used matches this value.  If this value and a generation
1353            /// are both specified, they must be the same value or the call fails.
1354            pub if_generation_match: std::option::Option<i64>,
1355
1356            pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1357        }
1358
1359        impl ObjectPreconditions {
1360            /// Creates a new default instance.
1361            pub fn new() -> Self {
1362                std::default::Default::default()
1363            }
1364
1365            /// Sets the value of [if_generation_match][crate::model::compose_object_request::source_object::ObjectPreconditions::if_generation_match].
1366            ///
1367            /// # Example
1368            /// ```ignore,no_run
1369            /// # use google_cloud_storage::model::compose_object_request::source_object::ObjectPreconditions;
1370            /// let x = ObjectPreconditions::new().set_if_generation_match(42);
1371            /// ```
1372            pub fn set_if_generation_match<T>(mut self, v: T) -> Self
1373            where
1374                T: std::convert::Into<i64>,
1375            {
1376                self.if_generation_match = std::option::Option::Some(v.into());
1377                self
1378            }
1379
1380            /// Sets or clears the value of [if_generation_match][crate::model::compose_object_request::source_object::ObjectPreconditions::if_generation_match].
1381            ///
1382            /// # Example
1383            /// ```ignore,no_run
1384            /// # use google_cloud_storage::model::compose_object_request::source_object::ObjectPreconditions;
1385            /// let x = ObjectPreconditions::new().set_or_clear_if_generation_match(Some(42));
1386            /// let x = ObjectPreconditions::new().set_or_clear_if_generation_match(None::<i32>);
1387            /// ```
1388            pub fn set_or_clear_if_generation_match<T>(mut self, v: std::option::Option<T>) -> Self
1389            where
1390                T: std::convert::Into<i64>,
1391            {
1392                self.if_generation_match = v.map(|x| x.into());
1393                self
1394            }
1395        }
1396
1397        impl wkt::message::Message for ObjectPreconditions {
1398            fn typename() -> &'static str {
1399                "type.googleapis.com/google.storage.v2.ComposeObjectRequest.SourceObject.ObjectPreconditions"
1400            }
1401        }
1402    }
1403}
1404
1405/// Request message for deleting an object.
1406#[derive(Clone, Default, PartialEq)]
1407#[non_exhaustive]
1408pub struct DeleteObjectRequest {
1409    /// Required. Name of the bucket in which the object resides.
1410    pub bucket: std::string::String,
1411
1412    /// Required. The name of the finalized object to delete.
1413    /// Note: If you want to delete an unfinalized resumable upload please use
1414    /// `CancelResumableWrite`.
1415    pub object: std::string::String,
1416
1417    /// Optional. If present, permanently deletes a specific revision of this
1418    /// object (as opposed to the latest version, the default).
1419    pub generation: i64,
1420
1421    /// Makes the operation conditional on whether the object's current generation
1422    /// matches the given value. Setting to 0 makes the operation succeed only if
1423    /// there are no live versions of the object.
1424    pub if_generation_match: std::option::Option<i64>,
1425
1426    /// Makes the operation conditional on whether the object's live generation
1427    /// does not match the given value. If no live object exists, the precondition
1428    /// fails. Setting to 0 makes the operation succeed only if there is a live
1429    /// version of the object.
1430    pub if_generation_not_match: std::option::Option<i64>,
1431
1432    /// Makes the operation conditional on whether the object's current
1433    /// metageneration matches the given value.
1434    pub if_metageneration_match: std::option::Option<i64>,
1435
1436    /// Makes the operation conditional on whether the object's current
1437    /// metageneration does not match the given value.
1438    pub if_metageneration_not_match: std::option::Option<i64>,
1439
1440    /// Optional. A set of parameters common to Storage API requests concerning an
1441    /// object.
1442    pub common_object_request_params: std::option::Option<crate::model::CommonObjectRequestParams>,
1443
1444    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1445}
1446
1447impl DeleteObjectRequest {
1448    /// Creates a new default instance.
1449    pub fn new() -> Self {
1450        std::default::Default::default()
1451    }
1452
1453    /// Sets the value of [bucket][crate::model::DeleteObjectRequest::bucket].
1454    ///
1455    /// # Example
1456    /// ```ignore,no_run
1457    /// # use google_cloud_storage::model::DeleteObjectRequest;
1458    /// # let project_id = "project_id";
1459    /// # let bucket_id = "bucket_id";
1460    /// let x = DeleteObjectRequest::new().set_bucket(format!("projects/{project_id}/buckets/{bucket_id}"));
1461    /// ```
1462    pub fn set_bucket<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1463        self.bucket = v.into();
1464        self
1465    }
1466
1467    /// Sets the value of [object][crate::model::DeleteObjectRequest::object].
1468    ///
1469    /// # Example
1470    /// ```ignore,no_run
1471    /// # use google_cloud_storage::model::DeleteObjectRequest;
1472    /// let x = DeleteObjectRequest::new().set_object("example");
1473    /// ```
1474    pub fn set_object<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1475        self.object = v.into();
1476        self
1477    }
1478
1479    /// Sets the value of [generation][crate::model::DeleteObjectRequest::generation].
1480    ///
1481    /// # Example
1482    /// ```ignore,no_run
1483    /// # use google_cloud_storage::model::DeleteObjectRequest;
1484    /// let x = DeleteObjectRequest::new().set_generation(42);
1485    /// ```
1486    pub fn set_generation<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
1487        self.generation = v.into();
1488        self
1489    }
1490
1491    /// Sets the value of [if_generation_match][crate::model::DeleteObjectRequest::if_generation_match].
1492    ///
1493    /// # Example
1494    /// ```ignore,no_run
1495    /// # use google_cloud_storage::model::DeleteObjectRequest;
1496    /// let x = DeleteObjectRequest::new().set_if_generation_match(42);
1497    /// ```
1498    pub fn set_if_generation_match<T>(mut self, v: T) -> Self
1499    where
1500        T: std::convert::Into<i64>,
1501    {
1502        self.if_generation_match = std::option::Option::Some(v.into());
1503        self
1504    }
1505
1506    /// Sets or clears the value of [if_generation_match][crate::model::DeleteObjectRequest::if_generation_match].
1507    ///
1508    /// # Example
1509    /// ```ignore,no_run
1510    /// # use google_cloud_storage::model::DeleteObjectRequest;
1511    /// let x = DeleteObjectRequest::new().set_or_clear_if_generation_match(Some(42));
1512    /// let x = DeleteObjectRequest::new().set_or_clear_if_generation_match(None::<i32>);
1513    /// ```
1514    pub fn set_or_clear_if_generation_match<T>(mut self, v: std::option::Option<T>) -> Self
1515    where
1516        T: std::convert::Into<i64>,
1517    {
1518        self.if_generation_match = v.map(|x| x.into());
1519        self
1520    }
1521
1522    /// Sets the value of [if_generation_not_match][crate::model::DeleteObjectRequest::if_generation_not_match].
1523    ///
1524    /// # Example
1525    /// ```ignore,no_run
1526    /// # use google_cloud_storage::model::DeleteObjectRequest;
1527    /// let x = DeleteObjectRequest::new().set_if_generation_not_match(42);
1528    /// ```
1529    pub fn set_if_generation_not_match<T>(mut self, v: T) -> Self
1530    where
1531        T: std::convert::Into<i64>,
1532    {
1533        self.if_generation_not_match = std::option::Option::Some(v.into());
1534        self
1535    }
1536
1537    /// Sets or clears the value of [if_generation_not_match][crate::model::DeleteObjectRequest::if_generation_not_match].
1538    ///
1539    /// # Example
1540    /// ```ignore,no_run
1541    /// # use google_cloud_storage::model::DeleteObjectRequest;
1542    /// let x = DeleteObjectRequest::new().set_or_clear_if_generation_not_match(Some(42));
1543    /// let x = DeleteObjectRequest::new().set_or_clear_if_generation_not_match(None::<i32>);
1544    /// ```
1545    pub fn set_or_clear_if_generation_not_match<T>(mut self, v: std::option::Option<T>) -> Self
1546    where
1547        T: std::convert::Into<i64>,
1548    {
1549        self.if_generation_not_match = v.map(|x| x.into());
1550        self
1551    }
1552
1553    /// Sets the value of [if_metageneration_match][crate::model::DeleteObjectRequest::if_metageneration_match].
1554    ///
1555    /// # Example
1556    /// ```ignore,no_run
1557    /// # use google_cloud_storage::model::DeleteObjectRequest;
1558    /// let x = DeleteObjectRequest::new().set_if_metageneration_match(42);
1559    /// ```
1560    pub fn set_if_metageneration_match<T>(mut self, v: T) -> Self
1561    where
1562        T: std::convert::Into<i64>,
1563    {
1564        self.if_metageneration_match = std::option::Option::Some(v.into());
1565        self
1566    }
1567
1568    /// Sets or clears the value of [if_metageneration_match][crate::model::DeleteObjectRequest::if_metageneration_match].
1569    ///
1570    /// # Example
1571    /// ```ignore,no_run
1572    /// # use google_cloud_storage::model::DeleteObjectRequest;
1573    /// let x = DeleteObjectRequest::new().set_or_clear_if_metageneration_match(Some(42));
1574    /// let x = DeleteObjectRequest::new().set_or_clear_if_metageneration_match(None::<i32>);
1575    /// ```
1576    pub fn set_or_clear_if_metageneration_match<T>(mut self, v: std::option::Option<T>) -> Self
1577    where
1578        T: std::convert::Into<i64>,
1579    {
1580        self.if_metageneration_match = v.map(|x| x.into());
1581        self
1582    }
1583
1584    /// Sets the value of [if_metageneration_not_match][crate::model::DeleteObjectRequest::if_metageneration_not_match].
1585    ///
1586    /// # Example
1587    /// ```ignore,no_run
1588    /// # use google_cloud_storage::model::DeleteObjectRequest;
1589    /// let x = DeleteObjectRequest::new().set_if_metageneration_not_match(42);
1590    /// ```
1591    pub fn set_if_metageneration_not_match<T>(mut self, v: T) -> Self
1592    where
1593        T: std::convert::Into<i64>,
1594    {
1595        self.if_metageneration_not_match = std::option::Option::Some(v.into());
1596        self
1597    }
1598
1599    /// Sets or clears the value of [if_metageneration_not_match][crate::model::DeleteObjectRequest::if_metageneration_not_match].
1600    ///
1601    /// # Example
1602    /// ```ignore,no_run
1603    /// # use google_cloud_storage::model::DeleteObjectRequest;
1604    /// let x = DeleteObjectRequest::new().set_or_clear_if_metageneration_not_match(Some(42));
1605    /// let x = DeleteObjectRequest::new().set_or_clear_if_metageneration_not_match(None::<i32>);
1606    /// ```
1607    pub fn set_or_clear_if_metageneration_not_match<T>(mut self, v: std::option::Option<T>) -> Self
1608    where
1609        T: std::convert::Into<i64>,
1610    {
1611        self.if_metageneration_not_match = v.map(|x| x.into());
1612        self
1613    }
1614
1615    /// Sets the value of [common_object_request_params][crate::model::DeleteObjectRequest::common_object_request_params].
1616    ///
1617    /// # Example
1618    /// ```ignore,no_run
1619    /// # use google_cloud_storage::model::DeleteObjectRequest;
1620    /// use google_cloud_storage::model::CommonObjectRequestParams;
1621    /// let x = DeleteObjectRequest::new().set_common_object_request_params(CommonObjectRequestParams::default()/* use setters */);
1622    /// ```
1623    pub fn set_common_object_request_params<T>(mut self, v: T) -> Self
1624    where
1625        T: std::convert::Into<crate::model::CommonObjectRequestParams>,
1626    {
1627        self.common_object_request_params = std::option::Option::Some(v.into());
1628        self
1629    }
1630
1631    /// Sets or clears the value of [common_object_request_params][crate::model::DeleteObjectRequest::common_object_request_params].
1632    ///
1633    /// # Example
1634    /// ```ignore,no_run
1635    /// # use google_cloud_storage::model::DeleteObjectRequest;
1636    /// use google_cloud_storage::model::CommonObjectRequestParams;
1637    /// let x = DeleteObjectRequest::new().set_or_clear_common_object_request_params(Some(CommonObjectRequestParams::default()/* use setters */));
1638    /// let x = DeleteObjectRequest::new().set_or_clear_common_object_request_params(None::<CommonObjectRequestParams>);
1639    /// ```
1640    pub fn set_or_clear_common_object_request_params<T>(mut self, v: std::option::Option<T>) -> Self
1641    where
1642        T: std::convert::Into<crate::model::CommonObjectRequestParams>,
1643    {
1644        self.common_object_request_params = v.map(|x| x.into());
1645        self
1646    }
1647}
1648
1649impl wkt::message::Message for DeleteObjectRequest {
1650    fn typename() -> &'static str {
1651        "type.googleapis.com/google.storage.v2.DeleteObjectRequest"
1652    }
1653}
1654
1655/// Request message for
1656/// [RestoreObject][google.storage.v2.Storage.RestoreObject].
1657/// `bucket`, `object`, and `generation` **must** be set.
1658///
1659/// [google.storage.v2.Storage.RestoreObject]: crate::client::StorageControl::restore_object
1660#[derive(Clone, Default, PartialEq)]
1661#[non_exhaustive]
1662pub struct RestoreObjectRequest {
1663    /// Required. Name of the bucket in which the object resides.
1664    pub bucket: std::string::String,
1665
1666    /// Required. The name of the object to restore.
1667    pub object: std::string::String,
1668
1669    /// Required. The specific revision of the object to restore.
1670    pub generation: i64,
1671
1672    /// Optional. Restore token used to differentiate soft-deleted objects with the
1673    /// same name and generation. Only applicable for hierarchical namespace
1674    /// buckets. This parameter is optional, and is only required in the rare case
1675    /// when there are multiple soft-deleted objects with the same name and
1676    /// generation.
1677    pub restore_token: std::string::String,
1678
1679    /// Makes the operation conditional on whether the object's current generation
1680    /// matches the given value. Setting to 0 makes the operation succeed only if
1681    /// there are no live versions of the object.
1682    pub if_generation_match: std::option::Option<i64>,
1683
1684    /// Makes the operation conditional on whether the object's live generation
1685    /// does not match the given value. If no live object exists, the precondition
1686    /// fails. Setting to 0 makes the operation succeed only if there is a live
1687    /// version of the object.
1688    pub if_generation_not_match: std::option::Option<i64>,
1689
1690    /// Makes the operation conditional on whether the object's current
1691    /// metageneration matches the given value.
1692    pub if_metageneration_match: std::option::Option<i64>,
1693
1694    /// Makes the operation conditional on whether the object's current
1695    /// metageneration does not match the given value.
1696    pub if_metageneration_not_match: std::option::Option<i64>,
1697
1698    /// If false or unset, the bucket's default object ACL is used.
1699    /// If true, copy the source object's access controls.
1700    /// Return an error if bucket has UBLA enabled.
1701    pub copy_source_acl: std::option::Option<bool>,
1702
1703    /// Optional. A set of parameters common to Storage API requests concerning an
1704    /// object.
1705    pub common_object_request_params: std::option::Option<crate::model::CommonObjectRequestParams>,
1706
1707    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1708}
1709
1710impl RestoreObjectRequest {
1711    /// Creates a new default instance.
1712    pub fn new() -> Self {
1713        std::default::Default::default()
1714    }
1715
1716    /// Sets the value of [bucket][crate::model::RestoreObjectRequest::bucket].
1717    ///
1718    /// # Example
1719    /// ```ignore,no_run
1720    /// # use google_cloud_storage::model::RestoreObjectRequest;
1721    /// # let project_id = "project_id";
1722    /// # let bucket_id = "bucket_id";
1723    /// let x = RestoreObjectRequest::new().set_bucket(format!("projects/{project_id}/buckets/{bucket_id}"));
1724    /// ```
1725    pub fn set_bucket<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1726        self.bucket = v.into();
1727        self
1728    }
1729
1730    /// Sets the value of [object][crate::model::RestoreObjectRequest::object].
1731    ///
1732    /// # Example
1733    /// ```ignore,no_run
1734    /// # use google_cloud_storage::model::RestoreObjectRequest;
1735    /// let x = RestoreObjectRequest::new().set_object("example");
1736    /// ```
1737    pub fn set_object<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1738        self.object = v.into();
1739        self
1740    }
1741
1742    /// Sets the value of [generation][crate::model::RestoreObjectRequest::generation].
1743    ///
1744    /// # Example
1745    /// ```ignore,no_run
1746    /// # use google_cloud_storage::model::RestoreObjectRequest;
1747    /// let x = RestoreObjectRequest::new().set_generation(42);
1748    /// ```
1749    pub fn set_generation<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
1750        self.generation = v.into();
1751        self
1752    }
1753
1754    /// Sets the value of [restore_token][crate::model::RestoreObjectRequest::restore_token].
1755    ///
1756    /// # Example
1757    /// ```ignore,no_run
1758    /// # use google_cloud_storage::model::RestoreObjectRequest;
1759    /// let x = RestoreObjectRequest::new().set_restore_token("example");
1760    /// ```
1761    pub fn set_restore_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1762        self.restore_token = v.into();
1763        self
1764    }
1765
1766    /// Sets the value of [if_generation_match][crate::model::RestoreObjectRequest::if_generation_match].
1767    ///
1768    /// # Example
1769    /// ```ignore,no_run
1770    /// # use google_cloud_storage::model::RestoreObjectRequest;
1771    /// let x = RestoreObjectRequest::new().set_if_generation_match(42);
1772    /// ```
1773    pub fn set_if_generation_match<T>(mut self, v: T) -> Self
1774    where
1775        T: std::convert::Into<i64>,
1776    {
1777        self.if_generation_match = std::option::Option::Some(v.into());
1778        self
1779    }
1780
1781    /// Sets or clears the value of [if_generation_match][crate::model::RestoreObjectRequest::if_generation_match].
1782    ///
1783    /// # Example
1784    /// ```ignore,no_run
1785    /// # use google_cloud_storage::model::RestoreObjectRequest;
1786    /// let x = RestoreObjectRequest::new().set_or_clear_if_generation_match(Some(42));
1787    /// let x = RestoreObjectRequest::new().set_or_clear_if_generation_match(None::<i32>);
1788    /// ```
1789    pub fn set_or_clear_if_generation_match<T>(mut self, v: std::option::Option<T>) -> Self
1790    where
1791        T: std::convert::Into<i64>,
1792    {
1793        self.if_generation_match = v.map(|x| x.into());
1794        self
1795    }
1796
1797    /// Sets the value of [if_generation_not_match][crate::model::RestoreObjectRequest::if_generation_not_match].
1798    ///
1799    /// # Example
1800    /// ```ignore,no_run
1801    /// # use google_cloud_storage::model::RestoreObjectRequest;
1802    /// let x = RestoreObjectRequest::new().set_if_generation_not_match(42);
1803    /// ```
1804    pub fn set_if_generation_not_match<T>(mut self, v: T) -> Self
1805    where
1806        T: std::convert::Into<i64>,
1807    {
1808        self.if_generation_not_match = std::option::Option::Some(v.into());
1809        self
1810    }
1811
1812    /// Sets or clears the value of [if_generation_not_match][crate::model::RestoreObjectRequest::if_generation_not_match].
1813    ///
1814    /// # Example
1815    /// ```ignore,no_run
1816    /// # use google_cloud_storage::model::RestoreObjectRequest;
1817    /// let x = RestoreObjectRequest::new().set_or_clear_if_generation_not_match(Some(42));
1818    /// let x = RestoreObjectRequest::new().set_or_clear_if_generation_not_match(None::<i32>);
1819    /// ```
1820    pub fn set_or_clear_if_generation_not_match<T>(mut self, v: std::option::Option<T>) -> Self
1821    where
1822        T: std::convert::Into<i64>,
1823    {
1824        self.if_generation_not_match = v.map(|x| x.into());
1825        self
1826    }
1827
1828    /// Sets the value of [if_metageneration_match][crate::model::RestoreObjectRequest::if_metageneration_match].
1829    ///
1830    /// # Example
1831    /// ```ignore,no_run
1832    /// # use google_cloud_storage::model::RestoreObjectRequest;
1833    /// let x = RestoreObjectRequest::new().set_if_metageneration_match(42);
1834    /// ```
1835    pub fn set_if_metageneration_match<T>(mut self, v: T) -> Self
1836    where
1837        T: std::convert::Into<i64>,
1838    {
1839        self.if_metageneration_match = std::option::Option::Some(v.into());
1840        self
1841    }
1842
1843    /// Sets or clears the value of [if_metageneration_match][crate::model::RestoreObjectRequest::if_metageneration_match].
1844    ///
1845    /// # Example
1846    /// ```ignore,no_run
1847    /// # use google_cloud_storage::model::RestoreObjectRequest;
1848    /// let x = RestoreObjectRequest::new().set_or_clear_if_metageneration_match(Some(42));
1849    /// let x = RestoreObjectRequest::new().set_or_clear_if_metageneration_match(None::<i32>);
1850    /// ```
1851    pub fn set_or_clear_if_metageneration_match<T>(mut self, v: std::option::Option<T>) -> Self
1852    where
1853        T: std::convert::Into<i64>,
1854    {
1855        self.if_metageneration_match = v.map(|x| x.into());
1856        self
1857    }
1858
1859    /// Sets the value of [if_metageneration_not_match][crate::model::RestoreObjectRequest::if_metageneration_not_match].
1860    ///
1861    /// # Example
1862    /// ```ignore,no_run
1863    /// # use google_cloud_storage::model::RestoreObjectRequest;
1864    /// let x = RestoreObjectRequest::new().set_if_metageneration_not_match(42);
1865    /// ```
1866    pub fn set_if_metageneration_not_match<T>(mut self, v: T) -> Self
1867    where
1868        T: std::convert::Into<i64>,
1869    {
1870        self.if_metageneration_not_match = std::option::Option::Some(v.into());
1871        self
1872    }
1873
1874    /// Sets or clears the value of [if_metageneration_not_match][crate::model::RestoreObjectRequest::if_metageneration_not_match].
1875    ///
1876    /// # Example
1877    /// ```ignore,no_run
1878    /// # use google_cloud_storage::model::RestoreObjectRequest;
1879    /// let x = RestoreObjectRequest::new().set_or_clear_if_metageneration_not_match(Some(42));
1880    /// let x = RestoreObjectRequest::new().set_or_clear_if_metageneration_not_match(None::<i32>);
1881    /// ```
1882    pub fn set_or_clear_if_metageneration_not_match<T>(mut self, v: std::option::Option<T>) -> Self
1883    where
1884        T: std::convert::Into<i64>,
1885    {
1886        self.if_metageneration_not_match = v.map(|x| x.into());
1887        self
1888    }
1889
1890    /// Sets the value of [copy_source_acl][crate::model::RestoreObjectRequest::copy_source_acl].
1891    ///
1892    /// # Example
1893    /// ```ignore,no_run
1894    /// # use google_cloud_storage::model::RestoreObjectRequest;
1895    /// let x = RestoreObjectRequest::new().set_copy_source_acl(true);
1896    /// ```
1897    pub fn set_copy_source_acl<T>(mut self, v: T) -> Self
1898    where
1899        T: std::convert::Into<bool>,
1900    {
1901        self.copy_source_acl = std::option::Option::Some(v.into());
1902        self
1903    }
1904
1905    /// Sets or clears the value of [copy_source_acl][crate::model::RestoreObjectRequest::copy_source_acl].
1906    ///
1907    /// # Example
1908    /// ```ignore,no_run
1909    /// # use google_cloud_storage::model::RestoreObjectRequest;
1910    /// let x = RestoreObjectRequest::new().set_or_clear_copy_source_acl(Some(false));
1911    /// let x = RestoreObjectRequest::new().set_or_clear_copy_source_acl(None::<bool>);
1912    /// ```
1913    pub fn set_or_clear_copy_source_acl<T>(mut self, v: std::option::Option<T>) -> Self
1914    where
1915        T: std::convert::Into<bool>,
1916    {
1917        self.copy_source_acl = v.map(|x| x.into());
1918        self
1919    }
1920
1921    /// Sets the value of [common_object_request_params][crate::model::RestoreObjectRequest::common_object_request_params].
1922    ///
1923    /// # Example
1924    /// ```ignore,no_run
1925    /// # use google_cloud_storage::model::RestoreObjectRequest;
1926    /// use google_cloud_storage::model::CommonObjectRequestParams;
1927    /// let x = RestoreObjectRequest::new().set_common_object_request_params(CommonObjectRequestParams::default()/* use setters */);
1928    /// ```
1929    pub fn set_common_object_request_params<T>(mut self, v: T) -> Self
1930    where
1931        T: std::convert::Into<crate::model::CommonObjectRequestParams>,
1932    {
1933        self.common_object_request_params = std::option::Option::Some(v.into());
1934        self
1935    }
1936
1937    /// Sets or clears the value of [common_object_request_params][crate::model::RestoreObjectRequest::common_object_request_params].
1938    ///
1939    /// # Example
1940    /// ```ignore,no_run
1941    /// # use google_cloud_storage::model::RestoreObjectRequest;
1942    /// use google_cloud_storage::model::CommonObjectRequestParams;
1943    /// let x = RestoreObjectRequest::new().set_or_clear_common_object_request_params(Some(CommonObjectRequestParams::default()/* use setters */));
1944    /// let x = RestoreObjectRequest::new().set_or_clear_common_object_request_params(None::<CommonObjectRequestParams>);
1945    /// ```
1946    pub fn set_or_clear_common_object_request_params<T>(mut self, v: std::option::Option<T>) -> Self
1947    where
1948        T: std::convert::Into<crate::model::CommonObjectRequestParams>,
1949    {
1950        self.common_object_request_params = v.map(|x| x.into());
1951        self
1952    }
1953}
1954
1955impl wkt::message::Message for RestoreObjectRequest {
1956    fn typename() -> &'static str {
1957        "type.googleapis.com/google.storage.v2.RestoreObjectRequest"
1958    }
1959}
1960
1961/// Request message for [ReadObject][google.storage.v2.Storage.ReadObject].
1962#[derive(Clone, Default, PartialEq)]
1963#[non_exhaustive]
1964pub struct ReadObjectRequest {
1965    /// Required. The name of the bucket containing the object to read.
1966    pub bucket: std::string::String,
1967
1968    /// Required. The name of the object to read.
1969    pub object: std::string::String,
1970
1971    /// Optional. If present, selects a specific revision of this object (as
1972    /// opposed to the latest version, the default).
1973    pub generation: i64,
1974
1975    /// Optional. The offset for the first byte to return in the read, relative to
1976    /// the start of the object.
1977    ///
1978    /// A negative `read_offset` value is interpreted as the number of bytes
1979    /// back from the end of the object to be returned. For example, if an object's
1980    /// length is `15` bytes, a `ReadObjectRequest` with `read_offset` = `-5` and
1981    /// `read_limit` = `3` would return bytes `10` through `12` of the object.
1982    /// Requesting a negative offset with magnitude larger than the size of the
1983    /// object returns the entire object.
1984    pub read_offset: i64,
1985
1986    /// Optional. The maximum number of `data` bytes the server is allowed to
1987    /// return in the sum of all `Object` messages. A `read_limit` of zero
1988    /// indicates that there is no limit, and a negative `read_limit` causes an
1989    /// error.
1990    ///
1991    /// If the stream returns fewer bytes than allowed by the `read_limit` and no
1992    /// error occurred, the stream includes all data from the `read_offset` to the
1993    /// end of the resource.
1994    pub read_limit: i64,
1995
1996    /// Makes the operation conditional on whether the object's current generation
1997    /// matches the given value. Setting to 0 makes the operation succeed only if
1998    /// there are no live versions of the object.
1999    pub if_generation_match: std::option::Option<i64>,
2000
2001    /// Makes the operation conditional on whether the object's live generation
2002    /// does not match the given value. If no live object exists, the precondition
2003    /// fails. Setting to 0 makes the operation succeed only if there is a live
2004    /// version of the object.
2005    pub if_generation_not_match: std::option::Option<i64>,
2006
2007    /// Makes the operation conditional on whether the object's current
2008    /// metageneration matches the given value.
2009    pub if_metageneration_match: std::option::Option<i64>,
2010
2011    /// Makes the operation conditional on whether the object's current
2012    /// metageneration does not match the given value.
2013    pub if_metageneration_not_match: std::option::Option<i64>,
2014
2015    /// Optional. A set of parameters common to Storage API requests concerning an
2016    /// object.
2017    pub common_object_request_params: std::option::Option<crate::model::CommonObjectRequestParams>,
2018
2019    /// Mask specifying which fields to read.
2020    /// The `checksummed_data` field and its children are always present.
2021    /// If no mask is specified, it defaults to all fields except `metadata.
2022    /// owner` and `metadata.acl`.
2023    /// `*` might be used to mean "all fields".
2024    pub read_mask: std::option::Option<wkt::FieldMask>,
2025
2026    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2027}
2028
2029impl ReadObjectRequest {
2030    /// Creates a new default instance.
2031    pub fn new() -> Self {
2032        std::default::Default::default()
2033    }
2034
2035    /// Sets the value of [bucket][crate::model::ReadObjectRequest::bucket].
2036    ///
2037    /// # Example
2038    /// ```ignore,no_run
2039    /// # use google_cloud_storage::model::ReadObjectRequest;
2040    /// # let project_id = "project_id";
2041    /// # let bucket_id = "bucket_id";
2042    /// let x = ReadObjectRequest::new().set_bucket(format!("projects/{project_id}/buckets/{bucket_id}"));
2043    /// ```
2044    pub fn set_bucket<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2045        self.bucket = v.into();
2046        self
2047    }
2048
2049    /// Sets the value of [object][crate::model::ReadObjectRequest::object].
2050    ///
2051    /// # Example
2052    /// ```ignore,no_run
2053    /// # use google_cloud_storage::model::ReadObjectRequest;
2054    /// let x = ReadObjectRequest::new().set_object("example");
2055    /// ```
2056    pub fn set_object<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2057        self.object = v.into();
2058        self
2059    }
2060
2061    /// Sets the value of [generation][crate::model::ReadObjectRequest::generation].
2062    ///
2063    /// # Example
2064    /// ```ignore,no_run
2065    /// # use google_cloud_storage::model::ReadObjectRequest;
2066    /// let x = ReadObjectRequest::new().set_generation(42);
2067    /// ```
2068    pub fn set_generation<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
2069        self.generation = v.into();
2070        self
2071    }
2072
2073    /// Sets the value of [read_offset][crate::model::ReadObjectRequest::read_offset].
2074    ///
2075    /// # Example
2076    /// ```ignore,no_run
2077    /// # use google_cloud_storage::model::ReadObjectRequest;
2078    /// let x = ReadObjectRequest::new().set_read_offset(42);
2079    /// ```
2080    pub fn set_read_offset<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
2081        self.read_offset = v.into();
2082        self
2083    }
2084
2085    /// Sets the value of [read_limit][crate::model::ReadObjectRequest::read_limit].
2086    ///
2087    /// # Example
2088    /// ```ignore,no_run
2089    /// # use google_cloud_storage::model::ReadObjectRequest;
2090    /// let x = ReadObjectRequest::new().set_read_limit(42);
2091    /// ```
2092    pub fn set_read_limit<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
2093        self.read_limit = v.into();
2094        self
2095    }
2096
2097    /// Sets the value of [if_generation_match][crate::model::ReadObjectRequest::if_generation_match].
2098    ///
2099    /// # Example
2100    /// ```ignore,no_run
2101    /// # use google_cloud_storage::model::ReadObjectRequest;
2102    /// let x = ReadObjectRequest::new().set_if_generation_match(42);
2103    /// ```
2104    pub fn set_if_generation_match<T>(mut self, v: T) -> Self
2105    where
2106        T: std::convert::Into<i64>,
2107    {
2108        self.if_generation_match = std::option::Option::Some(v.into());
2109        self
2110    }
2111
2112    /// Sets or clears the value of [if_generation_match][crate::model::ReadObjectRequest::if_generation_match].
2113    ///
2114    /// # Example
2115    /// ```ignore,no_run
2116    /// # use google_cloud_storage::model::ReadObjectRequest;
2117    /// let x = ReadObjectRequest::new().set_or_clear_if_generation_match(Some(42));
2118    /// let x = ReadObjectRequest::new().set_or_clear_if_generation_match(None::<i32>);
2119    /// ```
2120    pub fn set_or_clear_if_generation_match<T>(mut self, v: std::option::Option<T>) -> Self
2121    where
2122        T: std::convert::Into<i64>,
2123    {
2124        self.if_generation_match = v.map(|x| x.into());
2125        self
2126    }
2127
2128    /// Sets the value of [if_generation_not_match][crate::model::ReadObjectRequest::if_generation_not_match].
2129    ///
2130    /// # Example
2131    /// ```ignore,no_run
2132    /// # use google_cloud_storage::model::ReadObjectRequest;
2133    /// let x = ReadObjectRequest::new().set_if_generation_not_match(42);
2134    /// ```
2135    pub fn set_if_generation_not_match<T>(mut self, v: T) -> Self
2136    where
2137        T: std::convert::Into<i64>,
2138    {
2139        self.if_generation_not_match = std::option::Option::Some(v.into());
2140        self
2141    }
2142
2143    /// Sets or clears the value of [if_generation_not_match][crate::model::ReadObjectRequest::if_generation_not_match].
2144    ///
2145    /// # Example
2146    /// ```ignore,no_run
2147    /// # use google_cloud_storage::model::ReadObjectRequest;
2148    /// let x = ReadObjectRequest::new().set_or_clear_if_generation_not_match(Some(42));
2149    /// let x = ReadObjectRequest::new().set_or_clear_if_generation_not_match(None::<i32>);
2150    /// ```
2151    pub fn set_or_clear_if_generation_not_match<T>(mut self, v: std::option::Option<T>) -> Self
2152    where
2153        T: std::convert::Into<i64>,
2154    {
2155        self.if_generation_not_match = v.map(|x| x.into());
2156        self
2157    }
2158
2159    /// Sets the value of [if_metageneration_match][crate::model::ReadObjectRequest::if_metageneration_match].
2160    ///
2161    /// # Example
2162    /// ```ignore,no_run
2163    /// # use google_cloud_storage::model::ReadObjectRequest;
2164    /// let x = ReadObjectRequest::new().set_if_metageneration_match(42);
2165    /// ```
2166    pub fn set_if_metageneration_match<T>(mut self, v: T) -> Self
2167    where
2168        T: std::convert::Into<i64>,
2169    {
2170        self.if_metageneration_match = std::option::Option::Some(v.into());
2171        self
2172    }
2173
2174    /// Sets or clears the value of [if_metageneration_match][crate::model::ReadObjectRequest::if_metageneration_match].
2175    ///
2176    /// # Example
2177    /// ```ignore,no_run
2178    /// # use google_cloud_storage::model::ReadObjectRequest;
2179    /// let x = ReadObjectRequest::new().set_or_clear_if_metageneration_match(Some(42));
2180    /// let x = ReadObjectRequest::new().set_or_clear_if_metageneration_match(None::<i32>);
2181    /// ```
2182    pub fn set_or_clear_if_metageneration_match<T>(mut self, v: std::option::Option<T>) -> Self
2183    where
2184        T: std::convert::Into<i64>,
2185    {
2186        self.if_metageneration_match = v.map(|x| x.into());
2187        self
2188    }
2189
2190    /// Sets the value of [if_metageneration_not_match][crate::model::ReadObjectRequest::if_metageneration_not_match].
2191    ///
2192    /// # Example
2193    /// ```ignore,no_run
2194    /// # use google_cloud_storage::model::ReadObjectRequest;
2195    /// let x = ReadObjectRequest::new().set_if_metageneration_not_match(42);
2196    /// ```
2197    pub fn set_if_metageneration_not_match<T>(mut self, v: T) -> Self
2198    where
2199        T: std::convert::Into<i64>,
2200    {
2201        self.if_metageneration_not_match = std::option::Option::Some(v.into());
2202        self
2203    }
2204
2205    /// Sets or clears the value of [if_metageneration_not_match][crate::model::ReadObjectRequest::if_metageneration_not_match].
2206    ///
2207    /// # Example
2208    /// ```ignore,no_run
2209    /// # use google_cloud_storage::model::ReadObjectRequest;
2210    /// let x = ReadObjectRequest::new().set_or_clear_if_metageneration_not_match(Some(42));
2211    /// let x = ReadObjectRequest::new().set_or_clear_if_metageneration_not_match(None::<i32>);
2212    /// ```
2213    pub fn set_or_clear_if_metageneration_not_match<T>(mut self, v: std::option::Option<T>) -> Self
2214    where
2215        T: std::convert::Into<i64>,
2216    {
2217        self.if_metageneration_not_match = v.map(|x| x.into());
2218        self
2219    }
2220
2221    /// Sets the value of [common_object_request_params][crate::model::ReadObjectRequest::common_object_request_params].
2222    ///
2223    /// # Example
2224    /// ```ignore,no_run
2225    /// # use google_cloud_storage::model::ReadObjectRequest;
2226    /// use google_cloud_storage::model::CommonObjectRequestParams;
2227    /// let x = ReadObjectRequest::new().set_common_object_request_params(CommonObjectRequestParams::default()/* use setters */);
2228    /// ```
2229    pub fn set_common_object_request_params<T>(mut self, v: T) -> Self
2230    where
2231        T: std::convert::Into<crate::model::CommonObjectRequestParams>,
2232    {
2233        self.common_object_request_params = std::option::Option::Some(v.into());
2234        self
2235    }
2236
2237    /// Sets or clears the value of [common_object_request_params][crate::model::ReadObjectRequest::common_object_request_params].
2238    ///
2239    /// # Example
2240    /// ```ignore,no_run
2241    /// # use google_cloud_storage::model::ReadObjectRequest;
2242    /// use google_cloud_storage::model::CommonObjectRequestParams;
2243    /// let x = ReadObjectRequest::new().set_or_clear_common_object_request_params(Some(CommonObjectRequestParams::default()/* use setters */));
2244    /// let x = ReadObjectRequest::new().set_or_clear_common_object_request_params(None::<CommonObjectRequestParams>);
2245    /// ```
2246    pub fn set_or_clear_common_object_request_params<T>(mut self, v: std::option::Option<T>) -> Self
2247    where
2248        T: std::convert::Into<crate::model::CommonObjectRequestParams>,
2249    {
2250        self.common_object_request_params = v.map(|x| x.into());
2251        self
2252    }
2253
2254    /// Sets the value of [read_mask][crate::model::ReadObjectRequest::read_mask].
2255    ///
2256    /// # Example
2257    /// ```ignore,no_run
2258    /// # use google_cloud_storage::model::ReadObjectRequest;
2259    /// use wkt::FieldMask;
2260    /// let x = ReadObjectRequest::new().set_read_mask(FieldMask::default()/* use setters */);
2261    /// ```
2262    pub fn set_read_mask<T>(mut self, v: T) -> Self
2263    where
2264        T: std::convert::Into<wkt::FieldMask>,
2265    {
2266        self.read_mask = std::option::Option::Some(v.into());
2267        self
2268    }
2269
2270    /// Sets or clears the value of [read_mask][crate::model::ReadObjectRequest::read_mask].
2271    ///
2272    /// # Example
2273    /// ```ignore,no_run
2274    /// # use google_cloud_storage::model::ReadObjectRequest;
2275    /// use wkt::FieldMask;
2276    /// let x = ReadObjectRequest::new().set_or_clear_read_mask(Some(FieldMask::default()/* use setters */));
2277    /// let x = ReadObjectRequest::new().set_or_clear_read_mask(None::<FieldMask>);
2278    /// ```
2279    pub fn set_or_clear_read_mask<T>(mut self, v: std::option::Option<T>) -> Self
2280    where
2281        T: std::convert::Into<wkt::FieldMask>,
2282    {
2283        self.read_mask = v.map(|x| x.into());
2284        self
2285    }
2286}
2287
2288impl wkt::message::Message for ReadObjectRequest {
2289    fn typename() -> &'static str {
2290        "type.googleapis.com/google.storage.v2.ReadObjectRequest"
2291    }
2292}
2293
2294/// Request message for [GetObject][google.storage.v2.Storage.GetObject].
2295///
2296/// [google.storage.v2.Storage.GetObject]: crate::client::StorageControl::get_object
2297#[derive(Clone, Default, PartialEq)]
2298#[non_exhaustive]
2299pub struct GetObjectRequest {
2300    /// Required. Name of the bucket in which the object resides.
2301    pub bucket: std::string::String,
2302
2303    /// Required. Name of the object.
2304    pub object: std::string::String,
2305
2306    /// Optional. If present, selects a specific revision of this object (as
2307    /// opposed to the latest version, the default).
2308    pub generation: i64,
2309
2310    /// If true, return the soft-deleted version of this object.
2311    pub soft_deleted: std::option::Option<bool>,
2312
2313    /// Makes the operation conditional on whether the object's current generation
2314    /// matches the given value. Setting to 0 makes the operation succeed only if
2315    /// there are no live versions of the object.
2316    pub if_generation_match: std::option::Option<i64>,
2317
2318    /// Makes the operation conditional on whether the object's live generation
2319    /// does not match the given value. If no live object exists, the precondition
2320    /// fails. Setting to 0 makes the operation succeed only if there is a live
2321    /// version of the object.
2322    pub if_generation_not_match: std::option::Option<i64>,
2323
2324    /// Makes the operation conditional on whether the object's current
2325    /// metageneration matches the given value.
2326    pub if_metageneration_match: std::option::Option<i64>,
2327
2328    /// Makes the operation conditional on whether the object's current
2329    /// metageneration does not match the given value.
2330    pub if_metageneration_not_match: std::option::Option<i64>,
2331
2332    /// Optional. A set of parameters common to Storage API requests concerning an
2333    /// object.
2334    pub common_object_request_params: std::option::Option<crate::model::CommonObjectRequestParams>,
2335
2336    /// Mask specifying which fields to read.
2337    /// If no mask is specified, it defaults to all fields except `metadata.
2338    /// acl` and `metadata.owner`.
2339    /// `*` might be used to mean "all fields".
2340    pub read_mask: std::option::Option<wkt::FieldMask>,
2341
2342    /// Optional. Restore token used to differentiate soft-deleted objects with the
2343    /// same name and generation. Only applicable for hierarchical namespace
2344    /// buckets and if `soft_deleted` is set to `true`. This parameter is optional,
2345    /// and is only required in the rare case when there are multiple soft-deleted
2346    /// objects with the same `name` and `generation`.
2347    pub restore_token: std::string::String,
2348
2349    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2350}
2351
2352impl GetObjectRequest {
2353    /// Creates a new default instance.
2354    pub fn new() -> Self {
2355        std::default::Default::default()
2356    }
2357
2358    /// Sets the value of [bucket][crate::model::GetObjectRequest::bucket].
2359    ///
2360    /// # Example
2361    /// ```ignore,no_run
2362    /// # use google_cloud_storage::model::GetObjectRequest;
2363    /// # let project_id = "project_id";
2364    /// # let bucket_id = "bucket_id";
2365    /// let x = GetObjectRequest::new().set_bucket(format!("projects/{project_id}/buckets/{bucket_id}"));
2366    /// ```
2367    pub fn set_bucket<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2368        self.bucket = v.into();
2369        self
2370    }
2371
2372    /// Sets the value of [object][crate::model::GetObjectRequest::object].
2373    ///
2374    /// # Example
2375    /// ```ignore,no_run
2376    /// # use google_cloud_storage::model::GetObjectRequest;
2377    /// let x = GetObjectRequest::new().set_object("example");
2378    /// ```
2379    pub fn set_object<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2380        self.object = v.into();
2381        self
2382    }
2383
2384    /// Sets the value of [generation][crate::model::GetObjectRequest::generation].
2385    ///
2386    /// # Example
2387    /// ```ignore,no_run
2388    /// # use google_cloud_storage::model::GetObjectRequest;
2389    /// let x = GetObjectRequest::new().set_generation(42);
2390    /// ```
2391    pub fn set_generation<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
2392        self.generation = v.into();
2393        self
2394    }
2395
2396    /// Sets the value of [soft_deleted][crate::model::GetObjectRequest::soft_deleted].
2397    ///
2398    /// # Example
2399    /// ```ignore,no_run
2400    /// # use google_cloud_storage::model::GetObjectRequest;
2401    /// let x = GetObjectRequest::new().set_soft_deleted(true);
2402    /// ```
2403    pub fn set_soft_deleted<T>(mut self, v: T) -> Self
2404    where
2405        T: std::convert::Into<bool>,
2406    {
2407        self.soft_deleted = std::option::Option::Some(v.into());
2408        self
2409    }
2410
2411    /// Sets or clears the value of [soft_deleted][crate::model::GetObjectRequest::soft_deleted].
2412    ///
2413    /// # Example
2414    /// ```ignore,no_run
2415    /// # use google_cloud_storage::model::GetObjectRequest;
2416    /// let x = GetObjectRequest::new().set_or_clear_soft_deleted(Some(false));
2417    /// let x = GetObjectRequest::new().set_or_clear_soft_deleted(None::<bool>);
2418    /// ```
2419    pub fn set_or_clear_soft_deleted<T>(mut self, v: std::option::Option<T>) -> Self
2420    where
2421        T: std::convert::Into<bool>,
2422    {
2423        self.soft_deleted = v.map(|x| x.into());
2424        self
2425    }
2426
2427    /// Sets the value of [if_generation_match][crate::model::GetObjectRequest::if_generation_match].
2428    ///
2429    /// # Example
2430    /// ```ignore,no_run
2431    /// # use google_cloud_storage::model::GetObjectRequest;
2432    /// let x = GetObjectRequest::new().set_if_generation_match(42);
2433    /// ```
2434    pub fn set_if_generation_match<T>(mut self, v: T) -> Self
2435    where
2436        T: std::convert::Into<i64>,
2437    {
2438        self.if_generation_match = std::option::Option::Some(v.into());
2439        self
2440    }
2441
2442    /// Sets or clears the value of [if_generation_match][crate::model::GetObjectRequest::if_generation_match].
2443    ///
2444    /// # Example
2445    /// ```ignore,no_run
2446    /// # use google_cloud_storage::model::GetObjectRequest;
2447    /// let x = GetObjectRequest::new().set_or_clear_if_generation_match(Some(42));
2448    /// let x = GetObjectRequest::new().set_or_clear_if_generation_match(None::<i32>);
2449    /// ```
2450    pub fn set_or_clear_if_generation_match<T>(mut self, v: std::option::Option<T>) -> Self
2451    where
2452        T: std::convert::Into<i64>,
2453    {
2454        self.if_generation_match = v.map(|x| x.into());
2455        self
2456    }
2457
2458    /// Sets the value of [if_generation_not_match][crate::model::GetObjectRequest::if_generation_not_match].
2459    ///
2460    /// # Example
2461    /// ```ignore,no_run
2462    /// # use google_cloud_storage::model::GetObjectRequest;
2463    /// let x = GetObjectRequest::new().set_if_generation_not_match(42);
2464    /// ```
2465    pub fn set_if_generation_not_match<T>(mut self, v: T) -> Self
2466    where
2467        T: std::convert::Into<i64>,
2468    {
2469        self.if_generation_not_match = std::option::Option::Some(v.into());
2470        self
2471    }
2472
2473    /// Sets or clears the value of [if_generation_not_match][crate::model::GetObjectRequest::if_generation_not_match].
2474    ///
2475    /// # Example
2476    /// ```ignore,no_run
2477    /// # use google_cloud_storage::model::GetObjectRequest;
2478    /// let x = GetObjectRequest::new().set_or_clear_if_generation_not_match(Some(42));
2479    /// let x = GetObjectRequest::new().set_or_clear_if_generation_not_match(None::<i32>);
2480    /// ```
2481    pub fn set_or_clear_if_generation_not_match<T>(mut self, v: std::option::Option<T>) -> Self
2482    where
2483        T: std::convert::Into<i64>,
2484    {
2485        self.if_generation_not_match = v.map(|x| x.into());
2486        self
2487    }
2488
2489    /// Sets the value of [if_metageneration_match][crate::model::GetObjectRequest::if_metageneration_match].
2490    ///
2491    /// # Example
2492    /// ```ignore,no_run
2493    /// # use google_cloud_storage::model::GetObjectRequest;
2494    /// let x = GetObjectRequest::new().set_if_metageneration_match(42);
2495    /// ```
2496    pub fn set_if_metageneration_match<T>(mut self, v: T) -> Self
2497    where
2498        T: std::convert::Into<i64>,
2499    {
2500        self.if_metageneration_match = std::option::Option::Some(v.into());
2501        self
2502    }
2503
2504    /// Sets or clears the value of [if_metageneration_match][crate::model::GetObjectRequest::if_metageneration_match].
2505    ///
2506    /// # Example
2507    /// ```ignore,no_run
2508    /// # use google_cloud_storage::model::GetObjectRequest;
2509    /// let x = GetObjectRequest::new().set_or_clear_if_metageneration_match(Some(42));
2510    /// let x = GetObjectRequest::new().set_or_clear_if_metageneration_match(None::<i32>);
2511    /// ```
2512    pub fn set_or_clear_if_metageneration_match<T>(mut self, v: std::option::Option<T>) -> Self
2513    where
2514        T: std::convert::Into<i64>,
2515    {
2516        self.if_metageneration_match = v.map(|x| x.into());
2517        self
2518    }
2519
2520    /// Sets the value of [if_metageneration_not_match][crate::model::GetObjectRequest::if_metageneration_not_match].
2521    ///
2522    /// # Example
2523    /// ```ignore,no_run
2524    /// # use google_cloud_storage::model::GetObjectRequest;
2525    /// let x = GetObjectRequest::new().set_if_metageneration_not_match(42);
2526    /// ```
2527    pub fn set_if_metageneration_not_match<T>(mut self, v: T) -> Self
2528    where
2529        T: std::convert::Into<i64>,
2530    {
2531        self.if_metageneration_not_match = std::option::Option::Some(v.into());
2532        self
2533    }
2534
2535    /// Sets or clears the value of [if_metageneration_not_match][crate::model::GetObjectRequest::if_metageneration_not_match].
2536    ///
2537    /// # Example
2538    /// ```ignore,no_run
2539    /// # use google_cloud_storage::model::GetObjectRequest;
2540    /// let x = GetObjectRequest::new().set_or_clear_if_metageneration_not_match(Some(42));
2541    /// let x = GetObjectRequest::new().set_or_clear_if_metageneration_not_match(None::<i32>);
2542    /// ```
2543    pub fn set_or_clear_if_metageneration_not_match<T>(mut self, v: std::option::Option<T>) -> Self
2544    where
2545        T: std::convert::Into<i64>,
2546    {
2547        self.if_metageneration_not_match = v.map(|x| x.into());
2548        self
2549    }
2550
2551    /// Sets the value of [common_object_request_params][crate::model::GetObjectRequest::common_object_request_params].
2552    ///
2553    /// # Example
2554    /// ```ignore,no_run
2555    /// # use google_cloud_storage::model::GetObjectRequest;
2556    /// use google_cloud_storage::model::CommonObjectRequestParams;
2557    /// let x = GetObjectRequest::new().set_common_object_request_params(CommonObjectRequestParams::default()/* use setters */);
2558    /// ```
2559    pub fn set_common_object_request_params<T>(mut self, v: T) -> Self
2560    where
2561        T: std::convert::Into<crate::model::CommonObjectRequestParams>,
2562    {
2563        self.common_object_request_params = std::option::Option::Some(v.into());
2564        self
2565    }
2566
2567    /// Sets or clears the value of [common_object_request_params][crate::model::GetObjectRequest::common_object_request_params].
2568    ///
2569    /// # Example
2570    /// ```ignore,no_run
2571    /// # use google_cloud_storage::model::GetObjectRequest;
2572    /// use google_cloud_storage::model::CommonObjectRequestParams;
2573    /// let x = GetObjectRequest::new().set_or_clear_common_object_request_params(Some(CommonObjectRequestParams::default()/* use setters */));
2574    /// let x = GetObjectRequest::new().set_or_clear_common_object_request_params(None::<CommonObjectRequestParams>);
2575    /// ```
2576    pub fn set_or_clear_common_object_request_params<T>(mut self, v: std::option::Option<T>) -> Self
2577    where
2578        T: std::convert::Into<crate::model::CommonObjectRequestParams>,
2579    {
2580        self.common_object_request_params = v.map(|x| x.into());
2581        self
2582    }
2583
2584    /// Sets the value of [read_mask][crate::model::GetObjectRequest::read_mask].
2585    ///
2586    /// # Example
2587    /// ```ignore,no_run
2588    /// # use google_cloud_storage::model::GetObjectRequest;
2589    /// use wkt::FieldMask;
2590    /// let x = GetObjectRequest::new().set_read_mask(FieldMask::default()/* use setters */);
2591    /// ```
2592    pub fn set_read_mask<T>(mut self, v: T) -> Self
2593    where
2594        T: std::convert::Into<wkt::FieldMask>,
2595    {
2596        self.read_mask = std::option::Option::Some(v.into());
2597        self
2598    }
2599
2600    /// Sets or clears the value of [read_mask][crate::model::GetObjectRequest::read_mask].
2601    ///
2602    /// # Example
2603    /// ```ignore,no_run
2604    /// # use google_cloud_storage::model::GetObjectRequest;
2605    /// use wkt::FieldMask;
2606    /// let x = GetObjectRequest::new().set_or_clear_read_mask(Some(FieldMask::default()/* use setters */));
2607    /// let x = GetObjectRequest::new().set_or_clear_read_mask(None::<FieldMask>);
2608    /// ```
2609    pub fn set_or_clear_read_mask<T>(mut self, v: std::option::Option<T>) -> Self
2610    where
2611        T: std::convert::Into<wkt::FieldMask>,
2612    {
2613        self.read_mask = v.map(|x| x.into());
2614        self
2615    }
2616
2617    /// Sets the value of [restore_token][crate::model::GetObjectRequest::restore_token].
2618    ///
2619    /// # Example
2620    /// ```ignore,no_run
2621    /// # use google_cloud_storage::model::GetObjectRequest;
2622    /// let x = GetObjectRequest::new().set_restore_token("example");
2623    /// ```
2624    pub fn set_restore_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2625        self.restore_token = v.into();
2626        self
2627    }
2628}
2629
2630impl wkt::message::Message for GetObjectRequest {
2631    fn typename() -> &'static str {
2632        "type.googleapis.com/google.storage.v2.GetObjectRequest"
2633    }
2634}
2635
2636/// Describes an attempt to insert an object, possibly over multiple requests.
2637#[derive(Clone, Default, PartialEq)]
2638#[non_exhaustive]
2639pub struct WriteObjectSpec {
2640    /// Required. Destination object, including its name and its metadata.
2641    pub resource: std::option::Option<crate::model::Object>,
2642
2643    /// Optional. Apply a predefined set of access controls to this object.
2644    /// Valid values are `authenticatedRead`, `bucketOwnerFullControl`,
2645    /// `bucketOwnerRead`, `private`, `projectPrivate`, or `publicRead`.
2646    pub predefined_acl: std::string::String,
2647
2648    /// Makes the operation conditional on whether the object's current
2649    /// generation matches the given value. Setting to `0` makes the operation
2650    /// succeed only if there are no live versions of the object.
2651    pub if_generation_match: std::option::Option<i64>,
2652
2653    /// Makes the operation conditional on whether the object's live
2654    /// generation does not match the given value. If no live object exists, the
2655    /// precondition fails. Setting to `0` makes the operation succeed only if
2656    /// there is a live version of the object.
2657    pub if_generation_not_match: std::option::Option<i64>,
2658
2659    /// Makes the operation conditional on whether the object's current
2660    /// metageneration matches the given value.
2661    pub if_metageneration_match: std::option::Option<i64>,
2662
2663    /// Makes the operation conditional on whether the object's current
2664    /// metageneration does not match the given value.
2665    pub if_metageneration_not_match: std::option::Option<i64>,
2666
2667    /// The expected final object size being uploaded.
2668    /// If this value is set, closing the stream after writing fewer or more than
2669    /// `object_size` bytes results in an `OUT_OF_RANGE` error.
2670    ///
2671    /// This situation is considered a client error, and if such an error occurs
2672    /// you must start the upload over from scratch, this time sending the correct
2673    /// number of bytes.
2674    pub object_size: std::option::Option<i64>,
2675
2676    /// If `true`, the object is created in appendable mode.
2677    /// This field might only be set when using `BidiWriteObject`.
2678    pub appendable: std::option::Option<bool>,
2679
2680    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2681}
2682
2683impl WriteObjectSpec {
2684    /// Creates a new default instance.
2685    pub fn new() -> Self {
2686        std::default::Default::default()
2687    }
2688
2689    /// Sets the value of [resource][crate::model::WriteObjectSpec::resource].
2690    ///
2691    /// # Example
2692    /// ```ignore,no_run
2693    /// # use google_cloud_storage::model::WriteObjectSpec;
2694    /// use google_cloud_storage::model::Object;
2695    /// let x = WriteObjectSpec::new().set_resource(Object::default()/* use setters */);
2696    /// ```
2697    pub fn set_resource<T>(mut self, v: T) -> Self
2698    where
2699        T: std::convert::Into<crate::model::Object>,
2700    {
2701        self.resource = std::option::Option::Some(v.into());
2702        self
2703    }
2704
2705    /// Sets or clears the value of [resource][crate::model::WriteObjectSpec::resource].
2706    ///
2707    /// # Example
2708    /// ```ignore,no_run
2709    /// # use google_cloud_storage::model::WriteObjectSpec;
2710    /// use google_cloud_storage::model::Object;
2711    /// let x = WriteObjectSpec::new().set_or_clear_resource(Some(Object::default()/* use setters */));
2712    /// let x = WriteObjectSpec::new().set_or_clear_resource(None::<Object>);
2713    /// ```
2714    pub fn set_or_clear_resource<T>(mut self, v: std::option::Option<T>) -> Self
2715    where
2716        T: std::convert::Into<crate::model::Object>,
2717    {
2718        self.resource = v.map(|x| x.into());
2719        self
2720    }
2721
2722    /// Sets the value of [predefined_acl][crate::model::WriteObjectSpec::predefined_acl].
2723    ///
2724    /// # Example
2725    /// ```ignore,no_run
2726    /// # use google_cloud_storage::model::WriteObjectSpec;
2727    /// let x = WriteObjectSpec::new().set_predefined_acl("example");
2728    /// ```
2729    pub fn set_predefined_acl<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2730        self.predefined_acl = v.into();
2731        self
2732    }
2733
2734    /// Sets the value of [if_generation_match][crate::model::WriteObjectSpec::if_generation_match].
2735    ///
2736    /// # Example
2737    /// ```ignore,no_run
2738    /// # use google_cloud_storage::model::WriteObjectSpec;
2739    /// let x = WriteObjectSpec::new().set_if_generation_match(42);
2740    /// ```
2741    pub fn set_if_generation_match<T>(mut self, v: T) -> Self
2742    where
2743        T: std::convert::Into<i64>,
2744    {
2745        self.if_generation_match = std::option::Option::Some(v.into());
2746        self
2747    }
2748
2749    /// Sets or clears the value of [if_generation_match][crate::model::WriteObjectSpec::if_generation_match].
2750    ///
2751    /// # Example
2752    /// ```ignore,no_run
2753    /// # use google_cloud_storage::model::WriteObjectSpec;
2754    /// let x = WriteObjectSpec::new().set_or_clear_if_generation_match(Some(42));
2755    /// let x = WriteObjectSpec::new().set_or_clear_if_generation_match(None::<i32>);
2756    /// ```
2757    pub fn set_or_clear_if_generation_match<T>(mut self, v: std::option::Option<T>) -> Self
2758    where
2759        T: std::convert::Into<i64>,
2760    {
2761        self.if_generation_match = v.map(|x| x.into());
2762        self
2763    }
2764
2765    /// Sets the value of [if_generation_not_match][crate::model::WriteObjectSpec::if_generation_not_match].
2766    ///
2767    /// # Example
2768    /// ```ignore,no_run
2769    /// # use google_cloud_storage::model::WriteObjectSpec;
2770    /// let x = WriteObjectSpec::new().set_if_generation_not_match(42);
2771    /// ```
2772    pub fn set_if_generation_not_match<T>(mut self, v: T) -> Self
2773    where
2774        T: std::convert::Into<i64>,
2775    {
2776        self.if_generation_not_match = std::option::Option::Some(v.into());
2777        self
2778    }
2779
2780    /// Sets or clears the value of [if_generation_not_match][crate::model::WriteObjectSpec::if_generation_not_match].
2781    ///
2782    /// # Example
2783    /// ```ignore,no_run
2784    /// # use google_cloud_storage::model::WriteObjectSpec;
2785    /// let x = WriteObjectSpec::new().set_or_clear_if_generation_not_match(Some(42));
2786    /// let x = WriteObjectSpec::new().set_or_clear_if_generation_not_match(None::<i32>);
2787    /// ```
2788    pub fn set_or_clear_if_generation_not_match<T>(mut self, v: std::option::Option<T>) -> Self
2789    where
2790        T: std::convert::Into<i64>,
2791    {
2792        self.if_generation_not_match = v.map(|x| x.into());
2793        self
2794    }
2795
2796    /// Sets the value of [if_metageneration_match][crate::model::WriteObjectSpec::if_metageneration_match].
2797    ///
2798    /// # Example
2799    /// ```ignore,no_run
2800    /// # use google_cloud_storage::model::WriteObjectSpec;
2801    /// let x = WriteObjectSpec::new().set_if_metageneration_match(42);
2802    /// ```
2803    pub fn set_if_metageneration_match<T>(mut self, v: T) -> Self
2804    where
2805        T: std::convert::Into<i64>,
2806    {
2807        self.if_metageneration_match = std::option::Option::Some(v.into());
2808        self
2809    }
2810
2811    /// Sets or clears the value of [if_metageneration_match][crate::model::WriteObjectSpec::if_metageneration_match].
2812    ///
2813    /// # Example
2814    /// ```ignore,no_run
2815    /// # use google_cloud_storage::model::WriteObjectSpec;
2816    /// let x = WriteObjectSpec::new().set_or_clear_if_metageneration_match(Some(42));
2817    /// let x = WriteObjectSpec::new().set_or_clear_if_metageneration_match(None::<i32>);
2818    /// ```
2819    pub fn set_or_clear_if_metageneration_match<T>(mut self, v: std::option::Option<T>) -> Self
2820    where
2821        T: std::convert::Into<i64>,
2822    {
2823        self.if_metageneration_match = v.map(|x| x.into());
2824        self
2825    }
2826
2827    /// Sets the value of [if_metageneration_not_match][crate::model::WriteObjectSpec::if_metageneration_not_match].
2828    ///
2829    /// # Example
2830    /// ```ignore,no_run
2831    /// # use google_cloud_storage::model::WriteObjectSpec;
2832    /// let x = WriteObjectSpec::new().set_if_metageneration_not_match(42);
2833    /// ```
2834    pub fn set_if_metageneration_not_match<T>(mut self, v: T) -> Self
2835    where
2836        T: std::convert::Into<i64>,
2837    {
2838        self.if_metageneration_not_match = std::option::Option::Some(v.into());
2839        self
2840    }
2841
2842    /// Sets or clears the value of [if_metageneration_not_match][crate::model::WriteObjectSpec::if_metageneration_not_match].
2843    ///
2844    /// # Example
2845    /// ```ignore,no_run
2846    /// # use google_cloud_storage::model::WriteObjectSpec;
2847    /// let x = WriteObjectSpec::new().set_or_clear_if_metageneration_not_match(Some(42));
2848    /// let x = WriteObjectSpec::new().set_or_clear_if_metageneration_not_match(None::<i32>);
2849    /// ```
2850    pub fn set_or_clear_if_metageneration_not_match<T>(mut self, v: std::option::Option<T>) -> Self
2851    where
2852        T: std::convert::Into<i64>,
2853    {
2854        self.if_metageneration_not_match = v.map(|x| x.into());
2855        self
2856    }
2857
2858    /// Sets the value of [object_size][crate::model::WriteObjectSpec::object_size].
2859    ///
2860    /// # Example
2861    /// ```ignore,no_run
2862    /// # use google_cloud_storage::model::WriteObjectSpec;
2863    /// let x = WriteObjectSpec::new().set_object_size(42);
2864    /// ```
2865    pub fn set_object_size<T>(mut self, v: T) -> Self
2866    where
2867        T: std::convert::Into<i64>,
2868    {
2869        self.object_size = std::option::Option::Some(v.into());
2870        self
2871    }
2872
2873    /// Sets or clears the value of [object_size][crate::model::WriteObjectSpec::object_size].
2874    ///
2875    /// # Example
2876    /// ```ignore,no_run
2877    /// # use google_cloud_storage::model::WriteObjectSpec;
2878    /// let x = WriteObjectSpec::new().set_or_clear_object_size(Some(42));
2879    /// let x = WriteObjectSpec::new().set_or_clear_object_size(None::<i32>);
2880    /// ```
2881    pub fn set_or_clear_object_size<T>(mut self, v: std::option::Option<T>) -> Self
2882    where
2883        T: std::convert::Into<i64>,
2884    {
2885        self.object_size = v.map(|x| x.into());
2886        self
2887    }
2888
2889    /// Sets the value of [appendable][crate::model::WriteObjectSpec::appendable].
2890    ///
2891    /// # Example
2892    /// ```ignore,no_run
2893    /// # use google_cloud_storage::model::WriteObjectSpec;
2894    /// let x = WriteObjectSpec::new().set_appendable(true);
2895    /// ```
2896    pub fn set_appendable<T>(mut self, v: T) -> Self
2897    where
2898        T: std::convert::Into<bool>,
2899    {
2900        self.appendable = std::option::Option::Some(v.into());
2901        self
2902    }
2903
2904    /// Sets or clears the value of [appendable][crate::model::WriteObjectSpec::appendable].
2905    ///
2906    /// # Example
2907    /// ```ignore,no_run
2908    /// # use google_cloud_storage::model::WriteObjectSpec;
2909    /// let x = WriteObjectSpec::new().set_or_clear_appendable(Some(false));
2910    /// let x = WriteObjectSpec::new().set_or_clear_appendable(None::<bool>);
2911    /// ```
2912    pub fn set_or_clear_appendable<T>(mut self, v: std::option::Option<T>) -> Self
2913    where
2914        T: std::convert::Into<bool>,
2915    {
2916        self.appendable = v.map(|x| x.into());
2917        self
2918    }
2919}
2920
2921impl wkt::message::Message for WriteObjectSpec {
2922    fn typename() -> &'static str {
2923        "type.googleapis.com/google.storage.v2.WriteObjectSpec"
2924    }
2925}
2926
2927/// Request message for [ListObjects][google.storage.v2.Storage.ListObjects].
2928///
2929/// [google.storage.v2.Storage.ListObjects]: crate::client::StorageControl::list_objects
2930#[derive(Clone, Default, PartialEq)]
2931#[non_exhaustive]
2932pub struct ListObjectsRequest {
2933    /// Required. Name of the bucket in which to look for objects.
2934    pub parent: std::string::String,
2935
2936    /// Optional. Maximum number of `items` plus `prefixes` to return
2937    /// in a single page of responses. As duplicate `prefixes` are
2938    /// omitted, fewer total results might be returned than requested. The service
2939    /// uses this parameter or 1,000 items, whichever is smaller.
2940    pub page_size: i32,
2941
2942    /// Optional. A previously-returned page token representing part of the larger
2943    /// set of results to view.
2944    pub page_token: std::string::String,
2945
2946    /// Optional. If set, returns results in a directory-like mode. `items`
2947    /// contains only objects whose names, aside from the `prefix`, do not contain
2948    /// `delimiter`. Objects whose names, aside from the `prefix`, contain
2949    /// `delimiter` has their name, truncated after the `delimiter`, returned in
2950    /// `prefixes`. Duplicate `prefixes` are omitted.
2951    pub delimiter: std::string::String,
2952
2953    /// Optional. If true, objects that end in exactly one instance of `delimiter`
2954    /// has their metadata included in `items` in addition to
2955    /// `prefixes`.
2956    pub include_trailing_delimiter: bool,
2957
2958    /// Optional. Filter results to objects whose names begin with this prefix.
2959    pub prefix: std::string::String,
2960
2961    /// Optional. If `true`, lists all versions of an object as distinct results.
2962    pub versions: bool,
2963
2964    /// Mask specifying which fields to read from each result.
2965    /// If no mask is specified, defaults to all fields except `items.acl` and
2966    /// `items.owner`.
2967    /// `*` might be used to mean all fields.
2968    pub read_mask: std::option::Option<wkt::FieldMask>,
2969
2970    /// Optional. Filter results to objects whose names are lexicographically equal
2971    /// to or after `lexicographic_start`. If `lexicographic_end` is also set, the
2972    /// objects listed have names between `lexicographic_start` (inclusive) and
2973    /// `lexicographic_end` (exclusive).
2974    pub lexicographic_start: std::string::String,
2975
2976    /// Optional. Filter results to objects whose names are lexicographically
2977    /// before `lexicographic_end`. If `lexicographic_start` is also set, the
2978    /// objects listed have names between `lexicographic_start` (inclusive) and
2979    /// `lexicographic_end` (exclusive).
2980    pub lexicographic_end: std::string::String,
2981
2982    /// Optional. If true, only list all soft-deleted versions of the object.
2983    /// Soft delete policy is required to set this option.
2984    pub soft_deleted: bool,
2985
2986    /// Optional. If true, includes folders and managed folders (besides objects)
2987    /// in the returned `prefixes`. Requires `delimiter` to be set to '/'.
2988    pub include_folders_as_prefixes: bool,
2989
2990    /// Optional. Filter results to objects and prefixes that match this glob
2991    /// pattern. See [List objects using
2992    /// glob](https://cloud.google.com/storage/docs/json_api/v1/objects/list#list-objects-and-prefixes-using-glob)
2993    /// for the full syntax.
2994    pub match_glob: std::string::String,
2995
2996    /// Optional. An expression used to filter the returned objects by the
2997    /// `context` field. For the full syntax, see [Filter objects by contexts
2998    /// syntax](https://cloud.google.com/storage/docs/listing-objects#filter-by-object-contexts-syntax).
2999    /// If a `delimiter` is set, the returned `prefixes` are exempt from this
3000    /// filter.
3001    pub filter: std::string::String,
3002
3003    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3004}
3005
3006impl ListObjectsRequest {
3007    /// Creates a new default instance.
3008    pub fn new() -> Self {
3009        std::default::Default::default()
3010    }
3011
3012    /// Sets the value of [parent][crate::model::ListObjectsRequest::parent].
3013    ///
3014    /// # Example
3015    /// ```ignore,no_run
3016    /// # use google_cloud_storage::model::ListObjectsRequest;
3017    /// # let project_id = "project_id";
3018    /// # let bucket_id = "bucket_id";
3019    /// let x = ListObjectsRequest::new().set_parent(format!("projects/{project_id}/buckets/{bucket_id}"));
3020    /// ```
3021    pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3022        self.parent = v.into();
3023        self
3024    }
3025
3026    /// Sets the value of [page_size][crate::model::ListObjectsRequest::page_size].
3027    ///
3028    /// # Example
3029    /// ```ignore,no_run
3030    /// # use google_cloud_storage::model::ListObjectsRequest;
3031    /// let x = ListObjectsRequest::new().set_page_size(42);
3032    /// ```
3033    pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
3034        self.page_size = v.into();
3035        self
3036    }
3037
3038    /// Sets the value of [page_token][crate::model::ListObjectsRequest::page_token].
3039    ///
3040    /// # Example
3041    /// ```ignore,no_run
3042    /// # use google_cloud_storage::model::ListObjectsRequest;
3043    /// let x = ListObjectsRequest::new().set_page_token("example");
3044    /// ```
3045    pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3046        self.page_token = v.into();
3047        self
3048    }
3049
3050    /// Sets the value of [delimiter][crate::model::ListObjectsRequest::delimiter].
3051    ///
3052    /// # Example
3053    /// ```ignore,no_run
3054    /// # use google_cloud_storage::model::ListObjectsRequest;
3055    /// let x = ListObjectsRequest::new().set_delimiter("example");
3056    /// ```
3057    pub fn set_delimiter<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3058        self.delimiter = v.into();
3059        self
3060    }
3061
3062    /// Sets the value of [include_trailing_delimiter][crate::model::ListObjectsRequest::include_trailing_delimiter].
3063    ///
3064    /// # Example
3065    /// ```ignore,no_run
3066    /// # use google_cloud_storage::model::ListObjectsRequest;
3067    /// let x = ListObjectsRequest::new().set_include_trailing_delimiter(true);
3068    /// ```
3069    pub fn set_include_trailing_delimiter<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
3070        self.include_trailing_delimiter = v.into();
3071        self
3072    }
3073
3074    /// Sets the value of [prefix][crate::model::ListObjectsRequest::prefix].
3075    ///
3076    /// # Example
3077    /// ```ignore,no_run
3078    /// # use google_cloud_storage::model::ListObjectsRequest;
3079    /// let x = ListObjectsRequest::new().set_prefix("example");
3080    /// ```
3081    pub fn set_prefix<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3082        self.prefix = v.into();
3083        self
3084    }
3085
3086    /// Sets the value of [versions][crate::model::ListObjectsRequest::versions].
3087    ///
3088    /// # Example
3089    /// ```ignore,no_run
3090    /// # use google_cloud_storage::model::ListObjectsRequest;
3091    /// let x = ListObjectsRequest::new().set_versions(true);
3092    /// ```
3093    pub fn set_versions<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
3094        self.versions = v.into();
3095        self
3096    }
3097
3098    /// Sets the value of [read_mask][crate::model::ListObjectsRequest::read_mask].
3099    ///
3100    /// # Example
3101    /// ```ignore,no_run
3102    /// # use google_cloud_storage::model::ListObjectsRequest;
3103    /// use wkt::FieldMask;
3104    /// let x = ListObjectsRequest::new().set_read_mask(FieldMask::default()/* use setters */);
3105    /// ```
3106    pub fn set_read_mask<T>(mut self, v: T) -> Self
3107    where
3108        T: std::convert::Into<wkt::FieldMask>,
3109    {
3110        self.read_mask = std::option::Option::Some(v.into());
3111        self
3112    }
3113
3114    /// Sets or clears the value of [read_mask][crate::model::ListObjectsRequest::read_mask].
3115    ///
3116    /// # Example
3117    /// ```ignore,no_run
3118    /// # use google_cloud_storage::model::ListObjectsRequest;
3119    /// use wkt::FieldMask;
3120    /// let x = ListObjectsRequest::new().set_or_clear_read_mask(Some(FieldMask::default()/* use setters */));
3121    /// let x = ListObjectsRequest::new().set_or_clear_read_mask(None::<FieldMask>);
3122    /// ```
3123    pub fn set_or_clear_read_mask<T>(mut self, v: std::option::Option<T>) -> Self
3124    where
3125        T: std::convert::Into<wkt::FieldMask>,
3126    {
3127        self.read_mask = v.map(|x| x.into());
3128        self
3129    }
3130
3131    /// Sets the value of [lexicographic_start][crate::model::ListObjectsRequest::lexicographic_start].
3132    ///
3133    /// # Example
3134    /// ```ignore,no_run
3135    /// # use google_cloud_storage::model::ListObjectsRequest;
3136    /// let x = ListObjectsRequest::new().set_lexicographic_start("example");
3137    /// ```
3138    pub fn set_lexicographic_start<T: std::convert::Into<std::string::String>>(
3139        mut self,
3140        v: T,
3141    ) -> Self {
3142        self.lexicographic_start = v.into();
3143        self
3144    }
3145
3146    /// Sets the value of [lexicographic_end][crate::model::ListObjectsRequest::lexicographic_end].
3147    ///
3148    /// # Example
3149    /// ```ignore,no_run
3150    /// # use google_cloud_storage::model::ListObjectsRequest;
3151    /// let x = ListObjectsRequest::new().set_lexicographic_end("example");
3152    /// ```
3153    pub fn set_lexicographic_end<T: std::convert::Into<std::string::String>>(
3154        mut self,
3155        v: T,
3156    ) -> Self {
3157        self.lexicographic_end = v.into();
3158        self
3159    }
3160
3161    /// Sets the value of [soft_deleted][crate::model::ListObjectsRequest::soft_deleted].
3162    ///
3163    /// # Example
3164    /// ```ignore,no_run
3165    /// # use google_cloud_storage::model::ListObjectsRequest;
3166    /// let x = ListObjectsRequest::new().set_soft_deleted(true);
3167    /// ```
3168    pub fn set_soft_deleted<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
3169        self.soft_deleted = v.into();
3170        self
3171    }
3172
3173    /// Sets the value of [include_folders_as_prefixes][crate::model::ListObjectsRequest::include_folders_as_prefixes].
3174    ///
3175    /// # Example
3176    /// ```ignore,no_run
3177    /// # use google_cloud_storage::model::ListObjectsRequest;
3178    /// let x = ListObjectsRequest::new().set_include_folders_as_prefixes(true);
3179    /// ```
3180    pub fn set_include_folders_as_prefixes<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
3181        self.include_folders_as_prefixes = v.into();
3182        self
3183    }
3184
3185    /// Sets the value of [match_glob][crate::model::ListObjectsRequest::match_glob].
3186    ///
3187    /// # Example
3188    /// ```ignore,no_run
3189    /// # use google_cloud_storage::model::ListObjectsRequest;
3190    /// let x = ListObjectsRequest::new().set_match_glob("example");
3191    /// ```
3192    pub fn set_match_glob<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3193        self.match_glob = v.into();
3194        self
3195    }
3196
3197    /// Sets the value of [filter][crate::model::ListObjectsRequest::filter].
3198    ///
3199    /// # Example
3200    /// ```ignore,no_run
3201    /// # use google_cloud_storage::model::ListObjectsRequest;
3202    /// let x = ListObjectsRequest::new().set_filter("example");
3203    /// ```
3204    pub fn set_filter<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3205        self.filter = v.into();
3206        self
3207    }
3208}
3209
3210impl wkt::message::Message for ListObjectsRequest {
3211    fn typename() -> &'static str {
3212        "type.googleapis.com/google.storage.v2.ListObjectsRequest"
3213    }
3214}
3215
3216/// Request message for [RewriteObject][google.storage.v2.Storage.RewriteObject].
3217/// If the source object is encrypted using a Customer-Supplied Encryption Key
3218/// the key information must be provided in the
3219/// `copy_source_encryption_algorithm`, `copy_source_encryption_key_bytes`, and
3220/// `copy_source_encryption_key_sha256_bytes` fields. If the destination object
3221/// should be encrypted the keying information should be provided in the
3222/// `encryption_algorithm`, `encryption_key_bytes`, and
3223/// `encryption_key_sha256_bytes` fields of the
3224/// `common_object_request_params.customer_encryption` field.
3225///
3226/// [google.storage.v2.Storage.RewriteObject]: crate::client::StorageControl::rewrite_object
3227#[derive(Clone, Default, PartialEq)]
3228#[non_exhaustive]
3229pub struct RewriteObjectRequest {
3230    /// Required. Immutable. The name of the destination object.
3231    /// See the
3232    /// [Naming Guidelines](https://cloud.google.com/storage/docs/objects#naming).
3233    /// Example: `test.txt`
3234    /// The `name` field by itself does not uniquely identify a Cloud Storage
3235    /// object. A Cloud Storage object is uniquely identified by the tuple of
3236    /// (bucket, object, generation).
3237    pub destination_name: std::string::String,
3238
3239    /// Required. Immutable. The name of the bucket containing the destination
3240    /// object.
3241    pub destination_bucket: std::string::String,
3242
3243    /// Optional. The name of the Cloud KMS key that is used to encrypt the
3244    /// destination object. The Cloud KMS key must be located in same location as
3245    /// the object. If the parameter is not specified, the request uses the
3246    /// destination bucket's default encryption key, if any, or else the
3247    /// Google-managed encryption key.
3248    pub destination_kms_key: std::string::String,
3249
3250    /// Optional. Properties of the destination, post-rewrite object.
3251    /// The `name`, `bucket` and `kms_key` fields must not be populated (these
3252    /// values are specified in the `destination_name`, `destination_bucket`, and
3253    /// `destination_kms_key` fields).
3254    /// If `destination` is present it is used to construct the destination
3255    /// object's metadata; otherwise the destination object's metadata is
3256    /// copied from the source object.
3257    pub destination: std::option::Option<crate::model::Object>,
3258
3259    /// Required. Name of the bucket in which to find the source object.
3260    pub source_bucket: std::string::String,
3261
3262    /// Required. Name of the source object.
3263    pub source_object: std::string::String,
3264
3265    /// Optional. If present, selects a specific revision of the source object (as
3266    /// opposed to the latest version, the default).
3267    pub source_generation: i64,
3268
3269    /// Optional. Include this field (from the previous rewrite response) on each
3270    /// rewrite request after the first one, until the rewrite response 'done' flag
3271    /// is true. Calls that provide a rewriteToken can omit all other request
3272    /// fields, but if included those fields must match the values provided in the
3273    /// first rewrite request.
3274    pub rewrite_token: std::string::String,
3275
3276    /// Optional. Apply a predefined set of access controls to the destination
3277    /// object. Valid values are `authenticatedRead`, `bucketOwnerFullControl`,
3278    /// `bucketOwnerRead`, `private`, `projectPrivate`, or `publicRead`.
3279    pub destination_predefined_acl: std::string::String,
3280
3281    /// Makes the operation conditional on whether the object's current generation
3282    /// matches the given value. Setting to 0 makes the operation succeed only if
3283    /// there are no live versions of the object.
3284    pub if_generation_match: std::option::Option<i64>,
3285
3286    /// Makes the operation conditional on whether the object's live generation
3287    /// does not match the given value. If no live object exists, the precondition
3288    /// fails. Setting to 0 makes the operation succeed only if there is a live
3289    /// version of the object.
3290    pub if_generation_not_match: std::option::Option<i64>,
3291
3292    /// Makes the operation conditional on whether the destination object's current
3293    /// metageneration matches the given value.
3294    pub if_metageneration_match: std::option::Option<i64>,
3295
3296    /// Makes the operation conditional on whether the destination object's current
3297    /// metageneration does not match the given value.
3298    pub if_metageneration_not_match: std::option::Option<i64>,
3299
3300    /// Makes the operation conditional on whether the source object's live
3301    /// generation matches the given value.
3302    pub if_source_generation_match: std::option::Option<i64>,
3303
3304    /// Makes the operation conditional on whether the source object's live
3305    /// generation does not match the given value.
3306    pub if_source_generation_not_match: std::option::Option<i64>,
3307
3308    /// Makes the operation conditional on whether the source object's current
3309    /// metageneration matches the given value.
3310    pub if_source_metageneration_match: std::option::Option<i64>,
3311
3312    /// Makes the operation conditional on whether the source object's current
3313    /// metageneration does not match the given value.
3314    pub if_source_metageneration_not_match: std::option::Option<i64>,
3315
3316    /// Optional. The maximum number of bytes that are rewritten per rewrite
3317    /// request. Most callers shouldn't need to specify this parameter - it is
3318    /// primarily in place to support testing. If specified the value must be an
3319    /// integral multiple of 1 MiB (1048576). Also, this only applies to requests
3320    /// where the source and destination span locations and/or storage classes.
3321    /// Finally, this value must not change across rewrite calls else you'll get an
3322    /// error that the `rewriteToken` is invalid.
3323    pub max_bytes_rewritten_per_call: i64,
3324
3325    /// Optional. The algorithm used to encrypt the source object, if any. Used if
3326    /// the source object was encrypted with a Customer-Supplied Encryption Key.
3327    pub copy_source_encryption_algorithm: std::string::String,
3328
3329    /// Optional. The raw bytes (not base64-encoded) AES-256 encryption key used to
3330    /// encrypt the source object, if it was encrypted with a Customer-Supplied
3331    /// Encryption Key.
3332    pub copy_source_encryption_key_bytes: ::bytes::Bytes,
3333
3334    /// Optional. The raw bytes (not base64-encoded) SHA256 hash of the encryption
3335    /// key used to encrypt the source object, if it was encrypted with a
3336    /// Customer-Supplied Encryption Key.
3337    pub copy_source_encryption_key_sha256_bytes: ::bytes::Bytes,
3338
3339    /// Optional. A set of parameters common to Storage API requests concerning an
3340    /// object.
3341    pub common_object_request_params: std::option::Option<crate::model::CommonObjectRequestParams>,
3342
3343    /// Optional. The checksums of the complete object. This is used to validate
3344    /// the destination object after rewriting.
3345    pub object_checksums: std::option::Option<crate::model::ObjectChecksums>,
3346
3347    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3348}
3349
3350impl RewriteObjectRequest {
3351    /// Creates a new default instance.
3352    pub fn new() -> Self {
3353        std::default::Default::default()
3354    }
3355
3356    /// Sets the value of [destination_name][crate::model::RewriteObjectRequest::destination_name].
3357    ///
3358    /// # Example
3359    /// ```ignore,no_run
3360    /// # use google_cloud_storage::model::RewriteObjectRequest;
3361    /// let x = RewriteObjectRequest::new().set_destination_name("example");
3362    /// ```
3363    pub fn set_destination_name<T: std::convert::Into<std::string::String>>(
3364        mut self,
3365        v: T,
3366    ) -> Self {
3367        self.destination_name = v.into();
3368        self
3369    }
3370
3371    /// Sets the value of [destination_bucket][crate::model::RewriteObjectRequest::destination_bucket].
3372    ///
3373    /// # Example
3374    /// ```ignore,no_run
3375    /// # use google_cloud_storage::model::RewriteObjectRequest;
3376    /// # let project_id = "project_id";
3377    /// # let bucket_id = "bucket_id";
3378    /// let x = RewriteObjectRequest::new().set_destination_bucket(format!("projects/{project_id}/buckets/{bucket_id}"));
3379    /// ```
3380    pub fn set_destination_bucket<T: std::convert::Into<std::string::String>>(
3381        mut self,
3382        v: T,
3383    ) -> Self {
3384        self.destination_bucket = v.into();
3385        self
3386    }
3387
3388    /// Sets the value of [destination_kms_key][crate::model::RewriteObjectRequest::destination_kms_key].
3389    ///
3390    /// # Example
3391    /// ```ignore,no_run
3392    /// # use google_cloud_storage::model::RewriteObjectRequest;
3393    /// let x = RewriteObjectRequest::new().set_destination_kms_key("example");
3394    /// ```
3395    pub fn set_destination_kms_key<T: std::convert::Into<std::string::String>>(
3396        mut self,
3397        v: T,
3398    ) -> Self {
3399        self.destination_kms_key = v.into();
3400        self
3401    }
3402
3403    /// Sets the value of [destination][crate::model::RewriteObjectRequest::destination].
3404    ///
3405    /// # Example
3406    /// ```ignore,no_run
3407    /// # use google_cloud_storage::model::RewriteObjectRequest;
3408    /// use google_cloud_storage::model::Object;
3409    /// let x = RewriteObjectRequest::new().set_destination(Object::default()/* use setters */);
3410    /// ```
3411    pub fn set_destination<T>(mut self, v: T) -> Self
3412    where
3413        T: std::convert::Into<crate::model::Object>,
3414    {
3415        self.destination = std::option::Option::Some(v.into());
3416        self
3417    }
3418
3419    /// Sets or clears the value of [destination][crate::model::RewriteObjectRequest::destination].
3420    ///
3421    /// # Example
3422    /// ```ignore,no_run
3423    /// # use google_cloud_storage::model::RewriteObjectRequest;
3424    /// use google_cloud_storage::model::Object;
3425    /// let x = RewriteObjectRequest::new().set_or_clear_destination(Some(Object::default()/* use setters */));
3426    /// let x = RewriteObjectRequest::new().set_or_clear_destination(None::<Object>);
3427    /// ```
3428    pub fn set_or_clear_destination<T>(mut self, v: std::option::Option<T>) -> Self
3429    where
3430        T: std::convert::Into<crate::model::Object>,
3431    {
3432        self.destination = v.map(|x| x.into());
3433        self
3434    }
3435
3436    /// Sets the value of [source_bucket][crate::model::RewriteObjectRequest::source_bucket].
3437    ///
3438    /// # Example
3439    /// ```ignore,no_run
3440    /// # use google_cloud_storage::model::RewriteObjectRequest;
3441    /// # let project_id = "project_id";
3442    /// # let bucket_id = "bucket_id";
3443    /// let x = RewriteObjectRequest::new().set_source_bucket(format!("projects/{project_id}/buckets/{bucket_id}"));
3444    /// ```
3445    pub fn set_source_bucket<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3446        self.source_bucket = v.into();
3447        self
3448    }
3449
3450    /// Sets the value of [source_object][crate::model::RewriteObjectRequest::source_object].
3451    ///
3452    /// # Example
3453    /// ```ignore,no_run
3454    /// # use google_cloud_storage::model::RewriteObjectRequest;
3455    /// let x = RewriteObjectRequest::new().set_source_object("example");
3456    /// ```
3457    pub fn set_source_object<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3458        self.source_object = v.into();
3459        self
3460    }
3461
3462    /// Sets the value of [source_generation][crate::model::RewriteObjectRequest::source_generation].
3463    ///
3464    /// # Example
3465    /// ```ignore,no_run
3466    /// # use google_cloud_storage::model::RewriteObjectRequest;
3467    /// let x = RewriteObjectRequest::new().set_source_generation(42);
3468    /// ```
3469    pub fn set_source_generation<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
3470        self.source_generation = v.into();
3471        self
3472    }
3473
3474    /// Sets the value of [rewrite_token][crate::model::RewriteObjectRequest::rewrite_token].
3475    ///
3476    /// # Example
3477    /// ```ignore,no_run
3478    /// # use google_cloud_storage::model::RewriteObjectRequest;
3479    /// let x = RewriteObjectRequest::new().set_rewrite_token("example");
3480    /// ```
3481    pub fn set_rewrite_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3482        self.rewrite_token = v.into();
3483        self
3484    }
3485
3486    /// Sets the value of [destination_predefined_acl][crate::model::RewriteObjectRequest::destination_predefined_acl].
3487    ///
3488    /// # Example
3489    /// ```ignore,no_run
3490    /// # use google_cloud_storage::model::RewriteObjectRequest;
3491    /// let x = RewriteObjectRequest::new().set_destination_predefined_acl("example");
3492    /// ```
3493    pub fn set_destination_predefined_acl<T: std::convert::Into<std::string::String>>(
3494        mut self,
3495        v: T,
3496    ) -> Self {
3497        self.destination_predefined_acl = v.into();
3498        self
3499    }
3500
3501    /// Sets the value of [if_generation_match][crate::model::RewriteObjectRequest::if_generation_match].
3502    ///
3503    /// # Example
3504    /// ```ignore,no_run
3505    /// # use google_cloud_storage::model::RewriteObjectRequest;
3506    /// let x = RewriteObjectRequest::new().set_if_generation_match(42);
3507    /// ```
3508    pub fn set_if_generation_match<T>(mut self, v: T) -> Self
3509    where
3510        T: std::convert::Into<i64>,
3511    {
3512        self.if_generation_match = std::option::Option::Some(v.into());
3513        self
3514    }
3515
3516    /// Sets or clears the value of [if_generation_match][crate::model::RewriteObjectRequest::if_generation_match].
3517    ///
3518    /// # Example
3519    /// ```ignore,no_run
3520    /// # use google_cloud_storage::model::RewriteObjectRequest;
3521    /// let x = RewriteObjectRequest::new().set_or_clear_if_generation_match(Some(42));
3522    /// let x = RewriteObjectRequest::new().set_or_clear_if_generation_match(None::<i32>);
3523    /// ```
3524    pub fn set_or_clear_if_generation_match<T>(mut self, v: std::option::Option<T>) -> Self
3525    where
3526        T: std::convert::Into<i64>,
3527    {
3528        self.if_generation_match = v.map(|x| x.into());
3529        self
3530    }
3531
3532    /// Sets the value of [if_generation_not_match][crate::model::RewriteObjectRequest::if_generation_not_match].
3533    ///
3534    /// # Example
3535    /// ```ignore,no_run
3536    /// # use google_cloud_storage::model::RewriteObjectRequest;
3537    /// let x = RewriteObjectRequest::new().set_if_generation_not_match(42);
3538    /// ```
3539    pub fn set_if_generation_not_match<T>(mut self, v: T) -> Self
3540    where
3541        T: std::convert::Into<i64>,
3542    {
3543        self.if_generation_not_match = std::option::Option::Some(v.into());
3544        self
3545    }
3546
3547    /// Sets or clears the value of [if_generation_not_match][crate::model::RewriteObjectRequest::if_generation_not_match].
3548    ///
3549    /// # Example
3550    /// ```ignore,no_run
3551    /// # use google_cloud_storage::model::RewriteObjectRequest;
3552    /// let x = RewriteObjectRequest::new().set_or_clear_if_generation_not_match(Some(42));
3553    /// let x = RewriteObjectRequest::new().set_or_clear_if_generation_not_match(None::<i32>);
3554    /// ```
3555    pub fn set_or_clear_if_generation_not_match<T>(mut self, v: std::option::Option<T>) -> Self
3556    where
3557        T: std::convert::Into<i64>,
3558    {
3559        self.if_generation_not_match = v.map(|x| x.into());
3560        self
3561    }
3562
3563    /// Sets the value of [if_metageneration_match][crate::model::RewriteObjectRequest::if_metageneration_match].
3564    ///
3565    /// # Example
3566    /// ```ignore,no_run
3567    /// # use google_cloud_storage::model::RewriteObjectRequest;
3568    /// let x = RewriteObjectRequest::new().set_if_metageneration_match(42);
3569    /// ```
3570    pub fn set_if_metageneration_match<T>(mut self, v: T) -> Self
3571    where
3572        T: std::convert::Into<i64>,
3573    {
3574        self.if_metageneration_match = std::option::Option::Some(v.into());
3575        self
3576    }
3577
3578    /// Sets or clears the value of [if_metageneration_match][crate::model::RewriteObjectRequest::if_metageneration_match].
3579    ///
3580    /// # Example
3581    /// ```ignore,no_run
3582    /// # use google_cloud_storage::model::RewriteObjectRequest;
3583    /// let x = RewriteObjectRequest::new().set_or_clear_if_metageneration_match(Some(42));
3584    /// let x = RewriteObjectRequest::new().set_or_clear_if_metageneration_match(None::<i32>);
3585    /// ```
3586    pub fn set_or_clear_if_metageneration_match<T>(mut self, v: std::option::Option<T>) -> Self
3587    where
3588        T: std::convert::Into<i64>,
3589    {
3590        self.if_metageneration_match = v.map(|x| x.into());
3591        self
3592    }
3593
3594    /// Sets the value of [if_metageneration_not_match][crate::model::RewriteObjectRequest::if_metageneration_not_match].
3595    ///
3596    /// # Example
3597    /// ```ignore,no_run
3598    /// # use google_cloud_storage::model::RewriteObjectRequest;
3599    /// let x = RewriteObjectRequest::new().set_if_metageneration_not_match(42);
3600    /// ```
3601    pub fn set_if_metageneration_not_match<T>(mut self, v: T) -> Self
3602    where
3603        T: std::convert::Into<i64>,
3604    {
3605        self.if_metageneration_not_match = std::option::Option::Some(v.into());
3606        self
3607    }
3608
3609    /// Sets or clears the value of [if_metageneration_not_match][crate::model::RewriteObjectRequest::if_metageneration_not_match].
3610    ///
3611    /// # Example
3612    /// ```ignore,no_run
3613    /// # use google_cloud_storage::model::RewriteObjectRequest;
3614    /// let x = RewriteObjectRequest::new().set_or_clear_if_metageneration_not_match(Some(42));
3615    /// let x = RewriteObjectRequest::new().set_or_clear_if_metageneration_not_match(None::<i32>);
3616    /// ```
3617    pub fn set_or_clear_if_metageneration_not_match<T>(mut self, v: std::option::Option<T>) -> Self
3618    where
3619        T: std::convert::Into<i64>,
3620    {
3621        self.if_metageneration_not_match = v.map(|x| x.into());
3622        self
3623    }
3624
3625    /// Sets the value of [if_source_generation_match][crate::model::RewriteObjectRequest::if_source_generation_match].
3626    ///
3627    /// # Example
3628    /// ```ignore,no_run
3629    /// # use google_cloud_storage::model::RewriteObjectRequest;
3630    /// let x = RewriteObjectRequest::new().set_if_source_generation_match(42);
3631    /// ```
3632    pub fn set_if_source_generation_match<T>(mut self, v: T) -> Self
3633    where
3634        T: std::convert::Into<i64>,
3635    {
3636        self.if_source_generation_match = std::option::Option::Some(v.into());
3637        self
3638    }
3639
3640    /// Sets or clears the value of [if_source_generation_match][crate::model::RewriteObjectRequest::if_source_generation_match].
3641    ///
3642    /// # Example
3643    /// ```ignore,no_run
3644    /// # use google_cloud_storage::model::RewriteObjectRequest;
3645    /// let x = RewriteObjectRequest::new().set_or_clear_if_source_generation_match(Some(42));
3646    /// let x = RewriteObjectRequest::new().set_or_clear_if_source_generation_match(None::<i32>);
3647    /// ```
3648    pub fn set_or_clear_if_source_generation_match<T>(mut self, v: std::option::Option<T>) -> Self
3649    where
3650        T: std::convert::Into<i64>,
3651    {
3652        self.if_source_generation_match = v.map(|x| x.into());
3653        self
3654    }
3655
3656    /// Sets the value of [if_source_generation_not_match][crate::model::RewriteObjectRequest::if_source_generation_not_match].
3657    ///
3658    /// # Example
3659    /// ```ignore,no_run
3660    /// # use google_cloud_storage::model::RewriteObjectRequest;
3661    /// let x = RewriteObjectRequest::new().set_if_source_generation_not_match(42);
3662    /// ```
3663    pub fn set_if_source_generation_not_match<T>(mut self, v: T) -> Self
3664    where
3665        T: std::convert::Into<i64>,
3666    {
3667        self.if_source_generation_not_match = std::option::Option::Some(v.into());
3668        self
3669    }
3670
3671    /// Sets or clears the value of [if_source_generation_not_match][crate::model::RewriteObjectRequest::if_source_generation_not_match].
3672    ///
3673    /// # Example
3674    /// ```ignore,no_run
3675    /// # use google_cloud_storage::model::RewriteObjectRequest;
3676    /// let x = RewriteObjectRequest::new().set_or_clear_if_source_generation_not_match(Some(42));
3677    /// let x = RewriteObjectRequest::new().set_or_clear_if_source_generation_not_match(None::<i32>);
3678    /// ```
3679    pub fn set_or_clear_if_source_generation_not_match<T>(
3680        mut self,
3681        v: std::option::Option<T>,
3682    ) -> Self
3683    where
3684        T: std::convert::Into<i64>,
3685    {
3686        self.if_source_generation_not_match = v.map(|x| x.into());
3687        self
3688    }
3689
3690    /// Sets the value of [if_source_metageneration_match][crate::model::RewriteObjectRequest::if_source_metageneration_match].
3691    ///
3692    /// # Example
3693    /// ```ignore,no_run
3694    /// # use google_cloud_storage::model::RewriteObjectRequest;
3695    /// let x = RewriteObjectRequest::new().set_if_source_metageneration_match(42);
3696    /// ```
3697    pub fn set_if_source_metageneration_match<T>(mut self, v: T) -> Self
3698    where
3699        T: std::convert::Into<i64>,
3700    {
3701        self.if_source_metageneration_match = std::option::Option::Some(v.into());
3702        self
3703    }
3704
3705    /// Sets or clears the value of [if_source_metageneration_match][crate::model::RewriteObjectRequest::if_source_metageneration_match].
3706    ///
3707    /// # Example
3708    /// ```ignore,no_run
3709    /// # use google_cloud_storage::model::RewriteObjectRequest;
3710    /// let x = RewriteObjectRequest::new().set_or_clear_if_source_metageneration_match(Some(42));
3711    /// let x = RewriteObjectRequest::new().set_or_clear_if_source_metageneration_match(None::<i32>);
3712    /// ```
3713    pub fn set_or_clear_if_source_metageneration_match<T>(
3714        mut self,
3715        v: std::option::Option<T>,
3716    ) -> Self
3717    where
3718        T: std::convert::Into<i64>,
3719    {
3720        self.if_source_metageneration_match = v.map(|x| x.into());
3721        self
3722    }
3723
3724    /// Sets the value of [if_source_metageneration_not_match][crate::model::RewriteObjectRequest::if_source_metageneration_not_match].
3725    ///
3726    /// # Example
3727    /// ```ignore,no_run
3728    /// # use google_cloud_storage::model::RewriteObjectRequest;
3729    /// let x = RewriteObjectRequest::new().set_if_source_metageneration_not_match(42);
3730    /// ```
3731    pub fn set_if_source_metageneration_not_match<T>(mut self, v: T) -> Self
3732    where
3733        T: std::convert::Into<i64>,
3734    {
3735        self.if_source_metageneration_not_match = std::option::Option::Some(v.into());
3736        self
3737    }
3738
3739    /// Sets or clears the value of [if_source_metageneration_not_match][crate::model::RewriteObjectRequest::if_source_metageneration_not_match].
3740    ///
3741    /// # Example
3742    /// ```ignore,no_run
3743    /// # use google_cloud_storage::model::RewriteObjectRequest;
3744    /// let x = RewriteObjectRequest::new().set_or_clear_if_source_metageneration_not_match(Some(42));
3745    /// let x = RewriteObjectRequest::new().set_or_clear_if_source_metageneration_not_match(None::<i32>);
3746    /// ```
3747    pub fn set_or_clear_if_source_metageneration_not_match<T>(
3748        mut self,
3749        v: std::option::Option<T>,
3750    ) -> Self
3751    where
3752        T: std::convert::Into<i64>,
3753    {
3754        self.if_source_metageneration_not_match = v.map(|x| x.into());
3755        self
3756    }
3757
3758    /// Sets the value of [max_bytes_rewritten_per_call][crate::model::RewriteObjectRequest::max_bytes_rewritten_per_call].
3759    ///
3760    /// # Example
3761    /// ```ignore,no_run
3762    /// # use google_cloud_storage::model::RewriteObjectRequest;
3763    /// let x = RewriteObjectRequest::new().set_max_bytes_rewritten_per_call(42);
3764    /// ```
3765    pub fn set_max_bytes_rewritten_per_call<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
3766        self.max_bytes_rewritten_per_call = v.into();
3767        self
3768    }
3769
3770    /// Sets the value of [copy_source_encryption_algorithm][crate::model::RewriteObjectRequest::copy_source_encryption_algorithm].
3771    ///
3772    /// # Example
3773    /// ```ignore,no_run
3774    /// # use google_cloud_storage::model::RewriteObjectRequest;
3775    /// let x = RewriteObjectRequest::new().set_copy_source_encryption_algorithm("example");
3776    /// ```
3777    pub fn set_copy_source_encryption_algorithm<T: std::convert::Into<std::string::String>>(
3778        mut self,
3779        v: T,
3780    ) -> Self {
3781        self.copy_source_encryption_algorithm = v.into();
3782        self
3783    }
3784
3785    /// Sets the value of [copy_source_encryption_key_bytes][crate::model::RewriteObjectRequest::copy_source_encryption_key_bytes].
3786    ///
3787    /// # Example
3788    /// ```ignore,no_run
3789    /// # use google_cloud_storage::model::RewriteObjectRequest;
3790    /// let x = RewriteObjectRequest::new().set_copy_source_encryption_key_bytes(bytes::Bytes::from_static(b"example"));
3791    /// ```
3792    pub fn set_copy_source_encryption_key_bytes<T: std::convert::Into<::bytes::Bytes>>(
3793        mut self,
3794        v: T,
3795    ) -> Self {
3796        self.copy_source_encryption_key_bytes = v.into();
3797        self
3798    }
3799
3800    /// Sets the value of [copy_source_encryption_key_sha256_bytes][crate::model::RewriteObjectRequest::copy_source_encryption_key_sha256_bytes].
3801    ///
3802    /// # Example
3803    /// ```ignore,no_run
3804    /// # use google_cloud_storage::model::RewriteObjectRequest;
3805    /// let x = RewriteObjectRequest::new().set_copy_source_encryption_key_sha256_bytes(bytes::Bytes::from_static(b"example"));
3806    /// ```
3807    pub fn set_copy_source_encryption_key_sha256_bytes<T: std::convert::Into<::bytes::Bytes>>(
3808        mut self,
3809        v: T,
3810    ) -> Self {
3811        self.copy_source_encryption_key_sha256_bytes = v.into();
3812        self
3813    }
3814
3815    /// Sets the value of [common_object_request_params][crate::model::RewriteObjectRequest::common_object_request_params].
3816    ///
3817    /// # Example
3818    /// ```ignore,no_run
3819    /// # use google_cloud_storage::model::RewriteObjectRequest;
3820    /// use google_cloud_storage::model::CommonObjectRequestParams;
3821    /// let x = RewriteObjectRequest::new().set_common_object_request_params(CommonObjectRequestParams::default()/* use setters */);
3822    /// ```
3823    pub fn set_common_object_request_params<T>(mut self, v: T) -> Self
3824    where
3825        T: std::convert::Into<crate::model::CommonObjectRequestParams>,
3826    {
3827        self.common_object_request_params = std::option::Option::Some(v.into());
3828        self
3829    }
3830
3831    /// Sets or clears the value of [common_object_request_params][crate::model::RewriteObjectRequest::common_object_request_params].
3832    ///
3833    /// # Example
3834    /// ```ignore,no_run
3835    /// # use google_cloud_storage::model::RewriteObjectRequest;
3836    /// use google_cloud_storage::model::CommonObjectRequestParams;
3837    /// let x = RewriteObjectRequest::new().set_or_clear_common_object_request_params(Some(CommonObjectRequestParams::default()/* use setters */));
3838    /// let x = RewriteObjectRequest::new().set_or_clear_common_object_request_params(None::<CommonObjectRequestParams>);
3839    /// ```
3840    pub fn set_or_clear_common_object_request_params<T>(mut self, v: std::option::Option<T>) -> Self
3841    where
3842        T: std::convert::Into<crate::model::CommonObjectRequestParams>,
3843    {
3844        self.common_object_request_params = v.map(|x| x.into());
3845        self
3846    }
3847
3848    /// Sets the value of [object_checksums][crate::model::RewriteObjectRequest::object_checksums].
3849    ///
3850    /// # Example
3851    /// ```ignore,no_run
3852    /// # use google_cloud_storage::model::RewriteObjectRequest;
3853    /// use google_cloud_storage::model::ObjectChecksums;
3854    /// let x = RewriteObjectRequest::new().set_object_checksums(ObjectChecksums::default()/* use setters */);
3855    /// ```
3856    pub fn set_object_checksums<T>(mut self, v: T) -> Self
3857    where
3858        T: std::convert::Into<crate::model::ObjectChecksums>,
3859    {
3860        self.object_checksums = std::option::Option::Some(v.into());
3861        self
3862    }
3863
3864    /// Sets or clears the value of [object_checksums][crate::model::RewriteObjectRequest::object_checksums].
3865    ///
3866    /// # Example
3867    /// ```ignore,no_run
3868    /// # use google_cloud_storage::model::RewriteObjectRequest;
3869    /// use google_cloud_storage::model::ObjectChecksums;
3870    /// let x = RewriteObjectRequest::new().set_or_clear_object_checksums(Some(ObjectChecksums::default()/* use setters */));
3871    /// let x = RewriteObjectRequest::new().set_or_clear_object_checksums(None::<ObjectChecksums>);
3872    /// ```
3873    pub fn set_or_clear_object_checksums<T>(mut self, v: std::option::Option<T>) -> Self
3874    where
3875        T: std::convert::Into<crate::model::ObjectChecksums>,
3876    {
3877        self.object_checksums = v.map(|x| x.into());
3878        self
3879    }
3880}
3881
3882impl wkt::message::Message for RewriteObjectRequest {
3883    fn typename() -> &'static str {
3884        "type.googleapis.com/google.storage.v2.RewriteObjectRequest"
3885    }
3886}
3887
3888/// A rewrite response.
3889#[derive(Clone, Default, PartialEq)]
3890#[non_exhaustive]
3891pub struct RewriteResponse {
3892    /// The total bytes written so far, which can be used to provide a waiting user
3893    /// with a progress indicator. This property is always present in the response.
3894    pub total_bytes_rewritten: i64,
3895
3896    /// The total size of the object being copied in bytes. This property is always
3897    /// present in the response.
3898    pub object_size: i64,
3899
3900    /// `true` if the copy is finished; otherwise, `false` if
3901    /// the copy is in progress. This property is always present in the response.
3902    pub done: bool,
3903
3904    /// A token to use in subsequent requests to continue copying data. This token
3905    /// is present in the response only when there is more data to copy.
3906    pub rewrite_token: std::string::String,
3907
3908    /// A resource containing the metadata for the copied-to object. This property
3909    /// is present in the response only when copying completes.
3910    pub resource: std::option::Option<crate::model::Object>,
3911
3912    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3913}
3914
3915impl RewriteResponse {
3916    /// Creates a new default instance.
3917    pub fn new() -> Self {
3918        std::default::Default::default()
3919    }
3920
3921    /// Sets the value of [total_bytes_rewritten][crate::model::RewriteResponse::total_bytes_rewritten].
3922    ///
3923    /// # Example
3924    /// ```ignore,no_run
3925    /// # use google_cloud_storage::model::RewriteResponse;
3926    /// let x = RewriteResponse::new().set_total_bytes_rewritten(42);
3927    /// ```
3928    pub fn set_total_bytes_rewritten<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
3929        self.total_bytes_rewritten = v.into();
3930        self
3931    }
3932
3933    /// Sets the value of [object_size][crate::model::RewriteResponse::object_size].
3934    ///
3935    /// # Example
3936    /// ```ignore,no_run
3937    /// # use google_cloud_storage::model::RewriteResponse;
3938    /// let x = RewriteResponse::new().set_object_size(42);
3939    /// ```
3940    pub fn set_object_size<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
3941        self.object_size = v.into();
3942        self
3943    }
3944
3945    /// Sets the value of [done][crate::model::RewriteResponse::done].
3946    ///
3947    /// # Example
3948    /// ```ignore,no_run
3949    /// # use google_cloud_storage::model::RewriteResponse;
3950    /// let x = RewriteResponse::new().set_done(true);
3951    /// ```
3952    pub fn set_done<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
3953        self.done = v.into();
3954        self
3955    }
3956
3957    /// Sets the value of [rewrite_token][crate::model::RewriteResponse::rewrite_token].
3958    ///
3959    /// # Example
3960    /// ```ignore,no_run
3961    /// # use google_cloud_storage::model::RewriteResponse;
3962    /// let x = RewriteResponse::new().set_rewrite_token("example");
3963    /// ```
3964    pub fn set_rewrite_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3965        self.rewrite_token = v.into();
3966        self
3967    }
3968
3969    /// Sets the value of [resource][crate::model::RewriteResponse::resource].
3970    ///
3971    /// # Example
3972    /// ```ignore,no_run
3973    /// # use google_cloud_storage::model::RewriteResponse;
3974    /// use google_cloud_storage::model::Object;
3975    /// let x = RewriteResponse::new().set_resource(Object::default()/* use setters */);
3976    /// ```
3977    pub fn set_resource<T>(mut self, v: T) -> Self
3978    where
3979        T: std::convert::Into<crate::model::Object>,
3980    {
3981        self.resource = std::option::Option::Some(v.into());
3982        self
3983    }
3984
3985    /// Sets or clears the value of [resource][crate::model::RewriteResponse::resource].
3986    ///
3987    /// # Example
3988    /// ```ignore,no_run
3989    /// # use google_cloud_storage::model::RewriteResponse;
3990    /// use google_cloud_storage::model::Object;
3991    /// let x = RewriteResponse::new().set_or_clear_resource(Some(Object::default()/* use setters */));
3992    /// let x = RewriteResponse::new().set_or_clear_resource(None::<Object>);
3993    /// ```
3994    pub fn set_or_clear_resource<T>(mut self, v: std::option::Option<T>) -> Self
3995    where
3996        T: std::convert::Into<crate::model::Object>,
3997    {
3998        self.resource = v.map(|x| x.into());
3999        self
4000    }
4001}
4002
4003impl wkt::message::Message for RewriteResponse {
4004    fn typename() -> &'static str {
4005        "type.googleapis.com/google.storage.v2.RewriteResponse"
4006    }
4007}
4008
4009/// Request message for [MoveObject][google.storage.v2.Storage.MoveObject].
4010///
4011/// [google.storage.v2.Storage.MoveObject]: crate::client::StorageControl::move_object
4012#[derive(Clone, Default, PartialEq)]
4013#[non_exhaustive]
4014pub struct MoveObjectRequest {
4015    /// Required. Name of the bucket in which the object resides.
4016    pub bucket: std::string::String,
4017
4018    /// Required. Name of the source object.
4019    pub source_object: std::string::String,
4020
4021    /// Required. Name of the destination object.
4022    pub destination_object: std::string::String,
4023
4024    /// Optional. Makes the operation conditional on whether the source object's
4025    /// current generation matches the given value. `if_source_generation_match`
4026    /// and `if_source_generation_not_match` conditions are mutually exclusive:
4027    /// it's an error for both of them to be set in the request.
4028    pub if_source_generation_match: std::option::Option<i64>,
4029
4030    /// Optional. Makes the operation conditional on whether the source object's
4031    /// current generation does not match the given value.
4032    /// `if_source_generation_match` and `if_source_generation_not_match`
4033    /// conditions are mutually exclusive: it's an error for both of them to be set
4034    /// in the request.
4035    pub if_source_generation_not_match: std::option::Option<i64>,
4036
4037    /// Optional. Makes the operation conditional on whether the source object's
4038    /// current metageneration matches the given value.
4039    /// `if_source_metageneration_match` and `if_source_metageneration_not_match`
4040    /// conditions are mutually exclusive: it's an error for both of them to be set
4041    /// in the request.
4042    pub if_source_metageneration_match: std::option::Option<i64>,
4043
4044    /// Optional. Makes the operation conditional on whether the source object's
4045    /// current metageneration does not match the given value.
4046    /// `if_source_metageneration_match` and `if_source_metageneration_not_match`
4047    /// conditions are mutually exclusive: it's an error for both of them to be set
4048    /// in the request.
4049    pub if_source_metageneration_not_match: std::option::Option<i64>,
4050
4051    /// Optional. Makes the operation conditional on whether the destination
4052    /// object's current generation matches the given value. Setting to 0 makes the
4053    /// operation succeed only if there are no live versions of the object.
4054    /// `if_generation_match` and `if_generation_not_match` conditions are mutually
4055    /// exclusive: it's an error for both of them to be set in the request.
4056    pub if_generation_match: std::option::Option<i64>,
4057
4058    /// Optional. Makes the operation conditional on whether the destination
4059    /// object's current generation does not match the given value. If no live
4060    /// object exists, the precondition fails. Setting to 0 makes the operation
4061    /// succeed only if there is a live version of the object.
4062    /// `if_generation_match` and `if_generation_not_match` conditions are mutually
4063    /// exclusive: it's an error for both of them to be set in the request.
4064    pub if_generation_not_match: std::option::Option<i64>,
4065
4066    /// Optional. Makes the operation conditional on whether the destination
4067    /// object's current metageneration matches the given value.
4068    /// `if_metageneration_match` and `if_metageneration_not_match` conditions are
4069    /// mutually exclusive: it's an error for both of them to be set in the
4070    /// request.
4071    pub if_metageneration_match: std::option::Option<i64>,
4072
4073    /// Optional. Makes the operation conditional on whether the destination
4074    /// object's current metageneration does not match the given value.
4075    /// `if_metageneration_match` and `if_metageneration_not_match` conditions are
4076    /// mutually exclusive: it's an error for both of them to be set in the
4077    /// request.
4078    pub if_metageneration_not_match: std::option::Option<i64>,
4079
4080    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4081}
4082
4083impl MoveObjectRequest {
4084    /// Creates a new default instance.
4085    pub fn new() -> Self {
4086        std::default::Default::default()
4087    }
4088
4089    /// Sets the value of [bucket][crate::model::MoveObjectRequest::bucket].
4090    ///
4091    /// # Example
4092    /// ```ignore,no_run
4093    /// # use google_cloud_storage::model::MoveObjectRequest;
4094    /// # let project_id = "project_id";
4095    /// # let bucket_id = "bucket_id";
4096    /// let x = MoveObjectRequest::new().set_bucket(format!("projects/{project_id}/buckets/{bucket_id}"));
4097    /// ```
4098    pub fn set_bucket<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4099        self.bucket = v.into();
4100        self
4101    }
4102
4103    /// Sets the value of [source_object][crate::model::MoveObjectRequest::source_object].
4104    ///
4105    /// # Example
4106    /// ```ignore,no_run
4107    /// # use google_cloud_storage::model::MoveObjectRequest;
4108    /// let x = MoveObjectRequest::new().set_source_object("example");
4109    /// ```
4110    pub fn set_source_object<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4111        self.source_object = v.into();
4112        self
4113    }
4114
4115    /// Sets the value of [destination_object][crate::model::MoveObjectRequest::destination_object].
4116    ///
4117    /// # Example
4118    /// ```ignore,no_run
4119    /// # use google_cloud_storage::model::MoveObjectRequest;
4120    /// let x = MoveObjectRequest::new().set_destination_object("example");
4121    /// ```
4122    pub fn set_destination_object<T: std::convert::Into<std::string::String>>(
4123        mut self,
4124        v: T,
4125    ) -> Self {
4126        self.destination_object = v.into();
4127        self
4128    }
4129
4130    /// Sets the value of [if_source_generation_match][crate::model::MoveObjectRequest::if_source_generation_match].
4131    ///
4132    /// # Example
4133    /// ```ignore,no_run
4134    /// # use google_cloud_storage::model::MoveObjectRequest;
4135    /// let x = MoveObjectRequest::new().set_if_source_generation_match(42);
4136    /// ```
4137    pub fn set_if_source_generation_match<T>(mut self, v: T) -> Self
4138    where
4139        T: std::convert::Into<i64>,
4140    {
4141        self.if_source_generation_match = std::option::Option::Some(v.into());
4142        self
4143    }
4144
4145    /// Sets or clears the value of [if_source_generation_match][crate::model::MoveObjectRequest::if_source_generation_match].
4146    ///
4147    /// # Example
4148    /// ```ignore,no_run
4149    /// # use google_cloud_storage::model::MoveObjectRequest;
4150    /// let x = MoveObjectRequest::new().set_or_clear_if_source_generation_match(Some(42));
4151    /// let x = MoveObjectRequest::new().set_or_clear_if_source_generation_match(None::<i32>);
4152    /// ```
4153    pub fn set_or_clear_if_source_generation_match<T>(mut self, v: std::option::Option<T>) -> Self
4154    where
4155        T: std::convert::Into<i64>,
4156    {
4157        self.if_source_generation_match = v.map(|x| x.into());
4158        self
4159    }
4160
4161    /// Sets the value of [if_source_generation_not_match][crate::model::MoveObjectRequest::if_source_generation_not_match].
4162    ///
4163    /// # Example
4164    /// ```ignore,no_run
4165    /// # use google_cloud_storage::model::MoveObjectRequest;
4166    /// let x = MoveObjectRequest::new().set_if_source_generation_not_match(42);
4167    /// ```
4168    pub fn set_if_source_generation_not_match<T>(mut self, v: T) -> Self
4169    where
4170        T: std::convert::Into<i64>,
4171    {
4172        self.if_source_generation_not_match = std::option::Option::Some(v.into());
4173        self
4174    }
4175
4176    /// Sets or clears the value of [if_source_generation_not_match][crate::model::MoveObjectRequest::if_source_generation_not_match].
4177    ///
4178    /// # Example
4179    /// ```ignore,no_run
4180    /// # use google_cloud_storage::model::MoveObjectRequest;
4181    /// let x = MoveObjectRequest::new().set_or_clear_if_source_generation_not_match(Some(42));
4182    /// let x = MoveObjectRequest::new().set_or_clear_if_source_generation_not_match(None::<i32>);
4183    /// ```
4184    pub fn set_or_clear_if_source_generation_not_match<T>(
4185        mut self,
4186        v: std::option::Option<T>,
4187    ) -> Self
4188    where
4189        T: std::convert::Into<i64>,
4190    {
4191        self.if_source_generation_not_match = v.map(|x| x.into());
4192        self
4193    }
4194
4195    /// Sets the value of [if_source_metageneration_match][crate::model::MoveObjectRequest::if_source_metageneration_match].
4196    ///
4197    /// # Example
4198    /// ```ignore,no_run
4199    /// # use google_cloud_storage::model::MoveObjectRequest;
4200    /// let x = MoveObjectRequest::new().set_if_source_metageneration_match(42);
4201    /// ```
4202    pub fn set_if_source_metageneration_match<T>(mut self, v: T) -> Self
4203    where
4204        T: std::convert::Into<i64>,
4205    {
4206        self.if_source_metageneration_match = std::option::Option::Some(v.into());
4207        self
4208    }
4209
4210    /// Sets or clears the value of [if_source_metageneration_match][crate::model::MoveObjectRequest::if_source_metageneration_match].
4211    ///
4212    /// # Example
4213    /// ```ignore,no_run
4214    /// # use google_cloud_storage::model::MoveObjectRequest;
4215    /// let x = MoveObjectRequest::new().set_or_clear_if_source_metageneration_match(Some(42));
4216    /// let x = MoveObjectRequest::new().set_or_clear_if_source_metageneration_match(None::<i32>);
4217    /// ```
4218    pub fn set_or_clear_if_source_metageneration_match<T>(
4219        mut self,
4220        v: std::option::Option<T>,
4221    ) -> Self
4222    where
4223        T: std::convert::Into<i64>,
4224    {
4225        self.if_source_metageneration_match = v.map(|x| x.into());
4226        self
4227    }
4228
4229    /// Sets the value of [if_source_metageneration_not_match][crate::model::MoveObjectRequest::if_source_metageneration_not_match].
4230    ///
4231    /// # Example
4232    /// ```ignore,no_run
4233    /// # use google_cloud_storage::model::MoveObjectRequest;
4234    /// let x = MoveObjectRequest::new().set_if_source_metageneration_not_match(42);
4235    /// ```
4236    pub fn set_if_source_metageneration_not_match<T>(mut self, v: T) -> Self
4237    where
4238        T: std::convert::Into<i64>,
4239    {
4240        self.if_source_metageneration_not_match = std::option::Option::Some(v.into());
4241        self
4242    }
4243
4244    /// Sets or clears the value of [if_source_metageneration_not_match][crate::model::MoveObjectRequest::if_source_metageneration_not_match].
4245    ///
4246    /// # Example
4247    /// ```ignore,no_run
4248    /// # use google_cloud_storage::model::MoveObjectRequest;
4249    /// let x = MoveObjectRequest::new().set_or_clear_if_source_metageneration_not_match(Some(42));
4250    /// let x = MoveObjectRequest::new().set_or_clear_if_source_metageneration_not_match(None::<i32>);
4251    /// ```
4252    pub fn set_or_clear_if_source_metageneration_not_match<T>(
4253        mut self,
4254        v: std::option::Option<T>,
4255    ) -> Self
4256    where
4257        T: std::convert::Into<i64>,
4258    {
4259        self.if_source_metageneration_not_match = v.map(|x| x.into());
4260        self
4261    }
4262
4263    /// Sets the value of [if_generation_match][crate::model::MoveObjectRequest::if_generation_match].
4264    ///
4265    /// # Example
4266    /// ```ignore,no_run
4267    /// # use google_cloud_storage::model::MoveObjectRequest;
4268    /// let x = MoveObjectRequest::new().set_if_generation_match(42);
4269    /// ```
4270    pub fn set_if_generation_match<T>(mut self, v: T) -> Self
4271    where
4272        T: std::convert::Into<i64>,
4273    {
4274        self.if_generation_match = std::option::Option::Some(v.into());
4275        self
4276    }
4277
4278    /// Sets or clears the value of [if_generation_match][crate::model::MoveObjectRequest::if_generation_match].
4279    ///
4280    /// # Example
4281    /// ```ignore,no_run
4282    /// # use google_cloud_storage::model::MoveObjectRequest;
4283    /// let x = MoveObjectRequest::new().set_or_clear_if_generation_match(Some(42));
4284    /// let x = MoveObjectRequest::new().set_or_clear_if_generation_match(None::<i32>);
4285    /// ```
4286    pub fn set_or_clear_if_generation_match<T>(mut self, v: std::option::Option<T>) -> Self
4287    where
4288        T: std::convert::Into<i64>,
4289    {
4290        self.if_generation_match = v.map(|x| x.into());
4291        self
4292    }
4293
4294    /// Sets the value of [if_generation_not_match][crate::model::MoveObjectRequest::if_generation_not_match].
4295    ///
4296    /// # Example
4297    /// ```ignore,no_run
4298    /// # use google_cloud_storage::model::MoveObjectRequest;
4299    /// let x = MoveObjectRequest::new().set_if_generation_not_match(42);
4300    /// ```
4301    pub fn set_if_generation_not_match<T>(mut self, v: T) -> Self
4302    where
4303        T: std::convert::Into<i64>,
4304    {
4305        self.if_generation_not_match = std::option::Option::Some(v.into());
4306        self
4307    }
4308
4309    /// Sets or clears the value of [if_generation_not_match][crate::model::MoveObjectRequest::if_generation_not_match].
4310    ///
4311    /// # Example
4312    /// ```ignore,no_run
4313    /// # use google_cloud_storage::model::MoveObjectRequest;
4314    /// let x = MoveObjectRequest::new().set_or_clear_if_generation_not_match(Some(42));
4315    /// let x = MoveObjectRequest::new().set_or_clear_if_generation_not_match(None::<i32>);
4316    /// ```
4317    pub fn set_or_clear_if_generation_not_match<T>(mut self, v: std::option::Option<T>) -> Self
4318    where
4319        T: std::convert::Into<i64>,
4320    {
4321        self.if_generation_not_match = v.map(|x| x.into());
4322        self
4323    }
4324
4325    /// Sets the value of [if_metageneration_match][crate::model::MoveObjectRequest::if_metageneration_match].
4326    ///
4327    /// # Example
4328    /// ```ignore,no_run
4329    /// # use google_cloud_storage::model::MoveObjectRequest;
4330    /// let x = MoveObjectRequest::new().set_if_metageneration_match(42);
4331    /// ```
4332    pub fn set_if_metageneration_match<T>(mut self, v: T) -> Self
4333    where
4334        T: std::convert::Into<i64>,
4335    {
4336        self.if_metageneration_match = std::option::Option::Some(v.into());
4337        self
4338    }
4339
4340    /// Sets or clears the value of [if_metageneration_match][crate::model::MoveObjectRequest::if_metageneration_match].
4341    ///
4342    /// # Example
4343    /// ```ignore,no_run
4344    /// # use google_cloud_storage::model::MoveObjectRequest;
4345    /// let x = MoveObjectRequest::new().set_or_clear_if_metageneration_match(Some(42));
4346    /// let x = MoveObjectRequest::new().set_or_clear_if_metageneration_match(None::<i32>);
4347    /// ```
4348    pub fn set_or_clear_if_metageneration_match<T>(mut self, v: std::option::Option<T>) -> Self
4349    where
4350        T: std::convert::Into<i64>,
4351    {
4352        self.if_metageneration_match = v.map(|x| x.into());
4353        self
4354    }
4355
4356    /// Sets the value of [if_metageneration_not_match][crate::model::MoveObjectRequest::if_metageneration_not_match].
4357    ///
4358    /// # Example
4359    /// ```ignore,no_run
4360    /// # use google_cloud_storage::model::MoveObjectRequest;
4361    /// let x = MoveObjectRequest::new().set_if_metageneration_not_match(42);
4362    /// ```
4363    pub fn set_if_metageneration_not_match<T>(mut self, v: T) -> Self
4364    where
4365        T: std::convert::Into<i64>,
4366    {
4367        self.if_metageneration_not_match = std::option::Option::Some(v.into());
4368        self
4369    }
4370
4371    /// Sets or clears the value of [if_metageneration_not_match][crate::model::MoveObjectRequest::if_metageneration_not_match].
4372    ///
4373    /// # Example
4374    /// ```ignore,no_run
4375    /// # use google_cloud_storage::model::MoveObjectRequest;
4376    /// let x = MoveObjectRequest::new().set_or_clear_if_metageneration_not_match(Some(42));
4377    /// let x = MoveObjectRequest::new().set_or_clear_if_metageneration_not_match(None::<i32>);
4378    /// ```
4379    pub fn set_or_clear_if_metageneration_not_match<T>(mut self, v: std::option::Option<T>) -> Self
4380    where
4381        T: std::convert::Into<i64>,
4382    {
4383        self.if_metageneration_not_match = v.map(|x| x.into());
4384        self
4385    }
4386}
4387
4388impl wkt::message::Message for MoveObjectRequest {
4389    fn typename() -> &'static str {
4390        "type.googleapis.com/google.storage.v2.MoveObjectRequest"
4391    }
4392}
4393
4394/// Request message for [UpdateObject][google.storage.v2.Storage.UpdateObject].
4395///
4396/// [google.storage.v2.Storage.UpdateObject]: crate::client::StorageControl::update_object
4397#[derive(Clone, Default, PartialEq)]
4398#[non_exhaustive]
4399pub struct UpdateObjectRequest {
4400    /// Required. The object to update.
4401    /// The object's bucket and name fields are used to identify the object to
4402    /// update. If present, the object's generation field selects a specific
4403    /// revision of this object whose metadata should be updated. Otherwise,
4404    /// assumes the live version of the object.
4405    pub object: std::option::Option<crate::model::Object>,
4406
4407    /// Makes the operation conditional on whether the object's current generation
4408    /// matches the given value. Setting to 0 makes the operation succeed only if
4409    /// there are no live versions of the object.
4410    pub if_generation_match: std::option::Option<i64>,
4411
4412    /// Makes the operation conditional on whether the object's live generation
4413    /// does not match the given value. If no live object exists, the precondition
4414    /// fails. Setting to 0 makes the operation succeed only if there is a live
4415    /// version of the object.
4416    pub if_generation_not_match: std::option::Option<i64>,
4417
4418    /// Makes the operation conditional on whether the object's current
4419    /// metageneration matches the given value.
4420    pub if_metageneration_match: std::option::Option<i64>,
4421
4422    /// Makes the operation conditional on whether the object's current
4423    /// metageneration does not match the given value.
4424    pub if_metageneration_not_match: std::option::Option<i64>,
4425
4426    /// Optional. Apply a predefined set of access controls to this object.
4427    /// Valid values are "authenticatedRead", "bucketOwnerFullControl",
4428    /// "bucketOwnerRead", "private", "projectPrivate", or "publicRead".
4429    pub predefined_acl: std::string::String,
4430
4431    /// Required. List of fields to be updated.
4432    ///
4433    /// To specify ALL fields, equivalent to the JSON API's "update" function,
4434    /// specify a single field with the value `*`. Note: not recommended. If a new
4435    /// field is introduced at a later time, an older client updating with the `*`
4436    /// might accidentally reset the new field's value.
4437    ///
4438    /// Not specifying any fields is an error.
4439    pub update_mask: std::option::Option<wkt::FieldMask>,
4440
4441    /// Optional. A set of parameters common to Storage API requests concerning an
4442    /// object.
4443    pub common_object_request_params: std::option::Option<crate::model::CommonObjectRequestParams>,
4444
4445    /// Optional. Overrides the unlocked retention config on the object.
4446    pub override_unlocked_retention: bool,
4447
4448    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4449}
4450
4451impl UpdateObjectRequest {
4452    /// Creates a new default instance.
4453    pub fn new() -> Self {
4454        std::default::Default::default()
4455    }
4456
4457    /// Sets the value of [object][crate::model::UpdateObjectRequest::object].
4458    ///
4459    /// # Example
4460    /// ```ignore,no_run
4461    /// # use google_cloud_storage::model::UpdateObjectRequest;
4462    /// use google_cloud_storage::model::Object;
4463    /// let x = UpdateObjectRequest::new().set_object(Object::default()/* use setters */);
4464    /// ```
4465    pub fn set_object<T>(mut self, v: T) -> Self
4466    where
4467        T: std::convert::Into<crate::model::Object>,
4468    {
4469        self.object = std::option::Option::Some(v.into());
4470        self
4471    }
4472
4473    /// Sets or clears the value of [object][crate::model::UpdateObjectRequest::object].
4474    ///
4475    /// # Example
4476    /// ```ignore,no_run
4477    /// # use google_cloud_storage::model::UpdateObjectRequest;
4478    /// use google_cloud_storage::model::Object;
4479    /// let x = UpdateObjectRequest::new().set_or_clear_object(Some(Object::default()/* use setters */));
4480    /// let x = UpdateObjectRequest::new().set_or_clear_object(None::<Object>);
4481    /// ```
4482    pub fn set_or_clear_object<T>(mut self, v: std::option::Option<T>) -> Self
4483    where
4484        T: std::convert::Into<crate::model::Object>,
4485    {
4486        self.object = v.map(|x| x.into());
4487        self
4488    }
4489
4490    /// Sets the value of [if_generation_match][crate::model::UpdateObjectRequest::if_generation_match].
4491    ///
4492    /// # Example
4493    /// ```ignore,no_run
4494    /// # use google_cloud_storage::model::UpdateObjectRequest;
4495    /// let x = UpdateObjectRequest::new().set_if_generation_match(42);
4496    /// ```
4497    pub fn set_if_generation_match<T>(mut self, v: T) -> Self
4498    where
4499        T: std::convert::Into<i64>,
4500    {
4501        self.if_generation_match = std::option::Option::Some(v.into());
4502        self
4503    }
4504
4505    /// Sets or clears the value of [if_generation_match][crate::model::UpdateObjectRequest::if_generation_match].
4506    ///
4507    /// # Example
4508    /// ```ignore,no_run
4509    /// # use google_cloud_storage::model::UpdateObjectRequest;
4510    /// let x = UpdateObjectRequest::new().set_or_clear_if_generation_match(Some(42));
4511    /// let x = UpdateObjectRequest::new().set_or_clear_if_generation_match(None::<i32>);
4512    /// ```
4513    pub fn set_or_clear_if_generation_match<T>(mut self, v: std::option::Option<T>) -> Self
4514    where
4515        T: std::convert::Into<i64>,
4516    {
4517        self.if_generation_match = v.map(|x| x.into());
4518        self
4519    }
4520
4521    /// Sets the value of [if_generation_not_match][crate::model::UpdateObjectRequest::if_generation_not_match].
4522    ///
4523    /// # Example
4524    /// ```ignore,no_run
4525    /// # use google_cloud_storage::model::UpdateObjectRequest;
4526    /// let x = UpdateObjectRequest::new().set_if_generation_not_match(42);
4527    /// ```
4528    pub fn set_if_generation_not_match<T>(mut self, v: T) -> Self
4529    where
4530        T: std::convert::Into<i64>,
4531    {
4532        self.if_generation_not_match = std::option::Option::Some(v.into());
4533        self
4534    }
4535
4536    /// Sets or clears the value of [if_generation_not_match][crate::model::UpdateObjectRequest::if_generation_not_match].
4537    ///
4538    /// # Example
4539    /// ```ignore,no_run
4540    /// # use google_cloud_storage::model::UpdateObjectRequest;
4541    /// let x = UpdateObjectRequest::new().set_or_clear_if_generation_not_match(Some(42));
4542    /// let x = UpdateObjectRequest::new().set_or_clear_if_generation_not_match(None::<i32>);
4543    /// ```
4544    pub fn set_or_clear_if_generation_not_match<T>(mut self, v: std::option::Option<T>) -> Self
4545    where
4546        T: std::convert::Into<i64>,
4547    {
4548        self.if_generation_not_match = v.map(|x| x.into());
4549        self
4550    }
4551
4552    /// Sets the value of [if_metageneration_match][crate::model::UpdateObjectRequest::if_metageneration_match].
4553    ///
4554    /// # Example
4555    /// ```ignore,no_run
4556    /// # use google_cloud_storage::model::UpdateObjectRequest;
4557    /// let x = UpdateObjectRequest::new().set_if_metageneration_match(42);
4558    /// ```
4559    pub fn set_if_metageneration_match<T>(mut self, v: T) -> Self
4560    where
4561        T: std::convert::Into<i64>,
4562    {
4563        self.if_metageneration_match = std::option::Option::Some(v.into());
4564        self
4565    }
4566
4567    /// Sets or clears the value of [if_metageneration_match][crate::model::UpdateObjectRequest::if_metageneration_match].
4568    ///
4569    /// # Example
4570    /// ```ignore,no_run
4571    /// # use google_cloud_storage::model::UpdateObjectRequest;
4572    /// let x = UpdateObjectRequest::new().set_or_clear_if_metageneration_match(Some(42));
4573    /// let x = UpdateObjectRequest::new().set_or_clear_if_metageneration_match(None::<i32>);
4574    /// ```
4575    pub fn set_or_clear_if_metageneration_match<T>(mut self, v: std::option::Option<T>) -> Self
4576    where
4577        T: std::convert::Into<i64>,
4578    {
4579        self.if_metageneration_match = v.map(|x| x.into());
4580        self
4581    }
4582
4583    /// Sets the value of [if_metageneration_not_match][crate::model::UpdateObjectRequest::if_metageneration_not_match].
4584    ///
4585    /// # Example
4586    /// ```ignore,no_run
4587    /// # use google_cloud_storage::model::UpdateObjectRequest;
4588    /// let x = UpdateObjectRequest::new().set_if_metageneration_not_match(42);
4589    /// ```
4590    pub fn set_if_metageneration_not_match<T>(mut self, v: T) -> Self
4591    where
4592        T: std::convert::Into<i64>,
4593    {
4594        self.if_metageneration_not_match = std::option::Option::Some(v.into());
4595        self
4596    }
4597
4598    /// Sets or clears the value of [if_metageneration_not_match][crate::model::UpdateObjectRequest::if_metageneration_not_match].
4599    ///
4600    /// # Example
4601    /// ```ignore,no_run
4602    /// # use google_cloud_storage::model::UpdateObjectRequest;
4603    /// let x = UpdateObjectRequest::new().set_or_clear_if_metageneration_not_match(Some(42));
4604    /// let x = UpdateObjectRequest::new().set_or_clear_if_metageneration_not_match(None::<i32>);
4605    /// ```
4606    pub fn set_or_clear_if_metageneration_not_match<T>(mut self, v: std::option::Option<T>) -> Self
4607    where
4608        T: std::convert::Into<i64>,
4609    {
4610        self.if_metageneration_not_match = v.map(|x| x.into());
4611        self
4612    }
4613
4614    /// Sets the value of [predefined_acl][crate::model::UpdateObjectRequest::predefined_acl].
4615    ///
4616    /// # Example
4617    /// ```ignore,no_run
4618    /// # use google_cloud_storage::model::UpdateObjectRequest;
4619    /// let x = UpdateObjectRequest::new().set_predefined_acl("example");
4620    /// ```
4621    pub fn set_predefined_acl<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4622        self.predefined_acl = v.into();
4623        self
4624    }
4625
4626    /// Sets the value of [update_mask][crate::model::UpdateObjectRequest::update_mask].
4627    ///
4628    /// # Example
4629    /// ```ignore,no_run
4630    /// # use google_cloud_storage::model::UpdateObjectRequest;
4631    /// use wkt::FieldMask;
4632    /// let x = UpdateObjectRequest::new().set_update_mask(FieldMask::default()/* use setters */);
4633    /// ```
4634    pub fn set_update_mask<T>(mut self, v: T) -> Self
4635    where
4636        T: std::convert::Into<wkt::FieldMask>,
4637    {
4638        self.update_mask = std::option::Option::Some(v.into());
4639        self
4640    }
4641
4642    /// Sets or clears the value of [update_mask][crate::model::UpdateObjectRequest::update_mask].
4643    ///
4644    /// # Example
4645    /// ```ignore,no_run
4646    /// # use google_cloud_storage::model::UpdateObjectRequest;
4647    /// use wkt::FieldMask;
4648    /// let x = UpdateObjectRequest::new().set_or_clear_update_mask(Some(FieldMask::default()/* use setters */));
4649    /// let x = UpdateObjectRequest::new().set_or_clear_update_mask(None::<FieldMask>);
4650    /// ```
4651    pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
4652    where
4653        T: std::convert::Into<wkt::FieldMask>,
4654    {
4655        self.update_mask = v.map(|x| x.into());
4656        self
4657    }
4658
4659    /// Sets the value of [common_object_request_params][crate::model::UpdateObjectRequest::common_object_request_params].
4660    ///
4661    /// # Example
4662    /// ```ignore,no_run
4663    /// # use google_cloud_storage::model::UpdateObjectRequest;
4664    /// use google_cloud_storage::model::CommonObjectRequestParams;
4665    /// let x = UpdateObjectRequest::new().set_common_object_request_params(CommonObjectRequestParams::default()/* use setters */);
4666    /// ```
4667    pub fn set_common_object_request_params<T>(mut self, v: T) -> Self
4668    where
4669        T: std::convert::Into<crate::model::CommonObjectRequestParams>,
4670    {
4671        self.common_object_request_params = std::option::Option::Some(v.into());
4672        self
4673    }
4674
4675    /// Sets or clears the value of [common_object_request_params][crate::model::UpdateObjectRequest::common_object_request_params].
4676    ///
4677    /// # Example
4678    /// ```ignore,no_run
4679    /// # use google_cloud_storage::model::UpdateObjectRequest;
4680    /// use google_cloud_storage::model::CommonObjectRequestParams;
4681    /// let x = UpdateObjectRequest::new().set_or_clear_common_object_request_params(Some(CommonObjectRequestParams::default()/* use setters */));
4682    /// let x = UpdateObjectRequest::new().set_or_clear_common_object_request_params(None::<CommonObjectRequestParams>);
4683    /// ```
4684    pub fn set_or_clear_common_object_request_params<T>(mut self, v: std::option::Option<T>) -> Self
4685    where
4686        T: std::convert::Into<crate::model::CommonObjectRequestParams>,
4687    {
4688        self.common_object_request_params = v.map(|x| x.into());
4689        self
4690    }
4691
4692    /// Sets the value of [override_unlocked_retention][crate::model::UpdateObjectRequest::override_unlocked_retention].
4693    ///
4694    /// # Example
4695    /// ```ignore,no_run
4696    /// # use google_cloud_storage::model::UpdateObjectRequest;
4697    /// let x = UpdateObjectRequest::new().set_override_unlocked_retention(true);
4698    /// ```
4699    pub fn set_override_unlocked_retention<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
4700        self.override_unlocked_retention = v.into();
4701        self
4702    }
4703}
4704
4705impl wkt::message::Message for UpdateObjectRequest {
4706    fn typename() -> &'static str {
4707        "type.googleapis.com/google.storage.v2.UpdateObjectRequest"
4708    }
4709}
4710
4711/// Parameters that can be passed to any object request.
4712#[derive(Clone, Default, PartialEq)]
4713#[non_exhaustive]
4714pub struct CommonObjectRequestParams {
4715    /// Optional. Encryption algorithm used with the Customer-Supplied Encryption
4716    /// Keys feature.
4717    pub encryption_algorithm: std::string::String,
4718
4719    /// Optional. Encryption key used with the Customer-Supplied Encryption Keys
4720    /// feature. In raw bytes format (not base64-encoded).
4721    pub encryption_key_bytes: ::bytes::Bytes,
4722
4723    /// Optional. SHA256 hash of encryption key used with the Customer-supplied
4724    /// encryption keys feature.
4725    pub encryption_key_sha256_bytes: ::bytes::Bytes,
4726
4727    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4728}
4729
4730impl CommonObjectRequestParams {
4731    /// Creates a new default instance.
4732    pub fn new() -> Self {
4733        std::default::Default::default()
4734    }
4735
4736    /// Sets the value of [encryption_algorithm][crate::model::CommonObjectRequestParams::encryption_algorithm].
4737    ///
4738    /// # Example
4739    /// ```ignore,no_run
4740    /// # use google_cloud_storage::model::CommonObjectRequestParams;
4741    /// let x = CommonObjectRequestParams::new().set_encryption_algorithm("example");
4742    /// ```
4743    pub fn set_encryption_algorithm<T: std::convert::Into<std::string::String>>(
4744        mut self,
4745        v: T,
4746    ) -> Self {
4747        self.encryption_algorithm = v.into();
4748        self
4749    }
4750
4751    /// Sets the value of [encryption_key_bytes][crate::model::CommonObjectRequestParams::encryption_key_bytes].
4752    ///
4753    /// # Example
4754    /// ```ignore,no_run
4755    /// # use google_cloud_storage::model::CommonObjectRequestParams;
4756    /// let x = CommonObjectRequestParams::new().set_encryption_key_bytes(bytes::Bytes::from_static(b"example"));
4757    /// ```
4758    pub fn set_encryption_key_bytes<T: std::convert::Into<::bytes::Bytes>>(mut self, v: T) -> Self {
4759        self.encryption_key_bytes = v.into();
4760        self
4761    }
4762
4763    /// Sets the value of [encryption_key_sha256_bytes][crate::model::CommonObjectRequestParams::encryption_key_sha256_bytes].
4764    ///
4765    /// # Example
4766    /// ```ignore,no_run
4767    /// # use google_cloud_storage::model::CommonObjectRequestParams;
4768    /// let x = CommonObjectRequestParams::new().set_encryption_key_sha256_bytes(bytes::Bytes::from_static(b"example"));
4769    /// ```
4770    pub fn set_encryption_key_sha256_bytes<T: std::convert::Into<::bytes::Bytes>>(
4771        mut self,
4772        v: T,
4773    ) -> Self {
4774        self.encryption_key_sha256_bytes = v.into();
4775        self
4776    }
4777}
4778
4779impl wkt::message::Message for CommonObjectRequestParams {
4780    fn typename() -> &'static str {
4781        "type.googleapis.com/google.storage.v2.CommonObjectRequestParams"
4782    }
4783}
4784
4785/// A bucket.
4786#[derive(Clone, Default, PartialEq)]
4787#[non_exhaustive]
4788pub struct Bucket {
4789    /// Identifier. The name of the bucket.
4790    /// Format: `projects/{project}/buckets/{bucket}`
4791    pub name: std::string::String,
4792
4793    /// Output only. The user-chosen part of the bucket name. The `{bucket}`
4794    /// portion of the `name` field. For globally unique buckets, this is equal to
4795    /// the `bucket name` of other Cloud Storage APIs. Example: `pub`.
4796    pub bucket_id: std::string::String,
4797
4798    /// The etag of the bucket.
4799    /// If included in the metadata of an `UpdateBucketRequest`, the operation is
4800    /// only performed if the `etag` matches that of the bucket.
4801    pub etag: std::string::String,
4802
4803    /// Immutable. The project which owns this bucket, in the format of
4804    /// `projects/{projectIdentifier}`.
4805    /// `{projectIdentifier}` can be the project ID or project number.
4806    /// Output values are always in the project number format.
4807    pub project: std::string::String,
4808
4809    /// Output only. The metadata generation of this bucket.
4810    pub metageneration: i64,
4811
4812    /// Immutable. The location of the bucket. Object data for objects in the
4813    /// bucket resides in physical storage within this region.  Defaults to `US`.
4814    /// Attempting to update this field after the bucket is created results in an
4815    /// error.
4816    pub location: std::string::String,
4817
4818    /// Output only. The location type of the bucket (region, dual-region,
4819    /// multi-region, etc).
4820    pub location_type: std::string::String,
4821
4822    /// Optional. The bucket's default storage class, used whenever no storageClass
4823    /// is specified for a newly-created object. This defines how objects in the
4824    /// bucket are stored and determines the SLA and the cost of storage.
4825    /// If this value is not specified when the bucket is created, it defaults
4826    /// to `STANDARD`. For more information, see [Storage
4827    /// classes](https://developers.google.com/storage/docs/storage-classes).
4828    pub storage_class: std::string::String,
4829
4830    /// Optional. The recovery point objective for cross-region replication of the
4831    /// bucket. Applicable only for dual- and multi-region buckets. `DEFAULT` uses
4832    /// default replication. `ASYNC_TURBO` enables turbo replication, valid for
4833    /// dual-region buckets only. If rpo is not specified when the bucket is
4834    /// created, it defaults to `DEFAULT`. For more information, see [Turbo
4835    /// replication](https://cloud.google.com/storage/docs/availability-durability#turbo-replication).
4836    pub rpo: std::string::String,
4837
4838    /// Optional. Access controls on the bucket.
4839    /// If `iam_config.uniform_bucket_level_access` is enabled on this bucket,
4840    /// requests to set, read, or modify acl is an error.
4841    pub acl: std::vec::Vec<crate::model::BucketAccessControl>,
4842
4843    /// Optional. Default access controls to apply to new objects when no ACL is
4844    /// provided. If `iam_config.uniform_bucket_level_access` is enabled on this
4845    /// bucket, requests to set, read, or modify acl is an error.
4846    pub default_object_acl: std::vec::Vec<crate::model::ObjectAccessControl>,
4847
4848    /// Optional. The bucket's lifecycle configuration. See [Lifecycle
4849    /// Management](https://developers.google.com/storage/docs/lifecycle) for more
4850    /// information.
4851    pub lifecycle: std::option::Option<crate::model::bucket::Lifecycle>,
4852
4853    /// Output only. The creation time of the bucket.
4854    pub create_time: std::option::Option<wkt::Timestamp>,
4855
4856    /// Optional. The bucket's [CORS](https://www.w3.org/TR/cors/)
4857    /// configuration.
4858    pub cors: std::vec::Vec<crate::model::bucket::Cors>,
4859
4860    /// Output only. The modification time of the bucket.
4861    pub update_time: std::option::Option<wkt::Timestamp>,
4862
4863    /// Optional. The default value for event-based hold on newly created objects
4864    /// in this bucket.  Event-based hold is a way to retain objects indefinitely
4865    /// until an event occurs, signified by the hold's release. After being
4866    /// released, such objects are subject to bucket-level retention (if any).  One
4867    /// sample use case of this flag is for banks to hold loan documents for at
4868    /// least 3 years after loan is paid in full. Here, bucket-level retention is 3
4869    /// years and the event is loan being paid in full. In this example, these
4870    /// objects are held intact for any number of years until the event has
4871    /// occurred (event-based hold on the object is released) and then 3 more years
4872    /// after that. That means retention duration of the objects begins from the
4873    /// moment event-based hold transitioned from true to false.  Objects under
4874    /// event-based hold cannot be deleted, overwritten or archived until the hold
4875    /// is removed.
4876    pub default_event_based_hold: bool,
4877
4878    /// Optional. User-provided labels, in key/value pairs.
4879    pub labels: std::collections::HashMap<std::string::String, std::string::String>,
4880
4881    /// Optional. The bucket's website config, controlling how the service behaves
4882    /// when accessing bucket contents as a web site. See the [Static website
4883    /// examples](https://cloud.google.com/storage/docs/static-website) for more
4884    /// information.
4885    pub website: std::option::Option<crate::model::bucket::Website>,
4886
4887    /// Optional. The bucket's versioning configuration.
4888    pub versioning: std::option::Option<crate::model::bucket::Versioning>,
4889
4890    /// Optional. The bucket's logging config, which defines the destination bucket
4891    /// and name prefix (if any) for the current bucket's logs.
4892    pub logging: std::option::Option<crate::model::bucket::Logging>,
4893
4894    /// Output only. The owner of the bucket. This is always the project team's
4895    /// owner group.
4896    pub owner: std::option::Option<crate::model::Owner>,
4897
4898    /// Optional. Encryption config for a bucket.
4899    pub encryption: std::option::Option<crate::model::bucket::Encryption>,
4900
4901    /// Optional. The bucket's billing configuration.
4902    pub billing: std::option::Option<crate::model::bucket::Billing>,
4903
4904    /// Optional. The bucket's retention policy. The retention policy enforces a
4905    /// minimum retention time for all objects contained in the bucket, based on
4906    /// their creation time. Any attempt to overwrite or delete objects younger
4907    /// than the retention period results in a `PERMISSION_DENIED` error.  An
4908    /// unlocked retention policy can be modified or removed from the bucket via a
4909    /// storage.buckets.update operation. A locked retention policy cannot be
4910    /// removed or shortened in duration for the lifetime of the bucket.
4911    /// Attempting to remove or decrease period of a locked retention policy
4912    /// results in a `PERMISSION_DENIED` error.
4913    pub retention_policy: std::option::Option<crate::model::bucket::RetentionPolicy>,
4914
4915    /// Optional. The bucket's IAM configuration.
4916    pub iam_config: std::option::Option<crate::model::bucket::IamConfig>,
4917
4918    /// Optional. Reserved for future use.
4919    pub satisfies_pzs: bool,
4920
4921    /// Optional. Configuration that, if present, specifies the data placement for
4922    /// a [configurable
4923    /// dual-region](https://cloud.google.com/storage/docs/locations#location-dr).
4924    pub custom_placement_config: std::option::Option<crate::model::bucket::CustomPlacementConfig>,
4925
4926    /// Optional. The bucket's Autoclass configuration. If there is no
4927    /// configuration, the Autoclass feature is disabled and has no effect on the
4928    /// bucket.
4929    pub autoclass: std::option::Option<crate::model::bucket::Autoclass>,
4930
4931    /// Optional. The bucket's hierarchical namespace configuration. If there is no
4932    /// configuration, the hierarchical namespace feature is disabled and has
4933    /// no effect on the bucket.
4934    pub hierarchical_namespace: std::option::Option<crate::model::bucket::HierarchicalNamespace>,
4935
4936    /// Optional. The bucket's soft delete policy. The soft delete policy prevents
4937    /// soft-deleted objects from being permanently deleted.
4938    pub soft_delete_policy: std::option::Option<crate::model::bucket::SoftDeletePolicy>,
4939
4940    /// Optional. The bucket's object retention configuration. Must be enabled
4941    /// before objects in the bucket might have retention configured.
4942    pub object_retention: std::option::Option<crate::model::bucket::ObjectRetention>,
4943
4944    /// Optional. The bucket's IP filter configuration.
4945    pub ip_filter: std::option::Option<crate::model::bucket::IpFilter>,
4946
4947    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4948}
4949
4950impl Bucket {
4951    /// Creates a new default instance.
4952    pub fn new() -> Self {
4953        std::default::Default::default()
4954    }
4955
4956    /// Sets the value of [name][crate::model::Bucket::name].
4957    ///
4958    /// # Example
4959    /// ```ignore,no_run
4960    /// # use google_cloud_storage::model::Bucket;
4961    /// # let project_id = "project_id";
4962    /// # let bucket_id = "bucket_id";
4963    /// let x = Bucket::new().set_name(format!("projects/{project_id}/buckets/{bucket_id}"));
4964    /// ```
4965    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4966        self.name = v.into();
4967        self
4968    }
4969
4970    /// Sets the value of [bucket_id][crate::model::Bucket::bucket_id].
4971    ///
4972    /// # Example
4973    /// ```ignore,no_run
4974    /// # use google_cloud_storage::model::Bucket;
4975    /// let x = Bucket::new().set_bucket_id("example");
4976    /// ```
4977    pub fn set_bucket_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4978        self.bucket_id = v.into();
4979        self
4980    }
4981
4982    /// Sets the value of [etag][crate::model::Bucket::etag].
4983    ///
4984    /// # Example
4985    /// ```ignore,no_run
4986    /// # use google_cloud_storage::model::Bucket;
4987    /// let x = Bucket::new().set_etag("example");
4988    /// ```
4989    pub fn set_etag<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4990        self.etag = v.into();
4991        self
4992    }
4993
4994    /// Sets the value of [project][crate::model::Bucket::project].
4995    ///
4996    /// # Example
4997    /// ```ignore,no_run
4998    /// # use google_cloud_storage::model::Bucket;
4999    /// let x = Bucket::new().set_project("example");
5000    /// ```
5001    pub fn set_project<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5002        self.project = v.into();
5003        self
5004    }
5005
5006    /// Sets the value of [metageneration][crate::model::Bucket::metageneration].
5007    ///
5008    /// # Example
5009    /// ```ignore,no_run
5010    /// # use google_cloud_storage::model::Bucket;
5011    /// let x = Bucket::new().set_metageneration(42);
5012    /// ```
5013    pub fn set_metageneration<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
5014        self.metageneration = v.into();
5015        self
5016    }
5017
5018    /// Sets the value of [location][crate::model::Bucket::location].
5019    ///
5020    /// # Example
5021    /// ```ignore,no_run
5022    /// # use google_cloud_storage::model::Bucket;
5023    /// let x = Bucket::new().set_location("example");
5024    /// ```
5025    pub fn set_location<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5026        self.location = v.into();
5027        self
5028    }
5029
5030    /// Sets the value of [location_type][crate::model::Bucket::location_type].
5031    ///
5032    /// # Example
5033    /// ```ignore,no_run
5034    /// # use google_cloud_storage::model::Bucket;
5035    /// let x = Bucket::new().set_location_type("example");
5036    /// ```
5037    pub fn set_location_type<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5038        self.location_type = v.into();
5039        self
5040    }
5041
5042    /// Sets the value of [storage_class][crate::model::Bucket::storage_class].
5043    ///
5044    /// # Example
5045    /// ```ignore,no_run
5046    /// # use google_cloud_storage::model::Bucket;
5047    /// let x = Bucket::new().set_storage_class("example");
5048    /// ```
5049    pub fn set_storage_class<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5050        self.storage_class = v.into();
5051        self
5052    }
5053
5054    /// Sets the value of [rpo][crate::model::Bucket::rpo].
5055    ///
5056    /// # Example
5057    /// ```ignore,no_run
5058    /// # use google_cloud_storage::model::Bucket;
5059    /// let x = Bucket::new().set_rpo("example");
5060    /// ```
5061    pub fn set_rpo<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5062        self.rpo = v.into();
5063        self
5064    }
5065
5066    /// Sets the value of [acl][crate::model::Bucket::acl].
5067    ///
5068    /// # Example
5069    /// ```ignore,no_run
5070    /// # use google_cloud_storage::model::Bucket;
5071    /// use google_cloud_storage::model::BucketAccessControl;
5072    /// let x = Bucket::new()
5073    ///     .set_acl([
5074    ///         BucketAccessControl::default()/* use setters */,
5075    ///         BucketAccessControl::default()/* use (different) setters */,
5076    ///     ]);
5077    /// ```
5078    pub fn set_acl<T, V>(mut self, v: T) -> Self
5079    where
5080        T: std::iter::IntoIterator<Item = V>,
5081        V: std::convert::Into<crate::model::BucketAccessControl>,
5082    {
5083        use std::iter::Iterator;
5084        self.acl = v.into_iter().map(|i| i.into()).collect();
5085        self
5086    }
5087
5088    /// Sets the value of [default_object_acl][crate::model::Bucket::default_object_acl].
5089    ///
5090    /// # Example
5091    /// ```ignore,no_run
5092    /// # use google_cloud_storage::model::Bucket;
5093    /// use google_cloud_storage::model::ObjectAccessControl;
5094    /// let x = Bucket::new()
5095    ///     .set_default_object_acl([
5096    ///         ObjectAccessControl::default()/* use setters */,
5097    ///         ObjectAccessControl::default()/* use (different) setters */,
5098    ///     ]);
5099    /// ```
5100    pub fn set_default_object_acl<T, V>(mut self, v: T) -> Self
5101    where
5102        T: std::iter::IntoIterator<Item = V>,
5103        V: std::convert::Into<crate::model::ObjectAccessControl>,
5104    {
5105        use std::iter::Iterator;
5106        self.default_object_acl = v.into_iter().map(|i| i.into()).collect();
5107        self
5108    }
5109
5110    /// Sets the value of [lifecycle][crate::model::Bucket::lifecycle].
5111    ///
5112    /// # Example
5113    /// ```ignore,no_run
5114    /// # use google_cloud_storage::model::Bucket;
5115    /// use google_cloud_storage::model::bucket::Lifecycle;
5116    /// let x = Bucket::new().set_lifecycle(Lifecycle::default()/* use setters */);
5117    /// ```
5118    pub fn set_lifecycle<T>(mut self, v: T) -> Self
5119    where
5120        T: std::convert::Into<crate::model::bucket::Lifecycle>,
5121    {
5122        self.lifecycle = std::option::Option::Some(v.into());
5123        self
5124    }
5125
5126    /// Sets or clears the value of [lifecycle][crate::model::Bucket::lifecycle].
5127    ///
5128    /// # Example
5129    /// ```ignore,no_run
5130    /// # use google_cloud_storage::model::Bucket;
5131    /// use google_cloud_storage::model::bucket::Lifecycle;
5132    /// let x = Bucket::new().set_or_clear_lifecycle(Some(Lifecycle::default()/* use setters */));
5133    /// let x = Bucket::new().set_or_clear_lifecycle(None::<Lifecycle>);
5134    /// ```
5135    pub fn set_or_clear_lifecycle<T>(mut self, v: std::option::Option<T>) -> Self
5136    where
5137        T: std::convert::Into<crate::model::bucket::Lifecycle>,
5138    {
5139        self.lifecycle = v.map(|x| x.into());
5140        self
5141    }
5142
5143    /// Sets the value of [create_time][crate::model::Bucket::create_time].
5144    ///
5145    /// # Example
5146    /// ```ignore,no_run
5147    /// # use google_cloud_storage::model::Bucket;
5148    /// use wkt::Timestamp;
5149    /// let x = Bucket::new().set_create_time(Timestamp::default()/* use setters */);
5150    /// ```
5151    pub fn set_create_time<T>(mut self, v: T) -> Self
5152    where
5153        T: std::convert::Into<wkt::Timestamp>,
5154    {
5155        self.create_time = std::option::Option::Some(v.into());
5156        self
5157    }
5158
5159    /// Sets or clears the value of [create_time][crate::model::Bucket::create_time].
5160    ///
5161    /// # Example
5162    /// ```ignore,no_run
5163    /// # use google_cloud_storage::model::Bucket;
5164    /// use wkt::Timestamp;
5165    /// let x = Bucket::new().set_or_clear_create_time(Some(Timestamp::default()/* use setters */));
5166    /// let x = Bucket::new().set_or_clear_create_time(None::<Timestamp>);
5167    /// ```
5168    pub fn set_or_clear_create_time<T>(mut self, v: std::option::Option<T>) -> Self
5169    where
5170        T: std::convert::Into<wkt::Timestamp>,
5171    {
5172        self.create_time = v.map(|x| x.into());
5173        self
5174    }
5175
5176    /// Sets the value of [cors][crate::model::Bucket::cors].
5177    ///
5178    /// # Example
5179    /// ```ignore,no_run
5180    /// # use google_cloud_storage::model::Bucket;
5181    /// use google_cloud_storage::model::bucket::Cors;
5182    /// let x = Bucket::new()
5183    ///     .set_cors([
5184    ///         Cors::default()/* use setters */,
5185    ///         Cors::default()/* use (different) setters */,
5186    ///     ]);
5187    /// ```
5188    pub fn set_cors<T, V>(mut self, v: T) -> Self
5189    where
5190        T: std::iter::IntoIterator<Item = V>,
5191        V: std::convert::Into<crate::model::bucket::Cors>,
5192    {
5193        use std::iter::Iterator;
5194        self.cors = v.into_iter().map(|i| i.into()).collect();
5195        self
5196    }
5197
5198    /// Sets the value of [update_time][crate::model::Bucket::update_time].
5199    ///
5200    /// # Example
5201    /// ```ignore,no_run
5202    /// # use google_cloud_storage::model::Bucket;
5203    /// use wkt::Timestamp;
5204    /// let x = Bucket::new().set_update_time(Timestamp::default()/* use setters */);
5205    /// ```
5206    pub fn set_update_time<T>(mut self, v: T) -> Self
5207    where
5208        T: std::convert::Into<wkt::Timestamp>,
5209    {
5210        self.update_time = std::option::Option::Some(v.into());
5211        self
5212    }
5213
5214    /// Sets or clears the value of [update_time][crate::model::Bucket::update_time].
5215    ///
5216    /// # Example
5217    /// ```ignore,no_run
5218    /// # use google_cloud_storage::model::Bucket;
5219    /// use wkt::Timestamp;
5220    /// let x = Bucket::new().set_or_clear_update_time(Some(Timestamp::default()/* use setters */));
5221    /// let x = Bucket::new().set_or_clear_update_time(None::<Timestamp>);
5222    /// ```
5223    pub fn set_or_clear_update_time<T>(mut self, v: std::option::Option<T>) -> Self
5224    where
5225        T: std::convert::Into<wkt::Timestamp>,
5226    {
5227        self.update_time = v.map(|x| x.into());
5228        self
5229    }
5230
5231    /// Sets the value of [default_event_based_hold][crate::model::Bucket::default_event_based_hold].
5232    ///
5233    /// # Example
5234    /// ```ignore,no_run
5235    /// # use google_cloud_storage::model::Bucket;
5236    /// let x = Bucket::new().set_default_event_based_hold(true);
5237    /// ```
5238    pub fn set_default_event_based_hold<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
5239        self.default_event_based_hold = v.into();
5240        self
5241    }
5242
5243    /// Sets the value of [labels][crate::model::Bucket::labels].
5244    ///
5245    /// # Example
5246    /// ```ignore,no_run
5247    /// # use google_cloud_storage::model::Bucket;
5248    /// let x = Bucket::new().set_labels([
5249    ///     ("key0", "abc"),
5250    ///     ("key1", "xyz"),
5251    /// ]);
5252    /// ```
5253    pub fn set_labels<T, K, V>(mut self, v: T) -> Self
5254    where
5255        T: std::iter::IntoIterator<Item = (K, V)>,
5256        K: std::convert::Into<std::string::String>,
5257        V: std::convert::Into<std::string::String>,
5258    {
5259        use std::iter::Iterator;
5260        self.labels = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
5261        self
5262    }
5263
5264    /// Sets the value of [website][crate::model::Bucket::website].
5265    ///
5266    /// # Example
5267    /// ```ignore,no_run
5268    /// # use google_cloud_storage::model::Bucket;
5269    /// use google_cloud_storage::model::bucket::Website;
5270    /// let x = Bucket::new().set_website(Website::default()/* use setters */);
5271    /// ```
5272    pub fn set_website<T>(mut self, v: T) -> Self
5273    where
5274        T: std::convert::Into<crate::model::bucket::Website>,
5275    {
5276        self.website = std::option::Option::Some(v.into());
5277        self
5278    }
5279
5280    /// Sets or clears the value of [website][crate::model::Bucket::website].
5281    ///
5282    /// # Example
5283    /// ```ignore,no_run
5284    /// # use google_cloud_storage::model::Bucket;
5285    /// use google_cloud_storage::model::bucket::Website;
5286    /// let x = Bucket::new().set_or_clear_website(Some(Website::default()/* use setters */));
5287    /// let x = Bucket::new().set_or_clear_website(None::<Website>);
5288    /// ```
5289    pub fn set_or_clear_website<T>(mut self, v: std::option::Option<T>) -> Self
5290    where
5291        T: std::convert::Into<crate::model::bucket::Website>,
5292    {
5293        self.website = v.map(|x| x.into());
5294        self
5295    }
5296
5297    /// Sets the value of [versioning][crate::model::Bucket::versioning].
5298    ///
5299    /// # Example
5300    /// ```ignore,no_run
5301    /// # use google_cloud_storage::model::Bucket;
5302    /// use google_cloud_storage::model::bucket::Versioning;
5303    /// let x = Bucket::new().set_versioning(Versioning::default()/* use setters */);
5304    /// ```
5305    pub fn set_versioning<T>(mut self, v: T) -> Self
5306    where
5307        T: std::convert::Into<crate::model::bucket::Versioning>,
5308    {
5309        self.versioning = std::option::Option::Some(v.into());
5310        self
5311    }
5312
5313    /// Sets or clears the value of [versioning][crate::model::Bucket::versioning].
5314    ///
5315    /// # Example
5316    /// ```ignore,no_run
5317    /// # use google_cloud_storage::model::Bucket;
5318    /// use google_cloud_storage::model::bucket::Versioning;
5319    /// let x = Bucket::new().set_or_clear_versioning(Some(Versioning::default()/* use setters */));
5320    /// let x = Bucket::new().set_or_clear_versioning(None::<Versioning>);
5321    /// ```
5322    pub fn set_or_clear_versioning<T>(mut self, v: std::option::Option<T>) -> Self
5323    where
5324        T: std::convert::Into<crate::model::bucket::Versioning>,
5325    {
5326        self.versioning = v.map(|x| x.into());
5327        self
5328    }
5329
5330    /// Sets the value of [logging][crate::model::Bucket::logging].
5331    ///
5332    /// # Example
5333    /// ```ignore,no_run
5334    /// # use google_cloud_storage::model::Bucket;
5335    /// use google_cloud_storage::model::bucket::Logging;
5336    /// let x = Bucket::new().set_logging(Logging::default()/* use setters */);
5337    /// ```
5338    pub fn set_logging<T>(mut self, v: T) -> Self
5339    where
5340        T: std::convert::Into<crate::model::bucket::Logging>,
5341    {
5342        self.logging = std::option::Option::Some(v.into());
5343        self
5344    }
5345
5346    /// Sets or clears the value of [logging][crate::model::Bucket::logging].
5347    ///
5348    /// # Example
5349    /// ```ignore,no_run
5350    /// # use google_cloud_storage::model::Bucket;
5351    /// use google_cloud_storage::model::bucket::Logging;
5352    /// let x = Bucket::new().set_or_clear_logging(Some(Logging::default()/* use setters */));
5353    /// let x = Bucket::new().set_or_clear_logging(None::<Logging>);
5354    /// ```
5355    pub fn set_or_clear_logging<T>(mut self, v: std::option::Option<T>) -> Self
5356    where
5357        T: std::convert::Into<crate::model::bucket::Logging>,
5358    {
5359        self.logging = v.map(|x| x.into());
5360        self
5361    }
5362
5363    /// Sets the value of [owner][crate::model::Bucket::owner].
5364    ///
5365    /// # Example
5366    /// ```ignore,no_run
5367    /// # use google_cloud_storage::model::Bucket;
5368    /// use google_cloud_storage::model::Owner;
5369    /// let x = Bucket::new().set_owner(Owner::default()/* use setters */);
5370    /// ```
5371    pub fn set_owner<T>(mut self, v: T) -> Self
5372    where
5373        T: std::convert::Into<crate::model::Owner>,
5374    {
5375        self.owner = std::option::Option::Some(v.into());
5376        self
5377    }
5378
5379    /// Sets or clears the value of [owner][crate::model::Bucket::owner].
5380    ///
5381    /// # Example
5382    /// ```ignore,no_run
5383    /// # use google_cloud_storage::model::Bucket;
5384    /// use google_cloud_storage::model::Owner;
5385    /// let x = Bucket::new().set_or_clear_owner(Some(Owner::default()/* use setters */));
5386    /// let x = Bucket::new().set_or_clear_owner(None::<Owner>);
5387    /// ```
5388    pub fn set_or_clear_owner<T>(mut self, v: std::option::Option<T>) -> Self
5389    where
5390        T: std::convert::Into<crate::model::Owner>,
5391    {
5392        self.owner = v.map(|x| x.into());
5393        self
5394    }
5395
5396    /// Sets the value of [encryption][crate::model::Bucket::encryption].
5397    ///
5398    /// # Example
5399    /// ```ignore,no_run
5400    /// # use google_cloud_storage::model::Bucket;
5401    /// use google_cloud_storage::model::bucket::Encryption;
5402    /// let x = Bucket::new().set_encryption(Encryption::default()/* use setters */);
5403    /// ```
5404    pub fn set_encryption<T>(mut self, v: T) -> Self
5405    where
5406        T: std::convert::Into<crate::model::bucket::Encryption>,
5407    {
5408        self.encryption = std::option::Option::Some(v.into());
5409        self
5410    }
5411
5412    /// Sets or clears the value of [encryption][crate::model::Bucket::encryption].
5413    ///
5414    /// # Example
5415    /// ```ignore,no_run
5416    /// # use google_cloud_storage::model::Bucket;
5417    /// use google_cloud_storage::model::bucket::Encryption;
5418    /// let x = Bucket::new().set_or_clear_encryption(Some(Encryption::default()/* use setters */));
5419    /// let x = Bucket::new().set_or_clear_encryption(None::<Encryption>);
5420    /// ```
5421    pub fn set_or_clear_encryption<T>(mut self, v: std::option::Option<T>) -> Self
5422    where
5423        T: std::convert::Into<crate::model::bucket::Encryption>,
5424    {
5425        self.encryption = v.map(|x| x.into());
5426        self
5427    }
5428
5429    /// Sets the value of [billing][crate::model::Bucket::billing].
5430    ///
5431    /// # Example
5432    /// ```ignore,no_run
5433    /// # use google_cloud_storage::model::Bucket;
5434    /// use google_cloud_storage::model::bucket::Billing;
5435    /// let x = Bucket::new().set_billing(Billing::default()/* use setters */);
5436    /// ```
5437    pub fn set_billing<T>(mut self, v: T) -> Self
5438    where
5439        T: std::convert::Into<crate::model::bucket::Billing>,
5440    {
5441        self.billing = std::option::Option::Some(v.into());
5442        self
5443    }
5444
5445    /// Sets or clears the value of [billing][crate::model::Bucket::billing].
5446    ///
5447    /// # Example
5448    /// ```ignore,no_run
5449    /// # use google_cloud_storage::model::Bucket;
5450    /// use google_cloud_storage::model::bucket::Billing;
5451    /// let x = Bucket::new().set_or_clear_billing(Some(Billing::default()/* use setters */));
5452    /// let x = Bucket::new().set_or_clear_billing(None::<Billing>);
5453    /// ```
5454    pub fn set_or_clear_billing<T>(mut self, v: std::option::Option<T>) -> Self
5455    where
5456        T: std::convert::Into<crate::model::bucket::Billing>,
5457    {
5458        self.billing = v.map(|x| x.into());
5459        self
5460    }
5461
5462    /// Sets the value of [retention_policy][crate::model::Bucket::retention_policy].
5463    ///
5464    /// # Example
5465    /// ```ignore,no_run
5466    /// # use google_cloud_storage::model::Bucket;
5467    /// use google_cloud_storage::model::bucket::RetentionPolicy;
5468    /// let x = Bucket::new().set_retention_policy(RetentionPolicy::default()/* use setters */);
5469    /// ```
5470    pub fn set_retention_policy<T>(mut self, v: T) -> Self
5471    where
5472        T: std::convert::Into<crate::model::bucket::RetentionPolicy>,
5473    {
5474        self.retention_policy = std::option::Option::Some(v.into());
5475        self
5476    }
5477
5478    /// Sets or clears the value of [retention_policy][crate::model::Bucket::retention_policy].
5479    ///
5480    /// # Example
5481    /// ```ignore,no_run
5482    /// # use google_cloud_storage::model::Bucket;
5483    /// use google_cloud_storage::model::bucket::RetentionPolicy;
5484    /// let x = Bucket::new().set_or_clear_retention_policy(Some(RetentionPolicy::default()/* use setters */));
5485    /// let x = Bucket::new().set_or_clear_retention_policy(None::<RetentionPolicy>);
5486    /// ```
5487    pub fn set_or_clear_retention_policy<T>(mut self, v: std::option::Option<T>) -> Self
5488    where
5489        T: std::convert::Into<crate::model::bucket::RetentionPolicy>,
5490    {
5491        self.retention_policy = v.map(|x| x.into());
5492        self
5493    }
5494
5495    /// Sets the value of [iam_config][crate::model::Bucket::iam_config].
5496    ///
5497    /// # Example
5498    /// ```ignore,no_run
5499    /// # use google_cloud_storage::model::Bucket;
5500    /// use google_cloud_storage::model::bucket::IamConfig;
5501    /// let x = Bucket::new().set_iam_config(IamConfig::default()/* use setters */);
5502    /// ```
5503    pub fn set_iam_config<T>(mut self, v: T) -> Self
5504    where
5505        T: std::convert::Into<crate::model::bucket::IamConfig>,
5506    {
5507        self.iam_config = std::option::Option::Some(v.into());
5508        self
5509    }
5510
5511    /// Sets or clears the value of [iam_config][crate::model::Bucket::iam_config].
5512    ///
5513    /// # Example
5514    /// ```ignore,no_run
5515    /// # use google_cloud_storage::model::Bucket;
5516    /// use google_cloud_storage::model::bucket::IamConfig;
5517    /// let x = Bucket::new().set_or_clear_iam_config(Some(IamConfig::default()/* use setters */));
5518    /// let x = Bucket::new().set_or_clear_iam_config(None::<IamConfig>);
5519    /// ```
5520    pub fn set_or_clear_iam_config<T>(mut self, v: std::option::Option<T>) -> Self
5521    where
5522        T: std::convert::Into<crate::model::bucket::IamConfig>,
5523    {
5524        self.iam_config = v.map(|x| x.into());
5525        self
5526    }
5527
5528    /// Sets the value of [satisfies_pzs][crate::model::Bucket::satisfies_pzs].
5529    ///
5530    /// # Example
5531    /// ```ignore,no_run
5532    /// # use google_cloud_storage::model::Bucket;
5533    /// let x = Bucket::new().set_satisfies_pzs(true);
5534    /// ```
5535    pub fn set_satisfies_pzs<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
5536        self.satisfies_pzs = v.into();
5537        self
5538    }
5539
5540    /// Sets the value of [custom_placement_config][crate::model::Bucket::custom_placement_config].
5541    ///
5542    /// # Example
5543    /// ```ignore,no_run
5544    /// # use google_cloud_storage::model::Bucket;
5545    /// use google_cloud_storage::model::bucket::CustomPlacementConfig;
5546    /// let x = Bucket::new().set_custom_placement_config(CustomPlacementConfig::default()/* use setters */);
5547    /// ```
5548    pub fn set_custom_placement_config<T>(mut self, v: T) -> Self
5549    where
5550        T: std::convert::Into<crate::model::bucket::CustomPlacementConfig>,
5551    {
5552        self.custom_placement_config = std::option::Option::Some(v.into());
5553        self
5554    }
5555
5556    /// Sets or clears the value of [custom_placement_config][crate::model::Bucket::custom_placement_config].
5557    ///
5558    /// # Example
5559    /// ```ignore,no_run
5560    /// # use google_cloud_storage::model::Bucket;
5561    /// use google_cloud_storage::model::bucket::CustomPlacementConfig;
5562    /// let x = Bucket::new().set_or_clear_custom_placement_config(Some(CustomPlacementConfig::default()/* use setters */));
5563    /// let x = Bucket::new().set_or_clear_custom_placement_config(None::<CustomPlacementConfig>);
5564    /// ```
5565    pub fn set_or_clear_custom_placement_config<T>(mut self, v: std::option::Option<T>) -> Self
5566    where
5567        T: std::convert::Into<crate::model::bucket::CustomPlacementConfig>,
5568    {
5569        self.custom_placement_config = v.map(|x| x.into());
5570        self
5571    }
5572
5573    /// Sets the value of [autoclass][crate::model::Bucket::autoclass].
5574    ///
5575    /// # Example
5576    /// ```ignore,no_run
5577    /// # use google_cloud_storage::model::Bucket;
5578    /// use google_cloud_storage::model::bucket::Autoclass;
5579    /// let x = Bucket::new().set_autoclass(Autoclass::default()/* use setters */);
5580    /// ```
5581    pub fn set_autoclass<T>(mut self, v: T) -> Self
5582    where
5583        T: std::convert::Into<crate::model::bucket::Autoclass>,
5584    {
5585        self.autoclass = std::option::Option::Some(v.into());
5586        self
5587    }
5588
5589    /// Sets or clears the value of [autoclass][crate::model::Bucket::autoclass].
5590    ///
5591    /// # Example
5592    /// ```ignore,no_run
5593    /// # use google_cloud_storage::model::Bucket;
5594    /// use google_cloud_storage::model::bucket::Autoclass;
5595    /// let x = Bucket::new().set_or_clear_autoclass(Some(Autoclass::default()/* use setters */));
5596    /// let x = Bucket::new().set_or_clear_autoclass(None::<Autoclass>);
5597    /// ```
5598    pub fn set_or_clear_autoclass<T>(mut self, v: std::option::Option<T>) -> Self
5599    where
5600        T: std::convert::Into<crate::model::bucket::Autoclass>,
5601    {
5602        self.autoclass = v.map(|x| x.into());
5603        self
5604    }
5605
5606    /// Sets the value of [hierarchical_namespace][crate::model::Bucket::hierarchical_namespace].
5607    ///
5608    /// # Example
5609    /// ```ignore,no_run
5610    /// # use google_cloud_storage::model::Bucket;
5611    /// use google_cloud_storage::model::bucket::HierarchicalNamespace;
5612    /// let x = Bucket::new().set_hierarchical_namespace(HierarchicalNamespace::default()/* use setters */);
5613    /// ```
5614    pub fn set_hierarchical_namespace<T>(mut self, v: T) -> Self
5615    where
5616        T: std::convert::Into<crate::model::bucket::HierarchicalNamespace>,
5617    {
5618        self.hierarchical_namespace = std::option::Option::Some(v.into());
5619        self
5620    }
5621
5622    /// Sets or clears the value of [hierarchical_namespace][crate::model::Bucket::hierarchical_namespace].
5623    ///
5624    /// # Example
5625    /// ```ignore,no_run
5626    /// # use google_cloud_storage::model::Bucket;
5627    /// use google_cloud_storage::model::bucket::HierarchicalNamespace;
5628    /// let x = Bucket::new().set_or_clear_hierarchical_namespace(Some(HierarchicalNamespace::default()/* use setters */));
5629    /// let x = Bucket::new().set_or_clear_hierarchical_namespace(None::<HierarchicalNamespace>);
5630    /// ```
5631    pub fn set_or_clear_hierarchical_namespace<T>(mut self, v: std::option::Option<T>) -> Self
5632    where
5633        T: std::convert::Into<crate::model::bucket::HierarchicalNamespace>,
5634    {
5635        self.hierarchical_namespace = v.map(|x| x.into());
5636        self
5637    }
5638
5639    /// Sets the value of [soft_delete_policy][crate::model::Bucket::soft_delete_policy].
5640    ///
5641    /// # Example
5642    /// ```ignore,no_run
5643    /// # use google_cloud_storage::model::Bucket;
5644    /// use google_cloud_storage::model::bucket::SoftDeletePolicy;
5645    /// let x = Bucket::new().set_soft_delete_policy(SoftDeletePolicy::default()/* use setters */);
5646    /// ```
5647    pub fn set_soft_delete_policy<T>(mut self, v: T) -> Self
5648    where
5649        T: std::convert::Into<crate::model::bucket::SoftDeletePolicy>,
5650    {
5651        self.soft_delete_policy = std::option::Option::Some(v.into());
5652        self
5653    }
5654
5655    /// Sets or clears the value of [soft_delete_policy][crate::model::Bucket::soft_delete_policy].
5656    ///
5657    /// # Example
5658    /// ```ignore,no_run
5659    /// # use google_cloud_storage::model::Bucket;
5660    /// use google_cloud_storage::model::bucket::SoftDeletePolicy;
5661    /// let x = Bucket::new().set_or_clear_soft_delete_policy(Some(SoftDeletePolicy::default()/* use setters */));
5662    /// let x = Bucket::new().set_or_clear_soft_delete_policy(None::<SoftDeletePolicy>);
5663    /// ```
5664    pub fn set_or_clear_soft_delete_policy<T>(mut self, v: std::option::Option<T>) -> Self
5665    where
5666        T: std::convert::Into<crate::model::bucket::SoftDeletePolicy>,
5667    {
5668        self.soft_delete_policy = v.map(|x| x.into());
5669        self
5670    }
5671
5672    /// Sets the value of [object_retention][crate::model::Bucket::object_retention].
5673    ///
5674    /// # Example
5675    /// ```ignore,no_run
5676    /// # use google_cloud_storage::model::Bucket;
5677    /// use google_cloud_storage::model::bucket::ObjectRetention;
5678    /// let x = Bucket::new().set_object_retention(ObjectRetention::default()/* use setters */);
5679    /// ```
5680    pub fn set_object_retention<T>(mut self, v: T) -> Self
5681    where
5682        T: std::convert::Into<crate::model::bucket::ObjectRetention>,
5683    {
5684        self.object_retention = std::option::Option::Some(v.into());
5685        self
5686    }
5687
5688    /// Sets or clears the value of [object_retention][crate::model::Bucket::object_retention].
5689    ///
5690    /// # Example
5691    /// ```ignore,no_run
5692    /// # use google_cloud_storage::model::Bucket;
5693    /// use google_cloud_storage::model::bucket::ObjectRetention;
5694    /// let x = Bucket::new().set_or_clear_object_retention(Some(ObjectRetention::default()/* use setters */));
5695    /// let x = Bucket::new().set_or_clear_object_retention(None::<ObjectRetention>);
5696    /// ```
5697    pub fn set_or_clear_object_retention<T>(mut self, v: std::option::Option<T>) -> Self
5698    where
5699        T: std::convert::Into<crate::model::bucket::ObjectRetention>,
5700    {
5701        self.object_retention = v.map(|x| x.into());
5702        self
5703    }
5704
5705    /// Sets the value of [ip_filter][crate::model::Bucket::ip_filter].
5706    ///
5707    /// # Example
5708    /// ```ignore,no_run
5709    /// # use google_cloud_storage::model::Bucket;
5710    /// use google_cloud_storage::model::bucket::IpFilter;
5711    /// let x = Bucket::new().set_ip_filter(IpFilter::default()/* use setters */);
5712    /// ```
5713    pub fn set_ip_filter<T>(mut self, v: T) -> Self
5714    where
5715        T: std::convert::Into<crate::model::bucket::IpFilter>,
5716    {
5717        self.ip_filter = std::option::Option::Some(v.into());
5718        self
5719    }
5720
5721    /// Sets or clears the value of [ip_filter][crate::model::Bucket::ip_filter].
5722    ///
5723    /// # Example
5724    /// ```ignore,no_run
5725    /// # use google_cloud_storage::model::Bucket;
5726    /// use google_cloud_storage::model::bucket::IpFilter;
5727    /// let x = Bucket::new().set_or_clear_ip_filter(Some(IpFilter::default()/* use setters */));
5728    /// let x = Bucket::new().set_or_clear_ip_filter(None::<IpFilter>);
5729    /// ```
5730    pub fn set_or_clear_ip_filter<T>(mut self, v: std::option::Option<T>) -> Self
5731    where
5732        T: std::convert::Into<crate::model::bucket::IpFilter>,
5733    {
5734        self.ip_filter = v.map(|x| x.into());
5735        self
5736    }
5737}
5738
5739impl wkt::message::Message for Bucket {
5740    fn typename() -> &'static str {
5741        "type.googleapis.com/google.storage.v2.Bucket"
5742    }
5743}
5744
5745/// Defines additional types related to [Bucket].
5746pub mod bucket {
5747    #[allow(unused_imports)]
5748    use super::*;
5749
5750    /// Billing properties of a bucket.
5751    #[derive(Clone, Default, PartialEq)]
5752    #[non_exhaustive]
5753    pub struct Billing {
5754        /// Optional. When set to true, Requester Pays is enabled for this bucket.
5755        pub requester_pays: bool,
5756
5757        pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5758    }
5759
5760    impl Billing {
5761        /// Creates a new default instance.
5762        pub fn new() -> Self {
5763            std::default::Default::default()
5764        }
5765
5766        /// Sets the value of [requester_pays][crate::model::bucket::Billing::requester_pays].
5767        ///
5768        /// # Example
5769        /// ```ignore,no_run
5770        /// # use google_cloud_storage::model::bucket::Billing;
5771        /// let x = Billing::new().set_requester_pays(true);
5772        /// ```
5773        pub fn set_requester_pays<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
5774            self.requester_pays = v.into();
5775            self
5776        }
5777    }
5778
5779    impl wkt::message::Message for Billing {
5780        fn typename() -> &'static str {
5781            "type.googleapis.com/google.storage.v2.Bucket.Billing"
5782        }
5783    }
5784
5785    /// Cross-Origin Response sharing (CORS) properties for a bucket.
5786    /// For more on Cloud Storage and CORS, see
5787    /// <https://cloud.google.com/storage/docs/cross-origin>.
5788    /// For more on CORS in general, see <https://tools.ietf.org/html/rfc6454>.
5789    #[derive(Clone, Default, PartialEq)]
5790    #[non_exhaustive]
5791    pub struct Cors {
5792        /// Optional. The list of origins eligible to receive CORS response headers.
5793        /// For more information about origins, see [RFC
5794        /// 6454](https://tools.ietf.org/html/rfc6454). Note: `*` is permitted in the
5795        /// list of origins, and means `any origin`.
5796        pub origin: std::vec::Vec<std::string::String>,
5797
5798        /// Optional. The list of HTTP methods on which to include CORS response
5799        /// headers,
5800        /// (`GET`, `OPTIONS`, `POST`, etc) Note: `*` is permitted in the list of
5801        /// methods, and means "any method".
5802        pub method: std::vec::Vec<std::string::String>,
5803
5804        /// Optional. The list of HTTP headers other than the [simple response
5805        /// headers](https://www.w3.org/TR/cors/#simple-response-headers) to give
5806        /// permission for the user-agent to share across domains.
5807        pub response_header: std::vec::Vec<std::string::String>,
5808
5809        /// Optional. The value, in seconds, to return in the [Access-Control-Max-Age
5810        /// header](https://www.w3.org/TR/cors/#access-control-max-age-response-header)
5811        /// used in preflight responses.
5812        pub max_age_seconds: i32,
5813
5814        pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5815    }
5816
5817    impl Cors {
5818        /// Creates a new default instance.
5819        pub fn new() -> Self {
5820            std::default::Default::default()
5821        }
5822
5823        /// Sets the value of [origin][crate::model::bucket::Cors::origin].
5824        ///
5825        /// # Example
5826        /// ```ignore,no_run
5827        /// # use google_cloud_storage::model::bucket::Cors;
5828        /// let x = Cors::new().set_origin(["a", "b", "c"]);
5829        /// ```
5830        pub fn set_origin<T, V>(mut self, v: T) -> Self
5831        where
5832            T: std::iter::IntoIterator<Item = V>,
5833            V: std::convert::Into<std::string::String>,
5834        {
5835            use std::iter::Iterator;
5836            self.origin = v.into_iter().map(|i| i.into()).collect();
5837            self
5838        }
5839
5840        /// Sets the value of [method][crate::model::bucket::Cors::method].
5841        ///
5842        /// # Example
5843        /// ```ignore,no_run
5844        /// # use google_cloud_storage::model::bucket::Cors;
5845        /// let x = Cors::new().set_method(["a", "b", "c"]);
5846        /// ```
5847        pub fn set_method<T, V>(mut self, v: T) -> Self
5848        where
5849            T: std::iter::IntoIterator<Item = V>,
5850            V: std::convert::Into<std::string::String>,
5851        {
5852            use std::iter::Iterator;
5853            self.method = v.into_iter().map(|i| i.into()).collect();
5854            self
5855        }
5856
5857        /// Sets the value of [response_header][crate::model::bucket::Cors::response_header].
5858        ///
5859        /// # Example
5860        /// ```ignore,no_run
5861        /// # use google_cloud_storage::model::bucket::Cors;
5862        /// let x = Cors::new().set_response_header(["a", "b", "c"]);
5863        /// ```
5864        pub fn set_response_header<T, V>(mut self, v: T) -> Self
5865        where
5866            T: std::iter::IntoIterator<Item = V>,
5867            V: std::convert::Into<std::string::String>,
5868        {
5869            use std::iter::Iterator;
5870            self.response_header = v.into_iter().map(|i| i.into()).collect();
5871            self
5872        }
5873
5874        /// Sets the value of [max_age_seconds][crate::model::bucket::Cors::max_age_seconds].
5875        ///
5876        /// # Example
5877        /// ```ignore,no_run
5878        /// # use google_cloud_storage::model::bucket::Cors;
5879        /// let x = Cors::new().set_max_age_seconds(42);
5880        /// ```
5881        pub fn set_max_age_seconds<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
5882            self.max_age_seconds = v.into();
5883            self
5884        }
5885    }
5886
5887    impl wkt::message::Message for Cors {
5888        fn typename() -> &'static str {
5889            "type.googleapis.com/google.storage.v2.Bucket.Cors"
5890        }
5891    }
5892
5893    /// Encryption properties of a bucket.
5894    #[derive(Clone, Default, PartialEq)]
5895    #[non_exhaustive]
5896    pub struct Encryption {
5897        /// Optional. The name of the Cloud KMS key that is used to encrypt objects
5898        /// inserted into this bucket, if no encryption method is specified.
5899        pub default_kms_key: std::string::String,
5900
5901        /// Optional. If omitted, then new objects with GMEK encryption-type is
5902        /// allowed. If set, then new objects created in this bucket must comply with
5903        /// enforcement config. Changing this has no effect on existing objects; it
5904        /// applies to new objects only.
5905        pub google_managed_encryption_enforcement_config: std::option::Option<
5906            crate::model::bucket::encryption::GoogleManagedEncryptionEnforcementConfig,
5907        >,
5908
5909        /// Optional. If omitted, then new objects with CMEK encryption-type is
5910        /// allowed. If set, then new objects created in this bucket must comply with
5911        /// enforcement config. Changing this has no effect on existing objects; it
5912        /// applies to new objects only.
5913        pub customer_managed_encryption_enforcement_config: std::option::Option<
5914            crate::model::bucket::encryption::CustomerManagedEncryptionEnforcementConfig,
5915        >,
5916
5917        /// Optional. If omitted, then new objects with CSEK encryption-type is
5918        /// allowed. If set, then new objects created in this bucket must comply with
5919        /// enforcement config. Changing this has no effect on existing objects; it
5920        /// applies to new objects only.
5921        pub customer_supplied_encryption_enforcement_config: std::option::Option<
5922            crate::model::bucket::encryption::CustomerSuppliedEncryptionEnforcementConfig,
5923        >,
5924
5925        pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5926    }
5927
5928    impl Encryption {
5929        /// Creates a new default instance.
5930        pub fn new() -> Self {
5931            std::default::Default::default()
5932        }
5933
5934        /// Sets the value of [default_kms_key][crate::model::bucket::Encryption::default_kms_key].
5935        ///
5936        /// # Example
5937        /// ```ignore,no_run
5938        /// # use google_cloud_storage::model::bucket::Encryption;
5939        /// let x = Encryption::new().set_default_kms_key("example");
5940        /// ```
5941        pub fn set_default_kms_key<T: std::convert::Into<std::string::String>>(
5942            mut self,
5943            v: T,
5944        ) -> Self {
5945            self.default_kms_key = v.into();
5946            self
5947        }
5948
5949        /// Sets the value of [google_managed_encryption_enforcement_config][crate::model::bucket::Encryption::google_managed_encryption_enforcement_config].
5950        ///
5951        /// # Example
5952        /// ```ignore,no_run
5953        /// # use google_cloud_storage::model::bucket::Encryption;
5954        /// use google_cloud_storage::model::bucket::encryption::GoogleManagedEncryptionEnforcementConfig;
5955        /// let x = Encryption::new().set_google_managed_encryption_enforcement_config(GoogleManagedEncryptionEnforcementConfig::default()/* use setters */);
5956        /// ```
5957        pub fn set_google_managed_encryption_enforcement_config<T>(mut self, v: T) -> Self
5958        where
5959            T: std::convert::Into<
5960                    crate::model::bucket::encryption::GoogleManagedEncryptionEnforcementConfig,
5961                >,
5962        {
5963            self.google_managed_encryption_enforcement_config = std::option::Option::Some(v.into());
5964            self
5965        }
5966
5967        /// Sets or clears the value of [google_managed_encryption_enforcement_config][crate::model::bucket::Encryption::google_managed_encryption_enforcement_config].
5968        ///
5969        /// # Example
5970        /// ```ignore,no_run
5971        /// # use google_cloud_storage::model::bucket::Encryption;
5972        /// use google_cloud_storage::model::bucket::encryption::GoogleManagedEncryptionEnforcementConfig;
5973        /// let x = Encryption::new().set_or_clear_google_managed_encryption_enforcement_config(Some(GoogleManagedEncryptionEnforcementConfig::default()/* use setters */));
5974        /// let x = Encryption::new().set_or_clear_google_managed_encryption_enforcement_config(None::<GoogleManagedEncryptionEnforcementConfig>);
5975        /// ```
5976        pub fn set_or_clear_google_managed_encryption_enforcement_config<T>(
5977            mut self,
5978            v: std::option::Option<T>,
5979        ) -> Self
5980        where
5981            T: std::convert::Into<
5982                    crate::model::bucket::encryption::GoogleManagedEncryptionEnforcementConfig,
5983                >,
5984        {
5985            self.google_managed_encryption_enforcement_config = v.map(|x| x.into());
5986            self
5987        }
5988
5989        /// Sets the value of [customer_managed_encryption_enforcement_config][crate::model::bucket::Encryption::customer_managed_encryption_enforcement_config].
5990        ///
5991        /// # Example
5992        /// ```ignore,no_run
5993        /// # use google_cloud_storage::model::bucket::Encryption;
5994        /// use google_cloud_storage::model::bucket::encryption::CustomerManagedEncryptionEnforcementConfig;
5995        /// let x = Encryption::new().set_customer_managed_encryption_enforcement_config(CustomerManagedEncryptionEnforcementConfig::default()/* use setters */);
5996        /// ```
5997        pub fn set_customer_managed_encryption_enforcement_config<T>(mut self, v: T) -> Self
5998        where
5999            T: std::convert::Into<
6000                    crate::model::bucket::encryption::CustomerManagedEncryptionEnforcementConfig,
6001                >,
6002        {
6003            self.customer_managed_encryption_enforcement_config =
6004                std::option::Option::Some(v.into());
6005            self
6006        }
6007
6008        /// Sets or clears the value of [customer_managed_encryption_enforcement_config][crate::model::bucket::Encryption::customer_managed_encryption_enforcement_config].
6009        ///
6010        /// # Example
6011        /// ```ignore,no_run
6012        /// # use google_cloud_storage::model::bucket::Encryption;
6013        /// use google_cloud_storage::model::bucket::encryption::CustomerManagedEncryptionEnforcementConfig;
6014        /// let x = Encryption::new().set_or_clear_customer_managed_encryption_enforcement_config(Some(CustomerManagedEncryptionEnforcementConfig::default()/* use setters */));
6015        /// let x = Encryption::new().set_or_clear_customer_managed_encryption_enforcement_config(None::<CustomerManagedEncryptionEnforcementConfig>);
6016        /// ```
6017        pub fn set_or_clear_customer_managed_encryption_enforcement_config<T>(
6018            mut self,
6019            v: std::option::Option<T>,
6020        ) -> Self
6021        where
6022            T: std::convert::Into<
6023                    crate::model::bucket::encryption::CustomerManagedEncryptionEnforcementConfig,
6024                >,
6025        {
6026            self.customer_managed_encryption_enforcement_config = v.map(|x| x.into());
6027            self
6028        }
6029
6030        /// Sets the value of [customer_supplied_encryption_enforcement_config][crate::model::bucket::Encryption::customer_supplied_encryption_enforcement_config].
6031        ///
6032        /// # Example
6033        /// ```ignore,no_run
6034        /// # use google_cloud_storage::model::bucket::Encryption;
6035        /// use google_cloud_storage::model::bucket::encryption::CustomerSuppliedEncryptionEnforcementConfig;
6036        /// let x = Encryption::new().set_customer_supplied_encryption_enforcement_config(CustomerSuppliedEncryptionEnforcementConfig::default()/* use setters */);
6037        /// ```
6038        pub fn set_customer_supplied_encryption_enforcement_config<T>(mut self, v: T) -> Self
6039        where
6040            T: std::convert::Into<
6041                    crate::model::bucket::encryption::CustomerSuppliedEncryptionEnforcementConfig,
6042                >,
6043        {
6044            self.customer_supplied_encryption_enforcement_config =
6045                std::option::Option::Some(v.into());
6046            self
6047        }
6048
6049        /// Sets or clears the value of [customer_supplied_encryption_enforcement_config][crate::model::bucket::Encryption::customer_supplied_encryption_enforcement_config].
6050        ///
6051        /// # Example
6052        /// ```ignore,no_run
6053        /// # use google_cloud_storage::model::bucket::Encryption;
6054        /// use google_cloud_storage::model::bucket::encryption::CustomerSuppliedEncryptionEnforcementConfig;
6055        /// let x = Encryption::new().set_or_clear_customer_supplied_encryption_enforcement_config(Some(CustomerSuppliedEncryptionEnforcementConfig::default()/* use setters */));
6056        /// let x = Encryption::new().set_or_clear_customer_supplied_encryption_enforcement_config(None::<CustomerSuppliedEncryptionEnforcementConfig>);
6057        /// ```
6058        pub fn set_or_clear_customer_supplied_encryption_enforcement_config<T>(
6059            mut self,
6060            v: std::option::Option<T>,
6061        ) -> Self
6062        where
6063            T: std::convert::Into<
6064                    crate::model::bucket::encryption::CustomerSuppliedEncryptionEnforcementConfig,
6065                >,
6066        {
6067            self.customer_supplied_encryption_enforcement_config = v.map(|x| x.into());
6068            self
6069        }
6070    }
6071
6072    impl wkt::message::Message for Encryption {
6073        fn typename() -> &'static str {
6074            "type.googleapis.com/google.storage.v2.Bucket.Encryption"
6075        }
6076    }
6077
6078    /// Defines additional types related to [Encryption].
6079    pub mod encryption {
6080        #[allow(unused_imports)]
6081        use super::*;
6082
6083        /// Google Managed Encryption (GMEK) enforcement config of a bucket.
6084        #[derive(Clone, Default, PartialEq)]
6085        #[non_exhaustive]
6086        pub struct GoogleManagedEncryptionEnforcementConfig {
6087            /// Restriction mode for google-managed encryption for new objects within
6088            /// the bucket. Valid values are: `NotRestricted` and `FullyRestricted`.
6089            /// If `NotRestricted` or unset, creation of new objects with
6090            /// google-managed encryption is allowed.
6091            /// If `FullyRestricted`, new objects can't be created using google-managed
6092            /// encryption.
6093            pub restriction_mode: std::option::Option<std::string::String>,
6094
6095            /// Time from which the config was effective. This is service-provided.
6096            pub effective_time: std::option::Option<wkt::Timestamp>,
6097
6098            pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
6099        }
6100
6101        impl GoogleManagedEncryptionEnforcementConfig {
6102            /// Creates a new default instance.
6103            pub fn new() -> Self {
6104                std::default::Default::default()
6105            }
6106
6107            /// Sets the value of [restriction_mode][crate::model::bucket::encryption::GoogleManagedEncryptionEnforcementConfig::restriction_mode].
6108            ///
6109            /// # Example
6110            /// ```ignore,no_run
6111            /// # use google_cloud_storage::model::bucket::encryption::GoogleManagedEncryptionEnforcementConfig;
6112            /// let x = GoogleManagedEncryptionEnforcementConfig::new().set_restriction_mode("example");
6113            /// ```
6114            pub fn set_restriction_mode<T>(mut self, v: T) -> Self
6115            where
6116                T: std::convert::Into<std::string::String>,
6117            {
6118                self.restriction_mode = std::option::Option::Some(v.into());
6119                self
6120            }
6121
6122            /// Sets or clears the value of [restriction_mode][crate::model::bucket::encryption::GoogleManagedEncryptionEnforcementConfig::restriction_mode].
6123            ///
6124            /// # Example
6125            /// ```ignore,no_run
6126            /// # use google_cloud_storage::model::bucket::encryption::GoogleManagedEncryptionEnforcementConfig;
6127            /// let x = GoogleManagedEncryptionEnforcementConfig::new().set_or_clear_restriction_mode(Some("example"));
6128            /// let x = GoogleManagedEncryptionEnforcementConfig::new().set_or_clear_restriction_mode(None::<String>);
6129            /// ```
6130            pub fn set_or_clear_restriction_mode<T>(mut self, v: std::option::Option<T>) -> Self
6131            where
6132                T: std::convert::Into<std::string::String>,
6133            {
6134                self.restriction_mode = v.map(|x| x.into());
6135                self
6136            }
6137
6138            /// Sets the value of [effective_time][crate::model::bucket::encryption::GoogleManagedEncryptionEnforcementConfig::effective_time].
6139            ///
6140            /// # Example
6141            /// ```ignore,no_run
6142            /// # use google_cloud_storage::model::bucket::encryption::GoogleManagedEncryptionEnforcementConfig;
6143            /// use wkt::Timestamp;
6144            /// let x = GoogleManagedEncryptionEnforcementConfig::new().set_effective_time(Timestamp::default()/* use setters */);
6145            /// ```
6146            pub fn set_effective_time<T>(mut self, v: T) -> Self
6147            where
6148                T: std::convert::Into<wkt::Timestamp>,
6149            {
6150                self.effective_time = std::option::Option::Some(v.into());
6151                self
6152            }
6153
6154            /// Sets or clears the value of [effective_time][crate::model::bucket::encryption::GoogleManagedEncryptionEnforcementConfig::effective_time].
6155            ///
6156            /// # Example
6157            /// ```ignore,no_run
6158            /// # use google_cloud_storage::model::bucket::encryption::GoogleManagedEncryptionEnforcementConfig;
6159            /// use wkt::Timestamp;
6160            /// let x = GoogleManagedEncryptionEnforcementConfig::new().set_or_clear_effective_time(Some(Timestamp::default()/* use setters */));
6161            /// let x = GoogleManagedEncryptionEnforcementConfig::new().set_or_clear_effective_time(None::<Timestamp>);
6162            /// ```
6163            pub fn set_or_clear_effective_time<T>(mut self, v: std::option::Option<T>) -> Self
6164            where
6165                T: std::convert::Into<wkt::Timestamp>,
6166            {
6167                self.effective_time = v.map(|x| x.into());
6168                self
6169            }
6170        }
6171
6172        impl wkt::message::Message for GoogleManagedEncryptionEnforcementConfig {
6173            fn typename() -> &'static str {
6174                "type.googleapis.com/google.storage.v2.Bucket.Encryption.GoogleManagedEncryptionEnforcementConfig"
6175            }
6176        }
6177
6178        /// Customer Managed Encryption (CMEK) enforcement config of a bucket.
6179        #[derive(Clone, Default, PartialEq)]
6180        #[non_exhaustive]
6181        pub struct CustomerManagedEncryptionEnforcementConfig {
6182            /// Restriction mode for customer-managed encryption for new objects within
6183            /// the bucket. Valid values are: `NotRestricted` and `FullyRestricted`.
6184            /// If `NotRestricted` or unset, creation of new objects with
6185            /// customer-managed encryption is allowed.
6186            /// If `FullyRestricted`, new objects can't be created using
6187            /// customer-managed encryption.
6188            pub restriction_mode: std::option::Option<std::string::String>,
6189
6190            /// Time from which the config was effective. This is service-provided.
6191            pub effective_time: std::option::Option<wkt::Timestamp>,
6192
6193            pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
6194        }
6195
6196        impl CustomerManagedEncryptionEnforcementConfig {
6197            /// Creates a new default instance.
6198            pub fn new() -> Self {
6199                std::default::Default::default()
6200            }
6201
6202            /// Sets the value of [restriction_mode][crate::model::bucket::encryption::CustomerManagedEncryptionEnforcementConfig::restriction_mode].
6203            ///
6204            /// # Example
6205            /// ```ignore,no_run
6206            /// # use google_cloud_storage::model::bucket::encryption::CustomerManagedEncryptionEnforcementConfig;
6207            /// let x = CustomerManagedEncryptionEnforcementConfig::new().set_restriction_mode("example");
6208            /// ```
6209            pub fn set_restriction_mode<T>(mut self, v: T) -> Self
6210            where
6211                T: std::convert::Into<std::string::String>,
6212            {
6213                self.restriction_mode = std::option::Option::Some(v.into());
6214                self
6215            }
6216
6217            /// Sets or clears the value of [restriction_mode][crate::model::bucket::encryption::CustomerManagedEncryptionEnforcementConfig::restriction_mode].
6218            ///
6219            /// # Example
6220            /// ```ignore,no_run
6221            /// # use google_cloud_storage::model::bucket::encryption::CustomerManagedEncryptionEnforcementConfig;
6222            /// let x = CustomerManagedEncryptionEnforcementConfig::new().set_or_clear_restriction_mode(Some("example"));
6223            /// let x = CustomerManagedEncryptionEnforcementConfig::new().set_or_clear_restriction_mode(None::<String>);
6224            /// ```
6225            pub fn set_or_clear_restriction_mode<T>(mut self, v: std::option::Option<T>) -> Self
6226            where
6227                T: std::convert::Into<std::string::String>,
6228            {
6229                self.restriction_mode = v.map(|x| x.into());
6230                self
6231            }
6232
6233            /// Sets the value of [effective_time][crate::model::bucket::encryption::CustomerManagedEncryptionEnforcementConfig::effective_time].
6234            ///
6235            /// # Example
6236            /// ```ignore,no_run
6237            /// # use google_cloud_storage::model::bucket::encryption::CustomerManagedEncryptionEnforcementConfig;
6238            /// use wkt::Timestamp;
6239            /// let x = CustomerManagedEncryptionEnforcementConfig::new().set_effective_time(Timestamp::default()/* use setters */);
6240            /// ```
6241            pub fn set_effective_time<T>(mut self, v: T) -> Self
6242            where
6243                T: std::convert::Into<wkt::Timestamp>,
6244            {
6245                self.effective_time = std::option::Option::Some(v.into());
6246                self
6247            }
6248
6249            /// Sets or clears the value of [effective_time][crate::model::bucket::encryption::CustomerManagedEncryptionEnforcementConfig::effective_time].
6250            ///
6251            /// # Example
6252            /// ```ignore,no_run
6253            /// # use google_cloud_storage::model::bucket::encryption::CustomerManagedEncryptionEnforcementConfig;
6254            /// use wkt::Timestamp;
6255            /// let x = CustomerManagedEncryptionEnforcementConfig::new().set_or_clear_effective_time(Some(Timestamp::default()/* use setters */));
6256            /// let x = CustomerManagedEncryptionEnforcementConfig::new().set_or_clear_effective_time(None::<Timestamp>);
6257            /// ```
6258            pub fn set_or_clear_effective_time<T>(mut self, v: std::option::Option<T>) -> Self
6259            where
6260                T: std::convert::Into<wkt::Timestamp>,
6261            {
6262                self.effective_time = v.map(|x| x.into());
6263                self
6264            }
6265        }
6266
6267        impl wkt::message::Message for CustomerManagedEncryptionEnforcementConfig {
6268            fn typename() -> &'static str {
6269                "type.googleapis.com/google.storage.v2.Bucket.Encryption.CustomerManagedEncryptionEnforcementConfig"
6270            }
6271        }
6272
6273        /// Customer Supplied Encryption (CSEK) enforcement config of a bucket.
6274        #[derive(Clone, Default, PartialEq)]
6275        #[non_exhaustive]
6276        pub struct CustomerSuppliedEncryptionEnforcementConfig {
6277            /// Restriction mode for customer-supplied encryption for new objects
6278            /// within the bucket. Valid values are: `NotRestricted` and
6279            /// `FullyRestricted`.
6280            /// If `NotRestricted` or unset, creation of new objects with
6281            /// customer-supplied encryption is allowed.
6282            /// If `FullyRestricted`, new objects can't be created using
6283            /// customer-supplied encryption.
6284            pub restriction_mode: std::option::Option<std::string::String>,
6285
6286            /// Time from which the config was effective. This is service-provided.
6287            pub effective_time: std::option::Option<wkt::Timestamp>,
6288
6289            pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
6290        }
6291
6292        impl CustomerSuppliedEncryptionEnforcementConfig {
6293            /// Creates a new default instance.
6294            pub fn new() -> Self {
6295                std::default::Default::default()
6296            }
6297
6298            /// Sets the value of [restriction_mode][crate::model::bucket::encryption::CustomerSuppliedEncryptionEnforcementConfig::restriction_mode].
6299            ///
6300            /// # Example
6301            /// ```ignore,no_run
6302            /// # use google_cloud_storage::model::bucket::encryption::CustomerSuppliedEncryptionEnforcementConfig;
6303            /// let x = CustomerSuppliedEncryptionEnforcementConfig::new().set_restriction_mode("example");
6304            /// ```
6305            pub fn set_restriction_mode<T>(mut self, v: T) -> Self
6306            where
6307                T: std::convert::Into<std::string::String>,
6308            {
6309                self.restriction_mode = std::option::Option::Some(v.into());
6310                self
6311            }
6312
6313            /// Sets or clears the value of [restriction_mode][crate::model::bucket::encryption::CustomerSuppliedEncryptionEnforcementConfig::restriction_mode].
6314            ///
6315            /// # Example
6316            /// ```ignore,no_run
6317            /// # use google_cloud_storage::model::bucket::encryption::CustomerSuppliedEncryptionEnforcementConfig;
6318            /// let x = CustomerSuppliedEncryptionEnforcementConfig::new().set_or_clear_restriction_mode(Some("example"));
6319            /// let x = CustomerSuppliedEncryptionEnforcementConfig::new().set_or_clear_restriction_mode(None::<String>);
6320            /// ```
6321            pub fn set_or_clear_restriction_mode<T>(mut self, v: std::option::Option<T>) -> Self
6322            where
6323                T: std::convert::Into<std::string::String>,
6324            {
6325                self.restriction_mode = v.map(|x| x.into());
6326                self
6327            }
6328
6329            /// Sets the value of [effective_time][crate::model::bucket::encryption::CustomerSuppliedEncryptionEnforcementConfig::effective_time].
6330            ///
6331            /// # Example
6332            /// ```ignore,no_run
6333            /// # use google_cloud_storage::model::bucket::encryption::CustomerSuppliedEncryptionEnforcementConfig;
6334            /// use wkt::Timestamp;
6335            /// let x = CustomerSuppliedEncryptionEnforcementConfig::new().set_effective_time(Timestamp::default()/* use setters */);
6336            /// ```
6337            pub fn set_effective_time<T>(mut self, v: T) -> Self
6338            where
6339                T: std::convert::Into<wkt::Timestamp>,
6340            {
6341                self.effective_time = std::option::Option::Some(v.into());
6342                self
6343            }
6344
6345            /// Sets or clears the value of [effective_time][crate::model::bucket::encryption::CustomerSuppliedEncryptionEnforcementConfig::effective_time].
6346            ///
6347            /// # Example
6348            /// ```ignore,no_run
6349            /// # use google_cloud_storage::model::bucket::encryption::CustomerSuppliedEncryptionEnforcementConfig;
6350            /// use wkt::Timestamp;
6351            /// let x = CustomerSuppliedEncryptionEnforcementConfig::new().set_or_clear_effective_time(Some(Timestamp::default()/* use setters */));
6352            /// let x = CustomerSuppliedEncryptionEnforcementConfig::new().set_or_clear_effective_time(None::<Timestamp>);
6353            /// ```
6354            pub fn set_or_clear_effective_time<T>(mut self, v: std::option::Option<T>) -> Self
6355            where
6356                T: std::convert::Into<wkt::Timestamp>,
6357            {
6358                self.effective_time = v.map(|x| x.into());
6359                self
6360            }
6361        }
6362
6363        impl wkt::message::Message for CustomerSuppliedEncryptionEnforcementConfig {
6364            fn typename() -> &'static str {
6365                "type.googleapis.com/google.storage.v2.Bucket.Encryption.CustomerSuppliedEncryptionEnforcementConfig"
6366            }
6367        }
6368    }
6369
6370    /// Bucket restriction options.
6371    #[derive(Clone, Default, PartialEq)]
6372    #[non_exhaustive]
6373    pub struct IamConfig {
6374        /// Optional. Bucket restriction options currently enforced on the bucket.
6375        pub uniform_bucket_level_access:
6376            std::option::Option<crate::model::bucket::iam_config::UniformBucketLevelAccess>,
6377
6378        /// Optional. Whether IAM enforces public access prevention. Valid values are
6379        /// `enforced` or `inherited`.
6380        pub public_access_prevention: std::string::String,
6381
6382        pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
6383    }
6384
6385    impl IamConfig {
6386        /// Creates a new default instance.
6387        pub fn new() -> Self {
6388            std::default::Default::default()
6389        }
6390
6391        /// Sets the value of [uniform_bucket_level_access][crate::model::bucket::IamConfig::uniform_bucket_level_access].
6392        ///
6393        /// # Example
6394        /// ```ignore,no_run
6395        /// # use google_cloud_storage::model::bucket::IamConfig;
6396        /// use google_cloud_storage::model::bucket::iam_config::UniformBucketLevelAccess;
6397        /// let x = IamConfig::new().set_uniform_bucket_level_access(UniformBucketLevelAccess::default()/* use setters */);
6398        /// ```
6399        pub fn set_uniform_bucket_level_access<T>(mut self, v: T) -> Self
6400        where
6401            T: std::convert::Into<crate::model::bucket::iam_config::UniformBucketLevelAccess>,
6402        {
6403            self.uniform_bucket_level_access = std::option::Option::Some(v.into());
6404            self
6405        }
6406
6407        /// Sets or clears the value of [uniform_bucket_level_access][crate::model::bucket::IamConfig::uniform_bucket_level_access].
6408        ///
6409        /// # Example
6410        /// ```ignore,no_run
6411        /// # use google_cloud_storage::model::bucket::IamConfig;
6412        /// use google_cloud_storage::model::bucket::iam_config::UniformBucketLevelAccess;
6413        /// let x = IamConfig::new().set_or_clear_uniform_bucket_level_access(Some(UniformBucketLevelAccess::default()/* use setters */));
6414        /// let x = IamConfig::new().set_or_clear_uniform_bucket_level_access(None::<UniformBucketLevelAccess>);
6415        /// ```
6416        pub fn set_or_clear_uniform_bucket_level_access<T>(
6417            mut self,
6418            v: std::option::Option<T>,
6419        ) -> Self
6420        where
6421            T: std::convert::Into<crate::model::bucket::iam_config::UniformBucketLevelAccess>,
6422        {
6423            self.uniform_bucket_level_access = v.map(|x| x.into());
6424            self
6425        }
6426
6427        /// Sets the value of [public_access_prevention][crate::model::bucket::IamConfig::public_access_prevention].
6428        ///
6429        /// # Example
6430        /// ```ignore,no_run
6431        /// # use google_cloud_storage::model::bucket::IamConfig;
6432        /// let x = IamConfig::new().set_public_access_prevention("example");
6433        /// ```
6434        pub fn set_public_access_prevention<T: std::convert::Into<std::string::String>>(
6435            mut self,
6436            v: T,
6437        ) -> Self {
6438            self.public_access_prevention = v.into();
6439            self
6440        }
6441    }
6442
6443    impl wkt::message::Message for IamConfig {
6444        fn typename() -> &'static str {
6445            "type.googleapis.com/google.storage.v2.Bucket.IamConfig"
6446        }
6447    }
6448
6449    /// Defines additional types related to [IamConfig].
6450    pub mod iam_config {
6451        #[allow(unused_imports)]
6452        use super::*;
6453
6454        /// Settings for Uniform Bucket level access.
6455        /// See <https://cloud.google.com/storage/docs/uniform-bucket-level-access>.
6456        #[derive(Clone, Default, PartialEq)]
6457        #[non_exhaustive]
6458        pub struct UniformBucketLevelAccess {
6459            /// Optional. If set, access checks only use bucket-level IAM policies or
6460            /// above.
6461            pub enabled: bool,
6462
6463            /// Optional. The deadline time for changing
6464            /// `iam_config.uniform_bucket_level_access.enabled` from `true` to
6465            /// `false`. Mutable until the specified deadline is reached, but not
6466            /// afterward.
6467            pub lock_time: std::option::Option<wkt::Timestamp>,
6468
6469            pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
6470        }
6471
6472        impl UniformBucketLevelAccess {
6473            /// Creates a new default instance.
6474            pub fn new() -> Self {
6475                std::default::Default::default()
6476            }
6477
6478            /// Sets the value of [enabled][crate::model::bucket::iam_config::UniformBucketLevelAccess::enabled].
6479            ///
6480            /// # Example
6481            /// ```ignore,no_run
6482            /// # use google_cloud_storage::model::bucket::iam_config::UniformBucketLevelAccess;
6483            /// let x = UniformBucketLevelAccess::new().set_enabled(true);
6484            /// ```
6485            pub fn set_enabled<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
6486                self.enabled = v.into();
6487                self
6488            }
6489
6490            /// Sets the value of [lock_time][crate::model::bucket::iam_config::UniformBucketLevelAccess::lock_time].
6491            ///
6492            /// # Example
6493            /// ```ignore,no_run
6494            /// # use google_cloud_storage::model::bucket::iam_config::UniformBucketLevelAccess;
6495            /// use wkt::Timestamp;
6496            /// let x = UniformBucketLevelAccess::new().set_lock_time(Timestamp::default()/* use setters */);
6497            /// ```
6498            pub fn set_lock_time<T>(mut self, v: T) -> Self
6499            where
6500                T: std::convert::Into<wkt::Timestamp>,
6501            {
6502                self.lock_time = std::option::Option::Some(v.into());
6503                self
6504            }
6505
6506            /// Sets or clears the value of [lock_time][crate::model::bucket::iam_config::UniformBucketLevelAccess::lock_time].
6507            ///
6508            /// # Example
6509            /// ```ignore,no_run
6510            /// # use google_cloud_storage::model::bucket::iam_config::UniformBucketLevelAccess;
6511            /// use wkt::Timestamp;
6512            /// let x = UniformBucketLevelAccess::new().set_or_clear_lock_time(Some(Timestamp::default()/* use setters */));
6513            /// let x = UniformBucketLevelAccess::new().set_or_clear_lock_time(None::<Timestamp>);
6514            /// ```
6515            pub fn set_or_clear_lock_time<T>(mut self, v: std::option::Option<T>) -> Self
6516            where
6517                T: std::convert::Into<wkt::Timestamp>,
6518            {
6519                self.lock_time = v.map(|x| x.into());
6520                self
6521            }
6522        }
6523
6524        impl wkt::message::Message for UniformBucketLevelAccess {
6525            fn typename() -> &'static str {
6526                "type.googleapis.com/google.storage.v2.Bucket.IamConfig.UniformBucketLevelAccess"
6527            }
6528        }
6529    }
6530
6531    /// Lifecycle properties of a bucket.
6532    /// For more information, see [Object Lifecycle
6533    /// Management](https://cloud.google.com/storage/docs/lifecycle).
6534    #[derive(Clone, Default, PartialEq)]
6535    #[non_exhaustive]
6536    pub struct Lifecycle {
6537        /// Optional. A lifecycle management rule, which is made of an action to take
6538        /// and the condition under which the action is taken.
6539        pub rule: std::vec::Vec<crate::model::bucket::lifecycle::Rule>,
6540
6541        pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
6542    }
6543
6544    impl Lifecycle {
6545        /// Creates a new default instance.
6546        pub fn new() -> Self {
6547            std::default::Default::default()
6548        }
6549
6550        /// Sets the value of [rule][crate::model::bucket::Lifecycle::rule].
6551        ///
6552        /// # Example
6553        /// ```ignore,no_run
6554        /// # use google_cloud_storage::model::bucket::Lifecycle;
6555        /// use google_cloud_storage::model::bucket::lifecycle::Rule;
6556        /// let x = Lifecycle::new()
6557        ///     .set_rule([
6558        ///         Rule::default()/* use setters */,
6559        ///         Rule::default()/* use (different) setters */,
6560        ///     ]);
6561        /// ```
6562        pub fn set_rule<T, V>(mut self, v: T) -> Self
6563        where
6564            T: std::iter::IntoIterator<Item = V>,
6565            V: std::convert::Into<crate::model::bucket::lifecycle::Rule>,
6566        {
6567            use std::iter::Iterator;
6568            self.rule = v.into_iter().map(|i| i.into()).collect();
6569            self
6570        }
6571    }
6572
6573    impl wkt::message::Message for Lifecycle {
6574        fn typename() -> &'static str {
6575            "type.googleapis.com/google.storage.v2.Bucket.Lifecycle"
6576        }
6577    }
6578
6579    /// Defines additional types related to [Lifecycle].
6580    pub mod lifecycle {
6581        #[allow(unused_imports)]
6582        use super::*;
6583
6584        /// A lifecycle Rule, combining an action to take on an object and a
6585        /// condition which triggers that action.
6586        #[derive(Clone, Default, PartialEq)]
6587        #[non_exhaustive]
6588        pub struct Rule {
6589            /// Optional. The action to take.
6590            pub action: std::option::Option<crate::model::bucket::lifecycle::rule::Action>,
6591
6592            /// Optional. The condition under which the action is taken.
6593            pub condition: std::option::Option<crate::model::bucket::lifecycle::rule::Condition>,
6594
6595            pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
6596        }
6597
6598        impl Rule {
6599            /// Creates a new default instance.
6600            pub fn new() -> Self {
6601                std::default::Default::default()
6602            }
6603
6604            /// Sets the value of [action][crate::model::bucket::lifecycle::Rule::action].
6605            ///
6606            /// # Example
6607            /// ```ignore,no_run
6608            /// # use google_cloud_storage::model::bucket::lifecycle::Rule;
6609            /// use google_cloud_storage::model::bucket::lifecycle::rule::Action;
6610            /// let x = Rule::new().set_action(Action::default()/* use setters */);
6611            /// ```
6612            pub fn set_action<T>(mut self, v: T) -> Self
6613            where
6614                T: std::convert::Into<crate::model::bucket::lifecycle::rule::Action>,
6615            {
6616                self.action = std::option::Option::Some(v.into());
6617                self
6618            }
6619
6620            /// Sets or clears the value of [action][crate::model::bucket::lifecycle::Rule::action].
6621            ///
6622            /// # Example
6623            /// ```ignore,no_run
6624            /// # use google_cloud_storage::model::bucket::lifecycle::Rule;
6625            /// use google_cloud_storage::model::bucket::lifecycle::rule::Action;
6626            /// let x = Rule::new().set_or_clear_action(Some(Action::default()/* use setters */));
6627            /// let x = Rule::new().set_or_clear_action(None::<Action>);
6628            /// ```
6629            pub fn set_or_clear_action<T>(mut self, v: std::option::Option<T>) -> Self
6630            where
6631                T: std::convert::Into<crate::model::bucket::lifecycle::rule::Action>,
6632            {
6633                self.action = v.map(|x| x.into());
6634                self
6635            }
6636
6637            /// Sets the value of [condition][crate::model::bucket::lifecycle::Rule::condition].
6638            ///
6639            /// # Example
6640            /// ```ignore,no_run
6641            /// # use google_cloud_storage::model::bucket::lifecycle::Rule;
6642            /// use google_cloud_storage::model::bucket::lifecycle::rule::Condition;
6643            /// let x = Rule::new().set_condition(Condition::default()/* use setters */);
6644            /// ```
6645            pub fn set_condition<T>(mut self, v: T) -> Self
6646            where
6647                T: std::convert::Into<crate::model::bucket::lifecycle::rule::Condition>,
6648            {
6649                self.condition = std::option::Option::Some(v.into());
6650                self
6651            }
6652
6653            /// Sets or clears the value of [condition][crate::model::bucket::lifecycle::Rule::condition].
6654            ///
6655            /// # Example
6656            /// ```ignore,no_run
6657            /// # use google_cloud_storage::model::bucket::lifecycle::Rule;
6658            /// use google_cloud_storage::model::bucket::lifecycle::rule::Condition;
6659            /// let x = Rule::new().set_or_clear_condition(Some(Condition::default()/* use setters */));
6660            /// let x = Rule::new().set_or_clear_condition(None::<Condition>);
6661            /// ```
6662            pub fn set_or_clear_condition<T>(mut self, v: std::option::Option<T>) -> Self
6663            where
6664                T: std::convert::Into<crate::model::bucket::lifecycle::rule::Condition>,
6665            {
6666                self.condition = v.map(|x| x.into());
6667                self
6668            }
6669        }
6670
6671        impl wkt::message::Message for Rule {
6672            fn typename() -> &'static str {
6673                "type.googleapis.com/google.storage.v2.Bucket.Lifecycle.Rule"
6674            }
6675        }
6676
6677        /// Defines additional types related to [Rule].
6678        pub mod rule {
6679            #[allow(unused_imports)]
6680            use super::*;
6681
6682            /// An action to take on an object.
6683            #[derive(Clone, Default, PartialEq)]
6684            #[non_exhaustive]
6685            pub struct Action {
6686                /// Optional. Type of the action. Currently, only `Delete`,
6687                /// `SetStorageClass`, and `AbortIncompleteMultipartUpload` are
6688                /// supported.
6689                pub r#type: std::string::String,
6690
6691                /// Optional. Target storage class. Required iff the type of the action
6692                /// is SetStorageClass.
6693                pub storage_class: std::string::String,
6694
6695                pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
6696            }
6697
6698            impl Action {
6699                /// Creates a new default instance.
6700                pub fn new() -> Self {
6701                    std::default::Default::default()
6702                }
6703
6704                /// Sets the value of [r#type][crate::model::bucket::lifecycle::rule::Action::type].
6705                ///
6706                /// # Example
6707                /// ```ignore,no_run
6708                /// # use google_cloud_storage::model::bucket::lifecycle::rule::Action;
6709                /// let x = Action::new().set_type("example");
6710                /// ```
6711                pub fn set_type<T: std::convert::Into<std::string::String>>(
6712                    mut self,
6713                    v: T,
6714                ) -> Self {
6715                    self.r#type = v.into();
6716                    self
6717                }
6718
6719                /// Sets the value of [storage_class][crate::model::bucket::lifecycle::rule::Action::storage_class].
6720                ///
6721                /// # Example
6722                /// ```ignore,no_run
6723                /// # use google_cloud_storage::model::bucket::lifecycle::rule::Action;
6724                /// let x = Action::new().set_storage_class("example");
6725                /// ```
6726                pub fn set_storage_class<T: std::convert::Into<std::string::String>>(
6727                    mut self,
6728                    v: T,
6729                ) -> Self {
6730                    self.storage_class = v.into();
6731                    self
6732                }
6733            }
6734
6735            impl wkt::message::Message for Action {
6736                fn typename() -> &'static str {
6737                    "type.googleapis.com/google.storage.v2.Bucket.Lifecycle.Rule.Action"
6738                }
6739            }
6740
6741            /// A condition of an object which triggers some action.
6742            #[derive(Clone, Default, PartialEq)]
6743            #[non_exhaustive]
6744            pub struct Condition {
6745                /// Age of an object (in days). This condition is satisfied when an
6746                /// object reaches the specified age.
6747                /// A value of 0 indicates that all objects immediately match this
6748                /// condition.
6749                pub age_days: std::option::Option<i32>,
6750
6751                /// Optional. This condition is satisfied when an object is created
6752                /// before midnight of the specified date in UTC.
6753                pub created_before: std::option::Option<google_cloud_type::model::Date>,
6754
6755                /// Relevant only for versioned objects. If the value is
6756                /// `true`, this condition matches live objects; if the value
6757                /// is `false`, it matches archived objects.
6758                pub is_live: std::option::Option<bool>,
6759
6760                /// Relevant only for versioned objects. If the value is N, this
6761                /// condition is satisfied when there are at least N versions (including
6762                /// the live version) newer than this version of the object.
6763                pub num_newer_versions: std::option::Option<i32>,
6764
6765                /// Optional. Objects having any of the storage classes specified by this
6766                /// condition are matched. Values include `MULTI_REGIONAL`, `REGIONAL`,
6767                /// `NEARLINE`, `COLDLINE`, `STANDARD`, and
6768                /// `DURABLE_REDUCED_AVAILABILITY`.
6769                pub matches_storage_class: std::vec::Vec<std::string::String>,
6770
6771                /// Number of days that have elapsed since the custom timestamp set on an
6772                /// object.
6773                /// The value of the field must be a nonnegative integer.
6774                pub days_since_custom_time: std::option::Option<i32>,
6775
6776                /// Optional. An object matches this condition if the custom timestamp
6777                /// set on the object is before the specified date in UTC.
6778                pub custom_time_before: std::option::Option<google_cloud_type::model::Date>,
6779
6780                /// This condition is relevant only for versioned objects. An object
6781                /// version satisfies this condition only if these many days have been
6782                /// passed since it became noncurrent. The value of the field must be a
6783                /// nonnegative integer. If it's zero, the object version becomes
6784                /// eligible for Lifecycle action as soon as it becomes noncurrent.
6785                pub days_since_noncurrent_time: std::option::Option<i32>,
6786
6787                /// Optional. This condition is relevant only for versioned objects. An
6788                /// object version satisfies this condition only if it became noncurrent
6789                /// before the specified date in UTC.
6790                pub noncurrent_time_before: std::option::Option<google_cloud_type::model::Date>,
6791
6792                /// Optional. List of object name prefixes. If any prefix exactly matches
6793                /// the beginning of the object name, the condition evaluates to true.
6794                pub matches_prefix: std::vec::Vec<std::string::String>,
6795
6796                /// Optional. List of object name suffixes. If any suffix exactly matches
6797                /// the end of the object name, the condition evaluates to true.
6798                pub matches_suffix: std::vec::Vec<std::string::String>,
6799
6800                pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
6801            }
6802
6803            impl Condition {
6804                /// Creates a new default instance.
6805                pub fn new() -> Self {
6806                    std::default::Default::default()
6807                }
6808
6809                /// Sets the value of [age_days][crate::model::bucket::lifecycle::rule::Condition::age_days].
6810                ///
6811                /// # Example
6812                /// ```ignore,no_run
6813                /// # use google_cloud_storage::model::bucket::lifecycle::rule::Condition;
6814                /// let x = Condition::new().set_age_days(42);
6815                /// ```
6816                pub fn set_age_days<T>(mut self, v: T) -> Self
6817                where
6818                    T: std::convert::Into<i32>,
6819                {
6820                    self.age_days = std::option::Option::Some(v.into());
6821                    self
6822                }
6823
6824                /// Sets or clears the value of [age_days][crate::model::bucket::lifecycle::rule::Condition::age_days].
6825                ///
6826                /// # Example
6827                /// ```ignore,no_run
6828                /// # use google_cloud_storage::model::bucket::lifecycle::rule::Condition;
6829                /// let x = Condition::new().set_or_clear_age_days(Some(42));
6830                /// let x = Condition::new().set_or_clear_age_days(None::<i32>);
6831                /// ```
6832                pub fn set_or_clear_age_days<T>(mut self, v: std::option::Option<T>) -> Self
6833                where
6834                    T: std::convert::Into<i32>,
6835                {
6836                    self.age_days = v.map(|x| x.into());
6837                    self
6838                }
6839
6840                /// Sets the value of [created_before][crate::model::bucket::lifecycle::rule::Condition::created_before].
6841                ///
6842                /// # Example
6843                /// ```ignore,no_run
6844                /// # use google_cloud_storage::model::bucket::lifecycle::rule::Condition;
6845                /// use google_cloud_type::model::Date;
6846                /// let x = Condition::new().set_created_before(Date::default()/* use setters */);
6847                /// ```
6848                pub fn set_created_before<T>(mut self, v: T) -> Self
6849                where
6850                    T: std::convert::Into<google_cloud_type::model::Date>,
6851                {
6852                    self.created_before = std::option::Option::Some(v.into());
6853                    self
6854                }
6855
6856                /// Sets or clears the value of [created_before][crate::model::bucket::lifecycle::rule::Condition::created_before].
6857                ///
6858                /// # Example
6859                /// ```ignore,no_run
6860                /// # use google_cloud_storage::model::bucket::lifecycle::rule::Condition;
6861                /// use google_cloud_type::model::Date;
6862                /// let x = Condition::new().set_or_clear_created_before(Some(Date::default()/* use setters */));
6863                /// let x = Condition::new().set_or_clear_created_before(None::<Date>);
6864                /// ```
6865                pub fn set_or_clear_created_before<T>(mut self, v: std::option::Option<T>) -> Self
6866                where
6867                    T: std::convert::Into<google_cloud_type::model::Date>,
6868                {
6869                    self.created_before = v.map(|x| x.into());
6870                    self
6871                }
6872
6873                /// Sets the value of [is_live][crate::model::bucket::lifecycle::rule::Condition::is_live].
6874                ///
6875                /// # Example
6876                /// ```ignore,no_run
6877                /// # use google_cloud_storage::model::bucket::lifecycle::rule::Condition;
6878                /// let x = Condition::new().set_is_live(true);
6879                /// ```
6880                pub fn set_is_live<T>(mut self, v: T) -> Self
6881                where
6882                    T: std::convert::Into<bool>,
6883                {
6884                    self.is_live = std::option::Option::Some(v.into());
6885                    self
6886                }
6887
6888                /// Sets or clears the value of [is_live][crate::model::bucket::lifecycle::rule::Condition::is_live].
6889                ///
6890                /// # Example
6891                /// ```ignore,no_run
6892                /// # use google_cloud_storage::model::bucket::lifecycle::rule::Condition;
6893                /// let x = Condition::new().set_or_clear_is_live(Some(false));
6894                /// let x = Condition::new().set_or_clear_is_live(None::<bool>);
6895                /// ```
6896                pub fn set_or_clear_is_live<T>(mut self, v: std::option::Option<T>) -> Self
6897                where
6898                    T: std::convert::Into<bool>,
6899                {
6900                    self.is_live = v.map(|x| x.into());
6901                    self
6902                }
6903
6904                /// Sets the value of [num_newer_versions][crate::model::bucket::lifecycle::rule::Condition::num_newer_versions].
6905                ///
6906                /// # Example
6907                /// ```ignore,no_run
6908                /// # use google_cloud_storage::model::bucket::lifecycle::rule::Condition;
6909                /// let x = Condition::new().set_num_newer_versions(42);
6910                /// ```
6911                pub fn set_num_newer_versions<T>(mut self, v: T) -> Self
6912                where
6913                    T: std::convert::Into<i32>,
6914                {
6915                    self.num_newer_versions = std::option::Option::Some(v.into());
6916                    self
6917                }
6918
6919                /// Sets or clears the value of [num_newer_versions][crate::model::bucket::lifecycle::rule::Condition::num_newer_versions].
6920                ///
6921                /// # Example
6922                /// ```ignore,no_run
6923                /// # use google_cloud_storage::model::bucket::lifecycle::rule::Condition;
6924                /// let x = Condition::new().set_or_clear_num_newer_versions(Some(42));
6925                /// let x = Condition::new().set_or_clear_num_newer_versions(None::<i32>);
6926                /// ```
6927                pub fn set_or_clear_num_newer_versions<T>(
6928                    mut self,
6929                    v: std::option::Option<T>,
6930                ) -> Self
6931                where
6932                    T: std::convert::Into<i32>,
6933                {
6934                    self.num_newer_versions = v.map(|x| x.into());
6935                    self
6936                }
6937
6938                /// Sets the value of [matches_storage_class][crate::model::bucket::lifecycle::rule::Condition::matches_storage_class].
6939                ///
6940                /// # Example
6941                /// ```ignore,no_run
6942                /// # use google_cloud_storage::model::bucket::lifecycle::rule::Condition;
6943                /// let x = Condition::new().set_matches_storage_class(["a", "b", "c"]);
6944                /// ```
6945                pub fn set_matches_storage_class<T, V>(mut self, v: T) -> Self
6946                where
6947                    T: std::iter::IntoIterator<Item = V>,
6948                    V: std::convert::Into<std::string::String>,
6949                {
6950                    use std::iter::Iterator;
6951                    self.matches_storage_class = v.into_iter().map(|i| i.into()).collect();
6952                    self
6953                }
6954
6955                /// Sets the value of [days_since_custom_time][crate::model::bucket::lifecycle::rule::Condition::days_since_custom_time].
6956                ///
6957                /// # Example
6958                /// ```ignore,no_run
6959                /// # use google_cloud_storage::model::bucket::lifecycle::rule::Condition;
6960                /// let x = Condition::new().set_days_since_custom_time(42);
6961                /// ```
6962                pub fn set_days_since_custom_time<T>(mut self, v: T) -> Self
6963                where
6964                    T: std::convert::Into<i32>,
6965                {
6966                    self.days_since_custom_time = std::option::Option::Some(v.into());
6967                    self
6968                }
6969
6970                /// Sets or clears the value of [days_since_custom_time][crate::model::bucket::lifecycle::rule::Condition::days_since_custom_time].
6971                ///
6972                /// # Example
6973                /// ```ignore,no_run
6974                /// # use google_cloud_storage::model::bucket::lifecycle::rule::Condition;
6975                /// let x = Condition::new().set_or_clear_days_since_custom_time(Some(42));
6976                /// let x = Condition::new().set_or_clear_days_since_custom_time(None::<i32>);
6977                /// ```
6978                pub fn set_or_clear_days_since_custom_time<T>(
6979                    mut self,
6980                    v: std::option::Option<T>,
6981                ) -> Self
6982                where
6983                    T: std::convert::Into<i32>,
6984                {
6985                    self.days_since_custom_time = v.map(|x| x.into());
6986                    self
6987                }
6988
6989                /// Sets the value of [custom_time_before][crate::model::bucket::lifecycle::rule::Condition::custom_time_before].
6990                ///
6991                /// # Example
6992                /// ```ignore,no_run
6993                /// # use google_cloud_storage::model::bucket::lifecycle::rule::Condition;
6994                /// use google_cloud_type::model::Date;
6995                /// let x = Condition::new().set_custom_time_before(Date::default()/* use setters */);
6996                /// ```
6997                pub fn set_custom_time_before<T>(mut self, v: T) -> Self
6998                where
6999                    T: std::convert::Into<google_cloud_type::model::Date>,
7000                {
7001                    self.custom_time_before = std::option::Option::Some(v.into());
7002                    self
7003                }
7004
7005                /// Sets or clears the value of [custom_time_before][crate::model::bucket::lifecycle::rule::Condition::custom_time_before].
7006                ///
7007                /// # Example
7008                /// ```ignore,no_run
7009                /// # use google_cloud_storage::model::bucket::lifecycle::rule::Condition;
7010                /// use google_cloud_type::model::Date;
7011                /// let x = Condition::new().set_or_clear_custom_time_before(Some(Date::default()/* use setters */));
7012                /// let x = Condition::new().set_or_clear_custom_time_before(None::<Date>);
7013                /// ```
7014                pub fn set_or_clear_custom_time_before<T>(
7015                    mut self,
7016                    v: std::option::Option<T>,
7017                ) -> Self
7018                where
7019                    T: std::convert::Into<google_cloud_type::model::Date>,
7020                {
7021                    self.custom_time_before = v.map(|x| x.into());
7022                    self
7023                }
7024
7025                /// Sets the value of [days_since_noncurrent_time][crate::model::bucket::lifecycle::rule::Condition::days_since_noncurrent_time].
7026                ///
7027                /// # Example
7028                /// ```ignore,no_run
7029                /// # use google_cloud_storage::model::bucket::lifecycle::rule::Condition;
7030                /// let x = Condition::new().set_days_since_noncurrent_time(42);
7031                /// ```
7032                pub fn set_days_since_noncurrent_time<T>(mut self, v: T) -> Self
7033                where
7034                    T: std::convert::Into<i32>,
7035                {
7036                    self.days_since_noncurrent_time = std::option::Option::Some(v.into());
7037                    self
7038                }
7039
7040                /// Sets or clears the value of [days_since_noncurrent_time][crate::model::bucket::lifecycle::rule::Condition::days_since_noncurrent_time].
7041                ///
7042                /// # Example
7043                /// ```ignore,no_run
7044                /// # use google_cloud_storage::model::bucket::lifecycle::rule::Condition;
7045                /// let x = Condition::new().set_or_clear_days_since_noncurrent_time(Some(42));
7046                /// let x = Condition::new().set_or_clear_days_since_noncurrent_time(None::<i32>);
7047                /// ```
7048                pub fn set_or_clear_days_since_noncurrent_time<T>(
7049                    mut self,
7050                    v: std::option::Option<T>,
7051                ) -> Self
7052                where
7053                    T: std::convert::Into<i32>,
7054                {
7055                    self.days_since_noncurrent_time = v.map(|x| x.into());
7056                    self
7057                }
7058
7059                /// Sets the value of [noncurrent_time_before][crate::model::bucket::lifecycle::rule::Condition::noncurrent_time_before].
7060                ///
7061                /// # Example
7062                /// ```ignore,no_run
7063                /// # use google_cloud_storage::model::bucket::lifecycle::rule::Condition;
7064                /// use google_cloud_type::model::Date;
7065                /// let x = Condition::new().set_noncurrent_time_before(Date::default()/* use setters */);
7066                /// ```
7067                pub fn set_noncurrent_time_before<T>(mut self, v: T) -> Self
7068                where
7069                    T: std::convert::Into<google_cloud_type::model::Date>,
7070                {
7071                    self.noncurrent_time_before = std::option::Option::Some(v.into());
7072                    self
7073                }
7074
7075                /// Sets or clears the value of [noncurrent_time_before][crate::model::bucket::lifecycle::rule::Condition::noncurrent_time_before].
7076                ///
7077                /// # Example
7078                /// ```ignore,no_run
7079                /// # use google_cloud_storage::model::bucket::lifecycle::rule::Condition;
7080                /// use google_cloud_type::model::Date;
7081                /// let x = Condition::new().set_or_clear_noncurrent_time_before(Some(Date::default()/* use setters */));
7082                /// let x = Condition::new().set_or_clear_noncurrent_time_before(None::<Date>);
7083                /// ```
7084                pub fn set_or_clear_noncurrent_time_before<T>(
7085                    mut self,
7086                    v: std::option::Option<T>,
7087                ) -> Self
7088                where
7089                    T: std::convert::Into<google_cloud_type::model::Date>,
7090                {
7091                    self.noncurrent_time_before = v.map(|x| x.into());
7092                    self
7093                }
7094
7095                /// Sets the value of [matches_prefix][crate::model::bucket::lifecycle::rule::Condition::matches_prefix].
7096                ///
7097                /// # Example
7098                /// ```ignore,no_run
7099                /// # use google_cloud_storage::model::bucket::lifecycle::rule::Condition;
7100                /// let x = Condition::new().set_matches_prefix(["a", "b", "c"]);
7101                /// ```
7102                pub fn set_matches_prefix<T, V>(mut self, v: T) -> Self
7103                where
7104                    T: std::iter::IntoIterator<Item = V>,
7105                    V: std::convert::Into<std::string::String>,
7106                {
7107                    use std::iter::Iterator;
7108                    self.matches_prefix = v.into_iter().map(|i| i.into()).collect();
7109                    self
7110                }
7111
7112                /// Sets the value of [matches_suffix][crate::model::bucket::lifecycle::rule::Condition::matches_suffix].
7113                ///
7114                /// # Example
7115                /// ```ignore,no_run
7116                /// # use google_cloud_storage::model::bucket::lifecycle::rule::Condition;
7117                /// let x = Condition::new().set_matches_suffix(["a", "b", "c"]);
7118                /// ```
7119                pub fn set_matches_suffix<T, V>(mut self, v: T) -> Self
7120                where
7121                    T: std::iter::IntoIterator<Item = V>,
7122                    V: std::convert::Into<std::string::String>,
7123                {
7124                    use std::iter::Iterator;
7125                    self.matches_suffix = v.into_iter().map(|i| i.into()).collect();
7126                    self
7127                }
7128            }
7129
7130            impl wkt::message::Message for Condition {
7131                fn typename() -> &'static str {
7132                    "type.googleapis.com/google.storage.v2.Bucket.Lifecycle.Rule.Condition"
7133                }
7134            }
7135        }
7136    }
7137
7138    /// Logging-related properties of a bucket.
7139    #[derive(Clone, Default, PartialEq)]
7140    #[non_exhaustive]
7141    pub struct Logging {
7142        /// Optional. The destination bucket where the current bucket's logs should
7143        /// be placed, using path format (like `projects/123456/buckets/foo`).
7144        pub log_bucket: std::string::String,
7145
7146        /// Optional. A prefix for log object names.
7147        pub log_object_prefix: std::string::String,
7148
7149        pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
7150    }
7151
7152    impl Logging {
7153        /// Creates a new default instance.
7154        pub fn new() -> Self {
7155            std::default::Default::default()
7156        }
7157
7158        /// Sets the value of [log_bucket][crate::model::bucket::Logging::log_bucket].
7159        ///
7160        /// # Example
7161        /// ```ignore,no_run
7162        /// # use google_cloud_storage::model::bucket::Logging;
7163        /// let x = Logging::new().set_log_bucket("example");
7164        /// ```
7165        pub fn set_log_bucket<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
7166            self.log_bucket = v.into();
7167            self
7168        }
7169
7170        /// Sets the value of [log_object_prefix][crate::model::bucket::Logging::log_object_prefix].
7171        ///
7172        /// # Example
7173        /// ```ignore,no_run
7174        /// # use google_cloud_storage::model::bucket::Logging;
7175        /// let x = Logging::new().set_log_object_prefix("example");
7176        /// ```
7177        pub fn set_log_object_prefix<T: std::convert::Into<std::string::String>>(
7178            mut self,
7179            v: T,
7180        ) -> Self {
7181            self.log_object_prefix = v.into();
7182            self
7183        }
7184    }
7185
7186    impl wkt::message::Message for Logging {
7187        fn typename() -> &'static str {
7188            "type.googleapis.com/google.storage.v2.Bucket.Logging"
7189        }
7190    }
7191
7192    /// Object Retention related properties of a bucket.
7193    #[derive(Clone, Default, PartialEq)]
7194    #[non_exhaustive]
7195    pub struct ObjectRetention {
7196        /// Optional. Output only. If true, object retention is enabled for the
7197        /// bucket.
7198        pub enabled: bool,
7199
7200        pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
7201    }
7202
7203    impl ObjectRetention {
7204        /// Creates a new default instance.
7205        pub fn new() -> Self {
7206            std::default::Default::default()
7207        }
7208
7209        /// Sets the value of [enabled][crate::model::bucket::ObjectRetention::enabled].
7210        ///
7211        /// # Example
7212        /// ```ignore,no_run
7213        /// # use google_cloud_storage::model::bucket::ObjectRetention;
7214        /// let x = ObjectRetention::new().set_enabled(true);
7215        /// ```
7216        pub fn set_enabled<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
7217            self.enabled = v.into();
7218            self
7219        }
7220    }
7221
7222    impl wkt::message::Message for ObjectRetention {
7223        fn typename() -> &'static str {
7224            "type.googleapis.com/google.storage.v2.Bucket.ObjectRetention"
7225        }
7226    }
7227
7228    /// Retention policy properties of a bucket.
7229    #[derive(Clone, Default, PartialEq)]
7230    #[non_exhaustive]
7231    pub struct RetentionPolicy {
7232        /// Optional. Server-determined value that indicates the time from which
7233        /// policy was enforced and effective.
7234        pub effective_time: std::option::Option<wkt::Timestamp>,
7235
7236        /// Optional. Once locked, an object retention policy cannot be modified.
7237        pub is_locked: bool,
7238
7239        /// Optional. The duration that objects need to be retained. Retention
7240        /// duration must be greater than zero and less than 100 years. Note that
7241        /// enforcement of retention periods less than a day is not guaranteed. Such
7242        /// periods should only be used for testing purposes. Any `nanos` value
7243        /// specified is rounded down to the nearest second.
7244        pub retention_duration: std::option::Option<wkt::Duration>,
7245
7246        pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
7247    }
7248
7249    impl RetentionPolicy {
7250        /// Creates a new default instance.
7251        pub fn new() -> Self {
7252            std::default::Default::default()
7253        }
7254
7255        /// Sets the value of [effective_time][crate::model::bucket::RetentionPolicy::effective_time].
7256        ///
7257        /// # Example
7258        /// ```ignore,no_run
7259        /// # use google_cloud_storage::model::bucket::RetentionPolicy;
7260        /// use wkt::Timestamp;
7261        /// let x = RetentionPolicy::new().set_effective_time(Timestamp::default()/* use setters */);
7262        /// ```
7263        pub fn set_effective_time<T>(mut self, v: T) -> Self
7264        where
7265            T: std::convert::Into<wkt::Timestamp>,
7266        {
7267            self.effective_time = std::option::Option::Some(v.into());
7268            self
7269        }
7270
7271        /// Sets or clears the value of [effective_time][crate::model::bucket::RetentionPolicy::effective_time].
7272        ///
7273        /// # Example
7274        /// ```ignore,no_run
7275        /// # use google_cloud_storage::model::bucket::RetentionPolicy;
7276        /// use wkt::Timestamp;
7277        /// let x = RetentionPolicy::new().set_or_clear_effective_time(Some(Timestamp::default()/* use setters */));
7278        /// let x = RetentionPolicy::new().set_or_clear_effective_time(None::<Timestamp>);
7279        /// ```
7280        pub fn set_or_clear_effective_time<T>(mut self, v: std::option::Option<T>) -> Self
7281        where
7282            T: std::convert::Into<wkt::Timestamp>,
7283        {
7284            self.effective_time = v.map(|x| x.into());
7285            self
7286        }
7287
7288        /// Sets the value of [is_locked][crate::model::bucket::RetentionPolicy::is_locked].
7289        ///
7290        /// # Example
7291        /// ```ignore,no_run
7292        /// # use google_cloud_storage::model::bucket::RetentionPolicy;
7293        /// let x = RetentionPolicy::new().set_is_locked(true);
7294        /// ```
7295        pub fn set_is_locked<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
7296            self.is_locked = v.into();
7297            self
7298        }
7299
7300        /// Sets the value of [retention_duration][crate::model::bucket::RetentionPolicy::retention_duration].
7301        ///
7302        /// # Example
7303        /// ```ignore,no_run
7304        /// # use google_cloud_storage::model::bucket::RetentionPolicy;
7305        /// use wkt::Duration;
7306        /// let x = RetentionPolicy::new().set_retention_duration(Duration::default()/* use setters */);
7307        /// ```
7308        pub fn set_retention_duration<T>(mut self, v: T) -> Self
7309        where
7310            T: std::convert::Into<wkt::Duration>,
7311        {
7312            self.retention_duration = std::option::Option::Some(v.into());
7313            self
7314        }
7315
7316        /// Sets or clears the value of [retention_duration][crate::model::bucket::RetentionPolicy::retention_duration].
7317        ///
7318        /// # Example
7319        /// ```ignore,no_run
7320        /// # use google_cloud_storage::model::bucket::RetentionPolicy;
7321        /// use wkt::Duration;
7322        /// let x = RetentionPolicy::new().set_or_clear_retention_duration(Some(Duration::default()/* use setters */));
7323        /// let x = RetentionPolicy::new().set_or_clear_retention_duration(None::<Duration>);
7324        /// ```
7325        pub fn set_or_clear_retention_duration<T>(mut self, v: std::option::Option<T>) -> Self
7326        where
7327            T: std::convert::Into<wkt::Duration>,
7328        {
7329            self.retention_duration = v.map(|x| x.into());
7330            self
7331        }
7332    }
7333
7334    impl wkt::message::Message for RetentionPolicy {
7335        fn typename() -> &'static str {
7336            "type.googleapis.com/google.storage.v2.Bucket.RetentionPolicy"
7337        }
7338    }
7339
7340    /// Soft delete policy properties of a bucket.
7341    #[derive(Clone, Default, PartialEq)]
7342    #[non_exhaustive]
7343    pub struct SoftDeletePolicy {
7344        /// The period of time that soft-deleted objects in the bucket must be
7345        /// retained and cannot be permanently deleted. The duration must be greater
7346        /// than or equal to 7 days and less than 1 year.
7347        pub retention_duration: std::option::Option<wkt::Duration>,
7348
7349        /// Time from which the policy was effective. This is service-provided.
7350        pub effective_time: std::option::Option<wkt::Timestamp>,
7351
7352        pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
7353    }
7354
7355    impl SoftDeletePolicy {
7356        /// Creates a new default instance.
7357        pub fn new() -> Self {
7358            std::default::Default::default()
7359        }
7360
7361        /// Sets the value of [retention_duration][crate::model::bucket::SoftDeletePolicy::retention_duration].
7362        ///
7363        /// # Example
7364        /// ```ignore,no_run
7365        /// # use google_cloud_storage::model::bucket::SoftDeletePolicy;
7366        /// use wkt::Duration;
7367        /// let x = SoftDeletePolicy::new().set_retention_duration(Duration::default()/* use setters */);
7368        /// ```
7369        pub fn set_retention_duration<T>(mut self, v: T) -> Self
7370        where
7371            T: std::convert::Into<wkt::Duration>,
7372        {
7373            self.retention_duration = std::option::Option::Some(v.into());
7374            self
7375        }
7376
7377        /// Sets or clears the value of [retention_duration][crate::model::bucket::SoftDeletePolicy::retention_duration].
7378        ///
7379        /// # Example
7380        /// ```ignore,no_run
7381        /// # use google_cloud_storage::model::bucket::SoftDeletePolicy;
7382        /// use wkt::Duration;
7383        /// let x = SoftDeletePolicy::new().set_or_clear_retention_duration(Some(Duration::default()/* use setters */));
7384        /// let x = SoftDeletePolicy::new().set_or_clear_retention_duration(None::<Duration>);
7385        /// ```
7386        pub fn set_or_clear_retention_duration<T>(mut self, v: std::option::Option<T>) -> Self
7387        where
7388            T: std::convert::Into<wkt::Duration>,
7389        {
7390            self.retention_duration = v.map(|x| x.into());
7391            self
7392        }
7393
7394        /// Sets the value of [effective_time][crate::model::bucket::SoftDeletePolicy::effective_time].
7395        ///
7396        /// # Example
7397        /// ```ignore,no_run
7398        /// # use google_cloud_storage::model::bucket::SoftDeletePolicy;
7399        /// use wkt::Timestamp;
7400        /// let x = SoftDeletePolicy::new().set_effective_time(Timestamp::default()/* use setters */);
7401        /// ```
7402        pub fn set_effective_time<T>(mut self, v: T) -> Self
7403        where
7404            T: std::convert::Into<wkt::Timestamp>,
7405        {
7406            self.effective_time = std::option::Option::Some(v.into());
7407            self
7408        }
7409
7410        /// Sets or clears the value of [effective_time][crate::model::bucket::SoftDeletePolicy::effective_time].
7411        ///
7412        /// # Example
7413        /// ```ignore,no_run
7414        /// # use google_cloud_storage::model::bucket::SoftDeletePolicy;
7415        /// use wkt::Timestamp;
7416        /// let x = SoftDeletePolicy::new().set_or_clear_effective_time(Some(Timestamp::default()/* use setters */));
7417        /// let x = SoftDeletePolicy::new().set_or_clear_effective_time(None::<Timestamp>);
7418        /// ```
7419        pub fn set_or_clear_effective_time<T>(mut self, v: std::option::Option<T>) -> Self
7420        where
7421            T: std::convert::Into<wkt::Timestamp>,
7422        {
7423            self.effective_time = v.map(|x| x.into());
7424            self
7425        }
7426    }
7427
7428    impl wkt::message::Message for SoftDeletePolicy {
7429        fn typename() -> &'static str {
7430            "type.googleapis.com/google.storage.v2.Bucket.SoftDeletePolicy"
7431        }
7432    }
7433
7434    /// Properties of a bucket related to versioning.
7435    /// For more information about Cloud Storage versioning, see [Object
7436    /// versioning](https://cloud.google.com/storage/docs/object-versioning).
7437    #[derive(Clone, Default, PartialEq)]
7438    #[non_exhaustive]
7439    pub struct Versioning {
7440        /// Optional. While set to true, versioning is fully enabled for this bucket.
7441        pub enabled: bool,
7442
7443        pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
7444    }
7445
7446    impl Versioning {
7447        /// Creates a new default instance.
7448        pub fn new() -> Self {
7449            std::default::Default::default()
7450        }
7451
7452        /// Sets the value of [enabled][crate::model::bucket::Versioning::enabled].
7453        ///
7454        /// # Example
7455        /// ```ignore,no_run
7456        /// # use google_cloud_storage::model::bucket::Versioning;
7457        /// let x = Versioning::new().set_enabled(true);
7458        /// ```
7459        pub fn set_enabled<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
7460            self.enabled = v.into();
7461            self
7462        }
7463    }
7464
7465    impl wkt::message::Message for Versioning {
7466        fn typename() -> &'static str {
7467            "type.googleapis.com/google.storage.v2.Bucket.Versioning"
7468        }
7469    }
7470
7471    /// Properties of a bucket related to accessing the contents as a static
7472    /// website. For details, see [hosting a static website using Cloud
7473    /// Storage](https://cloud.google.com/storage/docs/hosting-static-website).
7474    #[derive(Clone, Default, PartialEq)]
7475    #[non_exhaustive]
7476    pub struct Website {
7477        /// Optional. If the requested object path is missing, the service ensures
7478        /// the path has a trailing '/', append this suffix, and attempt to retrieve
7479        /// the resulting object. This allows the creation of `index.html` objects to
7480        /// represent directory pages.
7481        pub main_page_suffix: std::string::String,
7482
7483        /// Optional. If the requested object path is missing, and any
7484        /// `mainPageSuffix` object is missing, if applicable, the service
7485        /// returns the named object from this bucket as the content for a
7486        /// [404 Not Found](https://tools.ietf.org/html/rfc7231#section-6.5.4)
7487        /// result.
7488        pub not_found_page: std::string::String,
7489
7490        pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
7491    }
7492
7493    impl Website {
7494        /// Creates a new default instance.
7495        pub fn new() -> Self {
7496            std::default::Default::default()
7497        }
7498
7499        /// Sets the value of [main_page_suffix][crate::model::bucket::Website::main_page_suffix].
7500        ///
7501        /// # Example
7502        /// ```ignore,no_run
7503        /// # use google_cloud_storage::model::bucket::Website;
7504        /// let x = Website::new().set_main_page_suffix("example");
7505        /// ```
7506        pub fn set_main_page_suffix<T: std::convert::Into<std::string::String>>(
7507            mut self,
7508            v: T,
7509        ) -> Self {
7510            self.main_page_suffix = v.into();
7511            self
7512        }
7513
7514        /// Sets the value of [not_found_page][crate::model::bucket::Website::not_found_page].
7515        ///
7516        /// # Example
7517        /// ```ignore,no_run
7518        /// # use google_cloud_storage::model::bucket::Website;
7519        /// let x = Website::new().set_not_found_page("example");
7520        /// ```
7521        pub fn set_not_found_page<T: std::convert::Into<std::string::String>>(
7522            mut self,
7523            v: T,
7524        ) -> Self {
7525            self.not_found_page = v.into();
7526            self
7527        }
7528    }
7529
7530    impl wkt::message::Message for Website {
7531        fn typename() -> &'static str {
7532            "type.googleapis.com/google.storage.v2.Bucket.Website"
7533        }
7534    }
7535
7536    /// Configuration for [configurable dual-
7537    /// regions](https://cloud.google.com/storage/docs/locations#configurable). It
7538    /// should specify precisely two eligible regions within the same multi-region.
7539    /// For details, see
7540    /// [locations](https://cloud.google.com/storage/docs/locations).
7541    #[derive(Clone, Default, PartialEq)]
7542    #[non_exhaustive]
7543    pub struct CustomPlacementConfig {
7544        /// Optional. List of locations to use for data placement.
7545        pub data_locations: std::vec::Vec<std::string::String>,
7546
7547        pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
7548    }
7549
7550    impl CustomPlacementConfig {
7551        /// Creates a new default instance.
7552        pub fn new() -> Self {
7553            std::default::Default::default()
7554        }
7555
7556        /// Sets the value of [data_locations][crate::model::bucket::CustomPlacementConfig::data_locations].
7557        ///
7558        /// # Example
7559        /// ```ignore,no_run
7560        /// # use google_cloud_storage::model::bucket::CustomPlacementConfig;
7561        /// let x = CustomPlacementConfig::new().set_data_locations(["a", "b", "c"]);
7562        /// ```
7563        pub fn set_data_locations<T, V>(mut self, v: T) -> Self
7564        where
7565            T: std::iter::IntoIterator<Item = V>,
7566            V: std::convert::Into<std::string::String>,
7567        {
7568            use std::iter::Iterator;
7569            self.data_locations = v.into_iter().map(|i| i.into()).collect();
7570            self
7571        }
7572    }
7573
7574    impl wkt::message::Message for CustomPlacementConfig {
7575        fn typename() -> &'static str {
7576            "type.googleapis.com/google.storage.v2.Bucket.CustomPlacementConfig"
7577        }
7578    }
7579
7580    /// Configuration for a bucket's Autoclass feature.
7581    #[derive(Clone, Default, PartialEq)]
7582    #[non_exhaustive]
7583    pub struct Autoclass {
7584        /// Optional. Enables Autoclass.
7585        pub enabled: bool,
7586
7587        /// Output only. Latest instant at which the `enabled` field was set to true
7588        /// after being disabled/unconfigured or set to false after being enabled. If
7589        /// Autoclass is enabled when the bucket is created, the value of the
7590        /// `toggle_time` field is set to the bucket `create_time`.
7591        pub toggle_time: std::option::Option<wkt::Timestamp>,
7592
7593        /// An object in an Autoclass bucket eventually cools down to the
7594        /// terminal storage class if there is no access to the object.
7595        /// The only valid values are NEARLINE and ARCHIVE.
7596        pub terminal_storage_class: std::option::Option<std::string::String>,
7597
7598        /// Output only. Latest instant at which the autoclass terminal storage class
7599        /// was updated.
7600        pub terminal_storage_class_update_time: std::option::Option<wkt::Timestamp>,
7601
7602        pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
7603    }
7604
7605    impl Autoclass {
7606        /// Creates a new default instance.
7607        pub fn new() -> Self {
7608            std::default::Default::default()
7609        }
7610
7611        /// Sets the value of [enabled][crate::model::bucket::Autoclass::enabled].
7612        ///
7613        /// # Example
7614        /// ```ignore,no_run
7615        /// # use google_cloud_storage::model::bucket::Autoclass;
7616        /// let x = Autoclass::new().set_enabled(true);
7617        /// ```
7618        pub fn set_enabled<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
7619            self.enabled = v.into();
7620            self
7621        }
7622
7623        /// Sets the value of [toggle_time][crate::model::bucket::Autoclass::toggle_time].
7624        ///
7625        /// # Example
7626        /// ```ignore,no_run
7627        /// # use google_cloud_storage::model::bucket::Autoclass;
7628        /// use wkt::Timestamp;
7629        /// let x = Autoclass::new().set_toggle_time(Timestamp::default()/* use setters */);
7630        /// ```
7631        pub fn set_toggle_time<T>(mut self, v: T) -> Self
7632        where
7633            T: std::convert::Into<wkt::Timestamp>,
7634        {
7635            self.toggle_time = std::option::Option::Some(v.into());
7636            self
7637        }
7638
7639        /// Sets or clears the value of [toggle_time][crate::model::bucket::Autoclass::toggle_time].
7640        ///
7641        /// # Example
7642        /// ```ignore,no_run
7643        /// # use google_cloud_storage::model::bucket::Autoclass;
7644        /// use wkt::Timestamp;
7645        /// let x = Autoclass::new().set_or_clear_toggle_time(Some(Timestamp::default()/* use setters */));
7646        /// let x = Autoclass::new().set_or_clear_toggle_time(None::<Timestamp>);
7647        /// ```
7648        pub fn set_or_clear_toggle_time<T>(mut self, v: std::option::Option<T>) -> Self
7649        where
7650            T: std::convert::Into<wkt::Timestamp>,
7651        {
7652            self.toggle_time = v.map(|x| x.into());
7653            self
7654        }
7655
7656        /// Sets the value of [terminal_storage_class][crate::model::bucket::Autoclass::terminal_storage_class].
7657        ///
7658        /// # Example
7659        /// ```ignore,no_run
7660        /// # use google_cloud_storage::model::bucket::Autoclass;
7661        /// let x = Autoclass::new().set_terminal_storage_class("example");
7662        /// ```
7663        pub fn set_terminal_storage_class<T>(mut self, v: T) -> Self
7664        where
7665            T: std::convert::Into<std::string::String>,
7666        {
7667            self.terminal_storage_class = std::option::Option::Some(v.into());
7668            self
7669        }
7670
7671        /// Sets or clears the value of [terminal_storage_class][crate::model::bucket::Autoclass::terminal_storage_class].
7672        ///
7673        /// # Example
7674        /// ```ignore,no_run
7675        /// # use google_cloud_storage::model::bucket::Autoclass;
7676        /// let x = Autoclass::new().set_or_clear_terminal_storage_class(Some("example"));
7677        /// let x = Autoclass::new().set_or_clear_terminal_storage_class(None::<String>);
7678        /// ```
7679        pub fn set_or_clear_terminal_storage_class<T>(mut self, v: std::option::Option<T>) -> Self
7680        where
7681            T: std::convert::Into<std::string::String>,
7682        {
7683            self.terminal_storage_class = v.map(|x| x.into());
7684            self
7685        }
7686
7687        /// Sets the value of [terminal_storage_class_update_time][crate::model::bucket::Autoclass::terminal_storage_class_update_time].
7688        ///
7689        /// # Example
7690        /// ```ignore,no_run
7691        /// # use google_cloud_storage::model::bucket::Autoclass;
7692        /// use wkt::Timestamp;
7693        /// let x = Autoclass::new().set_terminal_storage_class_update_time(Timestamp::default()/* use setters */);
7694        /// ```
7695        pub fn set_terminal_storage_class_update_time<T>(mut self, v: T) -> Self
7696        where
7697            T: std::convert::Into<wkt::Timestamp>,
7698        {
7699            self.terminal_storage_class_update_time = std::option::Option::Some(v.into());
7700            self
7701        }
7702
7703        /// Sets or clears the value of [terminal_storage_class_update_time][crate::model::bucket::Autoclass::terminal_storage_class_update_time].
7704        ///
7705        /// # Example
7706        /// ```ignore,no_run
7707        /// # use google_cloud_storage::model::bucket::Autoclass;
7708        /// use wkt::Timestamp;
7709        /// let x = Autoclass::new().set_or_clear_terminal_storage_class_update_time(Some(Timestamp::default()/* use setters */));
7710        /// let x = Autoclass::new().set_or_clear_terminal_storage_class_update_time(None::<Timestamp>);
7711        /// ```
7712        pub fn set_or_clear_terminal_storage_class_update_time<T>(
7713            mut self,
7714            v: std::option::Option<T>,
7715        ) -> Self
7716        where
7717            T: std::convert::Into<wkt::Timestamp>,
7718        {
7719            self.terminal_storage_class_update_time = v.map(|x| x.into());
7720            self
7721        }
7722    }
7723
7724    impl wkt::message::Message for Autoclass {
7725        fn typename() -> &'static str {
7726            "type.googleapis.com/google.storage.v2.Bucket.Autoclass"
7727        }
7728    }
7729
7730    /// The [bucket IP
7731    /// filtering](https://cloud.google.com/storage/docs/ip-filtering-overview)
7732    /// configuration. Specifies the network sources that can access the bucket, as
7733    /// well as its underlying objects.
7734    #[derive(Clone, Default, PartialEq)]
7735    #[non_exhaustive]
7736    pub struct IpFilter {
7737        /// The state of the IP filter configuration. Valid values are `Enabled` and
7738        /// `Disabled`. When set to `Enabled`, IP filtering rules are applied to a
7739        /// bucket and all incoming requests to the bucket are evaluated against
7740        /// these rules. When set to `Disabled`, IP filtering rules are not applied
7741        /// to a bucket.
7742        pub mode: std::option::Option<std::string::String>,
7743
7744        /// Public IPs allowed to operate or access the bucket.
7745        pub public_network_source:
7746            std::option::Option<crate::model::bucket::ip_filter::PublicNetworkSource>,
7747
7748        /// Optional. The list of network sources that are allowed to access
7749        /// operations on the bucket or the underlying objects.
7750        pub vpc_network_sources: std::vec::Vec<crate::model::bucket::ip_filter::VpcNetworkSource>,
7751
7752        /// Optional. Whether or not to allow VPCs from orgs different than the
7753        /// bucket's parent org to access the bucket. When set to true, validations
7754        /// on the existence of the VPCs won't be performed. If set to false, each
7755        /// VPC network source is checked to belong to the same org as the bucket as
7756        /// well as validated for existence.
7757        pub allow_cross_org_vpcs: bool,
7758
7759        /// Whether or not to allow all P4SA access to the bucket. When set to true,
7760        /// IP filter config validation doesn't apply.
7761        pub allow_all_service_agent_access: std::option::Option<bool>,
7762
7763        pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
7764    }
7765
7766    impl IpFilter {
7767        /// Creates a new default instance.
7768        pub fn new() -> Self {
7769            std::default::Default::default()
7770        }
7771
7772        /// Sets the value of [mode][crate::model::bucket::IpFilter::mode].
7773        ///
7774        /// # Example
7775        /// ```ignore,no_run
7776        /// # use google_cloud_storage::model::bucket::IpFilter;
7777        /// let x = IpFilter::new().set_mode("example");
7778        /// ```
7779        pub fn set_mode<T>(mut self, v: T) -> Self
7780        where
7781            T: std::convert::Into<std::string::String>,
7782        {
7783            self.mode = std::option::Option::Some(v.into());
7784            self
7785        }
7786
7787        /// Sets or clears the value of [mode][crate::model::bucket::IpFilter::mode].
7788        ///
7789        /// # Example
7790        /// ```ignore,no_run
7791        /// # use google_cloud_storage::model::bucket::IpFilter;
7792        /// let x = IpFilter::new().set_or_clear_mode(Some("example"));
7793        /// let x = IpFilter::new().set_or_clear_mode(None::<String>);
7794        /// ```
7795        pub fn set_or_clear_mode<T>(mut self, v: std::option::Option<T>) -> Self
7796        where
7797            T: std::convert::Into<std::string::String>,
7798        {
7799            self.mode = v.map(|x| x.into());
7800            self
7801        }
7802
7803        /// Sets the value of [public_network_source][crate::model::bucket::IpFilter::public_network_source].
7804        ///
7805        /// # Example
7806        /// ```ignore,no_run
7807        /// # use google_cloud_storage::model::bucket::IpFilter;
7808        /// use google_cloud_storage::model::bucket::ip_filter::PublicNetworkSource;
7809        /// let x = IpFilter::new().set_public_network_source(PublicNetworkSource::default()/* use setters */);
7810        /// ```
7811        pub fn set_public_network_source<T>(mut self, v: T) -> Self
7812        where
7813            T: std::convert::Into<crate::model::bucket::ip_filter::PublicNetworkSource>,
7814        {
7815            self.public_network_source = std::option::Option::Some(v.into());
7816            self
7817        }
7818
7819        /// Sets or clears the value of [public_network_source][crate::model::bucket::IpFilter::public_network_source].
7820        ///
7821        /// # Example
7822        /// ```ignore,no_run
7823        /// # use google_cloud_storage::model::bucket::IpFilter;
7824        /// use google_cloud_storage::model::bucket::ip_filter::PublicNetworkSource;
7825        /// let x = IpFilter::new().set_or_clear_public_network_source(Some(PublicNetworkSource::default()/* use setters */));
7826        /// let x = IpFilter::new().set_or_clear_public_network_source(None::<PublicNetworkSource>);
7827        /// ```
7828        pub fn set_or_clear_public_network_source<T>(mut self, v: std::option::Option<T>) -> Self
7829        where
7830            T: std::convert::Into<crate::model::bucket::ip_filter::PublicNetworkSource>,
7831        {
7832            self.public_network_source = v.map(|x| x.into());
7833            self
7834        }
7835
7836        /// Sets the value of [vpc_network_sources][crate::model::bucket::IpFilter::vpc_network_sources].
7837        ///
7838        /// # Example
7839        /// ```ignore,no_run
7840        /// # use google_cloud_storage::model::bucket::IpFilter;
7841        /// use google_cloud_storage::model::bucket::ip_filter::VpcNetworkSource;
7842        /// let x = IpFilter::new()
7843        ///     .set_vpc_network_sources([
7844        ///         VpcNetworkSource::default()/* use setters */,
7845        ///         VpcNetworkSource::default()/* use (different) setters */,
7846        ///     ]);
7847        /// ```
7848        pub fn set_vpc_network_sources<T, V>(mut self, v: T) -> Self
7849        where
7850            T: std::iter::IntoIterator<Item = V>,
7851            V: std::convert::Into<crate::model::bucket::ip_filter::VpcNetworkSource>,
7852        {
7853            use std::iter::Iterator;
7854            self.vpc_network_sources = v.into_iter().map(|i| i.into()).collect();
7855            self
7856        }
7857
7858        /// Sets the value of [allow_cross_org_vpcs][crate::model::bucket::IpFilter::allow_cross_org_vpcs].
7859        ///
7860        /// # Example
7861        /// ```ignore,no_run
7862        /// # use google_cloud_storage::model::bucket::IpFilter;
7863        /// let x = IpFilter::new().set_allow_cross_org_vpcs(true);
7864        /// ```
7865        pub fn set_allow_cross_org_vpcs<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
7866            self.allow_cross_org_vpcs = v.into();
7867            self
7868        }
7869
7870        /// Sets the value of [allow_all_service_agent_access][crate::model::bucket::IpFilter::allow_all_service_agent_access].
7871        ///
7872        /// # Example
7873        /// ```ignore,no_run
7874        /// # use google_cloud_storage::model::bucket::IpFilter;
7875        /// let x = IpFilter::new().set_allow_all_service_agent_access(true);
7876        /// ```
7877        pub fn set_allow_all_service_agent_access<T>(mut self, v: T) -> Self
7878        where
7879            T: std::convert::Into<bool>,
7880        {
7881            self.allow_all_service_agent_access = std::option::Option::Some(v.into());
7882            self
7883        }
7884
7885        /// Sets or clears the value of [allow_all_service_agent_access][crate::model::bucket::IpFilter::allow_all_service_agent_access].
7886        ///
7887        /// # Example
7888        /// ```ignore,no_run
7889        /// # use google_cloud_storage::model::bucket::IpFilter;
7890        /// let x = IpFilter::new().set_or_clear_allow_all_service_agent_access(Some(false));
7891        /// let x = IpFilter::new().set_or_clear_allow_all_service_agent_access(None::<bool>);
7892        /// ```
7893        pub fn set_or_clear_allow_all_service_agent_access<T>(
7894            mut self,
7895            v: std::option::Option<T>,
7896        ) -> Self
7897        where
7898            T: std::convert::Into<bool>,
7899        {
7900            self.allow_all_service_agent_access = v.map(|x| x.into());
7901            self
7902        }
7903    }
7904
7905    impl wkt::message::Message for IpFilter {
7906        fn typename() -> &'static str {
7907            "type.googleapis.com/google.storage.v2.Bucket.IpFilter"
7908        }
7909    }
7910
7911    /// Defines additional types related to [IpFilter].
7912    pub mod ip_filter {
7913        #[allow(unused_imports)]
7914        use super::*;
7915
7916        /// The public network IP address ranges that can access the bucket and its
7917        /// data.
7918        #[derive(Clone, Default, PartialEq)]
7919        #[non_exhaustive]
7920        pub struct PublicNetworkSource {
7921            /// Optional. The list of IPv4 and IPv6 cidr blocks that are allowed to
7922            /// operate or access the bucket and its underlying objects.
7923            pub allowed_ip_cidr_ranges: std::vec::Vec<std::string::String>,
7924
7925            pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
7926        }
7927
7928        impl PublicNetworkSource {
7929            /// Creates a new default instance.
7930            pub fn new() -> Self {
7931                std::default::Default::default()
7932            }
7933
7934            /// Sets the value of [allowed_ip_cidr_ranges][crate::model::bucket::ip_filter::PublicNetworkSource::allowed_ip_cidr_ranges].
7935            ///
7936            /// # Example
7937            /// ```ignore,no_run
7938            /// # use google_cloud_storage::model::bucket::ip_filter::PublicNetworkSource;
7939            /// let x = PublicNetworkSource::new().set_allowed_ip_cidr_ranges(["a", "b", "c"]);
7940            /// ```
7941            pub fn set_allowed_ip_cidr_ranges<T, V>(mut self, v: T) -> Self
7942            where
7943                T: std::iter::IntoIterator<Item = V>,
7944                V: std::convert::Into<std::string::String>,
7945            {
7946                use std::iter::Iterator;
7947                self.allowed_ip_cidr_ranges = v.into_iter().map(|i| i.into()).collect();
7948                self
7949            }
7950        }
7951
7952        impl wkt::message::Message for PublicNetworkSource {
7953            fn typename() -> &'static str {
7954                "type.googleapis.com/google.storage.v2.Bucket.IpFilter.PublicNetworkSource"
7955            }
7956        }
7957
7958        /// The list of VPC networks that can access the bucket.
7959        #[derive(Clone, Default, PartialEq)]
7960        #[non_exhaustive]
7961        pub struct VpcNetworkSource {
7962            /// Name of the network.
7963            ///
7964            /// Format: `projects/PROJECT_ID/global/networks/NETWORK_NAME`
7965            pub network: std::option::Option<std::string::String>,
7966
7967            /// Optional. The list of public or private IPv4 and IPv6 CIDR ranges that
7968            /// can access the bucket. In the CIDR IP address block, the specified IP
7969            /// address must be properly truncated, meaning all the host bits must be
7970            /// zero or else the input is considered malformed. For example,
7971            /// `192.0.2.0/24` is accepted but `192.0.2.1/24` is not. Similarly, for
7972            /// IPv6, `2001:db8::/32` is accepted whereas `2001:db8::1/32` is not.
7973            pub allowed_ip_cidr_ranges: std::vec::Vec<std::string::String>,
7974
7975            pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
7976        }
7977
7978        impl VpcNetworkSource {
7979            /// Creates a new default instance.
7980            pub fn new() -> Self {
7981                std::default::Default::default()
7982            }
7983
7984            /// Sets the value of [network][crate::model::bucket::ip_filter::VpcNetworkSource::network].
7985            ///
7986            /// # Example
7987            /// ```ignore,no_run
7988            /// # use google_cloud_storage::model::bucket::ip_filter::VpcNetworkSource;
7989            /// let x = VpcNetworkSource::new().set_network("example");
7990            /// ```
7991            pub fn set_network<T>(mut self, v: T) -> Self
7992            where
7993                T: std::convert::Into<std::string::String>,
7994            {
7995                self.network = std::option::Option::Some(v.into());
7996                self
7997            }
7998
7999            /// Sets or clears the value of [network][crate::model::bucket::ip_filter::VpcNetworkSource::network].
8000            ///
8001            /// # Example
8002            /// ```ignore,no_run
8003            /// # use google_cloud_storage::model::bucket::ip_filter::VpcNetworkSource;
8004            /// let x = VpcNetworkSource::new().set_or_clear_network(Some("example"));
8005            /// let x = VpcNetworkSource::new().set_or_clear_network(None::<String>);
8006            /// ```
8007            pub fn set_or_clear_network<T>(mut self, v: std::option::Option<T>) -> Self
8008            where
8009                T: std::convert::Into<std::string::String>,
8010            {
8011                self.network = v.map(|x| x.into());
8012                self
8013            }
8014
8015            /// Sets the value of [allowed_ip_cidr_ranges][crate::model::bucket::ip_filter::VpcNetworkSource::allowed_ip_cidr_ranges].
8016            ///
8017            /// # Example
8018            /// ```ignore,no_run
8019            /// # use google_cloud_storage::model::bucket::ip_filter::VpcNetworkSource;
8020            /// let x = VpcNetworkSource::new().set_allowed_ip_cidr_ranges(["a", "b", "c"]);
8021            /// ```
8022            pub fn set_allowed_ip_cidr_ranges<T, V>(mut self, v: T) -> Self
8023            where
8024                T: std::iter::IntoIterator<Item = V>,
8025                V: std::convert::Into<std::string::String>,
8026            {
8027                use std::iter::Iterator;
8028                self.allowed_ip_cidr_ranges = v.into_iter().map(|i| i.into()).collect();
8029                self
8030            }
8031        }
8032
8033        impl wkt::message::Message for VpcNetworkSource {
8034            fn typename() -> &'static str {
8035                "type.googleapis.com/google.storage.v2.Bucket.IpFilter.VpcNetworkSource"
8036            }
8037        }
8038    }
8039
8040    /// Configuration for a bucket's hierarchical namespace feature.
8041    #[derive(Clone, Default, PartialEq)]
8042    #[non_exhaustive]
8043    pub struct HierarchicalNamespace {
8044        /// Optional. Enables the hierarchical namespace feature.
8045        pub enabled: bool,
8046
8047        pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
8048    }
8049
8050    impl HierarchicalNamespace {
8051        /// Creates a new default instance.
8052        pub fn new() -> Self {
8053            std::default::Default::default()
8054        }
8055
8056        /// Sets the value of [enabled][crate::model::bucket::HierarchicalNamespace::enabled].
8057        ///
8058        /// # Example
8059        /// ```ignore,no_run
8060        /// # use google_cloud_storage::model::bucket::HierarchicalNamespace;
8061        /// let x = HierarchicalNamespace::new().set_enabled(true);
8062        /// ```
8063        pub fn set_enabled<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
8064            self.enabled = v.into();
8065            self
8066        }
8067    }
8068
8069    impl wkt::message::Message for HierarchicalNamespace {
8070        fn typename() -> &'static str {
8071            "type.googleapis.com/google.storage.v2.Bucket.HierarchicalNamespace"
8072        }
8073    }
8074}
8075
8076/// An access-control entry.
8077#[derive(Clone, Default, PartialEq)]
8078#[non_exhaustive]
8079pub struct BucketAccessControl {
8080    /// Optional. The access permission for the entity.
8081    pub role: std::string::String,
8082
8083    /// Optional. The ID of the access-control entry.
8084    pub id: std::string::String,
8085
8086    /// Optional. The entity holding the permission, in one of the following forms:
8087    ///
8088    /// * `user-{userid}`
8089    /// * `user-{email}`
8090    /// * `group-{groupid}`
8091    /// * `group-{email}`
8092    /// * `domain-{domain}`
8093    /// * `project-{team}-{projectnumber}`
8094    /// * `project-{team}-{projectid}`
8095    /// * `allUsers`
8096    /// * `allAuthenticatedUsers`
8097    ///   Examples:
8098    /// * The user `liz@example.com` would be `user-liz@example.com`.
8099    /// * The group `example@googlegroups.com` would be
8100    ///   `group-example@googlegroups.com`
8101    /// * All members of the Google Apps for Business domain `example.com` would be
8102    ///   `domain-example.com`
8103    ///   For project entities, `project-{team}-{projectnumber}` format is
8104    ///   returned on response.
8105    pub entity: std::string::String,
8106
8107    /// Output only. The alternative entity format, if exists. For project
8108    /// entities, `project-{team}-{projectid}` format is returned in the response.
8109    pub entity_alt: std::string::String,
8110
8111    /// Optional. The ID for the entity, if any.
8112    pub entity_id: std::string::String,
8113
8114    /// Optional. The `etag` of the `BucketAccessControl`.
8115    /// If included in the metadata of an update or delete request message, the
8116    /// operation operation is only performed if the etag matches that of the
8117    /// bucket's `BucketAccessControl`.
8118    pub etag: std::string::String,
8119
8120    /// Optional. The email address associated with the entity, if any.
8121    pub email: std::string::String,
8122
8123    /// Optional. The domain associated with the entity, if any.
8124    pub domain: std::string::String,
8125
8126    /// Optional. The project team associated with the entity, if any.
8127    pub project_team: std::option::Option<crate::model::ProjectTeam>,
8128
8129    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
8130}
8131
8132impl BucketAccessControl {
8133    /// Creates a new default instance.
8134    pub fn new() -> Self {
8135        std::default::Default::default()
8136    }
8137
8138    /// Sets the value of [role][crate::model::BucketAccessControl::role].
8139    ///
8140    /// # Example
8141    /// ```ignore,no_run
8142    /// # use google_cloud_storage::model::BucketAccessControl;
8143    /// let x = BucketAccessControl::new().set_role("example");
8144    /// ```
8145    pub fn set_role<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
8146        self.role = v.into();
8147        self
8148    }
8149
8150    /// Sets the value of [id][crate::model::BucketAccessControl::id].
8151    ///
8152    /// # Example
8153    /// ```ignore,no_run
8154    /// # use google_cloud_storage::model::BucketAccessControl;
8155    /// let x = BucketAccessControl::new().set_id("example");
8156    /// ```
8157    pub fn set_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
8158        self.id = v.into();
8159        self
8160    }
8161
8162    /// Sets the value of [entity][crate::model::BucketAccessControl::entity].
8163    ///
8164    /// # Example
8165    /// ```ignore,no_run
8166    /// # use google_cloud_storage::model::BucketAccessControl;
8167    /// let x = BucketAccessControl::new().set_entity("example");
8168    /// ```
8169    pub fn set_entity<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
8170        self.entity = v.into();
8171        self
8172    }
8173
8174    /// Sets the value of [entity_alt][crate::model::BucketAccessControl::entity_alt].
8175    ///
8176    /// # Example
8177    /// ```ignore,no_run
8178    /// # use google_cloud_storage::model::BucketAccessControl;
8179    /// let x = BucketAccessControl::new().set_entity_alt("example");
8180    /// ```
8181    pub fn set_entity_alt<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
8182        self.entity_alt = v.into();
8183        self
8184    }
8185
8186    /// Sets the value of [entity_id][crate::model::BucketAccessControl::entity_id].
8187    ///
8188    /// # Example
8189    /// ```ignore,no_run
8190    /// # use google_cloud_storage::model::BucketAccessControl;
8191    /// let x = BucketAccessControl::new().set_entity_id("example");
8192    /// ```
8193    pub fn set_entity_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
8194        self.entity_id = v.into();
8195        self
8196    }
8197
8198    /// Sets the value of [etag][crate::model::BucketAccessControl::etag].
8199    ///
8200    /// # Example
8201    /// ```ignore,no_run
8202    /// # use google_cloud_storage::model::BucketAccessControl;
8203    /// let x = BucketAccessControl::new().set_etag("example");
8204    /// ```
8205    pub fn set_etag<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
8206        self.etag = v.into();
8207        self
8208    }
8209
8210    /// Sets the value of [email][crate::model::BucketAccessControl::email].
8211    ///
8212    /// # Example
8213    /// ```ignore,no_run
8214    /// # use google_cloud_storage::model::BucketAccessControl;
8215    /// let x = BucketAccessControl::new().set_email("example");
8216    /// ```
8217    pub fn set_email<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
8218        self.email = v.into();
8219        self
8220    }
8221
8222    /// Sets the value of [domain][crate::model::BucketAccessControl::domain].
8223    ///
8224    /// # Example
8225    /// ```ignore,no_run
8226    /// # use google_cloud_storage::model::BucketAccessControl;
8227    /// let x = BucketAccessControl::new().set_domain("example");
8228    /// ```
8229    pub fn set_domain<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
8230        self.domain = v.into();
8231        self
8232    }
8233
8234    /// Sets the value of [project_team][crate::model::BucketAccessControl::project_team].
8235    ///
8236    /// # Example
8237    /// ```ignore,no_run
8238    /// # use google_cloud_storage::model::BucketAccessControl;
8239    /// use google_cloud_storage::model::ProjectTeam;
8240    /// let x = BucketAccessControl::new().set_project_team(ProjectTeam::default()/* use setters */);
8241    /// ```
8242    pub fn set_project_team<T>(mut self, v: T) -> Self
8243    where
8244        T: std::convert::Into<crate::model::ProjectTeam>,
8245    {
8246        self.project_team = std::option::Option::Some(v.into());
8247        self
8248    }
8249
8250    /// Sets or clears the value of [project_team][crate::model::BucketAccessControl::project_team].
8251    ///
8252    /// # Example
8253    /// ```ignore,no_run
8254    /// # use google_cloud_storage::model::BucketAccessControl;
8255    /// use google_cloud_storage::model::ProjectTeam;
8256    /// let x = BucketAccessControl::new().set_or_clear_project_team(Some(ProjectTeam::default()/* use setters */));
8257    /// let x = BucketAccessControl::new().set_or_clear_project_team(None::<ProjectTeam>);
8258    /// ```
8259    pub fn set_or_clear_project_team<T>(mut self, v: std::option::Option<T>) -> Self
8260    where
8261        T: std::convert::Into<crate::model::ProjectTeam>,
8262    {
8263        self.project_team = v.map(|x| x.into());
8264        self
8265    }
8266}
8267
8268impl wkt::message::Message for BucketAccessControl {
8269    fn typename() -> &'static str {
8270        "type.googleapis.com/google.storage.v2.BucketAccessControl"
8271    }
8272}
8273
8274/// Message used for storing full (not subrange) object checksums.
8275#[derive(Clone, Default, PartialEq)]
8276#[non_exhaustive]
8277pub struct ObjectChecksums {
8278    /// CRC32C digest of the object data. Computed by the Cloud Storage service for
8279    /// all written objects.
8280    /// If set in a WriteObjectRequest, service validates that the stored
8281    /// object matches this checksum.
8282    pub crc32c: std::option::Option<u32>,
8283
8284    /// Optional. 128 bit MD5 hash of the object data. For more information about
8285    /// using the MD5 hash, see [Data validation and change
8286    /// detection](https://cloud.google.com/storage/docs/data-validation). Not all
8287    /// objects provide an MD5 hash. For example, composite objects provide only
8288    /// crc32c hashes. This value is equivalent to running `cat object.txt |
8289    /// openssl md5 -binary`
8290    pub md5_hash: ::bytes::Bytes,
8291
8292    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
8293}
8294
8295impl ObjectChecksums {
8296    /// Creates a new default instance.
8297    pub fn new() -> Self {
8298        std::default::Default::default()
8299    }
8300
8301    /// Sets the value of [crc32c][crate::model::ObjectChecksums::crc32c].
8302    ///
8303    /// # Example
8304    /// ```ignore,no_run
8305    /// # use google_cloud_storage::model::ObjectChecksums;
8306    /// let x = ObjectChecksums::new().set_crc32c(42_u32);
8307    /// ```
8308    pub fn set_crc32c<T>(mut self, v: T) -> Self
8309    where
8310        T: std::convert::Into<u32>,
8311    {
8312        self.crc32c = std::option::Option::Some(v.into());
8313        self
8314    }
8315
8316    /// Sets or clears the value of [crc32c][crate::model::ObjectChecksums::crc32c].
8317    ///
8318    /// # Example
8319    /// ```ignore,no_run
8320    /// # use google_cloud_storage::model::ObjectChecksums;
8321    /// let x = ObjectChecksums::new().set_or_clear_crc32c(Some(42_u32));
8322    /// let x = ObjectChecksums::new().set_or_clear_crc32c(None::<u32>);
8323    /// ```
8324    pub fn set_or_clear_crc32c<T>(mut self, v: std::option::Option<T>) -> Self
8325    where
8326        T: std::convert::Into<u32>,
8327    {
8328        self.crc32c = v.map(|x| x.into());
8329        self
8330    }
8331
8332    /// Sets the value of [md5_hash][crate::model::ObjectChecksums::md5_hash].
8333    ///
8334    /// # Example
8335    /// ```ignore,no_run
8336    /// # use google_cloud_storage::model::ObjectChecksums;
8337    /// let x = ObjectChecksums::new().set_md5_hash(bytes::Bytes::from_static(b"example"));
8338    /// ```
8339    pub fn set_md5_hash<T: std::convert::Into<::bytes::Bytes>>(mut self, v: T) -> Self {
8340        self.md5_hash = v.into();
8341        self
8342    }
8343}
8344
8345impl wkt::message::Message for ObjectChecksums {
8346    fn typename() -> &'static str {
8347        "type.googleapis.com/google.storage.v2.ObjectChecksums"
8348    }
8349}
8350
8351/// The payload of a single user-defined object context.
8352#[derive(Clone, Default, PartialEq)]
8353#[non_exhaustive]
8354pub struct ObjectCustomContextPayload {
8355    /// Required. The value of the object context.
8356    pub value: std::string::String,
8357
8358    /// Output only. The time at which the object context was created.
8359    pub create_time: std::option::Option<wkt::Timestamp>,
8360
8361    /// Output only. The time at which the object context was last updated.
8362    pub update_time: std::option::Option<wkt::Timestamp>,
8363
8364    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
8365}
8366
8367impl ObjectCustomContextPayload {
8368    /// Creates a new default instance.
8369    pub fn new() -> Self {
8370        std::default::Default::default()
8371    }
8372
8373    /// Sets the value of [value][crate::model::ObjectCustomContextPayload::value].
8374    ///
8375    /// # Example
8376    /// ```ignore,no_run
8377    /// # use google_cloud_storage::model::ObjectCustomContextPayload;
8378    /// let x = ObjectCustomContextPayload::new().set_value("example");
8379    /// ```
8380    pub fn set_value<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
8381        self.value = v.into();
8382        self
8383    }
8384
8385    /// Sets the value of [create_time][crate::model::ObjectCustomContextPayload::create_time].
8386    ///
8387    /// # Example
8388    /// ```ignore,no_run
8389    /// # use google_cloud_storage::model::ObjectCustomContextPayload;
8390    /// use wkt::Timestamp;
8391    /// let x = ObjectCustomContextPayload::new().set_create_time(Timestamp::default()/* use setters */);
8392    /// ```
8393    pub fn set_create_time<T>(mut self, v: T) -> Self
8394    where
8395        T: std::convert::Into<wkt::Timestamp>,
8396    {
8397        self.create_time = std::option::Option::Some(v.into());
8398        self
8399    }
8400
8401    /// Sets or clears the value of [create_time][crate::model::ObjectCustomContextPayload::create_time].
8402    ///
8403    /// # Example
8404    /// ```ignore,no_run
8405    /// # use google_cloud_storage::model::ObjectCustomContextPayload;
8406    /// use wkt::Timestamp;
8407    /// let x = ObjectCustomContextPayload::new().set_or_clear_create_time(Some(Timestamp::default()/* use setters */));
8408    /// let x = ObjectCustomContextPayload::new().set_or_clear_create_time(None::<Timestamp>);
8409    /// ```
8410    pub fn set_or_clear_create_time<T>(mut self, v: std::option::Option<T>) -> Self
8411    where
8412        T: std::convert::Into<wkt::Timestamp>,
8413    {
8414        self.create_time = v.map(|x| x.into());
8415        self
8416    }
8417
8418    /// Sets the value of [update_time][crate::model::ObjectCustomContextPayload::update_time].
8419    ///
8420    /// # Example
8421    /// ```ignore,no_run
8422    /// # use google_cloud_storage::model::ObjectCustomContextPayload;
8423    /// use wkt::Timestamp;
8424    /// let x = ObjectCustomContextPayload::new().set_update_time(Timestamp::default()/* use setters */);
8425    /// ```
8426    pub fn set_update_time<T>(mut self, v: T) -> Self
8427    where
8428        T: std::convert::Into<wkt::Timestamp>,
8429    {
8430        self.update_time = std::option::Option::Some(v.into());
8431        self
8432    }
8433
8434    /// Sets or clears the value of [update_time][crate::model::ObjectCustomContextPayload::update_time].
8435    ///
8436    /// # Example
8437    /// ```ignore,no_run
8438    /// # use google_cloud_storage::model::ObjectCustomContextPayload;
8439    /// use wkt::Timestamp;
8440    /// let x = ObjectCustomContextPayload::new().set_or_clear_update_time(Some(Timestamp::default()/* use setters */));
8441    /// let x = ObjectCustomContextPayload::new().set_or_clear_update_time(None::<Timestamp>);
8442    /// ```
8443    pub fn set_or_clear_update_time<T>(mut self, v: std::option::Option<T>) -> Self
8444    where
8445        T: std::convert::Into<wkt::Timestamp>,
8446    {
8447        self.update_time = v.map(|x| x.into());
8448        self
8449    }
8450}
8451
8452impl wkt::message::Message for ObjectCustomContextPayload {
8453    fn typename() -> &'static str {
8454        "type.googleapis.com/google.storage.v2.ObjectCustomContextPayload"
8455    }
8456}
8457
8458/// All contexts of an object grouped by type.
8459#[derive(Clone, Default, PartialEq)]
8460#[non_exhaustive]
8461pub struct ObjectContexts {
8462    /// Optional. User-defined object contexts.
8463    /// The maximum key or value size is `256` characters.
8464    /// The maximum number of entries is `50`.
8465    /// The maximum total serialized size of all entries is `25KiB`.
8466    pub custom:
8467        std::collections::HashMap<std::string::String, crate::model::ObjectCustomContextPayload>,
8468
8469    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
8470}
8471
8472impl ObjectContexts {
8473    /// Creates a new default instance.
8474    pub fn new() -> Self {
8475        std::default::Default::default()
8476    }
8477
8478    /// Sets the value of [custom][crate::model::ObjectContexts::custom].
8479    ///
8480    /// # Example
8481    /// ```ignore,no_run
8482    /// # use google_cloud_storage::model::ObjectContexts;
8483    /// use google_cloud_storage::model::ObjectCustomContextPayload;
8484    /// let x = ObjectContexts::new().set_custom([
8485    ///     ("key0", ObjectCustomContextPayload::default()/* use setters */),
8486    ///     ("key1", ObjectCustomContextPayload::default()/* use (different) setters */),
8487    /// ]);
8488    /// ```
8489    pub fn set_custom<T, K, V>(mut self, v: T) -> Self
8490    where
8491        T: std::iter::IntoIterator<Item = (K, V)>,
8492        K: std::convert::Into<std::string::String>,
8493        V: std::convert::Into<crate::model::ObjectCustomContextPayload>,
8494    {
8495        use std::iter::Iterator;
8496        self.custom = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
8497        self
8498    }
8499}
8500
8501impl wkt::message::Message for ObjectContexts {
8502    fn typename() -> &'static str {
8503        "type.googleapis.com/google.storage.v2.ObjectContexts"
8504    }
8505}
8506
8507/// Describes the customer-supplied encryption key mechanism used to store an
8508/// object's data at rest.
8509#[derive(Clone, Default, PartialEq)]
8510#[non_exhaustive]
8511pub struct CustomerEncryption {
8512    /// Optional. The encryption algorithm.
8513    pub encryption_algorithm: std::string::String,
8514
8515    /// Optional. SHA256 hash value of the encryption key.
8516    /// In raw bytes format (not base64-encoded).
8517    pub key_sha256_bytes: ::bytes::Bytes,
8518
8519    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
8520}
8521
8522impl CustomerEncryption {
8523    /// Creates a new default instance.
8524    pub fn new() -> Self {
8525        std::default::Default::default()
8526    }
8527
8528    /// Sets the value of [encryption_algorithm][crate::model::CustomerEncryption::encryption_algorithm].
8529    ///
8530    /// # Example
8531    /// ```ignore,no_run
8532    /// # use google_cloud_storage::model::CustomerEncryption;
8533    /// let x = CustomerEncryption::new().set_encryption_algorithm("example");
8534    /// ```
8535    pub fn set_encryption_algorithm<T: std::convert::Into<std::string::String>>(
8536        mut self,
8537        v: T,
8538    ) -> Self {
8539        self.encryption_algorithm = v.into();
8540        self
8541    }
8542
8543    /// Sets the value of [key_sha256_bytes][crate::model::CustomerEncryption::key_sha256_bytes].
8544    ///
8545    /// # Example
8546    /// ```ignore,no_run
8547    /// # use google_cloud_storage::model::CustomerEncryption;
8548    /// let x = CustomerEncryption::new().set_key_sha256_bytes(bytes::Bytes::from_static(b"example"));
8549    /// ```
8550    pub fn set_key_sha256_bytes<T: std::convert::Into<::bytes::Bytes>>(mut self, v: T) -> Self {
8551        self.key_sha256_bytes = v.into();
8552        self
8553    }
8554}
8555
8556impl wkt::message::Message for CustomerEncryption {
8557    fn typename() -> &'static str {
8558        "type.googleapis.com/google.storage.v2.CustomerEncryption"
8559    }
8560}
8561
8562/// An object.
8563#[derive(Clone, Default, PartialEq)]
8564#[non_exhaustive]
8565pub struct Object {
8566    /// Immutable. The name of this object. Nearly any sequence of unicode
8567    /// characters is valid. See
8568    /// [Guidelines](https://cloud.google.com/storage/docs/objects#naming).
8569    /// Example: `test.txt`
8570    /// The `name` field by itself does not uniquely identify a Cloud Storage
8571    /// object. A Cloud Storage object is uniquely identified by the tuple of
8572    /// (bucket, object, generation).
8573    pub name: std::string::String,
8574
8575    /// Immutable. The name of the bucket containing this object.
8576    pub bucket: std::string::String,
8577
8578    /// Optional. The `etag` of an object.
8579    /// If included in the metadata of an update or delete request message, the
8580    /// operation is only performed if the etag matches that of the live
8581    /// object.
8582    pub etag: std::string::String,
8583
8584    /// Immutable. The content generation of this object. Used for object
8585    /// versioning.
8586    pub generation: i64,
8587
8588    /// Output only. Restore token used to differentiate deleted objects with the
8589    /// same name and generation. This field is output only, and only set for
8590    /// deleted objects in HNS buckets.
8591    pub restore_token: std::option::Option<std::string::String>,
8592
8593    /// Output only. The version of the metadata for this generation of this
8594    /// object. Used for preconditions and for detecting changes in metadata. A
8595    /// metageneration number is only meaningful in the context of a particular
8596    /// generation of a particular object.
8597    pub metageneration: i64,
8598
8599    /// Optional. Storage class of the object.
8600    pub storage_class: std::string::String,
8601
8602    /// Output only. Content-Length of the object data in bytes, matching
8603    /// [RFC 7230 §3.3.2](<https://tools.ietf.org/html/rfc7230#section-3.3.2>]).
8604    pub size: i64,
8605
8606    /// Optional. Content-Encoding of the object data, matching
8607    /// [RFC 7231 §3.1.2.2](https://tools.ietf.org/html/rfc7231#section-3.1.2.2)
8608    pub content_encoding: std::string::String,
8609
8610    /// Optional. Content-Disposition of the object data, matching
8611    /// [RFC 6266](https://tools.ietf.org/html/rfc6266).
8612    pub content_disposition: std::string::String,
8613
8614    /// Optional. Cache-Control directive for the object data, matching
8615    /// [RFC 7234 §5.2](https://tools.ietf.org/html/rfc7234#section-5.2).
8616    /// If omitted, and the object is accessible to all anonymous users, the
8617    /// default is `public, max-age=3600`.
8618    pub cache_control: std::string::String,
8619
8620    /// Optional. Access controls on the object.
8621    /// If `iam_config.uniform_bucket_level_access` is enabled on the parent
8622    /// bucket, requests to set, read, or modify acl is an error.
8623    pub acl: std::vec::Vec<crate::model::ObjectAccessControl>,
8624
8625    /// Optional. Content-Language of the object data, matching
8626    /// [RFC 7231 §3.1.3.2](https://tools.ietf.org/html/rfc7231#section-3.1.3.2).
8627    pub content_language: std::string::String,
8628
8629    /// Output only. If this object is noncurrent, this is the time when the object
8630    /// became noncurrent.
8631    pub delete_time: std::option::Option<wkt::Timestamp>,
8632
8633    /// Output only. The time when the object was finalized.
8634    pub finalize_time: std::option::Option<wkt::Timestamp>,
8635
8636    /// Optional. Content-Type of the object data, matching
8637    /// [RFC 7231 §3.1.1.5](https://tools.ietf.org/html/rfc7231#section-3.1.1.5).
8638    /// If an object is stored without a Content-Type, it is served as
8639    /// `application/octet-stream`.
8640    pub content_type: std::string::String,
8641
8642    /// Output only. The creation time of the object.
8643    pub create_time: std::option::Option<wkt::Timestamp>,
8644
8645    /// Output only. Number of underlying components that make up this object.
8646    /// Components are accumulated by compose operations.
8647    pub component_count: i32,
8648
8649    /// Output only. Hashes for the data part of this object. This field is used
8650    /// for output only and is silently ignored if provided in requests. The
8651    /// checksums of the complete object regardless of data range. If the object is
8652    /// downloaded in full, the client should compute one of these checksums over
8653    /// the downloaded object and compare it against the value provided here.
8654    pub checksums: std::option::Option<crate::model::ObjectChecksums>,
8655
8656    /// Output only. The modification time of the object metadata.
8657    /// Set initially to object creation time and then updated whenever any
8658    /// metadata of the object changes. This includes changes made by a requester,
8659    /// such as modifying custom metadata, as well as changes made by Cloud Storage
8660    /// on behalf of a requester, such as changing the storage class based on an
8661    /// Object Lifecycle Configuration.
8662    pub update_time: std::option::Option<wkt::Timestamp>,
8663
8664    /// Optional. Cloud KMS Key used to encrypt this object, if the object is
8665    /// encrypted by such a key.
8666    pub kms_key: std::string::String,
8667
8668    /// Output only. The time at which the object's storage class was last changed.
8669    /// When the object is initially created, it is set to `time_created`.
8670    pub update_storage_class_time: std::option::Option<wkt::Timestamp>,
8671
8672    /// Optional. Whether an object is under temporary hold. While this flag is set
8673    /// to true, the object is protected against deletion and overwrites.  A common
8674    /// use case of this flag is regulatory investigations where objects need to be
8675    /// retained while the investigation is ongoing. Note that unlike event-based
8676    /// hold, temporary hold does not impact retention expiration time of an
8677    /// object.
8678    pub temporary_hold: bool,
8679
8680    /// Optional. A server-determined value that specifies the earliest time that
8681    /// the object's retention period expires. Note 1: This field is not provided
8682    /// for objects with an active event-based hold, since retention expiration is
8683    /// unknown until the hold is removed. Note 2: This value can be provided even
8684    /// when temporary hold is set (so that the user can reason about policy
8685    /// without having to first unset the temporary hold).
8686    pub retention_expire_time: std::option::Option<wkt::Timestamp>,
8687
8688    /// Optional. User-provided metadata, in key/value pairs.
8689    pub metadata: std::collections::HashMap<std::string::String, std::string::String>,
8690
8691    /// Optional. User-defined or system-defined object contexts. Each object
8692    /// context is a key-payload pair, where the key provides the identification
8693    /// and the payload holds the associated value and additional metadata.
8694    pub contexts: std::option::Option<crate::model::ObjectContexts>,
8695
8696    /// Whether an object is under event-based hold.
8697    /// An event-based hold is a way to force the retention of an object until
8698    /// after some event occurs. Once the hold is released by explicitly setting
8699    /// this field to `false`, the object becomes subject to any bucket-level
8700    /// retention policy, except that the retention duration is calculated
8701    /// from the time the event based hold was lifted, rather than the time the
8702    /// object was created.
8703    ///
8704    /// In a `WriteObject` request, not setting this field implies that the value
8705    /// should be taken from the parent bucket's `default_event_based_hold` field.
8706    /// In a response, this field is always set to `true` or `false`.
8707    pub event_based_hold: std::option::Option<bool>,
8708
8709    /// Output only. The owner of the object. This is always the uploader of the
8710    /// object.
8711    pub owner: std::option::Option<crate::model::Owner>,
8712
8713    /// Optional. Metadata of customer-supplied encryption key, if the object is
8714    /// encrypted by such a key.
8715    pub customer_encryption: std::option::Option<crate::model::CustomerEncryption>,
8716
8717    /// Optional. A user-specified timestamp set on an object.
8718    pub custom_time: std::option::Option<wkt::Timestamp>,
8719
8720    /// Output only. This is the time when the object became soft-deleted.
8721    ///
8722    /// Soft-deleted objects are only accessible if a soft_delete_policy is
8723    /// enabled. Also see `hard_delete_time`.
8724    pub soft_delete_time: std::option::Option<wkt::Timestamp>,
8725
8726    /// Output only. The time when the object is permanently deleted.
8727    ///
8728    /// Only set when an object becomes soft-deleted with a `soft_delete_policy`.
8729    /// Otherwise, the object is not accessible.
8730    pub hard_delete_time: std::option::Option<wkt::Timestamp>,
8731
8732    /// Optional. Retention configuration of this object.
8733    /// Might only be configured if the bucket has object retention enabled.
8734    pub retention: std::option::Option<crate::model::object::Retention>,
8735
8736    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
8737}
8738
8739impl Object {
8740    /// Creates a new default instance.
8741    pub fn new() -> Self {
8742        std::default::Default::default()
8743    }
8744
8745    /// Sets the value of [name][crate::model::Object::name].
8746    ///
8747    /// # Example
8748    /// ```ignore,no_run
8749    /// # use google_cloud_storage::model::Object;
8750    /// let x = Object::new().set_name("example");
8751    /// ```
8752    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
8753        self.name = v.into();
8754        self
8755    }
8756
8757    /// Sets the value of [bucket][crate::model::Object::bucket].
8758    ///
8759    /// # Example
8760    /// ```ignore,no_run
8761    /// # use google_cloud_storage::model::Object;
8762    /// # let project_id = "project_id";
8763    /// # let bucket_id = "bucket_id";
8764    /// let x = Object::new().set_bucket(format!("projects/{project_id}/buckets/{bucket_id}"));
8765    /// ```
8766    pub fn set_bucket<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
8767        self.bucket = v.into();
8768        self
8769    }
8770
8771    /// Sets the value of [etag][crate::model::Object::etag].
8772    ///
8773    /// # Example
8774    /// ```ignore,no_run
8775    /// # use google_cloud_storage::model::Object;
8776    /// let x = Object::new().set_etag("example");
8777    /// ```
8778    pub fn set_etag<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
8779        self.etag = v.into();
8780        self
8781    }
8782
8783    /// Sets the value of [generation][crate::model::Object::generation].
8784    ///
8785    /// # Example
8786    /// ```ignore,no_run
8787    /// # use google_cloud_storage::model::Object;
8788    /// let x = Object::new().set_generation(42);
8789    /// ```
8790    pub fn set_generation<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
8791        self.generation = v.into();
8792        self
8793    }
8794
8795    /// Sets the value of [restore_token][crate::model::Object::restore_token].
8796    ///
8797    /// # Example
8798    /// ```ignore,no_run
8799    /// # use google_cloud_storage::model::Object;
8800    /// let x = Object::new().set_restore_token("example");
8801    /// ```
8802    pub fn set_restore_token<T>(mut self, v: T) -> Self
8803    where
8804        T: std::convert::Into<std::string::String>,
8805    {
8806        self.restore_token = std::option::Option::Some(v.into());
8807        self
8808    }
8809
8810    /// Sets or clears the value of [restore_token][crate::model::Object::restore_token].
8811    ///
8812    /// # Example
8813    /// ```ignore,no_run
8814    /// # use google_cloud_storage::model::Object;
8815    /// let x = Object::new().set_or_clear_restore_token(Some("example"));
8816    /// let x = Object::new().set_or_clear_restore_token(None::<String>);
8817    /// ```
8818    pub fn set_or_clear_restore_token<T>(mut self, v: std::option::Option<T>) -> Self
8819    where
8820        T: std::convert::Into<std::string::String>,
8821    {
8822        self.restore_token = v.map(|x| x.into());
8823        self
8824    }
8825
8826    /// Sets the value of [metageneration][crate::model::Object::metageneration].
8827    ///
8828    /// # Example
8829    /// ```ignore,no_run
8830    /// # use google_cloud_storage::model::Object;
8831    /// let x = Object::new().set_metageneration(42);
8832    /// ```
8833    pub fn set_metageneration<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
8834        self.metageneration = v.into();
8835        self
8836    }
8837
8838    /// Sets the value of [storage_class][crate::model::Object::storage_class].
8839    ///
8840    /// # Example
8841    /// ```ignore,no_run
8842    /// # use google_cloud_storage::model::Object;
8843    /// let x = Object::new().set_storage_class("example");
8844    /// ```
8845    pub fn set_storage_class<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
8846        self.storage_class = v.into();
8847        self
8848    }
8849
8850    /// Sets the value of [size][crate::model::Object::size].
8851    ///
8852    /// # Example
8853    /// ```ignore,no_run
8854    /// # use google_cloud_storage::model::Object;
8855    /// let x = Object::new().set_size(42);
8856    /// ```
8857    pub fn set_size<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
8858        self.size = v.into();
8859        self
8860    }
8861
8862    /// Sets the value of [content_encoding][crate::model::Object::content_encoding].
8863    ///
8864    /// # Example
8865    /// ```ignore,no_run
8866    /// # use google_cloud_storage::model::Object;
8867    /// let x = Object::new().set_content_encoding("example");
8868    /// ```
8869    pub fn set_content_encoding<T: std::convert::Into<std::string::String>>(
8870        mut self,
8871        v: T,
8872    ) -> Self {
8873        self.content_encoding = v.into();
8874        self
8875    }
8876
8877    /// Sets the value of [content_disposition][crate::model::Object::content_disposition].
8878    ///
8879    /// # Example
8880    /// ```ignore,no_run
8881    /// # use google_cloud_storage::model::Object;
8882    /// let x = Object::new().set_content_disposition("example");
8883    /// ```
8884    pub fn set_content_disposition<T: std::convert::Into<std::string::String>>(
8885        mut self,
8886        v: T,
8887    ) -> Self {
8888        self.content_disposition = v.into();
8889        self
8890    }
8891
8892    /// Sets the value of [cache_control][crate::model::Object::cache_control].
8893    ///
8894    /// # Example
8895    /// ```ignore,no_run
8896    /// # use google_cloud_storage::model::Object;
8897    /// let x = Object::new().set_cache_control("example");
8898    /// ```
8899    pub fn set_cache_control<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
8900        self.cache_control = v.into();
8901        self
8902    }
8903
8904    /// Sets the value of [acl][crate::model::Object::acl].
8905    ///
8906    /// # Example
8907    /// ```ignore,no_run
8908    /// # use google_cloud_storage::model::Object;
8909    /// use google_cloud_storage::model::ObjectAccessControl;
8910    /// let x = Object::new()
8911    ///     .set_acl([
8912    ///         ObjectAccessControl::default()/* use setters */,
8913    ///         ObjectAccessControl::default()/* use (different) setters */,
8914    ///     ]);
8915    /// ```
8916    pub fn set_acl<T, V>(mut self, v: T) -> Self
8917    where
8918        T: std::iter::IntoIterator<Item = V>,
8919        V: std::convert::Into<crate::model::ObjectAccessControl>,
8920    {
8921        use std::iter::Iterator;
8922        self.acl = v.into_iter().map(|i| i.into()).collect();
8923        self
8924    }
8925
8926    /// Sets the value of [content_language][crate::model::Object::content_language].
8927    ///
8928    /// # Example
8929    /// ```ignore,no_run
8930    /// # use google_cloud_storage::model::Object;
8931    /// let x = Object::new().set_content_language("example");
8932    /// ```
8933    pub fn set_content_language<T: std::convert::Into<std::string::String>>(
8934        mut self,
8935        v: T,
8936    ) -> Self {
8937        self.content_language = v.into();
8938        self
8939    }
8940
8941    /// Sets the value of [delete_time][crate::model::Object::delete_time].
8942    ///
8943    /// # Example
8944    /// ```ignore,no_run
8945    /// # use google_cloud_storage::model::Object;
8946    /// use wkt::Timestamp;
8947    /// let x = Object::new().set_delete_time(Timestamp::default()/* use setters */);
8948    /// ```
8949    pub fn set_delete_time<T>(mut self, v: T) -> Self
8950    where
8951        T: std::convert::Into<wkt::Timestamp>,
8952    {
8953        self.delete_time = std::option::Option::Some(v.into());
8954        self
8955    }
8956
8957    /// Sets or clears the value of [delete_time][crate::model::Object::delete_time].
8958    ///
8959    /// # Example
8960    /// ```ignore,no_run
8961    /// # use google_cloud_storage::model::Object;
8962    /// use wkt::Timestamp;
8963    /// let x = Object::new().set_or_clear_delete_time(Some(Timestamp::default()/* use setters */));
8964    /// let x = Object::new().set_or_clear_delete_time(None::<Timestamp>);
8965    /// ```
8966    pub fn set_or_clear_delete_time<T>(mut self, v: std::option::Option<T>) -> Self
8967    where
8968        T: std::convert::Into<wkt::Timestamp>,
8969    {
8970        self.delete_time = v.map(|x| x.into());
8971        self
8972    }
8973
8974    /// Sets the value of [finalize_time][crate::model::Object::finalize_time].
8975    ///
8976    /// # Example
8977    /// ```ignore,no_run
8978    /// # use google_cloud_storage::model::Object;
8979    /// use wkt::Timestamp;
8980    /// let x = Object::new().set_finalize_time(Timestamp::default()/* use setters */);
8981    /// ```
8982    pub fn set_finalize_time<T>(mut self, v: T) -> Self
8983    where
8984        T: std::convert::Into<wkt::Timestamp>,
8985    {
8986        self.finalize_time = std::option::Option::Some(v.into());
8987        self
8988    }
8989
8990    /// Sets or clears the value of [finalize_time][crate::model::Object::finalize_time].
8991    ///
8992    /// # Example
8993    /// ```ignore,no_run
8994    /// # use google_cloud_storage::model::Object;
8995    /// use wkt::Timestamp;
8996    /// let x = Object::new().set_or_clear_finalize_time(Some(Timestamp::default()/* use setters */));
8997    /// let x = Object::new().set_or_clear_finalize_time(None::<Timestamp>);
8998    /// ```
8999    pub fn set_or_clear_finalize_time<T>(mut self, v: std::option::Option<T>) -> Self
9000    where
9001        T: std::convert::Into<wkt::Timestamp>,
9002    {
9003        self.finalize_time = v.map(|x| x.into());
9004        self
9005    }
9006
9007    /// Sets the value of [content_type][crate::model::Object::content_type].
9008    ///
9009    /// # Example
9010    /// ```ignore,no_run
9011    /// # use google_cloud_storage::model::Object;
9012    /// let x = Object::new().set_content_type("example");
9013    /// ```
9014    pub fn set_content_type<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9015        self.content_type = v.into();
9016        self
9017    }
9018
9019    /// Sets the value of [create_time][crate::model::Object::create_time].
9020    ///
9021    /// # Example
9022    /// ```ignore,no_run
9023    /// # use google_cloud_storage::model::Object;
9024    /// use wkt::Timestamp;
9025    /// let x = Object::new().set_create_time(Timestamp::default()/* use setters */);
9026    /// ```
9027    pub fn set_create_time<T>(mut self, v: T) -> Self
9028    where
9029        T: std::convert::Into<wkt::Timestamp>,
9030    {
9031        self.create_time = std::option::Option::Some(v.into());
9032        self
9033    }
9034
9035    /// Sets or clears the value of [create_time][crate::model::Object::create_time].
9036    ///
9037    /// # Example
9038    /// ```ignore,no_run
9039    /// # use google_cloud_storage::model::Object;
9040    /// use wkt::Timestamp;
9041    /// let x = Object::new().set_or_clear_create_time(Some(Timestamp::default()/* use setters */));
9042    /// let x = Object::new().set_or_clear_create_time(None::<Timestamp>);
9043    /// ```
9044    pub fn set_or_clear_create_time<T>(mut self, v: std::option::Option<T>) -> Self
9045    where
9046        T: std::convert::Into<wkt::Timestamp>,
9047    {
9048        self.create_time = v.map(|x| x.into());
9049        self
9050    }
9051
9052    /// Sets the value of [component_count][crate::model::Object::component_count].
9053    ///
9054    /// # Example
9055    /// ```ignore,no_run
9056    /// # use google_cloud_storage::model::Object;
9057    /// let x = Object::new().set_component_count(42);
9058    /// ```
9059    pub fn set_component_count<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
9060        self.component_count = v.into();
9061        self
9062    }
9063
9064    /// Sets the value of [checksums][crate::model::Object::checksums].
9065    ///
9066    /// # Example
9067    /// ```ignore,no_run
9068    /// # use google_cloud_storage::model::Object;
9069    /// use google_cloud_storage::model::ObjectChecksums;
9070    /// let x = Object::new().set_checksums(ObjectChecksums::default()/* use setters */);
9071    /// ```
9072    pub fn set_checksums<T>(mut self, v: T) -> Self
9073    where
9074        T: std::convert::Into<crate::model::ObjectChecksums>,
9075    {
9076        self.checksums = std::option::Option::Some(v.into());
9077        self
9078    }
9079
9080    /// Sets or clears the value of [checksums][crate::model::Object::checksums].
9081    ///
9082    /// # Example
9083    /// ```ignore,no_run
9084    /// # use google_cloud_storage::model::Object;
9085    /// use google_cloud_storage::model::ObjectChecksums;
9086    /// let x = Object::new().set_or_clear_checksums(Some(ObjectChecksums::default()/* use setters */));
9087    /// let x = Object::new().set_or_clear_checksums(None::<ObjectChecksums>);
9088    /// ```
9089    pub fn set_or_clear_checksums<T>(mut self, v: std::option::Option<T>) -> Self
9090    where
9091        T: std::convert::Into<crate::model::ObjectChecksums>,
9092    {
9093        self.checksums = v.map(|x| x.into());
9094        self
9095    }
9096
9097    /// Sets the value of [update_time][crate::model::Object::update_time].
9098    ///
9099    /// # Example
9100    /// ```ignore,no_run
9101    /// # use google_cloud_storage::model::Object;
9102    /// use wkt::Timestamp;
9103    /// let x = Object::new().set_update_time(Timestamp::default()/* use setters */);
9104    /// ```
9105    pub fn set_update_time<T>(mut self, v: T) -> Self
9106    where
9107        T: std::convert::Into<wkt::Timestamp>,
9108    {
9109        self.update_time = std::option::Option::Some(v.into());
9110        self
9111    }
9112
9113    /// Sets or clears the value of [update_time][crate::model::Object::update_time].
9114    ///
9115    /// # Example
9116    /// ```ignore,no_run
9117    /// # use google_cloud_storage::model::Object;
9118    /// use wkt::Timestamp;
9119    /// let x = Object::new().set_or_clear_update_time(Some(Timestamp::default()/* use setters */));
9120    /// let x = Object::new().set_or_clear_update_time(None::<Timestamp>);
9121    /// ```
9122    pub fn set_or_clear_update_time<T>(mut self, v: std::option::Option<T>) -> Self
9123    where
9124        T: std::convert::Into<wkt::Timestamp>,
9125    {
9126        self.update_time = v.map(|x| x.into());
9127        self
9128    }
9129
9130    /// Sets the value of [kms_key][crate::model::Object::kms_key].
9131    ///
9132    /// # Example
9133    /// ```ignore,no_run
9134    /// # use google_cloud_storage::model::Object;
9135    /// let x = Object::new().set_kms_key("example");
9136    /// ```
9137    pub fn set_kms_key<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9138        self.kms_key = v.into();
9139        self
9140    }
9141
9142    /// Sets the value of [update_storage_class_time][crate::model::Object::update_storage_class_time].
9143    ///
9144    /// # Example
9145    /// ```ignore,no_run
9146    /// # use google_cloud_storage::model::Object;
9147    /// use wkt::Timestamp;
9148    /// let x = Object::new().set_update_storage_class_time(Timestamp::default()/* use setters */);
9149    /// ```
9150    pub fn set_update_storage_class_time<T>(mut self, v: T) -> Self
9151    where
9152        T: std::convert::Into<wkt::Timestamp>,
9153    {
9154        self.update_storage_class_time = std::option::Option::Some(v.into());
9155        self
9156    }
9157
9158    /// Sets or clears the value of [update_storage_class_time][crate::model::Object::update_storage_class_time].
9159    ///
9160    /// # Example
9161    /// ```ignore,no_run
9162    /// # use google_cloud_storage::model::Object;
9163    /// use wkt::Timestamp;
9164    /// let x = Object::new().set_or_clear_update_storage_class_time(Some(Timestamp::default()/* use setters */));
9165    /// let x = Object::new().set_or_clear_update_storage_class_time(None::<Timestamp>);
9166    /// ```
9167    pub fn set_or_clear_update_storage_class_time<T>(mut self, v: std::option::Option<T>) -> Self
9168    where
9169        T: std::convert::Into<wkt::Timestamp>,
9170    {
9171        self.update_storage_class_time = v.map(|x| x.into());
9172        self
9173    }
9174
9175    /// Sets the value of [temporary_hold][crate::model::Object::temporary_hold].
9176    ///
9177    /// # Example
9178    /// ```ignore,no_run
9179    /// # use google_cloud_storage::model::Object;
9180    /// let x = Object::new().set_temporary_hold(true);
9181    /// ```
9182    pub fn set_temporary_hold<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
9183        self.temporary_hold = v.into();
9184        self
9185    }
9186
9187    /// Sets the value of [retention_expire_time][crate::model::Object::retention_expire_time].
9188    ///
9189    /// # Example
9190    /// ```ignore,no_run
9191    /// # use google_cloud_storage::model::Object;
9192    /// use wkt::Timestamp;
9193    /// let x = Object::new().set_retention_expire_time(Timestamp::default()/* use setters */);
9194    /// ```
9195    pub fn set_retention_expire_time<T>(mut self, v: T) -> Self
9196    where
9197        T: std::convert::Into<wkt::Timestamp>,
9198    {
9199        self.retention_expire_time = std::option::Option::Some(v.into());
9200        self
9201    }
9202
9203    /// Sets or clears the value of [retention_expire_time][crate::model::Object::retention_expire_time].
9204    ///
9205    /// # Example
9206    /// ```ignore,no_run
9207    /// # use google_cloud_storage::model::Object;
9208    /// use wkt::Timestamp;
9209    /// let x = Object::new().set_or_clear_retention_expire_time(Some(Timestamp::default()/* use setters */));
9210    /// let x = Object::new().set_or_clear_retention_expire_time(None::<Timestamp>);
9211    /// ```
9212    pub fn set_or_clear_retention_expire_time<T>(mut self, v: std::option::Option<T>) -> Self
9213    where
9214        T: std::convert::Into<wkt::Timestamp>,
9215    {
9216        self.retention_expire_time = v.map(|x| x.into());
9217        self
9218    }
9219
9220    /// Sets the value of [metadata][crate::model::Object::metadata].
9221    ///
9222    /// # Example
9223    /// ```ignore,no_run
9224    /// # use google_cloud_storage::model::Object;
9225    /// let x = Object::new().set_metadata([
9226    ///     ("key0", "abc"),
9227    ///     ("key1", "xyz"),
9228    /// ]);
9229    /// ```
9230    pub fn set_metadata<T, K, V>(mut self, v: T) -> Self
9231    where
9232        T: std::iter::IntoIterator<Item = (K, V)>,
9233        K: std::convert::Into<std::string::String>,
9234        V: std::convert::Into<std::string::String>,
9235    {
9236        use std::iter::Iterator;
9237        self.metadata = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
9238        self
9239    }
9240
9241    /// Sets the value of [contexts][crate::model::Object::contexts].
9242    ///
9243    /// # Example
9244    /// ```ignore,no_run
9245    /// # use google_cloud_storage::model::Object;
9246    /// use google_cloud_storage::model::ObjectContexts;
9247    /// let x = Object::new().set_contexts(ObjectContexts::default()/* use setters */);
9248    /// ```
9249    pub fn set_contexts<T>(mut self, v: T) -> Self
9250    where
9251        T: std::convert::Into<crate::model::ObjectContexts>,
9252    {
9253        self.contexts = std::option::Option::Some(v.into());
9254        self
9255    }
9256
9257    /// Sets or clears the value of [contexts][crate::model::Object::contexts].
9258    ///
9259    /// # Example
9260    /// ```ignore,no_run
9261    /// # use google_cloud_storage::model::Object;
9262    /// use google_cloud_storage::model::ObjectContexts;
9263    /// let x = Object::new().set_or_clear_contexts(Some(ObjectContexts::default()/* use setters */));
9264    /// let x = Object::new().set_or_clear_contexts(None::<ObjectContexts>);
9265    /// ```
9266    pub fn set_or_clear_contexts<T>(mut self, v: std::option::Option<T>) -> Self
9267    where
9268        T: std::convert::Into<crate::model::ObjectContexts>,
9269    {
9270        self.contexts = v.map(|x| x.into());
9271        self
9272    }
9273
9274    /// Sets the value of [event_based_hold][crate::model::Object::event_based_hold].
9275    ///
9276    /// # Example
9277    /// ```ignore,no_run
9278    /// # use google_cloud_storage::model::Object;
9279    /// let x = Object::new().set_event_based_hold(true);
9280    /// ```
9281    pub fn set_event_based_hold<T>(mut self, v: T) -> Self
9282    where
9283        T: std::convert::Into<bool>,
9284    {
9285        self.event_based_hold = std::option::Option::Some(v.into());
9286        self
9287    }
9288
9289    /// Sets or clears the value of [event_based_hold][crate::model::Object::event_based_hold].
9290    ///
9291    /// # Example
9292    /// ```ignore,no_run
9293    /// # use google_cloud_storage::model::Object;
9294    /// let x = Object::new().set_or_clear_event_based_hold(Some(false));
9295    /// let x = Object::new().set_or_clear_event_based_hold(None::<bool>);
9296    /// ```
9297    pub fn set_or_clear_event_based_hold<T>(mut self, v: std::option::Option<T>) -> Self
9298    where
9299        T: std::convert::Into<bool>,
9300    {
9301        self.event_based_hold = v.map(|x| x.into());
9302        self
9303    }
9304
9305    /// Sets the value of [owner][crate::model::Object::owner].
9306    ///
9307    /// # Example
9308    /// ```ignore,no_run
9309    /// # use google_cloud_storage::model::Object;
9310    /// use google_cloud_storage::model::Owner;
9311    /// let x = Object::new().set_owner(Owner::default()/* use setters */);
9312    /// ```
9313    pub fn set_owner<T>(mut self, v: T) -> Self
9314    where
9315        T: std::convert::Into<crate::model::Owner>,
9316    {
9317        self.owner = std::option::Option::Some(v.into());
9318        self
9319    }
9320
9321    /// Sets or clears the value of [owner][crate::model::Object::owner].
9322    ///
9323    /// # Example
9324    /// ```ignore,no_run
9325    /// # use google_cloud_storage::model::Object;
9326    /// use google_cloud_storage::model::Owner;
9327    /// let x = Object::new().set_or_clear_owner(Some(Owner::default()/* use setters */));
9328    /// let x = Object::new().set_or_clear_owner(None::<Owner>);
9329    /// ```
9330    pub fn set_or_clear_owner<T>(mut self, v: std::option::Option<T>) -> Self
9331    where
9332        T: std::convert::Into<crate::model::Owner>,
9333    {
9334        self.owner = v.map(|x| x.into());
9335        self
9336    }
9337
9338    /// Sets the value of [customer_encryption][crate::model::Object::customer_encryption].
9339    ///
9340    /// # Example
9341    /// ```ignore,no_run
9342    /// # use google_cloud_storage::model::Object;
9343    /// use google_cloud_storage::model::CustomerEncryption;
9344    /// let x = Object::new().set_customer_encryption(CustomerEncryption::default()/* use setters */);
9345    /// ```
9346    pub fn set_customer_encryption<T>(mut self, v: T) -> Self
9347    where
9348        T: std::convert::Into<crate::model::CustomerEncryption>,
9349    {
9350        self.customer_encryption = std::option::Option::Some(v.into());
9351        self
9352    }
9353
9354    /// Sets or clears the value of [customer_encryption][crate::model::Object::customer_encryption].
9355    ///
9356    /// # Example
9357    /// ```ignore,no_run
9358    /// # use google_cloud_storage::model::Object;
9359    /// use google_cloud_storage::model::CustomerEncryption;
9360    /// let x = Object::new().set_or_clear_customer_encryption(Some(CustomerEncryption::default()/* use setters */));
9361    /// let x = Object::new().set_or_clear_customer_encryption(None::<CustomerEncryption>);
9362    /// ```
9363    pub fn set_or_clear_customer_encryption<T>(mut self, v: std::option::Option<T>) -> Self
9364    where
9365        T: std::convert::Into<crate::model::CustomerEncryption>,
9366    {
9367        self.customer_encryption = v.map(|x| x.into());
9368        self
9369    }
9370
9371    /// Sets the value of [custom_time][crate::model::Object::custom_time].
9372    ///
9373    /// # Example
9374    /// ```ignore,no_run
9375    /// # use google_cloud_storage::model::Object;
9376    /// use wkt::Timestamp;
9377    /// let x = Object::new().set_custom_time(Timestamp::default()/* use setters */);
9378    /// ```
9379    pub fn set_custom_time<T>(mut self, v: T) -> Self
9380    where
9381        T: std::convert::Into<wkt::Timestamp>,
9382    {
9383        self.custom_time = std::option::Option::Some(v.into());
9384        self
9385    }
9386
9387    /// Sets or clears the value of [custom_time][crate::model::Object::custom_time].
9388    ///
9389    /// # Example
9390    /// ```ignore,no_run
9391    /// # use google_cloud_storage::model::Object;
9392    /// use wkt::Timestamp;
9393    /// let x = Object::new().set_or_clear_custom_time(Some(Timestamp::default()/* use setters */));
9394    /// let x = Object::new().set_or_clear_custom_time(None::<Timestamp>);
9395    /// ```
9396    pub fn set_or_clear_custom_time<T>(mut self, v: std::option::Option<T>) -> Self
9397    where
9398        T: std::convert::Into<wkt::Timestamp>,
9399    {
9400        self.custom_time = v.map(|x| x.into());
9401        self
9402    }
9403
9404    /// Sets the value of [soft_delete_time][crate::model::Object::soft_delete_time].
9405    ///
9406    /// # Example
9407    /// ```ignore,no_run
9408    /// # use google_cloud_storage::model::Object;
9409    /// use wkt::Timestamp;
9410    /// let x = Object::new().set_soft_delete_time(Timestamp::default()/* use setters */);
9411    /// ```
9412    pub fn set_soft_delete_time<T>(mut self, v: T) -> Self
9413    where
9414        T: std::convert::Into<wkt::Timestamp>,
9415    {
9416        self.soft_delete_time = std::option::Option::Some(v.into());
9417        self
9418    }
9419
9420    /// Sets or clears the value of [soft_delete_time][crate::model::Object::soft_delete_time].
9421    ///
9422    /// # Example
9423    /// ```ignore,no_run
9424    /// # use google_cloud_storage::model::Object;
9425    /// use wkt::Timestamp;
9426    /// let x = Object::new().set_or_clear_soft_delete_time(Some(Timestamp::default()/* use setters */));
9427    /// let x = Object::new().set_or_clear_soft_delete_time(None::<Timestamp>);
9428    /// ```
9429    pub fn set_or_clear_soft_delete_time<T>(mut self, v: std::option::Option<T>) -> Self
9430    where
9431        T: std::convert::Into<wkt::Timestamp>,
9432    {
9433        self.soft_delete_time = v.map(|x| x.into());
9434        self
9435    }
9436
9437    /// Sets the value of [hard_delete_time][crate::model::Object::hard_delete_time].
9438    ///
9439    /// # Example
9440    /// ```ignore,no_run
9441    /// # use google_cloud_storage::model::Object;
9442    /// use wkt::Timestamp;
9443    /// let x = Object::new().set_hard_delete_time(Timestamp::default()/* use setters */);
9444    /// ```
9445    pub fn set_hard_delete_time<T>(mut self, v: T) -> Self
9446    where
9447        T: std::convert::Into<wkt::Timestamp>,
9448    {
9449        self.hard_delete_time = std::option::Option::Some(v.into());
9450        self
9451    }
9452
9453    /// Sets or clears the value of [hard_delete_time][crate::model::Object::hard_delete_time].
9454    ///
9455    /// # Example
9456    /// ```ignore,no_run
9457    /// # use google_cloud_storage::model::Object;
9458    /// use wkt::Timestamp;
9459    /// let x = Object::new().set_or_clear_hard_delete_time(Some(Timestamp::default()/* use setters */));
9460    /// let x = Object::new().set_or_clear_hard_delete_time(None::<Timestamp>);
9461    /// ```
9462    pub fn set_or_clear_hard_delete_time<T>(mut self, v: std::option::Option<T>) -> Self
9463    where
9464        T: std::convert::Into<wkt::Timestamp>,
9465    {
9466        self.hard_delete_time = v.map(|x| x.into());
9467        self
9468    }
9469
9470    /// Sets the value of [retention][crate::model::Object::retention].
9471    ///
9472    /// # Example
9473    /// ```ignore,no_run
9474    /// # use google_cloud_storage::model::Object;
9475    /// use google_cloud_storage::model::object::Retention;
9476    /// let x = Object::new().set_retention(Retention::default()/* use setters */);
9477    /// ```
9478    pub fn set_retention<T>(mut self, v: T) -> Self
9479    where
9480        T: std::convert::Into<crate::model::object::Retention>,
9481    {
9482        self.retention = std::option::Option::Some(v.into());
9483        self
9484    }
9485
9486    /// Sets or clears the value of [retention][crate::model::Object::retention].
9487    ///
9488    /// # Example
9489    /// ```ignore,no_run
9490    /// # use google_cloud_storage::model::Object;
9491    /// use google_cloud_storage::model::object::Retention;
9492    /// let x = Object::new().set_or_clear_retention(Some(Retention::default()/* use setters */));
9493    /// let x = Object::new().set_or_clear_retention(None::<Retention>);
9494    /// ```
9495    pub fn set_or_clear_retention<T>(mut self, v: std::option::Option<T>) -> Self
9496    where
9497        T: std::convert::Into<crate::model::object::Retention>,
9498    {
9499        self.retention = v.map(|x| x.into());
9500        self
9501    }
9502}
9503
9504impl wkt::message::Message for Object {
9505    fn typename() -> &'static str {
9506        "type.googleapis.com/google.storage.v2.Object"
9507    }
9508}
9509
9510/// Defines additional types related to [Object].
9511pub mod object {
9512    #[allow(unused_imports)]
9513    use super::*;
9514
9515    /// Specifies retention parameters of the object. Objects under retention
9516    /// cannot be deleted or overwritten until their retention expires.
9517    #[derive(Clone, Default, PartialEq)]
9518    #[non_exhaustive]
9519    pub struct Retention {
9520        /// Optional. The mode of the Retention.
9521        pub mode: crate::model::object::retention::Mode,
9522
9523        /// Optional. The timestamp that the object needs to be retained until.
9524        /// Value cannot be set in the past or more than 100 years in the future.
9525        pub retain_until_time: std::option::Option<wkt::Timestamp>,
9526
9527        pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
9528    }
9529
9530    impl Retention {
9531        /// Creates a new default instance.
9532        pub fn new() -> Self {
9533            std::default::Default::default()
9534        }
9535
9536        /// Sets the value of [mode][crate::model::object::Retention::mode].
9537        ///
9538        /// # Example
9539        /// ```ignore,no_run
9540        /// # use google_cloud_storage::model::object::Retention;
9541        /// use google_cloud_storage::model::object::retention::Mode;
9542        /// let x0 = Retention::new().set_mode(Mode::Unlocked);
9543        /// let x1 = Retention::new().set_mode(Mode::Locked);
9544        /// ```
9545        pub fn set_mode<T: std::convert::Into<crate::model::object::retention::Mode>>(
9546            mut self,
9547            v: T,
9548        ) -> Self {
9549            self.mode = v.into();
9550            self
9551        }
9552
9553        /// Sets the value of [retain_until_time][crate::model::object::Retention::retain_until_time].
9554        ///
9555        /// # Example
9556        /// ```ignore,no_run
9557        /// # use google_cloud_storage::model::object::Retention;
9558        /// use wkt::Timestamp;
9559        /// let x = Retention::new().set_retain_until_time(Timestamp::default()/* use setters */);
9560        /// ```
9561        pub fn set_retain_until_time<T>(mut self, v: T) -> Self
9562        where
9563            T: std::convert::Into<wkt::Timestamp>,
9564        {
9565            self.retain_until_time = std::option::Option::Some(v.into());
9566            self
9567        }
9568
9569        /// Sets or clears the value of [retain_until_time][crate::model::object::Retention::retain_until_time].
9570        ///
9571        /// # Example
9572        /// ```ignore,no_run
9573        /// # use google_cloud_storage::model::object::Retention;
9574        /// use wkt::Timestamp;
9575        /// let x = Retention::new().set_or_clear_retain_until_time(Some(Timestamp::default()/* use setters */));
9576        /// let x = Retention::new().set_or_clear_retain_until_time(None::<Timestamp>);
9577        /// ```
9578        pub fn set_or_clear_retain_until_time<T>(mut self, v: std::option::Option<T>) -> Self
9579        where
9580            T: std::convert::Into<wkt::Timestamp>,
9581        {
9582            self.retain_until_time = v.map(|x| x.into());
9583            self
9584        }
9585    }
9586
9587    impl wkt::message::Message for Retention {
9588        fn typename() -> &'static str {
9589            "type.googleapis.com/google.storage.v2.Object.Retention"
9590        }
9591    }
9592
9593    /// Defines additional types related to [Retention].
9594    pub mod retention {
9595        #[allow(unused_imports)]
9596        use super::*;
9597
9598        /// Retention mode values.
9599        ///
9600        /// # Working with unknown values
9601        ///
9602        /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
9603        /// additional enum variants at any time. Adding new variants is not considered
9604        /// a breaking change. Applications should write their code in anticipation of:
9605        ///
9606        /// - New values appearing in future releases of the client library, **and**
9607        /// - New values received dynamically, without application changes.
9608        ///
9609        /// Please consult the [Working with enums] section in the user guide for some
9610        /// guidelines.
9611        ///
9612        /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
9613        #[derive(Clone, Debug, PartialEq)]
9614        #[non_exhaustive]
9615        pub enum Mode {
9616            /// No specified mode. Object is not under retention.
9617            Unspecified,
9618            /// Retention period might be decreased or increased.
9619            /// The Retention configuration might be removed.
9620            /// The mode might be changed to locked.
9621            Unlocked,
9622            /// Retention period might be increased.
9623            /// The Retention configuration cannot be removed.
9624            /// The mode cannot be changed.
9625            Locked,
9626            /// If set, the enum was initialized with an unknown value.
9627            ///
9628            /// Applications can examine the value using [Mode::value] or
9629            /// [Mode::name].
9630            UnknownValue(mode::UnknownValue),
9631        }
9632
9633        #[doc(hidden)]
9634        pub mod mode {
9635            #[allow(unused_imports)]
9636            use super::*;
9637            #[derive(Clone, Debug, PartialEq)]
9638            pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
9639        }
9640
9641        impl Mode {
9642            /// Gets the enum value.
9643            ///
9644            /// Returns `None` if the enum contains an unknown value deserialized from
9645            /// the string representation of enums.
9646            pub fn value(&self) -> std::option::Option<i32> {
9647                match self {
9648                    Self::Unspecified => std::option::Option::Some(0),
9649                    Self::Unlocked => std::option::Option::Some(1),
9650                    Self::Locked => std::option::Option::Some(2),
9651                    Self::UnknownValue(u) => u.0.value(),
9652                }
9653            }
9654
9655            /// Gets the enum value as a string.
9656            ///
9657            /// Returns `None` if the enum contains an unknown value deserialized from
9658            /// the integer representation of enums.
9659            pub fn name(&self) -> std::option::Option<&str> {
9660                match self {
9661                    Self::Unspecified => std::option::Option::Some("MODE_UNSPECIFIED"),
9662                    Self::Unlocked => std::option::Option::Some("UNLOCKED"),
9663                    Self::Locked => std::option::Option::Some("LOCKED"),
9664                    Self::UnknownValue(u) => u.0.name(),
9665                }
9666            }
9667        }
9668
9669        impl std::default::Default for Mode {
9670            fn default() -> Self {
9671                use std::convert::From;
9672                Self::from(0)
9673            }
9674        }
9675
9676        impl std::fmt::Display for Mode {
9677            fn fmt(
9678                &self,
9679                f: &mut std::fmt::Formatter<'_>,
9680            ) -> std::result::Result<(), std::fmt::Error> {
9681                wkt::internal::display_enum(f, self.name(), self.value())
9682            }
9683        }
9684
9685        impl std::convert::From<i32> for Mode {
9686            fn from(value: i32) -> Self {
9687                match value {
9688                    0 => Self::Unspecified,
9689                    1 => Self::Unlocked,
9690                    2 => Self::Locked,
9691                    _ => Self::UnknownValue(mode::UnknownValue(
9692                        wkt::internal::UnknownEnumValue::Integer(value),
9693                    )),
9694                }
9695            }
9696        }
9697
9698        impl std::convert::From<&str> for Mode {
9699            fn from(value: &str) -> Self {
9700                use std::string::ToString;
9701                match value {
9702                    "MODE_UNSPECIFIED" => Self::Unspecified,
9703                    "UNLOCKED" => Self::Unlocked,
9704                    "LOCKED" => Self::Locked,
9705                    _ => Self::UnknownValue(mode::UnknownValue(
9706                        wkt::internal::UnknownEnumValue::String(value.to_string()),
9707                    )),
9708                }
9709            }
9710        }
9711
9712        impl serde::ser::Serialize for Mode {
9713            fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
9714            where
9715                S: serde::Serializer,
9716            {
9717                match self {
9718                    Self::Unspecified => serializer.serialize_i32(0),
9719                    Self::Unlocked => serializer.serialize_i32(1),
9720                    Self::Locked => serializer.serialize_i32(2),
9721                    Self::UnknownValue(u) => u.0.serialize(serializer),
9722                }
9723            }
9724        }
9725
9726        impl<'de> serde::de::Deserialize<'de> for Mode {
9727            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
9728            where
9729                D: serde::Deserializer<'de>,
9730            {
9731                deserializer.deserialize_any(wkt::internal::EnumVisitor::<Mode>::new(
9732                    ".google.storage.v2.Object.Retention.Mode",
9733                ))
9734            }
9735        }
9736    }
9737}
9738
9739/// An access-control entry.
9740#[derive(Clone, Default, PartialEq)]
9741#[non_exhaustive]
9742pub struct ObjectAccessControl {
9743    /// Optional. The access permission for the entity. One of the following
9744    /// values:
9745    ///
9746    /// * `READER`
9747    /// * `WRITER`
9748    /// * `OWNER`
9749    pub role: std::string::String,
9750
9751    /// Optional. The ID of the access-control entry.
9752    pub id: std::string::String,
9753
9754    /// Optional. The entity holding the permission, in one of the following forms:
9755    ///
9756    /// * `user-{userid}`
9757    /// * `user-{email}`
9758    /// * `group-{groupid}`
9759    /// * `group-{email}`
9760    /// * `domain-{domain}`
9761    /// * `project-{team}-{projectnumber}`
9762    /// * `project-{team}-{projectid}`
9763    /// * `allUsers`
9764    /// * `allAuthenticatedUsers`
9765    ///   Examples:
9766    /// * The user `liz@example.com` would be `user-liz@example.com`.
9767    /// * The group `example@googlegroups.com` would be
9768    ///   `group-example@googlegroups.com`.
9769    /// * All members of the Google Apps for Business domain `example.com` would be
9770    ///   `domain-example.com`.
9771    ///   For project entities, `project-{team}-{projectnumber}` format is
9772    ///   returned in the response.
9773    pub entity: std::string::String,
9774
9775    /// Output only. The alternative entity format, if exists. For project
9776    /// entities, `project-{team}-{projectid}` format is returned in the response.
9777    pub entity_alt: std::string::String,
9778
9779    /// Optional. The ID for the entity, if any.
9780    pub entity_id: std::string::String,
9781
9782    /// Optional. The etag of the ObjectAccessControl.
9783    /// If included in the metadata of an update or delete request message, the
9784    /// operation is only performed if the etag matches that of the live
9785    /// object's ObjectAccessControl.
9786    pub etag: std::string::String,
9787
9788    /// Optional. The email address associated with the entity, if any.
9789    pub email: std::string::String,
9790
9791    /// Optional. The domain associated with the entity, if any.
9792    pub domain: std::string::String,
9793
9794    /// Optional. The project team associated with the entity, if any.
9795    pub project_team: std::option::Option<crate::model::ProjectTeam>,
9796
9797    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
9798}
9799
9800impl ObjectAccessControl {
9801    /// Creates a new default instance.
9802    pub fn new() -> Self {
9803        std::default::Default::default()
9804    }
9805
9806    /// Sets the value of [role][crate::model::ObjectAccessControl::role].
9807    ///
9808    /// # Example
9809    /// ```ignore,no_run
9810    /// # use google_cloud_storage::model::ObjectAccessControl;
9811    /// let x = ObjectAccessControl::new().set_role("example");
9812    /// ```
9813    pub fn set_role<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9814        self.role = v.into();
9815        self
9816    }
9817
9818    /// Sets the value of [id][crate::model::ObjectAccessControl::id].
9819    ///
9820    /// # Example
9821    /// ```ignore,no_run
9822    /// # use google_cloud_storage::model::ObjectAccessControl;
9823    /// let x = ObjectAccessControl::new().set_id("example");
9824    /// ```
9825    pub fn set_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9826        self.id = v.into();
9827        self
9828    }
9829
9830    /// Sets the value of [entity][crate::model::ObjectAccessControl::entity].
9831    ///
9832    /// # Example
9833    /// ```ignore,no_run
9834    /// # use google_cloud_storage::model::ObjectAccessControl;
9835    /// let x = ObjectAccessControl::new().set_entity("example");
9836    /// ```
9837    pub fn set_entity<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9838        self.entity = v.into();
9839        self
9840    }
9841
9842    /// Sets the value of [entity_alt][crate::model::ObjectAccessControl::entity_alt].
9843    ///
9844    /// # Example
9845    /// ```ignore,no_run
9846    /// # use google_cloud_storage::model::ObjectAccessControl;
9847    /// let x = ObjectAccessControl::new().set_entity_alt("example");
9848    /// ```
9849    pub fn set_entity_alt<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9850        self.entity_alt = v.into();
9851        self
9852    }
9853
9854    /// Sets the value of [entity_id][crate::model::ObjectAccessControl::entity_id].
9855    ///
9856    /// # Example
9857    /// ```ignore,no_run
9858    /// # use google_cloud_storage::model::ObjectAccessControl;
9859    /// let x = ObjectAccessControl::new().set_entity_id("example");
9860    /// ```
9861    pub fn set_entity_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9862        self.entity_id = v.into();
9863        self
9864    }
9865
9866    /// Sets the value of [etag][crate::model::ObjectAccessControl::etag].
9867    ///
9868    /// # Example
9869    /// ```ignore,no_run
9870    /// # use google_cloud_storage::model::ObjectAccessControl;
9871    /// let x = ObjectAccessControl::new().set_etag("example");
9872    /// ```
9873    pub fn set_etag<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9874        self.etag = v.into();
9875        self
9876    }
9877
9878    /// Sets the value of [email][crate::model::ObjectAccessControl::email].
9879    ///
9880    /// # Example
9881    /// ```ignore,no_run
9882    /// # use google_cloud_storage::model::ObjectAccessControl;
9883    /// let x = ObjectAccessControl::new().set_email("example");
9884    /// ```
9885    pub fn set_email<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9886        self.email = v.into();
9887        self
9888    }
9889
9890    /// Sets the value of [domain][crate::model::ObjectAccessControl::domain].
9891    ///
9892    /// # Example
9893    /// ```ignore,no_run
9894    /// # use google_cloud_storage::model::ObjectAccessControl;
9895    /// let x = ObjectAccessControl::new().set_domain("example");
9896    /// ```
9897    pub fn set_domain<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9898        self.domain = v.into();
9899        self
9900    }
9901
9902    /// Sets the value of [project_team][crate::model::ObjectAccessControl::project_team].
9903    ///
9904    /// # Example
9905    /// ```ignore,no_run
9906    /// # use google_cloud_storage::model::ObjectAccessControl;
9907    /// use google_cloud_storage::model::ProjectTeam;
9908    /// let x = ObjectAccessControl::new().set_project_team(ProjectTeam::default()/* use setters */);
9909    /// ```
9910    pub fn set_project_team<T>(mut self, v: T) -> Self
9911    where
9912        T: std::convert::Into<crate::model::ProjectTeam>,
9913    {
9914        self.project_team = std::option::Option::Some(v.into());
9915        self
9916    }
9917
9918    /// Sets or clears the value of [project_team][crate::model::ObjectAccessControl::project_team].
9919    ///
9920    /// # Example
9921    /// ```ignore,no_run
9922    /// # use google_cloud_storage::model::ObjectAccessControl;
9923    /// use google_cloud_storage::model::ProjectTeam;
9924    /// let x = ObjectAccessControl::new().set_or_clear_project_team(Some(ProjectTeam::default()/* use setters */));
9925    /// let x = ObjectAccessControl::new().set_or_clear_project_team(None::<ProjectTeam>);
9926    /// ```
9927    pub fn set_or_clear_project_team<T>(mut self, v: std::option::Option<T>) -> Self
9928    where
9929        T: std::convert::Into<crate::model::ProjectTeam>,
9930    {
9931        self.project_team = v.map(|x| x.into());
9932        self
9933    }
9934}
9935
9936impl wkt::message::Message for ObjectAccessControl {
9937    fn typename() -> &'static str {
9938        "type.googleapis.com/google.storage.v2.ObjectAccessControl"
9939    }
9940}
9941
9942/// The result of a call to Objects.ListObjects
9943#[derive(Clone, Default, PartialEq)]
9944#[non_exhaustive]
9945pub struct ListObjectsResponse {
9946    /// The list of items.
9947    pub objects: std::vec::Vec<crate::model::Object>,
9948
9949    /// The list of prefixes of objects matching-but-not-listed up to and including
9950    /// the requested delimiter.
9951    pub prefixes: std::vec::Vec<std::string::String>,
9952
9953    /// The continuation token, used to page through large result sets. Provide
9954    /// this value in a subsequent request to return the next page of results.
9955    pub next_page_token: std::string::String,
9956
9957    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
9958}
9959
9960impl ListObjectsResponse {
9961    /// Creates a new default instance.
9962    pub fn new() -> Self {
9963        std::default::Default::default()
9964    }
9965
9966    /// Sets the value of [objects][crate::model::ListObjectsResponse::objects].
9967    ///
9968    /// # Example
9969    /// ```ignore,no_run
9970    /// # use google_cloud_storage::model::ListObjectsResponse;
9971    /// use google_cloud_storage::model::Object;
9972    /// let x = ListObjectsResponse::new()
9973    ///     .set_objects([
9974    ///         Object::default()/* use setters */,
9975    ///         Object::default()/* use (different) setters */,
9976    ///     ]);
9977    /// ```
9978    pub fn set_objects<T, V>(mut self, v: T) -> Self
9979    where
9980        T: std::iter::IntoIterator<Item = V>,
9981        V: std::convert::Into<crate::model::Object>,
9982    {
9983        use std::iter::Iterator;
9984        self.objects = v.into_iter().map(|i| i.into()).collect();
9985        self
9986    }
9987
9988    /// Sets the value of [prefixes][crate::model::ListObjectsResponse::prefixes].
9989    ///
9990    /// # Example
9991    /// ```ignore,no_run
9992    /// # use google_cloud_storage::model::ListObjectsResponse;
9993    /// let x = ListObjectsResponse::new().set_prefixes(["a", "b", "c"]);
9994    /// ```
9995    pub fn set_prefixes<T, V>(mut self, v: T) -> Self
9996    where
9997        T: std::iter::IntoIterator<Item = V>,
9998        V: std::convert::Into<std::string::String>,
9999    {
10000        use std::iter::Iterator;
10001        self.prefixes = v.into_iter().map(|i| i.into()).collect();
10002        self
10003    }
10004
10005    /// Sets the value of [next_page_token][crate::model::ListObjectsResponse::next_page_token].
10006    ///
10007    /// # Example
10008    /// ```ignore,no_run
10009    /// # use google_cloud_storage::model::ListObjectsResponse;
10010    /// let x = ListObjectsResponse::new().set_next_page_token("example");
10011    /// ```
10012    pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
10013        self.next_page_token = v.into();
10014        self
10015    }
10016}
10017
10018impl wkt::message::Message for ListObjectsResponse {
10019    fn typename() -> &'static str {
10020        "type.googleapis.com/google.storage.v2.ListObjectsResponse"
10021    }
10022}
10023
10024#[doc(hidden)]
10025impl google_cloud_gax::paginator::internal::PageableResponse for ListObjectsResponse {
10026    type PageItem = crate::model::Object;
10027
10028    fn items(self) -> std::vec::Vec<Self::PageItem> {
10029        self.objects
10030    }
10031
10032    fn next_page_token(&self) -> std::string::String {
10033        use std::clone::Clone;
10034        self.next_page_token.clone()
10035    }
10036}
10037
10038/// Represents the Viewers, Editors, or Owners of a given project.
10039#[derive(Clone, Default, PartialEq)]
10040#[non_exhaustive]
10041pub struct ProjectTeam {
10042    /// Optional. The project number.
10043    pub project_number: std::string::String,
10044
10045    /// Optional. The team.
10046    pub team: std::string::String,
10047
10048    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
10049}
10050
10051impl ProjectTeam {
10052    /// Creates a new default instance.
10053    pub fn new() -> Self {
10054        std::default::Default::default()
10055    }
10056
10057    /// Sets the value of [project_number][crate::model::ProjectTeam::project_number].
10058    ///
10059    /// # Example
10060    /// ```ignore,no_run
10061    /// # use google_cloud_storage::model::ProjectTeam;
10062    /// let x = ProjectTeam::new().set_project_number("example");
10063    /// ```
10064    pub fn set_project_number<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
10065        self.project_number = v.into();
10066        self
10067    }
10068
10069    /// Sets the value of [team][crate::model::ProjectTeam::team].
10070    ///
10071    /// # Example
10072    /// ```ignore,no_run
10073    /// # use google_cloud_storage::model::ProjectTeam;
10074    /// let x = ProjectTeam::new().set_team("example");
10075    /// ```
10076    pub fn set_team<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
10077        self.team = v.into();
10078        self
10079    }
10080}
10081
10082impl wkt::message::Message for ProjectTeam {
10083    fn typename() -> &'static str {
10084        "type.googleapis.com/google.storage.v2.ProjectTeam"
10085    }
10086}
10087
10088/// The owner of a specific resource.
10089#[derive(Clone, Default, PartialEq)]
10090#[non_exhaustive]
10091pub struct Owner {
10092    /// Optional. The entity, in the form `user-`*userId*.
10093    pub entity: std::string::String,
10094
10095    /// Optional. The ID for the entity.
10096    pub entity_id: std::string::String,
10097
10098    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
10099}
10100
10101impl Owner {
10102    /// Creates a new default instance.
10103    pub fn new() -> Self {
10104        std::default::Default::default()
10105    }
10106
10107    /// Sets the value of [entity][crate::model::Owner::entity].
10108    ///
10109    /// # Example
10110    /// ```ignore,no_run
10111    /// # use google_cloud_storage::model::Owner;
10112    /// let x = Owner::new().set_entity("example");
10113    /// ```
10114    pub fn set_entity<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
10115        self.entity = v.into();
10116        self
10117    }
10118
10119    /// Sets the value of [entity_id][crate::model::Owner::entity_id].
10120    ///
10121    /// # Example
10122    /// ```ignore,no_run
10123    /// # use google_cloud_storage::model::Owner;
10124    /// let x = Owner::new().set_entity_id("example");
10125    /// ```
10126    pub fn set_entity_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
10127        self.entity_id = v.into();
10128        self
10129    }
10130}
10131
10132impl wkt::message::Message for Owner {
10133    fn typename() -> &'static str {
10134        "type.googleapis.com/google.storage.v2.Owner"
10135    }
10136}