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 pub fn new() -> Self {
45 std::default::Default::default()
46 }
47
48 /// Sets the value of [name][crate::model::DeleteBucketRequest::name].
49 ///
50 /// # Example
51 /// ```ignore,no_run
52 /// # use google_cloud_storage::model::DeleteBucketRequest;
53 /// let x = DeleteBucketRequest::new().set_name("example");
54 /// ```
55 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
56 self.name = v.into();
57 self
58 }
59
60 /// Sets the value of [if_metageneration_match][crate::model::DeleteBucketRequest::if_metageneration_match].
61 ///
62 /// # Example
63 /// ```ignore,no_run
64 /// # use google_cloud_storage::model::DeleteBucketRequest;
65 /// let x = DeleteBucketRequest::new().set_if_metageneration_match(42);
66 /// ```
67 pub fn set_if_metageneration_match<T>(mut self, v: T) -> Self
68 where
69 T: std::convert::Into<i64>,
70 {
71 self.if_metageneration_match = std::option::Option::Some(v.into());
72 self
73 }
74
75 /// Sets or clears the value of [if_metageneration_match][crate::model::DeleteBucketRequest::if_metageneration_match].
76 ///
77 /// # Example
78 /// ```ignore,no_run
79 /// # use google_cloud_storage::model::DeleteBucketRequest;
80 /// let x = DeleteBucketRequest::new().set_or_clear_if_metageneration_match(Some(42));
81 /// let x = DeleteBucketRequest::new().set_or_clear_if_metageneration_match(None::<i32>);
82 /// ```
83 pub fn set_or_clear_if_metageneration_match<T>(mut self, v: std::option::Option<T>) -> Self
84 where
85 T: std::convert::Into<i64>,
86 {
87 self.if_metageneration_match = v.map(|x| x.into());
88 self
89 }
90
91 /// Sets the value of [if_metageneration_not_match][crate::model::DeleteBucketRequest::if_metageneration_not_match].
92 ///
93 /// # Example
94 /// ```ignore,no_run
95 /// # use google_cloud_storage::model::DeleteBucketRequest;
96 /// let x = DeleteBucketRequest::new().set_if_metageneration_not_match(42);
97 /// ```
98 pub fn set_if_metageneration_not_match<T>(mut self, v: T) -> Self
99 where
100 T: std::convert::Into<i64>,
101 {
102 self.if_metageneration_not_match = std::option::Option::Some(v.into());
103 self
104 }
105
106 /// Sets or clears the value of [if_metageneration_not_match][crate::model::DeleteBucketRequest::if_metageneration_not_match].
107 ///
108 /// # Example
109 /// ```ignore,no_run
110 /// # use google_cloud_storage::model::DeleteBucketRequest;
111 /// let x = DeleteBucketRequest::new().set_or_clear_if_metageneration_not_match(Some(42));
112 /// let x = DeleteBucketRequest::new().set_or_clear_if_metageneration_not_match(None::<i32>);
113 /// ```
114 pub fn set_or_clear_if_metageneration_not_match<T>(mut self, v: std::option::Option<T>) -> Self
115 where
116 T: std::convert::Into<i64>,
117 {
118 self.if_metageneration_not_match = v.map(|x| x.into());
119 self
120 }
121}
122
123impl wkt::message::Message for DeleteBucketRequest {
124 fn typename() -> &'static str {
125 "type.googleapis.com/google.storage.v2.DeleteBucketRequest"
126 }
127}
128
129/// Request message for [GetBucket][google.storage.v2.Storage.GetBucket].
130///
131/// [google.storage.v2.Storage.GetBucket]: crate::client::StorageControl::get_bucket
132#[derive(Clone, Default, PartialEq)]
133#[non_exhaustive]
134pub struct GetBucketRequest {
135 /// Required. Name of a bucket.
136 pub name: std::string::String,
137
138 /// If set, only gets the bucket metadata if its metageneration matches this
139 /// value.
140 pub if_metageneration_match: std::option::Option<i64>,
141
142 /// If set, and if the bucket's current metageneration matches the specified
143 /// value, the request returns an error.
144 pub if_metageneration_not_match: std::option::Option<i64>,
145
146 /// Mask specifying which fields to read.
147 /// A `*` field might be used to indicate all fields.
148 /// If no mask is specified, it defaults to all fields.
149 pub read_mask: std::option::Option<wkt::FieldMask>,
150
151 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
152}
153
154impl GetBucketRequest {
155 pub fn new() -> Self {
156 std::default::Default::default()
157 }
158
159 /// Sets the value of [name][crate::model::GetBucketRequest::name].
160 ///
161 /// # Example
162 /// ```ignore,no_run
163 /// # use google_cloud_storage::model::GetBucketRequest;
164 /// let x = GetBucketRequest::new().set_name("example");
165 /// ```
166 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
167 self.name = v.into();
168 self
169 }
170
171 /// Sets the value of [if_metageneration_match][crate::model::GetBucketRequest::if_metageneration_match].
172 ///
173 /// # Example
174 /// ```ignore,no_run
175 /// # use google_cloud_storage::model::GetBucketRequest;
176 /// let x = GetBucketRequest::new().set_if_metageneration_match(42);
177 /// ```
178 pub fn set_if_metageneration_match<T>(mut self, v: T) -> Self
179 where
180 T: std::convert::Into<i64>,
181 {
182 self.if_metageneration_match = std::option::Option::Some(v.into());
183 self
184 }
185
186 /// Sets or clears the value of [if_metageneration_match][crate::model::GetBucketRequest::if_metageneration_match].
187 ///
188 /// # Example
189 /// ```ignore,no_run
190 /// # use google_cloud_storage::model::GetBucketRequest;
191 /// let x = GetBucketRequest::new().set_or_clear_if_metageneration_match(Some(42));
192 /// let x = GetBucketRequest::new().set_or_clear_if_metageneration_match(None::<i32>);
193 /// ```
194 pub fn set_or_clear_if_metageneration_match<T>(mut self, v: std::option::Option<T>) -> Self
195 where
196 T: std::convert::Into<i64>,
197 {
198 self.if_metageneration_match = v.map(|x| x.into());
199 self
200 }
201
202 /// Sets the value of [if_metageneration_not_match][crate::model::GetBucketRequest::if_metageneration_not_match].
203 ///
204 /// # Example
205 /// ```ignore,no_run
206 /// # use google_cloud_storage::model::GetBucketRequest;
207 /// let x = GetBucketRequest::new().set_if_metageneration_not_match(42);
208 /// ```
209 pub fn set_if_metageneration_not_match<T>(mut self, v: T) -> Self
210 where
211 T: std::convert::Into<i64>,
212 {
213 self.if_metageneration_not_match = std::option::Option::Some(v.into());
214 self
215 }
216
217 /// Sets or clears the value of [if_metageneration_not_match][crate::model::GetBucketRequest::if_metageneration_not_match].
218 ///
219 /// # Example
220 /// ```ignore,no_run
221 /// # use google_cloud_storage::model::GetBucketRequest;
222 /// let x = GetBucketRequest::new().set_or_clear_if_metageneration_not_match(Some(42));
223 /// let x = GetBucketRequest::new().set_or_clear_if_metageneration_not_match(None::<i32>);
224 /// ```
225 pub fn set_or_clear_if_metageneration_not_match<T>(mut self, v: std::option::Option<T>) -> Self
226 where
227 T: std::convert::Into<i64>,
228 {
229 self.if_metageneration_not_match = v.map(|x| x.into());
230 self
231 }
232
233 /// Sets the value of [read_mask][crate::model::GetBucketRequest::read_mask].
234 ///
235 /// # Example
236 /// ```ignore,no_run
237 /// # use google_cloud_storage::model::GetBucketRequest;
238 /// use wkt::FieldMask;
239 /// let x = GetBucketRequest::new().set_read_mask(FieldMask::default()/* use setters */);
240 /// ```
241 pub fn set_read_mask<T>(mut self, v: T) -> Self
242 where
243 T: std::convert::Into<wkt::FieldMask>,
244 {
245 self.read_mask = std::option::Option::Some(v.into());
246 self
247 }
248
249 /// Sets or clears the value of [read_mask][crate::model::GetBucketRequest::read_mask].
250 ///
251 /// # Example
252 /// ```ignore,no_run
253 /// # use google_cloud_storage::model::GetBucketRequest;
254 /// use wkt::FieldMask;
255 /// let x = GetBucketRequest::new().set_or_clear_read_mask(Some(FieldMask::default()/* use setters */));
256 /// let x = GetBucketRequest::new().set_or_clear_read_mask(None::<FieldMask>);
257 /// ```
258 pub fn set_or_clear_read_mask<T>(mut self, v: std::option::Option<T>) -> Self
259 where
260 T: std::convert::Into<wkt::FieldMask>,
261 {
262 self.read_mask = v.map(|x| x.into());
263 self
264 }
265}
266
267impl wkt::message::Message for GetBucketRequest {
268 fn typename() -> &'static str {
269 "type.googleapis.com/google.storage.v2.GetBucketRequest"
270 }
271}
272
273/// Request message for [CreateBucket][google.storage.v2.Storage.CreateBucket].
274///
275/// [google.storage.v2.Storage.CreateBucket]: crate::client::StorageControl::create_bucket
276#[derive(Clone, Default, PartialEq)]
277#[non_exhaustive]
278pub struct CreateBucketRequest {
279 /// Required. The project to which this bucket belongs. This field must either
280 /// be empty or `projects/_`. The project ID that owns this bucket should be
281 /// specified in the `bucket.project` field.
282 pub parent: std::string::String,
283
284 /// Optional. Properties of the new bucket being inserted.
285 /// The name of the bucket is specified in the `bucket_id` field. Populating
286 /// `bucket.name` field results in an error.
287 /// The project of the bucket must be specified in the `bucket.project` field.
288 /// This field must be in `projects/{projectIdentifier}` format,
289 /// {projectIdentifier} can be the project ID or project number. The `parent`
290 /// field must be either empty or `projects/_`.
291 pub bucket: std::option::Option<crate::model::Bucket>,
292
293 /// Required. The ID to use for this bucket, which becomes the final component
294 /// of the bucket's resource name. For example, the value `foo` might result in
295 /// a bucket with the name `projects/123456/buckets/foo`.
296 pub bucket_id: std::string::String,
297
298 /// Optional. Apply a predefined set of access controls to this bucket.
299 /// Valid values are `authenticatedRead`, `private`, `projectPrivate`,
300 /// `publicRead`, or `publicReadWrite`.
301 pub predefined_acl: std::string::String,
302
303 /// Optional. Apply a predefined set of default object access controls to this
304 /// bucket. Valid values are `authenticatedRead`, `bucketOwnerFullControl`,
305 /// `bucketOwnerRead`, `private`, `projectPrivate`, or `publicRead`.
306 pub predefined_default_object_acl: std::string::String,
307
308 /// Optional. If true, enable object retention on the bucket.
309 pub enable_object_retention: bool,
310
311 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
312}
313
314impl CreateBucketRequest {
315 pub fn new() -> Self {
316 std::default::Default::default()
317 }
318
319 /// Sets the value of [parent][crate::model::CreateBucketRequest::parent].
320 ///
321 /// # Example
322 /// ```ignore,no_run
323 /// # use google_cloud_storage::model::CreateBucketRequest;
324 /// let x = CreateBucketRequest::new().set_parent("example");
325 /// ```
326 pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
327 self.parent = v.into();
328 self
329 }
330
331 /// Sets the value of [bucket][crate::model::CreateBucketRequest::bucket].
332 ///
333 /// # Example
334 /// ```ignore,no_run
335 /// # use google_cloud_storage::model::CreateBucketRequest;
336 /// use google_cloud_storage::model::Bucket;
337 /// let x = CreateBucketRequest::new().set_bucket(Bucket::default()/* use setters */);
338 /// ```
339 pub fn set_bucket<T>(mut self, v: T) -> Self
340 where
341 T: std::convert::Into<crate::model::Bucket>,
342 {
343 self.bucket = std::option::Option::Some(v.into());
344 self
345 }
346
347 /// Sets or clears the value of [bucket][crate::model::CreateBucketRequest::bucket].
348 ///
349 /// # Example
350 /// ```ignore,no_run
351 /// # use google_cloud_storage::model::CreateBucketRequest;
352 /// use google_cloud_storage::model::Bucket;
353 /// let x = CreateBucketRequest::new().set_or_clear_bucket(Some(Bucket::default()/* use setters */));
354 /// let x = CreateBucketRequest::new().set_or_clear_bucket(None::<Bucket>);
355 /// ```
356 pub fn set_or_clear_bucket<T>(mut self, v: std::option::Option<T>) -> Self
357 where
358 T: std::convert::Into<crate::model::Bucket>,
359 {
360 self.bucket = v.map(|x| x.into());
361 self
362 }
363
364 /// Sets the value of [bucket_id][crate::model::CreateBucketRequest::bucket_id].
365 ///
366 /// # Example
367 /// ```ignore,no_run
368 /// # use google_cloud_storage::model::CreateBucketRequest;
369 /// let x = CreateBucketRequest::new().set_bucket_id("example");
370 /// ```
371 pub fn set_bucket_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
372 self.bucket_id = v.into();
373 self
374 }
375
376 /// Sets the value of [predefined_acl][crate::model::CreateBucketRequest::predefined_acl].
377 ///
378 /// # Example
379 /// ```ignore,no_run
380 /// # use google_cloud_storage::model::CreateBucketRequest;
381 /// let x = CreateBucketRequest::new().set_predefined_acl("example");
382 /// ```
383 pub fn set_predefined_acl<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
384 self.predefined_acl = v.into();
385 self
386 }
387
388 /// Sets the value of [predefined_default_object_acl][crate::model::CreateBucketRequest::predefined_default_object_acl].
389 ///
390 /// # Example
391 /// ```ignore,no_run
392 /// # use google_cloud_storage::model::CreateBucketRequest;
393 /// let x = CreateBucketRequest::new().set_predefined_default_object_acl("example");
394 /// ```
395 pub fn set_predefined_default_object_acl<T: std::convert::Into<std::string::String>>(
396 mut self,
397 v: T,
398 ) -> Self {
399 self.predefined_default_object_acl = v.into();
400 self
401 }
402
403 /// Sets the value of [enable_object_retention][crate::model::CreateBucketRequest::enable_object_retention].
404 ///
405 /// # Example
406 /// ```ignore,no_run
407 /// # use google_cloud_storage::model::CreateBucketRequest;
408 /// let x = CreateBucketRequest::new().set_enable_object_retention(true);
409 /// ```
410 pub fn set_enable_object_retention<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
411 self.enable_object_retention = v.into();
412 self
413 }
414}
415
416impl wkt::message::Message for CreateBucketRequest {
417 fn typename() -> &'static str {
418 "type.googleapis.com/google.storage.v2.CreateBucketRequest"
419 }
420}
421
422/// Request message for [ListBuckets][google.storage.v2.Storage.ListBuckets].
423///
424/// [google.storage.v2.Storage.ListBuckets]: crate::client::StorageControl::list_buckets
425#[derive(Clone, Default, PartialEq)]
426#[non_exhaustive]
427pub struct ListBucketsRequest {
428 /// Required. The project whose buckets we are listing.
429 pub parent: std::string::String,
430
431 /// Optional. Maximum number of buckets to return in a single response. The
432 /// service uses this parameter or `1,000` items, whichever is smaller. If
433 /// `acl` is present in the `read_mask`, the service uses this parameter of
434 /// `200` items, whichever is smaller.
435 pub page_size: i32,
436
437 /// Optional. A previously-returned page token representing part of the larger
438 /// set of results to view.
439 pub page_token: std::string::String,
440
441 /// Optional. Filter results to buckets whose names begin with this prefix.
442 pub prefix: std::string::String,
443
444 /// Mask specifying which fields to read from each result.
445 /// If no mask is specified, it defaults to all fields except `items.
446 /// owner`, `items.acl`, and `items.default_object_acl`.
447 /// `*` might be used to mean "all fields".
448 pub read_mask: std::option::Option<wkt::FieldMask>,
449
450 /// Optional. Allows listing of buckets, even if there are buckets that are
451 /// unreachable.
452 pub return_partial_success: bool,
453
454 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
455}
456
457impl ListBucketsRequest {
458 pub fn new() -> Self {
459 std::default::Default::default()
460 }
461
462 /// Sets the value of [parent][crate::model::ListBucketsRequest::parent].
463 ///
464 /// # Example
465 /// ```ignore,no_run
466 /// # use google_cloud_storage::model::ListBucketsRequest;
467 /// let x = ListBucketsRequest::new().set_parent("example");
468 /// ```
469 pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
470 self.parent = v.into();
471 self
472 }
473
474 /// Sets the value of [page_size][crate::model::ListBucketsRequest::page_size].
475 ///
476 /// # Example
477 /// ```ignore,no_run
478 /// # use google_cloud_storage::model::ListBucketsRequest;
479 /// let x = ListBucketsRequest::new().set_page_size(42);
480 /// ```
481 pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
482 self.page_size = v.into();
483 self
484 }
485
486 /// Sets the value of [page_token][crate::model::ListBucketsRequest::page_token].
487 ///
488 /// # Example
489 /// ```ignore,no_run
490 /// # use google_cloud_storage::model::ListBucketsRequest;
491 /// let x = ListBucketsRequest::new().set_page_token("example");
492 /// ```
493 pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
494 self.page_token = v.into();
495 self
496 }
497
498 /// Sets the value of [prefix][crate::model::ListBucketsRequest::prefix].
499 ///
500 /// # Example
501 /// ```ignore,no_run
502 /// # use google_cloud_storage::model::ListBucketsRequest;
503 /// let x = ListBucketsRequest::new().set_prefix("example");
504 /// ```
505 pub fn set_prefix<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
506 self.prefix = v.into();
507 self
508 }
509
510 /// Sets the value of [read_mask][crate::model::ListBucketsRequest::read_mask].
511 ///
512 /// # Example
513 /// ```ignore,no_run
514 /// # use google_cloud_storage::model::ListBucketsRequest;
515 /// use wkt::FieldMask;
516 /// let x = ListBucketsRequest::new().set_read_mask(FieldMask::default()/* use setters */);
517 /// ```
518 pub fn set_read_mask<T>(mut self, v: T) -> Self
519 where
520 T: std::convert::Into<wkt::FieldMask>,
521 {
522 self.read_mask = std::option::Option::Some(v.into());
523 self
524 }
525
526 /// Sets or clears the value of [read_mask][crate::model::ListBucketsRequest::read_mask].
527 ///
528 /// # Example
529 /// ```ignore,no_run
530 /// # use google_cloud_storage::model::ListBucketsRequest;
531 /// use wkt::FieldMask;
532 /// let x = ListBucketsRequest::new().set_or_clear_read_mask(Some(FieldMask::default()/* use setters */));
533 /// let x = ListBucketsRequest::new().set_or_clear_read_mask(None::<FieldMask>);
534 /// ```
535 pub fn set_or_clear_read_mask<T>(mut self, v: std::option::Option<T>) -> Self
536 where
537 T: std::convert::Into<wkt::FieldMask>,
538 {
539 self.read_mask = v.map(|x| x.into());
540 self
541 }
542
543 /// Sets the value of [return_partial_success][crate::model::ListBucketsRequest::return_partial_success].
544 ///
545 /// # Example
546 /// ```ignore,no_run
547 /// # use google_cloud_storage::model::ListBucketsRequest;
548 /// let x = ListBucketsRequest::new().set_return_partial_success(true);
549 /// ```
550 pub fn set_return_partial_success<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
551 self.return_partial_success = v.into();
552 self
553 }
554}
555
556impl wkt::message::Message for ListBucketsRequest {
557 fn typename() -> &'static str {
558 "type.googleapis.com/google.storage.v2.ListBucketsRequest"
559 }
560}
561
562/// Response message for [ListBuckets][google.storage.v2.Storage.ListBuckets].
563///
564/// [google.storage.v2.Storage.ListBuckets]: crate::client::StorageControl::list_buckets
565#[derive(Clone, Default, PartialEq)]
566#[non_exhaustive]
567pub struct ListBucketsResponse {
568 /// The list of items.
569 pub buckets: std::vec::Vec<crate::model::Bucket>,
570
571 /// The continuation token, used to page through large result sets. Provide
572 /// this value in a subsequent request to return the next page of results.
573 pub next_page_token: std::string::String,
574
575 /// Unreachable resources.
576 /// This field can only be present if the caller specified
577 /// return_partial_success to be true in the request to receive indications
578 /// of temporarily missing resources.
579 /// unreachable might be:
580 /// unreachable = [
581 /// "projects/_/buckets/bucket1",
582 /// "projects/_/buckets/bucket2",
583 /// "projects/_/buckets/bucket3",
584 /// ]
585 pub unreachable: std::vec::Vec<std::string::String>,
586
587 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
588}
589
590impl ListBucketsResponse {
591 pub fn new() -> Self {
592 std::default::Default::default()
593 }
594
595 /// Sets the value of [buckets][crate::model::ListBucketsResponse::buckets].
596 ///
597 /// # Example
598 /// ```ignore,no_run
599 /// # use google_cloud_storage::model::ListBucketsResponse;
600 /// use google_cloud_storage::model::Bucket;
601 /// let x = ListBucketsResponse::new()
602 /// .set_buckets([
603 /// Bucket::default()/* use setters */,
604 /// Bucket::default()/* use (different) setters */,
605 /// ]);
606 /// ```
607 pub fn set_buckets<T, V>(mut self, v: T) -> Self
608 where
609 T: std::iter::IntoIterator<Item = V>,
610 V: std::convert::Into<crate::model::Bucket>,
611 {
612 use std::iter::Iterator;
613 self.buckets = v.into_iter().map(|i| i.into()).collect();
614 self
615 }
616
617 /// Sets the value of [next_page_token][crate::model::ListBucketsResponse::next_page_token].
618 ///
619 /// # Example
620 /// ```ignore,no_run
621 /// # use google_cloud_storage::model::ListBucketsResponse;
622 /// let x = ListBucketsResponse::new().set_next_page_token("example");
623 /// ```
624 pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
625 self.next_page_token = v.into();
626 self
627 }
628
629 /// Sets the value of [unreachable][crate::model::ListBucketsResponse::unreachable].
630 ///
631 /// # Example
632 /// ```ignore,no_run
633 /// # use google_cloud_storage::model::ListBucketsResponse;
634 /// let x = ListBucketsResponse::new().set_unreachable(["a", "b", "c"]);
635 /// ```
636 pub fn set_unreachable<T, V>(mut self, v: T) -> Self
637 where
638 T: std::iter::IntoIterator<Item = V>,
639 V: std::convert::Into<std::string::String>,
640 {
641 use std::iter::Iterator;
642 self.unreachable = v.into_iter().map(|i| i.into()).collect();
643 self
644 }
645}
646
647impl wkt::message::Message for ListBucketsResponse {
648 fn typename() -> &'static str {
649 "type.googleapis.com/google.storage.v2.ListBucketsResponse"
650 }
651}
652
653#[doc(hidden)]
654impl gax::paginator::internal::PageableResponse for ListBucketsResponse {
655 type PageItem = crate::model::Bucket;
656
657 fn items(self) -> std::vec::Vec<Self::PageItem> {
658 self.buckets
659 }
660
661 fn next_page_token(&self) -> std::string::String {
662 use std::clone::Clone;
663 self.next_page_token.clone()
664 }
665}
666
667/// Request message for
668/// [LockBucketRetentionPolicy][google.storage.v2.Storage.LockBucketRetentionPolicy].
669///
670/// [google.storage.v2.Storage.LockBucketRetentionPolicy]: crate::client::StorageControl::lock_bucket_retention_policy
671#[derive(Clone, Default, PartialEq)]
672#[non_exhaustive]
673pub struct LockBucketRetentionPolicyRequest {
674 /// Required. Name of a bucket.
675 pub bucket: std::string::String,
676
677 /// Required. Makes the operation conditional on whether bucket's current
678 /// metageneration matches the given value. Must be positive.
679 pub if_metageneration_match: i64,
680
681 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
682}
683
684impl LockBucketRetentionPolicyRequest {
685 pub fn new() -> Self {
686 std::default::Default::default()
687 }
688
689 /// Sets the value of [bucket][crate::model::LockBucketRetentionPolicyRequest::bucket].
690 ///
691 /// # Example
692 /// ```ignore,no_run
693 /// # use google_cloud_storage::model::LockBucketRetentionPolicyRequest;
694 /// let x = LockBucketRetentionPolicyRequest::new().set_bucket("example");
695 /// ```
696 pub fn set_bucket<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
697 self.bucket = v.into();
698 self
699 }
700
701 /// Sets the value of [if_metageneration_match][crate::model::LockBucketRetentionPolicyRequest::if_metageneration_match].
702 ///
703 /// # Example
704 /// ```ignore,no_run
705 /// # use google_cloud_storage::model::LockBucketRetentionPolicyRequest;
706 /// let x = LockBucketRetentionPolicyRequest::new().set_if_metageneration_match(42);
707 /// ```
708 pub fn set_if_metageneration_match<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
709 self.if_metageneration_match = v.into();
710 self
711 }
712}
713
714impl wkt::message::Message for LockBucketRetentionPolicyRequest {
715 fn typename() -> &'static str {
716 "type.googleapis.com/google.storage.v2.LockBucketRetentionPolicyRequest"
717 }
718}
719
720/// Request for [UpdateBucket][google.storage.v2.Storage.UpdateBucket] method.
721///
722/// [google.storage.v2.Storage.UpdateBucket]: crate::client::StorageControl::update_bucket
723#[derive(Clone, Default, PartialEq)]
724#[non_exhaustive]
725pub struct UpdateBucketRequest {
726 /// Required. The bucket to update.
727 /// The bucket's `name` field is used to identify the bucket.
728 pub bucket: std::option::Option<crate::model::Bucket>,
729
730 /// If set, the request modifies the bucket if its metageneration matches this
731 /// value.
732 pub if_metageneration_match: std::option::Option<i64>,
733
734 /// If set, the request modifies the bucket if its metageneration doesn't
735 /// match this value.
736 pub if_metageneration_not_match: std::option::Option<i64>,
737
738 /// Optional. Apply a predefined set of access controls to this bucket.
739 /// Valid values are `authenticatedRead`, `private`, `projectPrivate`,
740 /// `publicRead`, or `publicReadWrite`.
741 pub predefined_acl: std::string::String,
742
743 /// Optional. Apply a predefined set of default object access controls to this
744 /// bucket. Valid values are `authenticatedRead`, `bucketOwnerFullControl`,
745 /// `bucketOwnerRead`, `private`, `projectPrivate`, or `publicRead`.
746 pub predefined_default_object_acl: std::string::String,
747
748 /// Required. List of fields to be updated.
749 ///
750 /// To specify ALL fields, equivalent to the JSON API's "update" function,
751 /// specify a single field with the value `*`. Note: not recommended. If a new
752 /// field is introduced at a later time, an older client updating with the `*`
753 /// might accidentally reset the new field's value.
754 ///
755 /// Not specifying any fields is an error.
756 pub update_mask: std::option::Option<wkt::FieldMask>,
757
758 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
759}
760
761impl UpdateBucketRequest {
762 pub fn new() -> Self {
763 std::default::Default::default()
764 }
765
766 /// Sets the value of [bucket][crate::model::UpdateBucketRequest::bucket].
767 ///
768 /// # Example
769 /// ```ignore,no_run
770 /// # use google_cloud_storage::model::UpdateBucketRequest;
771 /// use google_cloud_storage::model::Bucket;
772 /// let x = UpdateBucketRequest::new().set_bucket(Bucket::default()/* use setters */);
773 /// ```
774 pub fn set_bucket<T>(mut self, v: T) -> Self
775 where
776 T: std::convert::Into<crate::model::Bucket>,
777 {
778 self.bucket = std::option::Option::Some(v.into());
779 self
780 }
781
782 /// Sets or clears the value of [bucket][crate::model::UpdateBucketRequest::bucket].
783 ///
784 /// # Example
785 /// ```ignore,no_run
786 /// # use google_cloud_storage::model::UpdateBucketRequest;
787 /// use google_cloud_storage::model::Bucket;
788 /// let x = UpdateBucketRequest::new().set_or_clear_bucket(Some(Bucket::default()/* use setters */));
789 /// let x = UpdateBucketRequest::new().set_or_clear_bucket(None::<Bucket>);
790 /// ```
791 pub fn set_or_clear_bucket<T>(mut self, v: std::option::Option<T>) -> Self
792 where
793 T: std::convert::Into<crate::model::Bucket>,
794 {
795 self.bucket = v.map(|x| x.into());
796 self
797 }
798
799 /// Sets the value of [if_metageneration_match][crate::model::UpdateBucketRequest::if_metageneration_match].
800 ///
801 /// # Example
802 /// ```ignore,no_run
803 /// # use google_cloud_storage::model::UpdateBucketRequest;
804 /// let x = UpdateBucketRequest::new().set_if_metageneration_match(42);
805 /// ```
806 pub fn set_if_metageneration_match<T>(mut self, v: T) -> Self
807 where
808 T: std::convert::Into<i64>,
809 {
810 self.if_metageneration_match = std::option::Option::Some(v.into());
811 self
812 }
813
814 /// Sets or clears 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_or_clear_if_metageneration_match(Some(42));
820 /// let x = UpdateBucketRequest::new().set_or_clear_if_metageneration_match(None::<i32>);
821 /// ```
822 pub fn set_or_clear_if_metageneration_match<T>(mut self, v: std::option::Option<T>) -> Self
823 where
824 T: std::convert::Into<i64>,
825 {
826 self.if_metageneration_match = v.map(|x| x.into());
827 self
828 }
829
830 /// Sets the value of [if_metageneration_not_match][crate::model::UpdateBucketRequest::if_metageneration_not_match].
831 ///
832 /// # Example
833 /// ```ignore,no_run
834 /// # use google_cloud_storage::model::UpdateBucketRequest;
835 /// let x = UpdateBucketRequest::new().set_if_metageneration_not_match(42);
836 /// ```
837 pub fn set_if_metageneration_not_match<T>(mut self, v: T) -> Self
838 where
839 T: std::convert::Into<i64>,
840 {
841 self.if_metageneration_not_match = std::option::Option::Some(v.into());
842 self
843 }
844
845 /// Sets or clears 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_or_clear_if_metageneration_not_match(Some(42));
851 /// let x = UpdateBucketRequest::new().set_or_clear_if_metageneration_not_match(None::<i32>);
852 /// ```
853 pub fn set_or_clear_if_metageneration_not_match<T>(mut self, v: std::option::Option<T>) -> Self
854 where
855 T: std::convert::Into<i64>,
856 {
857 self.if_metageneration_not_match = v.map(|x| x.into());
858 self
859 }
860
861 /// Sets the value of [predefined_acl][crate::model::UpdateBucketRequest::predefined_acl].
862 ///
863 /// # Example
864 /// ```ignore,no_run
865 /// # use google_cloud_storage::model::UpdateBucketRequest;
866 /// let x = UpdateBucketRequest::new().set_predefined_acl("example");
867 /// ```
868 pub fn set_predefined_acl<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
869 self.predefined_acl = v.into();
870 self
871 }
872
873 /// Sets the value of [predefined_default_object_acl][crate::model::UpdateBucketRequest::predefined_default_object_acl].
874 ///
875 /// # Example
876 /// ```ignore,no_run
877 /// # use google_cloud_storage::model::UpdateBucketRequest;
878 /// let x = UpdateBucketRequest::new().set_predefined_default_object_acl("example");
879 /// ```
880 pub fn set_predefined_default_object_acl<T: std::convert::Into<std::string::String>>(
881 mut self,
882 v: T,
883 ) -> Self {
884 self.predefined_default_object_acl = v.into();
885 self
886 }
887
888 /// Sets the value of [update_mask][crate::model::UpdateBucketRequest::update_mask].
889 ///
890 /// # Example
891 /// ```ignore,no_run
892 /// # use google_cloud_storage::model::UpdateBucketRequest;
893 /// use wkt::FieldMask;
894 /// let x = UpdateBucketRequest::new().set_update_mask(FieldMask::default()/* use setters */);
895 /// ```
896 pub fn set_update_mask<T>(mut self, v: T) -> Self
897 where
898 T: std::convert::Into<wkt::FieldMask>,
899 {
900 self.update_mask = std::option::Option::Some(v.into());
901 self
902 }
903
904 /// Sets or clears the value of [update_mask][crate::model::UpdateBucketRequest::update_mask].
905 ///
906 /// # Example
907 /// ```ignore,no_run
908 /// # use google_cloud_storage::model::UpdateBucketRequest;
909 /// use wkt::FieldMask;
910 /// let x = UpdateBucketRequest::new().set_or_clear_update_mask(Some(FieldMask::default()/* use setters */));
911 /// let x = UpdateBucketRequest::new().set_or_clear_update_mask(None::<FieldMask>);
912 /// ```
913 pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
914 where
915 T: std::convert::Into<wkt::FieldMask>,
916 {
917 self.update_mask = v.map(|x| x.into());
918 self
919 }
920}
921
922impl wkt::message::Message for UpdateBucketRequest {
923 fn typename() -> &'static str {
924 "type.googleapis.com/google.storage.v2.UpdateBucketRequest"
925 }
926}
927
928/// Request message for [ComposeObject][google.storage.v2.Storage.ComposeObject].
929///
930/// [google.storage.v2.Storage.ComposeObject]: crate::client::StorageControl::compose_object
931#[derive(Clone, Default, PartialEq)]
932#[non_exhaustive]
933pub struct ComposeObjectRequest {
934 /// Required. Properties of the resulting object.
935 pub destination: std::option::Option<crate::model::Object>,
936
937 /// Optional. The list of source objects that is concatenated into a single
938 /// object.
939 pub source_objects: std::vec::Vec<crate::model::compose_object_request::SourceObject>,
940
941 /// Optional. Apply a predefined set of access controls to the destination
942 /// object. Valid values are `authenticatedRead`, `bucketOwnerFullControl`,
943 /// `bucketOwnerRead`, `private`, `projectPrivate`, or `publicRead`.
944 pub destination_predefined_acl: std::string::String,
945
946 /// Makes the operation conditional on whether the object's current generation
947 /// matches the given value. Setting to 0 makes the operation succeed only if
948 /// there are no live versions of the object.
949 pub if_generation_match: std::option::Option<i64>,
950
951 /// Makes the operation conditional on whether the object's current
952 /// metageneration matches the given value.
953 pub if_metageneration_match: std::option::Option<i64>,
954
955 /// Optional. Resource name of the Cloud KMS key, of the form
956 /// `projects/my-project/locations/my-location/keyRings/my-kr/cryptoKeys/my-key`,
957 /// that is used to encrypt the object. Overrides the object
958 /// metadata's `kms_key_name` value, if any.
959 pub kms_key: std::string::String,
960
961 /// Optional. A set of parameters common to Storage API requests concerning an
962 /// object.
963 pub common_object_request_params: std::option::Option<crate::model::CommonObjectRequestParams>,
964
965 /// Optional. The checksums of the complete object. This is validated against
966 /// the combined checksums of the component objects.
967 pub object_checksums: std::option::Option<crate::model::ObjectChecksums>,
968
969 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
970}
971
972impl ComposeObjectRequest {
973 pub fn new() -> Self {
974 std::default::Default::default()
975 }
976
977 /// Sets the value of [destination][crate::model::ComposeObjectRequest::destination].
978 ///
979 /// # Example
980 /// ```ignore,no_run
981 /// # use google_cloud_storage::model::ComposeObjectRequest;
982 /// use google_cloud_storage::model::Object;
983 /// let x = ComposeObjectRequest::new().set_destination(Object::default()/* use setters */);
984 /// ```
985 pub fn set_destination<T>(mut self, v: T) -> Self
986 where
987 T: std::convert::Into<crate::model::Object>,
988 {
989 self.destination = std::option::Option::Some(v.into());
990 self
991 }
992
993 /// Sets or clears the value of [destination][crate::model::ComposeObjectRequest::destination].
994 ///
995 /// # Example
996 /// ```ignore,no_run
997 /// # use google_cloud_storage::model::ComposeObjectRequest;
998 /// use google_cloud_storage::model::Object;
999 /// let x = ComposeObjectRequest::new().set_or_clear_destination(Some(Object::default()/* use setters */));
1000 /// let x = ComposeObjectRequest::new().set_or_clear_destination(None::<Object>);
1001 /// ```
1002 pub fn set_or_clear_destination<T>(mut self, v: std::option::Option<T>) -> Self
1003 where
1004 T: std::convert::Into<crate::model::Object>,
1005 {
1006 self.destination = v.map(|x| x.into());
1007 self
1008 }
1009
1010 /// Sets the value of [source_objects][crate::model::ComposeObjectRequest::source_objects].
1011 ///
1012 /// # Example
1013 /// ```ignore,no_run
1014 /// # use google_cloud_storage::model::ComposeObjectRequest;
1015 /// use google_cloud_storage::model::compose_object_request::SourceObject;
1016 /// let x = ComposeObjectRequest::new()
1017 /// .set_source_objects([
1018 /// SourceObject::default()/* use setters */,
1019 /// SourceObject::default()/* use (different) setters */,
1020 /// ]);
1021 /// ```
1022 pub fn set_source_objects<T, V>(mut self, v: T) -> Self
1023 where
1024 T: std::iter::IntoIterator<Item = V>,
1025 V: std::convert::Into<crate::model::compose_object_request::SourceObject>,
1026 {
1027 use std::iter::Iterator;
1028 self.source_objects = v.into_iter().map(|i| i.into()).collect();
1029 self
1030 }
1031
1032 /// Sets the value of [destination_predefined_acl][crate::model::ComposeObjectRequest::destination_predefined_acl].
1033 ///
1034 /// # Example
1035 /// ```ignore,no_run
1036 /// # use google_cloud_storage::model::ComposeObjectRequest;
1037 /// let x = ComposeObjectRequest::new().set_destination_predefined_acl("example");
1038 /// ```
1039 pub fn set_destination_predefined_acl<T: std::convert::Into<std::string::String>>(
1040 mut self,
1041 v: T,
1042 ) -> Self {
1043 self.destination_predefined_acl = v.into();
1044 self
1045 }
1046
1047 /// Sets the value of [if_generation_match][crate::model::ComposeObjectRequest::if_generation_match].
1048 ///
1049 /// # Example
1050 /// ```ignore,no_run
1051 /// # use google_cloud_storage::model::ComposeObjectRequest;
1052 /// let x = ComposeObjectRequest::new().set_if_generation_match(42);
1053 /// ```
1054 pub fn set_if_generation_match<T>(mut self, v: T) -> Self
1055 where
1056 T: std::convert::Into<i64>,
1057 {
1058 self.if_generation_match = std::option::Option::Some(v.into());
1059 self
1060 }
1061
1062 /// Sets or clears the value of [if_generation_match][crate::model::ComposeObjectRequest::if_generation_match].
1063 ///
1064 /// # Example
1065 /// ```ignore,no_run
1066 /// # use google_cloud_storage::model::ComposeObjectRequest;
1067 /// let x = ComposeObjectRequest::new().set_or_clear_if_generation_match(Some(42));
1068 /// let x = ComposeObjectRequest::new().set_or_clear_if_generation_match(None::<i32>);
1069 /// ```
1070 pub fn set_or_clear_if_generation_match<T>(mut self, v: std::option::Option<T>) -> Self
1071 where
1072 T: std::convert::Into<i64>,
1073 {
1074 self.if_generation_match = v.map(|x| x.into());
1075 self
1076 }
1077
1078 /// Sets the value of [if_metageneration_match][crate::model::ComposeObjectRequest::if_metageneration_match].
1079 ///
1080 /// # Example
1081 /// ```ignore,no_run
1082 /// # use google_cloud_storage::model::ComposeObjectRequest;
1083 /// let x = ComposeObjectRequest::new().set_if_metageneration_match(42);
1084 /// ```
1085 pub fn set_if_metageneration_match<T>(mut self, v: T) -> Self
1086 where
1087 T: std::convert::Into<i64>,
1088 {
1089 self.if_metageneration_match = std::option::Option::Some(v.into());
1090 self
1091 }
1092
1093 /// Sets or clears the value of [if_metageneration_match][crate::model::ComposeObjectRequest::if_metageneration_match].
1094 ///
1095 /// # Example
1096 /// ```ignore,no_run
1097 /// # use google_cloud_storage::model::ComposeObjectRequest;
1098 /// let x = ComposeObjectRequest::new().set_or_clear_if_metageneration_match(Some(42));
1099 /// let x = ComposeObjectRequest::new().set_or_clear_if_metageneration_match(None::<i32>);
1100 /// ```
1101 pub fn set_or_clear_if_metageneration_match<T>(mut self, v: std::option::Option<T>) -> Self
1102 where
1103 T: std::convert::Into<i64>,
1104 {
1105 self.if_metageneration_match = v.map(|x| x.into());
1106 self
1107 }
1108
1109 /// Sets the value of [kms_key][crate::model::ComposeObjectRequest::kms_key].
1110 ///
1111 /// # Example
1112 /// ```ignore,no_run
1113 /// # use google_cloud_storage::model::ComposeObjectRequest;
1114 /// let x = ComposeObjectRequest::new().set_kms_key("example");
1115 /// ```
1116 pub fn set_kms_key<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1117 self.kms_key = v.into();
1118 self
1119 }
1120
1121 /// Sets the value of [common_object_request_params][crate::model::ComposeObjectRequest::common_object_request_params].
1122 ///
1123 /// # Example
1124 /// ```ignore,no_run
1125 /// # use google_cloud_storage::model::ComposeObjectRequest;
1126 /// use google_cloud_storage::model::CommonObjectRequestParams;
1127 /// let x = ComposeObjectRequest::new().set_common_object_request_params(CommonObjectRequestParams::default()/* use setters */);
1128 /// ```
1129 pub fn set_common_object_request_params<T>(mut self, v: T) -> Self
1130 where
1131 T: std::convert::Into<crate::model::CommonObjectRequestParams>,
1132 {
1133 self.common_object_request_params = std::option::Option::Some(v.into());
1134 self
1135 }
1136
1137 /// Sets or clears the value of [common_object_request_params][crate::model::ComposeObjectRequest::common_object_request_params].
1138 ///
1139 /// # Example
1140 /// ```ignore,no_run
1141 /// # use google_cloud_storage::model::ComposeObjectRequest;
1142 /// use google_cloud_storage::model::CommonObjectRequestParams;
1143 /// let x = ComposeObjectRequest::new().set_or_clear_common_object_request_params(Some(CommonObjectRequestParams::default()/* use setters */));
1144 /// let x = ComposeObjectRequest::new().set_or_clear_common_object_request_params(None::<CommonObjectRequestParams>);
1145 /// ```
1146 pub fn set_or_clear_common_object_request_params<T>(mut self, v: std::option::Option<T>) -> Self
1147 where
1148 T: std::convert::Into<crate::model::CommonObjectRequestParams>,
1149 {
1150 self.common_object_request_params = v.map(|x| x.into());
1151 self
1152 }
1153
1154 /// Sets the value of [object_checksums][crate::model::ComposeObjectRequest::object_checksums].
1155 ///
1156 /// # Example
1157 /// ```ignore,no_run
1158 /// # use google_cloud_storage::model::ComposeObjectRequest;
1159 /// use google_cloud_storage::model::ObjectChecksums;
1160 /// let x = ComposeObjectRequest::new().set_object_checksums(ObjectChecksums::default()/* use setters */);
1161 /// ```
1162 pub fn set_object_checksums<T>(mut self, v: T) -> Self
1163 where
1164 T: std::convert::Into<crate::model::ObjectChecksums>,
1165 {
1166 self.object_checksums = std::option::Option::Some(v.into());
1167 self
1168 }
1169
1170 /// Sets or clears the value of [object_checksums][crate::model::ComposeObjectRequest::object_checksums].
1171 ///
1172 /// # Example
1173 /// ```ignore,no_run
1174 /// # use google_cloud_storage::model::ComposeObjectRequest;
1175 /// use google_cloud_storage::model::ObjectChecksums;
1176 /// let x = ComposeObjectRequest::new().set_or_clear_object_checksums(Some(ObjectChecksums::default()/* use setters */));
1177 /// let x = ComposeObjectRequest::new().set_or_clear_object_checksums(None::<ObjectChecksums>);
1178 /// ```
1179 pub fn set_or_clear_object_checksums<T>(mut self, v: std::option::Option<T>) -> Self
1180 where
1181 T: std::convert::Into<crate::model::ObjectChecksums>,
1182 {
1183 self.object_checksums = v.map(|x| x.into());
1184 self
1185 }
1186}
1187
1188impl wkt::message::Message for ComposeObjectRequest {
1189 fn typename() -> &'static str {
1190 "type.googleapis.com/google.storage.v2.ComposeObjectRequest"
1191 }
1192}
1193
1194/// Defines additional types related to [ComposeObjectRequest].
1195pub mod compose_object_request {
1196 #[allow(unused_imports)]
1197 use super::*;
1198
1199 /// Description of a source object for a composition request.
1200 #[derive(Clone, Default, PartialEq)]
1201 #[non_exhaustive]
1202 pub struct SourceObject {
1203 /// Required. The source object's name. All source objects must reside in the
1204 /// same bucket.
1205 pub name: std::string::String,
1206
1207 /// Optional. The generation of this object to use as the source.
1208 pub generation: i64,
1209
1210 /// Optional. Conditions that must be met for this operation to execute.
1211 pub object_preconditions: std::option::Option<
1212 crate::model::compose_object_request::source_object::ObjectPreconditions,
1213 >,
1214
1215 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1216 }
1217
1218 impl SourceObject {
1219 pub fn new() -> Self {
1220 std::default::Default::default()
1221 }
1222
1223 /// Sets the value of [name][crate::model::compose_object_request::SourceObject::name].
1224 ///
1225 /// # Example
1226 /// ```ignore,no_run
1227 /// # use google_cloud_storage::model::compose_object_request::SourceObject;
1228 /// let x = SourceObject::new().set_name("example");
1229 /// ```
1230 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1231 self.name = v.into();
1232 self
1233 }
1234
1235 /// Sets the value of [generation][crate::model::compose_object_request::SourceObject::generation].
1236 ///
1237 /// # Example
1238 /// ```ignore,no_run
1239 /// # use google_cloud_storage::model::compose_object_request::SourceObject;
1240 /// let x = SourceObject::new().set_generation(42);
1241 /// ```
1242 pub fn set_generation<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
1243 self.generation = v.into();
1244 self
1245 }
1246
1247 /// Sets the value of [object_preconditions][crate::model::compose_object_request::SourceObject::object_preconditions].
1248 ///
1249 /// # Example
1250 /// ```ignore,no_run
1251 /// # use google_cloud_storage::model::compose_object_request::SourceObject;
1252 /// use google_cloud_storage::model::compose_object_request::source_object::ObjectPreconditions;
1253 /// let x = SourceObject::new().set_object_preconditions(ObjectPreconditions::default()/* use setters */);
1254 /// ```
1255 pub fn set_object_preconditions<T>(mut self, v: T) -> Self
1256 where
1257 T: std::convert::Into<
1258 crate::model::compose_object_request::source_object::ObjectPreconditions,
1259 >,
1260 {
1261 self.object_preconditions = std::option::Option::Some(v.into());
1262 self
1263 }
1264
1265 /// Sets or clears the value of [object_preconditions][crate::model::compose_object_request::SourceObject::object_preconditions].
1266 ///
1267 /// # Example
1268 /// ```ignore,no_run
1269 /// # use google_cloud_storage::model::compose_object_request::SourceObject;
1270 /// use google_cloud_storage::model::compose_object_request::source_object::ObjectPreconditions;
1271 /// let x = SourceObject::new().set_or_clear_object_preconditions(Some(ObjectPreconditions::default()/* use setters */));
1272 /// let x = SourceObject::new().set_or_clear_object_preconditions(None::<ObjectPreconditions>);
1273 /// ```
1274 pub fn set_or_clear_object_preconditions<T>(mut self, v: std::option::Option<T>) -> Self
1275 where
1276 T: std::convert::Into<
1277 crate::model::compose_object_request::source_object::ObjectPreconditions,
1278 >,
1279 {
1280 self.object_preconditions = v.map(|x| x.into());
1281 self
1282 }
1283 }
1284
1285 impl wkt::message::Message for SourceObject {
1286 fn typename() -> &'static str {
1287 "type.googleapis.com/google.storage.v2.ComposeObjectRequest.SourceObject"
1288 }
1289 }
1290
1291 /// Defines additional types related to [SourceObject].
1292 pub mod source_object {
1293 #[allow(unused_imports)]
1294 use super::*;
1295
1296 /// Preconditions for a source object of a composition request.
1297 #[derive(Clone, Default, PartialEq)]
1298 #[non_exhaustive]
1299 pub struct ObjectPreconditions {
1300 /// Only perform the composition if the generation of the source object
1301 /// that would be used matches this value. If this value and a generation
1302 /// are both specified, they must be the same value or the call fails.
1303 pub if_generation_match: std::option::Option<i64>,
1304
1305 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1306 }
1307
1308 impl ObjectPreconditions {
1309 pub fn new() -> Self {
1310 std::default::Default::default()
1311 }
1312
1313 /// Sets the value of [if_generation_match][crate::model::compose_object_request::source_object::ObjectPreconditions::if_generation_match].
1314 ///
1315 /// # Example
1316 /// ```ignore,no_run
1317 /// # use google_cloud_storage::model::compose_object_request::source_object::ObjectPreconditions;
1318 /// let x = ObjectPreconditions::new().set_if_generation_match(42);
1319 /// ```
1320 pub fn set_if_generation_match<T>(mut self, v: T) -> Self
1321 where
1322 T: std::convert::Into<i64>,
1323 {
1324 self.if_generation_match = std::option::Option::Some(v.into());
1325 self
1326 }
1327
1328 /// Sets or clears the value of [if_generation_match][crate::model::compose_object_request::source_object::ObjectPreconditions::if_generation_match].
1329 ///
1330 /// # Example
1331 /// ```ignore,no_run
1332 /// # use google_cloud_storage::model::compose_object_request::source_object::ObjectPreconditions;
1333 /// let x = ObjectPreconditions::new().set_or_clear_if_generation_match(Some(42));
1334 /// let x = ObjectPreconditions::new().set_or_clear_if_generation_match(None::<i32>);
1335 /// ```
1336 pub fn set_or_clear_if_generation_match<T>(mut self, v: std::option::Option<T>) -> Self
1337 where
1338 T: std::convert::Into<i64>,
1339 {
1340 self.if_generation_match = v.map(|x| x.into());
1341 self
1342 }
1343 }
1344
1345 impl wkt::message::Message for ObjectPreconditions {
1346 fn typename() -> &'static str {
1347 "type.googleapis.com/google.storage.v2.ComposeObjectRequest.SourceObject.ObjectPreconditions"
1348 }
1349 }
1350 }
1351}
1352
1353/// Request message for deleting an object.
1354#[derive(Clone, Default, PartialEq)]
1355#[non_exhaustive]
1356pub struct DeleteObjectRequest {
1357 /// Required. Name of the bucket in which the object resides.
1358 pub bucket: std::string::String,
1359
1360 /// Required. The name of the finalized object to delete.
1361 /// Note: If you want to delete an unfinalized resumable upload please use
1362 /// `CancelResumableWrite`.
1363 pub object: std::string::String,
1364
1365 /// Optional. If present, permanently deletes a specific revision of this
1366 /// object (as opposed to the latest version, the default).
1367 pub generation: i64,
1368
1369 /// Makes the operation conditional on whether the object's current generation
1370 /// matches the given value. Setting to 0 makes the operation succeed only if
1371 /// there are no live versions of the object.
1372 pub if_generation_match: std::option::Option<i64>,
1373
1374 /// Makes the operation conditional on whether the object's live generation
1375 /// does not match the given value. If no live object exists, the precondition
1376 /// fails. Setting to 0 makes the operation succeed only if there is a live
1377 /// version of the object.
1378 pub if_generation_not_match: std::option::Option<i64>,
1379
1380 /// Makes the operation conditional on whether the object's current
1381 /// metageneration matches the given value.
1382 pub if_metageneration_match: std::option::Option<i64>,
1383
1384 /// Makes the operation conditional on whether the object's current
1385 /// metageneration does not match the given value.
1386 pub if_metageneration_not_match: std::option::Option<i64>,
1387
1388 /// Optional. A set of parameters common to Storage API requests concerning an
1389 /// object.
1390 pub common_object_request_params: std::option::Option<crate::model::CommonObjectRequestParams>,
1391
1392 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1393}
1394
1395impl DeleteObjectRequest {
1396 pub fn new() -> Self {
1397 std::default::Default::default()
1398 }
1399
1400 /// Sets the value of [bucket][crate::model::DeleteObjectRequest::bucket].
1401 ///
1402 /// # Example
1403 /// ```ignore,no_run
1404 /// # use google_cloud_storage::model::DeleteObjectRequest;
1405 /// let x = DeleteObjectRequest::new().set_bucket("example");
1406 /// ```
1407 pub fn set_bucket<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1408 self.bucket = v.into();
1409 self
1410 }
1411
1412 /// Sets the value of [object][crate::model::DeleteObjectRequest::object].
1413 ///
1414 /// # Example
1415 /// ```ignore,no_run
1416 /// # use google_cloud_storage::model::DeleteObjectRequest;
1417 /// let x = DeleteObjectRequest::new().set_object("example");
1418 /// ```
1419 pub fn set_object<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1420 self.object = v.into();
1421 self
1422 }
1423
1424 /// Sets the value of [generation][crate::model::DeleteObjectRequest::generation].
1425 ///
1426 /// # Example
1427 /// ```ignore,no_run
1428 /// # use google_cloud_storage::model::DeleteObjectRequest;
1429 /// let x = DeleteObjectRequest::new().set_generation(42);
1430 /// ```
1431 pub fn set_generation<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
1432 self.generation = v.into();
1433 self
1434 }
1435
1436 /// Sets the value of [if_generation_match][crate::model::DeleteObjectRequest::if_generation_match].
1437 ///
1438 /// # Example
1439 /// ```ignore,no_run
1440 /// # use google_cloud_storage::model::DeleteObjectRequest;
1441 /// let x = DeleteObjectRequest::new().set_if_generation_match(42);
1442 /// ```
1443 pub fn set_if_generation_match<T>(mut self, v: T) -> Self
1444 where
1445 T: std::convert::Into<i64>,
1446 {
1447 self.if_generation_match = std::option::Option::Some(v.into());
1448 self
1449 }
1450
1451 /// Sets or clears the value of [if_generation_match][crate::model::DeleteObjectRequest::if_generation_match].
1452 ///
1453 /// # Example
1454 /// ```ignore,no_run
1455 /// # use google_cloud_storage::model::DeleteObjectRequest;
1456 /// let x = DeleteObjectRequest::new().set_or_clear_if_generation_match(Some(42));
1457 /// let x = DeleteObjectRequest::new().set_or_clear_if_generation_match(None::<i32>);
1458 /// ```
1459 pub fn set_or_clear_if_generation_match<T>(mut self, v: std::option::Option<T>) -> Self
1460 where
1461 T: std::convert::Into<i64>,
1462 {
1463 self.if_generation_match = v.map(|x| x.into());
1464 self
1465 }
1466
1467 /// Sets the value of [if_generation_not_match][crate::model::DeleteObjectRequest::if_generation_not_match].
1468 ///
1469 /// # Example
1470 /// ```ignore,no_run
1471 /// # use google_cloud_storage::model::DeleteObjectRequest;
1472 /// let x = DeleteObjectRequest::new().set_if_generation_not_match(42);
1473 /// ```
1474 pub fn set_if_generation_not_match<T>(mut self, v: T) -> Self
1475 where
1476 T: std::convert::Into<i64>,
1477 {
1478 self.if_generation_not_match = std::option::Option::Some(v.into());
1479 self
1480 }
1481
1482 /// Sets or clears the value of [if_generation_not_match][crate::model::DeleteObjectRequest::if_generation_not_match].
1483 ///
1484 /// # Example
1485 /// ```ignore,no_run
1486 /// # use google_cloud_storage::model::DeleteObjectRequest;
1487 /// let x = DeleteObjectRequest::new().set_or_clear_if_generation_not_match(Some(42));
1488 /// let x = DeleteObjectRequest::new().set_or_clear_if_generation_not_match(None::<i32>);
1489 /// ```
1490 pub fn set_or_clear_if_generation_not_match<T>(mut self, v: std::option::Option<T>) -> Self
1491 where
1492 T: std::convert::Into<i64>,
1493 {
1494 self.if_generation_not_match = v.map(|x| x.into());
1495 self
1496 }
1497
1498 /// Sets the value of [if_metageneration_match][crate::model::DeleteObjectRequest::if_metageneration_match].
1499 ///
1500 /// # Example
1501 /// ```ignore,no_run
1502 /// # use google_cloud_storage::model::DeleteObjectRequest;
1503 /// let x = DeleteObjectRequest::new().set_if_metageneration_match(42);
1504 /// ```
1505 pub fn set_if_metageneration_match<T>(mut self, v: T) -> Self
1506 where
1507 T: std::convert::Into<i64>,
1508 {
1509 self.if_metageneration_match = std::option::Option::Some(v.into());
1510 self
1511 }
1512
1513 /// Sets or clears the value of [if_metageneration_match][crate::model::DeleteObjectRequest::if_metageneration_match].
1514 ///
1515 /// # Example
1516 /// ```ignore,no_run
1517 /// # use google_cloud_storage::model::DeleteObjectRequest;
1518 /// let x = DeleteObjectRequest::new().set_or_clear_if_metageneration_match(Some(42));
1519 /// let x = DeleteObjectRequest::new().set_or_clear_if_metageneration_match(None::<i32>);
1520 /// ```
1521 pub fn set_or_clear_if_metageneration_match<T>(mut self, v: std::option::Option<T>) -> Self
1522 where
1523 T: std::convert::Into<i64>,
1524 {
1525 self.if_metageneration_match = v.map(|x| x.into());
1526 self
1527 }
1528
1529 /// Sets the value of [if_metageneration_not_match][crate::model::DeleteObjectRequest::if_metageneration_not_match].
1530 ///
1531 /// # Example
1532 /// ```ignore,no_run
1533 /// # use google_cloud_storage::model::DeleteObjectRequest;
1534 /// let x = DeleteObjectRequest::new().set_if_metageneration_not_match(42);
1535 /// ```
1536 pub fn set_if_metageneration_not_match<T>(mut self, v: T) -> Self
1537 where
1538 T: std::convert::Into<i64>,
1539 {
1540 self.if_metageneration_not_match = std::option::Option::Some(v.into());
1541 self
1542 }
1543
1544 /// Sets or clears the value of [if_metageneration_not_match][crate::model::DeleteObjectRequest::if_metageneration_not_match].
1545 ///
1546 /// # Example
1547 /// ```ignore,no_run
1548 /// # use google_cloud_storage::model::DeleteObjectRequest;
1549 /// let x = DeleteObjectRequest::new().set_or_clear_if_metageneration_not_match(Some(42));
1550 /// let x = DeleteObjectRequest::new().set_or_clear_if_metageneration_not_match(None::<i32>);
1551 /// ```
1552 pub fn set_or_clear_if_metageneration_not_match<T>(mut self, v: std::option::Option<T>) -> Self
1553 where
1554 T: std::convert::Into<i64>,
1555 {
1556 self.if_metageneration_not_match = v.map(|x| x.into());
1557 self
1558 }
1559
1560 /// Sets the value of [common_object_request_params][crate::model::DeleteObjectRequest::common_object_request_params].
1561 ///
1562 /// # Example
1563 /// ```ignore,no_run
1564 /// # use google_cloud_storage::model::DeleteObjectRequest;
1565 /// use google_cloud_storage::model::CommonObjectRequestParams;
1566 /// let x = DeleteObjectRequest::new().set_common_object_request_params(CommonObjectRequestParams::default()/* use setters */);
1567 /// ```
1568 pub fn set_common_object_request_params<T>(mut self, v: T) -> Self
1569 where
1570 T: std::convert::Into<crate::model::CommonObjectRequestParams>,
1571 {
1572 self.common_object_request_params = std::option::Option::Some(v.into());
1573 self
1574 }
1575
1576 /// Sets or clears the value of [common_object_request_params][crate::model::DeleteObjectRequest::common_object_request_params].
1577 ///
1578 /// # Example
1579 /// ```ignore,no_run
1580 /// # use google_cloud_storage::model::DeleteObjectRequest;
1581 /// use google_cloud_storage::model::CommonObjectRequestParams;
1582 /// let x = DeleteObjectRequest::new().set_or_clear_common_object_request_params(Some(CommonObjectRequestParams::default()/* use setters */));
1583 /// let x = DeleteObjectRequest::new().set_or_clear_common_object_request_params(None::<CommonObjectRequestParams>);
1584 /// ```
1585 pub fn set_or_clear_common_object_request_params<T>(mut self, v: std::option::Option<T>) -> Self
1586 where
1587 T: std::convert::Into<crate::model::CommonObjectRequestParams>,
1588 {
1589 self.common_object_request_params = v.map(|x| x.into());
1590 self
1591 }
1592}
1593
1594impl wkt::message::Message for DeleteObjectRequest {
1595 fn typename() -> &'static str {
1596 "type.googleapis.com/google.storage.v2.DeleteObjectRequest"
1597 }
1598}
1599
1600/// Request message for
1601/// [RestoreObject][google.storage.v2.Storage.RestoreObject].
1602/// `bucket`, `object`, and `generation` **must** be set.
1603///
1604/// [google.storage.v2.Storage.RestoreObject]: crate::client::StorageControl::restore_object
1605#[derive(Clone, Default, PartialEq)]
1606#[non_exhaustive]
1607pub struct RestoreObjectRequest {
1608 /// Required. Name of the bucket in which the object resides.
1609 pub bucket: std::string::String,
1610
1611 /// Required. The name of the object to restore.
1612 pub object: std::string::String,
1613
1614 /// Required. The specific revision of the object to restore.
1615 pub generation: i64,
1616
1617 /// Optional. Restore token used to differentiate soft-deleted objects with the
1618 /// same name and generation. Only applicable for hierarchical namespace
1619 /// buckets. This parameter is optional, and is only required in the rare case
1620 /// when there are multiple soft-deleted objects with the same name and
1621 /// generation.
1622 pub restore_token: std::string::String,
1623
1624 /// Makes the operation conditional on whether the object's current generation
1625 /// matches the given value. Setting to 0 makes the operation succeed only if
1626 /// there are no live versions of the object.
1627 pub if_generation_match: std::option::Option<i64>,
1628
1629 /// Makes the operation conditional on whether the object's live generation
1630 /// does not match the given value. If no live object exists, the precondition
1631 /// fails. Setting to 0 makes the operation succeed only if there is a live
1632 /// version of the object.
1633 pub if_generation_not_match: std::option::Option<i64>,
1634
1635 /// Makes the operation conditional on whether the object's current
1636 /// metageneration matches the given value.
1637 pub if_metageneration_match: std::option::Option<i64>,
1638
1639 /// Makes the operation conditional on whether the object's current
1640 /// metageneration does not match the given value.
1641 pub if_metageneration_not_match: std::option::Option<i64>,
1642
1643 /// If false or unset, the bucket's default object ACL is used.
1644 /// If true, copy the source object's access controls.
1645 /// Return an error if bucket has UBLA enabled.
1646 pub copy_source_acl: std::option::Option<bool>,
1647
1648 /// Optional. A set of parameters common to Storage API requests concerning an
1649 /// object.
1650 pub common_object_request_params: std::option::Option<crate::model::CommonObjectRequestParams>,
1651
1652 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1653}
1654
1655impl RestoreObjectRequest {
1656 pub fn new() -> Self {
1657 std::default::Default::default()
1658 }
1659
1660 /// Sets the value of [bucket][crate::model::RestoreObjectRequest::bucket].
1661 ///
1662 /// # Example
1663 /// ```ignore,no_run
1664 /// # use google_cloud_storage::model::RestoreObjectRequest;
1665 /// let x = RestoreObjectRequest::new().set_bucket("example");
1666 /// ```
1667 pub fn set_bucket<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1668 self.bucket = v.into();
1669 self
1670 }
1671
1672 /// Sets the value of [object][crate::model::RestoreObjectRequest::object].
1673 ///
1674 /// # Example
1675 /// ```ignore,no_run
1676 /// # use google_cloud_storage::model::RestoreObjectRequest;
1677 /// let x = RestoreObjectRequest::new().set_object("example");
1678 /// ```
1679 pub fn set_object<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1680 self.object = v.into();
1681 self
1682 }
1683
1684 /// Sets the value of [generation][crate::model::RestoreObjectRequest::generation].
1685 ///
1686 /// # Example
1687 /// ```ignore,no_run
1688 /// # use google_cloud_storage::model::RestoreObjectRequest;
1689 /// let x = RestoreObjectRequest::new().set_generation(42);
1690 /// ```
1691 pub fn set_generation<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
1692 self.generation = v.into();
1693 self
1694 }
1695
1696 /// Sets the value of [restore_token][crate::model::RestoreObjectRequest::restore_token].
1697 ///
1698 /// # Example
1699 /// ```ignore,no_run
1700 /// # use google_cloud_storage::model::RestoreObjectRequest;
1701 /// let x = RestoreObjectRequest::new().set_restore_token("example");
1702 /// ```
1703 pub fn set_restore_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1704 self.restore_token = v.into();
1705 self
1706 }
1707
1708 /// Sets the value of [if_generation_match][crate::model::RestoreObjectRequest::if_generation_match].
1709 ///
1710 /// # Example
1711 /// ```ignore,no_run
1712 /// # use google_cloud_storage::model::RestoreObjectRequest;
1713 /// let x = RestoreObjectRequest::new().set_if_generation_match(42);
1714 /// ```
1715 pub fn set_if_generation_match<T>(mut self, v: T) -> Self
1716 where
1717 T: std::convert::Into<i64>,
1718 {
1719 self.if_generation_match = std::option::Option::Some(v.into());
1720 self
1721 }
1722
1723 /// Sets or clears the value of [if_generation_match][crate::model::RestoreObjectRequest::if_generation_match].
1724 ///
1725 /// # Example
1726 /// ```ignore,no_run
1727 /// # use google_cloud_storage::model::RestoreObjectRequest;
1728 /// let x = RestoreObjectRequest::new().set_or_clear_if_generation_match(Some(42));
1729 /// let x = RestoreObjectRequest::new().set_or_clear_if_generation_match(None::<i32>);
1730 /// ```
1731 pub fn set_or_clear_if_generation_match<T>(mut self, v: std::option::Option<T>) -> Self
1732 where
1733 T: std::convert::Into<i64>,
1734 {
1735 self.if_generation_match = v.map(|x| x.into());
1736 self
1737 }
1738
1739 /// Sets the value of [if_generation_not_match][crate::model::RestoreObjectRequest::if_generation_not_match].
1740 ///
1741 /// # Example
1742 /// ```ignore,no_run
1743 /// # use google_cloud_storage::model::RestoreObjectRequest;
1744 /// let x = RestoreObjectRequest::new().set_if_generation_not_match(42);
1745 /// ```
1746 pub fn set_if_generation_not_match<T>(mut self, v: T) -> Self
1747 where
1748 T: std::convert::Into<i64>,
1749 {
1750 self.if_generation_not_match = std::option::Option::Some(v.into());
1751 self
1752 }
1753
1754 /// Sets or clears the value of [if_generation_not_match][crate::model::RestoreObjectRequest::if_generation_not_match].
1755 ///
1756 /// # Example
1757 /// ```ignore,no_run
1758 /// # use google_cloud_storage::model::RestoreObjectRequest;
1759 /// let x = RestoreObjectRequest::new().set_or_clear_if_generation_not_match(Some(42));
1760 /// let x = RestoreObjectRequest::new().set_or_clear_if_generation_not_match(None::<i32>);
1761 /// ```
1762 pub fn set_or_clear_if_generation_not_match<T>(mut self, v: std::option::Option<T>) -> Self
1763 where
1764 T: std::convert::Into<i64>,
1765 {
1766 self.if_generation_not_match = v.map(|x| x.into());
1767 self
1768 }
1769
1770 /// Sets the value of [if_metageneration_match][crate::model::RestoreObjectRequest::if_metageneration_match].
1771 ///
1772 /// # Example
1773 /// ```ignore,no_run
1774 /// # use google_cloud_storage::model::RestoreObjectRequest;
1775 /// let x = RestoreObjectRequest::new().set_if_metageneration_match(42);
1776 /// ```
1777 pub fn set_if_metageneration_match<T>(mut self, v: T) -> Self
1778 where
1779 T: std::convert::Into<i64>,
1780 {
1781 self.if_metageneration_match = std::option::Option::Some(v.into());
1782 self
1783 }
1784
1785 /// Sets or clears the value of [if_metageneration_match][crate::model::RestoreObjectRequest::if_metageneration_match].
1786 ///
1787 /// # Example
1788 /// ```ignore,no_run
1789 /// # use google_cloud_storage::model::RestoreObjectRequest;
1790 /// let x = RestoreObjectRequest::new().set_or_clear_if_metageneration_match(Some(42));
1791 /// let x = RestoreObjectRequest::new().set_or_clear_if_metageneration_match(None::<i32>);
1792 /// ```
1793 pub fn set_or_clear_if_metageneration_match<T>(mut self, v: std::option::Option<T>) -> Self
1794 where
1795 T: std::convert::Into<i64>,
1796 {
1797 self.if_metageneration_match = v.map(|x| x.into());
1798 self
1799 }
1800
1801 /// Sets the value of [if_metageneration_not_match][crate::model::RestoreObjectRequest::if_metageneration_not_match].
1802 ///
1803 /// # Example
1804 /// ```ignore,no_run
1805 /// # use google_cloud_storage::model::RestoreObjectRequest;
1806 /// let x = RestoreObjectRequest::new().set_if_metageneration_not_match(42);
1807 /// ```
1808 pub fn set_if_metageneration_not_match<T>(mut self, v: T) -> Self
1809 where
1810 T: std::convert::Into<i64>,
1811 {
1812 self.if_metageneration_not_match = std::option::Option::Some(v.into());
1813 self
1814 }
1815
1816 /// Sets or clears the value of [if_metageneration_not_match][crate::model::RestoreObjectRequest::if_metageneration_not_match].
1817 ///
1818 /// # Example
1819 /// ```ignore,no_run
1820 /// # use google_cloud_storage::model::RestoreObjectRequest;
1821 /// let x = RestoreObjectRequest::new().set_or_clear_if_metageneration_not_match(Some(42));
1822 /// let x = RestoreObjectRequest::new().set_or_clear_if_metageneration_not_match(None::<i32>);
1823 /// ```
1824 pub fn set_or_clear_if_metageneration_not_match<T>(mut self, v: std::option::Option<T>) -> Self
1825 where
1826 T: std::convert::Into<i64>,
1827 {
1828 self.if_metageneration_not_match = v.map(|x| x.into());
1829 self
1830 }
1831
1832 /// Sets the value of [copy_source_acl][crate::model::RestoreObjectRequest::copy_source_acl].
1833 ///
1834 /// # Example
1835 /// ```ignore,no_run
1836 /// # use google_cloud_storage::model::RestoreObjectRequest;
1837 /// let x = RestoreObjectRequest::new().set_copy_source_acl(true);
1838 /// ```
1839 pub fn set_copy_source_acl<T>(mut self, v: T) -> Self
1840 where
1841 T: std::convert::Into<bool>,
1842 {
1843 self.copy_source_acl = std::option::Option::Some(v.into());
1844 self
1845 }
1846
1847 /// Sets or clears the value of [copy_source_acl][crate::model::RestoreObjectRequest::copy_source_acl].
1848 ///
1849 /// # Example
1850 /// ```ignore,no_run
1851 /// # use google_cloud_storage::model::RestoreObjectRequest;
1852 /// let x = RestoreObjectRequest::new().set_or_clear_copy_source_acl(Some(false));
1853 /// let x = RestoreObjectRequest::new().set_or_clear_copy_source_acl(None::<bool>);
1854 /// ```
1855 pub fn set_or_clear_copy_source_acl<T>(mut self, v: std::option::Option<T>) -> Self
1856 where
1857 T: std::convert::Into<bool>,
1858 {
1859 self.copy_source_acl = v.map(|x| x.into());
1860 self
1861 }
1862
1863 /// Sets the value of [common_object_request_params][crate::model::RestoreObjectRequest::common_object_request_params].
1864 ///
1865 /// # Example
1866 /// ```ignore,no_run
1867 /// # use google_cloud_storage::model::RestoreObjectRequest;
1868 /// use google_cloud_storage::model::CommonObjectRequestParams;
1869 /// let x = RestoreObjectRequest::new().set_common_object_request_params(CommonObjectRequestParams::default()/* use setters */);
1870 /// ```
1871 pub fn set_common_object_request_params<T>(mut self, v: T) -> Self
1872 where
1873 T: std::convert::Into<crate::model::CommonObjectRequestParams>,
1874 {
1875 self.common_object_request_params = std::option::Option::Some(v.into());
1876 self
1877 }
1878
1879 /// Sets or clears the value of [common_object_request_params][crate::model::RestoreObjectRequest::common_object_request_params].
1880 ///
1881 /// # Example
1882 /// ```ignore,no_run
1883 /// # use google_cloud_storage::model::RestoreObjectRequest;
1884 /// use google_cloud_storage::model::CommonObjectRequestParams;
1885 /// let x = RestoreObjectRequest::new().set_or_clear_common_object_request_params(Some(CommonObjectRequestParams::default()/* use setters */));
1886 /// let x = RestoreObjectRequest::new().set_or_clear_common_object_request_params(None::<CommonObjectRequestParams>);
1887 /// ```
1888 pub fn set_or_clear_common_object_request_params<T>(mut self, v: std::option::Option<T>) -> Self
1889 where
1890 T: std::convert::Into<crate::model::CommonObjectRequestParams>,
1891 {
1892 self.common_object_request_params = v.map(|x| x.into());
1893 self
1894 }
1895}
1896
1897impl wkt::message::Message for RestoreObjectRequest {
1898 fn typename() -> &'static str {
1899 "type.googleapis.com/google.storage.v2.RestoreObjectRequest"
1900 }
1901}
1902
1903/// Request message for [ReadObject][google.storage.v2.Storage.ReadObject].
1904#[derive(Clone, Default, PartialEq)]
1905#[non_exhaustive]
1906pub struct ReadObjectRequest {
1907 /// Required. The name of the bucket containing the object to read.
1908 pub bucket: std::string::String,
1909
1910 /// Required. The name of the object to read.
1911 pub object: std::string::String,
1912
1913 /// Optional. If present, selects a specific revision of this object (as
1914 /// opposed to the latest version, the default).
1915 pub generation: i64,
1916
1917 /// Optional. The offset for the first byte to return in the read, relative to
1918 /// the start of the object.
1919 ///
1920 /// A negative `read_offset` value is interpreted as the number of bytes
1921 /// back from the end of the object to be returned. For example, if an object's
1922 /// length is `15` bytes, a `ReadObjectRequest` with `read_offset` = `-5` and
1923 /// `read_limit` = `3` would return bytes `10` through `12` of the object.
1924 /// Requesting a negative offset with magnitude larger than the size of the
1925 /// object returns the entire object.
1926 pub read_offset: i64,
1927
1928 /// Optional. The maximum number of `data` bytes the server is allowed to
1929 /// return in the sum of all `Object` messages. A `read_limit` of zero
1930 /// indicates that there is no limit, and a negative `read_limit` causes an
1931 /// error.
1932 ///
1933 /// If the stream returns fewer bytes than allowed by the `read_limit` and no
1934 /// error occurred, the stream includes all data from the `read_offset` to the
1935 /// end of the resource.
1936 pub read_limit: i64,
1937
1938 /// Makes the operation conditional on whether the object's current generation
1939 /// matches the given value. Setting to 0 makes the operation succeed only if
1940 /// there are no live versions of the object.
1941 pub if_generation_match: std::option::Option<i64>,
1942
1943 /// Makes the operation conditional on whether the object's live generation
1944 /// does not match the given value. If no live object exists, the precondition
1945 /// fails. Setting to 0 makes the operation succeed only if there is a live
1946 /// version of the object.
1947 pub if_generation_not_match: std::option::Option<i64>,
1948
1949 /// Makes the operation conditional on whether the object's current
1950 /// metageneration matches the given value.
1951 pub if_metageneration_match: std::option::Option<i64>,
1952
1953 /// Makes the operation conditional on whether the object's current
1954 /// metageneration does not match the given value.
1955 pub if_metageneration_not_match: std::option::Option<i64>,
1956
1957 /// Optional. A set of parameters common to Storage API requests concerning an
1958 /// object.
1959 pub common_object_request_params: std::option::Option<crate::model::CommonObjectRequestParams>,
1960
1961 /// Mask specifying which fields to read.
1962 /// The `checksummed_data` field and its children are always present.
1963 /// If no mask is specified, it defaults to all fields except `metadata.
1964 /// owner` and `metadata.acl`.
1965 /// `*` might be used to mean "all fields".
1966 pub read_mask: std::option::Option<wkt::FieldMask>,
1967
1968 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1969}
1970
1971impl ReadObjectRequest {
1972 pub fn new() -> Self {
1973 std::default::Default::default()
1974 }
1975
1976 /// Sets the value of [bucket][crate::model::ReadObjectRequest::bucket].
1977 ///
1978 /// # Example
1979 /// ```ignore,no_run
1980 /// # use google_cloud_storage::model::ReadObjectRequest;
1981 /// let x = ReadObjectRequest::new().set_bucket("example");
1982 /// ```
1983 pub fn set_bucket<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1984 self.bucket = v.into();
1985 self
1986 }
1987
1988 /// Sets the value of [object][crate::model::ReadObjectRequest::object].
1989 ///
1990 /// # Example
1991 /// ```ignore,no_run
1992 /// # use google_cloud_storage::model::ReadObjectRequest;
1993 /// let x = ReadObjectRequest::new().set_object("example");
1994 /// ```
1995 pub fn set_object<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1996 self.object = v.into();
1997 self
1998 }
1999
2000 /// Sets the value of [generation][crate::model::ReadObjectRequest::generation].
2001 ///
2002 /// # Example
2003 /// ```ignore,no_run
2004 /// # use google_cloud_storage::model::ReadObjectRequest;
2005 /// let x = ReadObjectRequest::new().set_generation(42);
2006 /// ```
2007 pub fn set_generation<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
2008 self.generation = v.into();
2009 self
2010 }
2011
2012 /// Sets the value of [read_offset][crate::model::ReadObjectRequest::read_offset].
2013 ///
2014 /// # Example
2015 /// ```ignore,no_run
2016 /// # use google_cloud_storage::model::ReadObjectRequest;
2017 /// let x = ReadObjectRequest::new().set_read_offset(42);
2018 /// ```
2019 pub fn set_read_offset<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
2020 self.read_offset = v.into();
2021 self
2022 }
2023
2024 /// Sets the value of [read_limit][crate::model::ReadObjectRequest::read_limit].
2025 ///
2026 /// # Example
2027 /// ```ignore,no_run
2028 /// # use google_cloud_storage::model::ReadObjectRequest;
2029 /// let x = ReadObjectRequest::new().set_read_limit(42);
2030 /// ```
2031 pub fn set_read_limit<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
2032 self.read_limit = v.into();
2033 self
2034 }
2035
2036 /// Sets the value of [if_generation_match][crate::model::ReadObjectRequest::if_generation_match].
2037 ///
2038 /// # Example
2039 /// ```ignore,no_run
2040 /// # use google_cloud_storage::model::ReadObjectRequest;
2041 /// let x = ReadObjectRequest::new().set_if_generation_match(42);
2042 /// ```
2043 pub fn set_if_generation_match<T>(mut self, v: T) -> Self
2044 where
2045 T: std::convert::Into<i64>,
2046 {
2047 self.if_generation_match = std::option::Option::Some(v.into());
2048 self
2049 }
2050
2051 /// Sets or clears the value of [if_generation_match][crate::model::ReadObjectRequest::if_generation_match].
2052 ///
2053 /// # Example
2054 /// ```ignore,no_run
2055 /// # use google_cloud_storage::model::ReadObjectRequest;
2056 /// let x = ReadObjectRequest::new().set_or_clear_if_generation_match(Some(42));
2057 /// let x = ReadObjectRequest::new().set_or_clear_if_generation_match(None::<i32>);
2058 /// ```
2059 pub fn set_or_clear_if_generation_match<T>(mut self, v: std::option::Option<T>) -> Self
2060 where
2061 T: std::convert::Into<i64>,
2062 {
2063 self.if_generation_match = v.map(|x| x.into());
2064 self
2065 }
2066
2067 /// Sets the value of [if_generation_not_match][crate::model::ReadObjectRequest::if_generation_not_match].
2068 ///
2069 /// # Example
2070 /// ```ignore,no_run
2071 /// # use google_cloud_storage::model::ReadObjectRequest;
2072 /// let x = ReadObjectRequest::new().set_if_generation_not_match(42);
2073 /// ```
2074 pub fn set_if_generation_not_match<T>(mut self, v: T) -> Self
2075 where
2076 T: std::convert::Into<i64>,
2077 {
2078 self.if_generation_not_match = std::option::Option::Some(v.into());
2079 self
2080 }
2081
2082 /// Sets or clears the value of [if_generation_not_match][crate::model::ReadObjectRequest::if_generation_not_match].
2083 ///
2084 /// # Example
2085 /// ```ignore,no_run
2086 /// # use google_cloud_storage::model::ReadObjectRequest;
2087 /// let x = ReadObjectRequest::new().set_or_clear_if_generation_not_match(Some(42));
2088 /// let x = ReadObjectRequest::new().set_or_clear_if_generation_not_match(None::<i32>);
2089 /// ```
2090 pub fn set_or_clear_if_generation_not_match<T>(mut self, v: std::option::Option<T>) -> Self
2091 where
2092 T: std::convert::Into<i64>,
2093 {
2094 self.if_generation_not_match = v.map(|x| x.into());
2095 self
2096 }
2097
2098 /// Sets the value of [if_metageneration_match][crate::model::ReadObjectRequest::if_metageneration_match].
2099 ///
2100 /// # Example
2101 /// ```ignore,no_run
2102 /// # use google_cloud_storage::model::ReadObjectRequest;
2103 /// let x = ReadObjectRequest::new().set_if_metageneration_match(42);
2104 /// ```
2105 pub fn set_if_metageneration_match<T>(mut self, v: T) -> Self
2106 where
2107 T: std::convert::Into<i64>,
2108 {
2109 self.if_metageneration_match = std::option::Option::Some(v.into());
2110 self
2111 }
2112
2113 /// Sets or clears the value of [if_metageneration_match][crate::model::ReadObjectRequest::if_metageneration_match].
2114 ///
2115 /// # Example
2116 /// ```ignore,no_run
2117 /// # use google_cloud_storage::model::ReadObjectRequest;
2118 /// let x = ReadObjectRequest::new().set_or_clear_if_metageneration_match(Some(42));
2119 /// let x = ReadObjectRequest::new().set_or_clear_if_metageneration_match(None::<i32>);
2120 /// ```
2121 pub fn set_or_clear_if_metageneration_match<T>(mut self, v: std::option::Option<T>) -> Self
2122 where
2123 T: std::convert::Into<i64>,
2124 {
2125 self.if_metageneration_match = v.map(|x| x.into());
2126 self
2127 }
2128
2129 /// Sets the value of [if_metageneration_not_match][crate::model::ReadObjectRequest::if_metageneration_not_match].
2130 ///
2131 /// # Example
2132 /// ```ignore,no_run
2133 /// # use google_cloud_storage::model::ReadObjectRequest;
2134 /// let x = ReadObjectRequest::new().set_if_metageneration_not_match(42);
2135 /// ```
2136 pub fn set_if_metageneration_not_match<T>(mut self, v: T) -> Self
2137 where
2138 T: std::convert::Into<i64>,
2139 {
2140 self.if_metageneration_not_match = std::option::Option::Some(v.into());
2141 self
2142 }
2143
2144 /// Sets or clears the value of [if_metageneration_not_match][crate::model::ReadObjectRequest::if_metageneration_not_match].
2145 ///
2146 /// # Example
2147 /// ```ignore,no_run
2148 /// # use google_cloud_storage::model::ReadObjectRequest;
2149 /// let x = ReadObjectRequest::new().set_or_clear_if_metageneration_not_match(Some(42));
2150 /// let x = ReadObjectRequest::new().set_or_clear_if_metageneration_not_match(None::<i32>);
2151 /// ```
2152 pub fn set_or_clear_if_metageneration_not_match<T>(mut self, v: std::option::Option<T>) -> Self
2153 where
2154 T: std::convert::Into<i64>,
2155 {
2156 self.if_metageneration_not_match = v.map(|x| x.into());
2157 self
2158 }
2159
2160 /// Sets the value of [common_object_request_params][crate::model::ReadObjectRequest::common_object_request_params].
2161 ///
2162 /// # Example
2163 /// ```ignore,no_run
2164 /// # use google_cloud_storage::model::ReadObjectRequest;
2165 /// use google_cloud_storage::model::CommonObjectRequestParams;
2166 /// let x = ReadObjectRequest::new().set_common_object_request_params(CommonObjectRequestParams::default()/* use setters */);
2167 /// ```
2168 pub fn set_common_object_request_params<T>(mut self, v: T) -> Self
2169 where
2170 T: std::convert::Into<crate::model::CommonObjectRequestParams>,
2171 {
2172 self.common_object_request_params = std::option::Option::Some(v.into());
2173 self
2174 }
2175
2176 /// Sets or clears the value of [common_object_request_params][crate::model::ReadObjectRequest::common_object_request_params].
2177 ///
2178 /// # Example
2179 /// ```ignore,no_run
2180 /// # use google_cloud_storage::model::ReadObjectRequest;
2181 /// use google_cloud_storage::model::CommonObjectRequestParams;
2182 /// let x = ReadObjectRequest::new().set_or_clear_common_object_request_params(Some(CommonObjectRequestParams::default()/* use setters */));
2183 /// let x = ReadObjectRequest::new().set_or_clear_common_object_request_params(None::<CommonObjectRequestParams>);
2184 /// ```
2185 pub fn set_or_clear_common_object_request_params<T>(mut self, v: std::option::Option<T>) -> Self
2186 where
2187 T: std::convert::Into<crate::model::CommonObjectRequestParams>,
2188 {
2189 self.common_object_request_params = v.map(|x| x.into());
2190 self
2191 }
2192
2193 /// Sets the value of [read_mask][crate::model::ReadObjectRequest::read_mask].
2194 ///
2195 /// # Example
2196 /// ```ignore,no_run
2197 /// # use google_cloud_storage::model::ReadObjectRequest;
2198 /// use wkt::FieldMask;
2199 /// let x = ReadObjectRequest::new().set_read_mask(FieldMask::default()/* use setters */);
2200 /// ```
2201 pub fn set_read_mask<T>(mut self, v: T) -> Self
2202 where
2203 T: std::convert::Into<wkt::FieldMask>,
2204 {
2205 self.read_mask = std::option::Option::Some(v.into());
2206 self
2207 }
2208
2209 /// Sets or clears the value of [read_mask][crate::model::ReadObjectRequest::read_mask].
2210 ///
2211 /// # Example
2212 /// ```ignore,no_run
2213 /// # use google_cloud_storage::model::ReadObjectRequest;
2214 /// use wkt::FieldMask;
2215 /// let x = ReadObjectRequest::new().set_or_clear_read_mask(Some(FieldMask::default()/* use setters */));
2216 /// let x = ReadObjectRequest::new().set_or_clear_read_mask(None::<FieldMask>);
2217 /// ```
2218 pub fn set_or_clear_read_mask<T>(mut self, v: std::option::Option<T>) -> Self
2219 where
2220 T: std::convert::Into<wkt::FieldMask>,
2221 {
2222 self.read_mask = v.map(|x| x.into());
2223 self
2224 }
2225}
2226
2227impl wkt::message::Message for ReadObjectRequest {
2228 fn typename() -> &'static str {
2229 "type.googleapis.com/google.storage.v2.ReadObjectRequest"
2230 }
2231}
2232
2233/// Request message for [GetObject][google.storage.v2.Storage.GetObject].
2234///
2235/// [google.storage.v2.Storage.GetObject]: crate::client::StorageControl::get_object
2236#[derive(Clone, Default, PartialEq)]
2237#[non_exhaustive]
2238pub struct GetObjectRequest {
2239 /// Required. Name of the bucket in which the object resides.
2240 pub bucket: std::string::String,
2241
2242 /// Required. Name of the object.
2243 pub object: std::string::String,
2244
2245 /// Optional. If present, selects a specific revision of this object (as
2246 /// opposed to the latest version, the default).
2247 pub generation: i64,
2248
2249 /// If true, return the soft-deleted version of this object.
2250 pub soft_deleted: std::option::Option<bool>,
2251
2252 /// Makes the operation conditional on whether the object's current generation
2253 /// matches the given value. Setting to 0 makes the operation succeed only if
2254 /// there are no live versions of the object.
2255 pub if_generation_match: std::option::Option<i64>,
2256
2257 /// Makes the operation conditional on whether the object's live generation
2258 /// does not match the given value. If no live object exists, the precondition
2259 /// fails. Setting to 0 makes the operation succeed only if there is a live
2260 /// version of the object.
2261 pub if_generation_not_match: std::option::Option<i64>,
2262
2263 /// Makes the operation conditional on whether the object's current
2264 /// metageneration matches the given value.
2265 pub if_metageneration_match: std::option::Option<i64>,
2266
2267 /// Makes the operation conditional on whether the object's current
2268 /// metageneration does not match the given value.
2269 pub if_metageneration_not_match: std::option::Option<i64>,
2270
2271 /// Optional. A set of parameters common to Storage API requests concerning an
2272 /// object.
2273 pub common_object_request_params: std::option::Option<crate::model::CommonObjectRequestParams>,
2274
2275 /// Mask specifying which fields to read.
2276 /// If no mask is specified, it defaults to all fields except `metadata.
2277 /// acl` and `metadata.owner`.
2278 /// `*` might be used to mean "all fields".
2279 pub read_mask: std::option::Option<wkt::FieldMask>,
2280
2281 /// Optional. Restore token used to differentiate soft-deleted objects with the
2282 /// same name and generation. Only applicable for hierarchical namespace
2283 /// buckets and if `soft_deleted` is set to `true`. This parameter is optional,
2284 /// and is only required in the rare case when there are multiple soft-deleted
2285 /// objects with the same `name` and `generation`.
2286 pub restore_token: std::string::String,
2287
2288 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2289}
2290
2291impl GetObjectRequest {
2292 pub fn new() -> Self {
2293 std::default::Default::default()
2294 }
2295
2296 /// Sets the value of [bucket][crate::model::GetObjectRequest::bucket].
2297 ///
2298 /// # Example
2299 /// ```ignore,no_run
2300 /// # use google_cloud_storage::model::GetObjectRequest;
2301 /// let x = GetObjectRequest::new().set_bucket("example");
2302 /// ```
2303 pub fn set_bucket<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2304 self.bucket = v.into();
2305 self
2306 }
2307
2308 /// Sets the value of [object][crate::model::GetObjectRequest::object].
2309 ///
2310 /// # Example
2311 /// ```ignore,no_run
2312 /// # use google_cloud_storage::model::GetObjectRequest;
2313 /// let x = GetObjectRequest::new().set_object("example");
2314 /// ```
2315 pub fn set_object<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2316 self.object = v.into();
2317 self
2318 }
2319
2320 /// Sets the value of [generation][crate::model::GetObjectRequest::generation].
2321 ///
2322 /// # Example
2323 /// ```ignore,no_run
2324 /// # use google_cloud_storage::model::GetObjectRequest;
2325 /// let x = GetObjectRequest::new().set_generation(42);
2326 /// ```
2327 pub fn set_generation<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
2328 self.generation = v.into();
2329 self
2330 }
2331
2332 /// Sets the value of [soft_deleted][crate::model::GetObjectRequest::soft_deleted].
2333 ///
2334 /// # Example
2335 /// ```ignore,no_run
2336 /// # use google_cloud_storage::model::GetObjectRequest;
2337 /// let x = GetObjectRequest::new().set_soft_deleted(true);
2338 /// ```
2339 pub fn set_soft_deleted<T>(mut self, v: T) -> Self
2340 where
2341 T: std::convert::Into<bool>,
2342 {
2343 self.soft_deleted = std::option::Option::Some(v.into());
2344 self
2345 }
2346
2347 /// Sets or clears the value of [soft_deleted][crate::model::GetObjectRequest::soft_deleted].
2348 ///
2349 /// # Example
2350 /// ```ignore,no_run
2351 /// # use google_cloud_storage::model::GetObjectRequest;
2352 /// let x = GetObjectRequest::new().set_or_clear_soft_deleted(Some(false));
2353 /// let x = GetObjectRequest::new().set_or_clear_soft_deleted(None::<bool>);
2354 /// ```
2355 pub fn set_or_clear_soft_deleted<T>(mut self, v: std::option::Option<T>) -> Self
2356 where
2357 T: std::convert::Into<bool>,
2358 {
2359 self.soft_deleted = v.map(|x| x.into());
2360 self
2361 }
2362
2363 /// Sets the value of [if_generation_match][crate::model::GetObjectRequest::if_generation_match].
2364 ///
2365 /// # Example
2366 /// ```ignore,no_run
2367 /// # use google_cloud_storage::model::GetObjectRequest;
2368 /// let x = GetObjectRequest::new().set_if_generation_match(42);
2369 /// ```
2370 pub fn set_if_generation_match<T>(mut self, v: T) -> Self
2371 where
2372 T: std::convert::Into<i64>,
2373 {
2374 self.if_generation_match = std::option::Option::Some(v.into());
2375 self
2376 }
2377
2378 /// Sets or clears the value of [if_generation_match][crate::model::GetObjectRequest::if_generation_match].
2379 ///
2380 /// # Example
2381 /// ```ignore,no_run
2382 /// # use google_cloud_storage::model::GetObjectRequest;
2383 /// let x = GetObjectRequest::new().set_or_clear_if_generation_match(Some(42));
2384 /// let x = GetObjectRequest::new().set_or_clear_if_generation_match(None::<i32>);
2385 /// ```
2386 pub fn set_or_clear_if_generation_match<T>(mut self, v: std::option::Option<T>) -> Self
2387 where
2388 T: std::convert::Into<i64>,
2389 {
2390 self.if_generation_match = v.map(|x| x.into());
2391 self
2392 }
2393
2394 /// Sets the value of [if_generation_not_match][crate::model::GetObjectRequest::if_generation_not_match].
2395 ///
2396 /// # Example
2397 /// ```ignore,no_run
2398 /// # use google_cloud_storage::model::GetObjectRequest;
2399 /// let x = GetObjectRequest::new().set_if_generation_not_match(42);
2400 /// ```
2401 pub fn set_if_generation_not_match<T>(mut self, v: T) -> Self
2402 where
2403 T: std::convert::Into<i64>,
2404 {
2405 self.if_generation_not_match = std::option::Option::Some(v.into());
2406 self
2407 }
2408
2409 /// Sets or clears the value of [if_generation_not_match][crate::model::GetObjectRequest::if_generation_not_match].
2410 ///
2411 /// # Example
2412 /// ```ignore,no_run
2413 /// # use google_cloud_storage::model::GetObjectRequest;
2414 /// let x = GetObjectRequest::new().set_or_clear_if_generation_not_match(Some(42));
2415 /// let x = GetObjectRequest::new().set_or_clear_if_generation_not_match(None::<i32>);
2416 /// ```
2417 pub fn set_or_clear_if_generation_not_match<T>(mut self, v: std::option::Option<T>) -> Self
2418 where
2419 T: std::convert::Into<i64>,
2420 {
2421 self.if_generation_not_match = v.map(|x| x.into());
2422 self
2423 }
2424
2425 /// Sets the value of [if_metageneration_match][crate::model::GetObjectRequest::if_metageneration_match].
2426 ///
2427 /// # Example
2428 /// ```ignore,no_run
2429 /// # use google_cloud_storage::model::GetObjectRequest;
2430 /// let x = GetObjectRequest::new().set_if_metageneration_match(42);
2431 /// ```
2432 pub fn set_if_metageneration_match<T>(mut self, v: T) -> Self
2433 where
2434 T: std::convert::Into<i64>,
2435 {
2436 self.if_metageneration_match = std::option::Option::Some(v.into());
2437 self
2438 }
2439
2440 /// Sets or clears the value of [if_metageneration_match][crate::model::GetObjectRequest::if_metageneration_match].
2441 ///
2442 /// # Example
2443 /// ```ignore,no_run
2444 /// # use google_cloud_storage::model::GetObjectRequest;
2445 /// let x = GetObjectRequest::new().set_or_clear_if_metageneration_match(Some(42));
2446 /// let x = GetObjectRequest::new().set_or_clear_if_metageneration_match(None::<i32>);
2447 /// ```
2448 pub fn set_or_clear_if_metageneration_match<T>(mut self, v: std::option::Option<T>) -> Self
2449 where
2450 T: std::convert::Into<i64>,
2451 {
2452 self.if_metageneration_match = v.map(|x| x.into());
2453 self
2454 }
2455
2456 /// Sets the value of [if_metageneration_not_match][crate::model::GetObjectRequest::if_metageneration_not_match].
2457 ///
2458 /// # Example
2459 /// ```ignore,no_run
2460 /// # use google_cloud_storage::model::GetObjectRequest;
2461 /// let x = GetObjectRequest::new().set_if_metageneration_not_match(42);
2462 /// ```
2463 pub fn set_if_metageneration_not_match<T>(mut self, v: T) -> Self
2464 where
2465 T: std::convert::Into<i64>,
2466 {
2467 self.if_metageneration_not_match = std::option::Option::Some(v.into());
2468 self
2469 }
2470
2471 /// Sets or clears the value of [if_metageneration_not_match][crate::model::GetObjectRequest::if_metageneration_not_match].
2472 ///
2473 /// # Example
2474 /// ```ignore,no_run
2475 /// # use google_cloud_storage::model::GetObjectRequest;
2476 /// let x = GetObjectRequest::new().set_or_clear_if_metageneration_not_match(Some(42));
2477 /// let x = GetObjectRequest::new().set_or_clear_if_metageneration_not_match(None::<i32>);
2478 /// ```
2479 pub fn set_or_clear_if_metageneration_not_match<T>(mut self, v: std::option::Option<T>) -> Self
2480 where
2481 T: std::convert::Into<i64>,
2482 {
2483 self.if_metageneration_not_match = v.map(|x| x.into());
2484 self
2485 }
2486
2487 /// Sets the value of [common_object_request_params][crate::model::GetObjectRequest::common_object_request_params].
2488 ///
2489 /// # Example
2490 /// ```ignore,no_run
2491 /// # use google_cloud_storage::model::GetObjectRequest;
2492 /// use google_cloud_storage::model::CommonObjectRequestParams;
2493 /// let x = GetObjectRequest::new().set_common_object_request_params(CommonObjectRequestParams::default()/* use setters */);
2494 /// ```
2495 pub fn set_common_object_request_params<T>(mut self, v: T) -> Self
2496 where
2497 T: std::convert::Into<crate::model::CommonObjectRequestParams>,
2498 {
2499 self.common_object_request_params = std::option::Option::Some(v.into());
2500 self
2501 }
2502
2503 /// Sets or clears the value of [common_object_request_params][crate::model::GetObjectRequest::common_object_request_params].
2504 ///
2505 /// # Example
2506 /// ```ignore,no_run
2507 /// # use google_cloud_storage::model::GetObjectRequest;
2508 /// use google_cloud_storage::model::CommonObjectRequestParams;
2509 /// let x = GetObjectRequest::new().set_or_clear_common_object_request_params(Some(CommonObjectRequestParams::default()/* use setters */));
2510 /// let x = GetObjectRequest::new().set_or_clear_common_object_request_params(None::<CommonObjectRequestParams>);
2511 /// ```
2512 pub fn set_or_clear_common_object_request_params<T>(mut self, v: std::option::Option<T>) -> Self
2513 where
2514 T: std::convert::Into<crate::model::CommonObjectRequestParams>,
2515 {
2516 self.common_object_request_params = v.map(|x| x.into());
2517 self
2518 }
2519
2520 /// Sets the value of [read_mask][crate::model::GetObjectRequest::read_mask].
2521 ///
2522 /// # Example
2523 /// ```ignore,no_run
2524 /// # use google_cloud_storage::model::GetObjectRequest;
2525 /// use wkt::FieldMask;
2526 /// let x = GetObjectRequest::new().set_read_mask(FieldMask::default()/* use setters */);
2527 /// ```
2528 pub fn set_read_mask<T>(mut self, v: T) -> Self
2529 where
2530 T: std::convert::Into<wkt::FieldMask>,
2531 {
2532 self.read_mask = std::option::Option::Some(v.into());
2533 self
2534 }
2535
2536 /// Sets or clears the value of [read_mask][crate::model::GetObjectRequest::read_mask].
2537 ///
2538 /// # Example
2539 /// ```ignore,no_run
2540 /// # use google_cloud_storage::model::GetObjectRequest;
2541 /// use wkt::FieldMask;
2542 /// let x = GetObjectRequest::new().set_or_clear_read_mask(Some(FieldMask::default()/* use setters */));
2543 /// let x = GetObjectRequest::new().set_or_clear_read_mask(None::<FieldMask>);
2544 /// ```
2545 pub fn set_or_clear_read_mask<T>(mut self, v: std::option::Option<T>) -> Self
2546 where
2547 T: std::convert::Into<wkt::FieldMask>,
2548 {
2549 self.read_mask = v.map(|x| x.into());
2550 self
2551 }
2552
2553 /// Sets the value of [restore_token][crate::model::GetObjectRequest::restore_token].
2554 ///
2555 /// # Example
2556 /// ```ignore,no_run
2557 /// # use google_cloud_storage::model::GetObjectRequest;
2558 /// let x = GetObjectRequest::new().set_restore_token("example");
2559 /// ```
2560 pub fn set_restore_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2561 self.restore_token = v.into();
2562 self
2563 }
2564}
2565
2566impl wkt::message::Message for GetObjectRequest {
2567 fn typename() -> &'static str {
2568 "type.googleapis.com/google.storage.v2.GetObjectRequest"
2569 }
2570}
2571
2572/// Describes an attempt to insert an object, possibly over multiple requests.
2573#[derive(Clone, Default, PartialEq)]
2574#[non_exhaustive]
2575pub struct WriteObjectSpec {
2576 /// Required. Destination object, including its name and its metadata.
2577 pub resource: std::option::Option<crate::model::Object>,
2578
2579 /// Optional. Apply a predefined set of access controls to this object.
2580 /// Valid values are `authenticatedRead`, `bucketOwnerFullControl`,
2581 /// `bucketOwnerRead`, `private`, `projectPrivate`, or `publicRead`.
2582 pub predefined_acl: std::string::String,
2583
2584 /// Makes the operation conditional on whether the object's current
2585 /// generation matches the given value. Setting to `0` makes the operation
2586 /// succeed only if there are no live versions of the object.
2587 pub if_generation_match: std::option::Option<i64>,
2588
2589 /// Makes the operation conditional on whether the object's live
2590 /// generation does not match the given value. If no live object exists, the
2591 /// precondition fails. Setting to `0` makes the operation succeed only if
2592 /// there is a live version of the object.
2593 pub if_generation_not_match: std::option::Option<i64>,
2594
2595 /// Makes the operation conditional on whether the object's current
2596 /// metageneration matches the given value.
2597 pub if_metageneration_match: std::option::Option<i64>,
2598
2599 /// Makes the operation conditional on whether the object's current
2600 /// metageneration does not match the given value.
2601 pub if_metageneration_not_match: std::option::Option<i64>,
2602
2603 /// The expected final object size being uploaded.
2604 /// If this value is set, closing the stream after writing fewer or more than
2605 /// `object_size` bytes results in an `OUT_OF_RANGE` error.
2606 ///
2607 /// This situation is considered a client error, and if such an error occurs
2608 /// you must start the upload over from scratch, this time sending the correct
2609 /// number of bytes.
2610 pub object_size: std::option::Option<i64>,
2611
2612 /// If `true`, the object is created in appendable mode.
2613 /// This field might only be set when using `BidiWriteObject`.
2614 pub appendable: std::option::Option<bool>,
2615
2616 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2617}
2618
2619impl WriteObjectSpec {
2620 pub fn new() -> Self {
2621 std::default::Default::default()
2622 }
2623
2624 /// Sets the value of [resource][crate::model::WriteObjectSpec::resource].
2625 ///
2626 /// # Example
2627 /// ```ignore,no_run
2628 /// # use google_cloud_storage::model::WriteObjectSpec;
2629 /// use google_cloud_storage::model::Object;
2630 /// let x = WriteObjectSpec::new().set_resource(Object::default()/* use setters */);
2631 /// ```
2632 pub fn set_resource<T>(mut self, v: T) -> Self
2633 where
2634 T: std::convert::Into<crate::model::Object>,
2635 {
2636 self.resource = std::option::Option::Some(v.into());
2637 self
2638 }
2639
2640 /// Sets or clears the value of [resource][crate::model::WriteObjectSpec::resource].
2641 ///
2642 /// # Example
2643 /// ```ignore,no_run
2644 /// # use google_cloud_storage::model::WriteObjectSpec;
2645 /// use google_cloud_storage::model::Object;
2646 /// let x = WriteObjectSpec::new().set_or_clear_resource(Some(Object::default()/* use setters */));
2647 /// let x = WriteObjectSpec::new().set_or_clear_resource(None::<Object>);
2648 /// ```
2649 pub fn set_or_clear_resource<T>(mut self, v: std::option::Option<T>) -> Self
2650 where
2651 T: std::convert::Into<crate::model::Object>,
2652 {
2653 self.resource = v.map(|x| x.into());
2654 self
2655 }
2656
2657 /// Sets the value of [predefined_acl][crate::model::WriteObjectSpec::predefined_acl].
2658 ///
2659 /// # Example
2660 /// ```ignore,no_run
2661 /// # use google_cloud_storage::model::WriteObjectSpec;
2662 /// let x = WriteObjectSpec::new().set_predefined_acl("example");
2663 /// ```
2664 pub fn set_predefined_acl<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2665 self.predefined_acl = v.into();
2666 self
2667 }
2668
2669 /// Sets the value of [if_generation_match][crate::model::WriteObjectSpec::if_generation_match].
2670 ///
2671 /// # Example
2672 /// ```ignore,no_run
2673 /// # use google_cloud_storage::model::WriteObjectSpec;
2674 /// let x = WriteObjectSpec::new().set_if_generation_match(42);
2675 /// ```
2676 pub fn set_if_generation_match<T>(mut self, v: T) -> Self
2677 where
2678 T: std::convert::Into<i64>,
2679 {
2680 self.if_generation_match = std::option::Option::Some(v.into());
2681 self
2682 }
2683
2684 /// Sets or clears the value of [if_generation_match][crate::model::WriteObjectSpec::if_generation_match].
2685 ///
2686 /// # Example
2687 /// ```ignore,no_run
2688 /// # use google_cloud_storage::model::WriteObjectSpec;
2689 /// let x = WriteObjectSpec::new().set_or_clear_if_generation_match(Some(42));
2690 /// let x = WriteObjectSpec::new().set_or_clear_if_generation_match(None::<i32>);
2691 /// ```
2692 pub fn set_or_clear_if_generation_match<T>(mut self, v: std::option::Option<T>) -> Self
2693 where
2694 T: std::convert::Into<i64>,
2695 {
2696 self.if_generation_match = v.map(|x| x.into());
2697 self
2698 }
2699
2700 /// Sets the value of [if_generation_not_match][crate::model::WriteObjectSpec::if_generation_not_match].
2701 ///
2702 /// # Example
2703 /// ```ignore,no_run
2704 /// # use google_cloud_storage::model::WriteObjectSpec;
2705 /// let x = WriteObjectSpec::new().set_if_generation_not_match(42);
2706 /// ```
2707 pub fn set_if_generation_not_match<T>(mut self, v: T) -> Self
2708 where
2709 T: std::convert::Into<i64>,
2710 {
2711 self.if_generation_not_match = std::option::Option::Some(v.into());
2712 self
2713 }
2714
2715 /// Sets or clears the value of [if_generation_not_match][crate::model::WriteObjectSpec::if_generation_not_match].
2716 ///
2717 /// # Example
2718 /// ```ignore,no_run
2719 /// # use google_cloud_storage::model::WriteObjectSpec;
2720 /// let x = WriteObjectSpec::new().set_or_clear_if_generation_not_match(Some(42));
2721 /// let x = WriteObjectSpec::new().set_or_clear_if_generation_not_match(None::<i32>);
2722 /// ```
2723 pub fn set_or_clear_if_generation_not_match<T>(mut self, v: std::option::Option<T>) -> Self
2724 where
2725 T: std::convert::Into<i64>,
2726 {
2727 self.if_generation_not_match = v.map(|x| x.into());
2728 self
2729 }
2730
2731 /// Sets the value of [if_metageneration_match][crate::model::WriteObjectSpec::if_metageneration_match].
2732 ///
2733 /// # Example
2734 /// ```ignore,no_run
2735 /// # use google_cloud_storage::model::WriteObjectSpec;
2736 /// let x = WriteObjectSpec::new().set_if_metageneration_match(42);
2737 /// ```
2738 pub fn set_if_metageneration_match<T>(mut self, v: T) -> Self
2739 where
2740 T: std::convert::Into<i64>,
2741 {
2742 self.if_metageneration_match = std::option::Option::Some(v.into());
2743 self
2744 }
2745
2746 /// Sets or clears the value of [if_metageneration_match][crate::model::WriteObjectSpec::if_metageneration_match].
2747 ///
2748 /// # Example
2749 /// ```ignore,no_run
2750 /// # use google_cloud_storage::model::WriteObjectSpec;
2751 /// let x = WriteObjectSpec::new().set_or_clear_if_metageneration_match(Some(42));
2752 /// let x = WriteObjectSpec::new().set_or_clear_if_metageneration_match(None::<i32>);
2753 /// ```
2754 pub fn set_or_clear_if_metageneration_match<T>(mut self, v: std::option::Option<T>) -> Self
2755 where
2756 T: std::convert::Into<i64>,
2757 {
2758 self.if_metageneration_match = v.map(|x| x.into());
2759 self
2760 }
2761
2762 /// Sets the value of [if_metageneration_not_match][crate::model::WriteObjectSpec::if_metageneration_not_match].
2763 ///
2764 /// # Example
2765 /// ```ignore,no_run
2766 /// # use google_cloud_storage::model::WriteObjectSpec;
2767 /// let x = WriteObjectSpec::new().set_if_metageneration_not_match(42);
2768 /// ```
2769 pub fn set_if_metageneration_not_match<T>(mut self, v: T) -> Self
2770 where
2771 T: std::convert::Into<i64>,
2772 {
2773 self.if_metageneration_not_match = std::option::Option::Some(v.into());
2774 self
2775 }
2776
2777 /// Sets or clears the value of [if_metageneration_not_match][crate::model::WriteObjectSpec::if_metageneration_not_match].
2778 ///
2779 /// # Example
2780 /// ```ignore,no_run
2781 /// # use google_cloud_storage::model::WriteObjectSpec;
2782 /// let x = WriteObjectSpec::new().set_or_clear_if_metageneration_not_match(Some(42));
2783 /// let x = WriteObjectSpec::new().set_or_clear_if_metageneration_not_match(None::<i32>);
2784 /// ```
2785 pub fn set_or_clear_if_metageneration_not_match<T>(mut self, v: std::option::Option<T>) -> Self
2786 where
2787 T: std::convert::Into<i64>,
2788 {
2789 self.if_metageneration_not_match = v.map(|x| x.into());
2790 self
2791 }
2792
2793 /// Sets the value of [object_size][crate::model::WriteObjectSpec::object_size].
2794 ///
2795 /// # Example
2796 /// ```ignore,no_run
2797 /// # use google_cloud_storage::model::WriteObjectSpec;
2798 /// let x = WriteObjectSpec::new().set_object_size(42);
2799 /// ```
2800 pub fn set_object_size<T>(mut self, v: T) -> Self
2801 where
2802 T: std::convert::Into<i64>,
2803 {
2804 self.object_size = std::option::Option::Some(v.into());
2805 self
2806 }
2807
2808 /// Sets or clears the value of [object_size][crate::model::WriteObjectSpec::object_size].
2809 ///
2810 /// # Example
2811 /// ```ignore,no_run
2812 /// # use google_cloud_storage::model::WriteObjectSpec;
2813 /// let x = WriteObjectSpec::new().set_or_clear_object_size(Some(42));
2814 /// let x = WriteObjectSpec::new().set_or_clear_object_size(None::<i32>);
2815 /// ```
2816 pub fn set_or_clear_object_size<T>(mut self, v: std::option::Option<T>) -> Self
2817 where
2818 T: std::convert::Into<i64>,
2819 {
2820 self.object_size = v.map(|x| x.into());
2821 self
2822 }
2823
2824 /// Sets the value of [appendable][crate::model::WriteObjectSpec::appendable].
2825 ///
2826 /// # Example
2827 /// ```ignore,no_run
2828 /// # use google_cloud_storage::model::WriteObjectSpec;
2829 /// let x = WriteObjectSpec::new().set_appendable(true);
2830 /// ```
2831 pub fn set_appendable<T>(mut self, v: T) -> Self
2832 where
2833 T: std::convert::Into<bool>,
2834 {
2835 self.appendable = std::option::Option::Some(v.into());
2836 self
2837 }
2838
2839 /// Sets or clears the value of [appendable][crate::model::WriteObjectSpec::appendable].
2840 ///
2841 /// # Example
2842 /// ```ignore,no_run
2843 /// # use google_cloud_storage::model::WriteObjectSpec;
2844 /// let x = WriteObjectSpec::new().set_or_clear_appendable(Some(false));
2845 /// let x = WriteObjectSpec::new().set_or_clear_appendable(None::<bool>);
2846 /// ```
2847 pub fn set_or_clear_appendable<T>(mut self, v: std::option::Option<T>) -> Self
2848 where
2849 T: std::convert::Into<bool>,
2850 {
2851 self.appendable = v.map(|x| x.into());
2852 self
2853 }
2854}
2855
2856impl wkt::message::Message for WriteObjectSpec {
2857 fn typename() -> &'static str {
2858 "type.googleapis.com/google.storage.v2.WriteObjectSpec"
2859 }
2860}
2861
2862/// Request message for [ListObjects][google.storage.v2.Storage.ListObjects].
2863///
2864/// [google.storage.v2.Storage.ListObjects]: crate::client::StorageControl::list_objects
2865#[derive(Clone, Default, PartialEq)]
2866#[non_exhaustive]
2867pub struct ListObjectsRequest {
2868 /// Required. Name of the bucket in which to look for objects.
2869 pub parent: std::string::String,
2870
2871 /// Optional. Maximum number of `items` plus `prefixes` to return
2872 /// in a single page of responses. As duplicate `prefixes` are
2873 /// omitted, fewer total results might be returned than requested. The service
2874 /// uses this parameter or 1,000 items, whichever is smaller.
2875 pub page_size: i32,
2876
2877 /// Optional. A previously-returned page token representing part of the larger
2878 /// set of results to view.
2879 pub page_token: std::string::String,
2880
2881 /// Optional. If set, returns results in a directory-like mode. `items`
2882 /// contains only objects whose names, aside from the `prefix`, do not contain
2883 /// `delimiter`. Objects whose names, aside from the `prefix`, contain
2884 /// `delimiter` has their name, truncated after the `delimiter`, returned in
2885 /// `prefixes`. Duplicate `prefixes` are omitted.
2886 pub delimiter: std::string::String,
2887
2888 /// Optional. If true, objects that end in exactly one instance of `delimiter`
2889 /// has their metadata included in `items` in addition to
2890 /// `prefixes`.
2891 pub include_trailing_delimiter: bool,
2892
2893 /// Optional. Filter results to objects whose names begin with this prefix.
2894 pub prefix: std::string::String,
2895
2896 /// Optional. If `true`, lists all versions of an object as distinct results.
2897 pub versions: bool,
2898
2899 /// Mask specifying which fields to read from each result.
2900 /// If no mask is specified, defaults to all fields except `items.acl` and
2901 /// `items.owner`.
2902 /// `*` might be used to mean all fields.
2903 pub read_mask: std::option::Option<wkt::FieldMask>,
2904
2905 /// Optional. Filter results to objects whose names are lexicographically equal
2906 /// to or after `lexicographic_start`. If `lexicographic_end` is also set, the
2907 /// objects listed have names between `lexicographic_start` (inclusive) and
2908 /// `lexicographic_end` (exclusive).
2909 pub lexicographic_start: std::string::String,
2910
2911 /// Optional. Filter results to objects whose names are lexicographically
2912 /// before `lexicographic_end`. If `lexicographic_start` is also set, the
2913 /// objects listed have names between `lexicographic_start` (inclusive) and
2914 /// `lexicographic_end` (exclusive).
2915 pub lexicographic_end: std::string::String,
2916
2917 /// Optional. If true, only list all soft-deleted versions of the object.
2918 /// Soft delete policy is required to set this option.
2919 pub soft_deleted: bool,
2920
2921 /// Optional. If true, includes folders and managed folders (besides objects)
2922 /// in the returned `prefixes`. Requires `delimiter` to be set to '/'.
2923 pub include_folders_as_prefixes: bool,
2924
2925 /// Optional. Filter results to objects and prefixes that match this glob
2926 /// pattern. See [List objects using
2927 /// glob](https://cloud.google.com/storage/docs/json_api/v1/objects/list#list-objects-and-prefixes-using-glob)
2928 /// for the full syntax.
2929 pub match_glob: std::string::String,
2930
2931 /// Optional. An expression used to filter the returned objects by the
2932 /// `context` field. For the full syntax, see [Filter objects by contexts
2933 /// syntax](https://cloud.google.com/storage/docs/listing-objects#filter-by-object-contexts-syntax).
2934 /// If a `delimiter` is set, the returned `prefixes` are exempt from this
2935 /// filter.
2936 pub filter: std::string::String,
2937
2938 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2939}
2940
2941impl ListObjectsRequest {
2942 pub fn new() -> Self {
2943 std::default::Default::default()
2944 }
2945
2946 /// Sets the value of [parent][crate::model::ListObjectsRequest::parent].
2947 ///
2948 /// # Example
2949 /// ```ignore,no_run
2950 /// # use google_cloud_storage::model::ListObjectsRequest;
2951 /// let x = ListObjectsRequest::new().set_parent("example");
2952 /// ```
2953 pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2954 self.parent = v.into();
2955 self
2956 }
2957
2958 /// Sets the value of [page_size][crate::model::ListObjectsRequest::page_size].
2959 ///
2960 /// # Example
2961 /// ```ignore,no_run
2962 /// # use google_cloud_storage::model::ListObjectsRequest;
2963 /// let x = ListObjectsRequest::new().set_page_size(42);
2964 /// ```
2965 pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
2966 self.page_size = v.into();
2967 self
2968 }
2969
2970 /// Sets the value of [page_token][crate::model::ListObjectsRequest::page_token].
2971 ///
2972 /// # Example
2973 /// ```ignore,no_run
2974 /// # use google_cloud_storage::model::ListObjectsRequest;
2975 /// let x = ListObjectsRequest::new().set_page_token("example");
2976 /// ```
2977 pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2978 self.page_token = v.into();
2979 self
2980 }
2981
2982 /// Sets the value of [delimiter][crate::model::ListObjectsRequest::delimiter].
2983 ///
2984 /// # Example
2985 /// ```ignore,no_run
2986 /// # use google_cloud_storage::model::ListObjectsRequest;
2987 /// let x = ListObjectsRequest::new().set_delimiter("example");
2988 /// ```
2989 pub fn set_delimiter<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2990 self.delimiter = v.into();
2991 self
2992 }
2993
2994 /// Sets the value of [include_trailing_delimiter][crate::model::ListObjectsRequest::include_trailing_delimiter].
2995 ///
2996 /// # Example
2997 /// ```ignore,no_run
2998 /// # use google_cloud_storage::model::ListObjectsRequest;
2999 /// let x = ListObjectsRequest::new().set_include_trailing_delimiter(true);
3000 /// ```
3001 pub fn set_include_trailing_delimiter<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
3002 self.include_trailing_delimiter = v.into();
3003 self
3004 }
3005
3006 /// Sets the value of [prefix][crate::model::ListObjectsRequest::prefix].
3007 ///
3008 /// # Example
3009 /// ```ignore,no_run
3010 /// # use google_cloud_storage::model::ListObjectsRequest;
3011 /// let x = ListObjectsRequest::new().set_prefix("example");
3012 /// ```
3013 pub fn set_prefix<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3014 self.prefix = v.into();
3015 self
3016 }
3017
3018 /// Sets the value of [versions][crate::model::ListObjectsRequest::versions].
3019 ///
3020 /// # Example
3021 /// ```ignore,no_run
3022 /// # use google_cloud_storage::model::ListObjectsRequest;
3023 /// let x = ListObjectsRequest::new().set_versions(true);
3024 /// ```
3025 pub fn set_versions<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
3026 self.versions = v.into();
3027 self
3028 }
3029
3030 /// Sets the value of [read_mask][crate::model::ListObjectsRequest::read_mask].
3031 ///
3032 /// # Example
3033 /// ```ignore,no_run
3034 /// # use google_cloud_storage::model::ListObjectsRequest;
3035 /// use wkt::FieldMask;
3036 /// let x = ListObjectsRequest::new().set_read_mask(FieldMask::default()/* use setters */);
3037 /// ```
3038 pub fn set_read_mask<T>(mut self, v: T) -> Self
3039 where
3040 T: std::convert::Into<wkt::FieldMask>,
3041 {
3042 self.read_mask = std::option::Option::Some(v.into());
3043 self
3044 }
3045
3046 /// Sets or clears the value of [read_mask][crate::model::ListObjectsRequest::read_mask].
3047 ///
3048 /// # Example
3049 /// ```ignore,no_run
3050 /// # use google_cloud_storage::model::ListObjectsRequest;
3051 /// use wkt::FieldMask;
3052 /// let x = ListObjectsRequest::new().set_or_clear_read_mask(Some(FieldMask::default()/* use setters */));
3053 /// let x = ListObjectsRequest::new().set_or_clear_read_mask(None::<FieldMask>);
3054 /// ```
3055 pub fn set_or_clear_read_mask<T>(mut self, v: std::option::Option<T>) -> Self
3056 where
3057 T: std::convert::Into<wkt::FieldMask>,
3058 {
3059 self.read_mask = v.map(|x| x.into());
3060 self
3061 }
3062
3063 /// Sets the value of [lexicographic_start][crate::model::ListObjectsRequest::lexicographic_start].
3064 ///
3065 /// # Example
3066 /// ```ignore,no_run
3067 /// # use google_cloud_storage::model::ListObjectsRequest;
3068 /// let x = ListObjectsRequest::new().set_lexicographic_start("example");
3069 /// ```
3070 pub fn set_lexicographic_start<T: std::convert::Into<std::string::String>>(
3071 mut self,
3072 v: T,
3073 ) -> Self {
3074 self.lexicographic_start = v.into();
3075 self
3076 }
3077
3078 /// Sets the value of [lexicographic_end][crate::model::ListObjectsRequest::lexicographic_end].
3079 ///
3080 /// # Example
3081 /// ```ignore,no_run
3082 /// # use google_cloud_storage::model::ListObjectsRequest;
3083 /// let x = ListObjectsRequest::new().set_lexicographic_end("example");
3084 /// ```
3085 pub fn set_lexicographic_end<T: std::convert::Into<std::string::String>>(
3086 mut self,
3087 v: T,
3088 ) -> Self {
3089 self.lexicographic_end = v.into();
3090 self
3091 }
3092
3093 /// Sets the value of [soft_deleted][crate::model::ListObjectsRequest::soft_deleted].
3094 ///
3095 /// # Example
3096 /// ```ignore,no_run
3097 /// # use google_cloud_storage::model::ListObjectsRequest;
3098 /// let x = ListObjectsRequest::new().set_soft_deleted(true);
3099 /// ```
3100 pub fn set_soft_deleted<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
3101 self.soft_deleted = v.into();
3102 self
3103 }
3104
3105 /// Sets the value of [include_folders_as_prefixes][crate::model::ListObjectsRequest::include_folders_as_prefixes].
3106 ///
3107 /// # Example
3108 /// ```ignore,no_run
3109 /// # use google_cloud_storage::model::ListObjectsRequest;
3110 /// let x = ListObjectsRequest::new().set_include_folders_as_prefixes(true);
3111 /// ```
3112 pub fn set_include_folders_as_prefixes<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
3113 self.include_folders_as_prefixes = v.into();
3114 self
3115 }
3116
3117 /// Sets the value of [match_glob][crate::model::ListObjectsRequest::match_glob].
3118 ///
3119 /// # Example
3120 /// ```ignore,no_run
3121 /// # use google_cloud_storage::model::ListObjectsRequest;
3122 /// let x = ListObjectsRequest::new().set_match_glob("example");
3123 /// ```
3124 pub fn set_match_glob<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3125 self.match_glob = v.into();
3126 self
3127 }
3128
3129 /// Sets the value of [filter][crate::model::ListObjectsRequest::filter].
3130 ///
3131 /// # Example
3132 /// ```ignore,no_run
3133 /// # use google_cloud_storage::model::ListObjectsRequest;
3134 /// let x = ListObjectsRequest::new().set_filter("example");
3135 /// ```
3136 pub fn set_filter<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3137 self.filter = v.into();
3138 self
3139 }
3140}
3141
3142impl wkt::message::Message for ListObjectsRequest {
3143 fn typename() -> &'static str {
3144 "type.googleapis.com/google.storage.v2.ListObjectsRequest"
3145 }
3146}
3147
3148/// Request message for [RewriteObject][google.storage.v2.Storage.RewriteObject].
3149/// If the source object is encrypted using a Customer-Supplied Encryption Key
3150/// the key information must be provided in the
3151/// `copy_source_encryption_algorithm`, `copy_source_encryption_key_bytes`, and
3152/// `copy_source_encryption_key_sha256_bytes` fields. If the destination object
3153/// should be encrypted the keying information should be provided in the
3154/// `encryption_algorithm`, `encryption_key_bytes`, and
3155/// `encryption_key_sha256_bytes` fields of the
3156/// `common_object_request_params.customer_encryption` field.
3157///
3158/// [google.storage.v2.Storage.RewriteObject]: crate::client::StorageControl::rewrite_object
3159#[derive(Clone, Default, PartialEq)]
3160#[non_exhaustive]
3161pub struct RewriteObjectRequest {
3162 /// Required. Immutable. The name of the destination object.
3163 /// See the
3164 /// [Naming Guidelines](https://cloud.google.com/storage/docs/objects#naming).
3165 /// Example: `test.txt`
3166 /// The `name` field by itself does not uniquely identify a Cloud Storage
3167 /// object. A Cloud Storage object is uniquely identified by the tuple of
3168 /// (bucket, object, generation).
3169 pub destination_name: std::string::String,
3170
3171 /// Required. Immutable. The name of the bucket containing the destination
3172 /// object.
3173 pub destination_bucket: std::string::String,
3174
3175 /// Optional. The name of the Cloud KMS key that is used to encrypt the
3176 /// destination object. The Cloud KMS key must be located in same location as
3177 /// the object. If the parameter is not specified, the request uses the
3178 /// destination bucket's default encryption key, if any, or else the
3179 /// Google-managed encryption key.
3180 pub destination_kms_key: std::string::String,
3181
3182 /// Optional. Properties of the destination, post-rewrite object.
3183 /// The `name`, `bucket` and `kms_key` fields must not be populated (these
3184 /// values are specified in the `destination_name`, `destination_bucket`, and
3185 /// `destination_kms_key` fields).
3186 /// If `destination` is present it is used to construct the destination
3187 /// object's metadata; otherwise the destination object's metadata is
3188 /// copied from the source object.
3189 pub destination: std::option::Option<crate::model::Object>,
3190
3191 /// Required. Name of the bucket in which to find the source object.
3192 pub source_bucket: std::string::String,
3193
3194 /// Required. Name of the source object.
3195 pub source_object: std::string::String,
3196
3197 /// Optional. If present, selects a specific revision of the source object (as
3198 /// opposed to the latest version, the default).
3199 pub source_generation: i64,
3200
3201 /// Optional. Include this field (from the previous rewrite response) on each
3202 /// rewrite request after the first one, until the rewrite response 'done' flag
3203 /// is true. Calls that provide a rewriteToken can omit all other request
3204 /// fields, but if included those fields must match the values provided in the
3205 /// first rewrite request.
3206 pub rewrite_token: std::string::String,
3207
3208 /// Optional. Apply a predefined set of access controls to the destination
3209 /// object. Valid values are `authenticatedRead`, `bucketOwnerFullControl`,
3210 /// `bucketOwnerRead`, `private`, `projectPrivate`, or `publicRead`.
3211 pub destination_predefined_acl: std::string::String,
3212
3213 /// Makes the operation conditional on whether the object's current generation
3214 /// matches the given value. Setting to 0 makes the operation succeed only if
3215 /// there are no live versions of the object.
3216 pub if_generation_match: std::option::Option<i64>,
3217
3218 /// Makes the operation conditional on whether the object's live generation
3219 /// does not match the given value. If no live object exists, the precondition
3220 /// fails. Setting to 0 makes the operation succeed only if there is a live
3221 /// version of the object.
3222 pub if_generation_not_match: std::option::Option<i64>,
3223
3224 /// Makes the operation conditional on whether the destination object's current
3225 /// metageneration matches the given value.
3226 pub if_metageneration_match: std::option::Option<i64>,
3227
3228 /// Makes the operation conditional on whether the destination object's current
3229 /// metageneration does not match the given value.
3230 pub if_metageneration_not_match: std::option::Option<i64>,
3231
3232 /// Makes the operation conditional on whether the source object's live
3233 /// generation matches the given value.
3234 pub if_source_generation_match: std::option::Option<i64>,
3235
3236 /// Makes the operation conditional on whether the source object's live
3237 /// generation does not match the given value.
3238 pub if_source_generation_not_match: std::option::Option<i64>,
3239
3240 /// Makes the operation conditional on whether the source object's current
3241 /// metageneration matches the given value.
3242 pub if_source_metageneration_match: std::option::Option<i64>,
3243
3244 /// Makes the operation conditional on whether the source object's current
3245 /// metageneration does not match the given value.
3246 pub if_source_metageneration_not_match: std::option::Option<i64>,
3247
3248 /// Optional. The maximum number of bytes that are rewritten per rewrite
3249 /// request. Most callers shouldn't need to specify this parameter - it is
3250 /// primarily in place to support testing. If specified the value must be an
3251 /// integral multiple of 1 MiB (1048576). Also, this only applies to requests
3252 /// where the source and destination span locations and/or storage classes.
3253 /// Finally, this value must not change across rewrite calls else you'll get an
3254 /// error that the `rewriteToken` is invalid.
3255 pub max_bytes_rewritten_per_call: i64,
3256
3257 /// Optional. The algorithm used to encrypt the source object, if any. Used if
3258 /// the source object was encrypted with a Customer-Supplied Encryption Key.
3259 pub copy_source_encryption_algorithm: std::string::String,
3260
3261 /// Optional. The raw bytes (not base64-encoded) AES-256 encryption key used to
3262 /// encrypt the source object, if it was encrypted with a Customer-Supplied
3263 /// Encryption Key.
3264 pub copy_source_encryption_key_bytes: ::bytes::Bytes,
3265
3266 /// Optional. The raw bytes (not base64-encoded) SHA256 hash of the encryption
3267 /// key used to encrypt the source object, if it was encrypted with a
3268 /// Customer-Supplied Encryption Key.
3269 pub copy_source_encryption_key_sha256_bytes: ::bytes::Bytes,
3270
3271 /// Optional. A set of parameters common to Storage API requests concerning an
3272 /// object.
3273 pub common_object_request_params: std::option::Option<crate::model::CommonObjectRequestParams>,
3274
3275 /// Optional. The checksums of the complete object. This is used to validate
3276 /// the destination object after rewriting.
3277 pub object_checksums: std::option::Option<crate::model::ObjectChecksums>,
3278
3279 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3280}
3281
3282impl RewriteObjectRequest {
3283 pub fn new() -> Self {
3284 std::default::Default::default()
3285 }
3286
3287 /// Sets the value of [destination_name][crate::model::RewriteObjectRequest::destination_name].
3288 ///
3289 /// # Example
3290 /// ```ignore,no_run
3291 /// # use google_cloud_storage::model::RewriteObjectRequest;
3292 /// let x = RewriteObjectRequest::new().set_destination_name("example");
3293 /// ```
3294 pub fn set_destination_name<T: std::convert::Into<std::string::String>>(
3295 mut self,
3296 v: T,
3297 ) -> Self {
3298 self.destination_name = v.into();
3299 self
3300 }
3301
3302 /// Sets the value of [destination_bucket][crate::model::RewriteObjectRequest::destination_bucket].
3303 ///
3304 /// # Example
3305 /// ```ignore,no_run
3306 /// # use google_cloud_storage::model::RewriteObjectRequest;
3307 /// let x = RewriteObjectRequest::new().set_destination_bucket("example");
3308 /// ```
3309 pub fn set_destination_bucket<T: std::convert::Into<std::string::String>>(
3310 mut self,
3311 v: T,
3312 ) -> Self {
3313 self.destination_bucket = v.into();
3314 self
3315 }
3316
3317 /// Sets the value of [destination_kms_key][crate::model::RewriteObjectRequest::destination_kms_key].
3318 ///
3319 /// # Example
3320 /// ```ignore,no_run
3321 /// # use google_cloud_storage::model::RewriteObjectRequest;
3322 /// let x = RewriteObjectRequest::new().set_destination_kms_key("example");
3323 /// ```
3324 pub fn set_destination_kms_key<T: std::convert::Into<std::string::String>>(
3325 mut self,
3326 v: T,
3327 ) -> Self {
3328 self.destination_kms_key = v.into();
3329 self
3330 }
3331
3332 /// Sets the value of [destination][crate::model::RewriteObjectRequest::destination].
3333 ///
3334 /// # Example
3335 /// ```ignore,no_run
3336 /// # use google_cloud_storage::model::RewriteObjectRequest;
3337 /// use google_cloud_storage::model::Object;
3338 /// let x = RewriteObjectRequest::new().set_destination(Object::default()/* use setters */);
3339 /// ```
3340 pub fn set_destination<T>(mut self, v: T) -> Self
3341 where
3342 T: std::convert::Into<crate::model::Object>,
3343 {
3344 self.destination = std::option::Option::Some(v.into());
3345 self
3346 }
3347
3348 /// Sets or clears the value of [destination][crate::model::RewriteObjectRequest::destination].
3349 ///
3350 /// # Example
3351 /// ```ignore,no_run
3352 /// # use google_cloud_storage::model::RewriteObjectRequest;
3353 /// use google_cloud_storage::model::Object;
3354 /// let x = RewriteObjectRequest::new().set_or_clear_destination(Some(Object::default()/* use setters */));
3355 /// let x = RewriteObjectRequest::new().set_or_clear_destination(None::<Object>);
3356 /// ```
3357 pub fn set_or_clear_destination<T>(mut self, v: std::option::Option<T>) -> Self
3358 where
3359 T: std::convert::Into<crate::model::Object>,
3360 {
3361 self.destination = v.map(|x| x.into());
3362 self
3363 }
3364
3365 /// Sets the value of [source_bucket][crate::model::RewriteObjectRequest::source_bucket].
3366 ///
3367 /// # Example
3368 /// ```ignore,no_run
3369 /// # use google_cloud_storage::model::RewriteObjectRequest;
3370 /// let x = RewriteObjectRequest::new().set_source_bucket("example");
3371 /// ```
3372 pub fn set_source_bucket<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3373 self.source_bucket = v.into();
3374 self
3375 }
3376
3377 /// Sets the value of [source_object][crate::model::RewriteObjectRequest::source_object].
3378 ///
3379 /// # Example
3380 /// ```ignore,no_run
3381 /// # use google_cloud_storage::model::RewriteObjectRequest;
3382 /// let x = RewriteObjectRequest::new().set_source_object("example");
3383 /// ```
3384 pub fn set_source_object<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3385 self.source_object = v.into();
3386 self
3387 }
3388
3389 /// Sets the value of [source_generation][crate::model::RewriteObjectRequest::source_generation].
3390 ///
3391 /// # Example
3392 /// ```ignore,no_run
3393 /// # use google_cloud_storage::model::RewriteObjectRequest;
3394 /// let x = RewriteObjectRequest::new().set_source_generation(42);
3395 /// ```
3396 pub fn set_source_generation<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
3397 self.source_generation = v.into();
3398 self
3399 }
3400
3401 /// Sets the value of [rewrite_token][crate::model::RewriteObjectRequest::rewrite_token].
3402 ///
3403 /// # Example
3404 /// ```ignore,no_run
3405 /// # use google_cloud_storage::model::RewriteObjectRequest;
3406 /// let x = RewriteObjectRequest::new().set_rewrite_token("example");
3407 /// ```
3408 pub fn set_rewrite_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3409 self.rewrite_token = v.into();
3410 self
3411 }
3412
3413 /// Sets the value of [destination_predefined_acl][crate::model::RewriteObjectRequest::destination_predefined_acl].
3414 ///
3415 /// # Example
3416 /// ```ignore,no_run
3417 /// # use google_cloud_storage::model::RewriteObjectRequest;
3418 /// let x = RewriteObjectRequest::new().set_destination_predefined_acl("example");
3419 /// ```
3420 pub fn set_destination_predefined_acl<T: std::convert::Into<std::string::String>>(
3421 mut self,
3422 v: T,
3423 ) -> Self {
3424 self.destination_predefined_acl = v.into();
3425 self
3426 }
3427
3428 /// Sets the value of [if_generation_match][crate::model::RewriteObjectRequest::if_generation_match].
3429 ///
3430 /// # Example
3431 /// ```ignore,no_run
3432 /// # use google_cloud_storage::model::RewriteObjectRequest;
3433 /// let x = RewriteObjectRequest::new().set_if_generation_match(42);
3434 /// ```
3435 pub fn set_if_generation_match<T>(mut self, v: T) -> Self
3436 where
3437 T: std::convert::Into<i64>,
3438 {
3439 self.if_generation_match = std::option::Option::Some(v.into());
3440 self
3441 }
3442
3443 /// Sets or clears the value of [if_generation_match][crate::model::RewriteObjectRequest::if_generation_match].
3444 ///
3445 /// # Example
3446 /// ```ignore,no_run
3447 /// # use google_cloud_storage::model::RewriteObjectRequest;
3448 /// let x = RewriteObjectRequest::new().set_or_clear_if_generation_match(Some(42));
3449 /// let x = RewriteObjectRequest::new().set_or_clear_if_generation_match(None::<i32>);
3450 /// ```
3451 pub fn set_or_clear_if_generation_match<T>(mut self, v: std::option::Option<T>) -> Self
3452 where
3453 T: std::convert::Into<i64>,
3454 {
3455 self.if_generation_match = v.map(|x| x.into());
3456 self
3457 }
3458
3459 /// Sets the value of [if_generation_not_match][crate::model::RewriteObjectRequest::if_generation_not_match].
3460 ///
3461 /// # Example
3462 /// ```ignore,no_run
3463 /// # use google_cloud_storage::model::RewriteObjectRequest;
3464 /// let x = RewriteObjectRequest::new().set_if_generation_not_match(42);
3465 /// ```
3466 pub fn set_if_generation_not_match<T>(mut self, v: T) -> Self
3467 where
3468 T: std::convert::Into<i64>,
3469 {
3470 self.if_generation_not_match = std::option::Option::Some(v.into());
3471 self
3472 }
3473
3474 /// Sets or clears the value of [if_generation_not_match][crate::model::RewriteObjectRequest::if_generation_not_match].
3475 ///
3476 /// # Example
3477 /// ```ignore,no_run
3478 /// # use google_cloud_storage::model::RewriteObjectRequest;
3479 /// let x = RewriteObjectRequest::new().set_or_clear_if_generation_not_match(Some(42));
3480 /// let x = RewriteObjectRequest::new().set_or_clear_if_generation_not_match(None::<i32>);
3481 /// ```
3482 pub fn set_or_clear_if_generation_not_match<T>(mut self, v: std::option::Option<T>) -> Self
3483 where
3484 T: std::convert::Into<i64>,
3485 {
3486 self.if_generation_not_match = v.map(|x| x.into());
3487 self
3488 }
3489
3490 /// Sets the value of [if_metageneration_match][crate::model::RewriteObjectRequest::if_metageneration_match].
3491 ///
3492 /// # Example
3493 /// ```ignore,no_run
3494 /// # use google_cloud_storage::model::RewriteObjectRequest;
3495 /// let x = RewriteObjectRequest::new().set_if_metageneration_match(42);
3496 /// ```
3497 pub fn set_if_metageneration_match<T>(mut self, v: T) -> Self
3498 where
3499 T: std::convert::Into<i64>,
3500 {
3501 self.if_metageneration_match = std::option::Option::Some(v.into());
3502 self
3503 }
3504
3505 /// Sets or clears the value of [if_metageneration_match][crate::model::RewriteObjectRequest::if_metageneration_match].
3506 ///
3507 /// # Example
3508 /// ```ignore,no_run
3509 /// # use google_cloud_storage::model::RewriteObjectRequest;
3510 /// let x = RewriteObjectRequest::new().set_or_clear_if_metageneration_match(Some(42));
3511 /// let x = RewriteObjectRequest::new().set_or_clear_if_metageneration_match(None::<i32>);
3512 /// ```
3513 pub fn set_or_clear_if_metageneration_match<T>(mut self, v: std::option::Option<T>) -> Self
3514 where
3515 T: std::convert::Into<i64>,
3516 {
3517 self.if_metageneration_match = v.map(|x| x.into());
3518 self
3519 }
3520
3521 /// Sets the value of [if_metageneration_not_match][crate::model::RewriteObjectRequest::if_metageneration_not_match].
3522 ///
3523 /// # Example
3524 /// ```ignore,no_run
3525 /// # use google_cloud_storage::model::RewriteObjectRequest;
3526 /// let x = RewriteObjectRequest::new().set_if_metageneration_not_match(42);
3527 /// ```
3528 pub fn set_if_metageneration_not_match<T>(mut self, v: T) -> Self
3529 where
3530 T: std::convert::Into<i64>,
3531 {
3532 self.if_metageneration_not_match = std::option::Option::Some(v.into());
3533 self
3534 }
3535
3536 /// Sets or clears the value of [if_metageneration_not_match][crate::model::RewriteObjectRequest::if_metageneration_not_match].
3537 ///
3538 /// # Example
3539 /// ```ignore,no_run
3540 /// # use google_cloud_storage::model::RewriteObjectRequest;
3541 /// let x = RewriteObjectRequest::new().set_or_clear_if_metageneration_not_match(Some(42));
3542 /// let x = RewriteObjectRequest::new().set_or_clear_if_metageneration_not_match(None::<i32>);
3543 /// ```
3544 pub fn set_or_clear_if_metageneration_not_match<T>(mut self, v: std::option::Option<T>) -> Self
3545 where
3546 T: std::convert::Into<i64>,
3547 {
3548 self.if_metageneration_not_match = v.map(|x| x.into());
3549 self
3550 }
3551
3552 /// Sets the value of [if_source_generation_match][crate::model::RewriteObjectRequest::if_source_generation_match].
3553 ///
3554 /// # Example
3555 /// ```ignore,no_run
3556 /// # use google_cloud_storage::model::RewriteObjectRequest;
3557 /// let x = RewriteObjectRequest::new().set_if_source_generation_match(42);
3558 /// ```
3559 pub fn set_if_source_generation_match<T>(mut self, v: T) -> Self
3560 where
3561 T: std::convert::Into<i64>,
3562 {
3563 self.if_source_generation_match = std::option::Option::Some(v.into());
3564 self
3565 }
3566
3567 /// Sets or clears the value of [if_source_generation_match][crate::model::RewriteObjectRequest::if_source_generation_match].
3568 ///
3569 /// # Example
3570 /// ```ignore,no_run
3571 /// # use google_cloud_storage::model::RewriteObjectRequest;
3572 /// let x = RewriteObjectRequest::new().set_or_clear_if_source_generation_match(Some(42));
3573 /// let x = RewriteObjectRequest::new().set_or_clear_if_source_generation_match(None::<i32>);
3574 /// ```
3575 pub fn set_or_clear_if_source_generation_match<T>(mut self, v: std::option::Option<T>) -> Self
3576 where
3577 T: std::convert::Into<i64>,
3578 {
3579 self.if_source_generation_match = v.map(|x| x.into());
3580 self
3581 }
3582
3583 /// Sets the value of [if_source_generation_not_match][crate::model::RewriteObjectRequest::if_source_generation_not_match].
3584 ///
3585 /// # Example
3586 /// ```ignore,no_run
3587 /// # use google_cloud_storage::model::RewriteObjectRequest;
3588 /// let x = RewriteObjectRequest::new().set_if_source_generation_not_match(42);
3589 /// ```
3590 pub fn set_if_source_generation_not_match<T>(mut self, v: T) -> Self
3591 where
3592 T: std::convert::Into<i64>,
3593 {
3594 self.if_source_generation_not_match = std::option::Option::Some(v.into());
3595 self
3596 }
3597
3598 /// Sets or clears the value of [if_source_generation_not_match][crate::model::RewriteObjectRequest::if_source_generation_not_match].
3599 ///
3600 /// # Example
3601 /// ```ignore,no_run
3602 /// # use google_cloud_storage::model::RewriteObjectRequest;
3603 /// let x = RewriteObjectRequest::new().set_or_clear_if_source_generation_not_match(Some(42));
3604 /// let x = RewriteObjectRequest::new().set_or_clear_if_source_generation_not_match(None::<i32>);
3605 /// ```
3606 pub fn set_or_clear_if_source_generation_not_match<T>(
3607 mut self,
3608 v: std::option::Option<T>,
3609 ) -> Self
3610 where
3611 T: std::convert::Into<i64>,
3612 {
3613 self.if_source_generation_not_match = v.map(|x| x.into());
3614 self
3615 }
3616
3617 /// Sets the value of [if_source_metageneration_match][crate::model::RewriteObjectRequest::if_source_metageneration_match].
3618 ///
3619 /// # Example
3620 /// ```ignore,no_run
3621 /// # use google_cloud_storage::model::RewriteObjectRequest;
3622 /// let x = RewriteObjectRequest::new().set_if_source_metageneration_match(42);
3623 /// ```
3624 pub fn set_if_source_metageneration_match<T>(mut self, v: T) -> Self
3625 where
3626 T: std::convert::Into<i64>,
3627 {
3628 self.if_source_metageneration_match = std::option::Option::Some(v.into());
3629 self
3630 }
3631
3632 /// Sets or clears the value of [if_source_metageneration_match][crate::model::RewriteObjectRequest::if_source_metageneration_match].
3633 ///
3634 /// # Example
3635 /// ```ignore,no_run
3636 /// # use google_cloud_storage::model::RewriteObjectRequest;
3637 /// let x = RewriteObjectRequest::new().set_or_clear_if_source_metageneration_match(Some(42));
3638 /// let x = RewriteObjectRequest::new().set_or_clear_if_source_metageneration_match(None::<i32>);
3639 /// ```
3640 pub fn set_or_clear_if_source_metageneration_match<T>(
3641 mut self,
3642 v: std::option::Option<T>,
3643 ) -> Self
3644 where
3645 T: std::convert::Into<i64>,
3646 {
3647 self.if_source_metageneration_match = v.map(|x| x.into());
3648 self
3649 }
3650
3651 /// Sets the value of [if_source_metageneration_not_match][crate::model::RewriteObjectRequest::if_source_metageneration_not_match].
3652 ///
3653 /// # Example
3654 /// ```ignore,no_run
3655 /// # use google_cloud_storage::model::RewriteObjectRequest;
3656 /// let x = RewriteObjectRequest::new().set_if_source_metageneration_not_match(42);
3657 /// ```
3658 pub fn set_if_source_metageneration_not_match<T>(mut self, v: T) -> Self
3659 where
3660 T: std::convert::Into<i64>,
3661 {
3662 self.if_source_metageneration_not_match = std::option::Option::Some(v.into());
3663 self
3664 }
3665
3666 /// Sets or clears the value of [if_source_metageneration_not_match][crate::model::RewriteObjectRequest::if_source_metageneration_not_match].
3667 ///
3668 /// # Example
3669 /// ```ignore,no_run
3670 /// # use google_cloud_storage::model::RewriteObjectRequest;
3671 /// let x = RewriteObjectRequest::new().set_or_clear_if_source_metageneration_not_match(Some(42));
3672 /// let x = RewriteObjectRequest::new().set_or_clear_if_source_metageneration_not_match(None::<i32>);
3673 /// ```
3674 pub fn set_or_clear_if_source_metageneration_not_match<T>(
3675 mut self,
3676 v: std::option::Option<T>,
3677 ) -> Self
3678 where
3679 T: std::convert::Into<i64>,
3680 {
3681 self.if_source_metageneration_not_match = v.map(|x| x.into());
3682 self
3683 }
3684
3685 /// Sets the value of [max_bytes_rewritten_per_call][crate::model::RewriteObjectRequest::max_bytes_rewritten_per_call].
3686 ///
3687 /// # Example
3688 /// ```ignore,no_run
3689 /// # use google_cloud_storage::model::RewriteObjectRequest;
3690 /// let x = RewriteObjectRequest::new().set_max_bytes_rewritten_per_call(42);
3691 /// ```
3692 pub fn set_max_bytes_rewritten_per_call<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
3693 self.max_bytes_rewritten_per_call = v.into();
3694 self
3695 }
3696
3697 /// Sets the value of [copy_source_encryption_algorithm][crate::model::RewriteObjectRequest::copy_source_encryption_algorithm].
3698 ///
3699 /// # Example
3700 /// ```ignore,no_run
3701 /// # use google_cloud_storage::model::RewriteObjectRequest;
3702 /// let x = RewriteObjectRequest::new().set_copy_source_encryption_algorithm("example");
3703 /// ```
3704 pub fn set_copy_source_encryption_algorithm<T: std::convert::Into<std::string::String>>(
3705 mut self,
3706 v: T,
3707 ) -> Self {
3708 self.copy_source_encryption_algorithm = v.into();
3709 self
3710 }
3711
3712 /// Sets the value of [copy_source_encryption_key_bytes][crate::model::RewriteObjectRequest::copy_source_encryption_key_bytes].
3713 ///
3714 /// # Example
3715 /// ```ignore,no_run
3716 /// # use google_cloud_storage::model::RewriteObjectRequest;
3717 /// let x = RewriteObjectRequest::new().set_copy_source_encryption_key_bytes(bytes::Bytes::from_static(b"example"));
3718 /// ```
3719 pub fn set_copy_source_encryption_key_bytes<T: std::convert::Into<::bytes::Bytes>>(
3720 mut self,
3721 v: T,
3722 ) -> Self {
3723 self.copy_source_encryption_key_bytes = v.into();
3724 self
3725 }
3726
3727 /// Sets the value of [copy_source_encryption_key_sha256_bytes][crate::model::RewriteObjectRequest::copy_source_encryption_key_sha256_bytes].
3728 ///
3729 /// # Example
3730 /// ```ignore,no_run
3731 /// # use google_cloud_storage::model::RewriteObjectRequest;
3732 /// let x = RewriteObjectRequest::new().set_copy_source_encryption_key_sha256_bytes(bytes::Bytes::from_static(b"example"));
3733 /// ```
3734 pub fn set_copy_source_encryption_key_sha256_bytes<T: std::convert::Into<::bytes::Bytes>>(
3735 mut self,
3736 v: T,
3737 ) -> Self {
3738 self.copy_source_encryption_key_sha256_bytes = v.into();
3739 self
3740 }
3741
3742 /// Sets the value of [common_object_request_params][crate::model::RewriteObjectRequest::common_object_request_params].
3743 ///
3744 /// # Example
3745 /// ```ignore,no_run
3746 /// # use google_cloud_storage::model::RewriteObjectRequest;
3747 /// use google_cloud_storage::model::CommonObjectRequestParams;
3748 /// let x = RewriteObjectRequest::new().set_common_object_request_params(CommonObjectRequestParams::default()/* use setters */);
3749 /// ```
3750 pub fn set_common_object_request_params<T>(mut self, v: T) -> Self
3751 where
3752 T: std::convert::Into<crate::model::CommonObjectRequestParams>,
3753 {
3754 self.common_object_request_params = std::option::Option::Some(v.into());
3755 self
3756 }
3757
3758 /// Sets or clears the value of [common_object_request_params][crate::model::RewriteObjectRequest::common_object_request_params].
3759 ///
3760 /// # Example
3761 /// ```ignore,no_run
3762 /// # use google_cloud_storage::model::RewriteObjectRequest;
3763 /// use google_cloud_storage::model::CommonObjectRequestParams;
3764 /// let x = RewriteObjectRequest::new().set_or_clear_common_object_request_params(Some(CommonObjectRequestParams::default()/* use setters */));
3765 /// let x = RewriteObjectRequest::new().set_or_clear_common_object_request_params(None::<CommonObjectRequestParams>);
3766 /// ```
3767 pub fn set_or_clear_common_object_request_params<T>(mut self, v: std::option::Option<T>) -> Self
3768 where
3769 T: std::convert::Into<crate::model::CommonObjectRequestParams>,
3770 {
3771 self.common_object_request_params = v.map(|x| x.into());
3772 self
3773 }
3774
3775 /// Sets the value of [object_checksums][crate::model::RewriteObjectRequest::object_checksums].
3776 ///
3777 /// # Example
3778 /// ```ignore,no_run
3779 /// # use google_cloud_storage::model::RewriteObjectRequest;
3780 /// use google_cloud_storage::model::ObjectChecksums;
3781 /// let x = RewriteObjectRequest::new().set_object_checksums(ObjectChecksums::default()/* use setters */);
3782 /// ```
3783 pub fn set_object_checksums<T>(mut self, v: T) -> Self
3784 where
3785 T: std::convert::Into<crate::model::ObjectChecksums>,
3786 {
3787 self.object_checksums = std::option::Option::Some(v.into());
3788 self
3789 }
3790
3791 /// Sets or clears the value of [object_checksums][crate::model::RewriteObjectRequest::object_checksums].
3792 ///
3793 /// # Example
3794 /// ```ignore,no_run
3795 /// # use google_cloud_storage::model::RewriteObjectRequest;
3796 /// use google_cloud_storage::model::ObjectChecksums;
3797 /// let x = RewriteObjectRequest::new().set_or_clear_object_checksums(Some(ObjectChecksums::default()/* use setters */));
3798 /// let x = RewriteObjectRequest::new().set_or_clear_object_checksums(None::<ObjectChecksums>);
3799 /// ```
3800 pub fn set_or_clear_object_checksums<T>(mut self, v: std::option::Option<T>) -> Self
3801 where
3802 T: std::convert::Into<crate::model::ObjectChecksums>,
3803 {
3804 self.object_checksums = v.map(|x| x.into());
3805 self
3806 }
3807}
3808
3809impl wkt::message::Message for RewriteObjectRequest {
3810 fn typename() -> &'static str {
3811 "type.googleapis.com/google.storage.v2.RewriteObjectRequest"
3812 }
3813}
3814
3815/// A rewrite response.
3816#[derive(Clone, Default, PartialEq)]
3817#[non_exhaustive]
3818pub struct RewriteResponse {
3819 /// The total bytes written so far, which can be used to provide a waiting user
3820 /// with a progress indicator. This property is always present in the response.
3821 pub total_bytes_rewritten: i64,
3822
3823 /// The total size of the object being copied in bytes. This property is always
3824 /// present in the response.
3825 pub object_size: i64,
3826
3827 /// `true` if the copy is finished; otherwise, `false` if
3828 /// the copy is in progress. This property is always present in the response.
3829 pub done: bool,
3830
3831 /// A token to use in subsequent requests to continue copying data. This token
3832 /// is present in the response only when there is more data to copy.
3833 pub rewrite_token: std::string::String,
3834
3835 /// A resource containing the metadata for the copied-to object. This property
3836 /// is present in the response only when copying completes.
3837 pub resource: std::option::Option<crate::model::Object>,
3838
3839 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3840}
3841
3842impl RewriteResponse {
3843 pub fn new() -> Self {
3844 std::default::Default::default()
3845 }
3846
3847 /// Sets the value of [total_bytes_rewritten][crate::model::RewriteResponse::total_bytes_rewritten].
3848 ///
3849 /// # Example
3850 /// ```ignore,no_run
3851 /// # use google_cloud_storage::model::RewriteResponse;
3852 /// let x = RewriteResponse::new().set_total_bytes_rewritten(42);
3853 /// ```
3854 pub fn set_total_bytes_rewritten<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
3855 self.total_bytes_rewritten = v.into();
3856 self
3857 }
3858
3859 /// Sets the value of [object_size][crate::model::RewriteResponse::object_size].
3860 ///
3861 /// # Example
3862 /// ```ignore,no_run
3863 /// # use google_cloud_storage::model::RewriteResponse;
3864 /// let x = RewriteResponse::new().set_object_size(42);
3865 /// ```
3866 pub fn set_object_size<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
3867 self.object_size = v.into();
3868 self
3869 }
3870
3871 /// Sets the value of [done][crate::model::RewriteResponse::done].
3872 ///
3873 /// # Example
3874 /// ```ignore,no_run
3875 /// # use google_cloud_storage::model::RewriteResponse;
3876 /// let x = RewriteResponse::new().set_done(true);
3877 /// ```
3878 pub fn set_done<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
3879 self.done = v.into();
3880 self
3881 }
3882
3883 /// Sets the value of [rewrite_token][crate::model::RewriteResponse::rewrite_token].
3884 ///
3885 /// # Example
3886 /// ```ignore,no_run
3887 /// # use google_cloud_storage::model::RewriteResponse;
3888 /// let x = RewriteResponse::new().set_rewrite_token("example");
3889 /// ```
3890 pub fn set_rewrite_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3891 self.rewrite_token = v.into();
3892 self
3893 }
3894
3895 /// Sets the value of [resource][crate::model::RewriteResponse::resource].
3896 ///
3897 /// # Example
3898 /// ```ignore,no_run
3899 /// # use google_cloud_storage::model::RewriteResponse;
3900 /// use google_cloud_storage::model::Object;
3901 /// let x = RewriteResponse::new().set_resource(Object::default()/* use setters */);
3902 /// ```
3903 pub fn set_resource<T>(mut self, v: T) -> Self
3904 where
3905 T: std::convert::Into<crate::model::Object>,
3906 {
3907 self.resource = std::option::Option::Some(v.into());
3908 self
3909 }
3910
3911 /// Sets or clears the value of [resource][crate::model::RewriteResponse::resource].
3912 ///
3913 /// # Example
3914 /// ```ignore,no_run
3915 /// # use google_cloud_storage::model::RewriteResponse;
3916 /// use google_cloud_storage::model::Object;
3917 /// let x = RewriteResponse::new().set_or_clear_resource(Some(Object::default()/* use setters */));
3918 /// let x = RewriteResponse::new().set_or_clear_resource(None::<Object>);
3919 /// ```
3920 pub fn set_or_clear_resource<T>(mut self, v: std::option::Option<T>) -> Self
3921 where
3922 T: std::convert::Into<crate::model::Object>,
3923 {
3924 self.resource = v.map(|x| x.into());
3925 self
3926 }
3927}
3928
3929impl wkt::message::Message for RewriteResponse {
3930 fn typename() -> &'static str {
3931 "type.googleapis.com/google.storage.v2.RewriteResponse"
3932 }
3933}
3934
3935/// Request message for [MoveObject][google.storage.v2.Storage.MoveObject].
3936///
3937/// [google.storage.v2.Storage.MoveObject]: crate::client::StorageControl::move_object
3938#[derive(Clone, Default, PartialEq)]
3939#[non_exhaustive]
3940pub struct MoveObjectRequest {
3941 /// Required. Name of the bucket in which the object resides.
3942 pub bucket: std::string::String,
3943
3944 /// Required. Name of the source object.
3945 pub source_object: std::string::String,
3946
3947 /// Required. Name of the destination object.
3948 pub destination_object: std::string::String,
3949
3950 /// Optional. Makes the operation conditional on whether the source object's
3951 /// current generation matches the given value. `if_source_generation_match`
3952 /// and `if_source_generation_not_match` conditions are mutually exclusive:
3953 /// it's an error for both of them to be set in the request.
3954 pub if_source_generation_match: std::option::Option<i64>,
3955
3956 /// Optional. Makes the operation conditional on whether the source object's
3957 /// current generation does not match the given value.
3958 /// `if_source_generation_match` and `if_source_generation_not_match`
3959 /// conditions are mutually exclusive: it's an error for both of them to be set
3960 /// in the request.
3961 pub if_source_generation_not_match: std::option::Option<i64>,
3962
3963 /// Optional. Makes the operation conditional on whether the source object's
3964 /// current metageneration matches the given value.
3965 /// `if_source_metageneration_match` and `if_source_metageneration_not_match`
3966 /// conditions are mutually exclusive: it's an error for both of them to be set
3967 /// in the request.
3968 pub if_source_metageneration_match: std::option::Option<i64>,
3969
3970 /// Optional. Makes the operation conditional on whether the source object's
3971 /// current metageneration does not match the given value.
3972 /// `if_source_metageneration_match` and `if_source_metageneration_not_match`
3973 /// conditions are mutually exclusive: it's an error for both of them to be set
3974 /// in the request.
3975 pub if_source_metageneration_not_match: std::option::Option<i64>,
3976
3977 /// Optional. Makes the operation conditional on whether the destination
3978 /// object's current generation matches the given value. Setting to 0 makes the
3979 /// operation succeed only if there are no live versions of the object.
3980 /// `if_generation_match` and `if_generation_not_match` conditions are mutually
3981 /// exclusive: it's an error for both of them to be set in the request.
3982 pub if_generation_match: std::option::Option<i64>,
3983
3984 /// Optional. Makes the operation conditional on whether the destination
3985 /// object's current generation does not match the given value. If no live
3986 /// object exists, the precondition fails. Setting to 0 makes the operation
3987 /// succeed only if there is a live version of the object.
3988 /// `if_generation_match` and `if_generation_not_match` conditions are mutually
3989 /// exclusive: it's an error for both of them to be set in the request.
3990 pub if_generation_not_match: std::option::Option<i64>,
3991
3992 /// Optional. Makes the operation conditional on whether the destination
3993 /// object's current metageneration matches the given value.
3994 /// `if_metageneration_match` and `if_metageneration_not_match` conditions are
3995 /// mutually exclusive: it's an error for both of them to be set in the
3996 /// request.
3997 pub if_metageneration_match: std::option::Option<i64>,
3998
3999 /// Optional. Makes the operation conditional on whether the destination
4000 /// object's current metageneration does not match the given value.
4001 /// `if_metageneration_match` and `if_metageneration_not_match` conditions are
4002 /// mutually exclusive: it's an error for both of them to be set in the
4003 /// request.
4004 pub if_metageneration_not_match: std::option::Option<i64>,
4005
4006 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4007}
4008
4009impl MoveObjectRequest {
4010 pub fn new() -> Self {
4011 std::default::Default::default()
4012 }
4013
4014 /// Sets the value of [bucket][crate::model::MoveObjectRequest::bucket].
4015 ///
4016 /// # Example
4017 /// ```ignore,no_run
4018 /// # use google_cloud_storage::model::MoveObjectRequest;
4019 /// let x = MoveObjectRequest::new().set_bucket("example");
4020 /// ```
4021 pub fn set_bucket<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4022 self.bucket = v.into();
4023 self
4024 }
4025
4026 /// Sets the value of [source_object][crate::model::MoveObjectRequest::source_object].
4027 ///
4028 /// # Example
4029 /// ```ignore,no_run
4030 /// # use google_cloud_storage::model::MoveObjectRequest;
4031 /// let x = MoveObjectRequest::new().set_source_object("example");
4032 /// ```
4033 pub fn set_source_object<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4034 self.source_object = v.into();
4035 self
4036 }
4037
4038 /// Sets the value of [destination_object][crate::model::MoveObjectRequest::destination_object].
4039 ///
4040 /// # Example
4041 /// ```ignore,no_run
4042 /// # use google_cloud_storage::model::MoveObjectRequest;
4043 /// let x = MoveObjectRequest::new().set_destination_object("example");
4044 /// ```
4045 pub fn set_destination_object<T: std::convert::Into<std::string::String>>(
4046 mut self,
4047 v: T,
4048 ) -> Self {
4049 self.destination_object = v.into();
4050 self
4051 }
4052
4053 /// Sets the value of [if_source_generation_match][crate::model::MoveObjectRequest::if_source_generation_match].
4054 ///
4055 /// # Example
4056 /// ```ignore,no_run
4057 /// # use google_cloud_storage::model::MoveObjectRequest;
4058 /// let x = MoveObjectRequest::new().set_if_source_generation_match(42);
4059 /// ```
4060 pub fn set_if_source_generation_match<T>(mut self, v: T) -> Self
4061 where
4062 T: std::convert::Into<i64>,
4063 {
4064 self.if_source_generation_match = std::option::Option::Some(v.into());
4065 self
4066 }
4067
4068 /// Sets or clears the value of [if_source_generation_match][crate::model::MoveObjectRequest::if_source_generation_match].
4069 ///
4070 /// # Example
4071 /// ```ignore,no_run
4072 /// # use google_cloud_storage::model::MoveObjectRequest;
4073 /// let x = MoveObjectRequest::new().set_or_clear_if_source_generation_match(Some(42));
4074 /// let x = MoveObjectRequest::new().set_or_clear_if_source_generation_match(None::<i32>);
4075 /// ```
4076 pub fn set_or_clear_if_source_generation_match<T>(mut self, v: std::option::Option<T>) -> Self
4077 where
4078 T: std::convert::Into<i64>,
4079 {
4080 self.if_source_generation_match = v.map(|x| x.into());
4081 self
4082 }
4083
4084 /// Sets the value of [if_source_generation_not_match][crate::model::MoveObjectRequest::if_source_generation_not_match].
4085 ///
4086 /// # Example
4087 /// ```ignore,no_run
4088 /// # use google_cloud_storage::model::MoveObjectRequest;
4089 /// let x = MoveObjectRequest::new().set_if_source_generation_not_match(42);
4090 /// ```
4091 pub fn set_if_source_generation_not_match<T>(mut self, v: T) -> Self
4092 where
4093 T: std::convert::Into<i64>,
4094 {
4095 self.if_source_generation_not_match = std::option::Option::Some(v.into());
4096 self
4097 }
4098
4099 /// Sets or clears the value of [if_source_generation_not_match][crate::model::MoveObjectRequest::if_source_generation_not_match].
4100 ///
4101 /// # Example
4102 /// ```ignore,no_run
4103 /// # use google_cloud_storage::model::MoveObjectRequest;
4104 /// let x = MoveObjectRequest::new().set_or_clear_if_source_generation_not_match(Some(42));
4105 /// let x = MoveObjectRequest::new().set_or_clear_if_source_generation_not_match(None::<i32>);
4106 /// ```
4107 pub fn set_or_clear_if_source_generation_not_match<T>(
4108 mut self,
4109 v: std::option::Option<T>,
4110 ) -> Self
4111 where
4112 T: std::convert::Into<i64>,
4113 {
4114 self.if_source_generation_not_match = v.map(|x| x.into());
4115 self
4116 }
4117
4118 /// Sets the value of [if_source_metageneration_match][crate::model::MoveObjectRequest::if_source_metageneration_match].
4119 ///
4120 /// # Example
4121 /// ```ignore,no_run
4122 /// # use google_cloud_storage::model::MoveObjectRequest;
4123 /// let x = MoveObjectRequest::new().set_if_source_metageneration_match(42);
4124 /// ```
4125 pub fn set_if_source_metageneration_match<T>(mut self, v: T) -> Self
4126 where
4127 T: std::convert::Into<i64>,
4128 {
4129 self.if_source_metageneration_match = std::option::Option::Some(v.into());
4130 self
4131 }
4132
4133 /// Sets or clears the value of [if_source_metageneration_match][crate::model::MoveObjectRequest::if_source_metageneration_match].
4134 ///
4135 /// # Example
4136 /// ```ignore,no_run
4137 /// # use google_cloud_storage::model::MoveObjectRequest;
4138 /// let x = MoveObjectRequest::new().set_or_clear_if_source_metageneration_match(Some(42));
4139 /// let x = MoveObjectRequest::new().set_or_clear_if_source_metageneration_match(None::<i32>);
4140 /// ```
4141 pub fn set_or_clear_if_source_metageneration_match<T>(
4142 mut self,
4143 v: std::option::Option<T>,
4144 ) -> Self
4145 where
4146 T: std::convert::Into<i64>,
4147 {
4148 self.if_source_metageneration_match = v.map(|x| x.into());
4149 self
4150 }
4151
4152 /// Sets the value of [if_source_metageneration_not_match][crate::model::MoveObjectRequest::if_source_metageneration_not_match].
4153 ///
4154 /// # Example
4155 /// ```ignore,no_run
4156 /// # use google_cloud_storage::model::MoveObjectRequest;
4157 /// let x = MoveObjectRequest::new().set_if_source_metageneration_not_match(42);
4158 /// ```
4159 pub fn set_if_source_metageneration_not_match<T>(mut self, v: T) -> Self
4160 where
4161 T: std::convert::Into<i64>,
4162 {
4163 self.if_source_metageneration_not_match = std::option::Option::Some(v.into());
4164 self
4165 }
4166
4167 /// Sets or clears the value of [if_source_metageneration_not_match][crate::model::MoveObjectRequest::if_source_metageneration_not_match].
4168 ///
4169 /// # Example
4170 /// ```ignore,no_run
4171 /// # use google_cloud_storage::model::MoveObjectRequest;
4172 /// let x = MoveObjectRequest::new().set_or_clear_if_source_metageneration_not_match(Some(42));
4173 /// let x = MoveObjectRequest::new().set_or_clear_if_source_metageneration_not_match(None::<i32>);
4174 /// ```
4175 pub fn set_or_clear_if_source_metageneration_not_match<T>(
4176 mut self,
4177 v: std::option::Option<T>,
4178 ) -> Self
4179 where
4180 T: std::convert::Into<i64>,
4181 {
4182 self.if_source_metageneration_not_match = v.map(|x| x.into());
4183 self
4184 }
4185
4186 /// Sets the value of [if_generation_match][crate::model::MoveObjectRequest::if_generation_match].
4187 ///
4188 /// # Example
4189 /// ```ignore,no_run
4190 /// # use google_cloud_storage::model::MoveObjectRequest;
4191 /// let x = MoveObjectRequest::new().set_if_generation_match(42);
4192 /// ```
4193 pub fn set_if_generation_match<T>(mut self, v: T) -> Self
4194 where
4195 T: std::convert::Into<i64>,
4196 {
4197 self.if_generation_match = std::option::Option::Some(v.into());
4198 self
4199 }
4200
4201 /// Sets or clears the value of [if_generation_match][crate::model::MoveObjectRequest::if_generation_match].
4202 ///
4203 /// # Example
4204 /// ```ignore,no_run
4205 /// # use google_cloud_storage::model::MoveObjectRequest;
4206 /// let x = MoveObjectRequest::new().set_or_clear_if_generation_match(Some(42));
4207 /// let x = MoveObjectRequest::new().set_or_clear_if_generation_match(None::<i32>);
4208 /// ```
4209 pub fn set_or_clear_if_generation_match<T>(mut self, v: std::option::Option<T>) -> Self
4210 where
4211 T: std::convert::Into<i64>,
4212 {
4213 self.if_generation_match = v.map(|x| x.into());
4214 self
4215 }
4216
4217 /// Sets the value of [if_generation_not_match][crate::model::MoveObjectRequest::if_generation_not_match].
4218 ///
4219 /// # Example
4220 /// ```ignore,no_run
4221 /// # use google_cloud_storage::model::MoveObjectRequest;
4222 /// let x = MoveObjectRequest::new().set_if_generation_not_match(42);
4223 /// ```
4224 pub fn set_if_generation_not_match<T>(mut self, v: T) -> Self
4225 where
4226 T: std::convert::Into<i64>,
4227 {
4228 self.if_generation_not_match = std::option::Option::Some(v.into());
4229 self
4230 }
4231
4232 /// Sets or clears the value of [if_generation_not_match][crate::model::MoveObjectRequest::if_generation_not_match].
4233 ///
4234 /// # Example
4235 /// ```ignore,no_run
4236 /// # use google_cloud_storage::model::MoveObjectRequest;
4237 /// let x = MoveObjectRequest::new().set_or_clear_if_generation_not_match(Some(42));
4238 /// let x = MoveObjectRequest::new().set_or_clear_if_generation_not_match(None::<i32>);
4239 /// ```
4240 pub fn set_or_clear_if_generation_not_match<T>(mut self, v: std::option::Option<T>) -> Self
4241 where
4242 T: std::convert::Into<i64>,
4243 {
4244 self.if_generation_not_match = v.map(|x| x.into());
4245 self
4246 }
4247
4248 /// Sets the value of [if_metageneration_match][crate::model::MoveObjectRequest::if_metageneration_match].
4249 ///
4250 /// # Example
4251 /// ```ignore,no_run
4252 /// # use google_cloud_storage::model::MoveObjectRequest;
4253 /// let x = MoveObjectRequest::new().set_if_metageneration_match(42);
4254 /// ```
4255 pub fn set_if_metageneration_match<T>(mut self, v: T) -> Self
4256 where
4257 T: std::convert::Into<i64>,
4258 {
4259 self.if_metageneration_match = std::option::Option::Some(v.into());
4260 self
4261 }
4262
4263 /// Sets or clears the value of [if_metageneration_match][crate::model::MoveObjectRequest::if_metageneration_match].
4264 ///
4265 /// # Example
4266 /// ```ignore,no_run
4267 /// # use google_cloud_storage::model::MoveObjectRequest;
4268 /// let x = MoveObjectRequest::new().set_or_clear_if_metageneration_match(Some(42));
4269 /// let x = MoveObjectRequest::new().set_or_clear_if_metageneration_match(None::<i32>);
4270 /// ```
4271 pub fn set_or_clear_if_metageneration_match<T>(mut self, v: std::option::Option<T>) -> Self
4272 where
4273 T: std::convert::Into<i64>,
4274 {
4275 self.if_metageneration_match = v.map(|x| x.into());
4276 self
4277 }
4278
4279 /// Sets the value of [if_metageneration_not_match][crate::model::MoveObjectRequest::if_metageneration_not_match].
4280 ///
4281 /// # Example
4282 /// ```ignore,no_run
4283 /// # use google_cloud_storage::model::MoveObjectRequest;
4284 /// let x = MoveObjectRequest::new().set_if_metageneration_not_match(42);
4285 /// ```
4286 pub fn set_if_metageneration_not_match<T>(mut self, v: T) -> Self
4287 where
4288 T: std::convert::Into<i64>,
4289 {
4290 self.if_metageneration_not_match = std::option::Option::Some(v.into());
4291 self
4292 }
4293
4294 /// Sets or clears the value of [if_metageneration_not_match][crate::model::MoveObjectRequest::if_metageneration_not_match].
4295 ///
4296 /// # Example
4297 /// ```ignore,no_run
4298 /// # use google_cloud_storage::model::MoveObjectRequest;
4299 /// let x = MoveObjectRequest::new().set_or_clear_if_metageneration_not_match(Some(42));
4300 /// let x = MoveObjectRequest::new().set_or_clear_if_metageneration_not_match(None::<i32>);
4301 /// ```
4302 pub fn set_or_clear_if_metageneration_not_match<T>(mut self, v: std::option::Option<T>) -> Self
4303 where
4304 T: std::convert::Into<i64>,
4305 {
4306 self.if_metageneration_not_match = v.map(|x| x.into());
4307 self
4308 }
4309}
4310
4311impl wkt::message::Message for MoveObjectRequest {
4312 fn typename() -> &'static str {
4313 "type.googleapis.com/google.storage.v2.MoveObjectRequest"
4314 }
4315}
4316
4317/// Request message for [UpdateObject][google.storage.v2.Storage.UpdateObject].
4318///
4319/// [google.storage.v2.Storage.UpdateObject]: crate::client::StorageControl::update_object
4320#[derive(Clone, Default, PartialEq)]
4321#[non_exhaustive]
4322pub struct UpdateObjectRequest {
4323 /// Required. The object to update.
4324 /// The object's bucket and name fields are used to identify the object to
4325 /// update. If present, the object's generation field selects a specific
4326 /// revision of this object whose metadata should be updated. Otherwise,
4327 /// assumes the live version of the object.
4328 pub object: std::option::Option<crate::model::Object>,
4329
4330 /// Makes the operation conditional on whether the object's current generation
4331 /// matches the given value. Setting to 0 makes the operation succeed only if
4332 /// there are no live versions of the object.
4333 pub if_generation_match: std::option::Option<i64>,
4334
4335 /// Makes the operation conditional on whether the object's live generation
4336 /// does not match the given value. If no live object exists, the precondition
4337 /// fails. Setting to 0 makes the operation succeed only if there is a live
4338 /// version of the object.
4339 pub if_generation_not_match: std::option::Option<i64>,
4340
4341 /// Makes the operation conditional on whether the object's current
4342 /// metageneration matches the given value.
4343 pub if_metageneration_match: std::option::Option<i64>,
4344
4345 /// Makes the operation conditional on whether the object's current
4346 /// metageneration does not match the given value.
4347 pub if_metageneration_not_match: std::option::Option<i64>,
4348
4349 /// Optional. Apply a predefined set of access controls to this object.
4350 /// Valid values are "authenticatedRead", "bucketOwnerFullControl",
4351 /// "bucketOwnerRead", "private", "projectPrivate", or "publicRead".
4352 pub predefined_acl: std::string::String,
4353
4354 /// Required. List of fields to be updated.
4355 ///
4356 /// To specify ALL fields, equivalent to the JSON API's "update" function,
4357 /// specify a single field with the value `*`. Note: not recommended. If a new
4358 /// field is introduced at a later time, an older client updating with the `*`
4359 /// might accidentally reset the new field's value.
4360 ///
4361 /// Not specifying any fields is an error.
4362 pub update_mask: std::option::Option<wkt::FieldMask>,
4363
4364 /// Optional. A set of parameters common to Storage API requests concerning an
4365 /// object.
4366 pub common_object_request_params: std::option::Option<crate::model::CommonObjectRequestParams>,
4367
4368 /// Optional. Overrides the unlocked retention config on the object.
4369 pub override_unlocked_retention: bool,
4370
4371 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4372}
4373
4374impl UpdateObjectRequest {
4375 pub fn new() -> Self {
4376 std::default::Default::default()
4377 }
4378
4379 /// Sets the value of [object][crate::model::UpdateObjectRequest::object].
4380 ///
4381 /// # Example
4382 /// ```ignore,no_run
4383 /// # use google_cloud_storage::model::UpdateObjectRequest;
4384 /// use google_cloud_storage::model::Object;
4385 /// let x = UpdateObjectRequest::new().set_object(Object::default()/* use setters */);
4386 /// ```
4387 pub fn set_object<T>(mut self, v: T) -> Self
4388 where
4389 T: std::convert::Into<crate::model::Object>,
4390 {
4391 self.object = std::option::Option::Some(v.into());
4392 self
4393 }
4394
4395 /// Sets or clears the value of [object][crate::model::UpdateObjectRequest::object].
4396 ///
4397 /// # Example
4398 /// ```ignore,no_run
4399 /// # use google_cloud_storage::model::UpdateObjectRequest;
4400 /// use google_cloud_storage::model::Object;
4401 /// let x = UpdateObjectRequest::new().set_or_clear_object(Some(Object::default()/* use setters */));
4402 /// let x = UpdateObjectRequest::new().set_or_clear_object(None::<Object>);
4403 /// ```
4404 pub fn set_or_clear_object<T>(mut self, v: std::option::Option<T>) -> Self
4405 where
4406 T: std::convert::Into<crate::model::Object>,
4407 {
4408 self.object = v.map(|x| x.into());
4409 self
4410 }
4411
4412 /// Sets the value of [if_generation_match][crate::model::UpdateObjectRequest::if_generation_match].
4413 ///
4414 /// # Example
4415 /// ```ignore,no_run
4416 /// # use google_cloud_storage::model::UpdateObjectRequest;
4417 /// let x = UpdateObjectRequest::new().set_if_generation_match(42);
4418 /// ```
4419 pub fn set_if_generation_match<T>(mut self, v: T) -> Self
4420 where
4421 T: std::convert::Into<i64>,
4422 {
4423 self.if_generation_match = std::option::Option::Some(v.into());
4424 self
4425 }
4426
4427 /// Sets or clears the value of [if_generation_match][crate::model::UpdateObjectRequest::if_generation_match].
4428 ///
4429 /// # Example
4430 /// ```ignore,no_run
4431 /// # use google_cloud_storage::model::UpdateObjectRequest;
4432 /// let x = UpdateObjectRequest::new().set_or_clear_if_generation_match(Some(42));
4433 /// let x = UpdateObjectRequest::new().set_or_clear_if_generation_match(None::<i32>);
4434 /// ```
4435 pub fn set_or_clear_if_generation_match<T>(mut self, v: std::option::Option<T>) -> Self
4436 where
4437 T: std::convert::Into<i64>,
4438 {
4439 self.if_generation_match = v.map(|x| x.into());
4440 self
4441 }
4442
4443 /// Sets the value of [if_generation_not_match][crate::model::UpdateObjectRequest::if_generation_not_match].
4444 ///
4445 /// # Example
4446 /// ```ignore,no_run
4447 /// # use google_cloud_storage::model::UpdateObjectRequest;
4448 /// let x = UpdateObjectRequest::new().set_if_generation_not_match(42);
4449 /// ```
4450 pub fn set_if_generation_not_match<T>(mut self, v: T) -> Self
4451 where
4452 T: std::convert::Into<i64>,
4453 {
4454 self.if_generation_not_match = std::option::Option::Some(v.into());
4455 self
4456 }
4457
4458 /// Sets or clears the value of [if_generation_not_match][crate::model::UpdateObjectRequest::if_generation_not_match].
4459 ///
4460 /// # Example
4461 /// ```ignore,no_run
4462 /// # use google_cloud_storage::model::UpdateObjectRequest;
4463 /// let x = UpdateObjectRequest::new().set_or_clear_if_generation_not_match(Some(42));
4464 /// let x = UpdateObjectRequest::new().set_or_clear_if_generation_not_match(None::<i32>);
4465 /// ```
4466 pub fn set_or_clear_if_generation_not_match<T>(mut self, v: std::option::Option<T>) -> Self
4467 where
4468 T: std::convert::Into<i64>,
4469 {
4470 self.if_generation_not_match = v.map(|x| x.into());
4471 self
4472 }
4473
4474 /// Sets the value of [if_metageneration_match][crate::model::UpdateObjectRequest::if_metageneration_match].
4475 ///
4476 /// # Example
4477 /// ```ignore,no_run
4478 /// # use google_cloud_storage::model::UpdateObjectRequest;
4479 /// let x = UpdateObjectRequest::new().set_if_metageneration_match(42);
4480 /// ```
4481 pub fn set_if_metageneration_match<T>(mut self, v: T) -> Self
4482 where
4483 T: std::convert::Into<i64>,
4484 {
4485 self.if_metageneration_match = std::option::Option::Some(v.into());
4486 self
4487 }
4488
4489 /// Sets or clears the value of [if_metageneration_match][crate::model::UpdateObjectRequest::if_metageneration_match].
4490 ///
4491 /// # Example
4492 /// ```ignore,no_run
4493 /// # use google_cloud_storage::model::UpdateObjectRequest;
4494 /// let x = UpdateObjectRequest::new().set_or_clear_if_metageneration_match(Some(42));
4495 /// let x = UpdateObjectRequest::new().set_or_clear_if_metageneration_match(None::<i32>);
4496 /// ```
4497 pub fn set_or_clear_if_metageneration_match<T>(mut self, v: std::option::Option<T>) -> Self
4498 where
4499 T: std::convert::Into<i64>,
4500 {
4501 self.if_metageneration_match = v.map(|x| x.into());
4502 self
4503 }
4504
4505 /// Sets the value of [if_metageneration_not_match][crate::model::UpdateObjectRequest::if_metageneration_not_match].
4506 ///
4507 /// # Example
4508 /// ```ignore,no_run
4509 /// # use google_cloud_storage::model::UpdateObjectRequest;
4510 /// let x = UpdateObjectRequest::new().set_if_metageneration_not_match(42);
4511 /// ```
4512 pub fn set_if_metageneration_not_match<T>(mut self, v: T) -> Self
4513 where
4514 T: std::convert::Into<i64>,
4515 {
4516 self.if_metageneration_not_match = std::option::Option::Some(v.into());
4517 self
4518 }
4519
4520 /// Sets or clears the value of [if_metageneration_not_match][crate::model::UpdateObjectRequest::if_metageneration_not_match].
4521 ///
4522 /// # Example
4523 /// ```ignore,no_run
4524 /// # use google_cloud_storage::model::UpdateObjectRequest;
4525 /// let x = UpdateObjectRequest::new().set_or_clear_if_metageneration_not_match(Some(42));
4526 /// let x = UpdateObjectRequest::new().set_or_clear_if_metageneration_not_match(None::<i32>);
4527 /// ```
4528 pub fn set_or_clear_if_metageneration_not_match<T>(mut self, v: std::option::Option<T>) -> Self
4529 where
4530 T: std::convert::Into<i64>,
4531 {
4532 self.if_metageneration_not_match = v.map(|x| x.into());
4533 self
4534 }
4535
4536 /// Sets the value of [predefined_acl][crate::model::UpdateObjectRequest::predefined_acl].
4537 ///
4538 /// # Example
4539 /// ```ignore,no_run
4540 /// # use google_cloud_storage::model::UpdateObjectRequest;
4541 /// let x = UpdateObjectRequest::new().set_predefined_acl("example");
4542 /// ```
4543 pub fn set_predefined_acl<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4544 self.predefined_acl = v.into();
4545 self
4546 }
4547
4548 /// Sets the value of [update_mask][crate::model::UpdateObjectRequest::update_mask].
4549 ///
4550 /// # Example
4551 /// ```ignore,no_run
4552 /// # use google_cloud_storage::model::UpdateObjectRequest;
4553 /// use wkt::FieldMask;
4554 /// let x = UpdateObjectRequest::new().set_update_mask(FieldMask::default()/* use setters */);
4555 /// ```
4556 pub fn set_update_mask<T>(mut self, v: T) -> Self
4557 where
4558 T: std::convert::Into<wkt::FieldMask>,
4559 {
4560 self.update_mask = std::option::Option::Some(v.into());
4561 self
4562 }
4563
4564 /// Sets or clears the value of [update_mask][crate::model::UpdateObjectRequest::update_mask].
4565 ///
4566 /// # Example
4567 /// ```ignore,no_run
4568 /// # use google_cloud_storage::model::UpdateObjectRequest;
4569 /// use wkt::FieldMask;
4570 /// let x = UpdateObjectRequest::new().set_or_clear_update_mask(Some(FieldMask::default()/* use setters */));
4571 /// let x = UpdateObjectRequest::new().set_or_clear_update_mask(None::<FieldMask>);
4572 /// ```
4573 pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
4574 where
4575 T: std::convert::Into<wkt::FieldMask>,
4576 {
4577 self.update_mask = v.map(|x| x.into());
4578 self
4579 }
4580
4581 /// Sets the value of [common_object_request_params][crate::model::UpdateObjectRequest::common_object_request_params].
4582 ///
4583 /// # Example
4584 /// ```ignore,no_run
4585 /// # use google_cloud_storage::model::UpdateObjectRequest;
4586 /// use google_cloud_storage::model::CommonObjectRequestParams;
4587 /// let x = UpdateObjectRequest::new().set_common_object_request_params(CommonObjectRequestParams::default()/* use setters */);
4588 /// ```
4589 pub fn set_common_object_request_params<T>(mut self, v: T) -> Self
4590 where
4591 T: std::convert::Into<crate::model::CommonObjectRequestParams>,
4592 {
4593 self.common_object_request_params = std::option::Option::Some(v.into());
4594 self
4595 }
4596
4597 /// Sets or clears the value of [common_object_request_params][crate::model::UpdateObjectRequest::common_object_request_params].
4598 ///
4599 /// # Example
4600 /// ```ignore,no_run
4601 /// # use google_cloud_storage::model::UpdateObjectRequest;
4602 /// use google_cloud_storage::model::CommonObjectRequestParams;
4603 /// let x = UpdateObjectRequest::new().set_or_clear_common_object_request_params(Some(CommonObjectRequestParams::default()/* use setters */));
4604 /// let x = UpdateObjectRequest::new().set_or_clear_common_object_request_params(None::<CommonObjectRequestParams>);
4605 /// ```
4606 pub fn set_or_clear_common_object_request_params<T>(mut self, v: std::option::Option<T>) -> Self
4607 where
4608 T: std::convert::Into<crate::model::CommonObjectRequestParams>,
4609 {
4610 self.common_object_request_params = v.map(|x| x.into());
4611 self
4612 }
4613
4614 /// Sets the value of [override_unlocked_retention][crate::model::UpdateObjectRequest::override_unlocked_retention].
4615 ///
4616 /// # Example
4617 /// ```ignore,no_run
4618 /// # use google_cloud_storage::model::UpdateObjectRequest;
4619 /// let x = UpdateObjectRequest::new().set_override_unlocked_retention(true);
4620 /// ```
4621 pub fn set_override_unlocked_retention<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
4622 self.override_unlocked_retention = v.into();
4623 self
4624 }
4625}
4626
4627impl wkt::message::Message for UpdateObjectRequest {
4628 fn typename() -> &'static str {
4629 "type.googleapis.com/google.storage.v2.UpdateObjectRequest"
4630 }
4631}
4632
4633/// Parameters that can be passed to any object request.
4634#[derive(Clone, Default, PartialEq)]
4635#[non_exhaustive]
4636pub struct CommonObjectRequestParams {
4637 /// Optional. Encryption algorithm used with the Customer-Supplied Encryption
4638 /// Keys feature.
4639 pub encryption_algorithm: std::string::String,
4640
4641 /// Optional. Encryption key used with the Customer-Supplied Encryption Keys
4642 /// feature. In raw bytes format (not base64-encoded).
4643 pub encryption_key_bytes: ::bytes::Bytes,
4644
4645 /// Optional. SHA256 hash of encryption key used with the Customer-supplied
4646 /// encryption keys feature.
4647 pub encryption_key_sha256_bytes: ::bytes::Bytes,
4648
4649 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4650}
4651
4652impl CommonObjectRequestParams {
4653 pub fn new() -> Self {
4654 std::default::Default::default()
4655 }
4656
4657 /// Sets the value of [encryption_algorithm][crate::model::CommonObjectRequestParams::encryption_algorithm].
4658 ///
4659 /// # Example
4660 /// ```ignore,no_run
4661 /// # use google_cloud_storage::model::CommonObjectRequestParams;
4662 /// let x = CommonObjectRequestParams::new().set_encryption_algorithm("example");
4663 /// ```
4664 pub fn set_encryption_algorithm<T: std::convert::Into<std::string::String>>(
4665 mut self,
4666 v: T,
4667 ) -> Self {
4668 self.encryption_algorithm = v.into();
4669 self
4670 }
4671
4672 /// Sets the value of [encryption_key_bytes][crate::model::CommonObjectRequestParams::encryption_key_bytes].
4673 ///
4674 /// # Example
4675 /// ```ignore,no_run
4676 /// # use google_cloud_storage::model::CommonObjectRequestParams;
4677 /// let x = CommonObjectRequestParams::new().set_encryption_key_bytes(bytes::Bytes::from_static(b"example"));
4678 /// ```
4679 pub fn set_encryption_key_bytes<T: std::convert::Into<::bytes::Bytes>>(mut self, v: T) -> Self {
4680 self.encryption_key_bytes = v.into();
4681 self
4682 }
4683
4684 /// Sets the value of [encryption_key_sha256_bytes][crate::model::CommonObjectRequestParams::encryption_key_sha256_bytes].
4685 ///
4686 /// # Example
4687 /// ```ignore,no_run
4688 /// # use google_cloud_storage::model::CommonObjectRequestParams;
4689 /// let x = CommonObjectRequestParams::new().set_encryption_key_sha256_bytes(bytes::Bytes::from_static(b"example"));
4690 /// ```
4691 pub fn set_encryption_key_sha256_bytes<T: std::convert::Into<::bytes::Bytes>>(
4692 mut self,
4693 v: T,
4694 ) -> Self {
4695 self.encryption_key_sha256_bytes = v.into();
4696 self
4697 }
4698}
4699
4700impl wkt::message::Message for CommonObjectRequestParams {
4701 fn typename() -> &'static str {
4702 "type.googleapis.com/google.storage.v2.CommonObjectRequestParams"
4703 }
4704}
4705
4706/// A bucket.
4707#[derive(Clone, Default, PartialEq)]
4708#[non_exhaustive]
4709pub struct Bucket {
4710 /// Identifier. The name of the bucket.
4711 /// Format: `projects/{project}/buckets/{bucket}`
4712 pub name: std::string::String,
4713
4714 /// Output only. The user-chosen part of the bucket name. The `{bucket}`
4715 /// portion of the `name` field. For globally unique buckets, this is equal to
4716 /// the `bucket name` of other Cloud Storage APIs. Example: `pub`.
4717 pub bucket_id: std::string::String,
4718
4719 /// The etag of the bucket.
4720 /// If included in the metadata of an `UpdateBucketRequest`, the operation is
4721 /// only performed if the `etag` matches that of the bucket.
4722 pub etag: std::string::String,
4723
4724 /// Immutable. The project which owns this bucket, in the format of
4725 /// `projects/{projectIdentifier}`.
4726 /// `{projectIdentifier}` can be the project ID or project number.
4727 /// Output values are always in the project number format.
4728 pub project: std::string::String,
4729
4730 /// Output only. The metadata generation of this bucket.
4731 pub metageneration: i64,
4732
4733 /// Immutable. The location of the bucket. Object data for objects in the
4734 /// bucket resides in physical storage within this region. Defaults to `US`.
4735 /// Attempting to update this field after the bucket is created results in an
4736 /// error.
4737 pub location: std::string::String,
4738
4739 /// Output only. The location type of the bucket (region, dual-region,
4740 /// multi-region, etc).
4741 pub location_type: std::string::String,
4742
4743 /// Optional. The bucket's default storage class, used whenever no storageClass
4744 /// is specified for a newly-created object. This defines how objects in the
4745 /// bucket are stored and determines the SLA and the cost of storage.
4746 /// If this value is not specified when the bucket is created, it defaults
4747 /// to `STANDARD`. For more information, see [Storage
4748 /// classes](https://developers.google.com/storage/docs/storage-classes).
4749 pub storage_class: std::string::String,
4750
4751 /// Optional. The recovery point objective for cross-region replication of the
4752 /// bucket. Applicable only for dual- and multi-region buckets. `DEFAULT` uses
4753 /// default replication. `ASYNC_TURBO` enables turbo replication, valid for
4754 /// dual-region buckets only. If rpo is not specified when the bucket is
4755 /// created, it defaults to `DEFAULT`. For more information, see [Turbo
4756 /// replication](https://cloud.google.com/storage/docs/availability-durability#turbo-replication).
4757 pub rpo: std::string::String,
4758
4759 /// Optional. Access controls on the bucket.
4760 /// If `iam_config.uniform_bucket_level_access` is enabled on this bucket,
4761 /// requests to set, read, or modify acl is an error.
4762 pub acl: std::vec::Vec<crate::model::BucketAccessControl>,
4763
4764 /// Optional. Default access controls to apply to new objects when no ACL is
4765 /// provided. If `iam_config.uniform_bucket_level_access` is enabled on this
4766 /// bucket, requests to set, read, or modify acl is an error.
4767 pub default_object_acl: std::vec::Vec<crate::model::ObjectAccessControl>,
4768
4769 /// Optional. The bucket's lifecycle configuration. See [Lifecycle
4770 /// Management](https://developers.google.com/storage/docs/lifecycle) for more
4771 /// information.
4772 pub lifecycle: std::option::Option<crate::model::bucket::Lifecycle>,
4773
4774 /// Output only. The creation time of the bucket.
4775 pub create_time: std::option::Option<wkt::Timestamp>,
4776
4777 /// Optional. The bucket's [CORS](https://www.w3.org/TR/cors/)
4778 /// configuration.
4779 pub cors: std::vec::Vec<crate::model::bucket::Cors>,
4780
4781 /// Output only. The modification time of the bucket.
4782 pub update_time: std::option::Option<wkt::Timestamp>,
4783
4784 /// Optional. The default value for event-based hold on newly created objects
4785 /// in this bucket. Event-based hold is a way to retain objects indefinitely
4786 /// until an event occurs, signified by the hold's release. After being
4787 /// released, such objects are subject to bucket-level retention (if any). One
4788 /// sample use case of this flag is for banks to hold loan documents for at
4789 /// least 3 years after loan is paid in full. Here, bucket-level retention is 3
4790 /// years and the event is loan being paid in full. In this example, these
4791 /// objects are held intact for any number of years until the event has
4792 /// occurred (event-based hold on the object is released) and then 3 more years
4793 /// after that. That means retention duration of the objects begins from the
4794 /// moment event-based hold transitioned from true to false. Objects under
4795 /// event-based hold cannot be deleted, overwritten or archived until the hold
4796 /// is removed.
4797 pub default_event_based_hold: bool,
4798
4799 /// Optional. User-provided labels, in key/value pairs.
4800 pub labels: std::collections::HashMap<std::string::String, std::string::String>,
4801
4802 /// Optional. The bucket's website config, controlling how the service behaves
4803 /// when accessing bucket contents as a web site. See the [Static website
4804 /// examples](https://cloud.google.com/storage/docs/static-website) for more
4805 /// information.
4806 pub website: std::option::Option<crate::model::bucket::Website>,
4807
4808 /// Optional. The bucket's versioning configuration.
4809 pub versioning: std::option::Option<crate::model::bucket::Versioning>,
4810
4811 /// Optional. The bucket's logging config, which defines the destination bucket
4812 /// and name prefix (if any) for the current bucket's logs.
4813 pub logging: std::option::Option<crate::model::bucket::Logging>,
4814
4815 /// Output only. The owner of the bucket. This is always the project team's
4816 /// owner group.
4817 pub owner: std::option::Option<crate::model::Owner>,
4818
4819 /// Optional. Encryption config for a bucket.
4820 pub encryption: std::option::Option<crate::model::bucket::Encryption>,
4821
4822 /// Optional. The bucket's billing configuration.
4823 pub billing: std::option::Option<crate::model::bucket::Billing>,
4824
4825 /// Optional. The bucket's retention policy. The retention policy enforces a
4826 /// minimum retention time for all objects contained in the bucket, based on
4827 /// their creation time. Any attempt to overwrite or delete objects younger
4828 /// than the retention period results in a `PERMISSION_DENIED` error. An
4829 /// unlocked retention policy can be modified or removed from the bucket via a
4830 /// storage.buckets.update operation. A locked retention policy cannot be
4831 /// removed or shortened in duration for the lifetime of the bucket.
4832 /// Attempting to remove or decrease period of a locked retention policy
4833 /// results in a `PERMISSION_DENIED` error.
4834 pub retention_policy: std::option::Option<crate::model::bucket::RetentionPolicy>,
4835
4836 /// Optional. The bucket's IAM configuration.
4837 pub iam_config: std::option::Option<crate::model::bucket::IamConfig>,
4838
4839 /// Optional. Reserved for future use.
4840 pub satisfies_pzs: bool,
4841
4842 /// Optional. Configuration that, if present, specifies the data placement for
4843 /// a [configurable
4844 /// dual-region](https://cloud.google.com/storage/docs/locations#location-dr).
4845 pub custom_placement_config: std::option::Option<crate::model::bucket::CustomPlacementConfig>,
4846
4847 /// Optional. The bucket's Autoclass configuration. If there is no
4848 /// configuration, the Autoclass feature is disabled and has no effect on the
4849 /// bucket.
4850 pub autoclass: std::option::Option<crate::model::bucket::Autoclass>,
4851
4852 /// Optional. The bucket's hierarchical namespace configuration. If there is no
4853 /// configuration, the hierarchical namespace feature is disabled and has
4854 /// no effect on the bucket.
4855 pub hierarchical_namespace: std::option::Option<crate::model::bucket::HierarchicalNamespace>,
4856
4857 /// Optional. The bucket's soft delete policy. The soft delete policy prevents
4858 /// soft-deleted objects from being permanently deleted.
4859 pub soft_delete_policy: std::option::Option<crate::model::bucket::SoftDeletePolicy>,
4860
4861 /// Optional. The bucket's object retention configuration. Must be enabled
4862 /// before objects in the bucket might have retention configured.
4863 pub object_retention: std::option::Option<crate::model::bucket::ObjectRetention>,
4864
4865 /// Optional. The bucket's IP filter configuration.
4866 pub ip_filter: std::option::Option<crate::model::bucket::IpFilter>,
4867
4868 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4869}
4870
4871impl Bucket {
4872 pub fn new() -> Self {
4873 std::default::Default::default()
4874 }
4875
4876 /// Sets the value of [name][crate::model::Bucket::name].
4877 ///
4878 /// # Example
4879 /// ```ignore,no_run
4880 /// # use google_cloud_storage::model::Bucket;
4881 /// let x = Bucket::new().set_name("example");
4882 /// ```
4883 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4884 self.name = v.into();
4885 self
4886 }
4887
4888 /// Sets the value of [bucket_id][crate::model::Bucket::bucket_id].
4889 ///
4890 /// # Example
4891 /// ```ignore,no_run
4892 /// # use google_cloud_storage::model::Bucket;
4893 /// let x = Bucket::new().set_bucket_id("example");
4894 /// ```
4895 pub fn set_bucket_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4896 self.bucket_id = v.into();
4897 self
4898 }
4899
4900 /// Sets the value of [etag][crate::model::Bucket::etag].
4901 ///
4902 /// # Example
4903 /// ```ignore,no_run
4904 /// # use google_cloud_storage::model::Bucket;
4905 /// let x = Bucket::new().set_etag("example");
4906 /// ```
4907 pub fn set_etag<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4908 self.etag = v.into();
4909 self
4910 }
4911
4912 /// Sets the value of [project][crate::model::Bucket::project].
4913 ///
4914 /// # Example
4915 /// ```ignore,no_run
4916 /// # use google_cloud_storage::model::Bucket;
4917 /// let x = Bucket::new().set_project("example");
4918 /// ```
4919 pub fn set_project<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4920 self.project = v.into();
4921 self
4922 }
4923
4924 /// Sets the value of [metageneration][crate::model::Bucket::metageneration].
4925 ///
4926 /// # Example
4927 /// ```ignore,no_run
4928 /// # use google_cloud_storage::model::Bucket;
4929 /// let x = Bucket::new().set_metageneration(42);
4930 /// ```
4931 pub fn set_metageneration<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
4932 self.metageneration = v.into();
4933 self
4934 }
4935
4936 /// Sets the value of [location][crate::model::Bucket::location].
4937 ///
4938 /// # Example
4939 /// ```ignore,no_run
4940 /// # use google_cloud_storage::model::Bucket;
4941 /// let x = Bucket::new().set_location("example");
4942 /// ```
4943 pub fn set_location<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4944 self.location = v.into();
4945 self
4946 }
4947
4948 /// Sets the value of [location_type][crate::model::Bucket::location_type].
4949 ///
4950 /// # Example
4951 /// ```ignore,no_run
4952 /// # use google_cloud_storage::model::Bucket;
4953 /// let x = Bucket::new().set_location_type("example");
4954 /// ```
4955 pub fn set_location_type<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4956 self.location_type = v.into();
4957 self
4958 }
4959
4960 /// Sets the value of [storage_class][crate::model::Bucket::storage_class].
4961 ///
4962 /// # Example
4963 /// ```ignore,no_run
4964 /// # use google_cloud_storage::model::Bucket;
4965 /// let x = Bucket::new().set_storage_class("example");
4966 /// ```
4967 pub fn set_storage_class<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4968 self.storage_class = v.into();
4969 self
4970 }
4971
4972 /// Sets the value of [rpo][crate::model::Bucket::rpo].
4973 ///
4974 /// # Example
4975 /// ```ignore,no_run
4976 /// # use google_cloud_storage::model::Bucket;
4977 /// let x = Bucket::new().set_rpo("example");
4978 /// ```
4979 pub fn set_rpo<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4980 self.rpo = v.into();
4981 self
4982 }
4983
4984 /// Sets the value of [acl][crate::model::Bucket::acl].
4985 ///
4986 /// # Example
4987 /// ```ignore,no_run
4988 /// # use google_cloud_storage::model::Bucket;
4989 /// use google_cloud_storage::model::BucketAccessControl;
4990 /// let x = Bucket::new()
4991 /// .set_acl([
4992 /// BucketAccessControl::default()/* use setters */,
4993 /// BucketAccessControl::default()/* use (different) setters */,
4994 /// ]);
4995 /// ```
4996 pub fn set_acl<T, V>(mut self, v: T) -> Self
4997 where
4998 T: std::iter::IntoIterator<Item = V>,
4999 V: std::convert::Into<crate::model::BucketAccessControl>,
5000 {
5001 use std::iter::Iterator;
5002 self.acl = v.into_iter().map(|i| i.into()).collect();
5003 self
5004 }
5005
5006 /// Sets the value of [default_object_acl][crate::model::Bucket::default_object_acl].
5007 ///
5008 /// # Example
5009 /// ```ignore,no_run
5010 /// # use google_cloud_storage::model::Bucket;
5011 /// use google_cloud_storage::model::ObjectAccessControl;
5012 /// let x = Bucket::new()
5013 /// .set_default_object_acl([
5014 /// ObjectAccessControl::default()/* use setters */,
5015 /// ObjectAccessControl::default()/* use (different) setters */,
5016 /// ]);
5017 /// ```
5018 pub fn set_default_object_acl<T, V>(mut self, v: T) -> Self
5019 where
5020 T: std::iter::IntoIterator<Item = V>,
5021 V: std::convert::Into<crate::model::ObjectAccessControl>,
5022 {
5023 use std::iter::Iterator;
5024 self.default_object_acl = v.into_iter().map(|i| i.into()).collect();
5025 self
5026 }
5027
5028 /// Sets the value of [lifecycle][crate::model::Bucket::lifecycle].
5029 ///
5030 /// # Example
5031 /// ```ignore,no_run
5032 /// # use google_cloud_storage::model::Bucket;
5033 /// use google_cloud_storage::model::bucket::Lifecycle;
5034 /// let x = Bucket::new().set_lifecycle(Lifecycle::default()/* use setters */);
5035 /// ```
5036 pub fn set_lifecycle<T>(mut self, v: T) -> Self
5037 where
5038 T: std::convert::Into<crate::model::bucket::Lifecycle>,
5039 {
5040 self.lifecycle = std::option::Option::Some(v.into());
5041 self
5042 }
5043
5044 /// Sets or clears the value of [lifecycle][crate::model::Bucket::lifecycle].
5045 ///
5046 /// # Example
5047 /// ```ignore,no_run
5048 /// # use google_cloud_storage::model::Bucket;
5049 /// use google_cloud_storage::model::bucket::Lifecycle;
5050 /// let x = Bucket::new().set_or_clear_lifecycle(Some(Lifecycle::default()/* use setters */));
5051 /// let x = Bucket::new().set_or_clear_lifecycle(None::<Lifecycle>);
5052 /// ```
5053 pub fn set_or_clear_lifecycle<T>(mut self, v: std::option::Option<T>) -> Self
5054 where
5055 T: std::convert::Into<crate::model::bucket::Lifecycle>,
5056 {
5057 self.lifecycle = v.map(|x| x.into());
5058 self
5059 }
5060
5061 /// Sets the value of [create_time][crate::model::Bucket::create_time].
5062 ///
5063 /// # Example
5064 /// ```ignore,no_run
5065 /// # use google_cloud_storage::model::Bucket;
5066 /// use wkt::Timestamp;
5067 /// let x = Bucket::new().set_create_time(Timestamp::default()/* use setters */);
5068 /// ```
5069 pub fn set_create_time<T>(mut self, v: T) -> Self
5070 where
5071 T: std::convert::Into<wkt::Timestamp>,
5072 {
5073 self.create_time = std::option::Option::Some(v.into());
5074 self
5075 }
5076
5077 /// Sets or clears the value of [create_time][crate::model::Bucket::create_time].
5078 ///
5079 /// # Example
5080 /// ```ignore,no_run
5081 /// # use google_cloud_storage::model::Bucket;
5082 /// use wkt::Timestamp;
5083 /// let x = Bucket::new().set_or_clear_create_time(Some(Timestamp::default()/* use setters */));
5084 /// let x = Bucket::new().set_or_clear_create_time(None::<Timestamp>);
5085 /// ```
5086 pub fn set_or_clear_create_time<T>(mut self, v: std::option::Option<T>) -> Self
5087 where
5088 T: std::convert::Into<wkt::Timestamp>,
5089 {
5090 self.create_time = v.map(|x| x.into());
5091 self
5092 }
5093
5094 /// Sets the value of [cors][crate::model::Bucket::cors].
5095 ///
5096 /// # Example
5097 /// ```ignore,no_run
5098 /// # use google_cloud_storage::model::Bucket;
5099 /// use google_cloud_storage::model::bucket::Cors;
5100 /// let x = Bucket::new()
5101 /// .set_cors([
5102 /// Cors::default()/* use setters */,
5103 /// Cors::default()/* use (different) setters */,
5104 /// ]);
5105 /// ```
5106 pub fn set_cors<T, V>(mut self, v: T) -> Self
5107 where
5108 T: std::iter::IntoIterator<Item = V>,
5109 V: std::convert::Into<crate::model::bucket::Cors>,
5110 {
5111 use std::iter::Iterator;
5112 self.cors = v.into_iter().map(|i| i.into()).collect();
5113 self
5114 }
5115
5116 /// Sets the value of [update_time][crate::model::Bucket::update_time].
5117 ///
5118 /// # Example
5119 /// ```ignore,no_run
5120 /// # use google_cloud_storage::model::Bucket;
5121 /// use wkt::Timestamp;
5122 /// let x = Bucket::new().set_update_time(Timestamp::default()/* use setters */);
5123 /// ```
5124 pub fn set_update_time<T>(mut self, v: T) -> Self
5125 where
5126 T: std::convert::Into<wkt::Timestamp>,
5127 {
5128 self.update_time = std::option::Option::Some(v.into());
5129 self
5130 }
5131
5132 /// Sets or clears the value of [update_time][crate::model::Bucket::update_time].
5133 ///
5134 /// # Example
5135 /// ```ignore,no_run
5136 /// # use google_cloud_storage::model::Bucket;
5137 /// use wkt::Timestamp;
5138 /// let x = Bucket::new().set_or_clear_update_time(Some(Timestamp::default()/* use setters */));
5139 /// let x = Bucket::new().set_or_clear_update_time(None::<Timestamp>);
5140 /// ```
5141 pub fn set_or_clear_update_time<T>(mut self, v: std::option::Option<T>) -> Self
5142 where
5143 T: std::convert::Into<wkt::Timestamp>,
5144 {
5145 self.update_time = v.map(|x| x.into());
5146 self
5147 }
5148
5149 /// Sets the value of [default_event_based_hold][crate::model::Bucket::default_event_based_hold].
5150 ///
5151 /// # Example
5152 /// ```ignore,no_run
5153 /// # use google_cloud_storage::model::Bucket;
5154 /// let x = Bucket::new().set_default_event_based_hold(true);
5155 /// ```
5156 pub fn set_default_event_based_hold<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
5157 self.default_event_based_hold = v.into();
5158 self
5159 }
5160
5161 /// Sets the value of [labels][crate::model::Bucket::labels].
5162 ///
5163 /// # Example
5164 /// ```ignore,no_run
5165 /// # use google_cloud_storage::model::Bucket;
5166 /// let x = Bucket::new().set_labels([
5167 /// ("key0", "abc"),
5168 /// ("key1", "xyz"),
5169 /// ]);
5170 /// ```
5171 pub fn set_labels<T, K, V>(mut self, v: T) -> Self
5172 where
5173 T: std::iter::IntoIterator<Item = (K, V)>,
5174 K: std::convert::Into<std::string::String>,
5175 V: std::convert::Into<std::string::String>,
5176 {
5177 use std::iter::Iterator;
5178 self.labels = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
5179 self
5180 }
5181
5182 /// Sets the value of [website][crate::model::Bucket::website].
5183 ///
5184 /// # Example
5185 /// ```ignore,no_run
5186 /// # use google_cloud_storage::model::Bucket;
5187 /// use google_cloud_storage::model::bucket::Website;
5188 /// let x = Bucket::new().set_website(Website::default()/* use setters */);
5189 /// ```
5190 pub fn set_website<T>(mut self, v: T) -> Self
5191 where
5192 T: std::convert::Into<crate::model::bucket::Website>,
5193 {
5194 self.website = std::option::Option::Some(v.into());
5195 self
5196 }
5197
5198 /// Sets or clears the value of [website][crate::model::Bucket::website].
5199 ///
5200 /// # Example
5201 /// ```ignore,no_run
5202 /// # use google_cloud_storage::model::Bucket;
5203 /// use google_cloud_storage::model::bucket::Website;
5204 /// let x = Bucket::new().set_or_clear_website(Some(Website::default()/* use setters */));
5205 /// let x = Bucket::new().set_or_clear_website(None::<Website>);
5206 /// ```
5207 pub fn set_or_clear_website<T>(mut self, v: std::option::Option<T>) -> Self
5208 where
5209 T: std::convert::Into<crate::model::bucket::Website>,
5210 {
5211 self.website = v.map(|x| x.into());
5212 self
5213 }
5214
5215 /// Sets the value of [versioning][crate::model::Bucket::versioning].
5216 ///
5217 /// # Example
5218 /// ```ignore,no_run
5219 /// # use google_cloud_storage::model::Bucket;
5220 /// use google_cloud_storage::model::bucket::Versioning;
5221 /// let x = Bucket::new().set_versioning(Versioning::default()/* use setters */);
5222 /// ```
5223 pub fn set_versioning<T>(mut self, v: T) -> Self
5224 where
5225 T: std::convert::Into<crate::model::bucket::Versioning>,
5226 {
5227 self.versioning = std::option::Option::Some(v.into());
5228 self
5229 }
5230
5231 /// Sets or clears the value of [versioning][crate::model::Bucket::versioning].
5232 ///
5233 /// # Example
5234 /// ```ignore,no_run
5235 /// # use google_cloud_storage::model::Bucket;
5236 /// use google_cloud_storage::model::bucket::Versioning;
5237 /// let x = Bucket::new().set_or_clear_versioning(Some(Versioning::default()/* use setters */));
5238 /// let x = Bucket::new().set_or_clear_versioning(None::<Versioning>);
5239 /// ```
5240 pub fn set_or_clear_versioning<T>(mut self, v: std::option::Option<T>) -> Self
5241 where
5242 T: std::convert::Into<crate::model::bucket::Versioning>,
5243 {
5244 self.versioning = v.map(|x| x.into());
5245 self
5246 }
5247
5248 /// Sets the value of [logging][crate::model::Bucket::logging].
5249 ///
5250 /// # Example
5251 /// ```ignore,no_run
5252 /// # use google_cloud_storage::model::Bucket;
5253 /// use google_cloud_storage::model::bucket::Logging;
5254 /// let x = Bucket::new().set_logging(Logging::default()/* use setters */);
5255 /// ```
5256 pub fn set_logging<T>(mut self, v: T) -> Self
5257 where
5258 T: std::convert::Into<crate::model::bucket::Logging>,
5259 {
5260 self.logging = std::option::Option::Some(v.into());
5261 self
5262 }
5263
5264 /// Sets or clears the value of [logging][crate::model::Bucket::logging].
5265 ///
5266 /// # Example
5267 /// ```ignore,no_run
5268 /// # use google_cloud_storage::model::Bucket;
5269 /// use google_cloud_storage::model::bucket::Logging;
5270 /// let x = Bucket::new().set_or_clear_logging(Some(Logging::default()/* use setters */));
5271 /// let x = Bucket::new().set_or_clear_logging(None::<Logging>);
5272 /// ```
5273 pub fn set_or_clear_logging<T>(mut self, v: std::option::Option<T>) -> Self
5274 where
5275 T: std::convert::Into<crate::model::bucket::Logging>,
5276 {
5277 self.logging = v.map(|x| x.into());
5278 self
5279 }
5280
5281 /// Sets the value of [owner][crate::model::Bucket::owner].
5282 ///
5283 /// # Example
5284 /// ```ignore,no_run
5285 /// # use google_cloud_storage::model::Bucket;
5286 /// use google_cloud_storage::model::Owner;
5287 /// let x = Bucket::new().set_owner(Owner::default()/* use setters */);
5288 /// ```
5289 pub fn set_owner<T>(mut self, v: T) -> Self
5290 where
5291 T: std::convert::Into<crate::model::Owner>,
5292 {
5293 self.owner = std::option::Option::Some(v.into());
5294 self
5295 }
5296
5297 /// Sets or clears the value of [owner][crate::model::Bucket::owner].
5298 ///
5299 /// # Example
5300 /// ```ignore,no_run
5301 /// # use google_cloud_storage::model::Bucket;
5302 /// use google_cloud_storage::model::Owner;
5303 /// let x = Bucket::new().set_or_clear_owner(Some(Owner::default()/* use setters */));
5304 /// let x = Bucket::new().set_or_clear_owner(None::<Owner>);
5305 /// ```
5306 pub fn set_or_clear_owner<T>(mut self, v: std::option::Option<T>) -> Self
5307 where
5308 T: std::convert::Into<crate::model::Owner>,
5309 {
5310 self.owner = v.map(|x| x.into());
5311 self
5312 }
5313
5314 /// Sets the value of [encryption][crate::model::Bucket::encryption].
5315 ///
5316 /// # Example
5317 /// ```ignore,no_run
5318 /// # use google_cloud_storage::model::Bucket;
5319 /// use google_cloud_storage::model::bucket::Encryption;
5320 /// let x = Bucket::new().set_encryption(Encryption::default()/* use setters */);
5321 /// ```
5322 pub fn set_encryption<T>(mut self, v: T) -> Self
5323 where
5324 T: std::convert::Into<crate::model::bucket::Encryption>,
5325 {
5326 self.encryption = std::option::Option::Some(v.into());
5327 self
5328 }
5329
5330 /// Sets or clears the value of [encryption][crate::model::Bucket::encryption].
5331 ///
5332 /// # Example
5333 /// ```ignore,no_run
5334 /// # use google_cloud_storage::model::Bucket;
5335 /// use google_cloud_storage::model::bucket::Encryption;
5336 /// let x = Bucket::new().set_or_clear_encryption(Some(Encryption::default()/* use setters */));
5337 /// let x = Bucket::new().set_or_clear_encryption(None::<Encryption>);
5338 /// ```
5339 pub fn set_or_clear_encryption<T>(mut self, v: std::option::Option<T>) -> Self
5340 where
5341 T: std::convert::Into<crate::model::bucket::Encryption>,
5342 {
5343 self.encryption = v.map(|x| x.into());
5344 self
5345 }
5346
5347 /// Sets the value of [billing][crate::model::Bucket::billing].
5348 ///
5349 /// # Example
5350 /// ```ignore,no_run
5351 /// # use google_cloud_storage::model::Bucket;
5352 /// use google_cloud_storage::model::bucket::Billing;
5353 /// let x = Bucket::new().set_billing(Billing::default()/* use setters */);
5354 /// ```
5355 pub fn set_billing<T>(mut self, v: T) -> Self
5356 where
5357 T: std::convert::Into<crate::model::bucket::Billing>,
5358 {
5359 self.billing = std::option::Option::Some(v.into());
5360 self
5361 }
5362
5363 /// Sets or clears the value of [billing][crate::model::Bucket::billing].
5364 ///
5365 /// # Example
5366 /// ```ignore,no_run
5367 /// # use google_cloud_storage::model::Bucket;
5368 /// use google_cloud_storage::model::bucket::Billing;
5369 /// let x = Bucket::new().set_or_clear_billing(Some(Billing::default()/* use setters */));
5370 /// let x = Bucket::new().set_or_clear_billing(None::<Billing>);
5371 /// ```
5372 pub fn set_or_clear_billing<T>(mut self, v: std::option::Option<T>) -> Self
5373 where
5374 T: std::convert::Into<crate::model::bucket::Billing>,
5375 {
5376 self.billing = v.map(|x| x.into());
5377 self
5378 }
5379
5380 /// Sets the value of [retention_policy][crate::model::Bucket::retention_policy].
5381 ///
5382 /// # Example
5383 /// ```ignore,no_run
5384 /// # use google_cloud_storage::model::Bucket;
5385 /// use google_cloud_storage::model::bucket::RetentionPolicy;
5386 /// let x = Bucket::new().set_retention_policy(RetentionPolicy::default()/* use setters */);
5387 /// ```
5388 pub fn set_retention_policy<T>(mut self, v: T) -> Self
5389 where
5390 T: std::convert::Into<crate::model::bucket::RetentionPolicy>,
5391 {
5392 self.retention_policy = std::option::Option::Some(v.into());
5393 self
5394 }
5395
5396 /// Sets or clears the value of [retention_policy][crate::model::Bucket::retention_policy].
5397 ///
5398 /// # Example
5399 /// ```ignore,no_run
5400 /// # use google_cloud_storage::model::Bucket;
5401 /// use google_cloud_storage::model::bucket::RetentionPolicy;
5402 /// let x = Bucket::new().set_or_clear_retention_policy(Some(RetentionPolicy::default()/* use setters */));
5403 /// let x = Bucket::new().set_or_clear_retention_policy(None::<RetentionPolicy>);
5404 /// ```
5405 pub fn set_or_clear_retention_policy<T>(mut self, v: std::option::Option<T>) -> Self
5406 where
5407 T: std::convert::Into<crate::model::bucket::RetentionPolicy>,
5408 {
5409 self.retention_policy = v.map(|x| x.into());
5410 self
5411 }
5412
5413 /// Sets the value of [iam_config][crate::model::Bucket::iam_config].
5414 ///
5415 /// # Example
5416 /// ```ignore,no_run
5417 /// # use google_cloud_storage::model::Bucket;
5418 /// use google_cloud_storage::model::bucket::IamConfig;
5419 /// let x = Bucket::new().set_iam_config(IamConfig::default()/* use setters */);
5420 /// ```
5421 pub fn set_iam_config<T>(mut self, v: T) -> Self
5422 where
5423 T: std::convert::Into<crate::model::bucket::IamConfig>,
5424 {
5425 self.iam_config = std::option::Option::Some(v.into());
5426 self
5427 }
5428
5429 /// Sets or clears the value of [iam_config][crate::model::Bucket::iam_config].
5430 ///
5431 /// # Example
5432 /// ```ignore,no_run
5433 /// # use google_cloud_storage::model::Bucket;
5434 /// use google_cloud_storage::model::bucket::IamConfig;
5435 /// let x = Bucket::new().set_or_clear_iam_config(Some(IamConfig::default()/* use setters */));
5436 /// let x = Bucket::new().set_or_clear_iam_config(None::<IamConfig>);
5437 /// ```
5438 pub fn set_or_clear_iam_config<T>(mut self, v: std::option::Option<T>) -> Self
5439 where
5440 T: std::convert::Into<crate::model::bucket::IamConfig>,
5441 {
5442 self.iam_config = v.map(|x| x.into());
5443 self
5444 }
5445
5446 /// Sets the value of [satisfies_pzs][crate::model::Bucket::satisfies_pzs].
5447 ///
5448 /// # Example
5449 /// ```ignore,no_run
5450 /// # use google_cloud_storage::model::Bucket;
5451 /// let x = Bucket::new().set_satisfies_pzs(true);
5452 /// ```
5453 pub fn set_satisfies_pzs<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
5454 self.satisfies_pzs = v.into();
5455 self
5456 }
5457
5458 /// Sets the value of [custom_placement_config][crate::model::Bucket::custom_placement_config].
5459 ///
5460 /// # Example
5461 /// ```ignore,no_run
5462 /// # use google_cloud_storage::model::Bucket;
5463 /// use google_cloud_storage::model::bucket::CustomPlacementConfig;
5464 /// let x = Bucket::new().set_custom_placement_config(CustomPlacementConfig::default()/* use setters */);
5465 /// ```
5466 pub fn set_custom_placement_config<T>(mut self, v: T) -> Self
5467 where
5468 T: std::convert::Into<crate::model::bucket::CustomPlacementConfig>,
5469 {
5470 self.custom_placement_config = std::option::Option::Some(v.into());
5471 self
5472 }
5473
5474 /// Sets or clears the value of [custom_placement_config][crate::model::Bucket::custom_placement_config].
5475 ///
5476 /// # Example
5477 /// ```ignore,no_run
5478 /// # use google_cloud_storage::model::Bucket;
5479 /// use google_cloud_storage::model::bucket::CustomPlacementConfig;
5480 /// let x = Bucket::new().set_or_clear_custom_placement_config(Some(CustomPlacementConfig::default()/* use setters */));
5481 /// let x = Bucket::new().set_or_clear_custom_placement_config(None::<CustomPlacementConfig>);
5482 /// ```
5483 pub fn set_or_clear_custom_placement_config<T>(mut self, v: std::option::Option<T>) -> Self
5484 where
5485 T: std::convert::Into<crate::model::bucket::CustomPlacementConfig>,
5486 {
5487 self.custom_placement_config = v.map(|x| x.into());
5488 self
5489 }
5490
5491 /// Sets the value of [autoclass][crate::model::Bucket::autoclass].
5492 ///
5493 /// # Example
5494 /// ```ignore,no_run
5495 /// # use google_cloud_storage::model::Bucket;
5496 /// use google_cloud_storage::model::bucket::Autoclass;
5497 /// let x = Bucket::new().set_autoclass(Autoclass::default()/* use setters */);
5498 /// ```
5499 pub fn set_autoclass<T>(mut self, v: T) -> Self
5500 where
5501 T: std::convert::Into<crate::model::bucket::Autoclass>,
5502 {
5503 self.autoclass = std::option::Option::Some(v.into());
5504 self
5505 }
5506
5507 /// Sets or clears the value of [autoclass][crate::model::Bucket::autoclass].
5508 ///
5509 /// # Example
5510 /// ```ignore,no_run
5511 /// # use google_cloud_storage::model::Bucket;
5512 /// use google_cloud_storage::model::bucket::Autoclass;
5513 /// let x = Bucket::new().set_or_clear_autoclass(Some(Autoclass::default()/* use setters */));
5514 /// let x = Bucket::new().set_or_clear_autoclass(None::<Autoclass>);
5515 /// ```
5516 pub fn set_or_clear_autoclass<T>(mut self, v: std::option::Option<T>) -> Self
5517 where
5518 T: std::convert::Into<crate::model::bucket::Autoclass>,
5519 {
5520 self.autoclass = v.map(|x| x.into());
5521 self
5522 }
5523
5524 /// Sets the value of [hierarchical_namespace][crate::model::Bucket::hierarchical_namespace].
5525 ///
5526 /// # Example
5527 /// ```ignore,no_run
5528 /// # use google_cloud_storage::model::Bucket;
5529 /// use google_cloud_storage::model::bucket::HierarchicalNamespace;
5530 /// let x = Bucket::new().set_hierarchical_namespace(HierarchicalNamespace::default()/* use setters */);
5531 /// ```
5532 pub fn set_hierarchical_namespace<T>(mut self, v: T) -> Self
5533 where
5534 T: std::convert::Into<crate::model::bucket::HierarchicalNamespace>,
5535 {
5536 self.hierarchical_namespace = std::option::Option::Some(v.into());
5537 self
5538 }
5539
5540 /// Sets or clears the value of [hierarchical_namespace][crate::model::Bucket::hierarchical_namespace].
5541 ///
5542 /// # Example
5543 /// ```ignore,no_run
5544 /// # use google_cloud_storage::model::Bucket;
5545 /// use google_cloud_storage::model::bucket::HierarchicalNamespace;
5546 /// let x = Bucket::new().set_or_clear_hierarchical_namespace(Some(HierarchicalNamespace::default()/* use setters */));
5547 /// let x = Bucket::new().set_or_clear_hierarchical_namespace(None::<HierarchicalNamespace>);
5548 /// ```
5549 pub fn set_or_clear_hierarchical_namespace<T>(mut self, v: std::option::Option<T>) -> Self
5550 where
5551 T: std::convert::Into<crate::model::bucket::HierarchicalNamespace>,
5552 {
5553 self.hierarchical_namespace = v.map(|x| x.into());
5554 self
5555 }
5556
5557 /// Sets the value of [soft_delete_policy][crate::model::Bucket::soft_delete_policy].
5558 ///
5559 /// # Example
5560 /// ```ignore,no_run
5561 /// # use google_cloud_storage::model::Bucket;
5562 /// use google_cloud_storage::model::bucket::SoftDeletePolicy;
5563 /// let x = Bucket::new().set_soft_delete_policy(SoftDeletePolicy::default()/* use setters */);
5564 /// ```
5565 pub fn set_soft_delete_policy<T>(mut self, v: T) -> Self
5566 where
5567 T: std::convert::Into<crate::model::bucket::SoftDeletePolicy>,
5568 {
5569 self.soft_delete_policy = std::option::Option::Some(v.into());
5570 self
5571 }
5572
5573 /// Sets or clears the value of [soft_delete_policy][crate::model::Bucket::soft_delete_policy].
5574 ///
5575 /// # Example
5576 /// ```ignore,no_run
5577 /// # use google_cloud_storage::model::Bucket;
5578 /// use google_cloud_storage::model::bucket::SoftDeletePolicy;
5579 /// let x = Bucket::new().set_or_clear_soft_delete_policy(Some(SoftDeletePolicy::default()/* use setters */));
5580 /// let x = Bucket::new().set_or_clear_soft_delete_policy(None::<SoftDeletePolicy>);
5581 /// ```
5582 pub fn set_or_clear_soft_delete_policy<T>(mut self, v: std::option::Option<T>) -> Self
5583 where
5584 T: std::convert::Into<crate::model::bucket::SoftDeletePolicy>,
5585 {
5586 self.soft_delete_policy = v.map(|x| x.into());
5587 self
5588 }
5589
5590 /// Sets the value of [object_retention][crate::model::Bucket::object_retention].
5591 ///
5592 /// # Example
5593 /// ```ignore,no_run
5594 /// # use google_cloud_storage::model::Bucket;
5595 /// use google_cloud_storage::model::bucket::ObjectRetention;
5596 /// let x = Bucket::new().set_object_retention(ObjectRetention::default()/* use setters */);
5597 /// ```
5598 pub fn set_object_retention<T>(mut self, v: T) -> Self
5599 where
5600 T: std::convert::Into<crate::model::bucket::ObjectRetention>,
5601 {
5602 self.object_retention = std::option::Option::Some(v.into());
5603 self
5604 }
5605
5606 /// Sets or clears the value of [object_retention][crate::model::Bucket::object_retention].
5607 ///
5608 /// # Example
5609 /// ```ignore,no_run
5610 /// # use google_cloud_storage::model::Bucket;
5611 /// use google_cloud_storage::model::bucket::ObjectRetention;
5612 /// let x = Bucket::new().set_or_clear_object_retention(Some(ObjectRetention::default()/* use setters */));
5613 /// let x = Bucket::new().set_or_clear_object_retention(None::<ObjectRetention>);
5614 /// ```
5615 pub fn set_or_clear_object_retention<T>(mut self, v: std::option::Option<T>) -> Self
5616 where
5617 T: std::convert::Into<crate::model::bucket::ObjectRetention>,
5618 {
5619 self.object_retention = v.map(|x| x.into());
5620 self
5621 }
5622
5623 /// Sets the value of [ip_filter][crate::model::Bucket::ip_filter].
5624 ///
5625 /// # Example
5626 /// ```ignore,no_run
5627 /// # use google_cloud_storage::model::Bucket;
5628 /// use google_cloud_storage::model::bucket::IpFilter;
5629 /// let x = Bucket::new().set_ip_filter(IpFilter::default()/* use setters */);
5630 /// ```
5631 pub fn set_ip_filter<T>(mut self, v: T) -> Self
5632 where
5633 T: std::convert::Into<crate::model::bucket::IpFilter>,
5634 {
5635 self.ip_filter = std::option::Option::Some(v.into());
5636 self
5637 }
5638
5639 /// Sets or clears the value of [ip_filter][crate::model::Bucket::ip_filter].
5640 ///
5641 /// # Example
5642 /// ```ignore,no_run
5643 /// # use google_cloud_storage::model::Bucket;
5644 /// use google_cloud_storage::model::bucket::IpFilter;
5645 /// let x = Bucket::new().set_or_clear_ip_filter(Some(IpFilter::default()/* use setters */));
5646 /// let x = Bucket::new().set_or_clear_ip_filter(None::<IpFilter>);
5647 /// ```
5648 pub fn set_or_clear_ip_filter<T>(mut self, v: std::option::Option<T>) -> Self
5649 where
5650 T: std::convert::Into<crate::model::bucket::IpFilter>,
5651 {
5652 self.ip_filter = v.map(|x| x.into());
5653 self
5654 }
5655}
5656
5657impl wkt::message::Message for Bucket {
5658 fn typename() -> &'static str {
5659 "type.googleapis.com/google.storage.v2.Bucket"
5660 }
5661}
5662
5663/// Defines additional types related to [Bucket].
5664pub mod bucket {
5665 #[allow(unused_imports)]
5666 use super::*;
5667
5668 /// Billing properties of a bucket.
5669 #[derive(Clone, Default, PartialEq)]
5670 #[non_exhaustive]
5671 pub struct Billing {
5672 /// Optional. When set to true, Requester Pays is enabled for this bucket.
5673 pub requester_pays: bool,
5674
5675 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5676 }
5677
5678 impl Billing {
5679 pub fn new() -> Self {
5680 std::default::Default::default()
5681 }
5682
5683 /// Sets the value of [requester_pays][crate::model::bucket::Billing::requester_pays].
5684 ///
5685 /// # Example
5686 /// ```ignore,no_run
5687 /// # use google_cloud_storage::model::bucket::Billing;
5688 /// let x = Billing::new().set_requester_pays(true);
5689 /// ```
5690 pub fn set_requester_pays<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
5691 self.requester_pays = v.into();
5692 self
5693 }
5694 }
5695
5696 impl wkt::message::Message for Billing {
5697 fn typename() -> &'static str {
5698 "type.googleapis.com/google.storage.v2.Bucket.Billing"
5699 }
5700 }
5701
5702 /// Cross-Origin Response sharing (CORS) properties for a bucket.
5703 /// For more on Cloud Storage and CORS, see
5704 /// <https://cloud.google.com/storage/docs/cross-origin>.
5705 /// For more on CORS in general, see <https://tools.ietf.org/html/rfc6454>.
5706 #[derive(Clone, Default, PartialEq)]
5707 #[non_exhaustive]
5708 pub struct Cors {
5709 /// Optional. The list of origins eligible to receive CORS response headers.
5710 /// For more information about origins, see [RFC
5711 /// 6454](https://tools.ietf.org/html/rfc6454). Note: `*` is permitted in the
5712 /// list of origins, and means `any origin`.
5713 pub origin: std::vec::Vec<std::string::String>,
5714
5715 /// Optional. The list of HTTP methods on which to include CORS response
5716 /// headers,
5717 /// (`GET`, `OPTIONS`, `POST`, etc) Note: `*` is permitted in the list of
5718 /// methods, and means "any method".
5719 pub method: std::vec::Vec<std::string::String>,
5720
5721 /// Optional. The list of HTTP headers other than the [simple response
5722 /// headers](https://www.w3.org/TR/cors/#simple-response-headers) to give
5723 /// permission for the user-agent to share across domains.
5724 pub response_header: std::vec::Vec<std::string::String>,
5725
5726 /// Optional. The value, in seconds, to return in the [Access-Control-Max-Age
5727 /// header](https://www.w3.org/TR/cors/#access-control-max-age-response-header)
5728 /// used in preflight responses.
5729 pub max_age_seconds: i32,
5730
5731 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5732 }
5733
5734 impl Cors {
5735 pub fn new() -> Self {
5736 std::default::Default::default()
5737 }
5738
5739 /// Sets the value of [origin][crate::model::bucket::Cors::origin].
5740 ///
5741 /// # Example
5742 /// ```ignore,no_run
5743 /// # use google_cloud_storage::model::bucket::Cors;
5744 /// let x = Cors::new().set_origin(["a", "b", "c"]);
5745 /// ```
5746 pub fn set_origin<T, V>(mut self, v: T) -> Self
5747 where
5748 T: std::iter::IntoIterator<Item = V>,
5749 V: std::convert::Into<std::string::String>,
5750 {
5751 use std::iter::Iterator;
5752 self.origin = v.into_iter().map(|i| i.into()).collect();
5753 self
5754 }
5755
5756 /// Sets the value of [method][crate::model::bucket::Cors::method].
5757 ///
5758 /// # Example
5759 /// ```ignore,no_run
5760 /// # use google_cloud_storage::model::bucket::Cors;
5761 /// let x = Cors::new().set_method(["a", "b", "c"]);
5762 /// ```
5763 pub fn set_method<T, V>(mut self, v: T) -> Self
5764 where
5765 T: std::iter::IntoIterator<Item = V>,
5766 V: std::convert::Into<std::string::String>,
5767 {
5768 use std::iter::Iterator;
5769 self.method = v.into_iter().map(|i| i.into()).collect();
5770 self
5771 }
5772
5773 /// Sets the value of [response_header][crate::model::bucket::Cors::response_header].
5774 ///
5775 /// # Example
5776 /// ```ignore,no_run
5777 /// # use google_cloud_storage::model::bucket::Cors;
5778 /// let x = Cors::new().set_response_header(["a", "b", "c"]);
5779 /// ```
5780 pub fn set_response_header<T, V>(mut self, v: T) -> Self
5781 where
5782 T: std::iter::IntoIterator<Item = V>,
5783 V: std::convert::Into<std::string::String>,
5784 {
5785 use std::iter::Iterator;
5786 self.response_header = v.into_iter().map(|i| i.into()).collect();
5787 self
5788 }
5789
5790 /// Sets the value of [max_age_seconds][crate::model::bucket::Cors::max_age_seconds].
5791 ///
5792 /// # Example
5793 /// ```ignore,no_run
5794 /// # use google_cloud_storage::model::bucket::Cors;
5795 /// let x = Cors::new().set_max_age_seconds(42);
5796 /// ```
5797 pub fn set_max_age_seconds<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
5798 self.max_age_seconds = v.into();
5799 self
5800 }
5801 }
5802
5803 impl wkt::message::Message for Cors {
5804 fn typename() -> &'static str {
5805 "type.googleapis.com/google.storage.v2.Bucket.Cors"
5806 }
5807 }
5808
5809 /// Encryption properties of a bucket.
5810 #[derive(Clone, Default, PartialEq)]
5811 #[non_exhaustive]
5812 pub struct Encryption {
5813 /// Optional. The name of the Cloud KMS key that is used to encrypt objects
5814 /// inserted into this bucket, if no encryption method is specified.
5815 pub default_kms_key: std::string::String,
5816
5817 /// Optional. If omitted, then new objects with GMEK encryption-type is
5818 /// allowed. If set, then new objects created in this bucket must comply with
5819 /// enforcement config. Changing this has no effect on existing objects; it
5820 /// applies to new objects only.
5821 pub google_managed_encryption_enforcement_config: std::option::Option<
5822 crate::model::bucket::encryption::GoogleManagedEncryptionEnforcementConfig,
5823 >,
5824
5825 /// Optional. If omitted, then new objects with CMEK encryption-type is
5826 /// allowed. If set, then new objects created in this bucket must comply with
5827 /// enforcement config. Changing this has no effect on existing objects; it
5828 /// applies to new objects only.
5829 pub customer_managed_encryption_enforcement_config: std::option::Option<
5830 crate::model::bucket::encryption::CustomerManagedEncryptionEnforcementConfig,
5831 >,
5832
5833 /// Optional. If omitted, then new objects with CSEK encryption-type is
5834 /// allowed. If set, then new objects created in this bucket must comply with
5835 /// enforcement config. Changing this has no effect on existing objects; it
5836 /// applies to new objects only.
5837 pub customer_supplied_encryption_enforcement_config: std::option::Option<
5838 crate::model::bucket::encryption::CustomerSuppliedEncryptionEnforcementConfig,
5839 >,
5840
5841 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5842 }
5843
5844 impl Encryption {
5845 pub fn new() -> Self {
5846 std::default::Default::default()
5847 }
5848
5849 /// Sets the value of [default_kms_key][crate::model::bucket::Encryption::default_kms_key].
5850 ///
5851 /// # Example
5852 /// ```ignore,no_run
5853 /// # use google_cloud_storage::model::bucket::Encryption;
5854 /// let x = Encryption::new().set_default_kms_key("example");
5855 /// ```
5856 pub fn set_default_kms_key<T: std::convert::Into<std::string::String>>(
5857 mut self,
5858 v: T,
5859 ) -> Self {
5860 self.default_kms_key = v.into();
5861 self
5862 }
5863
5864 /// Sets the value of [google_managed_encryption_enforcement_config][crate::model::bucket::Encryption::google_managed_encryption_enforcement_config].
5865 ///
5866 /// # Example
5867 /// ```ignore,no_run
5868 /// # use google_cloud_storage::model::bucket::Encryption;
5869 /// use google_cloud_storage::model::bucket::encryption::GoogleManagedEncryptionEnforcementConfig;
5870 /// let x = Encryption::new().set_google_managed_encryption_enforcement_config(GoogleManagedEncryptionEnforcementConfig::default()/* use setters */);
5871 /// ```
5872 pub fn set_google_managed_encryption_enforcement_config<T>(mut self, v: T) -> Self
5873 where
5874 T: std::convert::Into<
5875 crate::model::bucket::encryption::GoogleManagedEncryptionEnforcementConfig,
5876 >,
5877 {
5878 self.google_managed_encryption_enforcement_config = std::option::Option::Some(v.into());
5879 self
5880 }
5881
5882 /// Sets or clears the value of [google_managed_encryption_enforcement_config][crate::model::bucket::Encryption::google_managed_encryption_enforcement_config].
5883 ///
5884 /// # Example
5885 /// ```ignore,no_run
5886 /// # use google_cloud_storage::model::bucket::Encryption;
5887 /// use google_cloud_storage::model::bucket::encryption::GoogleManagedEncryptionEnforcementConfig;
5888 /// let x = Encryption::new().set_or_clear_google_managed_encryption_enforcement_config(Some(GoogleManagedEncryptionEnforcementConfig::default()/* use setters */));
5889 /// let x = Encryption::new().set_or_clear_google_managed_encryption_enforcement_config(None::<GoogleManagedEncryptionEnforcementConfig>);
5890 /// ```
5891 pub fn set_or_clear_google_managed_encryption_enforcement_config<T>(
5892 mut self,
5893 v: std::option::Option<T>,
5894 ) -> Self
5895 where
5896 T: std::convert::Into<
5897 crate::model::bucket::encryption::GoogleManagedEncryptionEnforcementConfig,
5898 >,
5899 {
5900 self.google_managed_encryption_enforcement_config = v.map(|x| x.into());
5901 self
5902 }
5903
5904 /// Sets the value of [customer_managed_encryption_enforcement_config][crate::model::bucket::Encryption::customer_managed_encryption_enforcement_config].
5905 ///
5906 /// # Example
5907 /// ```ignore,no_run
5908 /// # use google_cloud_storage::model::bucket::Encryption;
5909 /// use google_cloud_storage::model::bucket::encryption::CustomerManagedEncryptionEnforcementConfig;
5910 /// let x = Encryption::new().set_customer_managed_encryption_enforcement_config(CustomerManagedEncryptionEnforcementConfig::default()/* use setters */);
5911 /// ```
5912 pub fn set_customer_managed_encryption_enforcement_config<T>(mut self, v: T) -> Self
5913 where
5914 T: std::convert::Into<
5915 crate::model::bucket::encryption::CustomerManagedEncryptionEnforcementConfig,
5916 >,
5917 {
5918 self.customer_managed_encryption_enforcement_config =
5919 std::option::Option::Some(v.into());
5920 self
5921 }
5922
5923 /// Sets or clears the value of [customer_managed_encryption_enforcement_config][crate::model::bucket::Encryption::customer_managed_encryption_enforcement_config].
5924 ///
5925 /// # Example
5926 /// ```ignore,no_run
5927 /// # use google_cloud_storage::model::bucket::Encryption;
5928 /// use google_cloud_storage::model::bucket::encryption::CustomerManagedEncryptionEnforcementConfig;
5929 /// let x = Encryption::new().set_or_clear_customer_managed_encryption_enforcement_config(Some(CustomerManagedEncryptionEnforcementConfig::default()/* use setters */));
5930 /// let x = Encryption::new().set_or_clear_customer_managed_encryption_enforcement_config(None::<CustomerManagedEncryptionEnforcementConfig>);
5931 /// ```
5932 pub fn set_or_clear_customer_managed_encryption_enforcement_config<T>(
5933 mut self,
5934 v: std::option::Option<T>,
5935 ) -> Self
5936 where
5937 T: std::convert::Into<
5938 crate::model::bucket::encryption::CustomerManagedEncryptionEnforcementConfig,
5939 >,
5940 {
5941 self.customer_managed_encryption_enforcement_config = v.map(|x| x.into());
5942 self
5943 }
5944
5945 /// Sets the value of [customer_supplied_encryption_enforcement_config][crate::model::bucket::Encryption::customer_supplied_encryption_enforcement_config].
5946 ///
5947 /// # Example
5948 /// ```ignore,no_run
5949 /// # use google_cloud_storage::model::bucket::Encryption;
5950 /// use google_cloud_storage::model::bucket::encryption::CustomerSuppliedEncryptionEnforcementConfig;
5951 /// let x = Encryption::new().set_customer_supplied_encryption_enforcement_config(CustomerSuppliedEncryptionEnforcementConfig::default()/* use setters */);
5952 /// ```
5953 pub fn set_customer_supplied_encryption_enforcement_config<T>(mut self, v: T) -> Self
5954 where
5955 T: std::convert::Into<
5956 crate::model::bucket::encryption::CustomerSuppliedEncryptionEnforcementConfig,
5957 >,
5958 {
5959 self.customer_supplied_encryption_enforcement_config =
5960 std::option::Option::Some(v.into());
5961 self
5962 }
5963
5964 /// Sets or clears the value of [customer_supplied_encryption_enforcement_config][crate::model::bucket::Encryption::customer_supplied_encryption_enforcement_config].
5965 ///
5966 /// # Example
5967 /// ```ignore,no_run
5968 /// # use google_cloud_storage::model::bucket::Encryption;
5969 /// use google_cloud_storage::model::bucket::encryption::CustomerSuppliedEncryptionEnforcementConfig;
5970 /// let x = Encryption::new().set_or_clear_customer_supplied_encryption_enforcement_config(Some(CustomerSuppliedEncryptionEnforcementConfig::default()/* use setters */));
5971 /// let x = Encryption::new().set_or_clear_customer_supplied_encryption_enforcement_config(None::<CustomerSuppliedEncryptionEnforcementConfig>);
5972 /// ```
5973 pub fn set_or_clear_customer_supplied_encryption_enforcement_config<T>(
5974 mut self,
5975 v: std::option::Option<T>,
5976 ) -> Self
5977 where
5978 T: std::convert::Into<
5979 crate::model::bucket::encryption::CustomerSuppliedEncryptionEnforcementConfig,
5980 >,
5981 {
5982 self.customer_supplied_encryption_enforcement_config = v.map(|x| x.into());
5983 self
5984 }
5985 }
5986
5987 impl wkt::message::Message for Encryption {
5988 fn typename() -> &'static str {
5989 "type.googleapis.com/google.storage.v2.Bucket.Encryption"
5990 }
5991 }
5992
5993 /// Defines additional types related to [Encryption].
5994 pub mod encryption {
5995 #[allow(unused_imports)]
5996 use super::*;
5997
5998 /// Google Managed Encryption (GMEK) enforcement config of a bucket.
5999 #[derive(Clone, Default, PartialEq)]
6000 #[non_exhaustive]
6001 pub struct GoogleManagedEncryptionEnforcementConfig {
6002 /// Restriction mode for google-managed encryption for new objects within
6003 /// the bucket. Valid values are: `NotRestricted` and `FullyRestricted`.
6004 /// If `NotRestricted` or unset, creation of new objects with
6005 /// google-managed encryption is allowed.
6006 /// If `FullyRestricted`, new objects can't be created using google-managed
6007 /// encryption.
6008 pub restriction_mode: std::option::Option<std::string::String>,
6009
6010 /// Time from which the config was effective. This is service-provided.
6011 pub effective_time: std::option::Option<wkt::Timestamp>,
6012
6013 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
6014 }
6015
6016 impl GoogleManagedEncryptionEnforcementConfig {
6017 pub fn new() -> Self {
6018 std::default::Default::default()
6019 }
6020
6021 /// Sets the value of [restriction_mode][crate::model::bucket::encryption::GoogleManagedEncryptionEnforcementConfig::restriction_mode].
6022 ///
6023 /// # Example
6024 /// ```ignore,no_run
6025 /// # use google_cloud_storage::model::bucket::encryption::GoogleManagedEncryptionEnforcementConfig;
6026 /// let x = GoogleManagedEncryptionEnforcementConfig::new().set_restriction_mode("example");
6027 /// ```
6028 pub fn set_restriction_mode<T>(mut self, v: T) -> Self
6029 where
6030 T: std::convert::Into<std::string::String>,
6031 {
6032 self.restriction_mode = std::option::Option::Some(v.into());
6033 self
6034 }
6035
6036 /// Sets or clears the value of [restriction_mode][crate::model::bucket::encryption::GoogleManagedEncryptionEnforcementConfig::restriction_mode].
6037 ///
6038 /// # Example
6039 /// ```ignore,no_run
6040 /// # use google_cloud_storage::model::bucket::encryption::GoogleManagedEncryptionEnforcementConfig;
6041 /// let x = GoogleManagedEncryptionEnforcementConfig::new().set_or_clear_restriction_mode(Some("example"));
6042 /// let x = GoogleManagedEncryptionEnforcementConfig::new().set_or_clear_restriction_mode(None::<String>);
6043 /// ```
6044 pub fn set_or_clear_restriction_mode<T>(mut self, v: std::option::Option<T>) -> Self
6045 where
6046 T: std::convert::Into<std::string::String>,
6047 {
6048 self.restriction_mode = v.map(|x| x.into());
6049 self
6050 }
6051
6052 /// Sets the value of [effective_time][crate::model::bucket::encryption::GoogleManagedEncryptionEnforcementConfig::effective_time].
6053 ///
6054 /// # Example
6055 /// ```ignore,no_run
6056 /// # use google_cloud_storage::model::bucket::encryption::GoogleManagedEncryptionEnforcementConfig;
6057 /// use wkt::Timestamp;
6058 /// let x = GoogleManagedEncryptionEnforcementConfig::new().set_effective_time(Timestamp::default()/* use setters */);
6059 /// ```
6060 pub fn set_effective_time<T>(mut self, v: T) -> Self
6061 where
6062 T: std::convert::Into<wkt::Timestamp>,
6063 {
6064 self.effective_time = std::option::Option::Some(v.into());
6065 self
6066 }
6067
6068 /// Sets or clears the value of [effective_time][crate::model::bucket::encryption::GoogleManagedEncryptionEnforcementConfig::effective_time].
6069 ///
6070 /// # Example
6071 /// ```ignore,no_run
6072 /// # use google_cloud_storage::model::bucket::encryption::GoogleManagedEncryptionEnforcementConfig;
6073 /// use wkt::Timestamp;
6074 /// let x = GoogleManagedEncryptionEnforcementConfig::new().set_or_clear_effective_time(Some(Timestamp::default()/* use setters */));
6075 /// let x = GoogleManagedEncryptionEnforcementConfig::new().set_or_clear_effective_time(None::<Timestamp>);
6076 /// ```
6077 pub fn set_or_clear_effective_time<T>(mut self, v: std::option::Option<T>) -> Self
6078 where
6079 T: std::convert::Into<wkt::Timestamp>,
6080 {
6081 self.effective_time = v.map(|x| x.into());
6082 self
6083 }
6084 }
6085
6086 impl wkt::message::Message for GoogleManagedEncryptionEnforcementConfig {
6087 fn typename() -> &'static str {
6088 "type.googleapis.com/google.storage.v2.Bucket.Encryption.GoogleManagedEncryptionEnforcementConfig"
6089 }
6090 }
6091
6092 /// Customer Managed Encryption (CMEK) enforcement config of a bucket.
6093 #[derive(Clone, Default, PartialEq)]
6094 #[non_exhaustive]
6095 pub struct CustomerManagedEncryptionEnforcementConfig {
6096 /// Restriction mode for customer-managed encryption for new objects within
6097 /// the bucket. Valid values are: `NotRestricted` and `FullyRestricted`.
6098 /// If `NotRestricted` or unset, creation of new objects with
6099 /// customer-managed encryption is allowed.
6100 /// If `FullyRestricted`, new objects can't be created using
6101 /// customer-managed encryption.
6102 pub restriction_mode: std::option::Option<std::string::String>,
6103
6104 /// Time from which the config was effective. This is service-provided.
6105 pub effective_time: std::option::Option<wkt::Timestamp>,
6106
6107 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
6108 }
6109
6110 impl CustomerManagedEncryptionEnforcementConfig {
6111 pub fn new() -> Self {
6112 std::default::Default::default()
6113 }
6114
6115 /// Sets the value of [restriction_mode][crate::model::bucket::encryption::CustomerManagedEncryptionEnforcementConfig::restriction_mode].
6116 ///
6117 /// # Example
6118 /// ```ignore,no_run
6119 /// # use google_cloud_storage::model::bucket::encryption::CustomerManagedEncryptionEnforcementConfig;
6120 /// let x = CustomerManagedEncryptionEnforcementConfig::new().set_restriction_mode("example");
6121 /// ```
6122 pub fn set_restriction_mode<T>(mut self, v: T) -> Self
6123 where
6124 T: std::convert::Into<std::string::String>,
6125 {
6126 self.restriction_mode = std::option::Option::Some(v.into());
6127 self
6128 }
6129
6130 /// Sets or clears the value of [restriction_mode][crate::model::bucket::encryption::CustomerManagedEncryptionEnforcementConfig::restriction_mode].
6131 ///
6132 /// # Example
6133 /// ```ignore,no_run
6134 /// # use google_cloud_storage::model::bucket::encryption::CustomerManagedEncryptionEnforcementConfig;
6135 /// let x = CustomerManagedEncryptionEnforcementConfig::new().set_or_clear_restriction_mode(Some("example"));
6136 /// let x = CustomerManagedEncryptionEnforcementConfig::new().set_or_clear_restriction_mode(None::<String>);
6137 /// ```
6138 pub fn set_or_clear_restriction_mode<T>(mut self, v: std::option::Option<T>) -> Self
6139 where
6140 T: std::convert::Into<std::string::String>,
6141 {
6142 self.restriction_mode = v.map(|x| x.into());
6143 self
6144 }
6145
6146 /// Sets the value of [effective_time][crate::model::bucket::encryption::CustomerManagedEncryptionEnforcementConfig::effective_time].
6147 ///
6148 /// # Example
6149 /// ```ignore,no_run
6150 /// # use google_cloud_storage::model::bucket::encryption::CustomerManagedEncryptionEnforcementConfig;
6151 /// use wkt::Timestamp;
6152 /// let x = CustomerManagedEncryptionEnforcementConfig::new().set_effective_time(Timestamp::default()/* use setters */);
6153 /// ```
6154 pub fn set_effective_time<T>(mut self, v: T) -> Self
6155 where
6156 T: std::convert::Into<wkt::Timestamp>,
6157 {
6158 self.effective_time = std::option::Option::Some(v.into());
6159 self
6160 }
6161
6162 /// Sets or clears the value of [effective_time][crate::model::bucket::encryption::CustomerManagedEncryptionEnforcementConfig::effective_time].
6163 ///
6164 /// # Example
6165 /// ```ignore,no_run
6166 /// # use google_cloud_storage::model::bucket::encryption::CustomerManagedEncryptionEnforcementConfig;
6167 /// use wkt::Timestamp;
6168 /// let x = CustomerManagedEncryptionEnforcementConfig::new().set_or_clear_effective_time(Some(Timestamp::default()/* use setters */));
6169 /// let x = CustomerManagedEncryptionEnforcementConfig::new().set_or_clear_effective_time(None::<Timestamp>);
6170 /// ```
6171 pub fn set_or_clear_effective_time<T>(mut self, v: std::option::Option<T>) -> Self
6172 where
6173 T: std::convert::Into<wkt::Timestamp>,
6174 {
6175 self.effective_time = v.map(|x| x.into());
6176 self
6177 }
6178 }
6179
6180 impl wkt::message::Message for CustomerManagedEncryptionEnforcementConfig {
6181 fn typename() -> &'static str {
6182 "type.googleapis.com/google.storage.v2.Bucket.Encryption.CustomerManagedEncryptionEnforcementConfig"
6183 }
6184 }
6185
6186 /// Customer Supplied Encryption (CSEK) enforcement config of a bucket.
6187 #[derive(Clone, Default, PartialEq)]
6188 #[non_exhaustive]
6189 pub struct CustomerSuppliedEncryptionEnforcementConfig {
6190 /// Restriction mode for customer-supplied encryption for new objects
6191 /// within the bucket. Valid values are: `NotRestricted` and
6192 /// `FullyRestricted`.
6193 /// If `NotRestricted` or unset, creation of new objects with
6194 /// customer-supplied encryption is allowed.
6195 /// If `FullyRestricted`, new objects can't be created using
6196 /// customer-supplied encryption.
6197 pub restriction_mode: std::option::Option<std::string::String>,
6198
6199 /// Time from which the config was effective. This is service-provided.
6200 pub effective_time: std::option::Option<wkt::Timestamp>,
6201
6202 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
6203 }
6204
6205 impl CustomerSuppliedEncryptionEnforcementConfig {
6206 pub fn new() -> Self {
6207 std::default::Default::default()
6208 }
6209
6210 /// Sets the value of [restriction_mode][crate::model::bucket::encryption::CustomerSuppliedEncryptionEnforcementConfig::restriction_mode].
6211 ///
6212 /// # Example
6213 /// ```ignore,no_run
6214 /// # use google_cloud_storage::model::bucket::encryption::CustomerSuppliedEncryptionEnforcementConfig;
6215 /// let x = CustomerSuppliedEncryptionEnforcementConfig::new().set_restriction_mode("example");
6216 /// ```
6217 pub fn set_restriction_mode<T>(mut self, v: T) -> Self
6218 where
6219 T: std::convert::Into<std::string::String>,
6220 {
6221 self.restriction_mode = std::option::Option::Some(v.into());
6222 self
6223 }
6224
6225 /// Sets or clears the value of [restriction_mode][crate::model::bucket::encryption::CustomerSuppliedEncryptionEnforcementConfig::restriction_mode].
6226 ///
6227 /// # Example
6228 /// ```ignore,no_run
6229 /// # use google_cloud_storage::model::bucket::encryption::CustomerSuppliedEncryptionEnforcementConfig;
6230 /// let x = CustomerSuppliedEncryptionEnforcementConfig::new().set_or_clear_restriction_mode(Some("example"));
6231 /// let x = CustomerSuppliedEncryptionEnforcementConfig::new().set_or_clear_restriction_mode(None::<String>);
6232 /// ```
6233 pub fn set_or_clear_restriction_mode<T>(mut self, v: std::option::Option<T>) -> Self
6234 where
6235 T: std::convert::Into<std::string::String>,
6236 {
6237 self.restriction_mode = v.map(|x| x.into());
6238 self
6239 }
6240
6241 /// Sets the value of [effective_time][crate::model::bucket::encryption::CustomerSuppliedEncryptionEnforcementConfig::effective_time].
6242 ///
6243 /// # Example
6244 /// ```ignore,no_run
6245 /// # use google_cloud_storage::model::bucket::encryption::CustomerSuppliedEncryptionEnforcementConfig;
6246 /// use wkt::Timestamp;
6247 /// let x = CustomerSuppliedEncryptionEnforcementConfig::new().set_effective_time(Timestamp::default()/* use setters */);
6248 /// ```
6249 pub fn set_effective_time<T>(mut self, v: T) -> Self
6250 where
6251 T: std::convert::Into<wkt::Timestamp>,
6252 {
6253 self.effective_time = std::option::Option::Some(v.into());
6254 self
6255 }
6256
6257 /// Sets or clears the value of [effective_time][crate::model::bucket::encryption::CustomerSuppliedEncryptionEnforcementConfig::effective_time].
6258 ///
6259 /// # Example
6260 /// ```ignore,no_run
6261 /// # use google_cloud_storage::model::bucket::encryption::CustomerSuppliedEncryptionEnforcementConfig;
6262 /// use wkt::Timestamp;
6263 /// let x = CustomerSuppliedEncryptionEnforcementConfig::new().set_or_clear_effective_time(Some(Timestamp::default()/* use setters */));
6264 /// let x = CustomerSuppliedEncryptionEnforcementConfig::new().set_or_clear_effective_time(None::<Timestamp>);
6265 /// ```
6266 pub fn set_or_clear_effective_time<T>(mut self, v: std::option::Option<T>) -> Self
6267 where
6268 T: std::convert::Into<wkt::Timestamp>,
6269 {
6270 self.effective_time = v.map(|x| x.into());
6271 self
6272 }
6273 }
6274
6275 impl wkt::message::Message for CustomerSuppliedEncryptionEnforcementConfig {
6276 fn typename() -> &'static str {
6277 "type.googleapis.com/google.storage.v2.Bucket.Encryption.CustomerSuppliedEncryptionEnforcementConfig"
6278 }
6279 }
6280 }
6281
6282 /// Bucket restriction options.
6283 #[derive(Clone, Default, PartialEq)]
6284 #[non_exhaustive]
6285 pub struct IamConfig {
6286 /// Optional. Bucket restriction options currently enforced on the bucket.
6287 pub uniform_bucket_level_access:
6288 std::option::Option<crate::model::bucket::iam_config::UniformBucketLevelAccess>,
6289
6290 /// Optional. Whether IAM enforces public access prevention. Valid values are
6291 /// `enforced` or `inherited`.
6292 pub public_access_prevention: std::string::String,
6293
6294 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
6295 }
6296
6297 impl IamConfig {
6298 pub fn new() -> Self {
6299 std::default::Default::default()
6300 }
6301
6302 /// Sets the value of [uniform_bucket_level_access][crate::model::bucket::IamConfig::uniform_bucket_level_access].
6303 ///
6304 /// # Example
6305 /// ```ignore,no_run
6306 /// # use google_cloud_storage::model::bucket::IamConfig;
6307 /// use google_cloud_storage::model::bucket::iam_config::UniformBucketLevelAccess;
6308 /// let x = IamConfig::new().set_uniform_bucket_level_access(UniformBucketLevelAccess::default()/* use setters */);
6309 /// ```
6310 pub fn set_uniform_bucket_level_access<T>(mut self, v: T) -> Self
6311 where
6312 T: std::convert::Into<crate::model::bucket::iam_config::UniformBucketLevelAccess>,
6313 {
6314 self.uniform_bucket_level_access = std::option::Option::Some(v.into());
6315 self
6316 }
6317
6318 /// Sets or clears the value of [uniform_bucket_level_access][crate::model::bucket::IamConfig::uniform_bucket_level_access].
6319 ///
6320 /// # Example
6321 /// ```ignore,no_run
6322 /// # use google_cloud_storage::model::bucket::IamConfig;
6323 /// use google_cloud_storage::model::bucket::iam_config::UniformBucketLevelAccess;
6324 /// let x = IamConfig::new().set_or_clear_uniform_bucket_level_access(Some(UniformBucketLevelAccess::default()/* use setters */));
6325 /// let x = IamConfig::new().set_or_clear_uniform_bucket_level_access(None::<UniformBucketLevelAccess>);
6326 /// ```
6327 pub fn set_or_clear_uniform_bucket_level_access<T>(
6328 mut self,
6329 v: std::option::Option<T>,
6330 ) -> Self
6331 where
6332 T: std::convert::Into<crate::model::bucket::iam_config::UniformBucketLevelAccess>,
6333 {
6334 self.uniform_bucket_level_access = v.map(|x| x.into());
6335 self
6336 }
6337
6338 /// Sets the value of [public_access_prevention][crate::model::bucket::IamConfig::public_access_prevention].
6339 ///
6340 /// # Example
6341 /// ```ignore,no_run
6342 /// # use google_cloud_storage::model::bucket::IamConfig;
6343 /// let x = IamConfig::new().set_public_access_prevention("example");
6344 /// ```
6345 pub fn set_public_access_prevention<T: std::convert::Into<std::string::String>>(
6346 mut self,
6347 v: T,
6348 ) -> Self {
6349 self.public_access_prevention = v.into();
6350 self
6351 }
6352 }
6353
6354 impl wkt::message::Message for IamConfig {
6355 fn typename() -> &'static str {
6356 "type.googleapis.com/google.storage.v2.Bucket.IamConfig"
6357 }
6358 }
6359
6360 /// Defines additional types related to [IamConfig].
6361 pub mod iam_config {
6362 #[allow(unused_imports)]
6363 use super::*;
6364
6365 /// Settings for Uniform Bucket level access.
6366 /// See <https://cloud.google.com/storage/docs/uniform-bucket-level-access>.
6367 #[derive(Clone, Default, PartialEq)]
6368 #[non_exhaustive]
6369 pub struct UniformBucketLevelAccess {
6370 /// Optional. If set, access checks only use bucket-level IAM policies or
6371 /// above.
6372 pub enabled: bool,
6373
6374 /// Optional. The deadline time for changing
6375 /// `iam_config.uniform_bucket_level_access.enabled` from `true` to
6376 /// `false`. Mutable until the specified deadline is reached, but not
6377 /// afterward.
6378 pub lock_time: std::option::Option<wkt::Timestamp>,
6379
6380 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
6381 }
6382
6383 impl UniformBucketLevelAccess {
6384 pub fn new() -> Self {
6385 std::default::Default::default()
6386 }
6387
6388 /// Sets the value of [enabled][crate::model::bucket::iam_config::UniformBucketLevelAccess::enabled].
6389 ///
6390 /// # Example
6391 /// ```ignore,no_run
6392 /// # use google_cloud_storage::model::bucket::iam_config::UniformBucketLevelAccess;
6393 /// let x = UniformBucketLevelAccess::new().set_enabled(true);
6394 /// ```
6395 pub fn set_enabled<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
6396 self.enabled = v.into();
6397 self
6398 }
6399
6400 /// Sets the value of [lock_time][crate::model::bucket::iam_config::UniformBucketLevelAccess::lock_time].
6401 ///
6402 /// # Example
6403 /// ```ignore,no_run
6404 /// # use google_cloud_storage::model::bucket::iam_config::UniformBucketLevelAccess;
6405 /// use wkt::Timestamp;
6406 /// let x = UniformBucketLevelAccess::new().set_lock_time(Timestamp::default()/* use setters */);
6407 /// ```
6408 pub fn set_lock_time<T>(mut self, v: T) -> Self
6409 where
6410 T: std::convert::Into<wkt::Timestamp>,
6411 {
6412 self.lock_time = std::option::Option::Some(v.into());
6413 self
6414 }
6415
6416 /// Sets or clears the value of [lock_time][crate::model::bucket::iam_config::UniformBucketLevelAccess::lock_time].
6417 ///
6418 /// # Example
6419 /// ```ignore,no_run
6420 /// # use google_cloud_storage::model::bucket::iam_config::UniformBucketLevelAccess;
6421 /// use wkt::Timestamp;
6422 /// let x = UniformBucketLevelAccess::new().set_or_clear_lock_time(Some(Timestamp::default()/* use setters */));
6423 /// let x = UniformBucketLevelAccess::new().set_or_clear_lock_time(None::<Timestamp>);
6424 /// ```
6425 pub fn set_or_clear_lock_time<T>(mut self, v: std::option::Option<T>) -> Self
6426 where
6427 T: std::convert::Into<wkt::Timestamp>,
6428 {
6429 self.lock_time = v.map(|x| x.into());
6430 self
6431 }
6432 }
6433
6434 impl wkt::message::Message for UniformBucketLevelAccess {
6435 fn typename() -> &'static str {
6436 "type.googleapis.com/google.storage.v2.Bucket.IamConfig.UniformBucketLevelAccess"
6437 }
6438 }
6439 }
6440
6441 /// Lifecycle properties of a bucket.
6442 /// For more information, see [Object Lifecycle
6443 /// Management](https://cloud.google.com/storage/docs/lifecycle).
6444 #[derive(Clone, Default, PartialEq)]
6445 #[non_exhaustive]
6446 pub struct Lifecycle {
6447 /// Optional. A lifecycle management rule, which is made of an action to take
6448 /// and the condition under which the action is taken.
6449 pub rule: std::vec::Vec<crate::model::bucket::lifecycle::Rule>,
6450
6451 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
6452 }
6453
6454 impl Lifecycle {
6455 pub fn new() -> Self {
6456 std::default::Default::default()
6457 }
6458
6459 /// Sets the value of [rule][crate::model::bucket::Lifecycle::rule].
6460 ///
6461 /// # Example
6462 /// ```ignore,no_run
6463 /// # use google_cloud_storage::model::bucket::Lifecycle;
6464 /// use google_cloud_storage::model::bucket::lifecycle::Rule;
6465 /// let x = Lifecycle::new()
6466 /// .set_rule([
6467 /// Rule::default()/* use setters */,
6468 /// Rule::default()/* use (different) setters */,
6469 /// ]);
6470 /// ```
6471 pub fn set_rule<T, V>(mut self, v: T) -> Self
6472 where
6473 T: std::iter::IntoIterator<Item = V>,
6474 V: std::convert::Into<crate::model::bucket::lifecycle::Rule>,
6475 {
6476 use std::iter::Iterator;
6477 self.rule = v.into_iter().map(|i| i.into()).collect();
6478 self
6479 }
6480 }
6481
6482 impl wkt::message::Message for Lifecycle {
6483 fn typename() -> &'static str {
6484 "type.googleapis.com/google.storage.v2.Bucket.Lifecycle"
6485 }
6486 }
6487
6488 /// Defines additional types related to [Lifecycle].
6489 pub mod lifecycle {
6490 #[allow(unused_imports)]
6491 use super::*;
6492
6493 /// A lifecycle Rule, combining an action to take on an object and a
6494 /// condition which triggers that action.
6495 #[derive(Clone, Default, PartialEq)]
6496 #[non_exhaustive]
6497 pub struct Rule {
6498 /// Optional. The action to take.
6499 pub action: std::option::Option<crate::model::bucket::lifecycle::rule::Action>,
6500
6501 /// Optional. The condition under which the action is taken.
6502 pub condition: std::option::Option<crate::model::bucket::lifecycle::rule::Condition>,
6503
6504 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
6505 }
6506
6507 impl Rule {
6508 pub fn new() -> Self {
6509 std::default::Default::default()
6510 }
6511
6512 /// Sets the value of [action][crate::model::bucket::lifecycle::Rule::action].
6513 ///
6514 /// # Example
6515 /// ```ignore,no_run
6516 /// # use google_cloud_storage::model::bucket::lifecycle::Rule;
6517 /// use google_cloud_storage::model::bucket::lifecycle::rule::Action;
6518 /// let x = Rule::new().set_action(Action::default()/* use setters */);
6519 /// ```
6520 pub fn set_action<T>(mut self, v: T) -> Self
6521 where
6522 T: std::convert::Into<crate::model::bucket::lifecycle::rule::Action>,
6523 {
6524 self.action = std::option::Option::Some(v.into());
6525 self
6526 }
6527
6528 /// Sets or clears the value of [action][crate::model::bucket::lifecycle::Rule::action].
6529 ///
6530 /// # Example
6531 /// ```ignore,no_run
6532 /// # use google_cloud_storage::model::bucket::lifecycle::Rule;
6533 /// use google_cloud_storage::model::bucket::lifecycle::rule::Action;
6534 /// let x = Rule::new().set_or_clear_action(Some(Action::default()/* use setters */));
6535 /// let x = Rule::new().set_or_clear_action(None::<Action>);
6536 /// ```
6537 pub fn set_or_clear_action<T>(mut self, v: std::option::Option<T>) -> Self
6538 where
6539 T: std::convert::Into<crate::model::bucket::lifecycle::rule::Action>,
6540 {
6541 self.action = v.map(|x| x.into());
6542 self
6543 }
6544
6545 /// Sets the value of [condition][crate::model::bucket::lifecycle::Rule::condition].
6546 ///
6547 /// # Example
6548 /// ```ignore,no_run
6549 /// # use google_cloud_storage::model::bucket::lifecycle::Rule;
6550 /// use google_cloud_storage::model::bucket::lifecycle::rule::Condition;
6551 /// let x = Rule::new().set_condition(Condition::default()/* use setters */);
6552 /// ```
6553 pub fn set_condition<T>(mut self, v: T) -> Self
6554 where
6555 T: std::convert::Into<crate::model::bucket::lifecycle::rule::Condition>,
6556 {
6557 self.condition = std::option::Option::Some(v.into());
6558 self
6559 }
6560
6561 /// Sets or clears the value of [condition][crate::model::bucket::lifecycle::Rule::condition].
6562 ///
6563 /// # Example
6564 /// ```ignore,no_run
6565 /// # use google_cloud_storage::model::bucket::lifecycle::Rule;
6566 /// use google_cloud_storage::model::bucket::lifecycle::rule::Condition;
6567 /// let x = Rule::new().set_or_clear_condition(Some(Condition::default()/* use setters */));
6568 /// let x = Rule::new().set_or_clear_condition(None::<Condition>);
6569 /// ```
6570 pub fn set_or_clear_condition<T>(mut self, v: std::option::Option<T>) -> Self
6571 where
6572 T: std::convert::Into<crate::model::bucket::lifecycle::rule::Condition>,
6573 {
6574 self.condition = v.map(|x| x.into());
6575 self
6576 }
6577 }
6578
6579 impl wkt::message::Message for Rule {
6580 fn typename() -> &'static str {
6581 "type.googleapis.com/google.storage.v2.Bucket.Lifecycle.Rule"
6582 }
6583 }
6584
6585 /// Defines additional types related to [Rule].
6586 pub mod rule {
6587 #[allow(unused_imports)]
6588 use super::*;
6589
6590 /// An action to take on an object.
6591 #[derive(Clone, Default, PartialEq)]
6592 #[non_exhaustive]
6593 pub struct Action {
6594 /// Optional. Type of the action. Currently, only `Delete`,
6595 /// `SetStorageClass`, and `AbortIncompleteMultipartUpload` are
6596 /// supported.
6597 pub r#type: std::string::String,
6598
6599 /// Optional. Target storage class. Required iff the type of the action
6600 /// is SetStorageClass.
6601 pub storage_class: std::string::String,
6602
6603 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
6604 }
6605
6606 impl Action {
6607 pub fn new() -> Self {
6608 std::default::Default::default()
6609 }
6610
6611 /// Sets the value of [r#type][crate::model::bucket::lifecycle::rule::Action::type].
6612 ///
6613 /// # Example
6614 /// ```ignore,no_run
6615 /// # use google_cloud_storage::model::bucket::lifecycle::rule::Action;
6616 /// let x = Action::new().set_type("example");
6617 /// ```
6618 pub fn set_type<T: std::convert::Into<std::string::String>>(
6619 mut self,
6620 v: T,
6621 ) -> Self {
6622 self.r#type = v.into();
6623 self
6624 }
6625
6626 /// Sets the value of [storage_class][crate::model::bucket::lifecycle::rule::Action::storage_class].
6627 ///
6628 /// # Example
6629 /// ```ignore,no_run
6630 /// # use google_cloud_storage::model::bucket::lifecycle::rule::Action;
6631 /// let x = Action::new().set_storage_class("example");
6632 /// ```
6633 pub fn set_storage_class<T: std::convert::Into<std::string::String>>(
6634 mut self,
6635 v: T,
6636 ) -> Self {
6637 self.storage_class = v.into();
6638 self
6639 }
6640 }
6641
6642 impl wkt::message::Message for Action {
6643 fn typename() -> &'static str {
6644 "type.googleapis.com/google.storage.v2.Bucket.Lifecycle.Rule.Action"
6645 }
6646 }
6647
6648 /// A condition of an object which triggers some action.
6649 #[derive(Clone, Default, PartialEq)]
6650 #[non_exhaustive]
6651 pub struct Condition {
6652 /// Age of an object (in days). This condition is satisfied when an
6653 /// object reaches the specified age.
6654 /// A value of 0 indicates that all objects immediately match this
6655 /// condition.
6656 pub age_days: std::option::Option<i32>,
6657
6658 /// Optional. This condition is satisfied when an object is created
6659 /// before midnight of the specified date in UTC.
6660 pub created_before: std::option::Option<gtype::model::Date>,
6661
6662 /// Relevant only for versioned objects. If the value is
6663 /// `true`, this condition matches live objects; if the value
6664 /// is `false`, it matches archived objects.
6665 pub is_live: std::option::Option<bool>,
6666
6667 /// Relevant only for versioned objects. If the value is N, this
6668 /// condition is satisfied when there are at least N versions (including
6669 /// the live version) newer than this version of the object.
6670 pub num_newer_versions: std::option::Option<i32>,
6671
6672 /// Optional. Objects having any of the storage classes specified by this
6673 /// condition are matched. Values include `MULTI_REGIONAL`, `REGIONAL`,
6674 /// `NEARLINE`, `COLDLINE`, `STANDARD`, and
6675 /// `DURABLE_REDUCED_AVAILABILITY`.
6676 pub matches_storage_class: std::vec::Vec<std::string::String>,
6677
6678 /// Number of days that have elapsed since the custom timestamp set on an
6679 /// object.
6680 /// The value of the field must be a nonnegative integer.
6681 pub days_since_custom_time: std::option::Option<i32>,
6682
6683 /// Optional. An object matches this condition if the custom timestamp
6684 /// set on the object is before the specified date in UTC.
6685 pub custom_time_before: std::option::Option<gtype::model::Date>,
6686
6687 /// This condition is relevant only for versioned objects. An object
6688 /// version satisfies this condition only if these many days have been
6689 /// passed since it became noncurrent. The value of the field must be a
6690 /// nonnegative integer. If it's zero, the object version becomes
6691 /// eligible for Lifecycle action as soon as it becomes noncurrent.
6692 pub days_since_noncurrent_time: std::option::Option<i32>,
6693
6694 /// Optional. This condition is relevant only for versioned objects. An
6695 /// object version satisfies this condition only if it became noncurrent
6696 /// before the specified date in UTC.
6697 pub noncurrent_time_before: std::option::Option<gtype::model::Date>,
6698
6699 /// Optional. List of object name prefixes. If any prefix exactly matches
6700 /// the beginning of the object name, the condition evaluates to true.
6701 pub matches_prefix: std::vec::Vec<std::string::String>,
6702
6703 /// Optional. List of object name suffixes. If any suffix exactly matches
6704 /// the end of the object name, the condition evaluates to true.
6705 pub matches_suffix: std::vec::Vec<std::string::String>,
6706
6707 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
6708 }
6709
6710 impl Condition {
6711 pub fn new() -> Self {
6712 std::default::Default::default()
6713 }
6714
6715 /// Sets the value of [age_days][crate::model::bucket::lifecycle::rule::Condition::age_days].
6716 ///
6717 /// # Example
6718 /// ```ignore,no_run
6719 /// # use google_cloud_storage::model::bucket::lifecycle::rule::Condition;
6720 /// let x = Condition::new().set_age_days(42);
6721 /// ```
6722 pub fn set_age_days<T>(mut self, v: T) -> Self
6723 where
6724 T: std::convert::Into<i32>,
6725 {
6726 self.age_days = std::option::Option::Some(v.into());
6727 self
6728 }
6729
6730 /// Sets or clears the value of [age_days][crate::model::bucket::lifecycle::rule::Condition::age_days].
6731 ///
6732 /// # Example
6733 /// ```ignore,no_run
6734 /// # use google_cloud_storage::model::bucket::lifecycle::rule::Condition;
6735 /// let x = Condition::new().set_or_clear_age_days(Some(42));
6736 /// let x = Condition::new().set_or_clear_age_days(None::<i32>);
6737 /// ```
6738 pub fn set_or_clear_age_days<T>(mut self, v: std::option::Option<T>) -> Self
6739 where
6740 T: std::convert::Into<i32>,
6741 {
6742 self.age_days = v.map(|x| x.into());
6743 self
6744 }
6745
6746 /// Sets the value of [created_before][crate::model::bucket::lifecycle::rule::Condition::created_before].
6747 ///
6748 /// # Example
6749 /// ```ignore,no_run
6750 /// # use google_cloud_storage::model::bucket::lifecycle::rule::Condition;
6751 /// use gtype::model::Date;
6752 /// let x = Condition::new().set_created_before(Date::default()/* use setters */);
6753 /// ```
6754 pub fn set_created_before<T>(mut self, v: T) -> Self
6755 where
6756 T: std::convert::Into<gtype::model::Date>,
6757 {
6758 self.created_before = std::option::Option::Some(v.into());
6759 self
6760 }
6761
6762 /// Sets or clears the value of [created_before][crate::model::bucket::lifecycle::rule::Condition::created_before].
6763 ///
6764 /// # Example
6765 /// ```ignore,no_run
6766 /// # use google_cloud_storage::model::bucket::lifecycle::rule::Condition;
6767 /// use gtype::model::Date;
6768 /// let x = Condition::new().set_or_clear_created_before(Some(Date::default()/* use setters */));
6769 /// let x = Condition::new().set_or_clear_created_before(None::<Date>);
6770 /// ```
6771 pub fn set_or_clear_created_before<T>(mut self, v: std::option::Option<T>) -> Self
6772 where
6773 T: std::convert::Into<gtype::model::Date>,
6774 {
6775 self.created_before = v.map(|x| x.into());
6776 self
6777 }
6778
6779 /// Sets the value of [is_live][crate::model::bucket::lifecycle::rule::Condition::is_live].
6780 ///
6781 /// # Example
6782 /// ```ignore,no_run
6783 /// # use google_cloud_storage::model::bucket::lifecycle::rule::Condition;
6784 /// let x = Condition::new().set_is_live(true);
6785 /// ```
6786 pub fn set_is_live<T>(mut self, v: T) -> Self
6787 where
6788 T: std::convert::Into<bool>,
6789 {
6790 self.is_live = std::option::Option::Some(v.into());
6791 self
6792 }
6793
6794 /// Sets or clears the value of [is_live][crate::model::bucket::lifecycle::rule::Condition::is_live].
6795 ///
6796 /// # Example
6797 /// ```ignore,no_run
6798 /// # use google_cloud_storage::model::bucket::lifecycle::rule::Condition;
6799 /// let x = Condition::new().set_or_clear_is_live(Some(false));
6800 /// let x = Condition::new().set_or_clear_is_live(None::<bool>);
6801 /// ```
6802 pub fn set_or_clear_is_live<T>(mut self, v: std::option::Option<T>) -> Self
6803 where
6804 T: std::convert::Into<bool>,
6805 {
6806 self.is_live = v.map(|x| x.into());
6807 self
6808 }
6809
6810 /// Sets the value of [num_newer_versions][crate::model::bucket::lifecycle::rule::Condition::num_newer_versions].
6811 ///
6812 /// # Example
6813 /// ```ignore,no_run
6814 /// # use google_cloud_storage::model::bucket::lifecycle::rule::Condition;
6815 /// let x = Condition::new().set_num_newer_versions(42);
6816 /// ```
6817 pub fn set_num_newer_versions<T>(mut self, v: T) -> Self
6818 where
6819 T: std::convert::Into<i32>,
6820 {
6821 self.num_newer_versions = std::option::Option::Some(v.into());
6822 self
6823 }
6824
6825 /// Sets or clears the value of [num_newer_versions][crate::model::bucket::lifecycle::rule::Condition::num_newer_versions].
6826 ///
6827 /// # Example
6828 /// ```ignore,no_run
6829 /// # use google_cloud_storage::model::bucket::lifecycle::rule::Condition;
6830 /// let x = Condition::new().set_or_clear_num_newer_versions(Some(42));
6831 /// let x = Condition::new().set_or_clear_num_newer_versions(None::<i32>);
6832 /// ```
6833 pub fn set_or_clear_num_newer_versions<T>(
6834 mut self,
6835 v: std::option::Option<T>,
6836 ) -> Self
6837 where
6838 T: std::convert::Into<i32>,
6839 {
6840 self.num_newer_versions = v.map(|x| x.into());
6841 self
6842 }
6843
6844 /// Sets the value of [matches_storage_class][crate::model::bucket::lifecycle::rule::Condition::matches_storage_class].
6845 ///
6846 /// # Example
6847 /// ```ignore,no_run
6848 /// # use google_cloud_storage::model::bucket::lifecycle::rule::Condition;
6849 /// let x = Condition::new().set_matches_storage_class(["a", "b", "c"]);
6850 /// ```
6851 pub fn set_matches_storage_class<T, V>(mut self, v: T) -> Self
6852 where
6853 T: std::iter::IntoIterator<Item = V>,
6854 V: std::convert::Into<std::string::String>,
6855 {
6856 use std::iter::Iterator;
6857 self.matches_storage_class = v.into_iter().map(|i| i.into()).collect();
6858 self
6859 }
6860
6861 /// Sets the value of [days_since_custom_time][crate::model::bucket::lifecycle::rule::Condition::days_since_custom_time].
6862 ///
6863 /// # Example
6864 /// ```ignore,no_run
6865 /// # use google_cloud_storage::model::bucket::lifecycle::rule::Condition;
6866 /// let x = Condition::new().set_days_since_custom_time(42);
6867 /// ```
6868 pub fn set_days_since_custom_time<T>(mut self, v: T) -> Self
6869 where
6870 T: std::convert::Into<i32>,
6871 {
6872 self.days_since_custom_time = std::option::Option::Some(v.into());
6873 self
6874 }
6875
6876 /// Sets or clears the value of [days_since_custom_time][crate::model::bucket::lifecycle::rule::Condition::days_since_custom_time].
6877 ///
6878 /// # Example
6879 /// ```ignore,no_run
6880 /// # use google_cloud_storage::model::bucket::lifecycle::rule::Condition;
6881 /// let x = Condition::new().set_or_clear_days_since_custom_time(Some(42));
6882 /// let x = Condition::new().set_or_clear_days_since_custom_time(None::<i32>);
6883 /// ```
6884 pub fn set_or_clear_days_since_custom_time<T>(
6885 mut self,
6886 v: std::option::Option<T>,
6887 ) -> Self
6888 where
6889 T: std::convert::Into<i32>,
6890 {
6891 self.days_since_custom_time = v.map(|x| x.into());
6892 self
6893 }
6894
6895 /// Sets the value of [custom_time_before][crate::model::bucket::lifecycle::rule::Condition::custom_time_before].
6896 ///
6897 /// # Example
6898 /// ```ignore,no_run
6899 /// # use google_cloud_storage::model::bucket::lifecycle::rule::Condition;
6900 /// use gtype::model::Date;
6901 /// let x = Condition::new().set_custom_time_before(Date::default()/* use setters */);
6902 /// ```
6903 pub fn set_custom_time_before<T>(mut self, v: T) -> Self
6904 where
6905 T: std::convert::Into<gtype::model::Date>,
6906 {
6907 self.custom_time_before = std::option::Option::Some(v.into());
6908 self
6909 }
6910
6911 /// Sets or clears the value of [custom_time_before][crate::model::bucket::lifecycle::rule::Condition::custom_time_before].
6912 ///
6913 /// # Example
6914 /// ```ignore,no_run
6915 /// # use google_cloud_storage::model::bucket::lifecycle::rule::Condition;
6916 /// use gtype::model::Date;
6917 /// let x = Condition::new().set_or_clear_custom_time_before(Some(Date::default()/* use setters */));
6918 /// let x = Condition::new().set_or_clear_custom_time_before(None::<Date>);
6919 /// ```
6920 pub fn set_or_clear_custom_time_before<T>(
6921 mut self,
6922 v: std::option::Option<T>,
6923 ) -> Self
6924 where
6925 T: std::convert::Into<gtype::model::Date>,
6926 {
6927 self.custom_time_before = v.map(|x| x.into());
6928 self
6929 }
6930
6931 /// Sets the value of [days_since_noncurrent_time][crate::model::bucket::lifecycle::rule::Condition::days_since_noncurrent_time].
6932 ///
6933 /// # Example
6934 /// ```ignore,no_run
6935 /// # use google_cloud_storage::model::bucket::lifecycle::rule::Condition;
6936 /// let x = Condition::new().set_days_since_noncurrent_time(42);
6937 /// ```
6938 pub fn set_days_since_noncurrent_time<T>(mut self, v: T) -> Self
6939 where
6940 T: std::convert::Into<i32>,
6941 {
6942 self.days_since_noncurrent_time = std::option::Option::Some(v.into());
6943 self
6944 }
6945
6946 /// Sets or clears the value of [days_since_noncurrent_time][crate::model::bucket::lifecycle::rule::Condition::days_since_noncurrent_time].
6947 ///
6948 /// # Example
6949 /// ```ignore,no_run
6950 /// # use google_cloud_storage::model::bucket::lifecycle::rule::Condition;
6951 /// let x = Condition::new().set_or_clear_days_since_noncurrent_time(Some(42));
6952 /// let x = Condition::new().set_or_clear_days_since_noncurrent_time(None::<i32>);
6953 /// ```
6954 pub fn set_or_clear_days_since_noncurrent_time<T>(
6955 mut self,
6956 v: std::option::Option<T>,
6957 ) -> Self
6958 where
6959 T: std::convert::Into<i32>,
6960 {
6961 self.days_since_noncurrent_time = v.map(|x| x.into());
6962 self
6963 }
6964
6965 /// Sets the value of [noncurrent_time_before][crate::model::bucket::lifecycle::rule::Condition::noncurrent_time_before].
6966 ///
6967 /// # Example
6968 /// ```ignore,no_run
6969 /// # use google_cloud_storage::model::bucket::lifecycle::rule::Condition;
6970 /// use gtype::model::Date;
6971 /// let x = Condition::new().set_noncurrent_time_before(Date::default()/* use setters */);
6972 /// ```
6973 pub fn set_noncurrent_time_before<T>(mut self, v: T) -> Self
6974 where
6975 T: std::convert::Into<gtype::model::Date>,
6976 {
6977 self.noncurrent_time_before = std::option::Option::Some(v.into());
6978 self
6979 }
6980
6981 /// Sets or clears the value of [noncurrent_time_before][crate::model::bucket::lifecycle::rule::Condition::noncurrent_time_before].
6982 ///
6983 /// # Example
6984 /// ```ignore,no_run
6985 /// # use google_cloud_storage::model::bucket::lifecycle::rule::Condition;
6986 /// use gtype::model::Date;
6987 /// let x = Condition::new().set_or_clear_noncurrent_time_before(Some(Date::default()/* use setters */));
6988 /// let x = Condition::new().set_or_clear_noncurrent_time_before(None::<Date>);
6989 /// ```
6990 pub fn set_or_clear_noncurrent_time_before<T>(
6991 mut self,
6992 v: std::option::Option<T>,
6993 ) -> Self
6994 where
6995 T: std::convert::Into<gtype::model::Date>,
6996 {
6997 self.noncurrent_time_before = v.map(|x| x.into());
6998 self
6999 }
7000
7001 /// Sets the value of [matches_prefix][crate::model::bucket::lifecycle::rule::Condition::matches_prefix].
7002 ///
7003 /// # Example
7004 /// ```ignore,no_run
7005 /// # use google_cloud_storage::model::bucket::lifecycle::rule::Condition;
7006 /// let x = Condition::new().set_matches_prefix(["a", "b", "c"]);
7007 /// ```
7008 pub fn set_matches_prefix<T, V>(mut self, v: T) -> Self
7009 where
7010 T: std::iter::IntoIterator<Item = V>,
7011 V: std::convert::Into<std::string::String>,
7012 {
7013 use std::iter::Iterator;
7014 self.matches_prefix = v.into_iter().map(|i| i.into()).collect();
7015 self
7016 }
7017
7018 /// Sets the value of [matches_suffix][crate::model::bucket::lifecycle::rule::Condition::matches_suffix].
7019 ///
7020 /// # Example
7021 /// ```ignore,no_run
7022 /// # use google_cloud_storage::model::bucket::lifecycle::rule::Condition;
7023 /// let x = Condition::new().set_matches_suffix(["a", "b", "c"]);
7024 /// ```
7025 pub fn set_matches_suffix<T, V>(mut self, v: T) -> Self
7026 where
7027 T: std::iter::IntoIterator<Item = V>,
7028 V: std::convert::Into<std::string::String>,
7029 {
7030 use std::iter::Iterator;
7031 self.matches_suffix = v.into_iter().map(|i| i.into()).collect();
7032 self
7033 }
7034 }
7035
7036 impl wkt::message::Message for Condition {
7037 fn typename() -> &'static str {
7038 "type.googleapis.com/google.storage.v2.Bucket.Lifecycle.Rule.Condition"
7039 }
7040 }
7041 }
7042 }
7043
7044 /// Logging-related properties of a bucket.
7045 #[derive(Clone, Default, PartialEq)]
7046 #[non_exhaustive]
7047 pub struct Logging {
7048 /// Optional. The destination bucket where the current bucket's logs should
7049 /// be placed, using path format (like `projects/123456/buckets/foo`).
7050 pub log_bucket: std::string::String,
7051
7052 /// Optional. A prefix for log object names.
7053 pub log_object_prefix: std::string::String,
7054
7055 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
7056 }
7057
7058 impl Logging {
7059 pub fn new() -> Self {
7060 std::default::Default::default()
7061 }
7062
7063 /// Sets the value of [log_bucket][crate::model::bucket::Logging::log_bucket].
7064 ///
7065 /// # Example
7066 /// ```ignore,no_run
7067 /// # use google_cloud_storage::model::bucket::Logging;
7068 /// let x = Logging::new().set_log_bucket("example");
7069 /// ```
7070 pub fn set_log_bucket<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
7071 self.log_bucket = v.into();
7072 self
7073 }
7074
7075 /// Sets the value of [log_object_prefix][crate::model::bucket::Logging::log_object_prefix].
7076 ///
7077 /// # Example
7078 /// ```ignore,no_run
7079 /// # use google_cloud_storage::model::bucket::Logging;
7080 /// let x = Logging::new().set_log_object_prefix("example");
7081 /// ```
7082 pub fn set_log_object_prefix<T: std::convert::Into<std::string::String>>(
7083 mut self,
7084 v: T,
7085 ) -> Self {
7086 self.log_object_prefix = v.into();
7087 self
7088 }
7089 }
7090
7091 impl wkt::message::Message for Logging {
7092 fn typename() -> &'static str {
7093 "type.googleapis.com/google.storage.v2.Bucket.Logging"
7094 }
7095 }
7096
7097 /// Object Retention related properties of a bucket.
7098 #[derive(Clone, Default, PartialEq)]
7099 #[non_exhaustive]
7100 pub struct ObjectRetention {
7101 /// Optional. Output only. If true, object retention is enabled for the
7102 /// bucket.
7103 pub enabled: bool,
7104
7105 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
7106 }
7107
7108 impl ObjectRetention {
7109 pub fn new() -> Self {
7110 std::default::Default::default()
7111 }
7112
7113 /// Sets the value of [enabled][crate::model::bucket::ObjectRetention::enabled].
7114 ///
7115 /// # Example
7116 /// ```ignore,no_run
7117 /// # use google_cloud_storage::model::bucket::ObjectRetention;
7118 /// let x = ObjectRetention::new().set_enabled(true);
7119 /// ```
7120 pub fn set_enabled<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
7121 self.enabled = v.into();
7122 self
7123 }
7124 }
7125
7126 impl wkt::message::Message for ObjectRetention {
7127 fn typename() -> &'static str {
7128 "type.googleapis.com/google.storage.v2.Bucket.ObjectRetention"
7129 }
7130 }
7131
7132 /// Retention policy properties of a bucket.
7133 #[derive(Clone, Default, PartialEq)]
7134 #[non_exhaustive]
7135 pub struct RetentionPolicy {
7136 /// Optional. Server-determined value that indicates the time from which
7137 /// policy was enforced and effective.
7138 pub effective_time: std::option::Option<wkt::Timestamp>,
7139
7140 /// Optional. Once locked, an object retention policy cannot be modified.
7141 pub is_locked: bool,
7142
7143 /// Optional. The duration that objects need to be retained. Retention
7144 /// duration must be greater than zero and less than 100 years. Note that
7145 /// enforcement of retention periods less than a day is not guaranteed. Such
7146 /// periods should only be used for testing purposes. Any `nanos` value
7147 /// specified is rounded down to the nearest second.
7148 pub retention_duration: std::option::Option<wkt::Duration>,
7149
7150 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
7151 }
7152
7153 impl RetentionPolicy {
7154 pub fn new() -> Self {
7155 std::default::Default::default()
7156 }
7157
7158 /// Sets the value of [effective_time][crate::model::bucket::RetentionPolicy::effective_time].
7159 ///
7160 /// # Example
7161 /// ```ignore,no_run
7162 /// # use google_cloud_storage::model::bucket::RetentionPolicy;
7163 /// use wkt::Timestamp;
7164 /// let x = RetentionPolicy::new().set_effective_time(Timestamp::default()/* use setters */);
7165 /// ```
7166 pub fn set_effective_time<T>(mut self, v: T) -> Self
7167 where
7168 T: std::convert::Into<wkt::Timestamp>,
7169 {
7170 self.effective_time = std::option::Option::Some(v.into());
7171 self
7172 }
7173
7174 /// Sets or clears the value of [effective_time][crate::model::bucket::RetentionPolicy::effective_time].
7175 ///
7176 /// # Example
7177 /// ```ignore,no_run
7178 /// # use google_cloud_storage::model::bucket::RetentionPolicy;
7179 /// use wkt::Timestamp;
7180 /// let x = RetentionPolicy::new().set_or_clear_effective_time(Some(Timestamp::default()/* use setters */));
7181 /// let x = RetentionPolicy::new().set_or_clear_effective_time(None::<Timestamp>);
7182 /// ```
7183 pub fn set_or_clear_effective_time<T>(mut self, v: std::option::Option<T>) -> Self
7184 where
7185 T: std::convert::Into<wkt::Timestamp>,
7186 {
7187 self.effective_time = v.map(|x| x.into());
7188 self
7189 }
7190
7191 /// Sets the value of [is_locked][crate::model::bucket::RetentionPolicy::is_locked].
7192 ///
7193 /// # Example
7194 /// ```ignore,no_run
7195 /// # use google_cloud_storage::model::bucket::RetentionPolicy;
7196 /// let x = RetentionPolicy::new().set_is_locked(true);
7197 /// ```
7198 pub fn set_is_locked<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
7199 self.is_locked = v.into();
7200 self
7201 }
7202
7203 /// Sets the value of [retention_duration][crate::model::bucket::RetentionPolicy::retention_duration].
7204 ///
7205 /// # Example
7206 /// ```ignore,no_run
7207 /// # use google_cloud_storage::model::bucket::RetentionPolicy;
7208 /// use wkt::Duration;
7209 /// let x = RetentionPolicy::new().set_retention_duration(Duration::default()/* use setters */);
7210 /// ```
7211 pub fn set_retention_duration<T>(mut self, v: T) -> Self
7212 where
7213 T: std::convert::Into<wkt::Duration>,
7214 {
7215 self.retention_duration = std::option::Option::Some(v.into());
7216 self
7217 }
7218
7219 /// Sets or clears the value of [retention_duration][crate::model::bucket::RetentionPolicy::retention_duration].
7220 ///
7221 /// # Example
7222 /// ```ignore,no_run
7223 /// # use google_cloud_storage::model::bucket::RetentionPolicy;
7224 /// use wkt::Duration;
7225 /// let x = RetentionPolicy::new().set_or_clear_retention_duration(Some(Duration::default()/* use setters */));
7226 /// let x = RetentionPolicy::new().set_or_clear_retention_duration(None::<Duration>);
7227 /// ```
7228 pub fn set_or_clear_retention_duration<T>(mut self, v: std::option::Option<T>) -> Self
7229 where
7230 T: std::convert::Into<wkt::Duration>,
7231 {
7232 self.retention_duration = v.map(|x| x.into());
7233 self
7234 }
7235 }
7236
7237 impl wkt::message::Message for RetentionPolicy {
7238 fn typename() -> &'static str {
7239 "type.googleapis.com/google.storage.v2.Bucket.RetentionPolicy"
7240 }
7241 }
7242
7243 /// Soft delete policy properties of a bucket.
7244 #[derive(Clone, Default, PartialEq)]
7245 #[non_exhaustive]
7246 pub struct SoftDeletePolicy {
7247 /// The period of time that soft-deleted objects in the bucket must be
7248 /// retained and cannot be permanently deleted. The duration must be greater
7249 /// than or equal to 7 days and less than 1 year.
7250 pub retention_duration: std::option::Option<wkt::Duration>,
7251
7252 /// Time from which the policy was effective. This is service-provided.
7253 pub effective_time: std::option::Option<wkt::Timestamp>,
7254
7255 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
7256 }
7257
7258 impl SoftDeletePolicy {
7259 pub fn new() -> Self {
7260 std::default::Default::default()
7261 }
7262
7263 /// Sets the value of [retention_duration][crate::model::bucket::SoftDeletePolicy::retention_duration].
7264 ///
7265 /// # Example
7266 /// ```ignore,no_run
7267 /// # use google_cloud_storage::model::bucket::SoftDeletePolicy;
7268 /// use wkt::Duration;
7269 /// let x = SoftDeletePolicy::new().set_retention_duration(Duration::default()/* use setters */);
7270 /// ```
7271 pub fn set_retention_duration<T>(mut self, v: T) -> Self
7272 where
7273 T: std::convert::Into<wkt::Duration>,
7274 {
7275 self.retention_duration = std::option::Option::Some(v.into());
7276 self
7277 }
7278
7279 /// Sets or clears the value of [retention_duration][crate::model::bucket::SoftDeletePolicy::retention_duration].
7280 ///
7281 /// # Example
7282 /// ```ignore,no_run
7283 /// # use google_cloud_storage::model::bucket::SoftDeletePolicy;
7284 /// use wkt::Duration;
7285 /// let x = SoftDeletePolicy::new().set_or_clear_retention_duration(Some(Duration::default()/* use setters */));
7286 /// let x = SoftDeletePolicy::new().set_or_clear_retention_duration(None::<Duration>);
7287 /// ```
7288 pub fn set_or_clear_retention_duration<T>(mut self, v: std::option::Option<T>) -> Self
7289 where
7290 T: std::convert::Into<wkt::Duration>,
7291 {
7292 self.retention_duration = v.map(|x| x.into());
7293 self
7294 }
7295
7296 /// Sets the value of [effective_time][crate::model::bucket::SoftDeletePolicy::effective_time].
7297 ///
7298 /// # Example
7299 /// ```ignore,no_run
7300 /// # use google_cloud_storage::model::bucket::SoftDeletePolicy;
7301 /// use wkt::Timestamp;
7302 /// let x = SoftDeletePolicy::new().set_effective_time(Timestamp::default()/* use setters */);
7303 /// ```
7304 pub fn set_effective_time<T>(mut self, v: T) -> Self
7305 where
7306 T: std::convert::Into<wkt::Timestamp>,
7307 {
7308 self.effective_time = std::option::Option::Some(v.into());
7309 self
7310 }
7311
7312 /// Sets or clears the value of [effective_time][crate::model::bucket::SoftDeletePolicy::effective_time].
7313 ///
7314 /// # Example
7315 /// ```ignore,no_run
7316 /// # use google_cloud_storage::model::bucket::SoftDeletePolicy;
7317 /// use wkt::Timestamp;
7318 /// let x = SoftDeletePolicy::new().set_or_clear_effective_time(Some(Timestamp::default()/* use setters */));
7319 /// let x = SoftDeletePolicy::new().set_or_clear_effective_time(None::<Timestamp>);
7320 /// ```
7321 pub fn set_or_clear_effective_time<T>(mut self, v: std::option::Option<T>) -> Self
7322 where
7323 T: std::convert::Into<wkt::Timestamp>,
7324 {
7325 self.effective_time = v.map(|x| x.into());
7326 self
7327 }
7328 }
7329
7330 impl wkt::message::Message for SoftDeletePolicy {
7331 fn typename() -> &'static str {
7332 "type.googleapis.com/google.storage.v2.Bucket.SoftDeletePolicy"
7333 }
7334 }
7335
7336 /// Properties of a bucket related to versioning.
7337 /// For more information about Cloud Storage versioning, see [Object
7338 /// versioning](https://cloud.google.com/storage/docs/object-versioning).
7339 #[derive(Clone, Default, PartialEq)]
7340 #[non_exhaustive]
7341 pub struct Versioning {
7342 /// Optional. While set to true, versioning is fully enabled for this bucket.
7343 pub enabled: bool,
7344
7345 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
7346 }
7347
7348 impl Versioning {
7349 pub fn new() -> Self {
7350 std::default::Default::default()
7351 }
7352
7353 /// Sets the value of [enabled][crate::model::bucket::Versioning::enabled].
7354 ///
7355 /// # Example
7356 /// ```ignore,no_run
7357 /// # use google_cloud_storage::model::bucket::Versioning;
7358 /// let x = Versioning::new().set_enabled(true);
7359 /// ```
7360 pub fn set_enabled<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
7361 self.enabled = v.into();
7362 self
7363 }
7364 }
7365
7366 impl wkt::message::Message for Versioning {
7367 fn typename() -> &'static str {
7368 "type.googleapis.com/google.storage.v2.Bucket.Versioning"
7369 }
7370 }
7371
7372 /// Properties of a bucket related to accessing the contents as a static
7373 /// website. For details, see [hosting a static website using Cloud
7374 /// Storage](https://cloud.google.com/storage/docs/hosting-static-website).
7375 #[derive(Clone, Default, PartialEq)]
7376 #[non_exhaustive]
7377 pub struct Website {
7378 /// Optional. If the requested object path is missing, the service ensures
7379 /// the path has a trailing '/', append this suffix, and attempt to retrieve
7380 /// the resulting object. This allows the creation of `index.html` objects to
7381 /// represent directory pages.
7382 pub main_page_suffix: std::string::String,
7383
7384 /// Optional. If the requested object path is missing, and any
7385 /// `mainPageSuffix` object is missing, if applicable, the service
7386 /// returns the named object from this bucket as the content for a
7387 /// [404 Not Found](https://tools.ietf.org/html/rfc7231#section-6.5.4)
7388 /// result.
7389 pub not_found_page: std::string::String,
7390
7391 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
7392 }
7393
7394 impl Website {
7395 pub fn new() -> Self {
7396 std::default::Default::default()
7397 }
7398
7399 /// Sets the value of [main_page_suffix][crate::model::bucket::Website::main_page_suffix].
7400 ///
7401 /// # Example
7402 /// ```ignore,no_run
7403 /// # use google_cloud_storage::model::bucket::Website;
7404 /// let x = Website::new().set_main_page_suffix("example");
7405 /// ```
7406 pub fn set_main_page_suffix<T: std::convert::Into<std::string::String>>(
7407 mut self,
7408 v: T,
7409 ) -> Self {
7410 self.main_page_suffix = v.into();
7411 self
7412 }
7413
7414 /// Sets the value of [not_found_page][crate::model::bucket::Website::not_found_page].
7415 ///
7416 /// # Example
7417 /// ```ignore,no_run
7418 /// # use google_cloud_storage::model::bucket::Website;
7419 /// let x = Website::new().set_not_found_page("example");
7420 /// ```
7421 pub fn set_not_found_page<T: std::convert::Into<std::string::String>>(
7422 mut self,
7423 v: T,
7424 ) -> Self {
7425 self.not_found_page = v.into();
7426 self
7427 }
7428 }
7429
7430 impl wkt::message::Message for Website {
7431 fn typename() -> &'static str {
7432 "type.googleapis.com/google.storage.v2.Bucket.Website"
7433 }
7434 }
7435
7436 /// Configuration for [configurable dual-
7437 /// regions](https://cloud.google.com/storage/docs/locations#configurable). It
7438 /// should specify precisely two eligible regions within the same multi-region.
7439 /// For details, see
7440 /// [locations](https://cloud.google.com/storage/docs/locations).
7441 #[derive(Clone, Default, PartialEq)]
7442 #[non_exhaustive]
7443 pub struct CustomPlacementConfig {
7444 /// Optional. List of locations to use for data placement.
7445 pub data_locations: std::vec::Vec<std::string::String>,
7446
7447 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
7448 }
7449
7450 impl CustomPlacementConfig {
7451 pub fn new() -> Self {
7452 std::default::Default::default()
7453 }
7454
7455 /// Sets the value of [data_locations][crate::model::bucket::CustomPlacementConfig::data_locations].
7456 ///
7457 /// # Example
7458 /// ```ignore,no_run
7459 /// # use google_cloud_storage::model::bucket::CustomPlacementConfig;
7460 /// let x = CustomPlacementConfig::new().set_data_locations(["a", "b", "c"]);
7461 /// ```
7462 pub fn set_data_locations<T, V>(mut self, v: T) -> Self
7463 where
7464 T: std::iter::IntoIterator<Item = V>,
7465 V: std::convert::Into<std::string::String>,
7466 {
7467 use std::iter::Iterator;
7468 self.data_locations = v.into_iter().map(|i| i.into()).collect();
7469 self
7470 }
7471 }
7472
7473 impl wkt::message::Message for CustomPlacementConfig {
7474 fn typename() -> &'static str {
7475 "type.googleapis.com/google.storage.v2.Bucket.CustomPlacementConfig"
7476 }
7477 }
7478
7479 /// Configuration for a bucket's Autoclass feature.
7480 #[derive(Clone, Default, PartialEq)]
7481 #[non_exhaustive]
7482 pub struct Autoclass {
7483 /// Optional. Enables Autoclass.
7484 pub enabled: bool,
7485
7486 /// Output only. Latest instant at which the `enabled` field was set to true
7487 /// after being disabled/unconfigured or set to false after being enabled. If
7488 /// Autoclass is enabled when the bucket is created, the value of the
7489 /// `toggle_time` field is set to the bucket `create_time`.
7490 pub toggle_time: std::option::Option<wkt::Timestamp>,
7491
7492 /// An object in an Autoclass bucket eventually cools down to the
7493 /// terminal storage class if there is no access to the object.
7494 /// The only valid values are NEARLINE and ARCHIVE.
7495 pub terminal_storage_class: std::option::Option<std::string::String>,
7496
7497 /// Output only. Latest instant at which the autoclass terminal storage class
7498 /// was updated.
7499 pub terminal_storage_class_update_time: std::option::Option<wkt::Timestamp>,
7500
7501 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
7502 }
7503
7504 impl Autoclass {
7505 pub fn new() -> Self {
7506 std::default::Default::default()
7507 }
7508
7509 /// Sets the value of [enabled][crate::model::bucket::Autoclass::enabled].
7510 ///
7511 /// # Example
7512 /// ```ignore,no_run
7513 /// # use google_cloud_storage::model::bucket::Autoclass;
7514 /// let x = Autoclass::new().set_enabled(true);
7515 /// ```
7516 pub fn set_enabled<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
7517 self.enabled = v.into();
7518 self
7519 }
7520
7521 /// Sets the value of [toggle_time][crate::model::bucket::Autoclass::toggle_time].
7522 ///
7523 /// # Example
7524 /// ```ignore,no_run
7525 /// # use google_cloud_storage::model::bucket::Autoclass;
7526 /// use wkt::Timestamp;
7527 /// let x = Autoclass::new().set_toggle_time(Timestamp::default()/* use setters */);
7528 /// ```
7529 pub fn set_toggle_time<T>(mut self, v: T) -> Self
7530 where
7531 T: std::convert::Into<wkt::Timestamp>,
7532 {
7533 self.toggle_time = std::option::Option::Some(v.into());
7534 self
7535 }
7536
7537 /// Sets or clears the value of [toggle_time][crate::model::bucket::Autoclass::toggle_time].
7538 ///
7539 /// # Example
7540 /// ```ignore,no_run
7541 /// # use google_cloud_storage::model::bucket::Autoclass;
7542 /// use wkt::Timestamp;
7543 /// let x = Autoclass::new().set_or_clear_toggle_time(Some(Timestamp::default()/* use setters */));
7544 /// let x = Autoclass::new().set_or_clear_toggle_time(None::<Timestamp>);
7545 /// ```
7546 pub fn set_or_clear_toggle_time<T>(mut self, v: std::option::Option<T>) -> Self
7547 where
7548 T: std::convert::Into<wkt::Timestamp>,
7549 {
7550 self.toggle_time = v.map(|x| x.into());
7551 self
7552 }
7553
7554 /// Sets the value of [terminal_storage_class][crate::model::bucket::Autoclass::terminal_storage_class].
7555 ///
7556 /// # Example
7557 /// ```ignore,no_run
7558 /// # use google_cloud_storage::model::bucket::Autoclass;
7559 /// let x = Autoclass::new().set_terminal_storage_class("example");
7560 /// ```
7561 pub fn set_terminal_storage_class<T>(mut self, v: T) -> Self
7562 where
7563 T: std::convert::Into<std::string::String>,
7564 {
7565 self.terminal_storage_class = std::option::Option::Some(v.into());
7566 self
7567 }
7568
7569 /// Sets or clears the value of [terminal_storage_class][crate::model::bucket::Autoclass::terminal_storage_class].
7570 ///
7571 /// # Example
7572 /// ```ignore,no_run
7573 /// # use google_cloud_storage::model::bucket::Autoclass;
7574 /// let x = Autoclass::new().set_or_clear_terminal_storage_class(Some("example"));
7575 /// let x = Autoclass::new().set_or_clear_terminal_storage_class(None::<String>);
7576 /// ```
7577 pub fn set_or_clear_terminal_storage_class<T>(mut self, v: std::option::Option<T>) -> Self
7578 where
7579 T: std::convert::Into<std::string::String>,
7580 {
7581 self.terminal_storage_class = v.map(|x| x.into());
7582 self
7583 }
7584
7585 /// Sets the value of [terminal_storage_class_update_time][crate::model::bucket::Autoclass::terminal_storage_class_update_time].
7586 ///
7587 /// # Example
7588 /// ```ignore,no_run
7589 /// # use google_cloud_storage::model::bucket::Autoclass;
7590 /// use wkt::Timestamp;
7591 /// let x = Autoclass::new().set_terminal_storage_class_update_time(Timestamp::default()/* use setters */);
7592 /// ```
7593 pub fn set_terminal_storage_class_update_time<T>(mut self, v: T) -> Self
7594 where
7595 T: std::convert::Into<wkt::Timestamp>,
7596 {
7597 self.terminal_storage_class_update_time = std::option::Option::Some(v.into());
7598 self
7599 }
7600
7601 /// Sets or clears the value of [terminal_storage_class_update_time][crate::model::bucket::Autoclass::terminal_storage_class_update_time].
7602 ///
7603 /// # Example
7604 /// ```ignore,no_run
7605 /// # use google_cloud_storage::model::bucket::Autoclass;
7606 /// use wkt::Timestamp;
7607 /// let x = Autoclass::new().set_or_clear_terminal_storage_class_update_time(Some(Timestamp::default()/* use setters */));
7608 /// let x = Autoclass::new().set_or_clear_terminal_storage_class_update_time(None::<Timestamp>);
7609 /// ```
7610 pub fn set_or_clear_terminal_storage_class_update_time<T>(
7611 mut self,
7612 v: std::option::Option<T>,
7613 ) -> Self
7614 where
7615 T: std::convert::Into<wkt::Timestamp>,
7616 {
7617 self.terminal_storage_class_update_time = v.map(|x| x.into());
7618 self
7619 }
7620 }
7621
7622 impl wkt::message::Message for Autoclass {
7623 fn typename() -> &'static str {
7624 "type.googleapis.com/google.storage.v2.Bucket.Autoclass"
7625 }
7626 }
7627
7628 /// The [bucket IP
7629 /// filtering](https://cloud.google.com/storage/docs/ip-filtering-overview)
7630 /// configuration. Specifies the network sources that can access the bucket, as
7631 /// well as its underlying objects.
7632 #[derive(Clone, Default, PartialEq)]
7633 #[non_exhaustive]
7634 pub struct IpFilter {
7635 /// The state of the IP filter configuration. Valid values are `Enabled` and
7636 /// `Disabled`. When set to `Enabled`, IP filtering rules are applied to a
7637 /// bucket and all incoming requests to the bucket are evaluated against
7638 /// these rules. When set to `Disabled`, IP filtering rules are not applied
7639 /// to a bucket.
7640 pub mode: std::option::Option<std::string::String>,
7641
7642 /// Public IPs allowed to operate or access the bucket.
7643 pub public_network_source:
7644 std::option::Option<crate::model::bucket::ip_filter::PublicNetworkSource>,
7645
7646 /// Optional. The list of network sources that are allowed to access
7647 /// operations on the bucket or the underlying objects.
7648 pub vpc_network_sources: std::vec::Vec<crate::model::bucket::ip_filter::VpcNetworkSource>,
7649
7650 /// Optional. Whether or not to allow VPCs from orgs different than the
7651 /// bucket's parent org to access the bucket. When set to true, validations
7652 /// on the existence of the VPCs won't be performed. If set to false, each
7653 /// VPC network source is checked to belong to the same org as the bucket as
7654 /// well as validated for existence.
7655 pub allow_cross_org_vpcs: bool,
7656
7657 /// Whether or not to allow all P4SA access to the bucket. When set to true,
7658 /// IP filter config validation doesn't apply.
7659 pub allow_all_service_agent_access: std::option::Option<bool>,
7660
7661 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
7662 }
7663
7664 impl IpFilter {
7665 pub fn new() -> Self {
7666 std::default::Default::default()
7667 }
7668
7669 /// Sets the value of [mode][crate::model::bucket::IpFilter::mode].
7670 ///
7671 /// # Example
7672 /// ```ignore,no_run
7673 /// # use google_cloud_storage::model::bucket::IpFilter;
7674 /// let x = IpFilter::new().set_mode("example");
7675 /// ```
7676 pub fn set_mode<T>(mut self, v: T) -> Self
7677 where
7678 T: std::convert::Into<std::string::String>,
7679 {
7680 self.mode = std::option::Option::Some(v.into());
7681 self
7682 }
7683
7684 /// Sets or clears the value of [mode][crate::model::bucket::IpFilter::mode].
7685 ///
7686 /// # Example
7687 /// ```ignore,no_run
7688 /// # use google_cloud_storage::model::bucket::IpFilter;
7689 /// let x = IpFilter::new().set_or_clear_mode(Some("example"));
7690 /// let x = IpFilter::new().set_or_clear_mode(None::<String>);
7691 /// ```
7692 pub fn set_or_clear_mode<T>(mut self, v: std::option::Option<T>) -> Self
7693 where
7694 T: std::convert::Into<std::string::String>,
7695 {
7696 self.mode = v.map(|x| x.into());
7697 self
7698 }
7699
7700 /// Sets the value of [public_network_source][crate::model::bucket::IpFilter::public_network_source].
7701 ///
7702 /// # Example
7703 /// ```ignore,no_run
7704 /// # use google_cloud_storage::model::bucket::IpFilter;
7705 /// use google_cloud_storage::model::bucket::ip_filter::PublicNetworkSource;
7706 /// let x = IpFilter::new().set_public_network_source(PublicNetworkSource::default()/* use setters */);
7707 /// ```
7708 pub fn set_public_network_source<T>(mut self, v: T) -> Self
7709 where
7710 T: std::convert::Into<crate::model::bucket::ip_filter::PublicNetworkSource>,
7711 {
7712 self.public_network_source = std::option::Option::Some(v.into());
7713 self
7714 }
7715
7716 /// Sets or clears the value of [public_network_source][crate::model::bucket::IpFilter::public_network_source].
7717 ///
7718 /// # Example
7719 /// ```ignore,no_run
7720 /// # use google_cloud_storage::model::bucket::IpFilter;
7721 /// use google_cloud_storage::model::bucket::ip_filter::PublicNetworkSource;
7722 /// let x = IpFilter::new().set_or_clear_public_network_source(Some(PublicNetworkSource::default()/* use setters */));
7723 /// let x = IpFilter::new().set_or_clear_public_network_source(None::<PublicNetworkSource>);
7724 /// ```
7725 pub fn set_or_clear_public_network_source<T>(mut self, v: std::option::Option<T>) -> Self
7726 where
7727 T: std::convert::Into<crate::model::bucket::ip_filter::PublicNetworkSource>,
7728 {
7729 self.public_network_source = v.map(|x| x.into());
7730 self
7731 }
7732
7733 /// Sets the value of [vpc_network_sources][crate::model::bucket::IpFilter::vpc_network_sources].
7734 ///
7735 /// # Example
7736 /// ```ignore,no_run
7737 /// # use google_cloud_storage::model::bucket::IpFilter;
7738 /// use google_cloud_storage::model::bucket::ip_filter::VpcNetworkSource;
7739 /// let x = IpFilter::new()
7740 /// .set_vpc_network_sources([
7741 /// VpcNetworkSource::default()/* use setters */,
7742 /// VpcNetworkSource::default()/* use (different) setters */,
7743 /// ]);
7744 /// ```
7745 pub fn set_vpc_network_sources<T, V>(mut self, v: T) -> Self
7746 where
7747 T: std::iter::IntoIterator<Item = V>,
7748 V: std::convert::Into<crate::model::bucket::ip_filter::VpcNetworkSource>,
7749 {
7750 use std::iter::Iterator;
7751 self.vpc_network_sources = v.into_iter().map(|i| i.into()).collect();
7752 self
7753 }
7754
7755 /// Sets the value of [allow_cross_org_vpcs][crate::model::bucket::IpFilter::allow_cross_org_vpcs].
7756 ///
7757 /// # Example
7758 /// ```ignore,no_run
7759 /// # use google_cloud_storage::model::bucket::IpFilter;
7760 /// let x = IpFilter::new().set_allow_cross_org_vpcs(true);
7761 /// ```
7762 pub fn set_allow_cross_org_vpcs<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
7763 self.allow_cross_org_vpcs = v.into();
7764 self
7765 }
7766
7767 /// Sets the value of [allow_all_service_agent_access][crate::model::bucket::IpFilter::allow_all_service_agent_access].
7768 ///
7769 /// # Example
7770 /// ```ignore,no_run
7771 /// # use google_cloud_storage::model::bucket::IpFilter;
7772 /// let x = IpFilter::new().set_allow_all_service_agent_access(true);
7773 /// ```
7774 pub fn set_allow_all_service_agent_access<T>(mut self, v: T) -> Self
7775 where
7776 T: std::convert::Into<bool>,
7777 {
7778 self.allow_all_service_agent_access = std::option::Option::Some(v.into());
7779 self
7780 }
7781
7782 /// Sets or clears the value of [allow_all_service_agent_access][crate::model::bucket::IpFilter::allow_all_service_agent_access].
7783 ///
7784 /// # Example
7785 /// ```ignore,no_run
7786 /// # use google_cloud_storage::model::bucket::IpFilter;
7787 /// let x = IpFilter::new().set_or_clear_allow_all_service_agent_access(Some(false));
7788 /// let x = IpFilter::new().set_or_clear_allow_all_service_agent_access(None::<bool>);
7789 /// ```
7790 pub fn set_or_clear_allow_all_service_agent_access<T>(
7791 mut self,
7792 v: std::option::Option<T>,
7793 ) -> Self
7794 where
7795 T: std::convert::Into<bool>,
7796 {
7797 self.allow_all_service_agent_access = v.map(|x| x.into());
7798 self
7799 }
7800 }
7801
7802 impl wkt::message::Message for IpFilter {
7803 fn typename() -> &'static str {
7804 "type.googleapis.com/google.storage.v2.Bucket.IpFilter"
7805 }
7806 }
7807
7808 /// Defines additional types related to [IpFilter].
7809 pub mod ip_filter {
7810 #[allow(unused_imports)]
7811 use super::*;
7812
7813 /// The public network IP address ranges that can access the bucket and its
7814 /// data.
7815 #[derive(Clone, Default, PartialEq)]
7816 #[non_exhaustive]
7817 pub struct PublicNetworkSource {
7818 /// Optional. The list of IPv4 and IPv6 cidr blocks that are allowed to
7819 /// operate or access the bucket and its underlying objects.
7820 pub allowed_ip_cidr_ranges: std::vec::Vec<std::string::String>,
7821
7822 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
7823 }
7824
7825 impl PublicNetworkSource {
7826 pub fn new() -> Self {
7827 std::default::Default::default()
7828 }
7829
7830 /// Sets the value of [allowed_ip_cidr_ranges][crate::model::bucket::ip_filter::PublicNetworkSource::allowed_ip_cidr_ranges].
7831 ///
7832 /// # Example
7833 /// ```ignore,no_run
7834 /// # use google_cloud_storage::model::bucket::ip_filter::PublicNetworkSource;
7835 /// let x = PublicNetworkSource::new().set_allowed_ip_cidr_ranges(["a", "b", "c"]);
7836 /// ```
7837 pub fn set_allowed_ip_cidr_ranges<T, V>(mut self, v: T) -> Self
7838 where
7839 T: std::iter::IntoIterator<Item = V>,
7840 V: std::convert::Into<std::string::String>,
7841 {
7842 use std::iter::Iterator;
7843 self.allowed_ip_cidr_ranges = v.into_iter().map(|i| i.into()).collect();
7844 self
7845 }
7846 }
7847
7848 impl wkt::message::Message for PublicNetworkSource {
7849 fn typename() -> &'static str {
7850 "type.googleapis.com/google.storage.v2.Bucket.IpFilter.PublicNetworkSource"
7851 }
7852 }
7853
7854 /// The list of VPC networks that can access the bucket.
7855 #[derive(Clone, Default, PartialEq)]
7856 #[non_exhaustive]
7857 pub struct VpcNetworkSource {
7858 /// Name of the network.
7859 ///
7860 /// Format: `projects/PROJECT_ID/global/networks/NETWORK_NAME`
7861 pub network: std::option::Option<std::string::String>,
7862
7863 /// Optional. The list of public or private IPv4 and IPv6 CIDR ranges that
7864 /// can access the bucket. In the CIDR IP address block, the specified IP
7865 /// address must be properly truncated, meaning all the host bits must be
7866 /// zero or else the input is considered malformed. For example,
7867 /// `192.0.2.0/24` is accepted but `192.0.2.1/24` is not. Similarly, for
7868 /// IPv6, `2001:db8::/32` is accepted whereas `2001:db8::1/32` is not.
7869 pub allowed_ip_cidr_ranges: std::vec::Vec<std::string::String>,
7870
7871 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
7872 }
7873
7874 impl VpcNetworkSource {
7875 pub fn new() -> Self {
7876 std::default::Default::default()
7877 }
7878
7879 /// Sets the value of [network][crate::model::bucket::ip_filter::VpcNetworkSource::network].
7880 ///
7881 /// # Example
7882 /// ```ignore,no_run
7883 /// # use google_cloud_storage::model::bucket::ip_filter::VpcNetworkSource;
7884 /// let x = VpcNetworkSource::new().set_network("example");
7885 /// ```
7886 pub fn set_network<T>(mut self, v: T) -> Self
7887 where
7888 T: std::convert::Into<std::string::String>,
7889 {
7890 self.network = std::option::Option::Some(v.into());
7891 self
7892 }
7893
7894 /// Sets or clears the value of [network][crate::model::bucket::ip_filter::VpcNetworkSource::network].
7895 ///
7896 /// # Example
7897 /// ```ignore,no_run
7898 /// # use google_cloud_storage::model::bucket::ip_filter::VpcNetworkSource;
7899 /// let x = VpcNetworkSource::new().set_or_clear_network(Some("example"));
7900 /// let x = VpcNetworkSource::new().set_or_clear_network(None::<String>);
7901 /// ```
7902 pub fn set_or_clear_network<T>(mut self, v: std::option::Option<T>) -> Self
7903 where
7904 T: std::convert::Into<std::string::String>,
7905 {
7906 self.network = v.map(|x| x.into());
7907 self
7908 }
7909
7910 /// Sets the value of [allowed_ip_cidr_ranges][crate::model::bucket::ip_filter::VpcNetworkSource::allowed_ip_cidr_ranges].
7911 ///
7912 /// # Example
7913 /// ```ignore,no_run
7914 /// # use google_cloud_storage::model::bucket::ip_filter::VpcNetworkSource;
7915 /// let x = VpcNetworkSource::new().set_allowed_ip_cidr_ranges(["a", "b", "c"]);
7916 /// ```
7917 pub fn set_allowed_ip_cidr_ranges<T, V>(mut self, v: T) -> Self
7918 where
7919 T: std::iter::IntoIterator<Item = V>,
7920 V: std::convert::Into<std::string::String>,
7921 {
7922 use std::iter::Iterator;
7923 self.allowed_ip_cidr_ranges = v.into_iter().map(|i| i.into()).collect();
7924 self
7925 }
7926 }
7927
7928 impl wkt::message::Message for VpcNetworkSource {
7929 fn typename() -> &'static str {
7930 "type.googleapis.com/google.storage.v2.Bucket.IpFilter.VpcNetworkSource"
7931 }
7932 }
7933 }
7934
7935 /// Configuration for a bucket's hierarchical namespace feature.
7936 #[derive(Clone, Default, PartialEq)]
7937 #[non_exhaustive]
7938 pub struct HierarchicalNamespace {
7939 /// Optional. Enables the hierarchical namespace feature.
7940 pub enabled: bool,
7941
7942 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
7943 }
7944
7945 impl HierarchicalNamespace {
7946 pub fn new() -> Self {
7947 std::default::Default::default()
7948 }
7949
7950 /// Sets the value of [enabled][crate::model::bucket::HierarchicalNamespace::enabled].
7951 ///
7952 /// # Example
7953 /// ```ignore,no_run
7954 /// # use google_cloud_storage::model::bucket::HierarchicalNamespace;
7955 /// let x = HierarchicalNamespace::new().set_enabled(true);
7956 /// ```
7957 pub fn set_enabled<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
7958 self.enabled = v.into();
7959 self
7960 }
7961 }
7962
7963 impl wkt::message::Message for HierarchicalNamespace {
7964 fn typename() -> &'static str {
7965 "type.googleapis.com/google.storage.v2.Bucket.HierarchicalNamespace"
7966 }
7967 }
7968}
7969
7970/// An access-control entry.
7971#[derive(Clone, Default, PartialEq)]
7972#[non_exhaustive]
7973pub struct BucketAccessControl {
7974 /// Optional. The access permission for the entity.
7975 pub role: std::string::String,
7976
7977 /// Optional. The ID of the access-control entry.
7978 pub id: std::string::String,
7979
7980 /// Optional. The entity holding the permission, in one of the following forms:
7981 ///
7982 /// * `user-{userid}`
7983 /// * `user-{email}`
7984 /// * `group-{groupid}`
7985 /// * `group-{email}`
7986 /// * `domain-{domain}`
7987 /// * `project-{team}-{projectnumber}`
7988 /// * `project-{team}-{projectid}`
7989 /// * `allUsers`
7990 /// * `allAuthenticatedUsers`
7991 /// Examples:
7992 /// * The user `liz@example.com` would be `user-liz@example.com`.
7993 /// * The group `example@googlegroups.com` would be
7994 /// `group-example@googlegroups.com`
7995 /// * All members of the Google Apps for Business domain `example.com` would be
7996 /// `domain-example.com`
7997 /// For project entities, `project-{team}-{projectnumber}` format is
7998 /// returned on response.
7999 pub entity: std::string::String,
8000
8001 /// Output only. The alternative entity format, if exists. For project
8002 /// entities, `project-{team}-{projectid}` format is returned in the response.
8003 pub entity_alt: std::string::String,
8004
8005 /// Optional. The ID for the entity, if any.
8006 pub entity_id: std::string::String,
8007
8008 /// Optional. The `etag` of the `BucketAccessControl`.
8009 /// If included in the metadata of an update or delete request message, the
8010 /// operation operation is only performed if the etag matches that of the
8011 /// bucket's `BucketAccessControl`.
8012 pub etag: std::string::String,
8013
8014 /// Optional. The email address associated with the entity, if any.
8015 pub email: std::string::String,
8016
8017 /// Optional. The domain associated with the entity, if any.
8018 pub domain: std::string::String,
8019
8020 /// Optional. The project team associated with the entity, if any.
8021 pub project_team: std::option::Option<crate::model::ProjectTeam>,
8022
8023 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
8024}
8025
8026impl BucketAccessControl {
8027 pub fn new() -> Self {
8028 std::default::Default::default()
8029 }
8030
8031 /// Sets the value of [role][crate::model::BucketAccessControl::role].
8032 ///
8033 /// # Example
8034 /// ```ignore,no_run
8035 /// # use google_cloud_storage::model::BucketAccessControl;
8036 /// let x = BucketAccessControl::new().set_role("example");
8037 /// ```
8038 pub fn set_role<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
8039 self.role = v.into();
8040 self
8041 }
8042
8043 /// Sets the value of [id][crate::model::BucketAccessControl::id].
8044 ///
8045 /// # Example
8046 /// ```ignore,no_run
8047 /// # use google_cloud_storage::model::BucketAccessControl;
8048 /// let x = BucketAccessControl::new().set_id("example");
8049 /// ```
8050 pub fn set_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
8051 self.id = v.into();
8052 self
8053 }
8054
8055 /// Sets the value of [entity][crate::model::BucketAccessControl::entity].
8056 ///
8057 /// # Example
8058 /// ```ignore,no_run
8059 /// # use google_cloud_storage::model::BucketAccessControl;
8060 /// let x = BucketAccessControl::new().set_entity("example");
8061 /// ```
8062 pub fn set_entity<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
8063 self.entity = v.into();
8064 self
8065 }
8066
8067 /// Sets the value of [entity_alt][crate::model::BucketAccessControl::entity_alt].
8068 ///
8069 /// # Example
8070 /// ```ignore,no_run
8071 /// # use google_cloud_storage::model::BucketAccessControl;
8072 /// let x = BucketAccessControl::new().set_entity_alt("example");
8073 /// ```
8074 pub fn set_entity_alt<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
8075 self.entity_alt = v.into();
8076 self
8077 }
8078
8079 /// Sets the value of [entity_id][crate::model::BucketAccessControl::entity_id].
8080 ///
8081 /// # Example
8082 /// ```ignore,no_run
8083 /// # use google_cloud_storage::model::BucketAccessControl;
8084 /// let x = BucketAccessControl::new().set_entity_id("example");
8085 /// ```
8086 pub fn set_entity_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
8087 self.entity_id = v.into();
8088 self
8089 }
8090
8091 /// Sets the value of [etag][crate::model::BucketAccessControl::etag].
8092 ///
8093 /// # Example
8094 /// ```ignore,no_run
8095 /// # use google_cloud_storage::model::BucketAccessControl;
8096 /// let x = BucketAccessControl::new().set_etag("example");
8097 /// ```
8098 pub fn set_etag<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
8099 self.etag = v.into();
8100 self
8101 }
8102
8103 /// Sets the value of [email][crate::model::BucketAccessControl::email].
8104 ///
8105 /// # Example
8106 /// ```ignore,no_run
8107 /// # use google_cloud_storage::model::BucketAccessControl;
8108 /// let x = BucketAccessControl::new().set_email("example");
8109 /// ```
8110 pub fn set_email<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
8111 self.email = v.into();
8112 self
8113 }
8114
8115 /// Sets the value of [domain][crate::model::BucketAccessControl::domain].
8116 ///
8117 /// # Example
8118 /// ```ignore,no_run
8119 /// # use google_cloud_storage::model::BucketAccessControl;
8120 /// let x = BucketAccessControl::new().set_domain("example");
8121 /// ```
8122 pub fn set_domain<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
8123 self.domain = v.into();
8124 self
8125 }
8126
8127 /// Sets the value of [project_team][crate::model::BucketAccessControl::project_team].
8128 ///
8129 /// # Example
8130 /// ```ignore,no_run
8131 /// # use google_cloud_storage::model::BucketAccessControl;
8132 /// use google_cloud_storage::model::ProjectTeam;
8133 /// let x = BucketAccessControl::new().set_project_team(ProjectTeam::default()/* use setters */);
8134 /// ```
8135 pub fn set_project_team<T>(mut self, v: T) -> Self
8136 where
8137 T: std::convert::Into<crate::model::ProjectTeam>,
8138 {
8139 self.project_team = std::option::Option::Some(v.into());
8140 self
8141 }
8142
8143 /// Sets or clears the value of [project_team][crate::model::BucketAccessControl::project_team].
8144 ///
8145 /// # Example
8146 /// ```ignore,no_run
8147 /// # use google_cloud_storage::model::BucketAccessControl;
8148 /// use google_cloud_storage::model::ProjectTeam;
8149 /// let x = BucketAccessControl::new().set_or_clear_project_team(Some(ProjectTeam::default()/* use setters */));
8150 /// let x = BucketAccessControl::new().set_or_clear_project_team(None::<ProjectTeam>);
8151 /// ```
8152 pub fn set_or_clear_project_team<T>(mut self, v: std::option::Option<T>) -> Self
8153 where
8154 T: std::convert::Into<crate::model::ProjectTeam>,
8155 {
8156 self.project_team = v.map(|x| x.into());
8157 self
8158 }
8159}
8160
8161impl wkt::message::Message for BucketAccessControl {
8162 fn typename() -> &'static str {
8163 "type.googleapis.com/google.storage.v2.BucketAccessControl"
8164 }
8165}
8166
8167/// Message used for storing full (not subrange) object checksums.
8168#[derive(Clone, Default, PartialEq)]
8169#[non_exhaustive]
8170pub struct ObjectChecksums {
8171 /// CRC32C digest of the object data. Computed by the Cloud Storage service for
8172 /// all written objects.
8173 /// If set in a WriteObjectRequest, service validates that the stored
8174 /// object matches this checksum.
8175 pub crc32c: std::option::Option<u32>,
8176
8177 /// Optional. 128 bit MD5 hash of the object data. For more information about
8178 /// using the MD5 hash, see [Data validation and change
8179 /// detection](https://cloud.google.com/storage/docs/data-validation). Not all
8180 /// objects provide an MD5 hash. For example, composite objects provide only
8181 /// crc32c hashes. This value is equivalent to running `cat object.txt |
8182 /// openssl md5 -binary`
8183 pub md5_hash: ::bytes::Bytes,
8184
8185 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
8186}
8187
8188impl ObjectChecksums {
8189 pub fn new() -> Self {
8190 std::default::Default::default()
8191 }
8192
8193 /// Sets the value of [crc32c][crate::model::ObjectChecksums::crc32c].
8194 ///
8195 /// # Example
8196 /// ```ignore,no_run
8197 /// # use google_cloud_storage::model::ObjectChecksums;
8198 /// let x = ObjectChecksums::new().set_crc32c(42_u32);
8199 /// ```
8200 pub fn set_crc32c<T>(mut self, v: T) -> Self
8201 where
8202 T: std::convert::Into<u32>,
8203 {
8204 self.crc32c = std::option::Option::Some(v.into());
8205 self
8206 }
8207
8208 /// Sets or clears the value of [crc32c][crate::model::ObjectChecksums::crc32c].
8209 ///
8210 /// # Example
8211 /// ```ignore,no_run
8212 /// # use google_cloud_storage::model::ObjectChecksums;
8213 /// let x = ObjectChecksums::new().set_or_clear_crc32c(Some(42_u32));
8214 /// let x = ObjectChecksums::new().set_or_clear_crc32c(None::<u32>);
8215 /// ```
8216 pub fn set_or_clear_crc32c<T>(mut self, v: std::option::Option<T>) -> Self
8217 where
8218 T: std::convert::Into<u32>,
8219 {
8220 self.crc32c = v.map(|x| x.into());
8221 self
8222 }
8223
8224 /// Sets the value of [md5_hash][crate::model::ObjectChecksums::md5_hash].
8225 ///
8226 /// # Example
8227 /// ```ignore,no_run
8228 /// # use google_cloud_storage::model::ObjectChecksums;
8229 /// let x = ObjectChecksums::new().set_md5_hash(bytes::Bytes::from_static(b"example"));
8230 /// ```
8231 pub fn set_md5_hash<T: std::convert::Into<::bytes::Bytes>>(mut self, v: T) -> Self {
8232 self.md5_hash = v.into();
8233 self
8234 }
8235}
8236
8237impl wkt::message::Message for ObjectChecksums {
8238 fn typename() -> &'static str {
8239 "type.googleapis.com/google.storage.v2.ObjectChecksums"
8240 }
8241}
8242
8243/// The payload of a single user-defined object context.
8244#[derive(Clone, Default, PartialEq)]
8245#[non_exhaustive]
8246pub struct ObjectCustomContextPayload {
8247 /// Required. The value of the object context.
8248 pub value: std::string::String,
8249
8250 /// Output only. The time at which the object context was created.
8251 pub create_time: std::option::Option<wkt::Timestamp>,
8252
8253 /// Output only. The time at which the object context was last updated.
8254 pub update_time: std::option::Option<wkt::Timestamp>,
8255
8256 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
8257}
8258
8259impl ObjectCustomContextPayload {
8260 pub fn new() -> Self {
8261 std::default::Default::default()
8262 }
8263
8264 /// Sets the value of [value][crate::model::ObjectCustomContextPayload::value].
8265 ///
8266 /// # Example
8267 /// ```ignore,no_run
8268 /// # use google_cloud_storage::model::ObjectCustomContextPayload;
8269 /// let x = ObjectCustomContextPayload::new().set_value("example");
8270 /// ```
8271 pub fn set_value<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
8272 self.value = v.into();
8273 self
8274 }
8275
8276 /// Sets the value of [create_time][crate::model::ObjectCustomContextPayload::create_time].
8277 ///
8278 /// # Example
8279 /// ```ignore,no_run
8280 /// # use google_cloud_storage::model::ObjectCustomContextPayload;
8281 /// use wkt::Timestamp;
8282 /// let x = ObjectCustomContextPayload::new().set_create_time(Timestamp::default()/* use setters */);
8283 /// ```
8284 pub fn set_create_time<T>(mut self, v: T) -> Self
8285 where
8286 T: std::convert::Into<wkt::Timestamp>,
8287 {
8288 self.create_time = std::option::Option::Some(v.into());
8289 self
8290 }
8291
8292 /// Sets or clears the value of [create_time][crate::model::ObjectCustomContextPayload::create_time].
8293 ///
8294 /// # Example
8295 /// ```ignore,no_run
8296 /// # use google_cloud_storage::model::ObjectCustomContextPayload;
8297 /// use wkt::Timestamp;
8298 /// let x = ObjectCustomContextPayload::new().set_or_clear_create_time(Some(Timestamp::default()/* use setters */));
8299 /// let x = ObjectCustomContextPayload::new().set_or_clear_create_time(None::<Timestamp>);
8300 /// ```
8301 pub fn set_or_clear_create_time<T>(mut self, v: std::option::Option<T>) -> Self
8302 where
8303 T: std::convert::Into<wkt::Timestamp>,
8304 {
8305 self.create_time = v.map(|x| x.into());
8306 self
8307 }
8308
8309 /// Sets the value of [update_time][crate::model::ObjectCustomContextPayload::update_time].
8310 ///
8311 /// # Example
8312 /// ```ignore,no_run
8313 /// # use google_cloud_storage::model::ObjectCustomContextPayload;
8314 /// use wkt::Timestamp;
8315 /// let x = ObjectCustomContextPayload::new().set_update_time(Timestamp::default()/* use setters */);
8316 /// ```
8317 pub fn set_update_time<T>(mut self, v: T) -> Self
8318 where
8319 T: std::convert::Into<wkt::Timestamp>,
8320 {
8321 self.update_time = std::option::Option::Some(v.into());
8322 self
8323 }
8324
8325 /// Sets or clears the value of [update_time][crate::model::ObjectCustomContextPayload::update_time].
8326 ///
8327 /// # Example
8328 /// ```ignore,no_run
8329 /// # use google_cloud_storage::model::ObjectCustomContextPayload;
8330 /// use wkt::Timestamp;
8331 /// let x = ObjectCustomContextPayload::new().set_or_clear_update_time(Some(Timestamp::default()/* use setters */));
8332 /// let x = ObjectCustomContextPayload::new().set_or_clear_update_time(None::<Timestamp>);
8333 /// ```
8334 pub fn set_or_clear_update_time<T>(mut self, v: std::option::Option<T>) -> Self
8335 where
8336 T: std::convert::Into<wkt::Timestamp>,
8337 {
8338 self.update_time = v.map(|x| x.into());
8339 self
8340 }
8341}
8342
8343impl wkt::message::Message for ObjectCustomContextPayload {
8344 fn typename() -> &'static str {
8345 "type.googleapis.com/google.storage.v2.ObjectCustomContextPayload"
8346 }
8347}
8348
8349/// All contexts of an object grouped by type.
8350#[derive(Clone, Default, PartialEq)]
8351#[non_exhaustive]
8352pub struct ObjectContexts {
8353 /// Optional. User-defined object contexts.
8354 pub custom:
8355 std::collections::HashMap<std::string::String, crate::model::ObjectCustomContextPayload>,
8356
8357 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
8358}
8359
8360impl ObjectContexts {
8361 pub fn new() -> Self {
8362 std::default::Default::default()
8363 }
8364
8365 /// Sets the value of [custom][crate::model::ObjectContexts::custom].
8366 ///
8367 /// # Example
8368 /// ```ignore,no_run
8369 /// # use google_cloud_storage::model::ObjectContexts;
8370 /// use google_cloud_storage::model::ObjectCustomContextPayload;
8371 /// let x = ObjectContexts::new().set_custom([
8372 /// ("key0", ObjectCustomContextPayload::default()/* use setters */),
8373 /// ("key1", ObjectCustomContextPayload::default()/* use (different) setters */),
8374 /// ]);
8375 /// ```
8376 pub fn set_custom<T, K, V>(mut self, v: T) -> Self
8377 where
8378 T: std::iter::IntoIterator<Item = (K, V)>,
8379 K: std::convert::Into<std::string::String>,
8380 V: std::convert::Into<crate::model::ObjectCustomContextPayload>,
8381 {
8382 use std::iter::Iterator;
8383 self.custom = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
8384 self
8385 }
8386}
8387
8388impl wkt::message::Message for ObjectContexts {
8389 fn typename() -> &'static str {
8390 "type.googleapis.com/google.storage.v2.ObjectContexts"
8391 }
8392}
8393
8394/// Describes the customer-supplied encryption key mechanism used to store an
8395/// object's data at rest.
8396#[derive(Clone, Default, PartialEq)]
8397#[non_exhaustive]
8398pub struct CustomerEncryption {
8399 /// Optional. The encryption algorithm.
8400 pub encryption_algorithm: std::string::String,
8401
8402 /// Optional. SHA256 hash value of the encryption key.
8403 /// In raw bytes format (not base64-encoded).
8404 pub key_sha256_bytes: ::bytes::Bytes,
8405
8406 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
8407}
8408
8409impl CustomerEncryption {
8410 pub fn new() -> Self {
8411 std::default::Default::default()
8412 }
8413
8414 /// Sets the value of [encryption_algorithm][crate::model::CustomerEncryption::encryption_algorithm].
8415 ///
8416 /// # Example
8417 /// ```ignore,no_run
8418 /// # use google_cloud_storage::model::CustomerEncryption;
8419 /// let x = CustomerEncryption::new().set_encryption_algorithm("example");
8420 /// ```
8421 pub fn set_encryption_algorithm<T: std::convert::Into<std::string::String>>(
8422 mut self,
8423 v: T,
8424 ) -> Self {
8425 self.encryption_algorithm = v.into();
8426 self
8427 }
8428
8429 /// Sets the value of [key_sha256_bytes][crate::model::CustomerEncryption::key_sha256_bytes].
8430 ///
8431 /// # Example
8432 /// ```ignore,no_run
8433 /// # use google_cloud_storage::model::CustomerEncryption;
8434 /// let x = CustomerEncryption::new().set_key_sha256_bytes(bytes::Bytes::from_static(b"example"));
8435 /// ```
8436 pub fn set_key_sha256_bytes<T: std::convert::Into<::bytes::Bytes>>(mut self, v: T) -> Self {
8437 self.key_sha256_bytes = v.into();
8438 self
8439 }
8440}
8441
8442impl wkt::message::Message for CustomerEncryption {
8443 fn typename() -> &'static str {
8444 "type.googleapis.com/google.storage.v2.CustomerEncryption"
8445 }
8446}
8447
8448/// An object.
8449#[derive(Clone, Default, PartialEq)]
8450#[non_exhaustive]
8451pub struct Object {
8452 /// Immutable. The name of this object. Nearly any sequence of unicode
8453 /// characters is valid. See
8454 /// [Guidelines](https://cloud.google.com/storage/docs/objects#naming).
8455 /// Example: `test.txt`
8456 /// The `name` field by itself does not uniquely identify a Cloud Storage
8457 /// object. A Cloud Storage object is uniquely identified by the tuple of
8458 /// (bucket, object, generation).
8459 pub name: std::string::String,
8460
8461 /// Immutable. The name of the bucket containing this object.
8462 pub bucket: std::string::String,
8463
8464 /// Optional. The `etag` of an object.
8465 /// If included in the metadata of an update or delete request message, the
8466 /// operation is only performed if the etag matches that of the live
8467 /// object.
8468 pub etag: std::string::String,
8469
8470 /// Immutable. The content generation of this object. Used for object
8471 /// versioning.
8472 pub generation: i64,
8473
8474 /// Output only. Restore token used to differentiate deleted objects with the
8475 /// same name and generation. This field is output only, and only set for
8476 /// deleted objects in HNS buckets.
8477 pub restore_token: std::option::Option<std::string::String>,
8478
8479 /// Output only. The version of the metadata for this generation of this
8480 /// object. Used for preconditions and for detecting changes in metadata. A
8481 /// metageneration number is only meaningful in the context of a particular
8482 /// generation of a particular object.
8483 pub metageneration: i64,
8484
8485 /// Optional. Storage class of the object.
8486 pub storage_class: std::string::String,
8487
8488 /// Output only. Content-Length of the object data in bytes, matching
8489 /// [RFC 7230 §3.3.2](<https://tools.ietf.org/html/rfc7230#section-3.3.2>]).
8490 pub size: i64,
8491
8492 /// Optional. Content-Encoding of the object data, matching
8493 /// [RFC 7231 §3.1.2.2](https://tools.ietf.org/html/rfc7231#section-3.1.2.2)
8494 pub content_encoding: std::string::String,
8495
8496 /// Optional. Content-Disposition of the object data, matching
8497 /// [RFC 6266](https://tools.ietf.org/html/rfc6266).
8498 pub content_disposition: std::string::String,
8499
8500 /// Optional. Cache-Control directive for the object data, matching
8501 /// [RFC 7234 §5.2](https://tools.ietf.org/html/rfc7234#section-5.2).
8502 /// If omitted, and the object is accessible to all anonymous users, the
8503 /// default is `public, max-age=3600`.
8504 pub cache_control: std::string::String,
8505
8506 /// Optional. Access controls on the object.
8507 /// If `iam_config.uniform_bucket_level_access` is enabled on the parent
8508 /// bucket, requests to set, read, or modify acl is an error.
8509 pub acl: std::vec::Vec<crate::model::ObjectAccessControl>,
8510
8511 /// Optional. Content-Language of the object data, matching
8512 /// [RFC 7231 §3.1.3.2](https://tools.ietf.org/html/rfc7231#section-3.1.3.2).
8513 pub content_language: std::string::String,
8514
8515 /// Output only. If this object is noncurrent, this is the time when the object
8516 /// became noncurrent.
8517 pub delete_time: std::option::Option<wkt::Timestamp>,
8518
8519 /// Output only. The time when the object was finalized.
8520 pub finalize_time: std::option::Option<wkt::Timestamp>,
8521
8522 /// Optional. Content-Type of the object data, matching
8523 /// [RFC 7231 §3.1.1.5](https://tools.ietf.org/html/rfc7231#section-3.1.1.5).
8524 /// If an object is stored without a Content-Type, it is served as
8525 /// `application/octet-stream`.
8526 pub content_type: std::string::String,
8527
8528 /// Output only. The creation time of the object.
8529 pub create_time: std::option::Option<wkt::Timestamp>,
8530
8531 /// Output only. Number of underlying components that make up this object.
8532 /// Components are accumulated by compose operations.
8533 pub component_count: i32,
8534
8535 /// Output only. Hashes for the data part of this object. This field is used
8536 /// for output only and is silently ignored if provided in requests. The
8537 /// checksums of the complete object regardless of data range. If the object is
8538 /// downloaded in full, the client should compute one of these checksums over
8539 /// the downloaded object and compare it against the value provided here.
8540 pub checksums: std::option::Option<crate::model::ObjectChecksums>,
8541
8542 /// Output only. The modification time of the object metadata.
8543 /// Set initially to object creation time and then updated whenever any
8544 /// metadata of the object changes. This includes changes made by a requester,
8545 /// such as modifying custom metadata, as well as changes made by Cloud Storage
8546 /// on behalf of a requester, such as changing the storage class based on an
8547 /// Object Lifecycle Configuration.
8548 pub update_time: std::option::Option<wkt::Timestamp>,
8549
8550 /// Optional. Cloud KMS Key used to encrypt this object, if the object is
8551 /// encrypted by such a key.
8552 pub kms_key: std::string::String,
8553
8554 /// Output only. The time at which the object's storage class was last changed.
8555 /// When the object is initially created, it is set to `time_created`.
8556 pub update_storage_class_time: std::option::Option<wkt::Timestamp>,
8557
8558 /// Optional. Whether an object is under temporary hold. While this flag is set
8559 /// to true, the object is protected against deletion and overwrites. A common
8560 /// use case of this flag is regulatory investigations where objects need to be
8561 /// retained while the investigation is ongoing. Note that unlike event-based
8562 /// hold, temporary hold does not impact retention expiration time of an
8563 /// object.
8564 pub temporary_hold: bool,
8565
8566 /// Optional. A server-determined value that specifies the earliest time that
8567 /// the object's retention period expires. Note 1: This field is not provided
8568 /// for objects with an active event-based hold, since retention expiration is
8569 /// unknown until the hold is removed. Note 2: This value can be provided even
8570 /// when temporary hold is set (so that the user can reason about policy
8571 /// without having to first unset the temporary hold).
8572 pub retention_expire_time: std::option::Option<wkt::Timestamp>,
8573
8574 /// Optional. User-provided metadata, in key/value pairs.
8575 pub metadata: std::collections::HashMap<std::string::String, std::string::String>,
8576
8577 /// Optional. User-defined or system-defined object contexts. Each object
8578 /// context is a key-payload pair, where the key provides the identification
8579 /// and the payload holds the associated value and additional metadata.
8580 pub contexts: std::option::Option<crate::model::ObjectContexts>,
8581
8582 /// Whether an object is under event-based hold.
8583 /// An event-based hold is a way to force the retention of an object until
8584 /// after some event occurs. Once the hold is released by explicitly setting
8585 /// this field to `false`, the object becomes subject to any bucket-level
8586 /// retention policy, except that the retention duration is calculated
8587 /// from the time the event based hold was lifted, rather than the time the
8588 /// object was created.
8589 ///
8590 /// In a `WriteObject` request, not setting this field implies that the value
8591 /// should be taken from the parent bucket's `default_event_based_hold` field.
8592 /// In a response, this field is always set to `true` or `false`.
8593 pub event_based_hold: std::option::Option<bool>,
8594
8595 /// Output only. The owner of the object. This is always the uploader of the
8596 /// object.
8597 pub owner: std::option::Option<crate::model::Owner>,
8598
8599 /// Optional. Metadata of customer-supplied encryption key, if the object is
8600 /// encrypted by such a key.
8601 pub customer_encryption: std::option::Option<crate::model::CustomerEncryption>,
8602
8603 /// Optional. A user-specified timestamp set on an object.
8604 pub custom_time: std::option::Option<wkt::Timestamp>,
8605
8606 /// Output only. This is the time when the object became soft-deleted.
8607 ///
8608 /// Soft-deleted objects are only accessible if a soft_delete_policy is
8609 /// enabled. Also see `hard_delete_time`.
8610 pub soft_delete_time: std::option::Option<wkt::Timestamp>,
8611
8612 /// Output only. The time when the object is permanently deleted.
8613 ///
8614 /// Only set when an object becomes soft-deleted with a `soft_delete_policy`.
8615 /// Otherwise, the object is not accessible.
8616 pub hard_delete_time: std::option::Option<wkt::Timestamp>,
8617
8618 /// Optional. Retention configuration of this object.
8619 /// Might only be configured if the bucket has object retention enabled.
8620 pub retention: std::option::Option<crate::model::object::Retention>,
8621
8622 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
8623}
8624
8625impl Object {
8626 pub fn new() -> Self {
8627 std::default::Default::default()
8628 }
8629
8630 /// Sets the value of [name][crate::model::Object::name].
8631 ///
8632 /// # Example
8633 /// ```ignore,no_run
8634 /// # use google_cloud_storage::model::Object;
8635 /// let x = Object::new().set_name("example");
8636 /// ```
8637 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
8638 self.name = v.into();
8639 self
8640 }
8641
8642 /// Sets the value of [bucket][crate::model::Object::bucket].
8643 ///
8644 /// # Example
8645 /// ```ignore,no_run
8646 /// # use google_cloud_storage::model::Object;
8647 /// let x = Object::new().set_bucket("example");
8648 /// ```
8649 pub fn set_bucket<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
8650 self.bucket = v.into();
8651 self
8652 }
8653
8654 /// Sets the value of [etag][crate::model::Object::etag].
8655 ///
8656 /// # Example
8657 /// ```ignore,no_run
8658 /// # use google_cloud_storage::model::Object;
8659 /// let x = Object::new().set_etag("example");
8660 /// ```
8661 pub fn set_etag<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
8662 self.etag = v.into();
8663 self
8664 }
8665
8666 /// Sets the value of [generation][crate::model::Object::generation].
8667 ///
8668 /// # Example
8669 /// ```ignore,no_run
8670 /// # use google_cloud_storage::model::Object;
8671 /// let x = Object::new().set_generation(42);
8672 /// ```
8673 pub fn set_generation<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
8674 self.generation = v.into();
8675 self
8676 }
8677
8678 /// Sets the value of [restore_token][crate::model::Object::restore_token].
8679 ///
8680 /// # Example
8681 /// ```ignore,no_run
8682 /// # use google_cloud_storage::model::Object;
8683 /// let x = Object::new().set_restore_token("example");
8684 /// ```
8685 pub fn set_restore_token<T>(mut self, v: T) -> Self
8686 where
8687 T: std::convert::Into<std::string::String>,
8688 {
8689 self.restore_token = std::option::Option::Some(v.into());
8690 self
8691 }
8692
8693 /// Sets or clears the value of [restore_token][crate::model::Object::restore_token].
8694 ///
8695 /// # Example
8696 /// ```ignore,no_run
8697 /// # use google_cloud_storage::model::Object;
8698 /// let x = Object::new().set_or_clear_restore_token(Some("example"));
8699 /// let x = Object::new().set_or_clear_restore_token(None::<String>);
8700 /// ```
8701 pub fn set_or_clear_restore_token<T>(mut self, v: std::option::Option<T>) -> Self
8702 where
8703 T: std::convert::Into<std::string::String>,
8704 {
8705 self.restore_token = v.map(|x| x.into());
8706 self
8707 }
8708
8709 /// Sets the value of [metageneration][crate::model::Object::metageneration].
8710 ///
8711 /// # Example
8712 /// ```ignore,no_run
8713 /// # use google_cloud_storage::model::Object;
8714 /// let x = Object::new().set_metageneration(42);
8715 /// ```
8716 pub fn set_metageneration<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
8717 self.metageneration = v.into();
8718 self
8719 }
8720
8721 /// Sets the value of [storage_class][crate::model::Object::storage_class].
8722 ///
8723 /// # Example
8724 /// ```ignore,no_run
8725 /// # use google_cloud_storage::model::Object;
8726 /// let x = Object::new().set_storage_class("example");
8727 /// ```
8728 pub fn set_storage_class<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
8729 self.storage_class = v.into();
8730 self
8731 }
8732
8733 /// Sets the value of [size][crate::model::Object::size].
8734 ///
8735 /// # Example
8736 /// ```ignore,no_run
8737 /// # use google_cloud_storage::model::Object;
8738 /// let x = Object::new().set_size(42);
8739 /// ```
8740 pub fn set_size<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
8741 self.size = v.into();
8742 self
8743 }
8744
8745 /// Sets the value of [content_encoding][crate::model::Object::content_encoding].
8746 ///
8747 /// # Example
8748 /// ```ignore,no_run
8749 /// # use google_cloud_storage::model::Object;
8750 /// let x = Object::new().set_content_encoding("example");
8751 /// ```
8752 pub fn set_content_encoding<T: std::convert::Into<std::string::String>>(
8753 mut self,
8754 v: T,
8755 ) -> Self {
8756 self.content_encoding = v.into();
8757 self
8758 }
8759
8760 /// Sets the value of [content_disposition][crate::model::Object::content_disposition].
8761 ///
8762 /// # Example
8763 /// ```ignore,no_run
8764 /// # use google_cloud_storage::model::Object;
8765 /// let x = Object::new().set_content_disposition("example");
8766 /// ```
8767 pub fn set_content_disposition<T: std::convert::Into<std::string::String>>(
8768 mut self,
8769 v: T,
8770 ) -> Self {
8771 self.content_disposition = v.into();
8772 self
8773 }
8774
8775 /// Sets the value of [cache_control][crate::model::Object::cache_control].
8776 ///
8777 /// # Example
8778 /// ```ignore,no_run
8779 /// # use google_cloud_storage::model::Object;
8780 /// let x = Object::new().set_cache_control("example");
8781 /// ```
8782 pub fn set_cache_control<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
8783 self.cache_control = v.into();
8784 self
8785 }
8786
8787 /// Sets the value of [acl][crate::model::Object::acl].
8788 ///
8789 /// # Example
8790 /// ```ignore,no_run
8791 /// # use google_cloud_storage::model::Object;
8792 /// use google_cloud_storage::model::ObjectAccessControl;
8793 /// let x = Object::new()
8794 /// .set_acl([
8795 /// ObjectAccessControl::default()/* use setters */,
8796 /// ObjectAccessControl::default()/* use (different) setters */,
8797 /// ]);
8798 /// ```
8799 pub fn set_acl<T, V>(mut self, v: T) -> Self
8800 where
8801 T: std::iter::IntoIterator<Item = V>,
8802 V: std::convert::Into<crate::model::ObjectAccessControl>,
8803 {
8804 use std::iter::Iterator;
8805 self.acl = v.into_iter().map(|i| i.into()).collect();
8806 self
8807 }
8808
8809 /// Sets the value of [content_language][crate::model::Object::content_language].
8810 ///
8811 /// # Example
8812 /// ```ignore,no_run
8813 /// # use google_cloud_storage::model::Object;
8814 /// let x = Object::new().set_content_language("example");
8815 /// ```
8816 pub fn set_content_language<T: std::convert::Into<std::string::String>>(
8817 mut self,
8818 v: T,
8819 ) -> Self {
8820 self.content_language = v.into();
8821 self
8822 }
8823
8824 /// Sets the value of [delete_time][crate::model::Object::delete_time].
8825 ///
8826 /// # Example
8827 /// ```ignore,no_run
8828 /// # use google_cloud_storage::model::Object;
8829 /// use wkt::Timestamp;
8830 /// let x = Object::new().set_delete_time(Timestamp::default()/* use setters */);
8831 /// ```
8832 pub fn set_delete_time<T>(mut self, v: T) -> Self
8833 where
8834 T: std::convert::Into<wkt::Timestamp>,
8835 {
8836 self.delete_time = std::option::Option::Some(v.into());
8837 self
8838 }
8839
8840 /// Sets or clears the value of [delete_time][crate::model::Object::delete_time].
8841 ///
8842 /// # Example
8843 /// ```ignore,no_run
8844 /// # use google_cloud_storage::model::Object;
8845 /// use wkt::Timestamp;
8846 /// let x = Object::new().set_or_clear_delete_time(Some(Timestamp::default()/* use setters */));
8847 /// let x = Object::new().set_or_clear_delete_time(None::<Timestamp>);
8848 /// ```
8849 pub fn set_or_clear_delete_time<T>(mut self, v: std::option::Option<T>) -> Self
8850 where
8851 T: std::convert::Into<wkt::Timestamp>,
8852 {
8853 self.delete_time = v.map(|x| x.into());
8854 self
8855 }
8856
8857 /// Sets the value of [finalize_time][crate::model::Object::finalize_time].
8858 ///
8859 /// # Example
8860 /// ```ignore,no_run
8861 /// # use google_cloud_storage::model::Object;
8862 /// use wkt::Timestamp;
8863 /// let x = Object::new().set_finalize_time(Timestamp::default()/* use setters */);
8864 /// ```
8865 pub fn set_finalize_time<T>(mut self, v: T) -> Self
8866 where
8867 T: std::convert::Into<wkt::Timestamp>,
8868 {
8869 self.finalize_time = std::option::Option::Some(v.into());
8870 self
8871 }
8872
8873 /// Sets or clears the value of [finalize_time][crate::model::Object::finalize_time].
8874 ///
8875 /// # Example
8876 /// ```ignore,no_run
8877 /// # use google_cloud_storage::model::Object;
8878 /// use wkt::Timestamp;
8879 /// let x = Object::new().set_or_clear_finalize_time(Some(Timestamp::default()/* use setters */));
8880 /// let x = Object::new().set_or_clear_finalize_time(None::<Timestamp>);
8881 /// ```
8882 pub fn set_or_clear_finalize_time<T>(mut self, v: std::option::Option<T>) -> Self
8883 where
8884 T: std::convert::Into<wkt::Timestamp>,
8885 {
8886 self.finalize_time = v.map(|x| x.into());
8887 self
8888 }
8889
8890 /// Sets the value of [content_type][crate::model::Object::content_type].
8891 ///
8892 /// # Example
8893 /// ```ignore,no_run
8894 /// # use google_cloud_storage::model::Object;
8895 /// let x = Object::new().set_content_type("example");
8896 /// ```
8897 pub fn set_content_type<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
8898 self.content_type = v.into();
8899 self
8900 }
8901
8902 /// Sets the value of [create_time][crate::model::Object::create_time].
8903 ///
8904 /// # Example
8905 /// ```ignore,no_run
8906 /// # use google_cloud_storage::model::Object;
8907 /// use wkt::Timestamp;
8908 /// let x = Object::new().set_create_time(Timestamp::default()/* use setters */);
8909 /// ```
8910 pub fn set_create_time<T>(mut self, v: T) -> Self
8911 where
8912 T: std::convert::Into<wkt::Timestamp>,
8913 {
8914 self.create_time = std::option::Option::Some(v.into());
8915 self
8916 }
8917
8918 /// Sets or clears the value of [create_time][crate::model::Object::create_time].
8919 ///
8920 /// # Example
8921 /// ```ignore,no_run
8922 /// # use google_cloud_storage::model::Object;
8923 /// use wkt::Timestamp;
8924 /// let x = Object::new().set_or_clear_create_time(Some(Timestamp::default()/* use setters */));
8925 /// let x = Object::new().set_or_clear_create_time(None::<Timestamp>);
8926 /// ```
8927 pub fn set_or_clear_create_time<T>(mut self, v: std::option::Option<T>) -> Self
8928 where
8929 T: std::convert::Into<wkt::Timestamp>,
8930 {
8931 self.create_time = v.map(|x| x.into());
8932 self
8933 }
8934
8935 /// Sets the value of [component_count][crate::model::Object::component_count].
8936 ///
8937 /// # Example
8938 /// ```ignore,no_run
8939 /// # use google_cloud_storage::model::Object;
8940 /// let x = Object::new().set_component_count(42);
8941 /// ```
8942 pub fn set_component_count<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
8943 self.component_count = v.into();
8944 self
8945 }
8946
8947 /// Sets the value of [checksums][crate::model::Object::checksums].
8948 ///
8949 /// # Example
8950 /// ```ignore,no_run
8951 /// # use google_cloud_storage::model::Object;
8952 /// use google_cloud_storage::model::ObjectChecksums;
8953 /// let x = Object::new().set_checksums(ObjectChecksums::default()/* use setters */);
8954 /// ```
8955 pub fn set_checksums<T>(mut self, v: T) -> Self
8956 where
8957 T: std::convert::Into<crate::model::ObjectChecksums>,
8958 {
8959 self.checksums = std::option::Option::Some(v.into());
8960 self
8961 }
8962
8963 /// Sets or clears the value of [checksums][crate::model::Object::checksums].
8964 ///
8965 /// # Example
8966 /// ```ignore,no_run
8967 /// # use google_cloud_storage::model::Object;
8968 /// use google_cloud_storage::model::ObjectChecksums;
8969 /// let x = Object::new().set_or_clear_checksums(Some(ObjectChecksums::default()/* use setters */));
8970 /// let x = Object::new().set_or_clear_checksums(None::<ObjectChecksums>);
8971 /// ```
8972 pub fn set_or_clear_checksums<T>(mut self, v: std::option::Option<T>) -> Self
8973 where
8974 T: std::convert::Into<crate::model::ObjectChecksums>,
8975 {
8976 self.checksums = v.map(|x| x.into());
8977 self
8978 }
8979
8980 /// Sets the value of [update_time][crate::model::Object::update_time].
8981 ///
8982 /// # Example
8983 /// ```ignore,no_run
8984 /// # use google_cloud_storage::model::Object;
8985 /// use wkt::Timestamp;
8986 /// let x = Object::new().set_update_time(Timestamp::default()/* use setters */);
8987 /// ```
8988 pub fn set_update_time<T>(mut self, v: T) -> Self
8989 where
8990 T: std::convert::Into<wkt::Timestamp>,
8991 {
8992 self.update_time = std::option::Option::Some(v.into());
8993 self
8994 }
8995
8996 /// Sets or clears the value of [update_time][crate::model::Object::update_time].
8997 ///
8998 /// # Example
8999 /// ```ignore,no_run
9000 /// # use google_cloud_storage::model::Object;
9001 /// use wkt::Timestamp;
9002 /// let x = Object::new().set_or_clear_update_time(Some(Timestamp::default()/* use setters */));
9003 /// let x = Object::new().set_or_clear_update_time(None::<Timestamp>);
9004 /// ```
9005 pub fn set_or_clear_update_time<T>(mut self, v: std::option::Option<T>) -> Self
9006 where
9007 T: std::convert::Into<wkt::Timestamp>,
9008 {
9009 self.update_time = v.map(|x| x.into());
9010 self
9011 }
9012
9013 /// Sets the value of [kms_key][crate::model::Object::kms_key].
9014 ///
9015 /// # Example
9016 /// ```ignore,no_run
9017 /// # use google_cloud_storage::model::Object;
9018 /// let x = Object::new().set_kms_key("example");
9019 /// ```
9020 pub fn set_kms_key<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9021 self.kms_key = v.into();
9022 self
9023 }
9024
9025 /// Sets the value of [update_storage_class_time][crate::model::Object::update_storage_class_time].
9026 ///
9027 /// # Example
9028 /// ```ignore,no_run
9029 /// # use google_cloud_storage::model::Object;
9030 /// use wkt::Timestamp;
9031 /// let x = Object::new().set_update_storage_class_time(Timestamp::default()/* use setters */);
9032 /// ```
9033 pub fn set_update_storage_class_time<T>(mut self, v: T) -> Self
9034 where
9035 T: std::convert::Into<wkt::Timestamp>,
9036 {
9037 self.update_storage_class_time = std::option::Option::Some(v.into());
9038 self
9039 }
9040
9041 /// Sets or clears the value of [update_storage_class_time][crate::model::Object::update_storage_class_time].
9042 ///
9043 /// # Example
9044 /// ```ignore,no_run
9045 /// # use google_cloud_storage::model::Object;
9046 /// use wkt::Timestamp;
9047 /// let x = Object::new().set_or_clear_update_storage_class_time(Some(Timestamp::default()/* use setters */));
9048 /// let x = Object::new().set_or_clear_update_storage_class_time(None::<Timestamp>);
9049 /// ```
9050 pub fn set_or_clear_update_storage_class_time<T>(mut self, v: std::option::Option<T>) -> Self
9051 where
9052 T: std::convert::Into<wkt::Timestamp>,
9053 {
9054 self.update_storage_class_time = v.map(|x| x.into());
9055 self
9056 }
9057
9058 /// Sets the value of [temporary_hold][crate::model::Object::temporary_hold].
9059 ///
9060 /// # Example
9061 /// ```ignore,no_run
9062 /// # use google_cloud_storage::model::Object;
9063 /// let x = Object::new().set_temporary_hold(true);
9064 /// ```
9065 pub fn set_temporary_hold<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
9066 self.temporary_hold = v.into();
9067 self
9068 }
9069
9070 /// Sets the value of [retention_expire_time][crate::model::Object::retention_expire_time].
9071 ///
9072 /// # Example
9073 /// ```ignore,no_run
9074 /// # use google_cloud_storage::model::Object;
9075 /// use wkt::Timestamp;
9076 /// let x = Object::new().set_retention_expire_time(Timestamp::default()/* use setters */);
9077 /// ```
9078 pub fn set_retention_expire_time<T>(mut self, v: T) -> Self
9079 where
9080 T: std::convert::Into<wkt::Timestamp>,
9081 {
9082 self.retention_expire_time = std::option::Option::Some(v.into());
9083 self
9084 }
9085
9086 /// Sets or clears the value of [retention_expire_time][crate::model::Object::retention_expire_time].
9087 ///
9088 /// # Example
9089 /// ```ignore,no_run
9090 /// # use google_cloud_storage::model::Object;
9091 /// use wkt::Timestamp;
9092 /// let x = Object::new().set_or_clear_retention_expire_time(Some(Timestamp::default()/* use setters */));
9093 /// let x = Object::new().set_or_clear_retention_expire_time(None::<Timestamp>);
9094 /// ```
9095 pub fn set_or_clear_retention_expire_time<T>(mut self, v: std::option::Option<T>) -> Self
9096 where
9097 T: std::convert::Into<wkt::Timestamp>,
9098 {
9099 self.retention_expire_time = v.map(|x| x.into());
9100 self
9101 }
9102
9103 /// Sets the value of [metadata][crate::model::Object::metadata].
9104 ///
9105 /// # Example
9106 /// ```ignore,no_run
9107 /// # use google_cloud_storage::model::Object;
9108 /// let x = Object::new().set_metadata([
9109 /// ("key0", "abc"),
9110 /// ("key1", "xyz"),
9111 /// ]);
9112 /// ```
9113 pub fn set_metadata<T, K, V>(mut self, v: T) -> Self
9114 where
9115 T: std::iter::IntoIterator<Item = (K, V)>,
9116 K: std::convert::Into<std::string::String>,
9117 V: std::convert::Into<std::string::String>,
9118 {
9119 use std::iter::Iterator;
9120 self.metadata = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
9121 self
9122 }
9123
9124 /// Sets the value of [contexts][crate::model::Object::contexts].
9125 ///
9126 /// # Example
9127 /// ```ignore,no_run
9128 /// # use google_cloud_storage::model::Object;
9129 /// use google_cloud_storage::model::ObjectContexts;
9130 /// let x = Object::new().set_contexts(ObjectContexts::default()/* use setters */);
9131 /// ```
9132 pub fn set_contexts<T>(mut self, v: T) -> Self
9133 where
9134 T: std::convert::Into<crate::model::ObjectContexts>,
9135 {
9136 self.contexts = std::option::Option::Some(v.into());
9137 self
9138 }
9139
9140 /// Sets or clears the value of [contexts][crate::model::Object::contexts].
9141 ///
9142 /// # Example
9143 /// ```ignore,no_run
9144 /// # use google_cloud_storage::model::Object;
9145 /// use google_cloud_storage::model::ObjectContexts;
9146 /// let x = Object::new().set_or_clear_contexts(Some(ObjectContexts::default()/* use setters */));
9147 /// let x = Object::new().set_or_clear_contexts(None::<ObjectContexts>);
9148 /// ```
9149 pub fn set_or_clear_contexts<T>(mut self, v: std::option::Option<T>) -> Self
9150 where
9151 T: std::convert::Into<crate::model::ObjectContexts>,
9152 {
9153 self.contexts = v.map(|x| x.into());
9154 self
9155 }
9156
9157 /// Sets the value of [event_based_hold][crate::model::Object::event_based_hold].
9158 ///
9159 /// # Example
9160 /// ```ignore,no_run
9161 /// # use google_cloud_storage::model::Object;
9162 /// let x = Object::new().set_event_based_hold(true);
9163 /// ```
9164 pub fn set_event_based_hold<T>(mut self, v: T) -> Self
9165 where
9166 T: std::convert::Into<bool>,
9167 {
9168 self.event_based_hold = std::option::Option::Some(v.into());
9169 self
9170 }
9171
9172 /// Sets or clears the value of [event_based_hold][crate::model::Object::event_based_hold].
9173 ///
9174 /// # Example
9175 /// ```ignore,no_run
9176 /// # use google_cloud_storage::model::Object;
9177 /// let x = Object::new().set_or_clear_event_based_hold(Some(false));
9178 /// let x = Object::new().set_or_clear_event_based_hold(None::<bool>);
9179 /// ```
9180 pub fn set_or_clear_event_based_hold<T>(mut self, v: std::option::Option<T>) -> Self
9181 where
9182 T: std::convert::Into<bool>,
9183 {
9184 self.event_based_hold = v.map(|x| x.into());
9185 self
9186 }
9187
9188 /// Sets the value of [owner][crate::model::Object::owner].
9189 ///
9190 /// # Example
9191 /// ```ignore,no_run
9192 /// # use google_cloud_storage::model::Object;
9193 /// use google_cloud_storage::model::Owner;
9194 /// let x = Object::new().set_owner(Owner::default()/* use setters */);
9195 /// ```
9196 pub fn set_owner<T>(mut self, v: T) -> Self
9197 where
9198 T: std::convert::Into<crate::model::Owner>,
9199 {
9200 self.owner = std::option::Option::Some(v.into());
9201 self
9202 }
9203
9204 /// Sets or clears the value of [owner][crate::model::Object::owner].
9205 ///
9206 /// # Example
9207 /// ```ignore,no_run
9208 /// # use google_cloud_storage::model::Object;
9209 /// use google_cloud_storage::model::Owner;
9210 /// let x = Object::new().set_or_clear_owner(Some(Owner::default()/* use setters */));
9211 /// let x = Object::new().set_or_clear_owner(None::<Owner>);
9212 /// ```
9213 pub fn set_or_clear_owner<T>(mut self, v: std::option::Option<T>) -> Self
9214 where
9215 T: std::convert::Into<crate::model::Owner>,
9216 {
9217 self.owner = v.map(|x| x.into());
9218 self
9219 }
9220
9221 /// Sets the value of [customer_encryption][crate::model::Object::customer_encryption].
9222 ///
9223 /// # Example
9224 /// ```ignore,no_run
9225 /// # use google_cloud_storage::model::Object;
9226 /// use google_cloud_storage::model::CustomerEncryption;
9227 /// let x = Object::new().set_customer_encryption(CustomerEncryption::default()/* use setters */);
9228 /// ```
9229 pub fn set_customer_encryption<T>(mut self, v: T) -> Self
9230 where
9231 T: std::convert::Into<crate::model::CustomerEncryption>,
9232 {
9233 self.customer_encryption = std::option::Option::Some(v.into());
9234 self
9235 }
9236
9237 /// Sets or clears the value of [customer_encryption][crate::model::Object::customer_encryption].
9238 ///
9239 /// # Example
9240 /// ```ignore,no_run
9241 /// # use google_cloud_storage::model::Object;
9242 /// use google_cloud_storage::model::CustomerEncryption;
9243 /// let x = Object::new().set_or_clear_customer_encryption(Some(CustomerEncryption::default()/* use setters */));
9244 /// let x = Object::new().set_or_clear_customer_encryption(None::<CustomerEncryption>);
9245 /// ```
9246 pub fn set_or_clear_customer_encryption<T>(mut self, v: std::option::Option<T>) -> Self
9247 where
9248 T: std::convert::Into<crate::model::CustomerEncryption>,
9249 {
9250 self.customer_encryption = v.map(|x| x.into());
9251 self
9252 }
9253
9254 /// Sets the value of [custom_time][crate::model::Object::custom_time].
9255 ///
9256 /// # Example
9257 /// ```ignore,no_run
9258 /// # use google_cloud_storage::model::Object;
9259 /// use wkt::Timestamp;
9260 /// let x = Object::new().set_custom_time(Timestamp::default()/* use setters */);
9261 /// ```
9262 pub fn set_custom_time<T>(mut self, v: T) -> Self
9263 where
9264 T: std::convert::Into<wkt::Timestamp>,
9265 {
9266 self.custom_time = std::option::Option::Some(v.into());
9267 self
9268 }
9269
9270 /// Sets or clears the value of [custom_time][crate::model::Object::custom_time].
9271 ///
9272 /// # Example
9273 /// ```ignore,no_run
9274 /// # use google_cloud_storage::model::Object;
9275 /// use wkt::Timestamp;
9276 /// let x = Object::new().set_or_clear_custom_time(Some(Timestamp::default()/* use setters */));
9277 /// let x = Object::new().set_or_clear_custom_time(None::<Timestamp>);
9278 /// ```
9279 pub fn set_or_clear_custom_time<T>(mut self, v: std::option::Option<T>) -> Self
9280 where
9281 T: std::convert::Into<wkt::Timestamp>,
9282 {
9283 self.custom_time = v.map(|x| x.into());
9284 self
9285 }
9286
9287 /// Sets the value of [soft_delete_time][crate::model::Object::soft_delete_time].
9288 ///
9289 /// # Example
9290 /// ```ignore,no_run
9291 /// # use google_cloud_storage::model::Object;
9292 /// use wkt::Timestamp;
9293 /// let x = Object::new().set_soft_delete_time(Timestamp::default()/* use setters */);
9294 /// ```
9295 pub fn set_soft_delete_time<T>(mut self, v: T) -> Self
9296 where
9297 T: std::convert::Into<wkt::Timestamp>,
9298 {
9299 self.soft_delete_time = std::option::Option::Some(v.into());
9300 self
9301 }
9302
9303 /// Sets or clears the value of [soft_delete_time][crate::model::Object::soft_delete_time].
9304 ///
9305 /// # Example
9306 /// ```ignore,no_run
9307 /// # use google_cloud_storage::model::Object;
9308 /// use wkt::Timestamp;
9309 /// let x = Object::new().set_or_clear_soft_delete_time(Some(Timestamp::default()/* use setters */));
9310 /// let x = Object::new().set_or_clear_soft_delete_time(None::<Timestamp>);
9311 /// ```
9312 pub fn set_or_clear_soft_delete_time<T>(mut self, v: std::option::Option<T>) -> Self
9313 where
9314 T: std::convert::Into<wkt::Timestamp>,
9315 {
9316 self.soft_delete_time = v.map(|x| x.into());
9317 self
9318 }
9319
9320 /// Sets the value of [hard_delete_time][crate::model::Object::hard_delete_time].
9321 ///
9322 /// # Example
9323 /// ```ignore,no_run
9324 /// # use google_cloud_storage::model::Object;
9325 /// use wkt::Timestamp;
9326 /// let x = Object::new().set_hard_delete_time(Timestamp::default()/* use setters */);
9327 /// ```
9328 pub fn set_hard_delete_time<T>(mut self, v: T) -> Self
9329 where
9330 T: std::convert::Into<wkt::Timestamp>,
9331 {
9332 self.hard_delete_time = std::option::Option::Some(v.into());
9333 self
9334 }
9335
9336 /// Sets or clears the value of [hard_delete_time][crate::model::Object::hard_delete_time].
9337 ///
9338 /// # Example
9339 /// ```ignore,no_run
9340 /// # use google_cloud_storage::model::Object;
9341 /// use wkt::Timestamp;
9342 /// let x = Object::new().set_or_clear_hard_delete_time(Some(Timestamp::default()/* use setters */));
9343 /// let x = Object::new().set_or_clear_hard_delete_time(None::<Timestamp>);
9344 /// ```
9345 pub fn set_or_clear_hard_delete_time<T>(mut self, v: std::option::Option<T>) -> Self
9346 where
9347 T: std::convert::Into<wkt::Timestamp>,
9348 {
9349 self.hard_delete_time = v.map(|x| x.into());
9350 self
9351 }
9352
9353 /// Sets the value of [retention][crate::model::Object::retention].
9354 ///
9355 /// # Example
9356 /// ```ignore,no_run
9357 /// # use google_cloud_storage::model::Object;
9358 /// use google_cloud_storage::model::object::Retention;
9359 /// let x = Object::new().set_retention(Retention::default()/* use setters */);
9360 /// ```
9361 pub fn set_retention<T>(mut self, v: T) -> Self
9362 where
9363 T: std::convert::Into<crate::model::object::Retention>,
9364 {
9365 self.retention = std::option::Option::Some(v.into());
9366 self
9367 }
9368
9369 /// Sets or clears the value of [retention][crate::model::Object::retention].
9370 ///
9371 /// # Example
9372 /// ```ignore,no_run
9373 /// # use google_cloud_storage::model::Object;
9374 /// use google_cloud_storage::model::object::Retention;
9375 /// let x = Object::new().set_or_clear_retention(Some(Retention::default()/* use setters */));
9376 /// let x = Object::new().set_or_clear_retention(None::<Retention>);
9377 /// ```
9378 pub fn set_or_clear_retention<T>(mut self, v: std::option::Option<T>) -> Self
9379 where
9380 T: std::convert::Into<crate::model::object::Retention>,
9381 {
9382 self.retention = v.map(|x| x.into());
9383 self
9384 }
9385}
9386
9387impl wkt::message::Message for Object {
9388 fn typename() -> &'static str {
9389 "type.googleapis.com/google.storage.v2.Object"
9390 }
9391}
9392
9393/// Defines additional types related to [Object].
9394pub mod object {
9395 #[allow(unused_imports)]
9396 use super::*;
9397
9398 /// Specifies retention parameters of the object. Objects under retention
9399 /// cannot be deleted or overwritten until their retention expires.
9400 #[derive(Clone, Default, PartialEq)]
9401 #[non_exhaustive]
9402 pub struct Retention {
9403 /// Optional. The mode of the Retention.
9404 pub mode: crate::model::object::retention::Mode,
9405
9406 /// Optional. The timestamp that the object needs to be retained until.
9407 /// Value cannot be set in the past or more than 100 years in the future.
9408 pub retain_until_time: std::option::Option<wkt::Timestamp>,
9409
9410 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
9411 }
9412
9413 impl Retention {
9414 pub fn new() -> Self {
9415 std::default::Default::default()
9416 }
9417
9418 /// Sets the value of [mode][crate::model::object::Retention::mode].
9419 ///
9420 /// # Example
9421 /// ```ignore,no_run
9422 /// # use google_cloud_storage::model::object::Retention;
9423 /// use google_cloud_storage::model::object::retention::Mode;
9424 /// let x0 = Retention::new().set_mode(Mode::Unlocked);
9425 /// let x1 = Retention::new().set_mode(Mode::Locked);
9426 /// ```
9427 pub fn set_mode<T: std::convert::Into<crate::model::object::retention::Mode>>(
9428 mut self,
9429 v: T,
9430 ) -> Self {
9431 self.mode = v.into();
9432 self
9433 }
9434
9435 /// Sets the value of [retain_until_time][crate::model::object::Retention::retain_until_time].
9436 ///
9437 /// # Example
9438 /// ```ignore,no_run
9439 /// # use google_cloud_storage::model::object::Retention;
9440 /// use wkt::Timestamp;
9441 /// let x = Retention::new().set_retain_until_time(Timestamp::default()/* use setters */);
9442 /// ```
9443 pub fn set_retain_until_time<T>(mut self, v: T) -> Self
9444 where
9445 T: std::convert::Into<wkt::Timestamp>,
9446 {
9447 self.retain_until_time = std::option::Option::Some(v.into());
9448 self
9449 }
9450
9451 /// Sets or clears the value of [retain_until_time][crate::model::object::Retention::retain_until_time].
9452 ///
9453 /// # Example
9454 /// ```ignore,no_run
9455 /// # use google_cloud_storage::model::object::Retention;
9456 /// use wkt::Timestamp;
9457 /// let x = Retention::new().set_or_clear_retain_until_time(Some(Timestamp::default()/* use setters */));
9458 /// let x = Retention::new().set_or_clear_retain_until_time(None::<Timestamp>);
9459 /// ```
9460 pub fn set_or_clear_retain_until_time<T>(mut self, v: std::option::Option<T>) -> Self
9461 where
9462 T: std::convert::Into<wkt::Timestamp>,
9463 {
9464 self.retain_until_time = v.map(|x| x.into());
9465 self
9466 }
9467 }
9468
9469 impl wkt::message::Message for Retention {
9470 fn typename() -> &'static str {
9471 "type.googleapis.com/google.storage.v2.Object.Retention"
9472 }
9473 }
9474
9475 /// Defines additional types related to [Retention].
9476 pub mod retention {
9477 #[allow(unused_imports)]
9478 use super::*;
9479
9480 /// Retention mode values.
9481 ///
9482 /// # Working with unknown values
9483 ///
9484 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
9485 /// additional enum variants at any time. Adding new variants is not considered
9486 /// a breaking change. Applications should write their code in anticipation of:
9487 ///
9488 /// - New values appearing in future releases of the client library, **and**
9489 /// - New values received dynamically, without application changes.
9490 ///
9491 /// Please consult the [Working with enums] section in the user guide for some
9492 /// guidelines.
9493 ///
9494 /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
9495 #[derive(Clone, Debug, PartialEq)]
9496 #[non_exhaustive]
9497 pub enum Mode {
9498 /// No specified mode. Object is not under retention.
9499 Unspecified,
9500 /// Retention period might be decreased or increased.
9501 /// The Retention configuration might be removed.
9502 /// The mode might be changed to locked.
9503 Unlocked,
9504 /// Retention period might be increased.
9505 /// The Retention configuration cannot be removed.
9506 /// The mode cannot be changed.
9507 Locked,
9508 /// If set, the enum was initialized with an unknown value.
9509 ///
9510 /// Applications can examine the value using [Mode::value] or
9511 /// [Mode::name].
9512 UnknownValue(mode::UnknownValue),
9513 }
9514
9515 #[doc(hidden)]
9516 pub mod mode {
9517 #[allow(unused_imports)]
9518 use super::*;
9519 #[derive(Clone, Debug, PartialEq)]
9520 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
9521 }
9522
9523 impl Mode {
9524 /// Gets the enum value.
9525 ///
9526 /// Returns `None` if the enum contains an unknown value deserialized from
9527 /// the string representation of enums.
9528 pub fn value(&self) -> std::option::Option<i32> {
9529 match self {
9530 Self::Unspecified => std::option::Option::Some(0),
9531 Self::Unlocked => std::option::Option::Some(1),
9532 Self::Locked => std::option::Option::Some(2),
9533 Self::UnknownValue(u) => u.0.value(),
9534 }
9535 }
9536
9537 /// Gets the enum value as a string.
9538 ///
9539 /// Returns `None` if the enum contains an unknown value deserialized from
9540 /// the integer representation of enums.
9541 pub fn name(&self) -> std::option::Option<&str> {
9542 match self {
9543 Self::Unspecified => std::option::Option::Some("MODE_UNSPECIFIED"),
9544 Self::Unlocked => std::option::Option::Some("UNLOCKED"),
9545 Self::Locked => std::option::Option::Some("LOCKED"),
9546 Self::UnknownValue(u) => u.0.name(),
9547 }
9548 }
9549 }
9550
9551 impl std::default::Default for Mode {
9552 fn default() -> Self {
9553 use std::convert::From;
9554 Self::from(0)
9555 }
9556 }
9557
9558 impl std::fmt::Display for Mode {
9559 fn fmt(
9560 &self,
9561 f: &mut std::fmt::Formatter<'_>,
9562 ) -> std::result::Result<(), std::fmt::Error> {
9563 wkt::internal::display_enum(f, self.name(), self.value())
9564 }
9565 }
9566
9567 impl std::convert::From<i32> for Mode {
9568 fn from(value: i32) -> Self {
9569 match value {
9570 0 => Self::Unspecified,
9571 1 => Self::Unlocked,
9572 2 => Self::Locked,
9573 _ => Self::UnknownValue(mode::UnknownValue(
9574 wkt::internal::UnknownEnumValue::Integer(value),
9575 )),
9576 }
9577 }
9578 }
9579
9580 impl std::convert::From<&str> for Mode {
9581 fn from(value: &str) -> Self {
9582 use std::string::ToString;
9583 match value {
9584 "MODE_UNSPECIFIED" => Self::Unspecified,
9585 "UNLOCKED" => Self::Unlocked,
9586 "LOCKED" => Self::Locked,
9587 _ => Self::UnknownValue(mode::UnknownValue(
9588 wkt::internal::UnknownEnumValue::String(value.to_string()),
9589 )),
9590 }
9591 }
9592 }
9593
9594 impl serde::ser::Serialize for Mode {
9595 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
9596 where
9597 S: serde::Serializer,
9598 {
9599 match self {
9600 Self::Unspecified => serializer.serialize_i32(0),
9601 Self::Unlocked => serializer.serialize_i32(1),
9602 Self::Locked => serializer.serialize_i32(2),
9603 Self::UnknownValue(u) => u.0.serialize(serializer),
9604 }
9605 }
9606 }
9607
9608 impl<'de> serde::de::Deserialize<'de> for Mode {
9609 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
9610 where
9611 D: serde::Deserializer<'de>,
9612 {
9613 deserializer.deserialize_any(wkt::internal::EnumVisitor::<Mode>::new(
9614 ".google.storage.v2.Object.Retention.Mode",
9615 ))
9616 }
9617 }
9618 }
9619}
9620
9621/// An access-control entry.
9622#[derive(Clone, Default, PartialEq)]
9623#[non_exhaustive]
9624pub struct ObjectAccessControl {
9625 /// Optional. The access permission for the entity. One of the following
9626 /// values:
9627 ///
9628 /// * `READER`
9629 /// * `WRITER`
9630 /// * `OWNER`
9631 pub role: std::string::String,
9632
9633 /// Optional. The ID of the access-control entry.
9634 pub id: std::string::String,
9635
9636 /// Optional. The entity holding the permission, in one of the following forms:
9637 ///
9638 /// * `user-{userid}`
9639 /// * `user-{email}`
9640 /// * `group-{groupid}`
9641 /// * `group-{email}`
9642 /// * `domain-{domain}`
9643 /// * `project-{team}-{projectnumber}`
9644 /// * `project-{team}-{projectid}`
9645 /// * `allUsers`
9646 /// * `allAuthenticatedUsers`
9647 /// Examples:
9648 /// * The user `liz@example.com` would be `user-liz@example.com`.
9649 /// * The group `example@googlegroups.com` would be
9650 /// `group-example@googlegroups.com`.
9651 /// * All members of the Google Apps for Business domain `example.com` would be
9652 /// `domain-example.com`.
9653 /// For project entities, `project-{team}-{projectnumber}` format is
9654 /// returned in the response.
9655 pub entity: std::string::String,
9656
9657 /// Output only. The alternative entity format, if exists. For project
9658 /// entities, `project-{team}-{projectid}` format is returned in the response.
9659 pub entity_alt: std::string::String,
9660
9661 /// Optional. The ID for the entity, if any.
9662 pub entity_id: std::string::String,
9663
9664 /// Optional. The etag of the ObjectAccessControl.
9665 /// If included in the metadata of an update or delete request message, the
9666 /// operation is only performed if the etag matches that of the live
9667 /// object's ObjectAccessControl.
9668 pub etag: std::string::String,
9669
9670 /// Optional. The email address associated with the entity, if any.
9671 pub email: std::string::String,
9672
9673 /// Optional. The domain associated with the entity, if any.
9674 pub domain: std::string::String,
9675
9676 /// Optional. The project team associated with the entity, if any.
9677 pub project_team: std::option::Option<crate::model::ProjectTeam>,
9678
9679 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
9680}
9681
9682impl ObjectAccessControl {
9683 pub fn new() -> Self {
9684 std::default::Default::default()
9685 }
9686
9687 /// Sets the value of [role][crate::model::ObjectAccessControl::role].
9688 ///
9689 /// # Example
9690 /// ```ignore,no_run
9691 /// # use google_cloud_storage::model::ObjectAccessControl;
9692 /// let x = ObjectAccessControl::new().set_role("example");
9693 /// ```
9694 pub fn set_role<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9695 self.role = v.into();
9696 self
9697 }
9698
9699 /// Sets the value of [id][crate::model::ObjectAccessControl::id].
9700 ///
9701 /// # Example
9702 /// ```ignore,no_run
9703 /// # use google_cloud_storage::model::ObjectAccessControl;
9704 /// let x = ObjectAccessControl::new().set_id("example");
9705 /// ```
9706 pub fn set_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9707 self.id = v.into();
9708 self
9709 }
9710
9711 /// Sets the value of [entity][crate::model::ObjectAccessControl::entity].
9712 ///
9713 /// # Example
9714 /// ```ignore,no_run
9715 /// # use google_cloud_storage::model::ObjectAccessControl;
9716 /// let x = ObjectAccessControl::new().set_entity("example");
9717 /// ```
9718 pub fn set_entity<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9719 self.entity = v.into();
9720 self
9721 }
9722
9723 /// Sets the value of [entity_alt][crate::model::ObjectAccessControl::entity_alt].
9724 ///
9725 /// # Example
9726 /// ```ignore,no_run
9727 /// # use google_cloud_storage::model::ObjectAccessControl;
9728 /// let x = ObjectAccessControl::new().set_entity_alt("example");
9729 /// ```
9730 pub fn set_entity_alt<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9731 self.entity_alt = v.into();
9732 self
9733 }
9734
9735 /// Sets the value of [entity_id][crate::model::ObjectAccessControl::entity_id].
9736 ///
9737 /// # Example
9738 /// ```ignore,no_run
9739 /// # use google_cloud_storage::model::ObjectAccessControl;
9740 /// let x = ObjectAccessControl::new().set_entity_id("example");
9741 /// ```
9742 pub fn set_entity_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9743 self.entity_id = v.into();
9744 self
9745 }
9746
9747 /// Sets the value of [etag][crate::model::ObjectAccessControl::etag].
9748 ///
9749 /// # Example
9750 /// ```ignore,no_run
9751 /// # use google_cloud_storage::model::ObjectAccessControl;
9752 /// let x = ObjectAccessControl::new().set_etag("example");
9753 /// ```
9754 pub fn set_etag<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9755 self.etag = v.into();
9756 self
9757 }
9758
9759 /// Sets the value of [email][crate::model::ObjectAccessControl::email].
9760 ///
9761 /// # Example
9762 /// ```ignore,no_run
9763 /// # use google_cloud_storage::model::ObjectAccessControl;
9764 /// let x = ObjectAccessControl::new().set_email("example");
9765 /// ```
9766 pub fn set_email<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9767 self.email = v.into();
9768 self
9769 }
9770
9771 /// Sets the value of [domain][crate::model::ObjectAccessControl::domain].
9772 ///
9773 /// # Example
9774 /// ```ignore,no_run
9775 /// # use google_cloud_storage::model::ObjectAccessControl;
9776 /// let x = ObjectAccessControl::new().set_domain("example");
9777 /// ```
9778 pub fn set_domain<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9779 self.domain = v.into();
9780 self
9781 }
9782
9783 /// Sets the value of [project_team][crate::model::ObjectAccessControl::project_team].
9784 ///
9785 /// # Example
9786 /// ```ignore,no_run
9787 /// # use google_cloud_storage::model::ObjectAccessControl;
9788 /// use google_cloud_storage::model::ProjectTeam;
9789 /// let x = ObjectAccessControl::new().set_project_team(ProjectTeam::default()/* use setters */);
9790 /// ```
9791 pub fn set_project_team<T>(mut self, v: T) -> Self
9792 where
9793 T: std::convert::Into<crate::model::ProjectTeam>,
9794 {
9795 self.project_team = std::option::Option::Some(v.into());
9796 self
9797 }
9798
9799 /// Sets or clears the value of [project_team][crate::model::ObjectAccessControl::project_team].
9800 ///
9801 /// # Example
9802 /// ```ignore,no_run
9803 /// # use google_cloud_storage::model::ObjectAccessControl;
9804 /// use google_cloud_storage::model::ProjectTeam;
9805 /// let x = ObjectAccessControl::new().set_or_clear_project_team(Some(ProjectTeam::default()/* use setters */));
9806 /// let x = ObjectAccessControl::new().set_or_clear_project_team(None::<ProjectTeam>);
9807 /// ```
9808 pub fn set_or_clear_project_team<T>(mut self, v: std::option::Option<T>) -> Self
9809 where
9810 T: std::convert::Into<crate::model::ProjectTeam>,
9811 {
9812 self.project_team = v.map(|x| x.into());
9813 self
9814 }
9815}
9816
9817impl wkt::message::Message for ObjectAccessControl {
9818 fn typename() -> &'static str {
9819 "type.googleapis.com/google.storage.v2.ObjectAccessControl"
9820 }
9821}
9822
9823/// The result of a call to Objects.ListObjects
9824#[derive(Clone, Default, PartialEq)]
9825#[non_exhaustive]
9826pub struct ListObjectsResponse {
9827 /// The list of items.
9828 pub objects: std::vec::Vec<crate::model::Object>,
9829
9830 /// The list of prefixes of objects matching-but-not-listed up to and including
9831 /// the requested delimiter.
9832 pub prefixes: std::vec::Vec<std::string::String>,
9833
9834 /// The continuation token, used to page through large result sets. Provide
9835 /// this value in a subsequent request to return the next page of results.
9836 pub next_page_token: std::string::String,
9837
9838 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
9839}
9840
9841impl ListObjectsResponse {
9842 pub fn new() -> Self {
9843 std::default::Default::default()
9844 }
9845
9846 /// Sets the value of [objects][crate::model::ListObjectsResponse::objects].
9847 ///
9848 /// # Example
9849 /// ```ignore,no_run
9850 /// # use google_cloud_storage::model::ListObjectsResponse;
9851 /// use google_cloud_storage::model::Object;
9852 /// let x = ListObjectsResponse::new()
9853 /// .set_objects([
9854 /// Object::default()/* use setters */,
9855 /// Object::default()/* use (different) setters */,
9856 /// ]);
9857 /// ```
9858 pub fn set_objects<T, V>(mut self, v: T) -> Self
9859 where
9860 T: std::iter::IntoIterator<Item = V>,
9861 V: std::convert::Into<crate::model::Object>,
9862 {
9863 use std::iter::Iterator;
9864 self.objects = v.into_iter().map(|i| i.into()).collect();
9865 self
9866 }
9867
9868 /// Sets the value of [prefixes][crate::model::ListObjectsResponse::prefixes].
9869 ///
9870 /// # Example
9871 /// ```ignore,no_run
9872 /// # use google_cloud_storage::model::ListObjectsResponse;
9873 /// let x = ListObjectsResponse::new().set_prefixes(["a", "b", "c"]);
9874 /// ```
9875 pub fn set_prefixes<T, V>(mut self, v: T) -> Self
9876 where
9877 T: std::iter::IntoIterator<Item = V>,
9878 V: std::convert::Into<std::string::String>,
9879 {
9880 use std::iter::Iterator;
9881 self.prefixes = v.into_iter().map(|i| i.into()).collect();
9882 self
9883 }
9884
9885 /// Sets the value of [next_page_token][crate::model::ListObjectsResponse::next_page_token].
9886 ///
9887 /// # Example
9888 /// ```ignore,no_run
9889 /// # use google_cloud_storage::model::ListObjectsResponse;
9890 /// let x = ListObjectsResponse::new().set_next_page_token("example");
9891 /// ```
9892 pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9893 self.next_page_token = v.into();
9894 self
9895 }
9896}
9897
9898impl wkt::message::Message for ListObjectsResponse {
9899 fn typename() -> &'static str {
9900 "type.googleapis.com/google.storage.v2.ListObjectsResponse"
9901 }
9902}
9903
9904#[doc(hidden)]
9905impl gax::paginator::internal::PageableResponse for ListObjectsResponse {
9906 type PageItem = crate::model::Object;
9907
9908 fn items(self) -> std::vec::Vec<Self::PageItem> {
9909 self.objects
9910 }
9911
9912 fn next_page_token(&self) -> std::string::String {
9913 use std::clone::Clone;
9914 self.next_page_token.clone()
9915 }
9916}
9917
9918/// Represents the Viewers, Editors, or Owners of a given project.
9919#[derive(Clone, Default, PartialEq)]
9920#[non_exhaustive]
9921pub struct ProjectTeam {
9922 /// Optional. The project number.
9923 pub project_number: std::string::String,
9924
9925 /// Optional. The team.
9926 pub team: std::string::String,
9927
9928 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
9929}
9930
9931impl ProjectTeam {
9932 pub fn new() -> Self {
9933 std::default::Default::default()
9934 }
9935
9936 /// Sets the value of [project_number][crate::model::ProjectTeam::project_number].
9937 ///
9938 /// # Example
9939 /// ```ignore,no_run
9940 /// # use google_cloud_storage::model::ProjectTeam;
9941 /// let x = ProjectTeam::new().set_project_number("example");
9942 /// ```
9943 pub fn set_project_number<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9944 self.project_number = v.into();
9945 self
9946 }
9947
9948 /// Sets the value of [team][crate::model::ProjectTeam::team].
9949 ///
9950 /// # Example
9951 /// ```ignore,no_run
9952 /// # use google_cloud_storage::model::ProjectTeam;
9953 /// let x = ProjectTeam::new().set_team("example");
9954 /// ```
9955 pub fn set_team<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9956 self.team = v.into();
9957 self
9958 }
9959}
9960
9961impl wkt::message::Message for ProjectTeam {
9962 fn typename() -> &'static str {
9963 "type.googleapis.com/google.storage.v2.ProjectTeam"
9964 }
9965}
9966
9967/// The owner of a specific resource.
9968#[derive(Clone, Default, PartialEq)]
9969#[non_exhaustive]
9970pub struct Owner {
9971 /// Optional. The entity, in the form `user-`*userId*.
9972 pub entity: std::string::String,
9973
9974 /// Optional. The ID for the entity.
9975 pub entity_id: std::string::String,
9976
9977 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
9978}
9979
9980impl Owner {
9981 pub fn new() -> Self {
9982 std::default::Default::default()
9983 }
9984
9985 /// Sets the value of [entity][crate::model::Owner::entity].
9986 ///
9987 /// # Example
9988 /// ```ignore,no_run
9989 /// # use google_cloud_storage::model::Owner;
9990 /// let x = Owner::new().set_entity("example");
9991 /// ```
9992 pub fn set_entity<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9993 self.entity = v.into();
9994 self
9995 }
9996
9997 /// Sets the value of [entity_id][crate::model::Owner::entity_id].
9998 ///
9999 /// # Example
10000 /// ```ignore,no_run
10001 /// # use google_cloud_storage::model::Owner;
10002 /// let x = Owner::new().set_entity_id("example");
10003 /// ```
10004 pub fn set_entity_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
10005 self.entity_id = v.into();
10006 self
10007 }
10008}
10009
10010impl wkt::message::Message for Owner {
10011 fn typename() -> &'static str {
10012 "type.googleapis.com/google.storage.v2.Owner"
10013 }
10014}