google_cloud_storage/generated/gapic/model.rs
1// Copyright 2025 Google LLC
2//
3// Licensed under the Apache License, Version 2.0 (the "License");
4// you may not use this file except in compliance with the License.
5// You may obtain a copy of the License at
6//
7// https://www.apache.org/licenses/LICENSE-2.0
8//
9// Unless required by applicable law or agreed to in writing, software
10// distributed under the License is distributed on an "AS IS" BASIS,
11// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12// See the License for the specific language governing permissions and
13// limitations under the License.
14//
15// Code generated by sidekick. DO NOT EDIT.
16
17#![allow(rustdoc::redundant_explicit_links)]
18#![allow(rustdoc::broken_intra_doc_links)]
19
20mod debug;
21mod deserialize;
22mod serialize;
23
24/// Request message for [DeleteBucket][google.storage.v2.Storage.DeleteBucket].
25///
26/// [google.storage.v2.Storage.DeleteBucket]: crate::client::StorageControl::delete_bucket
27#[derive(Clone, Default, PartialEq)]
28#[non_exhaustive]
29pub struct DeleteBucketRequest {
30 /// Required. Name of a bucket to delete.
31 pub name: std::string::String,
32
33 /// If set, only deletes the bucket if its metageneration matches this value.
34 pub if_metageneration_match: std::option::Option<i64>,
35
36 /// If set, only deletes the bucket if its metageneration does not match this
37 /// value.
38 pub if_metageneration_not_match: std::option::Option<i64>,
39
40 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
41}
42
43impl DeleteBucketRequest {
44 /// Creates a new default instance.
45 pub fn new() -> Self {
46 std::default::Default::default()
47 }
48
49 /// Sets the value of [name][crate::model::DeleteBucketRequest::name].
50 ///
51 /// # Example
52 /// ```ignore,no_run
53 /// # use google_cloud_storage::model::DeleteBucketRequest;
54 /// let x = DeleteBucketRequest::new().set_name("example");
55 /// ```
56 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
57 self.name = v.into();
58 self
59 }
60
61 /// Sets the value of [if_metageneration_match][crate::model::DeleteBucketRequest::if_metageneration_match].
62 ///
63 /// # Example
64 /// ```ignore,no_run
65 /// # use google_cloud_storage::model::DeleteBucketRequest;
66 /// let x = DeleteBucketRequest::new().set_if_metageneration_match(42);
67 /// ```
68 pub fn set_if_metageneration_match<T>(mut self, v: T) -> Self
69 where
70 T: std::convert::Into<i64>,
71 {
72 self.if_metageneration_match = std::option::Option::Some(v.into());
73 self
74 }
75
76 /// Sets or clears the value of [if_metageneration_match][crate::model::DeleteBucketRequest::if_metageneration_match].
77 ///
78 /// # Example
79 /// ```ignore,no_run
80 /// # use google_cloud_storage::model::DeleteBucketRequest;
81 /// let x = DeleteBucketRequest::new().set_or_clear_if_metageneration_match(Some(42));
82 /// let x = DeleteBucketRequest::new().set_or_clear_if_metageneration_match(None::<i32>);
83 /// ```
84 pub fn set_or_clear_if_metageneration_match<T>(mut self, v: std::option::Option<T>) -> Self
85 where
86 T: std::convert::Into<i64>,
87 {
88 self.if_metageneration_match = v.map(|x| x.into());
89 self
90 }
91
92 /// Sets the value of [if_metageneration_not_match][crate::model::DeleteBucketRequest::if_metageneration_not_match].
93 ///
94 /// # Example
95 /// ```ignore,no_run
96 /// # use google_cloud_storage::model::DeleteBucketRequest;
97 /// let x = DeleteBucketRequest::new().set_if_metageneration_not_match(42);
98 /// ```
99 pub fn set_if_metageneration_not_match<T>(mut self, v: T) -> Self
100 where
101 T: std::convert::Into<i64>,
102 {
103 self.if_metageneration_not_match = std::option::Option::Some(v.into());
104 self
105 }
106
107 /// Sets or clears the value of [if_metageneration_not_match][crate::model::DeleteBucketRequest::if_metageneration_not_match].
108 ///
109 /// # Example
110 /// ```ignore,no_run
111 /// # use google_cloud_storage::model::DeleteBucketRequest;
112 /// let x = DeleteBucketRequest::new().set_or_clear_if_metageneration_not_match(Some(42));
113 /// let x = DeleteBucketRequest::new().set_or_clear_if_metageneration_not_match(None::<i32>);
114 /// ```
115 pub fn set_or_clear_if_metageneration_not_match<T>(mut self, v: std::option::Option<T>) -> Self
116 where
117 T: std::convert::Into<i64>,
118 {
119 self.if_metageneration_not_match = v.map(|x| x.into());
120 self
121 }
122}
123
124impl wkt::message::Message for DeleteBucketRequest {
125 fn typename() -> &'static str {
126 "type.googleapis.com/google.storage.v2.DeleteBucketRequest"
127 }
128}
129
130/// Request message for [GetBucket][google.storage.v2.Storage.GetBucket].
131///
132/// [google.storage.v2.Storage.GetBucket]: crate::client::StorageControl::get_bucket
133#[derive(Clone, Default, PartialEq)]
134#[non_exhaustive]
135pub struct GetBucketRequest {
136 /// Required. Name of a bucket.
137 pub name: std::string::String,
138
139 /// If set, only gets the bucket metadata if its metageneration matches this
140 /// value.
141 pub if_metageneration_match: std::option::Option<i64>,
142
143 /// If set, and if the bucket's current metageneration matches the specified
144 /// value, the request returns an error.
145 pub if_metageneration_not_match: std::option::Option<i64>,
146
147 /// Mask specifying which fields to read.
148 /// A `*` field might be used to indicate all fields.
149 /// If no mask is specified, it defaults to all fields.
150 pub read_mask: std::option::Option<wkt::FieldMask>,
151
152 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
153}
154
155impl GetBucketRequest {
156 /// Creates a new default instance.
157 pub fn new() -> Self {
158 std::default::Default::default()
159 }
160
161 /// Sets the value of [name][crate::model::GetBucketRequest::name].
162 ///
163 /// # Example
164 /// ```ignore,no_run
165 /// # use google_cloud_storage::model::GetBucketRequest;
166 /// let x = GetBucketRequest::new().set_name("example");
167 /// ```
168 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
169 self.name = v.into();
170 self
171 }
172
173 /// Sets the value of [if_metageneration_match][crate::model::GetBucketRequest::if_metageneration_match].
174 ///
175 /// # Example
176 /// ```ignore,no_run
177 /// # use google_cloud_storage::model::GetBucketRequest;
178 /// let x = GetBucketRequest::new().set_if_metageneration_match(42);
179 /// ```
180 pub fn set_if_metageneration_match<T>(mut self, v: T) -> Self
181 where
182 T: std::convert::Into<i64>,
183 {
184 self.if_metageneration_match = std::option::Option::Some(v.into());
185 self
186 }
187
188 /// Sets or clears the value of [if_metageneration_match][crate::model::GetBucketRequest::if_metageneration_match].
189 ///
190 /// # Example
191 /// ```ignore,no_run
192 /// # use google_cloud_storage::model::GetBucketRequest;
193 /// let x = GetBucketRequest::new().set_or_clear_if_metageneration_match(Some(42));
194 /// let x = GetBucketRequest::new().set_or_clear_if_metageneration_match(None::<i32>);
195 /// ```
196 pub fn set_or_clear_if_metageneration_match<T>(mut self, v: std::option::Option<T>) -> Self
197 where
198 T: std::convert::Into<i64>,
199 {
200 self.if_metageneration_match = v.map(|x| x.into());
201 self
202 }
203
204 /// Sets the value of [if_metageneration_not_match][crate::model::GetBucketRequest::if_metageneration_not_match].
205 ///
206 /// # Example
207 /// ```ignore,no_run
208 /// # use google_cloud_storage::model::GetBucketRequest;
209 /// let x = GetBucketRequest::new().set_if_metageneration_not_match(42);
210 /// ```
211 pub fn set_if_metageneration_not_match<T>(mut self, v: T) -> Self
212 where
213 T: std::convert::Into<i64>,
214 {
215 self.if_metageneration_not_match = std::option::Option::Some(v.into());
216 self
217 }
218
219 /// Sets or clears the value of [if_metageneration_not_match][crate::model::GetBucketRequest::if_metageneration_not_match].
220 ///
221 /// # Example
222 /// ```ignore,no_run
223 /// # use google_cloud_storage::model::GetBucketRequest;
224 /// let x = GetBucketRequest::new().set_or_clear_if_metageneration_not_match(Some(42));
225 /// let x = GetBucketRequest::new().set_or_clear_if_metageneration_not_match(None::<i32>);
226 /// ```
227 pub fn set_or_clear_if_metageneration_not_match<T>(mut self, v: std::option::Option<T>) -> Self
228 where
229 T: std::convert::Into<i64>,
230 {
231 self.if_metageneration_not_match = v.map(|x| x.into());
232 self
233 }
234
235 /// Sets the value of [read_mask][crate::model::GetBucketRequest::read_mask].
236 ///
237 /// # Example
238 /// ```ignore,no_run
239 /// # use google_cloud_storage::model::GetBucketRequest;
240 /// use wkt::FieldMask;
241 /// let x = GetBucketRequest::new().set_read_mask(FieldMask::default()/* use setters */);
242 /// ```
243 pub fn set_read_mask<T>(mut self, v: T) -> Self
244 where
245 T: std::convert::Into<wkt::FieldMask>,
246 {
247 self.read_mask = std::option::Option::Some(v.into());
248 self
249 }
250
251 /// Sets or clears the value of [read_mask][crate::model::GetBucketRequest::read_mask].
252 ///
253 /// # Example
254 /// ```ignore,no_run
255 /// # use google_cloud_storage::model::GetBucketRequest;
256 /// use wkt::FieldMask;
257 /// let x = GetBucketRequest::new().set_or_clear_read_mask(Some(FieldMask::default()/* use setters */));
258 /// let x = GetBucketRequest::new().set_or_clear_read_mask(None::<FieldMask>);
259 /// ```
260 pub fn set_or_clear_read_mask<T>(mut self, v: std::option::Option<T>) -> Self
261 where
262 T: std::convert::Into<wkt::FieldMask>,
263 {
264 self.read_mask = v.map(|x| x.into());
265 self
266 }
267}
268
269impl wkt::message::Message for GetBucketRequest {
270 fn typename() -> &'static str {
271 "type.googleapis.com/google.storage.v2.GetBucketRequest"
272 }
273}
274
275/// Request message for [CreateBucket][google.storage.v2.Storage.CreateBucket].
276///
277/// [google.storage.v2.Storage.CreateBucket]: crate::client::StorageControl::create_bucket
278#[derive(Clone, Default, PartialEq)]
279#[non_exhaustive]
280pub struct CreateBucketRequest {
281 /// Required. The project to which this bucket belongs. This field must either
282 /// be empty or `projects/_`. The project ID that owns this bucket should be
283 /// specified in the `bucket.project` field.
284 pub parent: std::string::String,
285
286 /// Optional. Properties of the new bucket being inserted.
287 /// The name of the bucket is specified in the `bucket_id` field. Populating
288 /// `bucket.name` field results in an error.
289 /// The project of the bucket must be specified in the `bucket.project` field.
290 /// This field must be in `projects/{projectIdentifier}` format,
291 /// {projectIdentifier} can be the project ID or project number. The `parent`
292 /// field must be either empty or `projects/_`.
293 pub bucket: std::option::Option<crate::model::Bucket>,
294
295 /// Required. The ID to use for this bucket, which becomes the final component
296 /// of the bucket's resource name. For example, the value `foo` might result in
297 /// a bucket with the name `projects/123456/buckets/foo`.
298 pub bucket_id: std::string::String,
299
300 /// Optional. Apply a predefined set of access controls to this bucket.
301 /// Valid values are `authenticatedRead`, `private`, `projectPrivate`,
302 /// `publicRead`, or `publicReadWrite`.
303 pub predefined_acl: std::string::String,
304
305 /// Optional. Apply a predefined set of default object access controls to this
306 /// bucket. Valid values are `authenticatedRead`, `bucketOwnerFullControl`,
307 /// `bucketOwnerRead`, `private`, `projectPrivate`, or `publicRead`.
308 pub predefined_default_object_acl: std::string::String,
309
310 /// Optional. If true, enable object retention on the bucket.
311 pub enable_object_retention: bool,
312
313 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
314}
315
316impl CreateBucketRequest {
317 /// Creates a new default instance.
318 pub fn new() -> Self {
319 std::default::Default::default()
320 }
321
322 /// Sets the value of [parent][crate::model::CreateBucketRequest::parent].
323 ///
324 /// # Example
325 /// ```ignore,no_run
326 /// # use google_cloud_storage::model::CreateBucketRequest;
327 /// let x = CreateBucketRequest::new().set_parent("example");
328 /// ```
329 pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
330 self.parent = v.into();
331 self
332 }
333
334 /// Sets the value of [bucket][crate::model::CreateBucketRequest::bucket].
335 ///
336 /// # Example
337 /// ```ignore,no_run
338 /// # use google_cloud_storage::model::CreateBucketRequest;
339 /// use google_cloud_storage::model::Bucket;
340 /// let x = CreateBucketRequest::new().set_bucket(Bucket::default()/* use setters */);
341 /// ```
342 pub fn set_bucket<T>(mut self, v: T) -> Self
343 where
344 T: std::convert::Into<crate::model::Bucket>,
345 {
346 self.bucket = std::option::Option::Some(v.into());
347 self
348 }
349
350 /// Sets or clears the value of [bucket][crate::model::CreateBucketRequest::bucket].
351 ///
352 /// # Example
353 /// ```ignore,no_run
354 /// # use google_cloud_storage::model::CreateBucketRequest;
355 /// use google_cloud_storage::model::Bucket;
356 /// let x = CreateBucketRequest::new().set_or_clear_bucket(Some(Bucket::default()/* use setters */));
357 /// let x = CreateBucketRequest::new().set_or_clear_bucket(None::<Bucket>);
358 /// ```
359 pub fn set_or_clear_bucket<T>(mut self, v: std::option::Option<T>) -> Self
360 where
361 T: std::convert::Into<crate::model::Bucket>,
362 {
363 self.bucket = v.map(|x| x.into());
364 self
365 }
366
367 /// Sets the value of [bucket_id][crate::model::CreateBucketRequest::bucket_id].
368 ///
369 /// # Example
370 /// ```ignore,no_run
371 /// # use google_cloud_storage::model::CreateBucketRequest;
372 /// let x = CreateBucketRequest::new().set_bucket_id("example");
373 /// ```
374 pub fn set_bucket_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
375 self.bucket_id = v.into();
376 self
377 }
378
379 /// Sets the value of [predefined_acl][crate::model::CreateBucketRequest::predefined_acl].
380 ///
381 /// # Example
382 /// ```ignore,no_run
383 /// # use google_cloud_storage::model::CreateBucketRequest;
384 /// let x = CreateBucketRequest::new().set_predefined_acl("example");
385 /// ```
386 pub fn set_predefined_acl<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
387 self.predefined_acl = v.into();
388 self
389 }
390
391 /// Sets the value of [predefined_default_object_acl][crate::model::CreateBucketRequest::predefined_default_object_acl].
392 ///
393 /// # Example
394 /// ```ignore,no_run
395 /// # use google_cloud_storage::model::CreateBucketRequest;
396 /// let x = CreateBucketRequest::new().set_predefined_default_object_acl("example");
397 /// ```
398 pub fn set_predefined_default_object_acl<T: std::convert::Into<std::string::String>>(
399 mut self,
400 v: T,
401 ) -> Self {
402 self.predefined_default_object_acl = v.into();
403 self
404 }
405
406 /// Sets the value of [enable_object_retention][crate::model::CreateBucketRequest::enable_object_retention].
407 ///
408 /// # Example
409 /// ```ignore,no_run
410 /// # use google_cloud_storage::model::CreateBucketRequest;
411 /// let x = CreateBucketRequest::new().set_enable_object_retention(true);
412 /// ```
413 pub fn set_enable_object_retention<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
414 self.enable_object_retention = v.into();
415 self
416 }
417}
418
419impl wkt::message::Message for CreateBucketRequest {
420 fn typename() -> &'static str {
421 "type.googleapis.com/google.storage.v2.CreateBucketRequest"
422 }
423}
424
425/// Request message for [ListBuckets][google.storage.v2.Storage.ListBuckets].
426///
427/// [google.storage.v2.Storage.ListBuckets]: crate::client::StorageControl::list_buckets
428#[derive(Clone, Default, PartialEq)]
429#[non_exhaustive]
430pub struct ListBucketsRequest {
431 /// Required. The project whose buckets we are listing.
432 pub parent: std::string::String,
433
434 /// Optional. Maximum number of buckets to return in a single response. The
435 /// service uses this parameter or `1,000` items, whichever is smaller. If
436 /// `acl` is present in the `read_mask`, the service uses this parameter of
437 /// `200` items, whichever is smaller.
438 pub page_size: i32,
439
440 /// Optional. A previously-returned page token representing part of the larger
441 /// set of results to view.
442 pub page_token: std::string::String,
443
444 /// Optional. Filter results to buckets whose names begin with this prefix.
445 pub prefix: std::string::String,
446
447 /// Mask specifying which fields to read from each result.
448 /// If no mask is specified, it defaults to all fields except `items.
449 /// owner`, `items.acl`, and `items.default_object_acl`.
450 /// `*` might be used to mean "all fields".
451 pub read_mask: std::option::Option<wkt::FieldMask>,
452
453 /// Optional. Allows listing of buckets, even if there are buckets that are
454 /// unreachable.
455 pub return_partial_success: bool,
456
457 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
458}
459
460impl ListBucketsRequest {
461 /// Creates a new default instance.
462 pub fn new() -> Self {
463 std::default::Default::default()
464 }
465
466 /// Sets the value of [parent][crate::model::ListBucketsRequest::parent].
467 ///
468 /// # Example
469 /// ```ignore,no_run
470 /// # use google_cloud_storage::model::ListBucketsRequest;
471 /// let x = ListBucketsRequest::new().set_parent("example");
472 /// ```
473 pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
474 self.parent = v.into();
475 self
476 }
477
478 /// Sets the value of [page_size][crate::model::ListBucketsRequest::page_size].
479 ///
480 /// # Example
481 /// ```ignore,no_run
482 /// # use google_cloud_storage::model::ListBucketsRequest;
483 /// let x = ListBucketsRequest::new().set_page_size(42);
484 /// ```
485 pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
486 self.page_size = v.into();
487 self
488 }
489
490 /// Sets the value of [page_token][crate::model::ListBucketsRequest::page_token].
491 ///
492 /// # Example
493 /// ```ignore,no_run
494 /// # use google_cloud_storage::model::ListBucketsRequest;
495 /// let x = ListBucketsRequest::new().set_page_token("example");
496 /// ```
497 pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
498 self.page_token = v.into();
499 self
500 }
501
502 /// Sets the value of [prefix][crate::model::ListBucketsRequest::prefix].
503 ///
504 /// # Example
505 /// ```ignore,no_run
506 /// # use google_cloud_storage::model::ListBucketsRequest;
507 /// let x = ListBucketsRequest::new().set_prefix("example");
508 /// ```
509 pub fn set_prefix<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
510 self.prefix = v.into();
511 self
512 }
513
514 /// Sets the value of [read_mask][crate::model::ListBucketsRequest::read_mask].
515 ///
516 /// # Example
517 /// ```ignore,no_run
518 /// # use google_cloud_storage::model::ListBucketsRequest;
519 /// use wkt::FieldMask;
520 /// let x = ListBucketsRequest::new().set_read_mask(FieldMask::default()/* use setters */);
521 /// ```
522 pub fn set_read_mask<T>(mut self, v: T) -> Self
523 where
524 T: std::convert::Into<wkt::FieldMask>,
525 {
526 self.read_mask = std::option::Option::Some(v.into());
527 self
528 }
529
530 /// Sets or clears the value of [read_mask][crate::model::ListBucketsRequest::read_mask].
531 ///
532 /// # Example
533 /// ```ignore,no_run
534 /// # use google_cloud_storage::model::ListBucketsRequest;
535 /// use wkt::FieldMask;
536 /// let x = ListBucketsRequest::new().set_or_clear_read_mask(Some(FieldMask::default()/* use setters */));
537 /// let x = ListBucketsRequest::new().set_or_clear_read_mask(None::<FieldMask>);
538 /// ```
539 pub fn set_or_clear_read_mask<T>(mut self, v: std::option::Option<T>) -> Self
540 where
541 T: std::convert::Into<wkt::FieldMask>,
542 {
543 self.read_mask = v.map(|x| x.into());
544 self
545 }
546
547 /// Sets the value of [return_partial_success][crate::model::ListBucketsRequest::return_partial_success].
548 ///
549 /// # Example
550 /// ```ignore,no_run
551 /// # use google_cloud_storage::model::ListBucketsRequest;
552 /// let x = ListBucketsRequest::new().set_return_partial_success(true);
553 /// ```
554 pub fn set_return_partial_success<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
555 self.return_partial_success = v.into();
556 self
557 }
558}
559
560impl wkt::message::Message for ListBucketsRequest {
561 fn typename() -> &'static str {
562 "type.googleapis.com/google.storage.v2.ListBucketsRequest"
563 }
564}
565
566/// Response message for [ListBuckets][google.storage.v2.Storage.ListBuckets].
567///
568/// [google.storage.v2.Storage.ListBuckets]: crate::client::StorageControl::list_buckets
569#[derive(Clone, Default, PartialEq)]
570#[non_exhaustive]
571pub struct ListBucketsResponse {
572 /// The list of items.
573 pub buckets: std::vec::Vec<crate::model::Bucket>,
574
575 /// The continuation token, used to page through large result sets. Provide
576 /// this value in a subsequent request to return the next page of results.
577 pub next_page_token: std::string::String,
578
579 /// Unreachable resources.
580 /// This field can only be present if the caller specified
581 /// return_partial_success to be true in the request to receive indications
582 /// of temporarily missing resources.
583 /// unreachable might be:
584 /// unreachable = [
585 /// "projects/_/buckets/bucket1",
586 /// "projects/_/buckets/bucket2",
587 /// "projects/_/buckets/bucket3",
588 /// ]
589 pub unreachable: std::vec::Vec<std::string::String>,
590
591 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
592}
593
594impl ListBucketsResponse {
595 /// Creates a new default instance.
596 pub fn new() -> Self {
597 std::default::Default::default()
598 }
599
600 /// Sets the value of [buckets][crate::model::ListBucketsResponse::buckets].
601 ///
602 /// # Example
603 /// ```ignore,no_run
604 /// # use google_cloud_storage::model::ListBucketsResponse;
605 /// use google_cloud_storage::model::Bucket;
606 /// let x = ListBucketsResponse::new()
607 /// .set_buckets([
608 /// Bucket::default()/* use setters */,
609 /// Bucket::default()/* use (different) setters */,
610 /// ]);
611 /// ```
612 pub fn set_buckets<T, V>(mut self, v: T) -> Self
613 where
614 T: std::iter::IntoIterator<Item = V>,
615 V: std::convert::Into<crate::model::Bucket>,
616 {
617 use std::iter::Iterator;
618 self.buckets = v.into_iter().map(|i| i.into()).collect();
619 self
620 }
621
622 /// Sets the value of [next_page_token][crate::model::ListBucketsResponse::next_page_token].
623 ///
624 /// # Example
625 /// ```ignore,no_run
626 /// # use google_cloud_storage::model::ListBucketsResponse;
627 /// let x = ListBucketsResponse::new().set_next_page_token("example");
628 /// ```
629 pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
630 self.next_page_token = v.into();
631 self
632 }
633
634 /// Sets the value of [unreachable][crate::model::ListBucketsResponse::unreachable].
635 ///
636 /// # Example
637 /// ```ignore,no_run
638 /// # use google_cloud_storage::model::ListBucketsResponse;
639 /// let x = ListBucketsResponse::new().set_unreachable(["a", "b", "c"]);
640 /// ```
641 pub fn set_unreachable<T, V>(mut self, v: T) -> Self
642 where
643 T: std::iter::IntoIterator<Item = V>,
644 V: std::convert::Into<std::string::String>,
645 {
646 use std::iter::Iterator;
647 self.unreachable = v.into_iter().map(|i| i.into()).collect();
648 self
649 }
650}
651
652impl wkt::message::Message for ListBucketsResponse {
653 fn typename() -> &'static str {
654 "type.googleapis.com/google.storage.v2.ListBucketsResponse"
655 }
656}
657
658#[doc(hidden)]
659impl google_cloud_gax::paginator::internal::PageableResponse for ListBucketsResponse {
660 type PageItem = crate::model::Bucket;
661
662 fn items(self) -> std::vec::Vec<Self::PageItem> {
663 self.buckets
664 }
665
666 fn next_page_token(&self) -> std::string::String {
667 use std::clone::Clone;
668 self.next_page_token.clone()
669 }
670}
671
672/// Request message for
673/// [LockBucketRetentionPolicy][google.storage.v2.Storage.LockBucketRetentionPolicy].
674///
675/// [google.storage.v2.Storage.LockBucketRetentionPolicy]: crate::client::StorageControl::lock_bucket_retention_policy
676#[derive(Clone, Default, PartialEq)]
677#[non_exhaustive]
678pub struct LockBucketRetentionPolicyRequest {
679 /// Required. Name of a bucket.
680 pub bucket: std::string::String,
681
682 /// Required. Makes the operation conditional on whether bucket's current
683 /// metageneration matches the given value. Must be positive.
684 pub if_metageneration_match: i64,
685
686 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
687}
688
689impl LockBucketRetentionPolicyRequest {
690 /// Creates a new default instance.
691 pub fn new() -> Self {
692 std::default::Default::default()
693 }
694
695 /// Sets the value of [bucket][crate::model::LockBucketRetentionPolicyRequest::bucket].
696 ///
697 /// # Example
698 /// ```ignore,no_run
699 /// # use google_cloud_storage::model::LockBucketRetentionPolicyRequest;
700 /// let x = LockBucketRetentionPolicyRequest::new().set_bucket("example");
701 /// ```
702 pub fn set_bucket<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
703 self.bucket = v.into();
704 self
705 }
706
707 /// Sets the value of [if_metageneration_match][crate::model::LockBucketRetentionPolicyRequest::if_metageneration_match].
708 ///
709 /// # Example
710 /// ```ignore,no_run
711 /// # use google_cloud_storage::model::LockBucketRetentionPolicyRequest;
712 /// let x = LockBucketRetentionPolicyRequest::new().set_if_metageneration_match(42);
713 /// ```
714 pub fn set_if_metageneration_match<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
715 self.if_metageneration_match = v.into();
716 self
717 }
718}
719
720impl wkt::message::Message for LockBucketRetentionPolicyRequest {
721 fn typename() -> &'static str {
722 "type.googleapis.com/google.storage.v2.LockBucketRetentionPolicyRequest"
723 }
724}
725
726/// Request for [UpdateBucket][google.storage.v2.Storage.UpdateBucket] method.
727///
728/// [google.storage.v2.Storage.UpdateBucket]: crate::client::StorageControl::update_bucket
729#[derive(Clone, Default, PartialEq)]
730#[non_exhaustive]
731pub struct UpdateBucketRequest {
732 /// Required. The bucket to update.
733 /// The bucket's `name` field is used to identify the bucket.
734 pub bucket: std::option::Option<crate::model::Bucket>,
735
736 /// If set, the request modifies the bucket if its metageneration matches this
737 /// value.
738 pub if_metageneration_match: std::option::Option<i64>,
739
740 /// If set, the request modifies the bucket if its metageneration doesn't
741 /// match this value.
742 pub if_metageneration_not_match: std::option::Option<i64>,
743
744 /// Optional. Apply a predefined set of access controls to this bucket.
745 /// Valid values are `authenticatedRead`, `private`, `projectPrivate`,
746 /// `publicRead`, or `publicReadWrite`.
747 pub predefined_acl: std::string::String,
748
749 /// Optional. Apply a predefined set of default object access controls to this
750 /// bucket. Valid values are `authenticatedRead`, `bucketOwnerFullControl`,
751 /// `bucketOwnerRead`, `private`, `projectPrivate`, or `publicRead`.
752 pub predefined_default_object_acl: std::string::String,
753
754 /// Required. List of fields to be updated.
755 ///
756 /// To specify ALL fields, equivalent to the JSON API's "update" function,
757 /// specify a single field with the value `*`. Note: not recommended. If a new
758 /// field is introduced at a later time, an older client updating with the `*`
759 /// might accidentally reset the new field's value.
760 ///
761 /// Not specifying any fields is an error.
762 pub update_mask: std::option::Option<wkt::FieldMask>,
763
764 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
765}
766
767impl UpdateBucketRequest {
768 /// Creates a new default instance.
769 pub fn new() -> Self {
770 std::default::Default::default()
771 }
772
773 /// Sets the value of [bucket][crate::model::UpdateBucketRequest::bucket].
774 ///
775 /// # Example
776 /// ```ignore,no_run
777 /// # use google_cloud_storage::model::UpdateBucketRequest;
778 /// use google_cloud_storage::model::Bucket;
779 /// let x = UpdateBucketRequest::new().set_bucket(Bucket::default()/* use setters */);
780 /// ```
781 pub fn set_bucket<T>(mut self, v: T) -> Self
782 where
783 T: std::convert::Into<crate::model::Bucket>,
784 {
785 self.bucket = std::option::Option::Some(v.into());
786 self
787 }
788
789 /// Sets or clears the value of [bucket][crate::model::UpdateBucketRequest::bucket].
790 ///
791 /// # Example
792 /// ```ignore,no_run
793 /// # use google_cloud_storage::model::UpdateBucketRequest;
794 /// use google_cloud_storage::model::Bucket;
795 /// let x = UpdateBucketRequest::new().set_or_clear_bucket(Some(Bucket::default()/* use setters */));
796 /// let x = UpdateBucketRequest::new().set_or_clear_bucket(None::<Bucket>);
797 /// ```
798 pub fn set_or_clear_bucket<T>(mut self, v: std::option::Option<T>) -> Self
799 where
800 T: std::convert::Into<crate::model::Bucket>,
801 {
802 self.bucket = v.map(|x| x.into());
803 self
804 }
805
806 /// Sets the value of [if_metageneration_match][crate::model::UpdateBucketRequest::if_metageneration_match].
807 ///
808 /// # Example
809 /// ```ignore,no_run
810 /// # use google_cloud_storage::model::UpdateBucketRequest;
811 /// let x = UpdateBucketRequest::new().set_if_metageneration_match(42);
812 /// ```
813 pub fn set_if_metageneration_match<T>(mut self, v: T) -> Self
814 where
815 T: std::convert::Into<i64>,
816 {
817 self.if_metageneration_match = std::option::Option::Some(v.into());
818 self
819 }
820
821 /// Sets or clears the value of [if_metageneration_match][crate::model::UpdateBucketRequest::if_metageneration_match].
822 ///
823 /// # Example
824 /// ```ignore,no_run
825 /// # use google_cloud_storage::model::UpdateBucketRequest;
826 /// let x = UpdateBucketRequest::new().set_or_clear_if_metageneration_match(Some(42));
827 /// let x = UpdateBucketRequest::new().set_or_clear_if_metageneration_match(None::<i32>);
828 /// ```
829 pub fn set_or_clear_if_metageneration_match<T>(mut self, v: std::option::Option<T>) -> Self
830 where
831 T: std::convert::Into<i64>,
832 {
833 self.if_metageneration_match = v.map(|x| x.into());
834 self
835 }
836
837 /// Sets the value of [if_metageneration_not_match][crate::model::UpdateBucketRequest::if_metageneration_not_match].
838 ///
839 /// # Example
840 /// ```ignore,no_run
841 /// # use google_cloud_storage::model::UpdateBucketRequest;
842 /// let x = UpdateBucketRequest::new().set_if_metageneration_not_match(42);
843 /// ```
844 pub fn set_if_metageneration_not_match<T>(mut self, v: T) -> Self
845 where
846 T: std::convert::Into<i64>,
847 {
848 self.if_metageneration_not_match = std::option::Option::Some(v.into());
849 self
850 }
851
852 /// Sets or clears the value of [if_metageneration_not_match][crate::model::UpdateBucketRequest::if_metageneration_not_match].
853 ///
854 /// # Example
855 /// ```ignore,no_run
856 /// # use google_cloud_storage::model::UpdateBucketRequest;
857 /// let x = UpdateBucketRequest::new().set_or_clear_if_metageneration_not_match(Some(42));
858 /// let x = UpdateBucketRequest::new().set_or_clear_if_metageneration_not_match(None::<i32>);
859 /// ```
860 pub fn set_or_clear_if_metageneration_not_match<T>(mut self, v: std::option::Option<T>) -> Self
861 where
862 T: std::convert::Into<i64>,
863 {
864 self.if_metageneration_not_match = v.map(|x| x.into());
865 self
866 }
867
868 /// Sets the value of [predefined_acl][crate::model::UpdateBucketRequest::predefined_acl].
869 ///
870 /// # Example
871 /// ```ignore,no_run
872 /// # use google_cloud_storage::model::UpdateBucketRequest;
873 /// let x = UpdateBucketRequest::new().set_predefined_acl("example");
874 /// ```
875 pub fn set_predefined_acl<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
876 self.predefined_acl = v.into();
877 self
878 }
879
880 /// Sets the value of [predefined_default_object_acl][crate::model::UpdateBucketRequest::predefined_default_object_acl].
881 ///
882 /// # Example
883 /// ```ignore,no_run
884 /// # use google_cloud_storage::model::UpdateBucketRequest;
885 /// let x = UpdateBucketRequest::new().set_predefined_default_object_acl("example");
886 /// ```
887 pub fn set_predefined_default_object_acl<T: std::convert::Into<std::string::String>>(
888 mut self,
889 v: T,
890 ) -> Self {
891 self.predefined_default_object_acl = v.into();
892 self
893 }
894
895 /// Sets the value of [update_mask][crate::model::UpdateBucketRequest::update_mask].
896 ///
897 /// # Example
898 /// ```ignore,no_run
899 /// # use google_cloud_storage::model::UpdateBucketRequest;
900 /// use wkt::FieldMask;
901 /// let x = UpdateBucketRequest::new().set_update_mask(FieldMask::default()/* use setters */);
902 /// ```
903 pub fn set_update_mask<T>(mut self, v: T) -> Self
904 where
905 T: std::convert::Into<wkt::FieldMask>,
906 {
907 self.update_mask = std::option::Option::Some(v.into());
908 self
909 }
910
911 /// Sets or clears the value of [update_mask][crate::model::UpdateBucketRequest::update_mask].
912 ///
913 /// # Example
914 /// ```ignore,no_run
915 /// # use google_cloud_storage::model::UpdateBucketRequest;
916 /// use wkt::FieldMask;
917 /// let x = UpdateBucketRequest::new().set_or_clear_update_mask(Some(FieldMask::default()/* use setters */));
918 /// let x = UpdateBucketRequest::new().set_or_clear_update_mask(None::<FieldMask>);
919 /// ```
920 pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
921 where
922 T: std::convert::Into<wkt::FieldMask>,
923 {
924 self.update_mask = v.map(|x| x.into());
925 self
926 }
927}
928
929impl wkt::message::Message for UpdateBucketRequest {
930 fn typename() -> &'static str {
931 "type.googleapis.com/google.storage.v2.UpdateBucketRequest"
932 }
933}
934
935/// Request message for [ComposeObject][google.storage.v2.Storage.ComposeObject].
936///
937/// [google.storage.v2.Storage.ComposeObject]: crate::client::StorageControl::compose_object
938#[derive(Clone, Default, PartialEq)]
939#[non_exhaustive]
940pub struct ComposeObjectRequest {
941 /// Required. Properties of the resulting object.
942 pub destination: std::option::Option<crate::model::Object>,
943
944 /// Optional. The list of source objects that is concatenated into a single
945 /// object.
946 pub source_objects: std::vec::Vec<crate::model::compose_object_request::SourceObject>,
947
948 /// Optional. Apply a predefined set of access controls to the destination
949 /// object. Valid values are `authenticatedRead`, `bucketOwnerFullControl`,
950 /// `bucketOwnerRead`, `private`, `projectPrivate`, or `publicRead`.
951 pub destination_predefined_acl: std::string::String,
952
953 /// Makes the operation conditional on whether the object's current generation
954 /// matches the given value. Setting to 0 makes the operation succeed only if
955 /// there are no live versions of the object.
956 pub if_generation_match: std::option::Option<i64>,
957
958 /// Makes the operation conditional on whether the object's current
959 /// metageneration matches the given value.
960 pub if_metageneration_match: std::option::Option<i64>,
961
962 /// Optional. Resource name of the Cloud KMS key, of the form
963 /// `projects/my-project/locations/my-location/keyRings/my-kr/cryptoKeys/my-key`,
964 /// that is used to encrypt the object. Overrides the object
965 /// metadata's `kms_key_name` value, if any.
966 pub kms_key: std::string::String,
967
968 /// Optional. A set of parameters common to Storage API requests concerning an
969 /// object.
970 pub common_object_request_params: std::option::Option<crate::model::CommonObjectRequestParams>,
971
972 /// Optional. The checksums of the complete object. This is validated against
973 /// the combined checksums of the component objects.
974 pub object_checksums: std::option::Option<crate::model::ObjectChecksums>,
975
976 /// Whether the source objects should be deleted in the compose request.
977 pub delete_source_objects: std::option::Option<bool>,
978
979 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
980}
981
982impl ComposeObjectRequest {
983 /// Creates a new default instance.
984 pub fn new() -> Self {
985 std::default::Default::default()
986 }
987
988 /// Sets the value of [destination][crate::model::ComposeObjectRequest::destination].
989 ///
990 /// # Example
991 /// ```ignore,no_run
992 /// # use google_cloud_storage::model::ComposeObjectRequest;
993 /// use google_cloud_storage::model::Object;
994 /// let x = ComposeObjectRequest::new().set_destination(Object::default()/* use setters */);
995 /// ```
996 pub fn set_destination<T>(mut self, v: T) -> Self
997 where
998 T: std::convert::Into<crate::model::Object>,
999 {
1000 self.destination = std::option::Option::Some(v.into());
1001 self
1002 }
1003
1004 /// Sets or clears the value of [destination][crate::model::ComposeObjectRequest::destination].
1005 ///
1006 /// # Example
1007 /// ```ignore,no_run
1008 /// # use google_cloud_storage::model::ComposeObjectRequest;
1009 /// use google_cloud_storage::model::Object;
1010 /// let x = ComposeObjectRequest::new().set_or_clear_destination(Some(Object::default()/* use setters */));
1011 /// let x = ComposeObjectRequest::new().set_or_clear_destination(None::<Object>);
1012 /// ```
1013 pub fn set_or_clear_destination<T>(mut self, v: std::option::Option<T>) -> Self
1014 where
1015 T: std::convert::Into<crate::model::Object>,
1016 {
1017 self.destination = v.map(|x| x.into());
1018 self
1019 }
1020
1021 /// Sets the value of [source_objects][crate::model::ComposeObjectRequest::source_objects].
1022 ///
1023 /// # Example
1024 /// ```ignore,no_run
1025 /// # use google_cloud_storage::model::ComposeObjectRequest;
1026 /// use google_cloud_storage::model::compose_object_request::SourceObject;
1027 /// let x = ComposeObjectRequest::new()
1028 /// .set_source_objects([
1029 /// SourceObject::default()/* use setters */,
1030 /// SourceObject::default()/* use (different) setters */,
1031 /// ]);
1032 /// ```
1033 pub fn set_source_objects<T, V>(mut self, v: T) -> Self
1034 where
1035 T: std::iter::IntoIterator<Item = V>,
1036 V: std::convert::Into<crate::model::compose_object_request::SourceObject>,
1037 {
1038 use std::iter::Iterator;
1039 self.source_objects = v.into_iter().map(|i| i.into()).collect();
1040 self
1041 }
1042
1043 /// Sets the value of [destination_predefined_acl][crate::model::ComposeObjectRequest::destination_predefined_acl].
1044 ///
1045 /// # Example
1046 /// ```ignore,no_run
1047 /// # use google_cloud_storage::model::ComposeObjectRequest;
1048 /// let x = ComposeObjectRequest::new().set_destination_predefined_acl("example");
1049 /// ```
1050 pub fn set_destination_predefined_acl<T: std::convert::Into<std::string::String>>(
1051 mut self,
1052 v: T,
1053 ) -> Self {
1054 self.destination_predefined_acl = v.into();
1055 self
1056 }
1057
1058 /// Sets the value of [if_generation_match][crate::model::ComposeObjectRequest::if_generation_match].
1059 ///
1060 /// # Example
1061 /// ```ignore,no_run
1062 /// # use google_cloud_storage::model::ComposeObjectRequest;
1063 /// let x = ComposeObjectRequest::new().set_if_generation_match(42);
1064 /// ```
1065 pub fn set_if_generation_match<T>(mut self, v: T) -> Self
1066 where
1067 T: std::convert::Into<i64>,
1068 {
1069 self.if_generation_match = std::option::Option::Some(v.into());
1070 self
1071 }
1072
1073 /// Sets or clears the value of [if_generation_match][crate::model::ComposeObjectRequest::if_generation_match].
1074 ///
1075 /// # Example
1076 /// ```ignore,no_run
1077 /// # use google_cloud_storage::model::ComposeObjectRequest;
1078 /// let x = ComposeObjectRequest::new().set_or_clear_if_generation_match(Some(42));
1079 /// let x = ComposeObjectRequest::new().set_or_clear_if_generation_match(None::<i32>);
1080 /// ```
1081 pub fn set_or_clear_if_generation_match<T>(mut self, v: std::option::Option<T>) -> Self
1082 where
1083 T: std::convert::Into<i64>,
1084 {
1085 self.if_generation_match = v.map(|x| x.into());
1086 self
1087 }
1088
1089 /// Sets the value of [if_metageneration_match][crate::model::ComposeObjectRequest::if_metageneration_match].
1090 ///
1091 /// # Example
1092 /// ```ignore,no_run
1093 /// # use google_cloud_storage::model::ComposeObjectRequest;
1094 /// let x = ComposeObjectRequest::new().set_if_metageneration_match(42);
1095 /// ```
1096 pub fn set_if_metageneration_match<T>(mut self, v: T) -> Self
1097 where
1098 T: std::convert::Into<i64>,
1099 {
1100 self.if_metageneration_match = std::option::Option::Some(v.into());
1101 self
1102 }
1103
1104 /// Sets or clears the value of [if_metageneration_match][crate::model::ComposeObjectRequest::if_metageneration_match].
1105 ///
1106 /// # Example
1107 /// ```ignore,no_run
1108 /// # use google_cloud_storage::model::ComposeObjectRequest;
1109 /// let x = ComposeObjectRequest::new().set_or_clear_if_metageneration_match(Some(42));
1110 /// let x = ComposeObjectRequest::new().set_or_clear_if_metageneration_match(None::<i32>);
1111 /// ```
1112 pub fn set_or_clear_if_metageneration_match<T>(mut self, v: std::option::Option<T>) -> Self
1113 where
1114 T: std::convert::Into<i64>,
1115 {
1116 self.if_metageneration_match = v.map(|x| x.into());
1117 self
1118 }
1119
1120 /// Sets the value of [kms_key][crate::model::ComposeObjectRequest::kms_key].
1121 ///
1122 /// # Example
1123 /// ```ignore,no_run
1124 /// # use google_cloud_storage::model::ComposeObjectRequest;
1125 /// let x = ComposeObjectRequest::new().set_kms_key("example");
1126 /// ```
1127 pub fn set_kms_key<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1128 self.kms_key = v.into();
1129 self
1130 }
1131
1132 /// Sets the value of [common_object_request_params][crate::model::ComposeObjectRequest::common_object_request_params].
1133 ///
1134 /// # Example
1135 /// ```ignore,no_run
1136 /// # use google_cloud_storage::model::ComposeObjectRequest;
1137 /// use google_cloud_storage::model::CommonObjectRequestParams;
1138 /// let x = ComposeObjectRequest::new().set_common_object_request_params(CommonObjectRequestParams::default()/* use setters */);
1139 /// ```
1140 pub fn set_common_object_request_params<T>(mut self, v: T) -> Self
1141 where
1142 T: std::convert::Into<crate::model::CommonObjectRequestParams>,
1143 {
1144 self.common_object_request_params = std::option::Option::Some(v.into());
1145 self
1146 }
1147
1148 /// Sets or clears the value of [common_object_request_params][crate::model::ComposeObjectRequest::common_object_request_params].
1149 ///
1150 /// # Example
1151 /// ```ignore,no_run
1152 /// # use google_cloud_storage::model::ComposeObjectRequest;
1153 /// use google_cloud_storage::model::CommonObjectRequestParams;
1154 /// let x = ComposeObjectRequest::new().set_or_clear_common_object_request_params(Some(CommonObjectRequestParams::default()/* use setters */));
1155 /// let x = ComposeObjectRequest::new().set_or_clear_common_object_request_params(None::<CommonObjectRequestParams>);
1156 /// ```
1157 pub fn set_or_clear_common_object_request_params<T>(mut self, v: std::option::Option<T>) -> Self
1158 where
1159 T: std::convert::Into<crate::model::CommonObjectRequestParams>,
1160 {
1161 self.common_object_request_params = v.map(|x| x.into());
1162 self
1163 }
1164
1165 /// Sets the value of [object_checksums][crate::model::ComposeObjectRequest::object_checksums].
1166 ///
1167 /// # Example
1168 /// ```ignore,no_run
1169 /// # use google_cloud_storage::model::ComposeObjectRequest;
1170 /// use google_cloud_storage::model::ObjectChecksums;
1171 /// let x = ComposeObjectRequest::new().set_object_checksums(ObjectChecksums::default()/* use setters */);
1172 /// ```
1173 pub fn set_object_checksums<T>(mut self, v: T) -> Self
1174 where
1175 T: std::convert::Into<crate::model::ObjectChecksums>,
1176 {
1177 self.object_checksums = std::option::Option::Some(v.into());
1178 self
1179 }
1180
1181 /// Sets or clears the value of [object_checksums][crate::model::ComposeObjectRequest::object_checksums].
1182 ///
1183 /// # Example
1184 /// ```ignore,no_run
1185 /// # use google_cloud_storage::model::ComposeObjectRequest;
1186 /// use google_cloud_storage::model::ObjectChecksums;
1187 /// let x = ComposeObjectRequest::new().set_or_clear_object_checksums(Some(ObjectChecksums::default()/* use setters */));
1188 /// let x = ComposeObjectRequest::new().set_or_clear_object_checksums(None::<ObjectChecksums>);
1189 /// ```
1190 pub fn set_or_clear_object_checksums<T>(mut self, v: std::option::Option<T>) -> Self
1191 where
1192 T: std::convert::Into<crate::model::ObjectChecksums>,
1193 {
1194 self.object_checksums = v.map(|x| x.into());
1195 self
1196 }
1197
1198 /// Sets the value of [delete_source_objects][crate::model::ComposeObjectRequest::delete_source_objects].
1199 ///
1200 /// # Example
1201 /// ```ignore,no_run
1202 /// # use google_cloud_storage::model::ComposeObjectRequest;
1203 /// let x = ComposeObjectRequest::new().set_delete_source_objects(true);
1204 /// ```
1205 pub fn set_delete_source_objects<T>(mut self, v: T) -> Self
1206 where
1207 T: std::convert::Into<bool>,
1208 {
1209 self.delete_source_objects = std::option::Option::Some(v.into());
1210 self
1211 }
1212
1213 /// Sets or clears the value of [delete_source_objects][crate::model::ComposeObjectRequest::delete_source_objects].
1214 ///
1215 /// # Example
1216 /// ```ignore,no_run
1217 /// # use google_cloud_storage::model::ComposeObjectRequest;
1218 /// let x = ComposeObjectRequest::new().set_or_clear_delete_source_objects(Some(false));
1219 /// let x = ComposeObjectRequest::new().set_or_clear_delete_source_objects(None::<bool>);
1220 /// ```
1221 pub fn set_or_clear_delete_source_objects<T>(mut self, v: std::option::Option<T>) -> Self
1222 where
1223 T: std::convert::Into<bool>,
1224 {
1225 self.delete_source_objects = v.map(|x| x.into());
1226 self
1227 }
1228}
1229
1230impl wkt::message::Message for ComposeObjectRequest {
1231 fn typename() -> &'static str {
1232 "type.googleapis.com/google.storage.v2.ComposeObjectRequest"
1233 }
1234}
1235
1236/// Defines additional types related to [ComposeObjectRequest].
1237pub mod compose_object_request {
1238 #[allow(unused_imports)]
1239 use super::*;
1240
1241 /// Description of a source object for a composition request.
1242 #[derive(Clone, Default, PartialEq)]
1243 #[non_exhaustive]
1244 pub struct SourceObject {
1245 /// Required. The source object's name. All source objects must reside in the
1246 /// same bucket.
1247 pub name: std::string::String,
1248
1249 /// Optional. The generation of this object to use as the source.
1250 pub generation: i64,
1251
1252 /// Optional. Conditions that must be met for this operation to execute.
1253 pub object_preconditions: std::option::Option<
1254 crate::model::compose_object_request::source_object::ObjectPreconditions,
1255 >,
1256
1257 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1258 }
1259
1260 impl SourceObject {
1261 /// Creates a new default instance.
1262 pub fn new() -> Self {
1263 std::default::Default::default()
1264 }
1265
1266 /// Sets the value of [name][crate::model::compose_object_request::SourceObject::name].
1267 ///
1268 /// # Example
1269 /// ```ignore,no_run
1270 /// # use google_cloud_storage::model::compose_object_request::SourceObject;
1271 /// let x = SourceObject::new().set_name("example");
1272 /// ```
1273 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1274 self.name = v.into();
1275 self
1276 }
1277
1278 /// Sets the value of [generation][crate::model::compose_object_request::SourceObject::generation].
1279 ///
1280 /// # Example
1281 /// ```ignore,no_run
1282 /// # use google_cloud_storage::model::compose_object_request::SourceObject;
1283 /// let x = SourceObject::new().set_generation(42);
1284 /// ```
1285 pub fn set_generation<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
1286 self.generation = v.into();
1287 self
1288 }
1289
1290 /// Sets the value of [object_preconditions][crate::model::compose_object_request::SourceObject::object_preconditions].
1291 ///
1292 /// # Example
1293 /// ```ignore,no_run
1294 /// # use google_cloud_storage::model::compose_object_request::SourceObject;
1295 /// use google_cloud_storage::model::compose_object_request::source_object::ObjectPreconditions;
1296 /// let x = SourceObject::new().set_object_preconditions(ObjectPreconditions::default()/* use setters */);
1297 /// ```
1298 pub fn set_object_preconditions<T>(mut self, v: T) -> Self
1299 where
1300 T: std::convert::Into<
1301 crate::model::compose_object_request::source_object::ObjectPreconditions,
1302 >,
1303 {
1304 self.object_preconditions = std::option::Option::Some(v.into());
1305 self
1306 }
1307
1308 /// Sets or clears the value of [object_preconditions][crate::model::compose_object_request::SourceObject::object_preconditions].
1309 ///
1310 /// # Example
1311 /// ```ignore,no_run
1312 /// # use google_cloud_storage::model::compose_object_request::SourceObject;
1313 /// use google_cloud_storage::model::compose_object_request::source_object::ObjectPreconditions;
1314 /// let x = SourceObject::new().set_or_clear_object_preconditions(Some(ObjectPreconditions::default()/* use setters */));
1315 /// let x = SourceObject::new().set_or_clear_object_preconditions(None::<ObjectPreconditions>);
1316 /// ```
1317 pub fn set_or_clear_object_preconditions<T>(mut self, v: std::option::Option<T>) -> Self
1318 where
1319 T: std::convert::Into<
1320 crate::model::compose_object_request::source_object::ObjectPreconditions,
1321 >,
1322 {
1323 self.object_preconditions = v.map(|x| x.into());
1324 self
1325 }
1326 }
1327
1328 impl wkt::message::Message for SourceObject {
1329 fn typename() -> &'static str {
1330 "type.googleapis.com/google.storage.v2.ComposeObjectRequest.SourceObject"
1331 }
1332 }
1333
1334 /// Defines additional types related to [SourceObject].
1335 pub mod source_object {
1336 #[allow(unused_imports)]
1337 use super::*;
1338
1339 /// Preconditions for a source object of a composition request.
1340 #[derive(Clone, Default, PartialEq)]
1341 #[non_exhaustive]
1342 pub struct ObjectPreconditions {
1343 /// Only perform the composition if the generation of the source object
1344 /// that would be used matches this value. If this value and a generation
1345 /// are both specified, they must be the same value or the call fails.
1346 pub if_generation_match: std::option::Option<i64>,
1347
1348 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1349 }
1350
1351 impl ObjectPreconditions {
1352 /// Creates a new default instance.
1353 pub fn new() -> Self {
1354 std::default::Default::default()
1355 }
1356
1357 /// Sets the value of [if_generation_match][crate::model::compose_object_request::source_object::ObjectPreconditions::if_generation_match].
1358 ///
1359 /// # Example
1360 /// ```ignore,no_run
1361 /// # use google_cloud_storage::model::compose_object_request::source_object::ObjectPreconditions;
1362 /// let x = ObjectPreconditions::new().set_if_generation_match(42);
1363 /// ```
1364 pub fn set_if_generation_match<T>(mut self, v: T) -> Self
1365 where
1366 T: std::convert::Into<i64>,
1367 {
1368 self.if_generation_match = std::option::Option::Some(v.into());
1369 self
1370 }
1371
1372 /// Sets or clears the value of [if_generation_match][crate::model::compose_object_request::source_object::ObjectPreconditions::if_generation_match].
1373 ///
1374 /// # Example
1375 /// ```ignore,no_run
1376 /// # use google_cloud_storage::model::compose_object_request::source_object::ObjectPreconditions;
1377 /// let x = ObjectPreconditions::new().set_or_clear_if_generation_match(Some(42));
1378 /// let x = ObjectPreconditions::new().set_or_clear_if_generation_match(None::<i32>);
1379 /// ```
1380 pub fn set_or_clear_if_generation_match<T>(mut self, v: std::option::Option<T>) -> Self
1381 where
1382 T: std::convert::Into<i64>,
1383 {
1384 self.if_generation_match = v.map(|x| x.into());
1385 self
1386 }
1387 }
1388
1389 impl wkt::message::Message for ObjectPreconditions {
1390 fn typename() -> &'static str {
1391 "type.googleapis.com/google.storage.v2.ComposeObjectRequest.SourceObject.ObjectPreconditions"
1392 }
1393 }
1394 }
1395}
1396
1397/// Request message for deleting an object.
1398#[derive(Clone, Default, PartialEq)]
1399#[non_exhaustive]
1400pub struct DeleteObjectRequest {
1401 /// Required. Name of the bucket in which the object resides.
1402 pub bucket: std::string::String,
1403
1404 /// Required. The name of the finalized object to delete.
1405 /// Note: If you want to delete an unfinalized resumable upload please use
1406 /// `CancelResumableWrite`.
1407 pub object: std::string::String,
1408
1409 /// Optional. If present, permanently deletes a specific revision of this
1410 /// object (as opposed to the latest version, the default).
1411 pub generation: i64,
1412
1413 /// Makes the operation conditional on whether the object's current generation
1414 /// matches the given value. Setting to 0 makes the operation succeed only if
1415 /// there are no live versions of the object.
1416 pub if_generation_match: std::option::Option<i64>,
1417
1418 /// Makes the operation conditional on whether the object's live generation
1419 /// does not match the given value. If no live object exists, the precondition
1420 /// fails. Setting to 0 makes the operation succeed only if there is a live
1421 /// version of the object.
1422 pub if_generation_not_match: std::option::Option<i64>,
1423
1424 /// Makes the operation conditional on whether the object's current
1425 /// metageneration matches the given value.
1426 pub if_metageneration_match: std::option::Option<i64>,
1427
1428 /// Makes the operation conditional on whether the object's current
1429 /// metageneration does not match the given value.
1430 pub if_metageneration_not_match: std::option::Option<i64>,
1431
1432 /// Optional. A set of parameters common to Storage API requests concerning an
1433 /// object.
1434 pub common_object_request_params: std::option::Option<crate::model::CommonObjectRequestParams>,
1435
1436 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1437}
1438
1439impl DeleteObjectRequest {
1440 /// Creates a new default instance.
1441 pub fn new() -> Self {
1442 std::default::Default::default()
1443 }
1444
1445 /// Sets the value of [bucket][crate::model::DeleteObjectRequest::bucket].
1446 ///
1447 /// # Example
1448 /// ```ignore,no_run
1449 /// # use google_cloud_storage::model::DeleteObjectRequest;
1450 /// let x = DeleteObjectRequest::new().set_bucket("example");
1451 /// ```
1452 pub fn set_bucket<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1453 self.bucket = v.into();
1454 self
1455 }
1456
1457 /// Sets the value of [object][crate::model::DeleteObjectRequest::object].
1458 ///
1459 /// # Example
1460 /// ```ignore,no_run
1461 /// # use google_cloud_storage::model::DeleteObjectRequest;
1462 /// let x = DeleteObjectRequest::new().set_object("example");
1463 /// ```
1464 pub fn set_object<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1465 self.object = v.into();
1466 self
1467 }
1468
1469 /// Sets the value of [generation][crate::model::DeleteObjectRequest::generation].
1470 ///
1471 /// # Example
1472 /// ```ignore,no_run
1473 /// # use google_cloud_storage::model::DeleteObjectRequest;
1474 /// let x = DeleteObjectRequest::new().set_generation(42);
1475 /// ```
1476 pub fn set_generation<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
1477 self.generation = v.into();
1478 self
1479 }
1480
1481 /// Sets the value of [if_generation_match][crate::model::DeleteObjectRequest::if_generation_match].
1482 ///
1483 /// # Example
1484 /// ```ignore,no_run
1485 /// # use google_cloud_storage::model::DeleteObjectRequest;
1486 /// let x = DeleteObjectRequest::new().set_if_generation_match(42);
1487 /// ```
1488 pub fn set_if_generation_match<T>(mut self, v: T) -> Self
1489 where
1490 T: std::convert::Into<i64>,
1491 {
1492 self.if_generation_match = std::option::Option::Some(v.into());
1493 self
1494 }
1495
1496 /// Sets or clears the value of [if_generation_match][crate::model::DeleteObjectRequest::if_generation_match].
1497 ///
1498 /// # Example
1499 /// ```ignore,no_run
1500 /// # use google_cloud_storage::model::DeleteObjectRequest;
1501 /// let x = DeleteObjectRequest::new().set_or_clear_if_generation_match(Some(42));
1502 /// let x = DeleteObjectRequest::new().set_or_clear_if_generation_match(None::<i32>);
1503 /// ```
1504 pub fn set_or_clear_if_generation_match<T>(mut self, v: std::option::Option<T>) -> Self
1505 where
1506 T: std::convert::Into<i64>,
1507 {
1508 self.if_generation_match = v.map(|x| x.into());
1509 self
1510 }
1511
1512 /// Sets the value of [if_generation_not_match][crate::model::DeleteObjectRequest::if_generation_not_match].
1513 ///
1514 /// # Example
1515 /// ```ignore,no_run
1516 /// # use google_cloud_storage::model::DeleteObjectRequest;
1517 /// let x = DeleteObjectRequest::new().set_if_generation_not_match(42);
1518 /// ```
1519 pub fn set_if_generation_not_match<T>(mut self, v: T) -> Self
1520 where
1521 T: std::convert::Into<i64>,
1522 {
1523 self.if_generation_not_match = std::option::Option::Some(v.into());
1524 self
1525 }
1526
1527 /// Sets or clears the value of [if_generation_not_match][crate::model::DeleteObjectRequest::if_generation_not_match].
1528 ///
1529 /// # Example
1530 /// ```ignore,no_run
1531 /// # use google_cloud_storage::model::DeleteObjectRequest;
1532 /// let x = DeleteObjectRequest::new().set_or_clear_if_generation_not_match(Some(42));
1533 /// let x = DeleteObjectRequest::new().set_or_clear_if_generation_not_match(None::<i32>);
1534 /// ```
1535 pub fn set_or_clear_if_generation_not_match<T>(mut self, v: std::option::Option<T>) -> Self
1536 where
1537 T: std::convert::Into<i64>,
1538 {
1539 self.if_generation_not_match = v.map(|x| x.into());
1540 self
1541 }
1542
1543 /// Sets the value of [if_metageneration_match][crate::model::DeleteObjectRequest::if_metageneration_match].
1544 ///
1545 /// # Example
1546 /// ```ignore,no_run
1547 /// # use google_cloud_storage::model::DeleteObjectRequest;
1548 /// let x = DeleteObjectRequest::new().set_if_metageneration_match(42);
1549 /// ```
1550 pub fn set_if_metageneration_match<T>(mut self, v: T) -> Self
1551 where
1552 T: std::convert::Into<i64>,
1553 {
1554 self.if_metageneration_match = std::option::Option::Some(v.into());
1555 self
1556 }
1557
1558 /// Sets or clears the value of [if_metageneration_match][crate::model::DeleteObjectRequest::if_metageneration_match].
1559 ///
1560 /// # Example
1561 /// ```ignore,no_run
1562 /// # use google_cloud_storage::model::DeleteObjectRequest;
1563 /// let x = DeleteObjectRequest::new().set_or_clear_if_metageneration_match(Some(42));
1564 /// let x = DeleteObjectRequest::new().set_or_clear_if_metageneration_match(None::<i32>);
1565 /// ```
1566 pub fn set_or_clear_if_metageneration_match<T>(mut self, v: std::option::Option<T>) -> Self
1567 where
1568 T: std::convert::Into<i64>,
1569 {
1570 self.if_metageneration_match = v.map(|x| x.into());
1571 self
1572 }
1573
1574 /// Sets the value of [if_metageneration_not_match][crate::model::DeleteObjectRequest::if_metageneration_not_match].
1575 ///
1576 /// # Example
1577 /// ```ignore,no_run
1578 /// # use google_cloud_storage::model::DeleteObjectRequest;
1579 /// let x = DeleteObjectRequest::new().set_if_metageneration_not_match(42);
1580 /// ```
1581 pub fn set_if_metageneration_not_match<T>(mut self, v: T) -> Self
1582 where
1583 T: std::convert::Into<i64>,
1584 {
1585 self.if_metageneration_not_match = std::option::Option::Some(v.into());
1586 self
1587 }
1588
1589 /// Sets or clears the value of [if_metageneration_not_match][crate::model::DeleteObjectRequest::if_metageneration_not_match].
1590 ///
1591 /// # Example
1592 /// ```ignore,no_run
1593 /// # use google_cloud_storage::model::DeleteObjectRequest;
1594 /// let x = DeleteObjectRequest::new().set_or_clear_if_metageneration_not_match(Some(42));
1595 /// let x = DeleteObjectRequest::new().set_or_clear_if_metageneration_not_match(None::<i32>);
1596 /// ```
1597 pub fn set_or_clear_if_metageneration_not_match<T>(mut self, v: std::option::Option<T>) -> Self
1598 where
1599 T: std::convert::Into<i64>,
1600 {
1601 self.if_metageneration_not_match = v.map(|x| x.into());
1602 self
1603 }
1604
1605 /// Sets the value of [common_object_request_params][crate::model::DeleteObjectRequest::common_object_request_params].
1606 ///
1607 /// # Example
1608 /// ```ignore,no_run
1609 /// # use google_cloud_storage::model::DeleteObjectRequest;
1610 /// use google_cloud_storage::model::CommonObjectRequestParams;
1611 /// let x = DeleteObjectRequest::new().set_common_object_request_params(CommonObjectRequestParams::default()/* use setters */);
1612 /// ```
1613 pub fn set_common_object_request_params<T>(mut self, v: T) -> Self
1614 where
1615 T: std::convert::Into<crate::model::CommonObjectRequestParams>,
1616 {
1617 self.common_object_request_params = std::option::Option::Some(v.into());
1618 self
1619 }
1620
1621 /// Sets or clears the value of [common_object_request_params][crate::model::DeleteObjectRequest::common_object_request_params].
1622 ///
1623 /// # Example
1624 /// ```ignore,no_run
1625 /// # use google_cloud_storage::model::DeleteObjectRequest;
1626 /// use google_cloud_storage::model::CommonObjectRequestParams;
1627 /// let x = DeleteObjectRequest::new().set_or_clear_common_object_request_params(Some(CommonObjectRequestParams::default()/* use setters */));
1628 /// let x = DeleteObjectRequest::new().set_or_clear_common_object_request_params(None::<CommonObjectRequestParams>);
1629 /// ```
1630 pub fn set_or_clear_common_object_request_params<T>(mut self, v: std::option::Option<T>) -> Self
1631 where
1632 T: std::convert::Into<crate::model::CommonObjectRequestParams>,
1633 {
1634 self.common_object_request_params = v.map(|x| x.into());
1635 self
1636 }
1637}
1638
1639impl wkt::message::Message for DeleteObjectRequest {
1640 fn typename() -> &'static str {
1641 "type.googleapis.com/google.storage.v2.DeleteObjectRequest"
1642 }
1643}
1644
1645/// Request message for
1646/// [RestoreObject][google.storage.v2.Storage.RestoreObject].
1647/// `bucket`, `object`, and `generation` **must** be set.
1648///
1649/// [google.storage.v2.Storage.RestoreObject]: crate::client::StorageControl::restore_object
1650#[derive(Clone, Default, PartialEq)]
1651#[non_exhaustive]
1652pub struct RestoreObjectRequest {
1653 /// Required. Name of the bucket in which the object resides.
1654 pub bucket: std::string::String,
1655
1656 /// Required. The name of the object to restore.
1657 pub object: std::string::String,
1658
1659 /// Required. The specific revision of the object to restore.
1660 pub generation: i64,
1661
1662 /// Optional. Restore token used to differentiate soft-deleted objects with the
1663 /// same name and generation. Only applicable for hierarchical namespace
1664 /// buckets. This parameter is optional, and is only required in the rare case
1665 /// when there are multiple soft-deleted objects with the same name and
1666 /// generation.
1667 pub restore_token: std::string::String,
1668
1669 /// Makes the operation conditional on whether the object's current generation
1670 /// matches the given value. Setting to 0 makes the operation succeed only if
1671 /// there are no live versions of the object.
1672 pub if_generation_match: std::option::Option<i64>,
1673
1674 /// Makes the operation conditional on whether the object's live generation
1675 /// does not match the given value. If no live object exists, the precondition
1676 /// fails. Setting to 0 makes the operation succeed only if there is a live
1677 /// version of the object.
1678 pub if_generation_not_match: std::option::Option<i64>,
1679
1680 /// Makes the operation conditional on whether the object's current
1681 /// metageneration matches the given value.
1682 pub if_metageneration_match: std::option::Option<i64>,
1683
1684 /// Makes the operation conditional on whether the object's current
1685 /// metageneration does not match the given value.
1686 pub if_metageneration_not_match: std::option::Option<i64>,
1687
1688 /// If false or unset, the bucket's default object ACL is used.
1689 /// If true, copy the source object's access controls.
1690 /// Return an error if bucket has UBLA enabled.
1691 pub copy_source_acl: std::option::Option<bool>,
1692
1693 /// Optional. A set of parameters common to Storage API requests concerning an
1694 /// object.
1695 pub common_object_request_params: std::option::Option<crate::model::CommonObjectRequestParams>,
1696
1697 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1698}
1699
1700impl RestoreObjectRequest {
1701 /// Creates a new default instance.
1702 pub fn new() -> Self {
1703 std::default::Default::default()
1704 }
1705
1706 /// Sets the value of [bucket][crate::model::RestoreObjectRequest::bucket].
1707 ///
1708 /// # Example
1709 /// ```ignore,no_run
1710 /// # use google_cloud_storage::model::RestoreObjectRequest;
1711 /// let x = RestoreObjectRequest::new().set_bucket("example");
1712 /// ```
1713 pub fn set_bucket<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1714 self.bucket = v.into();
1715 self
1716 }
1717
1718 /// Sets the value of [object][crate::model::RestoreObjectRequest::object].
1719 ///
1720 /// # Example
1721 /// ```ignore,no_run
1722 /// # use google_cloud_storage::model::RestoreObjectRequest;
1723 /// let x = RestoreObjectRequest::new().set_object("example");
1724 /// ```
1725 pub fn set_object<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1726 self.object = v.into();
1727 self
1728 }
1729
1730 /// Sets the value of [generation][crate::model::RestoreObjectRequest::generation].
1731 ///
1732 /// # Example
1733 /// ```ignore,no_run
1734 /// # use google_cloud_storage::model::RestoreObjectRequest;
1735 /// let x = RestoreObjectRequest::new().set_generation(42);
1736 /// ```
1737 pub fn set_generation<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
1738 self.generation = v.into();
1739 self
1740 }
1741
1742 /// Sets the value of [restore_token][crate::model::RestoreObjectRequest::restore_token].
1743 ///
1744 /// # Example
1745 /// ```ignore,no_run
1746 /// # use google_cloud_storage::model::RestoreObjectRequest;
1747 /// let x = RestoreObjectRequest::new().set_restore_token("example");
1748 /// ```
1749 pub fn set_restore_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1750 self.restore_token = v.into();
1751 self
1752 }
1753
1754 /// Sets the value of [if_generation_match][crate::model::RestoreObjectRequest::if_generation_match].
1755 ///
1756 /// # Example
1757 /// ```ignore,no_run
1758 /// # use google_cloud_storage::model::RestoreObjectRequest;
1759 /// let x = RestoreObjectRequest::new().set_if_generation_match(42);
1760 /// ```
1761 pub fn set_if_generation_match<T>(mut self, v: T) -> Self
1762 where
1763 T: std::convert::Into<i64>,
1764 {
1765 self.if_generation_match = std::option::Option::Some(v.into());
1766 self
1767 }
1768
1769 /// Sets or clears the value of [if_generation_match][crate::model::RestoreObjectRequest::if_generation_match].
1770 ///
1771 /// # Example
1772 /// ```ignore,no_run
1773 /// # use google_cloud_storage::model::RestoreObjectRequest;
1774 /// let x = RestoreObjectRequest::new().set_or_clear_if_generation_match(Some(42));
1775 /// let x = RestoreObjectRequest::new().set_or_clear_if_generation_match(None::<i32>);
1776 /// ```
1777 pub fn set_or_clear_if_generation_match<T>(mut self, v: std::option::Option<T>) -> Self
1778 where
1779 T: std::convert::Into<i64>,
1780 {
1781 self.if_generation_match = v.map(|x| x.into());
1782 self
1783 }
1784
1785 /// Sets the value of [if_generation_not_match][crate::model::RestoreObjectRequest::if_generation_not_match].
1786 ///
1787 /// # Example
1788 /// ```ignore,no_run
1789 /// # use google_cloud_storage::model::RestoreObjectRequest;
1790 /// let x = RestoreObjectRequest::new().set_if_generation_not_match(42);
1791 /// ```
1792 pub fn set_if_generation_not_match<T>(mut self, v: T) -> Self
1793 where
1794 T: std::convert::Into<i64>,
1795 {
1796 self.if_generation_not_match = std::option::Option::Some(v.into());
1797 self
1798 }
1799
1800 /// Sets or clears the value of [if_generation_not_match][crate::model::RestoreObjectRequest::if_generation_not_match].
1801 ///
1802 /// # Example
1803 /// ```ignore,no_run
1804 /// # use google_cloud_storage::model::RestoreObjectRequest;
1805 /// let x = RestoreObjectRequest::new().set_or_clear_if_generation_not_match(Some(42));
1806 /// let x = RestoreObjectRequest::new().set_or_clear_if_generation_not_match(None::<i32>);
1807 /// ```
1808 pub fn set_or_clear_if_generation_not_match<T>(mut self, v: std::option::Option<T>) -> Self
1809 where
1810 T: std::convert::Into<i64>,
1811 {
1812 self.if_generation_not_match = v.map(|x| x.into());
1813 self
1814 }
1815
1816 /// Sets the value of [if_metageneration_match][crate::model::RestoreObjectRequest::if_metageneration_match].
1817 ///
1818 /// # Example
1819 /// ```ignore,no_run
1820 /// # use google_cloud_storage::model::RestoreObjectRequest;
1821 /// let x = RestoreObjectRequest::new().set_if_metageneration_match(42);
1822 /// ```
1823 pub fn set_if_metageneration_match<T>(mut self, v: T) -> Self
1824 where
1825 T: std::convert::Into<i64>,
1826 {
1827 self.if_metageneration_match = std::option::Option::Some(v.into());
1828 self
1829 }
1830
1831 /// Sets or clears the value of [if_metageneration_match][crate::model::RestoreObjectRequest::if_metageneration_match].
1832 ///
1833 /// # Example
1834 /// ```ignore,no_run
1835 /// # use google_cloud_storage::model::RestoreObjectRequest;
1836 /// let x = RestoreObjectRequest::new().set_or_clear_if_metageneration_match(Some(42));
1837 /// let x = RestoreObjectRequest::new().set_or_clear_if_metageneration_match(None::<i32>);
1838 /// ```
1839 pub fn set_or_clear_if_metageneration_match<T>(mut self, v: std::option::Option<T>) -> Self
1840 where
1841 T: std::convert::Into<i64>,
1842 {
1843 self.if_metageneration_match = v.map(|x| x.into());
1844 self
1845 }
1846
1847 /// Sets the value of [if_metageneration_not_match][crate::model::RestoreObjectRequest::if_metageneration_not_match].
1848 ///
1849 /// # Example
1850 /// ```ignore,no_run
1851 /// # use google_cloud_storage::model::RestoreObjectRequest;
1852 /// let x = RestoreObjectRequest::new().set_if_metageneration_not_match(42);
1853 /// ```
1854 pub fn set_if_metageneration_not_match<T>(mut self, v: T) -> Self
1855 where
1856 T: std::convert::Into<i64>,
1857 {
1858 self.if_metageneration_not_match = std::option::Option::Some(v.into());
1859 self
1860 }
1861
1862 /// Sets or clears the value of [if_metageneration_not_match][crate::model::RestoreObjectRequest::if_metageneration_not_match].
1863 ///
1864 /// # Example
1865 /// ```ignore,no_run
1866 /// # use google_cloud_storage::model::RestoreObjectRequest;
1867 /// let x = RestoreObjectRequest::new().set_or_clear_if_metageneration_not_match(Some(42));
1868 /// let x = RestoreObjectRequest::new().set_or_clear_if_metageneration_not_match(None::<i32>);
1869 /// ```
1870 pub fn set_or_clear_if_metageneration_not_match<T>(mut self, v: std::option::Option<T>) -> Self
1871 where
1872 T: std::convert::Into<i64>,
1873 {
1874 self.if_metageneration_not_match = v.map(|x| x.into());
1875 self
1876 }
1877
1878 /// Sets the value of [copy_source_acl][crate::model::RestoreObjectRequest::copy_source_acl].
1879 ///
1880 /// # Example
1881 /// ```ignore,no_run
1882 /// # use google_cloud_storage::model::RestoreObjectRequest;
1883 /// let x = RestoreObjectRequest::new().set_copy_source_acl(true);
1884 /// ```
1885 pub fn set_copy_source_acl<T>(mut self, v: T) -> Self
1886 where
1887 T: std::convert::Into<bool>,
1888 {
1889 self.copy_source_acl = std::option::Option::Some(v.into());
1890 self
1891 }
1892
1893 /// Sets or clears the value of [copy_source_acl][crate::model::RestoreObjectRequest::copy_source_acl].
1894 ///
1895 /// # Example
1896 /// ```ignore,no_run
1897 /// # use google_cloud_storage::model::RestoreObjectRequest;
1898 /// let x = RestoreObjectRequest::new().set_or_clear_copy_source_acl(Some(false));
1899 /// let x = RestoreObjectRequest::new().set_or_clear_copy_source_acl(None::<bool>);
1900 /// ```
1901 pub fn set_or_clear_copy_source_acl<T>(mut self, v: std::option::Option<T>) -> Self
1902 where
1903 T: std::convert::Into<bool>,
1904 {
1905 self.copy_source_acl = v.map(|x| x.into());
1906 self
1907 }
1908
1909 /// Sets the value of [common_object_request_params][crate::model::RestoreObjectRequest::common_object_request_params].
1910 ///
1911 /// # Example
1912 /// ```ignore,no_run
1913 /// # use google_cloud_storage::model::RestoreObjectRequest;
1914 /// use google_cloud_storage::model::CommonObjectRequestParams;
1915 /// let x = RestoreObjectRequest::new().set_common_object_request_params(CommonObjectRequestParams::default()/* use setters */);
1916 /// ```
1917 pub fn set_common_object_request_params<T>(mut self, v: T) -> Self
1918 where
1919 T: std::convert::Into<crate::model::CommonObjectRequestParams>,
1920 {
1921 self.common_object_request_params = std::option::Option::Some(v.into());
1922 self
1923 }
1924
1925 /// Sets or clears the value of [common_object_request_params][crate::model::RestoreObjectRequest::common_object_request_params].
1926 ///
1927 /// # Example
1928 /// ```ignore,no_run
1929 /// # use google_cloud_storage::model::RestoreObjectRequest;
1930 /// use google_cloud_storage::model::CommonObjectRequestParams;
1931 /// let x = RestoreObjectRequest::new().set_or_clear_common_object_request_params(Some(CommonObjectRequestParams::default()/* use setters */));
1932 /// let x = RestoreObjectRequest::new().set_or_clear_common_object_request_params(None::<CommonObjectRequestParams>);
1933 /// ```
1934 pub fn set_or_clear_common_object_request_params<T>(mut self, v: std::option::Option<T>) -> Self
1935 where
1936 T: std::convert::Into<crate::model::CommonObjectRequestParams>,
1937 {
1938 self.common_object_request_params = v.map(|x| x.into());
1939 self
1940 }
1941}
1942
1943impl wkt::message::Message for RestoreObjectRequest {
1944 fn typename() -> &'static str {
1945 "type.googleapis.com/google.storage.v2.RestoreObjectRequest"
1946 }
1947}
1948
1949/// Request message for [ReadObject][google.storage.v2.Storage.ReadObject].
1950#[derive(Clone, Default, PartialEq)]
1951#[non_exhaustive]
1952pub struct ReadObjectRequest {
1953 /// Required. The name of the bucket containing the object to read.
1954 pub bucket: std::string::String,
1955
1956 /// Required. The name of the object to read.
1957 pub object: std::string::String,
1958
1959 /// Optional. If present, selects a specific revision of this object (as
1960 /// opposed to the latest version, the default).
1961 pub generation: i64,
1962
1963 /// Optional. The offset for the first byte to return in the read, relative to
1964 /// the start of the object.
1965 ///
1966 /// A negative `read_offset` value is interpreted as the number of bytes
1967 /// back from the end of the object to be returned. For example, if an object's
1968 /// length is `15` bytes, a `ReadObjectRequest` with `read_offset` = `-5` and
1969 /// `read_limit` = `3` would return bytes `10` through `12` of the object.
1970 /// Requesting a negative offset with magnitude larger than the size of the
1971 /// object returns the entire object.
1972 pub read_offset: i64,
1973
1974 /// Optional. The maximum number of `data` bytes the server is allowed to
1975 /// return in the sum of all `Object` messages. A `read_limit` of zero
1976 /// indicates that there is no limit, and a negative `read_limit` causes an
1977 /// error.
1978 ///
1979 /// If the stream returns fewer bytes than allowed by the `read_limit` and no
1980 /// error occurred, the stream includes all data from the `read_offset` to the
1981 /// end of the resource.
1982 pub read_limit: i64,
1983
1984 /// Makes the operation conditional on whether the object's current generation
1985 /// matches the given value. Setting to 0 makes the operation succeed only if
1986 /// there are no live versions of the object.
1987 pub if_generation_match: std::option::Option<i64>,
1988
1989 /// Makes the operation conditional on whether the object's live generation
1990 /// does not match the given value. If no live object exists, the precondition
1991 /// fails. Setting to 0 makes the operation succeed only if there is a live
1992 /// version of the object.
1993 pub if_generation_not_match: std::option::Option<i64>,
1994
1995 /// Makes the operation conditional on whether the object's current
1996 /// metageneration matches the given value.
1997 pub if_metageneration_match: std::option::Option<i64>,
1998
1999 /// Makes the operation conditional on whether the object's current
2000 /// metageneration does not match the given value.
2001 pub if_metageneration_not_match: std::option::Option<i64>,
2002
2003 /// Optional. A set of parameters common to Storage API requests concerning an
2004 /// object.
2005 pub common_object_request_params: std::option::Option<crate::model::CommonObjectRequestParams>,
2006
2007 /// Mask specifying which fields to read.
2008 /// The `checksummed_data` field and its children are always present.
2009 /// If no mask is specified, it defaults to all fields except `metadata.
2010 /// owner` and `metadata.acl`.
2011 /// `*` might be used to mean "all fields".
2012 pub read_mask: std::option::Option<wkt::FieldMask>,
2013
2014 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2015}
2016
2017impl ReadObjectRequest {
2018 /// Creates a new default instance.
2019 pub fn new() -> Self {
2020 std::default::Default::default()
2021 }
2022
2023 /// Sets the value of [bucket][crate::model::ReadObjectRequest::bucket].
2024 ///
2025 /// # Example
2026 /// ```ignore,no_run
2027 /// # use google_cloud_storage::model::ReadObjectRequest;
2028 /// let x = ReadObjectRequest::new().set_bucket("example");
2029 /// ```
2030 pub fn set_bucket<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2031 self.bucket = v.into();
2032 self
2033 }
2034
2035 /// Sets the value of [object][crate::model::ReadObjectRequest::object].
2036 ///
2037 /// # Example
2038 /// ```ignore,no_run
2039 /// # use google_cloud_storage::model::ReadObjectRequest;
2040 /// let x = ReadObjectRequest::new().set_object("example");
2041 /// ```
2042 pub fn set_object<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2043 self.object = v.into();
2044 self
2045 }
2046
2047 /// Sets the value of [generation][crate::model::ReadObjectRequest::generation].
2048 ///
2049 /// # Example
2050 /// ```ignore,no_run
2051 /// # use google_cloud_storage::model::ReadObjectRequest;
2052 /// let x = ReadObjectRequest::new().set_generation(42);
2053 /// ```
2054 pub fn set_generation<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
2055 self.generation = v.into();
2056 self
2057 }
2058
2059 /// Sets the value of [read_offset][crate::model::ReadObjectRequest::read_offset].
2060 ///
2061 /// # Example
2062 /// ```ignore,no_run
2063 /// # use google_cloud_storage::model::ReadObjectRequest;
2064 /// let x = ReadObjectRequest::new().set_read_offset(42);
2065 /// ```
2066 pub fn set_read_offset<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
2067 self.read_offset = v.into();
2068 self
2069 }
2070
2071 /// Sets the value of [read_limit][crate::model::ReadObjectRequest::read_limit].
2072 ///
2073 /// # Example
2074 /// ```ignore,no_run
2075 /// # use google_cloud_storage::model::ReadObjectRequest;
2076 /// let x = ReadObjectRequest::new().set_read_limit(42);
2077 /// ```
2078 pub fn set_read_limit<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
2079 self.read_limit = v.into();
2080 self
2081 }
2082
2083 /// Sets the value of [if_generation_match][crate::model::ReadObjectRequest::if_generation_match].
2084 ///
2085 /// # Example
2086 /// ```ignore,no_run
2087 /// # use google_cloud_storage::model::ReadObjectRequest;
2088 /// let x = ReadObjectRequest::new().set_if_generation_match(42);
2089 /// ```
2090 pub fn set_if_generation_match<T>(mut self, v: T) -> Self
2091 where
2092 T: std::convert::Into<i64>,
2093 {
2094 self.if_generation_match = std::option::Option::Some(v.into());
2095 self
2096 }
2097
2098 /// Sets or clears the value of [if_generation_match][crate::model::ReadObjectRequest::if_generation_match].
2099 ///
2100 /// # Example
2101 /// ```ignore,no_run
2102 /// # use google_cloud_storage::model::ReadObjectRequest;
2103 /// let x = ReadObjectRequest::new().set_or_clear_if_generation_match(Some(42));
2104 /// let x = ReadObjectRequest::new().set_or_clear_if_generation_match(None::<i32>);
2105 /// ```
2106 pub fn set_or_clear_if_generation_match<T>(mut self, v: std::option::Option<T>) -> Self
2107 where
2108 T: std::convert::Into<i64>,
2109 {
2110 self.if_generation_match = v.map(|x| x.into());
2111 self
2112 }
2113
2114 /// Sets the value of [if_generation_not_match][crate::model::ReadObjectRequest::if_generation_not_match].
2115 ///
2116 /// # Example
2117 /// ```ignore,no_run
2118 /// # use google_cloud_storage::model::ReadObjectRequest;
2119 /// let x = ReadObjectRequest::new().set_if_generation_not_match(42);
2120 /// ```
2121 pub fn set_if_generation_not_match<T>(mut self, v: T) -> Self
2122 where
2123 T: std::convert::Into<i64>,
2124 {
2125 self.if_generation_not_match = std::option::Option::Some(v.into());
2126 self
2127 }
2128
2129 /// Sets or clears the value of [if_generation_not_match][crate::model::ReadObjectRequest::if_generation_not_match].
2130 ///
2131 /// # Example
2132 /// ```ignore,no_run
2133 /// # use google_cloud_storage::model::ReadObjectRequest;
2134 /// let x = ReadObjectRequest::new().set_or_clear_if_generation_not_match(Some(42));
2135 /// let x = ReadObjectRequest::new().set_or_clear_if_generation_not_match(None::<i32>);
2136 /// ```
2137 pub fn set_or_clear_if_generation_not_match<T>(mut self, v: std::option::Option<T>) -> Self
2138 where
2139 T: std::convert::Into<i64>,
2140 {
2141 self.if_generation_not_match = v.map(|x| x.into());
2142 self
2143 }
2144
2145 /// Sets the value of [if_metageneration_match][crate::model::ReadObjectRequest::if_metageneration_match].
2146 ///
2147 /// # Example
2148 /// ```ignore,no_run
2149 /// # use google_cloud_storage::model::ReadObjectRequest;
2150 /// let x = ReadObjectRequest::new().set_if_metageneration_match(42);
2151 /// ```
2152 pub fn set_if_metageneration_match<T>(mut self, v: T) -> Self
2153 where
2154 T: std::convert::Into<i64>,
2155 {
2156 self.if_metageneration_match = std::option::Option::Some(v.into());
2157 self
2158 }
2159
2160 /// Sets or clears the value of [if_metageneration_match][crate::model::ReadObjectRequest::if_metageneration_match].
2161 ///
2162 /// # Example
2163 /// ```ignore,no_run
2164 /// # use google_cloud_storage::model::ReadObjectRequest;
2165 /// let x = ReadObjectRequest::new().set_or_clear_if_metageneration_match(Some(42));
2166 /// let x = ReadObjectRequest::new().set_or_clear_if_metageneration_match(None::<i32>);
2167 /// ```
2168 pub fn set_or_clear_if_metageneration_match<T>(mut self, v: std::option::Option<T>) -> Self
2169 where
2170 T: std::convert::Into<i64>,
2171 {
2172 self.if_metageneration_match = v.map(|x| x.into());
2173 self
2174 }
2175
2176 /// Sets the value of [if_metageneration_not_match][crate::model::ReadObjectRequest::if_metageneration_not_match].
2177 ///
2178 /// # Example
2179 /// ```ignore,no_run
2180 /// # use google_cloud_storage::model::ReadObjectRequest;
2181 /// let x = ReadObjectRequest::new().set_if_metageneration_not_match(42);
2182 /// ```
2183 pub fn set_if_metageneration_not_match<T>(mut self, v: T) -> Self
2184 where
2185 T: std::convert::Into<i64>,
2186 {
2187 self.if_metageneration_not_match = std::option::Option::Some(v.into());
2188 self
2189 }
2190
2191 /// Sets or clears the value of [if_metageneration_not_match][crate::model::ReadObjectRequest::if_metageneration_not_match].
2192 ///
2193 /// # Example
2194 /// ```ignore,no_run
2195 /// # use google_cloud_storage::model::ReadObjectRequest;
2196 /// let x = ReadObjectRequest::new().set_or_clear_if_metageneration_not_match(Some(42));
2197 /// let x = ReadObjectRequest::new().set_or_clear_if_metageneration_not_match(None::<i32>);
2198 /// ```
2199 pub fn set_or_clear_if_metageneration_not_match<T>(mut self, v: std::option::Option<T>) -> Self
2200 where
2201 T: std::convert::Into<i64>,
2202 {
2203 self.if_metageneration_not_match = v.map(|x| x.into());
2204 self
2205 }
2206
2207 /// Sets the value of [common_object_request_params][crate::model::ReadObjectRequest::common_object_request_params].
2208 ///
2209 /// # Example
2210 /// ```ignore,no_run
2211 /// # use google_cloud_storage::model::ReadObjectRequest;
2212 /// use google_cloud_storage::model::CommonObjectRequestParams;
2213 /// let x = ReadObjectRequest::new().set_common_object_request_params(CommonObjectRequestParams::default()/* use setters */);
2214 /// ```
2215 pub fn set_common_object_request_params<T>(mut self, v: T) -> Self
2216 where
2217 T: std::convert::Into<crate::model::CommonObjectRequestParams>,
2218 {
2219 self.common_object_request_params = std::option::Option::Some(v.into());
2220 self
2221 }
2222
2223 /// Sets or clears the value of [common_object_request_params][crate::model::ReadObjectRequest::common_object_request_params].
2224 ///
2225 /// # Example
2226 /// ```ignore,no_run
2227 /// # use google_cloud_storage::model::ReadObjectRequest;
2228 /// use google_cloud_storage::model::CommonObjectRequestParams;
2229 /// let x = ReadObjectRequest::new().set_or_clear_common_object_request_params(Some(CommonObjectRequestParams::default()/* use setters */));
2230 /// let x = ReadObjectRequest::new().set_or_clear_common_object_request_params(None::<CommonObjectRequestParams>);
2231 /// ```
2232 pub fn set_or_clear_common_object_request_params<T>(mut self, v: std::option::Option<T>) -> Self
2233 where
2234 T: std::convert::Into<crate::model::CommonObjectRequestParams>,
2235 {
2236 self.common_object_request_params = v.map(|x| x.into());
2237 self
2238 }
2239
2240 /// Sets the value of [read_mask][crate::model::ReadObjectRequest::read_mask].
2241 ///
2242 /// # Example
2243 /// ```ignore,no_run
2244 /// # use google_cloud_storage::model::ReadObjectRequest;
2245 /// use wkt::FieldMask;
2246 /// let x = ReadObjectRequest::new().set_read_mask(FieldMask::default()/* use setters */);
2247 /// ```
2248 pub fn set_read_mask<T>(mut self, v: T) -> Self
2249 where
2250 T: std::convert::Into<wkt::FieldMask>,
2251 {
2252 self.read_mask = std::option::Option::Some(v.into());
2253 self
2254 }
2255
2256 /// Sets or clears the value of [read_mask][crate::model::ReadObjectRequest::read_mask].
2257 ///
2258 /// # Example
2259 /// ```ignore,no_run
2260 /// # use google_cloud_storage::model::ReadObjectRequest;
2261 /// use wkt::FieldMask;
2262 /// let x = ReadObjectRequest::new().set_or_clear_read_mask(Some(FieldMask::default()/* use setters */));
2263 /// let x = ReadObjectRequest::new().set_or_clear_read_mask(None::<FieldMask>);
2264 /// ```
2265 pub fn set_or_clear_read_mask<T>(mut self, v: std::option::Option<T>) -> Self
2266 where
2267 T: std::convert::Into<wkt::FieldMask>,
2268 {
2269 self.read_mask = v.map(|x| x.into());
2270 self
2271 }
2272}
2273
2274impl wkt::message::Message for ReadObjectRequest {
2275 fn typename() -> &'static str {
2276 "type.googleapis.com/google.storage.v2.ReadObjectRequest"
2277 }
2278}
2279
2280/// Request message for [GetObject][google.storage.v2.Storage.GetObject].
2281///
2282/// [google.storage.v2.Storage.GetObject]: crate::client::StorageControl::get_object
2283#[derive(Clone, Default, PartialEq)]
2284#[non_exhaustive]
2285pub struct GetObjectRequest {
2286 /// Required. Name of the bucket in which the object resides.
2287 pub bucket: std::string::String,
2288
2289 /// Required. Name of the object.
2290 pub object: std::string::String,
2291
2292 /// Optional. If present, selects a specific revision of this object (as
2293 /// opposed to the latest version, the default).
2294 pub generation: i64,
2295
2296 /// If true, return the soft-deleted version of this object.
2297 pub soft_deleted: std::option::Option<bool>,
2298
2299 /// Makes the operation conditional on whether the object's current generation
2300 /// matches the given value. Setting to 0 makes the operation succeed only if
2301 /// there are no live versions of the object.
2302 pub if_generation_match: std::option::Option<i64>,
2303
2304 /// Makes the operation conditional on whether the object's live generation
2305 /// does not match the given value. If no live object exists, the precondition
2306 /// fails. Setting to 0 makes the operation succeed only if there is a live
2307 /// version of the object.
2308 pub if_generation_not_match: std::option::Option<i64>,
2309
2310 /// Makes the operation conditional on whether the object's current
2311 /// metageneration matches the given value.
2312 pub if_metageneration_match: std::option::Option<i64>,
2313
2314 /// Makes the operation conditional on whether the object's current
2315 /// metageneration does not match the given value.
2316 pub if_metageneration_not_match: std::option::Option<i64>,
2317
2318 /// Optional. A set of parameters common to Storage API requests concerning an
2319 /// object.
2320 pub common_object_request_params: std::option::Option<crate::model::CommonObjectRequestParams>,
2321
2322 /// Mask specifying which fields to read.
2323 /// If no mask is specified, it defaults to all fields except `metadata.
2324 /// acl` and `metadata.owner`.
2325 /// `*` might be used to mean "all fields".
2326 pub read_mask: std::option::Option<wkt::FieldMask>,
2327
2328 /// Optional. Restore token used to differentiate soft-deleted objects with the
2329 /// same name and generation. Only applicable for hierarchical namespace
2330 /// buckets and if `soft_deleted` is set to `true`. This parameter is optional,
2331 /// and is only required in the rare case when there are multiple soft-deleted
2332 /// objects with the same `name` and `generation`.
2333 pub restore_token: std::string::String,
2334
2335 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2336}
2337
2338impl GetObjectRequest {
2339 /// Creates a new default instance.
2340 pub fn new() -> Self {
2341 std::default::Default::default()
2342 }
2343
2344 /// Sets the value of [bucket][crate::model::GetObjectRequest::bucket].
2345 ///
2346 /// # Example
2347 /// ```ignore,no_run
2348 /// # use google_cloud_storage::model::GetObjectRequest;
2349 /// let x = GetObjectRequest::new().set_bucket("example");
2350 /// ```
2351 pub fn set_bucket<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2352 self.bucket = v.into();
2353 self
2354 }
2355
2356 /// Sets the value of [object][crate::model::GetObjectRequest::object].
2357 ///
2358 /// # Example
2359 /// ```ignore,no_run
2360 /// # use google_cloud_storage::model::GetObjectRequest;
2361 /// let x = GetObjectRequest::new().set_object("example");
2362 /// ```
2363 pub fn set_object<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2364 self.object = v.into();
2365 self
2366 }
2367
2368 /// Sets the value of [generation][crate::model::GetObjectRequest::generation].
2369 ///
2370 /// # Example
2371 /// ```ignore,no_run
2372 /// # use google_cloud_storage::model::GetObjectRequest;
2373 /// let x = GetObjectRequest::new().set_generation(42);
2374 /// ```
2375 pub fn set_generation<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
2376 self.generation = v.into();
2377 self
2378 }
2379
2380 /// Sets the value of [soft_deleted][crate::model::GetObjectRequest::soft_deleted].
2381 ///
2382 /// # Example
2383 /// ```ignore,no_run
2384 /// # use google_cloud_storage::model::GetObjectRequest;
2385 /// let x = GetObjectRequest::new().set_soft_deleted(true);
2386 /// ```
2387 pub fn set_soft_deleted<T>(mut self, v: T) -> Self
2388 where
2389 T: std::convert::Into<bool>,
2390 {
2391 self.soft_deleted = std::option::Option::Some(v.into());
2392 self
2393 }
2394
2395 /// Sets or clears the value of [soft_deleted][crate::model::GetObjectRequest::soft_deleted].
2396 ///
2397 /// # Example
2398 /// ```ignore,no_run
2399 /// # use google_cloud_storage::model::GetObjectRequest;
2400 /// let x = GetObjectRequest::new().set_or_clear_soft_deleted(Some(false));
2401 /// let x = GetObjectRequest::new().set_or_clear_soft_deleted(None::<bool>);
2402 /// ```
2403 pub fn set_or_clear_soft_deleted<T>(mut self, v: std::option::Option<T>) -> Self
2404 where
2405 T: std::convert::Into<bool>,
2406 {
2407 self.soft_deleted = v.map(|x| x.into());
2408 self
2409 }
2410
2411 /// Sets the value of [if_generation_match][crate::model::GetObjectRequest::if_generation_match].
2412 ///
2413 /// # Example
2414 /// ```ignore,no_run
2415 /// # use google_cloud_storage::model::GetObjectRequest;
2416 /// let x = GetObjectRequest::new().set_if_generation_match(42);
2417 /// ```
2418 pub fn set_if_generation_match<T>(mut self, v: T) -> Self
2419 where
2420 T: std::convert::Into<i64>,
2421 {
2422 self.if_generation_match = std::option::Option::Some(v.into());
2423 self
2424 }
2425
2426 /// Sets or clears the value of [if_generation_match][crate::model::GetObjectRequest::if_generation_match].
2427 ///
2428 /// # Example
2429 /// ```ignore,no_run
2430 /// # use google_cloud_storage::model::GetObjectRequest;
2431 /// let x = GetObjectRequest::new().set_or_clear_if_generation_match(Some(42));
2432 /// let x = GetObjectRequest::new().set_or_clear_if_generation_match(None::<i32>);
2433 /// ```
2434 pub fn set_or_clear_if_generation_match<T>(mut self, v: std::option::Option<T>) -> Self
2435 where
2436 T: std::convert::Into<i64>,
2437 {
2438 self.if_generation_match = v.map(|x| x.into());
2439 self
2440 }
2441
2442 /// Sets the value of [if_generation_not_match][crate::model::GetObjectRequest::if_generation_not_match].
2443 ///
2444 /// # Example
2445 /// ```ignore,no_run
2446 /// # use google_cloud_storage::model::GetObjectRequest;
2447 /// let x = GetObjectRequest::new().set_if_generation_not_match(42);
2448 /// ```
2449 pub fn set_if_generation_not_match<T>(mut self, v: T) -> Self
2450 where
2451 T: std::convert::Into<i64>,
2452 {
2453 self.if_generation_not_match = std::option::Option::Some(v.into());
2454 self
2455 }
2456
2457 /// Sets or clears the value of [if_generation_not_match][crate::model::GetObjectRequest::if_generation_not_match].
2458 ///
2459 /// # Example
2460 /// ```ignore,no_run
2461 /// # use google_cloud_storage::model::GetObjectRequest;
2462 /// let x = GetObjectRequest::new().set_or_clear_if_generation_not_match(Some(42));
2463 /// let x = GetObjectRequest::new().set_or_clear_if_generation_not_match(None::<i32>);
2464 /// ```
2465 pub fn set_or_clear_if_generation_not_match<T>(mut self, v: std::option::Option<T>) -> Self
2466 where
2467 T: std::convert::Into<i64>,
2468 {
2469 self.if_generation_not_match = v.map(|x| x.into());
2470 self
2471 }
2472
2473 /// Sets the value of [if_metageneration_match][crate::model::GetObjectRequest::if_metageneration_match].
2474 ///
2475 /// # Example
2476 /// ```ignore,no_run
2477 /// # use google_cloud_storage::model::GetObjectRequest;
2478 /// let x = GetObjectRequest::new().set_if_metageneration_match(42);
2479 /// ```
2480 pub fn set_if_metageneration_match<T>(mut self, v: T) -> Self
2481 where
2482 T: std::convert::Into<i64>,
2483 {
2484 self.if_metageneration_match = std::option::Option::Some(v.into());
2485 self
2486 }
2487
2488 /// Sets or clears the value of [if_metageneration_match][crate::model::GetObjectRequest::if_metageneration_match].
2489 ///
2490 /// # Example
2491 /// ```ignore,no_run
2492 /// # use google_cloud_storage::model::GetObjectRequest;
2493 /// let x = GetObjectRequest::new().set_or_clear_if_metageneration_match(Some(42));
2494 /// let x = GetObjectRequest::new().set_or_clear_if_metageneration_match(None::<i32>);
2495 /// ```
2496 pub fn set_or_clear_if_metageneration_match<T>(mut self, v: std::option::Option<T>) -> Self
2497 where
2498 T: std::convert::Into<i64>,
2499 {
2500 self.if_metageneration_match = v.map(|x| x.into());
2501 self
2502 }
2503
2504 /// Sets the value of [if_metageneration_not_match][crate::model::GetObjectRequest::if_metageneration_not_match].
2505 ///
2506 /// # Example
2507 /// ```ignore,no_run
2508 /// # use google_cloud_storage::model::GetObjectRequest;
2509 /// let x = GetObjectRequest::new().set_if_metageneration_not_match(42);
2510 /// ```
2511 pub fn set_if_metageneration_not_match<T>(mut self, v: T) -> Self
2512 where
2513 T: std::convert::Into<i64>,
2514 {
2515 self.if_metageneration_not_match = std::option::Option::Some(v.into());
2516 self
2517 }
2518
2519 /// Sets or clears the value of [if_metageneration_not_match][crate::model::GetObjectRequest::if_metageneration_not_match].
2520 ///
2521 /// # Example
2522 /// ```ignore,no_run
2523 /// # use google_cloud_storage::model::GetObjectRequest;
2524 /// let x = GetObjectRequest::new().set_or_clear_if_metageneration_not_match(Some(42));
2525 /// let x = GetObjectRequest::new().set_or_clear_if_metageneration_not_match(None::<i32>);
2526 /// ```
2527 pub fn set_or_clear_if_metageneration_not_match<T>(mut self, v: std::option::Option<T>) -> Self
2528 where
2529 T: std::convert::Into<i64>,
2530 {
2531 self.if_metageneration_not_match = v.map(|x| x.into());
2532 self
2533 }
2534
2535 /// Sets the value of [common_object_request_params][crate::model::GetObjectRequest::common_object_request_params].
2536 ///
2537 /// # Example
2538 /// ```ignore,no_run
2539 /// # use google_cloud_storage::model::GetObjectRequest;
2540 /// use google_cloud_storage::model::CommonObjectRequestParams;
2541 /// let x = GetObjectRequest::new().set_common_object_request_params(CommonObjectRequestParams::default()/* use setters */);
2542 /// ```
2543 pub fn set_common_object_request_params<T>(mut self, v: T) -> Self
2544 where
2545 T: std::convert::Into<crate::model::CommonObjectRequestParams>,
2546 {
2547 self.common_object_request_params = std::option::Option::Some(v.into());
2548 self
2549 }
2550
2551 /// Sets or clears the value of [common_object_request_params][crate::model::GetObjectRequest::common_object_request_params].
2552 ///
2553 /// # Example
2554 /// ```ignore,no_run
2555 /// # use google_cloud_storage::model::GetObjectRequest;
2556 /// use google_cloud_storage::model::CommonObjectRequestParams;
2557 /// let x = GetObjectRequest::new().set_or_clear_common_object_request_params(Some(CommonObjectRequestParams::default()/* use setters */));
2558 /// let x = GetObjectRequest::new().set_or_clear_common_object_request_params(None::<CommonObjectRequestParams>);
2559 /// ```
2560 pub fn set_or_clear_common_object_request_params<T>(mut self, v: std::option::Option<T>) -> Self
2561 where
2562 T: std::convert::Into<crate::model::CommonObjectRequestParams>,
2563 {
2564 self.common_object_request_params = v.map(|x| x.into());
2565 self
2566 }
2567
2568 /// Sets the value of [read_mask][crate::model::GetObjectRequest::read_mask].
2569 ///
2570 /// # Example
2571 /// ```ignore,no_run
2572 /// # use google_cloud_storage::model::GetObjectRequest;
2573 /// use wkt::FieldMask;
2574 /// let x = GetObjectRequest::new().set_read_mask(FieldMask::default()/* use setters */);
2575 /// ```
2576 pub fn set_read_mask<T>(mut self, v: T) -> Self
2577 where
2578 T: std::convert::Into<wkt::FieldMask>,
2579 {
2580 self.read_mask = std::option::Option::Some(v.into());
2581 self
2582 }
2583
2584 /// Sets or clears the value of [read_mask][crate::model::GetObjectRequest::read_mask].
2585 ///
2586 /// # Example
2587 /// ```ignore,no_run
2588 /// # use google_cloud_storage::model::GetObjectRequest;
2589 /// use wkt::FieldMask;
2590 /// let x = GetObjectRequest::new().set_or_clear_read_mask(Some(FieldMask::default()/* use setters */));
2591 /// let x = GetObjectRequest::new().set_or_clear_read_mask(None::<FieldMask>);
2592 /// ```
2593 pub fn set_or_clear_read_mask<T>(mut self, v: std::option::Option<T>) -> Self
2594 where
2595 T: std::convert::Into<wkt::FieldMask>,
2596 {
2597 self.read_mask = v.map(|x| x.into());
2598 self
2599 }
2600
2601 /// Sets the value of [restore_token][crate::model::GetObjectRequest::restore_token].
2602 ///
2603 /// # Example
2604 /// ```ignore,no_run
2605 /// # use google_cloud_storage::model::GetObjectRequest;
2606 /// let x = GetObjectRequest::new().set_restore_token("example");
2607 /// ```
2608 pub fn set_restore_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2609 self.restore_token = v.into();
2610 self
2611 }
2612}
2613
2614impl wkt::message::Message for GetObjectRequest {
2615 fn typename() -> &'static str {
2616 "type.googleapis.com/google.storage.v2.GetObjectRequest"
2617 }
2618}
2619
2620/// Describes an attempt to insert an object, possibly over multiple requests.
2621#[derive(Clone, Default, PartialEq)]
2622#[non_exhaustive]
2623pub struct WriteObjectSpec {
2624 /// Required. Destination object, including its name and its metadata.
2625 pub resource: std::option::Option<crate::model::Object>,
2626
2627 /// Optional. Apply a predefined set of access controls to this object.
2628 /// Valid values are `authenticatedRead`, `bucketOwnerFullControl`,
2629 /// `bucketOwnerRead`, `private`, `projectPrivate`, or `publicRead`.
2630 pub predefined_acl: std::string::String,
2631
2632 /// Makes the operation conditional on whether the object's current
2633 /// generation matches the given value. Setting to `0` makes the operation
2634 /// succeed only if there are no live versions of the object.
2635 pub if_generation_match: std::option::Option<i64>,
2636
2637 /// Makes the operation conditional on whether the object's live
2638 /// generation does not match the given value. If no live object exists, the
2639 /// precondition fails. Setting to `0` makes the operation succeed only if
2640 /// there is a live version of the object.
2641 pub if_generation_not_match: std::option::Option<i64>,
2642
2643 /// Makes the operation conditional on whether the object's current
2644 /// metageneration matches the given value.
2645 pub if_metageneration_match: std::option::Option<i64>,
2646
2647 /// Makes the operation conditional on whether the object's current
2648 /// metageneration does not match the given value.
2649 pub if_metageneration_not_match: std::option::Option<i64>,
2650
2651 /// The expected final object size being uploaded.
2652 /// If this value is set, closing the stream after writing fewer or more than
2653 /// `object_size` bytes results in an `OUT_OF_RANGE` error.
2654 ///
2655 /// This situation is considered a client error, and if such an error occurs
2656 /// you must start the upload over from scratch, this time sending the correct
2657 /// number of bytes.
2658 pub object_size: std::option::Option<i64>,
2659
2660 /// If `true`, the object is created in appendable mode.
2661 /// This field might only be set when using `BidiWriteObject`.
2662 pub appendable: std::option::Option<bool>,
2663
2664 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2665}
2666
2667impl WriteObjectSpec {
2668 /// Creates a new default instance.
2669 pub fn new() -> Self {
2670 std::default::Default::default()
2671 }
2672
2673 /// Sets the value of [resource][crate::model::WriteObjectSpec::resource].
2674 ///
2675 /// # Example
2676 /// ```ignore,no_run
2677 /// # use google_cloud_storage::model::WriteObjectSpec;
2678 /// use google_cloud_storage::model::Object;
2679 /// let x = WriteObjectSpec::new().set_resource(Object::default()/* use setters */);
2680 /// ```
2681 pub fn set_resource<T>(mut self, v: T) -> Self
2682 where
2683 T: std::convert::Into<crate::model::Object>,
2684 {
2685 self.resource = std::option::Option::Some(v.into());
2686 self
2687 }
2688
2689 /// Sets or clears the value of [resource][crate::model::WriteObjectSpec::resource].
2690 ///
2691 /// # Example
2692 /// ```ignore,no_run
2693 /// # use google_cloud_storage::model::WriteObjectSpec;
2694 /// use google_cloud_storage::model::Object;
2695 /// let x = WriteObjectSpec::new().set_or_clear_resource(Some(Object::default()/* use setters */));
2696 /// let x = WriteObjectSpec::new().set_or_clear_resource(None::<Object>);
2697 /// ```
2698 pub fn set_or_clear_resource<T>(mut self, v: std::option::Option<T>) -> Self
2699 where
2700 T: std::convert::Into<crate::model::Object>,
2701 {
2702 self.resource = v.map(|x| x.into());
2703 self
2704 }
2705
2706 /// Sets the value of [predefined_acl][crate::model::WriteObjectSpec::predefined_acl].
2707 ///
2708 /// # Example
2709 /// ```ignore,no_run
2710 /// # use google_cloud_storage::model::WriteObjectSpec;
2711 /// let x = WriteObjectSpec::new().set_predefined_acl("example");
2712 /// ```
2713 pub fn set_predefined_acl<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2714 self.predefined_acl = v.into();
2715 self
2716 }
2717
2718 /// Sets the value of [if_generation_match][crate::model::WriteObjectSpec::if_generation_match].
2719 ///
2720 /// # Example
2721 /// ```ignore,no_run
2722 /// # use google_cloud_storage::model::WriteObjectSpec;
2723 /// let x = WriteObjectSpec::new().set_if_generation_match(42);
2724 /// ```
2725 pub fn set_if_generation_match<T>(mut self, v: T) -> Self
2726 where
2727 T: std::convert::Into<i64>,
2728 {
2729 self.if_generation_match = std::option::Option::Some(v.into());
2730 self
2731 }
2732
2733 /// Sets or clears the value of [if_generation_match][crate::model::WriteObjectSpec::if_generation_match].
2734 ///
2735 /// # Example
2736 /// ```ignore,no_run
2737 /// # use google_cloud_storage::model::WriteObjectSpec;
2738 /// let x = WriteObjectSpec::new().set_or_clear_if_generation_match(Some(42));
2739 /// let x = WriteObjectSpec::new().set_or_clear_if_generation_match(None::<i32>);
2740 /// ```
2741 pub fn set_or_clear_if_generation_match<T>(mut self, v: std::option::Option<T>) -> Self
2742 where
2743 T: std::convert::Into<i64>,
2744 {
2745 self.if_generation_match = v.map(|x| x.into());
2746 self
2747 }
2748
2749 /// Sets the value of [if_generation_not_match][crate::model::WriteObjectSpec::if_generation_not_match].
2750 ///
2751 /// # Example
2752 /// ```ignore,no_run
2753 /// # use google_cloud_storage::model::WriteObjectSpec;
2754 /// let x = WriteObjectSpec::new().set_if_generation_not_match(42);
2755 /// ```
2756 pub fn set_if_generation_not_match<T>(mut self, v: T) -> Self
2757 where
2758 T: std::convert::Into<i64>,
2759 {
2760 self.if_generation_not_match = std::option::Option::Some(v.into());
2761 self
2762 }
2763
2764 /// Sets or clears the value of [if_generation_not_match][crate::model::WriteObjectSpec::if_generation_not_match].
2765 ///
2766 /// # Example
2767 /// ```ignore,no_run
2768 /// # use google_cloud_storage::model::WriteObjectSpec;
2769 /// let x = WriteObjectSpec::new().set_or_clear_if_generation_not_match(Some(42));
2770 /// let x = WriteObjectSpec::new().set_or_clear_if_generation_not_match(None::<i32>);
2771 /// ```
2772 pub fn set_or_clear_if_generation_not_match<T>(mut self, v: std::option::Option<T>) -> Self
2773 where
2774 T: std::convert::Into<i64>,
2775 {
2776 self.if_generation_not_match = v.map(|x| x.into());
2777 self
2778 }
2779
2780 /// Sets the value of [if_metageneration_match][crate::model::WriteObjectSpec::if_metageneration_match].
2781 ///
2782 /// # Example
2783 /// ```ignore,no_run
2784 /// # use google_cloud_storage::model::WriteObjectSpec;
2785 /// let x = WriteObjectSpec::new().set_if_metageneration_match(42);
2786 /// ```
2787 pub fn set_if_metageneration_match<T>(mut self, v: T) -> Self
2788 where
2789 T: std::convert::Into<i64>,
2790 {
2791 self.if_metageneration_match = std::option::Option::Some(v.into());
2792 self
2793 }
2794
2795 /// Sets or clears the value of [if_metageneration_match][crate::model::WriteObjectSpec::if_metageneration_match].
2796 ///
2797 /// # Example
2798 /// ```ignore,no_run
2799 /// # use google_cloud_storage::model::WriteObjectSpec;
2800 /// let x = WriteObjectSpec::new().set_or_clear_if_metageneration_match(Some(42));
2801 /// let x = WriteObjectSpec::new().set_or_clear_if_metageneration_match(None::<i32>);
2802 /// ```
2803 pub fn set_or_clear_if_metageneration_match<T>(mut self, v: std::option::Option<T>) -> Self
2804 where
2805 T: std::convert::Into<i64>,
2806 {
2807 self.if_metageneration_match = v.map(|x| x.into());
2808 self
2809 }
2810
2811 /// Sets the value of [if_metageneration_not_match][crate::model::WriteObjectSpec::if_metageneration_not_match].
2812 ///
2813 /// # Example
2814 /// ```ignore,no_run
2815 /// # use google_cloud_storage::model::WriteObjectSpec;
2816 /// let x = WriteObjectSpec::new().set_if_metageneration_not_match(42);
2817 /// ```
2818 pub fn set_if_metageneration_not_match<T>(mut self, v: T) -> Self
2819 where
2820 T: std::convert::Into<i64>,
2821 {
2822 self.if_metageneration_not_match = std::option::Option::Some(v.into());
2823 self
2824 }
2825
2826 /// Sets or clears the value of [if_metageneration_not_match][crate::model::WriteObjectSpec::if_metageneration_not_match].
2827 ///
2828 /// # Example
2829 /// ```ignore,no_run
2830 /// # use google_cloud_storage::model::WriteObjectSpec;
2831 /// let x = WriteObjectSpec::new().set_or_clear_if_metageneration_not_match(Some(42));
2832 /// let x = WriteObjectSpec::new().set_or_clear_if_metageneration_not_match(None::<i32>);
2833 /// ```
2834 pub fn set_or_clear_if_metageneration_not_match<T>(mut self, v: std::option::Option<T>) -> Self
2835 where
2836 T: std::convert::Into<i64>,
2837 {
2838 self.if_metageneration_not_match = v.map(|x| x.into());
2839 self
2840 }
2841
2842 /// Sets the value of [object_size][crate::model::WriteObjectSpec::object_size].
2843 ///
2844 /// # Example
2845 /// ```ignore,no_run
2846 /// # use google_cloud_storage::model::WriteObjectSpec;
2847 /// let x = WriteObjectSpec::new().set_object_size(42);
2848 /// ```
2849 pub fn set_object_size<T>(mut self, v: T) -> Self
2850 where
2851 T: std::convert::Into<i64>,
2852 {
2853 self.object_size = std::option::Option::Some(v.into());
2854 self
2855 }
2856
2857 /// Sets or clears the value of [object_size][crate::model::WriteObjectSpec::object_size].
2858 ///
2859 /// # Example
2860 /// ```ignore,no_run
2861 /// # use google_cloud_storage::model::WriteObjectSpec;
2862 /// let x = WriteObjectSpec::new().set_or_clear_object_size(Some(42));
2863 /// let x = WriteObjectSpec::new().set_or_clear_object_size(None::<i32>);
2864 /// ```
2865 pub fn set_or_clear_object_size<T>(mut self, v: std::option::Option<T>) -> Self
2866 where
2867 T: std::convert::Into<i64>,
2868 {
2869 self.object_size = v.map(|x| x.into());
2870 self
2871 }
2872
2873 /// Sets the value of [appendable][crate::model::WriteObjectSpec::appendable].
2874 ///
2875 /// # Example
2876 /// ```ignore,no_run
2877 /// # use google_cloud_storage::model::WriteObjectSpec;
2878 /// let x = WriteObjectSpec::new().set_appendable(true);
2879 /// ```
2880 pub fn set_appendable<T>(mut self, v: T) -> Self
2881 where
2882 T: std::convert::Into<bool>,
2883 {
2884 self.appendable = std::option::Option::Some(v.into());
2885 self
2886 }
2887
2888 /// Sets or clears the value of [appendable][crate::model::WriteObjectSpec::appendable].
2889 ///
2890 /// # Example
2891 /// ```ignore,no_run
2892 /// # use google_cloud_storage::model::WriteObjectSpec;
2893 /// let x = WriteObjectSpec::new().set_or_clear_appendable(Some(false));
2894 /// let x = WriteObjectSpec::new().set_or_clear_appendable(None::<bool>);
2895 /// ```
2896 pub fn set_or_clear_appendable<T>(mut self, v: std::option::Option<T>) -> Self
2897 where
2898 T: std::convert::Into<bool>,
2899 {
2900 self.appendable = v.map(|x| x.into());
2901 self
2902 }
2903}
2904
2905impl wkt::message::Message for WriteObjectSpec {
2906 fn typename() -> &'static str {
2907 "type.googleapis.com/google.storage.v2.WriteObjectSpec"
2908 }
2909}
2910
2911/// Request message for [ListObjects][google.storage.v2.Storage.ListObjects].
2912///
2913/// [google.storage.v2.Storage.ListObjects]: crate::client::StorageControl::list_objects
2914#[derive(Clone, Default, PartialEq)]
2915#[non_exhaustive]
2916pub struct ListObjectsRequest {
2917 /// Required. Name of the bucket in which to look for objects.
2918 pub parent: std::string::String,
2919
2920 /// Optional. Maximum number of `items` plus `prefixes` to return
2921 /// in a single page of responses. As duplicate `prefixes` are
2922 /// omitted, fewer total results might be returned than requested. The service
2923 /// uses this parameter or 1,000 items, whichever is smaller.
2924 pub page_size: i32,
2925
2926 /// Optional. A previously-returned page token representing part of the larger
2927 /// set of results to view.
2928 pub page_token: std::string::String,
2929
2930 /// Optional. If set, returns results in a directory-like mode. `items`
2931 /// contains only objects whose names, aside from the `prefix`, do not contain
2932 /// `delimiter`. Objects whose names, aside from the `prefix`, contain
2933 /// `delimiter` has their name, truncated after the `delimiter`, returned in
2934 /// `prefixes`. Duplicate `prefixes` are omitted.
2935 pub delimiter: std::string::String,
2936
2937 /// Optional. If true, objects that end in exactly one instance of `delimiter`
2938 /// has their metadata included in `items` in addition to
2939 /// `prefixes`.
2940 pub include_trailing_delimiter: bool,
2941
2942 /// Optional. Filter results to objects whose names begin with this prefix.
2943 pub prefix: std::string::String,
2944
2945 /// Optional. If `true`, lists all versions of an object as distinct results.
2946 pub versions: bool,
2947
2948 /// Mask specifying which fields to read from each result.
2949 /// If no mask is specified, defaults to all fields except `items.acl` and
2950 /// `items.owner`.
2951 /// `*` might be used to mean all fields.
2952 pub read_mask: std::option::Option<wkt::FieldMask>,
2953
2954 /// Optional. Filter results to objects whose names are lexicographically equal
2955 /// to or after `lexicographic_start`. If `lexicographic_end` is also set, the
2956 /// objects listed have names between `lexicographic_start` (inclusive) and
2957 /// `lexicographic_end` (exclusive).
2958 pub lexicographic_start: std::string::String,
2959
2960 /// Optional. Filter results to objects whose names are lexicographically
2961 /// before `lexicographic_end`. If `lexicographic_start` is also set, the
2962 /// objects listed have names between `lexicographic_start` (inclusive) and
2963 /// `lexicographic_end` (exclusive).
2964 pub lexicographic_end: std::string::String,
2965
2966 /// Optional. If true, only list all soft-deleted versions of the object.
2967 /// Soft delete policy is required to set this option.
2968 pub soft_deleted: bool,
2969
2970 /// Optional. If true, includes folders and managed folders (besides objects)
2971 /// in the returned `prefixes`. Requires `delimiter` to be set to '/'.
2972 pub include_folders_as_prefixes: bool,
2973
2974 /// Optional. Filter results to objects and prefixes that match this glob
2975 /// pattern. See [List objects using
2976 /// glob](https://cloud.google.com/storage/docs/json_api/v1/objects/list#list-objects-and-prefixes-using-glob)
2977 /// for the full syntax.
2978 pub match_glob: std::string::String,
2979
2980 /// Optional. An expression used to filter the returned objects by the
2981 /// `context` field. For the full syntax, see [Filter objects by contexts
2982 /// syntax](https://cloud.google.com/storage/docs/listing-objects#filter-by-object-contexts-syntax).
2983 /// If a `delimiter` is set, the returned `prefixes` are exempt from this
2984 /// filter.
2985 pub filter: std::string::String,
2986
2987 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2988}
2989
2990impl ListObjectsRequest {
2991 /// Creates a new default instance.
2992 pub fn new() -> Self {
2993 std::default::Default::default()
2994 }
2995
2996 /// Sets the value of [parent][crate::model::ListObjectsRequest::parent].
2997 ///
2998 /// # Example
2999 /// ```ignore,no_run
3000 /// # use google_cloud_storage::model::ListObjectsRequest;
3001 /// let x = ListObjectsRequest::new().set_parent("example");
3002 /// ```
3003 pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3004 self.parent = v.into();
3005 self
3006 }
3007
3008 /// Sets the value of [page_size][crate::model::ListObjectsRequest::page_size].
3009 ///
3010 /// # Example
3011 /// ```ignore,no_run
3012 /// # use google_cloud_storage::model::ListObjectsRequest;
3013 /// let x = ListObjectsRequest::new().set_page_size(42);
3014 /// ```
3015 pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
3016 self.page_size = v.into();
3017 self
3018 }
3019
3020 /// Sets the value of [page_token][crate::model::ListObjectsRequest::page_token].
3021 ///
3022 /// # Example
3023 /// ```ignore,no_run
3024 /// # use google_cloud_storage::model::ListObjectsRequest;
3025 /// let x = ListObjectsRequest::new().set_page_token("example");
3026 /// ```
3027 pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3028 self.page_token = v.into();
3029 self
3030 }
3031
3032 /// Sets the value of [delimiter][crate::model::ListObjectsRequest::delimiter].
3033 ///
3034 /// # Example
3035 /// ```ignore,no_run
3036 /// # use google_cloud_storage::model::ListObjectsRequest;
3037 /// let x = ListObjectsRequest::new().set_delimiter("example");
3038 /// ```
3039 pub fn set_delimiter<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3040 self.delimiter = v.into();
3041 self
3042 }
3043
3044 /// Sets the value of [include_trailing_delimiter][crate::model::ListObjectsRequest::include_trailing_delimiter].
3045 ///
3046 /// # Example
3047 /// ```ignore,no_run
3048 /// # use google_cloud_storage::model::ListObjectsRequest;
3049 /// let x = ListObjectsRequest::new().set_include_trailing_delimiter(true);
3050 /// ```
3051 pub fn set_include_trailing_delimiter<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
3052 self.include_trailing_delimiter = v.into();
3053 self
3054 }
3055
3056 /// Sets the value of [prefix][crate::model::ListObjectsRequest::prefix].
3057 ///
3058 /// # Example
3059 /// ```ignore,no_run
3060 /// # use google_cloud_storage::model::ListObjectsRequest;
3061 /// let x = ListObjectsRequest::new().set_prefix("example");
3062 /// ```
3063 pub fn set_prefix<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3064 self.prefix = v.into();
3065 self
3066 }
3067
3068 /// Sets the value of [versions][crate::model::ListObjectsRequest::versions].
3069 ///
3070 /// # Example
3071 /// ```ignore,no_run
3072 /// # use google_cloud_storage::model::ListObjectsRequest;
3073 /// let x = ListObjectsRequest::new().set_versions(true);
3074 /// ```
3075 pub fn set_versions<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
3076 self.versions = v.into();
3077 self
3078 }
3079
3080 /// Sets the value of [read_mask][crate::model::ListObjectsRequest::read_mask].
3081 ///
3082 /// # Example
3083 /// ```ignore,no_run
3084 /// # use google_cloud_storage::model::ListObjectsRequest;
3085 /// use wkt::FieldMask;
3086 /// let x = ListObjectsRequest::new().set_read_mask(FieldMask::default()/* use setters */);
3087 /// ```
3088 pub fn set_read_mask<T>(mut self, v: T) -> Self
3089 where
3090 T: std::convert::Into<wkt::FieldMask>,
3091 {
3092 self.read_mask = std::option::Option::Some(v.into());
3093 self
3094 }
3095
3096 /// Sets or clears the value of [read_mask][crate::model::ListObjectsRequest::read_mask].
3097 ///
3098 /// # Example
3099 /// ```ignore,no_run
3100 /// # use google_cloud_storage::model::ListObjectsRequest;
3101 /// use wkt::FieldMask;
3102 /// let x = ListObjectsRequest::new().set_or_clear_read_mask(Some(FieldMask::default()/* use setters */));
3103 /// let x = ListObjectsRequest::new().set_or_clear_read_mask(None::<FieldMask>);
3104 /// ```
3105 pub fn set_or_clear_read_mask<T>(mut self, v: std::option::Option<T>) -> Self
3106 where
3107 T: std::convert::Into<wkt::FieldMask>,
3108 {
3109 self.read_mask = v.map(|x| x.into());
3110 self
3111 }
3112
3113 /// Sets the value of [lexicographic_start][crate::model::ListObjectsRequest::lexicographic_start].
3114 ///
3115 /// # Example
3116 /// ```ignore,no_run
3117 /// # use google_cloud_storage::model::ListObjectsRequest;
3118 /// let x = ListObjectsRequest::new().set_lexicographic_start("example");
3119 /// ```
3120 pub fn set_lexicographic_start<T: std::convert::Into<std::string::String>>(
3121 mut self,
3122 v: T,
3123 ) -> Self {
3124 self.lexicographic_start = v.into();
3125 self
3126 }
3127
3128 /// Sets the value of [lexicographic_end][crate::model::ListObjectsRequest::lexicographic_end].
3129 ///
3130 /// # Example
3131 /// ```ignore,no_run
3132 /// # use google_cloud_storage::model::ListObjectsRequest;
3133 /// let x = ListObjectsRequest::new().set_lexicographic_end("example");
3134 /// ```
3135 pub fn set_lexicographic_end<T: std::convert::Into<std::string::String>>(
3136 mut self,
3137 v: T,
3138 ) -> Self {
3139 self.lexicographic_end = v.into();
3140 self
3141 }
3142
3143 /// Sets the value of [soft_deleted][crate::model::ListObjectsRequest::soft_deleted].
3144 ///
3145 /// # Example
3146 /// ```ignore,no_run
3147 /// # use google_cloud_storage::model::ListObjectsRequest;
3148 /// let x = ListObjectsRequest::new().set_soft_deleted(true);
3149 /// ```
3150 pub fn set_soft_deleted<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
3151 self.soft_deleted = v.into();
3152 self
3153 }
3154
3155 /// Sets the value of [include_folders_as_prefixes][crate::model::ListObjectsRequest::include_folders_as_prefixes].
3156 ///
3157 /// # Example
3158 /// ```ignore,no_run
3159 /// # use google_cloud_storage::model::ListObjectsRequest;
3160 /// let x = ListObjectsRequest::new().set_include_folders_as_prefixes(true);
3161 /// ```
3162 pub fn set_include_folders_as_prefixes<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
3163 self.include_folders_as_prefixes = v.into();
3164 self
3165 }
3166
3167 /// Sets the value of [match_glob][crate::model::ListObjectsRequest::match_glob].
3168 ///
3169 /// # Example
3170 /// ```ignore,no_run
3171 /// # use google_cloud_storage::model::ListObjectsRequest;
3172 /// let x = ListObjectsRequest::new().set_match_glob("example");
3173 /// ```
3174 pub fn set_match_glob<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3175 self.match_glob = v.into();
3176 self
3177 }
3178
3179 /// Sets the value of [filter][crate::model::ListObjectsRequest::filter].
3180 ///
3181 /// # Example
3182 /// ```ignore,no_run
3183 /// # use google_cloud_storage::model::ListObjectsRequest;
3184 /// let x = ListObjectsRequest::new().set_filter("example");
3185 /// ```
3186 pub fn set_filter<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3187 self.filter = v.into();
3188 self
3189 }
3190}
3191
3192impl wkt::message::Message for ListObjectsRequest {
3193 fn typename() -> &'static str {
3194 "type.googleapis.com/google.storage.v2.ListObjectsRequest"
3195 }
3196}
3197
3198/// Request message for [RewriteObject][google.storage.v2.Storage.RewriteObject].
3199/// If the source object is encrypted using a Customer-Supplied Encryption Key
3200/// the key information must be provided in the
3201/// `copy_source_encryption_algorithm`, `copy_source_encryption_key_bytes`, and
3202/// `copy_source_encryption_key_sha256_bytes` fields. If the destination object
3203/// should be encrypted the keying information should be provided in the
3204/// `encryption_algorithm`, `encryption_key_bytes`, and
3205/// `encryption_key_sha256_bytes` fields of the
3206/// `common_object_request_params.customer_encryption` field.
3207///
3208/// [google.storage.v2.Storage.RewriteObject]: crate::client::StorageControl::rewrite_object
3209#[derive(Clone, Default, PartialEq)]
3210#[non_exhaustive]
3211pub struct RewriteObjectRequest {
3212 /// Required. Immutable. The name of the destination object.
3213 /// See the
3214 /// [Naming Guidelines](https://cloud.google.com/storage/docs/objects#naming).
3215 /// Example: `test.txt`
3216 /// The `name` field by itself does not uniquely identify a Cloud Storage
3217 /// object. A Cloud Storage object is uniquely identified by the tuple of
3218 /// (bucket, object, generation).
3219 pub destination_name: std::string::String,
3220
3221 /// Required. Immutable. The name of the bucket containing the destination
3222 /// object.
3223 pub destination_bucket: std::string::String,
3224
3225 /// Optional. The name of the Cloud KMS key that is used to encrypt the
3226 /// destination object. The Cloud KMS key must be located in same location as
3227 /// the object. If the parameter is not specified, the request uses the
3228 /// destination bucket's default encryption key, if any, or else the
3229 /// Google-managed encryption key.
3230 pub destination_kms_key: std::string::String,
3231
3232 /// Optional. Properties of the destination, post-rewrite object.
3233 /// The `name`, `bucket` and `kms_key` fields must not be populated (these
3234 /// values are specified in the `destination_name`, `destination_bucket`, and
3235 /// `destination_kms_key` fields).
3236 /// If `destination` is present it is used to construct the destination
3237 /// object's metadata; otherwise the destination object's metadata is
3238 /// copied from the source object.
3239 pub destination: std::option::Option<crate::model::Object>,
3240
3241 /// Required. Name of the bucket in which to find the source object.
3242 pub source_bucket: std::string::String,
3243
3244 /// Required. Name of the source object.
3245 pub source_object: std::string::String,
3246
3247 /// Optional. If present, selects a specific revision of the source object (as
3248 /// opposed to the latest version, the default).
3249 pub source_generation: i64,
3250
3251 /// Optional. Include this field (from the previous rewrite response) on each
3252 /// rewrite request after the first one, until the rewrite response 'done' flag
3253 /// is true. Calls that provide a rewriteToken can omit all other request
3254 /// fields, but if included those fields must match the values provided in the
3255 /// first rewrite request.
3256 pub rewrite_token: std::string::String,
3257
3258 /// Optional. Apply a predefined set of access controls to the destination
3259 /// object. Valid values are `authenticatedRead`, `bucketOwnerFullControl`,
3260 /// `bucketOwnerRead`, `private`, `projectPrivate`, or `publicRead`.
3261 pub destination_predefined_acl: std::string::String,
3262
3263 /// Makes the operation conditional on whether the object's current generation
3264 /// matches the given value. Setting to 0 makes the operation succeed only if
3265 /// there are no live versions of the object.
3266 pub if_generation_match: std::option::Option<i64>,
3267
3268 /// Makes the operation conditional on whether the object's live generation
3269 /// does not match the given value. If no live object exists, the precondition
3270 /// fails. Setting to 0 makes the operation succeed only if there is a live
3271 /// version of the object.
3272 pub if_generation_not_match: std::option::Option<i64>,
3273
3274 /// Makes the operation conditional on whether the destination object's current
3275 /// metageneration matches the given value.
3276 pub if_metageneration_match: std::option::Option<i64>,
3277
3278 /// Makes the operation conditional on whether the destination object's current
3279 /// metageneration does not match the given value.
3280 pub if_metageneration_not_match: std::option::Option<i64>,
3281
3282 /// Makes the operation conditional on whether the source object's live
3283 /// generation matches the given value.
3284 pub if_source_generation_match: std::option::Option<i64>,
3285
3286 /// Makes the operation conditional on whether the source object's live
3287 /// generation does not match the given value.
3288 pub if_source_generation_not_match: std::option::Option<i64>,
3289
3290 /// Makes the operation conditional on whether the source object's current
3291 /// metageneration matches the given value.
3292 pub if_source_metageneration_match: std::option::Option<i64>,
3293
3294 /// Makes the operation conditional on whether the source object's current
3295 /// metageneration does not match the given value.
3296 pub if_source_metageneration_not_match: std::option::Option<i64>,
3297
3298 /// Optional. The maximum number of bytes that are rewritten per rewrite
3299 /// request. Most callers shouldn't need to specify this parameter - it is
3300 /// primarily in place to support testing. If specified the value must be an
3301 /// integral multiple of 1 MiB (1048576). Also, this only applies to requests
3302 /// where the source and destination span locations and/or storage classes.
3303 /// Finally, this value must not change across rewrite calls else you'll get an
3304 /// error that the `rewriteToken` is invalid.
3305 pub max_bytes_rewritten_per_call: i64,
3306
3307 /// Optional. The algorithm used to encrypt the source object, if any. Used if
3308 /// the source object was encrypted with a Customer-Supplied Encryption Key.
3309 pub copy_source_encryption_algorithm: std::string::String,
3310
3311 /// Optional. The raw bytes (not base64-encoded) AES-256 encryption key used to
3312 /// encrypt the source object, if it was encrypted with a Customer-Supplied
3313 /// Encryption Key.
3314 pub copy_source_encryption_key_bytes: ::bytes::Bytes,
3315
3316 /// Optional. The raw bytes (not base64-encoded) SHA256 hash of the encryption
3317 /// key used to encrypt the source object, if it was encrypted with a
3318 /// Customer-Supplied Encryption Key.
3319 pub copy_source_encryption_key_sha256_bytes: ::bytes::Bytes,
3320
3321 /// Optional. A set of parameters common to Storage API requests concerning an
3322 /// object.
3323 pub common_object_request_params: std::option::Option<crate::model::CommonObjectRequestParams>,
3324
3325 /// Optional. The checksums of the complete object. This is used to validate
3326 /// the destination object after rewriting.
3327 pub object_checksums: std::option::Option<crate::model::ObjectChecksums>,
3328
3329 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3330}
3331
3332impl RewriteObjectRequest {
3333 /// Creates a new default instance.
3334 pub fn new() -> Self {
3335 std::default::Default::default()
3336 }
3337
3338 /// Sets the value of [destination_name][crate::model::RewriteObjectRequest::destination_name].
3339 ///
3340 /// # Example
3341 /// ```ignore,no_run
3342 /// # use google_cloud_storage::model::RewriteObjectRequest;
3343 /// let x = RewriteObjectRequest::new().set_destination_name("example");
3344 /// ```
3345 pub fn set_destination_name<T: std::convert::Into<std::string::String>>(
3346 mut self,
3347 v: T,
3348 ) -> Self {
3349 self.destination_name = v.into();
3350 self
3351 }
3352
3353 /// Sets the value of [destination_bucket][crate::model::RewriteObjectRequest::destination_bucket].
3354 ///
3355 /// # Example
3356 /// ```ignore,no_run
3357 /// # use google_cloud_storage::model::RewriteObjectRequest;
3358 /// let x = RewriteObjectRequest::new().set_destination_bucket("example");
3359 /// ```
3360 pub fn set_destination_bucket<T: std::convert::Into<std::string::String>>(
3361 mut self,
3362 v: T,
3363 ) -> Self {
3364 self.destination_bucket = v.into();
3365 self
3366 }
3367
3368 /// Sets the value of [destination_kms_key][crate::model::RewriteObjectRequest::destination_kms_key].
3369 ///
3370 /// # Example
3371 /// ```ignore,no_run
3372 /// # use google_cloud_storage::model::RewriteObjectRequest;
3373 /// let x = RewriteObjectRequest::new().set_destination_kms_key("example");
3374 /// ```
3375 pub fn set_destination_kms_key<T: std::convert::Into<std::string::String>>(
3376 mut self,
3377 v: T,
3378 ) -> Self {
3379 self.destination_kms_key = v.into();
3380 self
3381 }
3382
3383 /// Sets the value of [destination][crate::model::RewriteObjectRequest::destination].
3384 ///
3385 /// # Example
3386 /// ```ignore,no_run
3387 /// # use google_cloud_storage::model::RewriteObjectRequest;
3388 /// use google_cloud_storage::model::Object;
3389 /// let x = RewriteObjectRequest::new().set_destination(Object::default()/* use setters */);
3390 /// ```
3391 pub fn set_destination<T>(mut self, v: T) -> Self
3392 where
3393 T: std::convert::Into<crate::model::Object>,
3394 {
3395 self.destination = std::option::Option::Some(v.into());
3396 self
3397 }
3398
3399 /// Sets or clears the value of [destination][crate::model::RewriteObjectRequest::destination].
3400 ///
3401 /// # Example
3402 /// ```ignore,no_run
3403 /// # use google_cloud_storage::model::RewriteObjectRequest;
3404 /// use google_cloud_storage::model::Object;
3405 /// let x = RewriteObjectRequest::new().set_or_clear_destination(Some(Object::default()/* use setters */));
3406 /// let x = RewriteObjectRequest::new().set_or_clear_destination(None::<Object>);
3407 /// ```
3408 pub fn set_or_clear_destination<T>(mut self, v: std::option::Option<T>) -> Self
3409 where
3410 T: std::convert::Into<crate::model::Object>,
3411 {
3412 self.destination = v.map(|x| x.into());
3413 self
3414 }
3415
3416 /// Sets the value of [source_bucket][crate::model::RewriteObjectRequest::source_bucket].
3417 ///
3418 /// # Example
3419 /// ```ignore,no_run
3420 /// # use google_cloud_storage::model::RewriteObjectRequest;
3421 /// let x = RewriteObjectRequest::new().set_source_bucket("example");
3422 /// ```
3423 pub fn set_source_bucket<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3424 self.source_bucket = v.into();
3425 self
3426 }
3427
3428 /// Sets the value of [source_object][crate::model::RewriteObjectRequest::source_object].
3429 ///
3430 /// # Example
3431 /// ```ignore,no_run
3432 /// # use google_cloud_storage::model::RewriteObjectRequest;
3433 /// let x = RewriteObjectRequest::new().set_source_object("example");
3434 /// ```
3435 pub fn set_source_object<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3436 self.source_object = v.into();
3437 self
3438 }
3439
3440 /// Sets the value of [source_generation][crate::model::RewriteObjectRequest::source_generation].
3441 ///
3442 /// # Example
3443 /// ```ignore,no_run
3444 /// # use google_cloud_storage::model::RewriteObjectRequest;
3445 /// let x = RewriteObjectRequest::new().set_source_generation(42);
3446 /// ```
3447 pub fn set_source_generation<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
3448 self.source_generation = v.into();
3449 self
3450 }
3451
3452 /// Sets the value of [rewrite_token][crate::model::RewriteObjectRequest::rewrite_token].
3453 ///
3454 /// # Example
3455 /// ```ignore,no_run
3456 /// # use google_cloud_storage::model::RewriteObjectRequest;
3457 /// let x = RewriteObjectRequest::new().set_rewrite_token("example");
3458 /// ```
3459 pub fn set_rewrite_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3460 self.rewrite_token = v.into();
3461 self
3462 }
3463
3464 /// Sets the value of [destination_predefined_acl][crate::model::RewriteObjectRequest::destination_predefined_acl].
3465 ///
3466 /// # Example
3467 /// ```ignore,no_run
3468 /// # use google_cloud_storage::model::RewriteObjectRequest;
3469 /// let x = RewriteObjectRequest::new().set_destination_predefined_acl("example");
3470 /// ```
3471 pub fn set_destination_predefined_acl<T: std::convert::Into<std::string::String>>(
3472 mut self,
3473 v: T,
3474 ) -> Self {
3475 self.destination_predefined_acl = v.into();
3476 self
3477 }
3478
3479 /// Sets the value of [if_generation_match][crate::model::RewriteObjectRequest::if_generation_match].
3480 ///
3481 /// # Example
3482 /// ```ignore,no_run
3483 /// # use google_cloud_storage::model::RewriteObjectRequest;
3484 /// let x = RewriteObjectRequest::new().set_if_generation_match(42);
3485 /// ```
3486 pub fn set_if_generation_match<T>(mut self, v: T) -> Self
3487 where
3488 T: std::convert::Into<i64>,
3489 {
3490 self.if_generation_match = std::option::Option::Some(v.into());
3491 self
3492 }
3493
3494 /// Sets or clears the value of [if_generation_match][crate::model::RewriteObjectRequest::if_generation_match].
3495 ///
3496 /// # Example
3497 /// ```ignore,no_run
3498 /// # use google_cloud_storage::model::RewriteObjectRequest;
3499 /// let x = RewriteObjectRequest::new().set_or_clear_if_generation_match(Some(42));
3500 /// let x = RewriteObjectRequest::new().set_or_clear_if_generation_match(None::<i32>);
3501 /// ```
3502 pub fn set_or_clear_if_generation_match<T>(mut self, v: std::option::Option<T>) -> Self
3503 where
3504 T: std::convert::Into<i64>,
3505 {
3506 self.if_generation_match = v.map(|x| x.into());
3507 self
3508 }
3509
3510 /// Sets the value of [if_generation_not_match][crate::model::RewriteObjectRequest::if_generation_not_match].
3511 ///
3512 /// # Example
3513 /// ```ignore,no_run
3514 /// # use google_cloud_storage::model::RewriteObjectRequest;
3515 /// let x = RewriteObjectRequest::new().set_if_generation_not_match(42);
3516 /// ```
3517 pub fn set_if_generation_not_match<T>(mut self, v: T) -> Self
3518 where
3519 T: std::convert::Into<i64>,
3520 {
3521 self.if_generation_not_match = std::option::Option::Some(v.into());
3522 self
3523 }
3524
3525 /// Sets or clears the value of [if_generation_not_match][crate::model::RewriteObjectRequest::if_generation_not_match].
3526 ///
3527 /// # Example
3528 /// ```ignore,no_run
3529 /// # use google_cloud_storage::model::RewriteObjectRequest;
3530 /// let x = RewriteObjectRequest::new().set_or_clear_if_generation_not_match(Some(42));
3531 /// let x = RewriteObjectRequest::new().set_or_clear_if_generation_not_match(None::<i32>);
3532 /// ```
3533 pub fn set_or_clear_if_generation_not_match<T>(mut self, v: std::option::Option<T>) -> Self
3534 where
3535 T: std::convert::Into<i64>,
3536 {
3537 self.if_generation_not_match = v.map(|x| x.into());
3538 self
3539 }
3540
3541 /// Sets the value of [if_metageneration_match][crate::model::RewriteObjectRequest::if_metageneration_match].
3542 ///
3543 /// # Example
3544 /// ```ignore,no_run
3545 /// # use google_cloud_storage::model::RewriteObjectRequest;
3546 /// let x = RewriteObjectRequest::new().set_if_metageneration_match(42);
3547 /// ```
3548 pub fn set_if_metageneration_match<T>(mut self, v: T) -> Self
3549 where
3550 T: std::convert::Into<i64>,
3551 {
3552 self.if_metageneration_match = std::option::Option::Some(v.into());
3553 self
3554 }
3555
3556 /// Sets or clears the value of [if_metageneration_match][crate::model::RewriteObjectRequest::if_metageneration_match].
3557 ///
3558 /// # Example
3559 /// ```ignore,no_run
3560 /// # use google_cloud_storage::model::RewriteObjectRequest;
3561 /// let x = RewriteObjectRequest::new().set_or_clear_if_metageneration_match(Some(42));
3562 /// let x = RewriteObjectRequest::new().set_or_clear_if_metageneration_match(None::<i32>);
3563 /// ```
3564 pub fn set_or_clear_if_metageneration_match<T>(mut self, v: std::option::Option<T>) -> Self
3565 where
3566 T: std::convert::Into<i64>,
3567 {
3568 self.if_metageneration_match = v.map(|x| x.into());
3569 self
3570 }
3571
3572 /// Sets the value of [if_metageneration_not_match][crate::model::RewriteObjectRequest::if_metageneration_not_match].
3573 ///
3574 /// # Example
3575 /// ```ignore,no_run
3576 /// # use google_cloud_storage::model::RewriteObjectRequest;
3577 /// let x = RewriteObjectRequest::new().set_if_metageneration_not_match(42);
3578 /// ```
3579 pub fn set_if_metageneration_not_match<T>(mut self, v: T) -> Self
3580 where
3581 T: std::convert::Into<i64>,
3582 {
3583 self.if_metageneration_not_match = std::option::Option::Some(v.into());
3584 self
3585 }
3586
3587 /// Sets or clears the value of [if_metageneration_not_match][crate::model::RewriteObjectRequest::if_metageneration_not_match].
3588 ///
3589 /// # Example
3590 /// ```ignore,no_run
3591 /// # use google_cloud_storage::model::RewriteObjectRequest;
3592 /// let x = RewriteObjectRequest::new().set_or_clear_if_metageneration_not_match(Some(42));
3593 /// let x = RewriteObjectRequest::new().set_or_clear_if_metageneration_not_match(None::<i32>);
3594 /// ```
3595 pub fn set_or_clear_if_metageneration_not_match<T>(mut self, v: std::option::Option<T>) -> Self
3596 where
3597 T: std::convert::Into<i64>,
3598 {
3599 self.if_metageneration_not_match = v.map(|x| x.into());
3600 self
3601 }
3602
3603 /// Sets the value of [if_source_generation_match][crate::model::RewriteObjectRequest::if_source_generation_match].
3604 ///
3605 /// # Example
3606 /// ```ignore,no_run
3607 /// # use google_cloud_storage::model::RewriteObjectRequest;
3608 /// let x = RewriteObjectRequest::new().set_if_source_generation_match(42);
3609 /// ```
3610 pub fn set_if_source_generation_match<T>(mut self, v: T) -> Self
3611 where
3612 T: std::convert::Into<i64>,
3613 {
3614 self.if_source_generation_match = std::option::Option::Some(v.into());
3615 self
3616 }
3617
3618 /// Sets or clears the value of [if_source_generation_match][crate::model::RewriteObjectRequest::if_source_generation_match].
3619 ///
3620 /// # Example
3621 /// ```ignore,no_run
3622 /// # use google_cloud_storage::model::RewriteObjectRequest;
3623 /// let x = RewriteObjectRequest::new().set_or_clear_if_source_generation_match(Some(42));
3624 /// let x = RewriteObjectRequest::new().set_or_clear_if_source_generation_match(None::<i32>);
3625 /// ```
3626 pub fn set_or_clear_if_source_generation_match<T>(mut self, v: std::option::Option<T>) -> Self
3627 where
3628 T: std::convert::Into<i64>,
3629 {
3630 self.if_source_generation_match = v.map(|x| x.into());
3631 self
3632 }
3633
3634 /// Sets the value of [if_source_generation_not_match][crate::model::RewriteObjectRequest::if_source_generation_not_match].
3635 ///
3636 /// # Example
3637 /// ```ignore,no_run
3638 /// # use google_cloud_storage::model::RewriteObjectRequest;
3639 /// let x = RewriteObjectRequest::new().set_if_source_generation_not_match(42);
3640 /// ```
3641 pub fn set_if_source_generation_not_match<T>(mut self, v: T) -> Self
3642 where
3643 T: std::convert::Into<i64>,
3644 {
3645 self.if_source_generation_not_match = std::option::Option::Some(v.into());
3646 self
3647 }
3648
3649 /// Sets or clears the value of [if_source_generation_not_match][crate::model::RewriteObjectRequest::if_source_generation_not_match].
3650 ///
3651 /// # Example
3652 /// ```ignore,no_run
3653 /// # use google_cloud_storage::model::RewriteObjectRequest;
3654 /// let x = RewriteObjectRequest::new().set_or_clear_if_source_generation_not_match(Some(42));
3655 /// let x = RewriteObjectRequest::new().set_or_clear_if_source_generation_not_match(None::<i32>);
3656 /// ```
3657 pub fn set_or_clear_if_source_generation_not_match<T>(
3658 mut self,
3659 v: std::option::Option<T>,
3660 ) -> Self
3661 where
3662 T: std::convert::Into<i64>,
3663 {
3664 self.if_source_generation_not_match = v.map(|x| x.into());
3665 self
3666 }
3667
3668 /// Sets the value of [if_source_metageneration_match][crate::model::RewriteObjectRequest::if_source_metageneration_match].
3669 ///
3670 /// # Example
3671 /// ```ignore,no_run
3672 /// # use google_cloud_storage::model::RewriteObjectRequest;
3673 /// let x = RewriteObjectRequest::new().set_if_source_metageneration_match(42);
3674 /// ```
3675 pub fn set_if_source_metageneration_match<T>(mut self, v: T) -> Self
3676 where
3677 T: std::convert::Into<i64>,
3678 {
3679 self.if_source_metageneration_match = std::option::Option::Some(v.into());
3680 self
3681 }
3682
3683 /// Sets or clears the value of [if_source_metageneration_match][crate::model::RewriteObjectRequest::if_source_metageneration_match].
3684 ///
3685 /// # Example
3686 /// ```ignore,no_run
3687 /// # use google_cloud_storage::model::RewriteObjectRequest;
3688 /// let x = RewriteObjectRequest::new().set_or_clear_if_source_metageneration_match(Some(42));
3689 /// let x = RewriteObjectRequest::new().set_or_clear_if_source_metageneration_match(None::<i32>);
3690 /// ```
3691 pub fn set_or_clear_if_source_metageneration_match<T>(
3692 mut self,
3693 v: std::option::Option<T>,
3694 ) -> Self
3695 where
3696 T: std::convert::Into<i64>,
3697 {
3698 self.if_source_metageneration_match = v.map(|x| x.into());
3699 self
3700 }
3701
3702 /// Sets the value of [if_source_metageneration_not_match][crate::model::RewriteObjectRequest::if_source_metageneration_not_match].
3703 ///
3704 /// # Example
3705 /// ```ignore,no_run
3706 /// # use google_cloud_storage::model::RewriteObjectRequest;
3707 /// let x = RewriteObjectRequest::new().set_if_source_metageneration_not_match(42);
3708 /// ```
3709 pub fn set_if_source_metageneration_not_match<T>(mut self, v: T) -> Self
3710 where
3711 T: std::convert::Into<i64>,
3712 {
3713 self.if_source_metageneration_not_match = std::option::Option::Some(v.into());
3714 self
3715 }
3716
3717 /// Sets or clears the value of [if_source_metageneration_not_match][crate::model::RewriteObjectRequest::if_source_metageneration_not_match].
3718 ///
3719 /// # Example
3720 /// ```ignore,no_run
3721 /// # use google_cloud_storage::model::RewriteObjectRequest;
3722 /// let x = RewriteObjectRequest::new().set_or_clear_if_source_metageneration_not_match(Some(42));
3723 /// let x = RewriteObjectRequest::new().set_or_clear_if_source_metageneration_not_match(None::<i32>);
3724 /// ```
3725 pub fn set_or_clear_if_source_metageneration_not_match<T>(
3726 mut self,
3727 v: std::option::Option<T>,
3728 ) -> Self
3729 where
3730 T: std::convert::Into<i64>,
3731 {
3732 self.if_source_metageneration_not_match = v.map(|x| x.into());
3733 self
3734 }
3735
3736 /// Sets the value of [max_bytes_rewritten_per_call][crate::model::RewriteObjectRequest::max_bytes_rewritten_per_call].
3737 ///
3738 /// # Example
3739 /// ```ignore,no_run
3740 /// # use google_cloud_storage::model::RewriteObjectRequest;
3741 /// let x = RewriteObjectRequest::new().set_max_bytes_rewritten_per_call(42);
3742 /// ```
3743 pub fn set_max_bytes_rewritten_per_call<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
3744 self.max_bytes_rewritten_per_call = v.into();
3745 self
3746 }
3747
3748 /// Sets the value of [copy_source_encryption_algorithm][crate::model::RewriteObjectRequest::copy_source_encryption_algorithm].
3749 ///
3750 /// # Example
3751 /// ```ignore,no_run
3752 /// # use google_cloud_storage::model::RewriteObjectRequest;
3753 /// let x = RewriteObjectRequest::new().set_copy_source_encryption_algorithm("example");
3754 /// ```
3755 pub fn set_copy_source_encryption_algorithm<T: std::convert::Into<std::string::String>>(
3756 mut self,
3757 v: T,
3758 ) -> Self {
3759 self.copy_source_encryption_algorithm = v.into();
3760 self
3761 }
3762
3763 /// Sets the value of [copy_source_encryption_key_bytes][crate::model::RewriteObjectRequest::copy_source_encryption_key_bytes].
3764 ///
3765 /// # Example
3766 /// ```ignore,no_run
3767 /// # use google_cloud_storage::model::RewriteObjectRequest;
3768 /// let x = RewriteObjectRequest::new().set_copy_source_encryption_key_bytes(bytes::Bytes::from_static(b"example"));
3769 /// ```
3770 pub fn set_copy_source_encryption_key_bytes<T: std::convert::Into<::bytes::Bytes>>(
3771 mut self,
3772 v: T,
3773 ) -> Self {
3774 self.copy_source_encryption_key_bytes = v.into();
3775 self
3776 }
3777
3778 /// Sets the value of [copy_source_encryption_key_sha256_bytes][crate::model::RewriteObjectRequest::copy_source_encryption_key_sha256_bytes].
3779 ///
3780 /// # Example
3781 /// ```ignore,no_run
3782 /// # use google_cloud_storage::model::RewriteObjectRequest;
3783 /// let x = RewriteObjectRequest::new().set_copy_source_encryption_key_sha256_bytes(bytes::Bytes::from_static(b"example"));
3784 /// ```
3785 pub fn set_copy_source_encryption_key_sha256_bytes<T: std::convert::Into<::bytes::Bytes>>(
3786 mut self,
3787 v: T,
3788 ) -> Self {
3789 self.copy_source_encryption_key_sha256_bytes = v.into();
3790 self
3791 }
3792
3793 /// Sets the value of [common_object_request_params][crate::model::RewriteObjectRequest::common_object_request_params].
3794 ///
3795 /// # Example
3796 /// ```ignore,no_run
3797 /// # use google_cloud_storage::model::RewriteObjectRequest;
3798 /// use google_cloud_storage::model::CommonObjectRequestParams;
3799 /// let x = RewriteObjectRequest::new().set_common_object_request_params(CommonObjectRequestParams::default()/* use setters */);
3800 /// ```
3801 pub fn set_common_object_request_params<T>(mut self, v: T) -> Self
3802 where
3803 T: std::convert::Into<crate::model::CommonObjectRequestParams>,
3804 {
3805 self.common_object_request_params = std::option::Option::Some(v.into());
3806 self
3807 }
3808
3809 /// Sets or clears the value of [common_object_request_params][crate::model::RewriteObjectRequest::common_object_request_params].
3810 ///
3811 /// # Example
3812 /// ```ignore,no_run
3813 /// # use google_cloud_storage::model::RewriteObjectRequest;
3814 /// use google_cloud_storage::model::CommonObjectRequestParams;
3815 /// let x = RewriteObjectRequest::new().set_or_clear_common_object_request_params(Some(CommonObjectRequestParams::default()/* use setters */));
3816 /// let x = RewriteObjectRequest::new().set_or_clear_common_object_request_params(None::<CommonObjectRequestParams>);
3817 /// ```
3818 pub fn set_or_clear_common_object_request_params<T>(mut self, v: std::option::Option<T>) -> Self
3819 where
3820 T: std::convert::Into<crate::model::CommonObjectRequestParams>,
3821 {
3822 self.common_object_request_params = v.map(|x| x.into());
3823 self
3824 }
3825
3826 /// Sets the value of [object_checksums][crate::model::RewriteObjectRequest::object_checksums].
3827 ///
3828 /// # Example
3829 /// ```ignore,no_run
3830 /// # use google_cloud_storage::model::RewriteObjectRequest;
3831 /// use google_cloud_storage::model::ObjectChecksums;
3832 /// let x = RewriteObjectRequest::new().set_object_checksums(ObjectChecksums::default()/* use setters */);
3833 /// ```
3834 pub fn set_object_checksums<T>(mut self, v: T) -> Self
3835 where
3836 T: std::convert::Into<crate::model::ObjectChecksums>,
3837 {
3838 self.object_checksums = std::option::Option::Some(v.into());
3839 self
3840 }
3841
3842 /// Sets or clears the value of [object_checksums][crate::model::RewriteObjectRequest::object_checksums].
3843 ///
3844 /// # Example
3845 /// ```ignore,no_run
3846 /// # use google_cloud_storage::model::RewriteObjectRequest;
3847 /// use google_cloud_storage::model::ObjectChecksums;
3848 /// let x = RewriteObjectRequest::new().set_or_clear_object_checksums(Some(ObjectChecksums::default()/* use setters */));
3849 /// let x = RewriteObjectRequest::new().set_or_clear_object_checksums(None::<ObjectChecksums>);
3850 /// ```
3851 pub fn set_or_clear_object_checksums<T>(mut self, v: std::option::Option<T>) -> Self
3852 where
3853 T: std::convert::Into<crate::model::ObjectChecksums>,
3854 {
3855 self.object_checksums = v.map(|x| x.into());
3856 self
3857 }
3858}
3859
3860impl wkt::message::Message for RewriteObjectRequest {
3861 fn typename() -> &'static str {
3862 "type.googleapis.com/google.storage.v2.RewriteObjectRequest"
3863 }
3864}
3865
3866/// A rewrite response.
3867#[derive(Clone, Default, PartialEq)]
3868#[non_exhaustive]
3869pub struct RewriteResponse {
3870 /// The total bytes written so far, which can be used to provide a waiting user
3871 /// with a progress indicator. This property is always present in the response.
3872 pub total_bytes_rewritten: i64,
3873
3874 /// The total size of the object being copied in bytes. This property is always
3875 /// present in the response.
3876 pub object_size: i64,
3877
3878 /// `true` if the copy is finished; otherwise, `false` if
3879 /// the copy is in progress. This property is always present in the response.
3880 pub done: bool,
3881
3882 /// A token to use in subsequent requests to continue copying data. This token
3883 /// is present in the response only when there is more data to copy.
3884 pub rewrite_token: std::string::String,
3885
3886 /// A resource containing the metadata for the copied-to object. This property
3887 /// is present in the response only when copying completes.
3888 pub resource: std::option::Option<crate::model::Object>,
3889
3890 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3891}
3892
3893impl RewriteResponse {
3894 /// Creates a new default instance.
3895 pub fn new() -> Self {
3896 std::default::Default::default()
3897 }
3898
3899 /// Sets the value of [total_bytes_rewritten][crate::model::RewriteResponse::total_bytes_rewritten].
3900 ///
3901 /// # Example
3902 /// ```ignore,no_run
3903 /// # use google_cloud_storage::model::RewriteResponse;
3904 /// let x = RewriteResponse::new().set_total_bytes_rewritten(42);
3905 /// ```
3906 pub fn set_total_bytes_rewritten<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
3907 self.total_bytes_rewritten = v.into();
3908 self
3909 }
3910
3911 /// Sets the value of [object_size][crate::model::RewriteResponse::object_size].
3912 ///
3913 /// # Example
3914 /// ```ignore,no_run
3915 /// # use google_cloud_storage::model::RewriteResponse;
3916 /// let x = RewriteResponse::new().set_object_size(42);
3917 /// ```
3918 pub fn set_object_size<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
3919 self.object_size = v.into();
3920 self
3921 }
3922
3923 /// Sets the value of [done][crate::model::RewriteResponse::done].
3924 ///
3925 /// # Example
3926 /// ```ignore,no_run
3927 /// # use google_cloud_storage::model::RewriteResponse;
3928 /// let x = RewriteResponse::new().set_done(true);
3929 /// ```
3930 pub fn set_done<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
3931 self.done = v.into();
3932 self
3933 }
3934
3935 /// Sets the value of [rewrite_token][crate::model::RewriteResponse::rewrite_token].
3936 ///
3937 /// # Example
3938 /// ```ignore,no_run
3939 /// # use google_cloud_storage::model::RewriteResponse;
3940 /// let x = RewriteResponse::new().set_rewrite_token("example");
3941 /// ```
3942 pub fn set_rewrite_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3943 self.rewrite_token = v.into();
3944 self
3945 }
3946
3947 /// Sets the value of [resource][crate::model::RewriteResponse::resource].
3948 ///
3949 /// # Example
3950 /// ```ignore,no_run
3951 /// # use google_cloud_storage::model::RewriteResponse;
3952 /// use google_cloud_storage::model::Object;
3953 /// let x = RewriteResponse::new().set_resource(Object::default()/* use setters */);
3954 /// ```
3955 pub fn set_resource<T>(mut self, v: T) -> Self
3956 where
3957 T: std::convert::Into<crate::model::Object>,
3958 {
3959 self.resource = std::option::Option::Some(v.into());
3960 self
3961 }
3962
3963 /// Sets or clears the value of [resource][crate::model::RewriteResponse::resource].
3964 ///
3965 /// # Example
3966 /// ```ignore,no_run
3967 /// # use google_cloud_storage::model::RewriteResponse;
3968 /// use google_cloud_storage::model::Object;
3969 /// let x = RewriteResponse::new().set_or_clear_resource(Some(Object::default()/* use setters */));
3970 /// let x = RewriteResponse::new().set_or_clear_resource(None::<Object>);
3971 /// ```
3972 pub fn set_or_clear_resource<T>(mut self, v: std::option::Option<T>) -> Self
3973 where
3974 T: std::convert::Into<crate::model::Object>,
3975 {
3976 self.resource = v.map(|x| x.into());
3977 self
3978 }
3979}
3980
3981impl wkt::message::Message for RewriteResponse {
3982 fn typename() -> &'static str {
3983 "type.googleapis.com/google.storage.v2.RewriteResponse"
3984 }
3985}
3986
3987/// Request message for [MoveObject][google.storage.v2.Storage.MoveObject].
3988///
3989/// [google.storage.v2.Storage.MoveObject]: crate::client::StorageControl::move_object
3990#[derive(Clone, Default, PartialEq)]
3991#[non_exhaustive]
3992pub struct MoveObjectRequest {
3993 /// Required. Name of the bucket in which the object resides.
3994 pub bucket: std::string::String,
3995
3996 /// Required. Name of the source object.
3997 pub source_object: std::string::String,
3998
3999 /// Required. Name of the destination object.
4000 pub destination_object: std::string::String,
4001
4002 /// Optional. Makes the operation conditional on whether the source object's
4003 /// current generation matches the given value. `if_source_generation_match`
4004 /// and `if_source_generation_not_match` conditions are mutually exclusive:
4005 /// it's an error for both of them to be set in the request.
4006 pub if_source_generation_match: std::option::Option<i64>,
4007
4008 /// Optional. Makes the operation conditional on whether the source object's
4009 /// current generation does not match the given value.
4010 /// `if_source_generation_match` and `if_source_generation_not_match`
4011 /// conditions are mutually exclusive: it's an error for both of them to be set
4012 /// in the request.
4013 pub if_source_generation_not_match: std::option::Option<i64>,
4014
4015 /// Optional. Makes the operation conditional on whether the source object's
4016 /// current metageneration matches the given value.
4017 /// `if_source_metageneration_match` and `if_source_metageneration_not_match`
4018 /// conditions are mutually exclusive: it's an error for both of them to be set
4019 /// in the request.
4020 pub if_source_metageneration_match: std::option::Option<i64>,
4021
4022 /// Optional. Makes the operation conditional on whether the source object's
4023 /// current metageneration does not match the given value.
4024 /// `if_source_metageneration_match` and `if_source_metageneration_not_match`
4025 /// conditions are mutually exclusive: it's an error for both of them to be set
4026 /// in the request.
4027 pub if_source_metageneration_not_match: std::option::Option<i64>,
4028
4029 /// Optional. Makes the operation conditional on whether the destination
4030 /// object's current generation matches the given value. Setting to 0 makes the
4031 /// operation succeed only if there are no live versions of the object.
4032 /// `if_generation_match` and `if_generation_not_match` conditions are mutually
4033 /// exclusive: it's an error for both of them to be set in the request.
4034 pub if_generation_match: std::option::Option<i64>,
4035
4036 /// Optional. Makes the operation conditional on whether the destination
4037 /// object's current generation does not match the given value. If no live
4038 /// object exists, the precondition fails. Setting to 0 makes the operation
4039 /// succeed only if there is a live version of the object.
4040 /// `if_generation_match` and `if_generation_not_match` conditions are mutually
4041 /// exclusive: it's an error for both of them to be set in the request.
4042 pub if_generation_not_match: std::option::Option<i64>,
4043
4044 /// Optional. Makes the operation conditional on whether the destination
4045 /// object's current metageneration matches the given value.
4046 /// `if_metageneration_match` and `if_metageneration_not_match` conditions are
4047 /// mutually exclusive: it's an error for both of them to be set in the
4048 /// request.
4049 pub if_metageneration_match: std::option::Option<i64>,
4050
4051 /// Optional. Makes the operation conditional on whether the destination
4052 /// object's current metageneration does not match the given value.
4053 /// `if_metageneration_match` and `if_metageneration_not_match` conditions are
4054 /// mutually exclusive: it's an error for both of them to be set in the
4055 /// request.
4056 pub if_metageneration_not_match: std::option::Option<i64>,
4057
4058 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4059}
4060
4061impl MoveObjectRequest {
4062 /// Creates a new default instance.
4063 pub fn new() -> Self {
4064 std::default::Default::default()
4065 }
4066
4067 /// Sets the value of [bucket][crate::model::MoveObjectRequest::bucket].
4068 ///
4069 /// # Example
4070 /// ```ignore,no_run
4071 /// # use google_cloud_storage::model::MoveObjectRequest;
4072 /// let x = MoveObjectRequest::new().set_bucket("example");
4073 /// ```
4074 pub fn set_bucket<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4075 self.bucket = v.into();
4076 self
4077 }
4078
4079 /// Sets the value of [source_object][crate::model::MoveObjectRequest::source_object].
4080 ///
4081 /// # Example
4082 /// ```ignore,no_run
4083 /// # use google_cloud_storage::model::MoveObjectRequest;
4084 /// let x = MoveObjectRequest::new().set_source_object("example");
4085 /// ```
4086 pub fn set_source_object<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4087 self.source_object = v.into();
4088 self
4089 }
4090
4091 /// Sets the value of [destination_object][crate::model::MoveObjectRequest::destination_object].
4092 ///
4093 /// # Example
4094 /// ```ignore,no_run
4095 /// # use google_cloud_storage::model::MoveObjectRequest;
4096 /// let x = MoveObjectRequest::new().set_destination_object("example");
4097 /// ```
4098 pub fn set_destination_object<T: std::convert::Into<std::string::String>>(
4099 mut self,
4100 v: T,
4101 ) -> Self {
4102 self.destination_object = v.into();
4103 self
4104 }
4105
4106 /// Sets the value of [if_source_generation_match][crate::model::MoveObjectRequest::if_source_generation_match].
4107 ///
4108 /// # Example
4109 /// ```ignore,no_run
4110 /// # use google_cloud_storage::model::MoveObjectRequest;
4111 /// let x = MoveObjectRequest::new().set_if_source_generation_match(42);
4112 /// ```
4113 pub fn set_if_source_generation_match<T>(mut self, v: T) -> Self
4114 where
4115 T: std::convert::Into<i64>,
4116 {
4117 self.if_source_generation_match = std::option::Option::Some(v.into());
4118 self
4119 }
4120
4121 /// Sets or clears the value of [if_source_generation_match][crate::model::MoveObjectRequest::if_source_generation_match].
4122 ///
4123 /// # Example
4124 /// ```ignore,no_run
4125 /// # use google_cloud_storage::model::MoveObjectRequest;
4126 /// let x = MoveObjectRequest::new().set_or_clear_if_source_generation_match(Some(42));
4127 /// let x = MoveObjectRequest::new().set_or_clear_if_source_generation_match(None::<i32>);
4128 /// ```
4129 pub fn set_or_clear_if_source_generation_match<T>(mut self, v: std::option::Option<T>) -> Self
4130 where
4131 T: std::convert::Into<i64>,
4132 {
4133 self.if_source_generation_match = v.map(|x| x.into());
4134 self
4135 }
4136
4137 /// Sets the value of [if_source_generation_not_match][crate::model::MoveObjectRequest::if_source_generation_not_match].
4138 ///
4139 /// # Example
4140 /// ```ignore,no_run
4141 /// # use google_cloud_storage::model::MoveObjectRequest;
4142 /// let x = MoveObjectRequest::new().set_if_source_generation_not_match(42);
4143 /// ```
4144 pub fn set_if_source_generation_not_match<T>(mut self, v: T) -> Self
4145 where
4146 T: std::convert::Into<i64>,
4147 {
4148 self.if_source_generation_not_match = std::option::Option::Some(v.into());
4149 self
4150 }
4151
4152 /// Sets or clears the value of [if_source_generation_not_match][crate::model::MoveObjectRequest::if_source_generation_not_match].
4153 ///
4154 /// # Example
4155 /// ```ignore,no_run
4156 /// # use google_cloud_storage::model::MoveObjectRequest;
4157 /// let x = MoveObjectRequest::new().set_or_clear_if_source_generation_not_match(Some(42));
4158 /// let x = MoveObjectRequest::new().set_or_clear_if_source_generation_not_match(None::<i32>);
4159 /// ```
4160 pub fn set_or_clear_if_source_generation_not_match<T>(
4161 mut self,
4162 v: std::option::Option<T>,
4163 ) -> Self
4164 where
4165 T: std::convert::Into<i64>,
4166 {
4167 self.if_source_generation_not_match = v.map(|x| x.into());
4168 self
4169 }
4170
4171 /// Sets the value of [if_source_metageneration_match][crate::model::MoveObjectRequest::if_source_metageneration_match].
4172 ///
4173 /// # Example
4174 /// ```ignore,no_run
4175 /// # use google_cloud_storage::model::MoveObjectRequest;
4176 /// let x = MoveObjectRequest::new().set_if_source_metageneration_match(42);
4177 /// ```
4178 pub fn set_if_source_metageneration_match<T>(mut self, v: T) -> Self
4179 where
4180 T: std::convert::Into<i64>,
4181 {
4182 self.if_source_metageneration_match = std::option::Option::Some(v.into());
4183 self
4184 }
4185
4186 /// Sets or clears the value of [if_source_metageneration_match][crate::model::MoveObjectRequest::if_source_metageneration_match].
4187 ///
4188 /// # Example
4189 /// ```ignore,no_run
4190 /// # use google_cloud_storage::model::MoveObjectRequest;
4191 /// let x = MoveObjectRequest::new().set_or_clear_if_source_metageneration_match(Some(42));
4192 /// let x = MoveObjectRequest::new().set_or_clear_if_source_metageneration_match(None::<i32>);
4193 /// ```
4194 pub fn set_or_clear_if_source_metageneration_match<T>(
4195 mut self,
4196 v: std::option::Option<T>,
4197 ) -> Self
4198 where
4199 T: std::convert::Into<i64>,
4200 {
4201 self.if_source_metageneration_match = v.map(|x| x.into());
4202 self
4203 }
4204
4205 /// Sets the value of [if_source_metageneration_not_match][crate::model::MoveObjectRequest::if_source_metageneration_not_match].
4206 ///
4207 /// # Example
4208 /// ```ignore,no_run
4209 /// # use google_cloud_storage::model::MoveObjectRequest;
4210 /// let x = MoveObjectRequest::new().set_if_source_metageneration_not_match(42);
4211 /// ```
4212 pub fn set_if_source_metageneration_not_match<T>(mut self, v: T) -> Self
4213 where
4214 T: std::convert::Into<i64>,
4215 {
4216 self.if_source_metageneration_not_match = std::option::Option::Some(v.into());
4217 self
4218 }
4219
4220 /// Sets or clears the value of [if_source_metageneration_not_match][crate::model::MoveObjectRequest::if_source_metageneration_not_match].
4221 ///
4222 /// # Example
4223 /// ```ignore,no_run
4224 /// # use google_cloud_storage::model::MoveObjectRequest;
4225 /// let x = MoveObjectRequest::new().set_or_clear_if_source_metageneration_not_match(Some(42));
4226 /// let x = MoveObjectRequest::new().set_or_clear_if_source_metageneration_not_match(None::<i32>);
4227 /// ```
4228 pub fn set_or_clear_if_source_metageneration_not_match<T>(
4229 mut self,
4230 v: std::option::Option<T>,
4231 ) -> Self
4232 where
4233 T: std::convert::Into<i64>,
4234 {
4235 self.if_source_metageneration_not_match = v.map(|x| x.into());
4236 self
4237 }
4238
4239 /// Sets the value of [if_generation_match][crate::model::MoveObjectRequest::if_generation_match].
4240 ///
4241 /// # Example
4242 /// ```ignore,no_run
4243 /// # use google_cloud_storage::model::MoveObjectRequest;
4244 /// let x = MoveObjectRequest::new().set_if_generation_match(42);
4245 /// ```
4246 pub fn set_if_generation_match<T>(mut self, v: T) -> Self
4247 where
4248 T: std::convert::Into<i64>,
4249 {
4250 self.if_generation_match = std::option::Option::Some(v.into());
4251 self
4252 }
4253
4254 /// Sets or clears the value of [if_generation_match][crate::model::MoveObjectRequest::if_generation_match].
4255 ///
4256 /// # Example
4257 /// ```ignore,no_run
4258 /// # use google_cloud_storage::model::MoveObjectRequest;
4259 /// let x = MoveObjectRequest::new().set_or_clear_if_generation_match(Some(42));
4260 /// let x = MoveObjectRequest::new().set_or_clear_if_generation_match(None::<i32>);
4261 /// ```
4262 pub fn set_or_clear_if_generation_match<T>(mut self, v: std::option::Option<T>) -> Self
4263 where
4264 T: std::convert::Into<i64>,
4265 {
4266 self.if_generation_match = v.map(|x| x.into());
4267 self
4268 }
4269
4270 /// Sets the value of [if_generation_not_match][crate::model::MoveObjectRequest::if_generation_not_match].
4271 ///
4272 /// # Example
4273 /// ```ignore,no_run
4274 /// # use google_cloud_storage::model::MoveObjectRequest;
4275 /// let x = MoveObjectRequest::new().set_if_generation_not_match(42);
4276 /// ```
4277 pub fn set_if_generation_not_match<T>(mut self, v: T) -> Self
4278 where
4279 T: std::convert::Into<i64>,
4280 {
4281 self.if_generation_not_match = std::option::Option::Some(v.into());
4282 self
4283 }
4284
4285 /// Sets or clears the value of [if_generation_not_match][crate::model::MoveObjectRequest::if_generation_not_match].
4286 ///
4287 /// # Example
4288 /// ```ignore,no_run
4289 /// # use google_cloud_storage::model::MoveObjectRequest;
4290 /// let x = MoveObjectRequest::new().set_or_clear_if_generation_not_match(Some(42));
4291 /// let x = MoveObjectRequest::new().set_or_clear_if_generation_not_match(None::<i32>);
4292 /// ```
4293 pub fn set_or_clear_if_generation_not_match<T>(mut self, v: std::option::Option<T>) -> Self
4294 where
4295 T: std::convert::Into<i64>,
4296 {
4297 self.if_generation_not_match = v.map(|x| x.into());
4298 self
4299 }
4300
4301 /// Sets the value of [if_metageneration_match][crate::model::MoveObjectRequest::if_metageneration_match].
4302 ///
4303 /// # Example
4304 /// ```ignore,no_run
4305 /// # use google_cloud_storage::model::MoveObjectRequest;
4306 /// let x = MoveObjectRequest::new().set_if_metageneration_match(42);
4307 /// ```
4308 pub fn set_if_metageneration_match<T>(mut self, v: T) -> Self
4309 where
4310 T: std::convert::Into<i64>,
4311 {
4312 self.if_metageneration_match = std::option::Option::Some(v.into());
4313 self
4314 }
4315
4316 /// Sets or clears the value of [if_metageneration_match][crate::model::MoveObjectRequest::if_metageneration_match].
4317 ///
4318 /// # Example
4319 /// ```ignore,no_run
4320 /// # use google_cloud_storage::model::MoveObjectRequest;
4321 /// let x = MoveObjectRequest::new().set_or_clear_if_metageneration_match(Some(42));
4322 /// let x = MoveObjectRequest::new().set_or_clear_if_metageneration_match(None::<i32>);
4323 /// ```
4324 pub fn set_or_clear_if_metageneration_match<T>(mut self, v: std::option::Option<T>) -> Self
4325 where
4326 T: std::convert::Into<i64>,
4327 {
4328 self.if_metageneration_match = v.map(|x| x.into());
4329 self
4330 }
4331
4332 /// Sets the value of [if_metageneration_not_match][crate::model::MoveObjectRequest::if_metageneration_not_match].
4333 ///
4334 /// # Example
4335 /// ```ignore,no_run
4336 /// # use google_cloud_storage::model::MoveObjectRequest;
4337 /// let x = MoveObjectRequest::new().set_if_metageneration_not_match(42);
4338 /// ```
4339 pub fn set_if_metageneration_not_match<T>(mut self, v: T) -> Self
4340 where
4341 T: std::convert::Into<i64>,
4342 {
4343 self.if_metageneration_not_match = std::option::Option::Some(v.into());
4344 self
4345 }
4346
4347 /// Sets or clears the value of [if_metageneration_not_match][crate::model::MoveObjectRequest::if_metageneration_not_match].
4348 ///
4349 /// # Example
4350 /// ```ignore,no_run
4351 /// # use google_cloud_storage::model::MoveObjectRequest;
4352 /// let x = MoveObjectRequest::new().set_or_clear_if_metageneration_not_match(Some(42));
4353 /// let x = MoveObjectRequest::new().set_or_clear_if_metageneration_not_match(None::<i32>);
4354 /// ```
4355 pub fn set_or_clear_if_metageneration_not_match<T>(mut self, v: std::option::Option<T>) -> Self
4356 where
4357 T: std::convert::Into<i64>,
4358 {
4359 self.if_metageneration_not_match = v.map(|x| x.into());
4360 self
4361 }
4362}
4363
4364impl wkt::message::Message for MoveObjectRequest {
4365 fn typename() -> &'static str {
4366 "type.googleapis.com/google.storage.v2.MoveObjectRequest"
4367 }
4368}
4369
4370/// Request message for [UpdateObject][google.storage.v2.Storage.UpdateObject].
4371///
4372/// [google.storage.v2.Storage.UpdateObject]: crate::client::StorageControl::update_object
4373#[derive(Clone, Default, PartialEq)]
4374#[non_exhaustive]
4375pub struct UpdateObjectRequest {
4376 /// Required. The object to update.
4377 /// The object's bucket and name fields are used to identify the object to
4378 /// update. If present, the object's generation field selects a specific
4379 /// revision of this object whose metadata should be updated. Otherwise,
4380 /// assumes the live version of the object.
4381 pub object: std::option::Option<crate::model::Object>,
4382
4383 /// Makes the operation conditional on whether the object's current generation
4384 /// matches the given value. Setting to 0 makes the operation succeed only if
4385 /// there are no live versions of the object.
4386 pub if_generation_match: std::option::Option<i64>,
4387
4388 /// Makes the operation conditional on whether the object's live generation
4389 /// does not match the given value. If no live object exists, the precondition
4390 /// fails. Setting to 0 makes the operation succeed only if there is a live
4391 /// version of the object.
4392 pub if_generation_not_match: std::option::Option<i64>,
4393
4394 /// Makes the operation conditional on whether the object's current
4395 /// metageneration matches the given value.
4396 pub if_metageneration_match: std::option::Option<i64>,
4397
4398 /// Makes the operation conditional on whether the object's current
4399 /// metageneration does not match the given value.
4400 pub if_metageneration_not_match: std::option::Option<i64>,
4401
4402 /// Optional. Apply a predefined set of access controls to this object.
4403 /// Valid values are "authenticatedRead", "bucketOwnerFullControl",
4404 /// "bucketOwnerRead", "private", "projectPrivate", or "publicRead".
4405 pub predefined_acl: std::string::String,
4406
4407 /// Required. List of fields to be updated.
4408 ///
4409 /// To specify ALL fields, equivalent to the JSON API's "update" function,
4410 /// specify a single field with the value `*`. Note: not recommended. If a new
4411 /// field is introduced at a later time, an older client updating with the `*`
4412 /// might accidentally reset the new field's value.
4413 ///
4414 /// Not specifying any fields is an error.
4415 pub update_mask: std::option::Option<wkt::FieldMask>,
4416
4417 /// Optional. A set of parameters common to Storage API requests concerning an
4418 /// object.
4419 pub common_object_request_params: std::option::Option<crate::model::CommonObjectRequestParams>,
4420
4421 /// Optional. Overrides the unlocked retention config on the object.
4422 pub override_unlocked_retention: bool,
4423
4424 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4425}
4426
4427impl UpdateObjectRequest {
4428 /// Creates a new default instance.
4429 pub fn new() -> Self {
4430 std::default::Default::default()
4431 }
4432
4433 /// Sets the value of [object][crate::model::UpdateObjectRequest::object].
4434 ///
4435 /// # Example
4436 /// ```ignore,no_run
4437 /// # use google_cloud_storage::model::UpdateObjectRequest;
4438 /// use google_cloud_storage::model::Object;
4439 /// let x = UpdateObjectRequest::new().set_object(Object::default()/* use setters */);
4440 /// ```
4441 pub fn set_object<T>(mut self, v: T) -> Self
4442 where
4443 T: std::convert::Into<crate::model::Object>,
4444 {
4445 self.object = std::option::Option::Some(v.into());
4446 self
4447 }
4448
4449 /// Sets or clears the value of [object][crate::model::UpdateObjectRequest::object].
4450 ///
4451 /// # Example
4452 /// ```ignore,no_run
4453 /// # use google_cloud_storage::model::UpdateObjectRequest;
4454 /// use google_cloud_storage::model::Object;
4455 /// let x = UpdateObjectRequest::new().set_or_clear_object(Some(Object::default()/* use setters */));
4456 /// let x = UpdateObjectRequest::new().set_or_clear_object(None::<Object>);
4457 /// ```
4458 pub fn set_or_clear_object<T>(mut self, v: std::option::Option<T>) -> Self
4459 where
4460 T: std::convert::Into<crate::model::Object>,
4461 {
4462 self.object = v.map(|x| x.into());
4463 self
4464 }
4465
4466 /// Sets the value of [if_generation_match][crate::model::UpdateObjectRequest::if_generation_match].
4467 ///
4468 /// # Example
4469 /// ```ignore,no_run
4470 /// # use google_cloud_storage::model::UpdateObjectRequest;
4471 /// let x = UpdateObjectRequest::new().set_if_generation_match(42);
4472 /// ```
4473 pub fn set_if_generation_match<T>(mut self, v: T) -> Self
4474 where
4475 T: std::convert::Into<i64>,
4476 {
4477 self.if_generation_match = std::option::Option::Some(v.into());
4478 self
4479 }
4480
4481 /// Sets or clears the value of [if_generation_match][crate::model::UpdateObjectRequest::if_generation_match].
4482 ///
4483 /// # Example
4484 /// ```ignore,no_run
4485 /// # use google_cloud_storage::model::UpdateObjectRequest;
4486 /// let x = UpdateObjectRequest::new().set_or_clear_if_generation_match(Some(42));
4487 /// let x = UpdateObjectRequest::new().set_or_clear_if_generation_match(None::<i32>);
4488 /// ```
4489 pub fn set_or_clear_if_generation_match<T>(mut self, v: std::option::Option<T>) -> Self
4490 where
4491 T: std::convert::Into<i64>,
4492 {
4493 self.if_generation_match = v.map(|x| x.into());
4494 self
4495 }
4496
4497 /// Sets the value of [if_generation_not_match][crate::model::UpdateObjectRequest::if_generation_not_match].
4498 ///
4499 /// # Example
4500 /// ```ignore,no_run
4501 /// # use google_cloud_storage::model::UpdateObjectRequest;
4502 /// let x = UpdateObjectRequest::new().set_if_generation_not_match(42);
4503 /// ```
4504 pub fn set_if_generation_not_match<T>(mut self, v: T) -> Self
4505 where
4506 T: std::convert::Into<i64>,
4507 {
4508 self.if_generation_not_match = std::option::Option::Some(v.into());
4509 self
4510 }
4511
4512 /// Sets or clears the value of [if_generation_not_match][crate::model::UpdateObjectRequest::if_generation_not_match].
4513 ///
4514 /// # Example
4515 /// ```ignore,no_run
4516 /// # use google_cloud_storage::model::UpdateObjectRequest;
4517 /// let x = UpdateObjectRequest::new().set_or_clear_if_generation_not_match(Some(42));
4518 /// let x = UpdateObjectRequest::new().set_or_clear_if_generation_not_match(None::<i32>);
4519 /// ```
4520 pub fn set_or_clear_if_generation_not_match<T>(mut self, v: std::option::Option<T>) -> Self
4521 where
4522 T: std::convert::Into<i64>,
4523 {
4524 self.if_generation_not_match = v.map(|x| x.into());
4525 self
4526 }
4527
4528 /// Sets the value of [if_metageneration_match][crate::model::UpdateObjectRequest::if_metageneration_match].
4529 ///
4530 /// # Example
4531 /// ```ignore,no_run
4532 /// # use google_cloud_storage::model::UpdateObjectRequest;
4533 /// let x = UpdateObjectRequest::new().set_if_metageneration_match(42);
4534 /// ```
4535 pub fn set_if_metageneration_match<T>(mut self, v: T) -> Self
4536 where
4537 T: std::convert::Into<i64>,
4538 {
4539 self.if_metageneration_match = std::option::Option::Some(v.into());
4540 self
4541 }
4542
4543 /// Sets or clears the value of [if_metageneration_match][crate::model::UpdateObjectRequest::if_metageneration_match].
4544 ///
4545 /// # Example
4546 /// ```ignore,no_run
4547 /// # use google_cloud_storage::model::UpdateObjectRequest;
4548 /// let x = UpdateObjectRequest::new().set_or_clear_if_metageneration_match(Some(42));
4549 /// let x = UpdateObjectRequest::new().set_or_clear_if_metageneration_match(None::<i32>);
4550 /// ```
4551 pub fn set_or_clear_if_metageneration_match<T>(mut self, v: std::option::Option<T>) -> Self
4552 where
4553 T: std::convert::Into<i64>,
4554 {
4555 self.if_metageneration_match = v.map(|x| x.into());
4556 self
4557 }
4558
4559 /// Sets the value of [if_metageneration_not_match][crate::model::UpdateObjectRequest::if_metageneration_not_match].
4560 ///
4561 /// # Example
4562 /// ```ignore,no_run
4563 /// # use google_cloud_storage::model::UpdateObjectRequest;
4564 /// let x = UpdateObjectRequest::new().set_if_metageneration_not_match(42);
4565 /// ```
4566 pub fn set_if_metageneration_not_match<T>(mut self, v: T) -> Self
4567 where
4568 T: std::convert::Into<i64>,
4569 {
4570 self.if_metageneration_not_match = std::option::Option::Some(v.into());
4571 self
4572 }
4573
4574 /// Sets or clears the value of [if_metageneration_not_match][crate::model::UpdateObjectRequest::if_metageneration_not_match].
4575 ///
4576 /// # Example
4577 /// ```ignore,no_run
4578 /// # use google_cloud_storage::model::UpdateObjectRequest;
4579 /// let x = UpdateObjectRequest::new().set_or_clear_if_metageneration_not_match(Some(42));
4580 /// let x = UpdateObjectRequest::new().set_or_clear_if_metageneration_not_match(None::<i32>);
4581 /// ```
4582 pub fn set_or_clear_if_metageneration_not_match<T>(mut self, v: std::option::Option<T>) -> Self
4583 where
4584 T: std::convert::Into<i64>,
4585 {
4586 self.if_metageneration_not_match = v.map(|x| x.into());
4587 self
4588 }
4589
4590 /// Sets the value of [predefined_acl][crate::model::UpdateObjectRequest::predefined_acl].
4591 ///
4592 /// # Example
4593 /// ```ignore,no_run
4594 /// # use google_cloud_storage::model::UpdateObjectRequest;
4595 /// let x = UpdateObjectRequest::new().set_predefined_acl("example");
4596 /// ```
4597 pub fn set_predefined_acl<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4598 self.predefined_acl = v.into();
4599 self
4600 }
4601
4602 /// Sets the value of [update_mask][crate::model::UpdateObjectRequest::update_mask].
4603 ///
4604 /// # Example
4605 /// ```ignore,no_run
4606 /// # use google_cloud_storage::model::UpdateObjectRequest;
4607 /// use wkt::FieldMask;
4608 /// let x = UpdateObjectRequest::new().set_update_mask(FieldMask::default()/* use setters */);
4609 /// ```
4610 pub fn set_update_mask<T>(mut self, v: T) -> Self
4611 where
4612 T: std::convert::Into<wkt::FieldMask>,
4613 {
4614 self.update_mask = std::option::Option::Some(v.into());
4615 self
4616 }
4617
4618 /// Sets or clears the value of [update_mask][crate::model::UpdateObjectRequest::update_mask].
4619 ///
4620 /// # Example
4621 /// ```ignore,no_run
4622 /// # use google_cloud_storage::model::UpdateObjectRequest;
4623 /// use wkt::FieldMask;
4624 /// let x = UpdateObjectRequest::new().set_or_clear_update_mask(Some(FieldMask::default()/* use setters */));
4625 /// let x = UpdateObjectRequest::new().set_or_clear_update_mask(None::<FieldMask>);
4626 /// ```
4627 pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
4628 where
4629 T: std::convert::Into<wkt::FieldMask>,
4630 {
4631 self.update_mask = v.map(|x| x.into());
4632 self
4633 }
4634
4635 /// Sets the value of [common_object_request_params][crate::model::UpdateObjectRequest::common_object_request_params].
4636 ///
4637 /// # Example
4638 /// ```ignore,no_run
4639 /// # use google_cloud_storage::model::UpdateObjectRequest;
4640 /// use google_cloud_storage::model::CommonObjectRequestParams;
4641 /// let x = UpdateObjectRequest::new().set_common_object_request_params(CommonObjectRequestParams::default()/* use setters */);
4642 /// ```
4643 pub fn set_common_object_request_params<T>(mut self, v: T) -> Self
4644 where
4645 T: std::convert::Into<crate::model::CommonObjectRequestParams>,
4646 {
4647 self.common_object_request_params = std::option::Option::Some(v.into());
4648 self
4649 }
4650
4651 /// Sets or clears the value of [common_object_request_params][crate::model::UpdateObjectRequest::common_object_request_params].
4652 ///
4653 /// # Example
4654 /// ```ignore,no_run
4655 /// # use google_cloud_storage::model::UpdateObjectRequest;
4656 /// use google_cloud_storage::model::CommonObjectRequestParams;
4657 /// let x = UpdateObjectRequest::new().set_or_clear_common_object_request_params(Some(CommonObjectRequestParams::default()/* use setters */));
4658 /// let x = UpdateObjectRequest::new().set_or_clear_common_object_request_params(None::<CommonObjectRequestParams>);
4659 /// ```
4660 pub fn set_or_clear_common_object_request_params<T>(mut self, v: std::option::Option<T>) -> Self
4661 where
4662 T: std::convert::Into<crate::model::CommonObjectRequestParams>,
4663 {
4664 self.common_object_request_params = v.map(|x| x.into());
4665 self
4666 }
4667
4668 /// Sets the value of [override_unlocked_retention][crate::model::UpdateObjectRequest::override_unlocked_retention].
4669 ///
4670 /// # Example
4671 /// ```ignore,no_run
4672 /// # use google_cloud_storage::model::UpdateObjectRequest;
4673 /// let x = UpdateObjectRequest::new().set_override_unlocked_retention(true);
4674 /// ```
4675 pub fn set_override_unlocked_retention<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
4676 self.override_unlocked_retention = v.into();
4677 self
4678 }
4679}
4680
4681impl wkt::message::Message for UpdateObjectRequest {
4682 fn typename() -> &'static str {
4683 "type.googleapis.com/google.storage.v2.UpdateObjectRequest"
4684 }
4685}
4686
4687/// Parameters that can be passed to any object request.
4688#[derive(Clone, Default, PartialEq)]
4689#[non_exhaustive]
4690pub struct CommonObjectRequestParams {
4691 /// Optional. Encryption algorithm used with the Customer-Supplied Encryption
4692 /// Keys feature.
4693 pub encryption_algorithm: std::string::String,
4694
4695 /// Optional. Encryption key used with the Customer-Supplied Encryption Keys
4696 /// feature. In raw bytes format (not base64-encoded).
4697 pub encryption_key_bytes: ::bytes::Bytes,
4698
4699 /// Optional. SHA256 hash of encryption key used with the Customer-supplied
4700 /// encryption keys feature.
4701 pub encryption_key_sha256_bytes: ::bytes::Bytes,
4702
4703 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4704}
4705
4706impl CommonObjectRequestParams {
4707 /// Creates a new default instance.
4708 pub fn new() -> Self {
4709 std::default::Default::default()
4710 }
4711
4712 /// Sets the value of [encryption_algorithm][crate::model::CommonObjectRequestParams::encryption_algorithm].
4713 ///
4714 /// # Example
4715 /// ```ignore,no_run
4716 /// # use google_cloud_storage::model::CommonObjectRequestParams;
4717 /// let x = CommonObjectRequestParams::new().set_encryption_algorithm("example");
4718 /// ```
4719 pub fn set_encryption_algorithm<T: std::convert::Into<std::string::String>>(
4720 mut self,
4721 v: T,
4722 ) -> Self {
4723 self.encryption_algorithm = v.into();
4724 self
4725 }
4726
4727 /// Sets the value of [encryption_key_bytes][crate::model::CommonObjectRequestParams::encryption_key_bytes].
4728 ///
4729 /// # Example
4730 /// ```ignore,no_run
4731 /// # use google_cloud_storage::model::CommonObjectRequestParams;
4732 /// let x = CommonObjectRequestParams::new().set_encryption_key_bytes(bytes::Bytes::from_static(b"example"));
4733 /// ```
4734 pub fn set_encryption_key_bytes<T: std::convert::Into<::bytes::Bytes>>(mut self, v: T) -> Self {
4735 self.encryption_key_bytes = v.into();
4736 self
4737 }
4738
4739 /// Sets the value of [encryption_key_sha256_bytes][crate::model::CommonObjectRequestParams::encryption_key_sha256_bytes].
4740 ///
4741 /// # Example
4742 /// ```ignore,no_run
4743 /// # use google_cloud_storage::model::CommonObjectRequestParams;
4744 /// let x = CommonObjectRequestParams::new().set_encryption_key_sha256_bytes(bytes::Bytes::from_static(b"example"));
4745 /// ```
4746 pub fn set_encryption_key_sha256_bytes<T: std::convert::Into<::bytes::Bytes>>(
4747 mut self,
4748 v: T,
4749 ) -> Self {
4750 self.encryption_key_sha256_bytes = v.into();
4751 self
4752 }
4753}
4754
4755impl wkt::message::Message for CommonObjectRequestParams {
4756 fn typename() -> &'static str {
4757 "type.googleapis.com/google.storage.v2.CommonObjectRequestParams"
4758 }
4759}
4760
4761/// A bucket.
4762#[derive(Clone, Default, PartialEq)]
4763#[non_exhaustive]
4764pub struct Bucket {
4765 /// Identifier. The name of the bucket.
4766 /// Format: `projects/{project}/buckets/{bucket}`
4767 pub name: std::string::String,
4768
4769 /// Output only. The user-chosen part of the bucket name. The `{bucket}`
4770 /// portion of the `name` field. For globally unique buckets, this is equal to
4771 /// the `bucket name` of other Cloud Storage APIs. Example: `pub`.
4772 pub bucket_id: std::string::String,
4773
4774 /// The etag of the bucket.
4775 /// If included in the metadata of an `UpdateBucketRequest`, the operation is
4776 /// only performed if the `etag` matches that of the bucket.
4777 pub etag: std::string::String,
4778
4779 /// Immutable. The project which owns this bucket, in the format of
4780 /// `projects/{projectIdentifier}`.
4781 /// `{projectIdentifier}` can be the project ID or project number.
4782 /// Output values are always in the project number format.
4783 pub project: std::string::String,
4784
4785 /// Output only. The metadata generation of this bucket.
4786 pub metageneration: i64,
4787
4788 /// Immutable. The location of the bucket. Object data for objects in the
4789 /// bucket resides in physical storage within this region. Defaults to `US`.
4790 /// Attempting to update this field after the bucket is created results in an
4791 /// error.
4792 pub location: std::string::String,
4793
4794 /// Output only. The location type of the bucket (region, dual-region,
4795 /// multi-region, etc).
4796 pub location_type: std::string::String,
4797
4798 /// Optional. The bucket's default storage class, used whenever no storageClass
4799 /// is specified for a newly-created object. This defines how objects in the
4800 /// bucket are stored and determines the SLA and the cost of storage.
4801 /// If this value is not specified when the bucket is created, it defaults
4802 /// to `STANDARD`. For more information, see [Storage
4803 /// classes](https://developers.google.com/storage/docs/storage-classes).
4804 pub storage_class: std::string::String,
4805
4806 /// Optional. The recovery point objective for cross-region replication of the
4807 /// bucket. Applicable only for dual- and multi-region buckets. `DEFAULT` uses
4808 /// default replication. `ASYNC_TURBO` enables turbo replication, valid for
4809 /// dual-region buckets only. If rpo is not specified when the bucket is
4810 /// created, it defaults to `DEFAULT`. For more information, see [Turbo
4811 /// replication](https://cloud.google.com/storage/docs/availability-durability#turbo-replication).
4812 pub rpo: std::string::String,
4813
4814 /// Optional. Access controls on the bucket.
4815 /// If `iam_config.uniform_bucket_level_access` is enabled on this bucket,
4816 /// requests to set, read, or modify acl is an error.
4817 pub acl: std::vec::Vec<crate::model::BucketAccessControl>,
4818
4819 /// Optional. Default access controls to apply to new objects when no ACL is
4820 /// provided. If `iam_config.uniform_bucket_level_access` is enabled on this
4821 /// bucket, requests to set, read, or modify acl is an error.
4822 pub default_object_acl: std::vec::Vec<crate::model::ObjectAccessControl>,
4823
4824 /// Optional. The bucket's lifecycle configuration. See [Lifecycle
4825 /// Management](https://developers.google.com/storage/docs/lifecycle) for more
4826 /// information.
4827 pub lifecycle: std::option::Option<crate::model::bucket::Lifecycle>,
4828
4829 /// Output only. The creation time of the bucket.
4830 pub create_time: std::option::Option<wkt::Timestamp>,
4831
4832 /// Optional. The bucket's [CORS](https://www.w3.org/TR/cors/)
4833 /// configuration.
4834 pub cors: std::vec::Vec<crate::model::bucket::Cors>,
4835
4836 /// Output only. The modification time of the bucket.
4837 pub update_time: std::option::Option<wkt::Timestamp>,
4838
4839 /// Optional. The default value for event-based hold on newly created objects
4840 /// in this bucket. Event-based hold is a way to retain objects indefinitely
4841 /// until an event occurs, signified by the hold's release. After being
4842 /// released, such objects are subject to bucket-level retention (if any). One
4843 /// sample use case of this flag is for banks to hold loan documents for at
4844 /// least 3 years after loan is paid in full. Here, bucket-level retention is 3
4845 /// years and the event is loan being paid in full. In this example, these
4846 /// objects are held intact for any number of years until the event has
4847 /// occurred (event-based hold on the object is released) and then 3 more years
4848 /// after that. That means retention duration of the objects begins from the
4849 /// moment event-based hold transitioned from true to false. Objects under
4850 /// event-based hold cannot be deleted, overwritten or archived until the hold
4851 /// is removed.
4852 pub default_event_based_hold: bool,
4853
4854 /// Optional. User-provided labels, in key/value pairs.
4855 pub labels: std::collections::HashMap<std::string::String, std::string::String>,
4856
4857 /// Optional. The bucket's website config, controlling how the service behaves
4858 /// when accessing bucket contents as a web site. See the [Static website
4859 /// examples](https://cloud.google.com/storage/docs/static-website) for more
4860 /// information.
4861 pub website: std::option::Option<crate::model::bucket::Website>,
4862
4863 /// Optional. The bucket's versioning configuration.
4864 pub versioning: std::option::Option<crate::model::bucket::Versioning>,
4865
4866 /// Optional. The bucket's logging config, which defines the destination bucket
4867 /// and name prefix (if any) for the current bucket's logs.
4868 pub logging: std::option::Option<crate::model::bucket::Logging>,
4869
4870 /// Output only. The owner of the bucket. This is always the project team's
4871 /// owner group.
4872 pub owner: std::option::Option<crate::model::Owner>,
4873
4874 /// Optional. Encryption config for a bucket.
4875 pub encryption: std::option::Option<crate::model::bucket::Encryption>,
4876
4877 /// Optional. The bucket's billing configuration.
4878 pub billing: std::option::Option<crate::model::bucket::Billing>,
4879
4880 /// Optional. The bucket's retention policy. The retention policy enforces a
4881 /// minimum retention time for all objects contained in the bucket, based on
4882 /// their creation time. Any attempt to overwrite or delete objects younger
4883 /// than the retention period results in a `PERMISSION_DENIED` error. An
4884 /// unlocked retention policy can be modified or removed from the bucket via a
4885 /// storage.buckets.update operation. A locked retention policy cannot be
4886 /// removed or shortened in duration for the lifetime of the bucket.
4887 /// Attempting to remove or decrease period of a locked retention policy
4888 /// results in a `PERMISSION_DENIED` error.
4889 pub retention_policy: std::option::Option<crate::model::bucket::RetentionPolicy>,
4890
4891 /// Optional. The bucket's IAM configuration.
4892 pub iam_config: std::option::Option<crate::model::bucket::IamConfig>,
4893
4894 /// Optional. Reserved for future use.
4895 pub satisfies_pzs: bool,
4896
4897 /// Optional. Configuration that, if present, specifies the data placement for
4898 /// a [configurable
4899 /// dual-region](https://cloud.google.com/storage/docs/locations#location-dr).
4900 pub custom_placement_config: std::option::Option<crate::model::bucket::CustomPlacementConfig>,
4901
4902 /// Optional. The bucket's Autoclass configuration. If there is no
4903 /// configuration, the Autoclass feature is disabled and has no effect on the
4904 /// bucket.
4905 pub autoclass: std::option::Option<crate::model::bucket::Autoclass>,
4906
4907 /// Optional. The bucket's hierarchical namespace configuration. If there is no
4908 /// configuration, the hierarchical namespace feature is disabled and has
4909 /// no effect on the bucket.
4910 pub hierarchical_namespace: std::option::Option<crate::model::bucket::HierarchicalNamespace>,
4911
4912 /// Optional. The bucket's soft delete policy. The soft delete policy prevents
4913 /// soft-deleted objects from being permanently deleted.
4914 pub soft_delete_policy: std::option::Option<crate::model::bucket::SoftDeletePolicy>,
4915
4916 /// Optional. The bucket's object retention configuration. Must be enabled
4917 /// before objects in the bucket might have retention configured.
4918 pub object_retention: std::option::Option<crate::model::bucket::ObjectRetention>,
4919
4920 /// Optional. The bucket's IP filter configuration.
4921 pub ip_filter: std::option::Option<crate::model::bucket::IpFilter>,
4922
4923 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4924}
4925
4926impl Bucket {
4927 /// Creates a new default instance.
4928 pub fn new() -> Self {
4929 std::default::Default::default()
4930 }
4931
4932 /// Sets the value of [name][crate::model::Bucket::name].
4933 ///
4934 /// # Example
4935 /// ```ignore,no_run
4936 /// # use google_cloud_storage::model::Bucket;
4937 /// let x = Bucket::new().set_name("example");
4938 /// ```
4939 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4940 self.name = v.into();
4941 self
4942 }
4943
4944 /// Sets the value of [bucket_id][crate::model::Bucket::bucket_id].
4945 ///
4946 /// # Example
4947 /// ```ignore,no_run
4948 /// # use google_cloud_storage::model::Bucket;
4949 /// let x = Bucket::new().set_bucket_id("example");
4950 /// ```
4951 pub fn set_bucket_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4952 self.bucket_id = v.into();
4953 self
4954 }
4955
4956 /// Sets the value of [etag][crate::model::Bucket::etag].
4957 ///
4958 /// # Example
4959 /// ```ignore,no_run
4960 /// # use google_cloud_storage::model::Bucket;
4961 /// let x = Bucket::new().set_etag("example");
4962 /// ```
4963 pub fn set_etag<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4964 self.etag = v.into();
4965 self
4966 }
4967
4968 /// Sets the value of [project][crate::model::Bucket::project].
4969 ///
4970 /// # Example
4971 /// ```ignore,no_run
4972 /// # use google_cloud_storage::model::Bucket;
4973 /// let x = Bucket::new().set_project("example");
4974 /// ```
4975 pub fn set_project<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4976 self.project = v.into();
4977 self
4978 }
4979
4980 /// Sets the value of [metageneration][crate::model::Bucket::metageneration].
4981 ///
4982 /// # Example
4983 /// ```ignore,no_run
4984 /// # use google_cloud_storage::model::Bucket;
4985 /// let x = Bucket::new().set_metageneration(42);
4986 /// ```
4987 pub fn set_metageneration<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
4988 self.metageneration = v.into();
4989 self
4990 }
4991
4992 /// Sets the value of [location][crate::model::Bucket::location].
4993 ///
4994 /// # Example
4995 /// ```ignore,no_run
4996 /// # use google_cloud_storage::model::Bucket;
4997 /// let x = Bucket::new().set_location("example");
4998 /// ```
4999 pub fn set_location<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5000 self.location = v.into();
5001 self
5002 }
5003
5004 /// Sets the value of [location_type][crate::model::Bucket::location_type].
5005 ///
5006 /// # Example
5007 /// ```ignore,no_run
5008 /// # use google_cloud_storage::model::Bucket;
5009 /// let x = Bucket::new().set_location_type("example");
5010 /// ```
5011 pub fn set_location_type<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5012 self.location_type = v.into();
5013 self
5014 }
5015
5016 /// Sets the value of [storage_class][crate::model::Bucket::storage_class].
5017 ///
5018 /// # Example
5019 /// ```ignore,no_run
5020 /// # use google_cloud_storage::model::Bucket;
5021 /// let x = Bucket::new().set_storage_class("example");
5022 /// ```
5023 pub fn set_storage_class<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5024 self.storage_class = v.into();
5025 self
5026 }
5027
5028 /// Sets the value of [rpo][crate::model::Bucket::rpo].
5029 ///
5030 /// # Example
5031 /// ```ignore,no_run
5032 /// # use google_cloud_storage::model::Bucket;
5033 /// let x = Bucket::new().set_rpo("example");
5034 /// ```
5035 pub fn set_rpo<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5036 self.rpo = v.into();
5037 self
5038 }
5039
5040 /// Sets the value of [acl][crate::model::Bucket::acl].
5041 ///
5042 /// # Example
5043 /// ```ignore,no_run
5044 /// # use google_cloud_storage::model::Bucket;
5045 /// use google_cloud_storage::model::BucketAccessControl;
5046 /// let x = Bucket::new()
5047 /// .set_acl([
5048 /// BucketAccessControl::default()/* use setters */,
5049 /// BucketAccessControl::default()/* use (different) setters */,
5050 /// ]);
5051 /// ```
5052 pub fn set_acl<T, V>(mut self, v: T) -> Self
5053 where
5054 T: std::iter::IntoIterator<Item = V>,
5055 V: std::convert::Into<crate::model::BucketAccessControl>,
5056 {
5057 use std::iter::Iterator;
5058 self.acl = v.into_iter().map(|i| i.into()).collect();
5059 self
5060 }
5061
5062 /// Sets the value of [default_object_acl][crate::model::Bucket::default_object_acl].
5063 ///
5064 /// # Example
5065 /// ```ignore,no_run
5066 /// # use google_cloud_storage::model::Bucket;
5067 /// use google_cloud_storage::model::ObjectAccessControl;
5068 /// let x = Bucket::new()
5069 /// .set_default_object_acl([
5070 /// ObjectAccessControl::default()/* use setters */,
5071 /// ObjectAccessControl::default()/* use (different) setters */,
5072 /// ]);
5073 /// ```
5074 pub fn set_default_object_acl<T, V>(mut self, v: T) -> Self
5075 where
5076 T: std::iter::IntoIterator<Item = V>,
5077 V: std::convert::Into<crate::model::ObjectAccessControl>,
5078 {
5079 use std::iter::Iterator;
5080 self.default_object_acl = v.into_iter().map(|i| i.into()).collect();
5081 self
5082 }
5083
5084 /// Sets the value of [lifecycle][crate::model::Bucket::lifecycle].
5085 ///
5086 /// # Example
5087 /// ```ignore,no_run
5088 /// # use google_cloud_storage::model::Bucket;
5089 /// use google_cloud_storage::model::bucket::Lifecycle;
5090 /// let x = Bucket::new().set_lifecycle(Lifecycle::default()/* use setters */);
5091 /// ```
5092 pub fn set_lifecycle<T>(mut self, v: T) -> Self
5093 where
5094 T: std::convert::Into<crate::model::bucket::Lifecycle>,
5095 {
5096 self.lifecycle = std::option::Option::Some(v.into());
5097 self
5098 }
5099
5100 /// Sets or clears the value of [lifecycle][crate::model::Bucket::lifecycle].
5101 ///
5102 /// # Example
5103 /// ```ignore,no_run
5104 /// # use google_cloud_storage::model::Bucket;
5105 /// use google_cloud_storage::model::bucket::Lifecycle;
5106 /// let x = Bucket::new().set_or_clear_lifecycle(Some(Lifecycle::default()/* use setters */));
5107 /// let x = Bucket::new().set_or_clear_lifecycle(None::<Lifecycle>);
5108 /// ```
5109 pub fn set_or_clear_lifecycle<T>(mut self, v: std::option::Option<T>) -> Self
5110 where
5111 T: std::convert::Into<crate::model::bucket::Lifecycle>,
5112 {
5113 self.lifecycle = v.map(|x| x.into());
5114 self
5115 }
5116
5117 /// Sets the value of [create_time][crate::model::Bucket::create_time].
5118 ///
5119 /// # Example
5120 /// ```ignore,no_run
5121 /// # use google_cloud_storage::model::Bucket;
5122 /// use wkt::Timestamp;
5123 /// let x = Bucket::new().set_create_time(Timestamp::default()/* use setters */);
5124 /// ```
5125 pub fn set_create_time<T>(mut self, v: T) -> Self
5126 where
5127 T: std::convert::Into<wkt::Timestamp>,
5128 {
5129 self.create_time = std::option::Option::Some(v.into());
5130 self
5131 }
5132
5133 /// Sets or clears the value of [create_time][crate::model::Bucket::create_time].
5134 ///
5135 /// # Example
5136 /// ```ignore,no_run
5137 /// # use google_cloud_storage::model::Bucket;
5138 /// use wkt::Timestamp;
5139 /// let x = Bucket::new().set_or_clear_create_time(Some(Timestamp::default()/* use setters */));
5140 /// let x = Bucket::new().set_or_clear_create_time(None::<Timestamp>);
5141 /// ```
5142 pub fn set_or_clear_create_time<T>(mut self, v: std::option::Option<T>) -> Self
5143 where
5144 T: std::convert::Into<wkt::Timestamp>,
5145 {
5146 self.create_time = v.map(|x| x.into());
5147 self
5148 }
5149
5150 /// Sets the value of [cors][crate::model::Bucket::cors].
5151 ///
5152 /// # Example
5153 /// ```ignore,no_run
5154 /// # use google_cloud_storage::model::Bucket;
5155 /// use google_cloud_storage::model::bucket::Cors;
5156 /// let x = Bucket::new()
5157 /// .set_cors([
5158 /// Cors::default()/* use setters */,
5159 /// Cors::default()/* use (different) setters */,
5160 /// ]);
5161 /// ```
5162 pub fn set_cors<T, V>(mut self, v: T) -> Self
5163 where
5164 T: std::iter::IntoIterator<Item = V>,
5165 V: std::convert::Into<crate::model::bucket::Cors>,
5166 {
5167 use std::iter::Iterator;
5168 self.cors = v.into_iter().map(|i| i.into()).collect();
5169 self
5170 }
5171
5172 /// Sets the value of [update_time][crate::model::Bucket::update_time].
5173 ///
5174 /// # Example
5175 /// ```ignore,no_run
5176 /// # use google_cloud_storage::model::Bucket;
5177 /// use wkt::Timestamp;
5178 /// let x = Bucket::new().set_update_time(Timestamp::default()/* use setters */);
5179 /// ```
5180 pub fn set_update_time<T>(mut self, v: T) -> Self
5181 where
5182 T: std::convert::Into<wkt::Timestamp>,
5183 {
5184 self.update_time = std::option::Option::Some(v.into());
5185 self
5186 }
5187
5188 /// Sets or clears the value of [update_time][crate::model::Bucket::update_time].
5189 ///
5190 /// # Example
5191 /// ```ignore,no_run
5192 /// # use google_cloud_storage::model::Bucket;
5193 /// use wkt::Timestamp;
5194 /// let x = Bucket::new().set_or_clear_update_time(Some(Timestamp::default()/* use setters */));
5195 /// let x = Bucket::new().set_or_clear_update_time(None::<Timestamp>);
5196 /// ```
5197 pub fn set_or_clear_update_time<T>(mut self, v: std::option::Option<T>) -> Self
5198 where
5199 T: std::convert::Into<wkt::Timestamp>,
5200 {
5201 self.update_time = v.map(|x| x.into());
5202 self
5203 }
5204
5205 /// Sets the value of [default_event_based_hold][crate::model::Bucket::default_event_based_hold].
5206 ///
5207 /// # Example
5208 /// ```ignore,no_run
5209 /// # use google_cloud_storage::model::Bucket;
5210 /// let x = Bucket::new().set_default_event_based_hold(true);
5211 /// ```
5212 pub fn set_default_event_based_hold<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
5213 self.default_event_based_hold = v.into();
5214 self
5215 }
5216
5217 /// Sets the value of [labels][crate::model::Bucket::labels].
5218 ///
5219 /// # Example
5220 /// ```ignore,no_run
5221 /// # use google_cloud_storage::model::Bucket;
5222 /// let x = Bucket::new().set_labels([
5223 /// ("key0", "abc"),
5224 /// ("key1", "xyz"),
5225 /// ]);
5226 /// ```
5227 pub fn set_labels<T, K, V>(mut self, v: T) -> Self
5228 where
5229 T: std::iter::IntoIterator<Item = (K, V)>,
5230 K: std::convert::Into<std::string::String>,
5231 V: std::convert::Into<std::string::String>,
5232 {
5233 use std::iter::Iterator;
5234 self.labels = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
5235 self
5236 }
5237
5238 /// Sets the value of [website][crate::model::Bucket::website].
5239 ///
5240 /// # Example
5241 /// ```ignore,no_run
5242 /// # use google_cloud_storage::model::Bucket;
5243 /// use google_cloud_storage::model::bucket::Website;
5244 /// let x = Bucket::new().set_website(Website::default()/* use setters */);
5245 /// ```
5246 pub fn set_website<T>(mut self, v: T) -> Self
5247 where
5248 T: std::convert::Into<crate::model::bucket::Website>,
5249 {
5250 self.website = std::option::Option::Some(v.into());
5251 self
5252 }
5253
5254 /// Sets or clears the value of [website][crate::model::Bucket::website].
5255 ///
5256 /// # Example
5257 /// ```ignore,no_run
5258 /// # use google_cloud_storage::model::Bucket;
5259 /// use google_cloud_storage::model::bucket::Website;
5260 /// let x = Bucket::new().set_or_clear_website(Some(Website::default()/* use setters */));
5261 /// let x = Bucket::new().set_or_clear_website(None::<Website>);
5262 /// ```
5263 pub fn set_or_clear_website<T>(mut self, v: std::option::Option<T>) -> Self
5264 where
5265 T: std::convert::Into<crate::model::bucket::Website>,
5266 {
5267 self.website = v.map(|x| x.into());
5268 self
5269 }
5270
5271 /// Sets the value of [versioning][crate::model::Bucket::versioning].
5272 ///
5273 /// # Example
5274 /// ```ignore,no_run
5275 /// # use google_cloud_storage::model::Bucket;
5276 /// use google_cloud_storage::model::bucket::Versioning;
5277 /// let x = Bucket::new().set_versioning(Versioning::default()/* use setters */);
5278 /// ```
5279 pub fn set_versioning<T>(mut self, v: T) -> Self
5280 where
5281 T: std::convert::Into<crate::model::bucket::Versioning>,
5282 {
5283 self.versioning = std::option::Option::Some(v.into());
5284 self
5285 }
5286
5287 /// Sets or clears the value of [versioning][crate::model::Bucket::versioning].
5288 ///
5289 /// # Example
5290 /// ```ignore,no_run
5291 /// # use google_cloud_storage::model::Bucket;
5292 /// use google_cloud_storage::model::bucket::Versioning;
5293 /// let x = Bucket::new().set_or_clear_versioning(Some(Versioning::default()/* use setters */));
5294 /// let x = Bucket::new().set_or_clear_versioning(None::<Versioning>);
5295 /// ```
5296 pub fn set_or_clear_versioning<T>(mut self, v: std::option::Option<T>) -> Self
5297 where
5298 T: std::convert::Into<crate::model::bucket::Versioning>,
5299 {
5300 self.versioning = v.map(|x| x.into());
5301 self
5302 }
5303
5304 /// Sets the value of [logging][crate::model::Bucket::logging].
5305 ///
5306 /// # Example
5307 /// ```ignore,no_run
5308 /// # use google_cloud_storage::model::Bucket;
5309 /// use google_cloud_storage::model::bucket::Logging;
5310 /// let x = Bucket::new().set_logging(Logging::default()/* use setters */);
5311 /// ```
5312 pub fn set_logging<T>(mut self, v: T) -> Self
5313 where
5314 T: std::convert::Into<crate::model::bucket::Logging>,
5315 {
5316 self.logging = std::option::Option::Some(v.into());
5317 self
5318 }
5319
5320 /// Sets or clears the value of [logging][crate::model::Bucket::logging].
5321 ///
5322 /// # Example
5323 /// ```ignore,no_run
5324 /// # use google_cloud_storage::model::Bucket;
5325 /// use google_cloud_storage::model::bucket::Logging;
5326 /// let x = Bucket::new().set_or_clear_logging(Some(Logging::default()/* use setters */));
5327 /// let x = Bucket::new().set_or_clear_logging(None::<Logging>);
5328 /// ```
5329 pub fn set_or_clear_logging<T>(mut self, v: std::option::Option<T>) -> Self
5330 where
5331 T: std::convert::Into<crate::model::bucket::Logging>,
5332 {
5333 self.logging = v.map(|x| x.into());
5334 self
5335 }
5336
5337 /// Sets the value of [owner][crate::model::Bucket::owner].
5338 ///
5339 /// # Example
5340 /// ```ignore,no_run
5341 /// # use google_cloud_storage::model::Bucket;
5342 /// use google_cloud_storage::model::Owner;
5343 /// let x = Bucket::new().set_owner(Owner::default()/* use setters */);
5344 /// ```
5345 pub fn set_owner<T>(mut self, v: T) -> Self
5346 where
5347 T: std::convert::Into<crate::model::Owner>,
5348 {
5349 self.owner = std::option::Option::Some(v.into());
5350 self
5351 }
5352
5353 /// Sets or clears the value of [owner][crate::model::Bucket::owner].
5354 ///
5355 /// # Example
5356 /// ```ignore,no_run
5357 /// # use google_cloud_storage::model::Bucket;
5358 /// use google_cloud_storage::model::Owner;
5359 /// let x = Bucket::new().set_or_clear_owner(Some(Owner::default()/* use setters */));
5360 /// let x = Bucket::new().set_or_clear_owner(None::<Owner>);
5361 /// ```
5362 pub fn set_or_clear_owner<T>(mut self, v: std::option::Option<T>) -> Self
5363 where
5364 T: std::convert::Into<crate::model::Owner>,
5365 {
5366 self.owner = v.map(|x| x.into());
5367 self
5368 }
5369
5370 /// Sets the value of [encryption][crate::model::Bucket::encryption].
5371 ///
5372 /// # Example
5373 /// ```ignore,no_run
5374 /// # use google_cloud_storage::model::Bucket;
5375 /// use google_cloud_storage::model::bucket::Encryption;
5376 /// let x = Bucket::new().set_encryption(Encryption::default()/* use setters */);
5377 /// ```
5378 pub fn set_encryption<T>(mut self, v: T) -> Self
5379 where
5380 T: std::convert::Into<crate::model::bucket::Encryption>,
5381 {
5382 self.encryption = std::option::Option::Some(v.into());
5383 self
5384 }
5385
5386 /// Sets or clears the value of [encryption][crate::model::Bucket::encryption].
5387 ///
5388 /// # Example
5389 /// ```ignore,no_run
5390 /// # use google_cloud_storage::model::Bucket;
5391 /// use google_cloud_storage::model::bucket::Encryption;
5392 /// let x = Bucket::new().set_or_clear_encryption(Some(Encryption::default()/* use setters */));
5393 /// let x = Bucket::new().set_or_clear_encryption(None::<Encryption>);
5394 /// ```
5395 pub fn set_or_clear_encryption<T>(mut self, v: std::option::Option<T>) -> Self
5396 where
5397 T: std::convert::Into<crate::model::bucket::Encryption>,
5398 {
5399 self.encryption = v.map(|x| x.into());
5400 self
5401 }
5402
5403 /// Sets the value of [billing][crate::model::Bucket::billing].
5404 ///
5405 /// # Example
5406 /// ```ignore,no_run
5407 /// # use google_cloud_storage::model::Bucket;
5408 /// use google_cloud_storage::model::bucket::Billing;
5409 /// let x = Bucket::new().set_billing(Billing::default()/* use setters */);
5410 /// ```
5411 pub fn set_billing<T>(mut self, v: T) -> Self
5412 where
5413 T: std::convert::Into<crate::model::bucket::Billing>,
5414 {
5415 self.billing = std::option::Option::Some(v.into());
5416 self
5417 }
5418
5419 /// Sets or clears the value of [billing][crate::model::Bucket::billing].
5420 ///
5421 /// # Example
5422 /// ```ignore,no_run
5423 /// # use google_cloud_storage::model::Bucket;
5424 /// use google_cloud_storage::model::bucket::Billing;
5425 /// let x = Bucket::new().set_or_clear_billing(Some(Billing::default()/* use setters */));
5426 /// let x = Bucket::new().set_or_clear_billing(None::<Billing>);
5427 /// ```
5428 pub fn set_or_clear_billing<T>(mut self, v: std::option::Option<T>) -> Self
5429 where
5430 T: std::convert::Into<crate::model::bucket::Billing>,
5431 {
5432 self.billing = v.map(|x| x.into());
5433 self
5434 }
5435
5436 /// Sets the value of [retention_policy][crate::model::Bucket::retention_policy].
5437 ///
5438 /// # Example
5439 /// ```ignore,no_run
5440 /// # use google_cloud_storage::model::Bucket;
5441 /// use google_cloud_storage::model::bucket::RetentionPolicy;
5442 /// let x = Bucket::new().set_retention_policy(RetentionPolicy::default()/* use setters */);
5443 /// ```
5444 pub fn set_retention_policy<T>(mut self, v: T) -> Self
5445 where
5446 T: std::convert::Into<crate::model::bucket::RetentionPolicy>,
5447 {
5448 self.retention_policy = std::option::Option::Some(v.into());
5449 self
5450 }
5451
5452 /// Sets or clears the value of [retention_policy][crate::model::Bucket::retention_policy].
5453 ///
5454 /// # Example
5455 /// ```ignore,no_run
5456 /// # use google_cloud_storage::model::Bucket;
5457 /// use google_cloud_storage::model::bucket::RetentionPolicy;
5458 /// let x = Bucket::new().set_or_clear_retention_policy(Some(RetentionPolicy::default()/* use setters */));
5459 /// let x = Bucket::new().set_or_clear_retention_policy(None::<RetentionPolicy>);
5460 /// ```
5461 pub fn set_or_clear_retention_policy<T>(mut self, v: std::option::Option<T>) -> Self
5462 where
5463 T: std::convert::Into<crate::model::bucket::RetentionPolicy>,
5464 {
5465 self.retention_policy = v.map(|x| x.into());
5466 self
5467 }
5468
5469 /// Sets the value of [iam_config][crate::model::Bucket::iam_config].
5470 ///
5471 /// # Example
5472 /// ```ignore,no_run
5473 /// # use google_cloud_storage::model::Bucket;
5474 /// use google_cloud_storage::model::bucket::IamConfig;
5475 /// let x = Bucket::new().set_iam_config(IamConfig::default()/* use setters */);
5476 /// ```
5477 pub fn set_iam_config<T>(mut self, v: T) -> Self
5478 where
5479 T: std::convert::Into<crate::model::bucket::IamConfig>,
5480 {
5481 self.iam_config = std::option::Option::Some(v.into());
5482 self
5483 }
5484
5485 /// Sets or clears the value of [iam_config][crate::model::Bucket::iam_config].
5486 ///
5487 /// # Example
5488 /// ```ignore,no_run
5489 /// # use google_cloud_storage::model::Bucket;
5490 /// use google_cloud_storage::model::bucket::IamConfig;
5491 /// let x = Bucket::new().set_or_clear_iam_config(Some(IamConfig::default()/* use setters */));
5492 /// let x = Bucket::new().set_or_clear_iam_config(None::<IamConfig>);
5493 /// ```
5494 pub fn set_or_clear_iam_config<T>(mut self, v: std::option::Option<T>) -> Self
5495 where
5496 T: std::convert::Into<crate::model::bucket::IamConfig>,
5497 {
5498 self.iam_config = v.map(|x| x.into());
5499 self
5500 }
5501
5502 /// Sets the value of [satisfies_pzs][crate::model::Bucket::satisfies_pzs].
5503 ///
5504 /// # Example
5505 /// ```ignore,no_run
5506 /// # use google_cloud_storage::model::Bucket;
5507 /// let x = Bucket::new().set_satisfies_pzs(true);
5508 /// ```
5509 pub fn set_satisfies_pzs<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
5510 self.satisfies_pzs = v.into();
5511 self
5512 }
5513
5514 /// Sets the value of [custom_placement_config][crate::model::Bucket::custom_placement_config].
5515 ///
5516 /// # Example
5517 /// ```ignore,no_run
5518 /// # use google_cloud_storage::model::Bucket;
5519 /// use google_cloud_storage::model::bucket::CustomPlacementConfig;
5520 /// let x = Bucket::new().set_custom_placement_config(CustomPlacementConfig::default()/* use setters */);
5521 /// ```
5522 pub fn set_custom_placement_config<T>(mut self, v: T) -> Self
5523 where
5524 T: std::convert::Into<crate::model::bucket::CustomPlacementConfig>,
5525 {
5526 self.custom_placement_config = std::option::Option::Some(v.into());
5527 self
5528 }
5529
5530 /// Sets or clears the value of [custom_placement_config][crate::model::Bucket::custom_placement_config].
5531 ///
5532 /// # Example
5533 /// ```ignore,no_run
5534 /// # use google_cloud_storage::model::Bucket;
5535 /// use google_cloud_storage::model::bucket::CustomPlacementConfig;
5536 /// let x = Bucket::new().set_or_clear_custom_placement_config(Some(CustomPlacementConfig::default()/* use setters */));
5537 /// let x = Bucket::new().set_or_clear_custom_placement_config(None::<CustomPlacementConfig>);
5538 /// ```
5539 pub fn set_or_clear_custom_placement_config<T>(mut self, v: std::option::Option<T>) -> Self
5540 where
5541 T: std::convert::Into<crate::model::bucket::CustomPlacementConfig>,
5542 {
5543 self.custom_placement_config = v.map(|x| x.into());
5544 self
5545 }
5546
5547 /// Sets the value of [autoclass][crate::model::Bucket::autoclass].
5548 ///
5549 /// # Example
5550 /// ```ignore,no_run
5551 /// # use google_cloud_storage::model::Bucket;
5552 /// use google_cloud_storage::model::bucket::Autoclass;
5553 /// let x = Bucket::new().set_autoclass(Autoclass::default()/* use setters */);
5554 /// ```
5555 pub fn set_autoclass<T>(mut self, v: T) -> Self
5556 where
5557 T: std::convert::Into<crate::model::bucket::Autoclass>,
5558 {
5559 self.autoclass = std::option::Option::Some(v.into());
5560 self
5561 }
5562
5563 /// Sets or clears the value of [autoclass][crate::model::Bucket::autoclass].
5564 ///
5565 /// # Example
5566 /// ```ignore,no_run
5567 /// # use google_cloud_storage::model::Bucket;
5568 /// use google_cloud_storage::model::bucket::Autoclass;
5569 /// let x = Bucket::new().set_or_clear_autoclass(Some(Autoclass::default()/* use setters */));
5570 /// let x = Bucket::new().set_or_clear_autoclass(None::<Autoclass>);
5571 /// ```
5572 pub fn set_or_clear_autoclass<T>(mut self, v: std::option::Option<T>) -> Self
5573 where
5574 T: std::convert::Into<crate::model::bucket::Autoclass>,
5575 {
5576 self.autoclass = v.map(|x| x.into());
5577 self
5578 }
5579
5580 /// Sets the value of [hierarchical_namespace][crate::model::Bucket::hierarchical_namespace].
5581 ///
5582 /// # Example
5583 /// ```ignore,no_run
5584 /// # use google_cloud_storage::model::Bucket;
5585 /// use google_cloud_storage::model::bucket::HierarchicalNamespace;
5586 /// let x = Bucket::new().set_hierarchical_namespace(HierarchicalNamespace::default()/* use setters */);
5587 /// ```
5588 pub fn set_hierarchical_namespace<T>(mut self, v: T) -> Self
5589 where
5590 T: std::convert::Into<crate::model::bucket::HierarchicalNamespace>,
5591 {
5592 self.hierarchical_namespace = std::option::Option::Some(v.into());
5593 self
5594 }
5595
5596 /// Sets or clears the value of [hierarchical_namespace][crate::model::Bucket::hierarchical_namespace].
5597 ///
5598 /// # Example
5599 /// ```ignore,no_run
5600 /// # use google_cloud_storage::model::Bucket;
5601 /// use google_cloud_storage::model::bucket::HierarchicalNamespace;
5602 /// let x = Bucket::new().set_or_clear_hierarchical_namespace(Some(HierarchicalNamespace::default()/* use setters */));
5603 /// let x = Bucket::new().set_or_clear_hierarchical_namespace(None::<HierarchicalNamespace>);
5604 /// ```
5605 pub fn set_or_clear_hierarchical_namespace<T>(mut self, v: std::option::Option<T>) -> Self
5606 where
5607 T: std::convert::Into<crate::model::bucket::HierarchicalNamespace>,
5608 {
5609 self.hierarchical_namespace = v.map(|x| x.into());
5610 self
5611 }
5612
5613 /// Sets the value of [soft_delete_policy][crate::model::Bucket::soft_delete_policy].
5614 ///
5615 /// # Example
5616 /// ```ignore,no_run
5617 /// # use google_cloud_storage::model::Bucket;
5618 /// use google_cloud_storage::model::bucket::SoftDeletePolicy;
5619 /// let x = Bucket::new().set_soft_delete_policy(SoftDeletePolicy::default()/* use setters */);
5620 /// ```
5621 pub fn set_soft_delete_policy<T>(mut self, v: T) -> Self
5622 where
5623 T: std::convert::Into<crate::model::bucket::SoftDeletePolicy>,
5624 {
5625 self.soft_delete_policy = std::option::Option::Some(v.into());
5626 self
5627 }
5628
5629 /// Sets or clears the value of [soft_delete_policy][crate::model::Bucket::soft_delete_policy].
5630 ///
5631 /// # Example
5632 /// ```ignore,no_run
5633 /// # use google_cloud_storage::model::Bucket;
5634 /// use google_cloud_storage::model::bucket::SoftDeletePolicy;
5635 /// let x = Bucket::new().set_or_clear_soft_delete_policy(Some(SoftDeletePolicy::default()/* use setters */));
5636 /// let x = Bucket::new().set_or_clear_soft_delete_policy(None::<SoftDeletePolicy>);
5637 /// ```
5638 pub fn set_or_clear_soft_delete_policy<T>(mut self, v: std::option::Option<T>) -> Self
5639 where
5640 T: std::convert::Into<crate::model::bucket::SoftDeletePolicy>,
5641 {
5642 self.soft_delete_policy = v.map(|x| x.into());
5643 self
5644 }
5645
5646 /// Sets the value of [object_retention][crate::model::Bucket::object_retention].
5647 ///
5648 /// # Example
5649 /// ```ignore,no_run
5650 /// # use google_cloud_storage::model::Bucket;
5651 /// use google_cloud_storage::model::bucket::ObjectRetention;
5652 /// let x = Bucket::new().set_object_retention(ObjectRetention::default()/* use setters */);
5653 /// ```
5654 pub fn set_object_retention<T>(mut self, v: T) -> Self
5655 where
5656 T: std::convert::Into<crate::model::bucket::ObjectRetention>,
5657 {
5658 self.object_retention = std::option::Option::Some(v.into());
5659 self
5660 }
5661
5662 /// Sets or clears the value of [object_retention][crate::model::Bucket::object_retention].
5663 ///
5664 /// # Example
5665 /// ```ignore,no_run
5666 /// # use google_cloud_storage::model::Bucket;
5667 /// use google_cloud_storage::model::bucket::ObjectRetention;
5668 /// let x = Bucket::new().set_or_clear_object_retention(Some(ObjectRetention::default()/* use setters */));
5669 /// let x = Bucket::new().set_or_clear_object_retention(None::<ObjectRetention>);
5670 /// ```
5671 pub fn set_or_clear_object_retention<T>(mut self, v: std::option::Option<T>) -> Self
5672 where
5673 T: std::convert::Into<crate::model::bucket::ObjectRetention>,
5674 {
5675 self.object_retention = v.map(|x| x.into());
5676 self
5677 }
5678
5679 /// Sets the value of [ip_filter][crate::model::Bucket::ip_filter].
5680 ///
5681 /// # Example
5682 /// ```ignore,no_run
5683 /// # use google_cloud_storage::model::Bucket;
5684 /// use google_cloud_storage::model::bucket::IpFilter;
5685 /// let x = Bucket::new().set_ip_filter(IpFilter::default()/* use setters */);
5686 /// ```
5687 pub fn set_ip_filter<T>(mut self, v: T) -> Self
5688 where
5689 T: std::convert::Into<crate::model::bucket::IpFilter>,
5690 {
5691 self.ip_filter = std::option::Option::Some(v.into());
5692 self
5693 }
5694
5695 /// Sets or clears the value of [ip_filter][crate::model::Bucket::ip_filter].
5696 ///
5697 /// # Example
5698 /// ```ignore,no_run
5699 /// # use google_cloud_storage::model::Bucket;
5700 /// use google_cloud_storage::model::bucket::IpFilter;
5701 /// let x = Bucket::new().set_or_clear_ip_filter(Some(IpFilter::default()/* use setters */));
5702 /// let x = Bucket::new().set_or_clear_ip_filter(None::<IpFilter>);
5703 /// ```
5704 pub fn set_or_clear_ip_filter<T>(mut self, v: std::option::Option<T>) -> Self
5705 where
5706 T: std::convert::Into<crate::model::bucket::IpFilter>,
5707 {
5708 self.ip_filter = v.map(|x| x.into());
5709 self
5710 }
5711}
5712
5713impl wkt::message::Message for Bucket {
5714 fn typename() -> &'static str {
5715 "type.googleapis.com/google.storage.v2.Bucket"
5716 }
5717}
5718
5719/// Defines additional types related to [Bucket].
5720pub mod bucket {
5721 #[allow(unused_imports)]
5722 use super::*;
5723
5724 /// Billing properties of a bucket.
5725 #[derive(Clone, Default, PartialEq)]
5726 #[non_exhaustive]
5727 pub struct Billing {
5728 /// Optional. When set to true, Requester Pays is enabled for this bucket.
5729 pub requester_pays: bool,
5730
5731 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5732 }
5733
5734 impl Billing {
5735 /// Creates a new default instance.
5736 pub fn new() -> Self {
5737 std::default::Default::default()
5738 }
5739
5740 /// Sets the value of [requester_pays][crate::model::bucket::Billing::requester_pays].
5741 ///
5742 /// # Example
5743 /// ```ignore,no_run
5744 /// # use google_cloud_storage::model::bucket::Billing;
5745 /// let x = Billing::new().set_requester_pays(true);
5746 /// ```
5747 pub fn set_requester_pays<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
5748 self.requester_pays = v.into();
5749 self
5750 }
5751 }
5752
5753 impl wkt::message::Message for Billing {
5754 fn typename() -> &'static str {
5755 "type.googleapis.com/google.storage.v2.Bucket.Billing"
5756 }
5757 }
5758
5759 /// Cross-Origin Response sharing (CORS) properties for a bucket.
5760 /// For more on Cloud Storage and CORS, see
5761 /// <https://cloud.google.com/storage/docs/cross-origin>.
5762 /// For more on CORS in general, see <https://tools.ietf.org/html/rfc6454>.
5763 #[derive(Clone, Default, PartialEq)]
5764 #[non_exhaustive]
5765 pub struct Cors {
5766 /// Optional. The list of origins eligible to receive CORS response headers.
5767 /// For more information about origins, see [RFC
5768 /// 6454](https://tools.ietf.org/html/rfc6454). Note: `*` is permitted in the
5769 /// list of origins, and means `any origin`.
5770 pub origin: std::vec::Vec<std::string::String>,
5771
5772 /// Optional. The list of HTTP methods on which to include CORS response
5773 /// headers,
5774 /// (`GET`, `OPTIONS`, `POST`, etc) Note: `*` is permitted in the list of
5775 /// methods, and means "any method".
5776 pub method: std::vec::Vec<std::string::String>,
5777
5778 /// Optional. The list of HTTP headers other than the [simple response
5779 /// headers](https://www.w3.org/TR/cors/#simple-response-headers) to give
5780 /// permission for the user-agent to share across domains.
5781 pub response_header: std::vec::Vec<std::string::String>,
5782
5783 /// Optional. The value, in seconds, to return in the [Access-Control-Max-Age
5784 /// header](https://www.w3.org/TR/cors/#access-control-max-age-response-header)
5785 /// used in preflight responses.
5786 pub max_age_seconds: i32,
5787
5788 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5789 }
5790
5791 impl Cors {
5792 /// Creates a new default instance.
5793 pub fn new() -> Self {
5794 std::default::Default::default()
5795 }
5796
5797 /// Sets the value of [origin][crate::model::bucket::Cors::origin].
5798 ///
5799 /// # Example
5800 /// ```ignore,no_run
5801 /// # use google_cloud_storage::model::bucket::Cors;
5802 /// let x = Cors::new().set_origin(["a", "b", "c"]);
5803 /// ```
5804 pub fn set_origin<T, V>(mut self, v: T) -> Self
5805 where
5806 T: std::iter::IntoIterator<Item = V>,
5807 V: std::convert::Into<std::string::String>,
5808 {
5809 use std::iter::Iterator;
5810 self.origin = v.into_iter().map(|i| i.into()).collect();
5811 self
5812 }
5813
5814 /// Sets the value of [method][crate::model::bucket::Cors::method].
5815 ///
5816 /// # Example
5817 /// ```ignore,no_run
5818 /// # use google_cloud_storage::model::bucket::Cors;
5819 /// let x = Cors::new().set_method(["a", "b", "c"]);
5820 /// ```
5821 pub fn set_method<T, V>(mut self, v: T) -> Self
5822 where
5823 T: std::iter::IntoIterator<Item = V>,
5824 V: std::convert::Into<std::string::String>,
5825 {
5826 use std::iter::Iterator;
5827 self.method = v.into_iter().map(|i| i.into()).collect();
5828 self
5829 }
5830
5831 /// Sets the value of [response_header][crate::model::bucket::Cors::response_header].
5832 ///
5833 /// # Example
5834 /// ```ignore,no_run
5835 /// # use google_cloud_storage::model::bucket::Cors;
5836 /// let x = Cors::new().set_response_header(["a", "b", "c"]);
5837 /// ```
5838 pub fn set_response_header<T, V>(mut self, v: T) -> Self
5839 where
5840 T: std::iter::IntoIterator<Item = V>,
5841 V: std::convert::Into<std::string::String>,
5842 {
5843 use std::iter::Iterator;
5844 self.response_header = v.into_iter().map(|i| i.into()).collect();
5845 self
5846 }
5847
5848 /// Sets the value of [max_age_seconds][crate::model::bucket::Cors::max_age_seconds].
5849 ///
5850 /// # Example
5851 /// ```ignore,no_run
5852 /// # use google_cloud_storage::model::bucket::Cors;
5853 /// let x = Cors::new().set_max_age_seconds(42);
5854 /// ```
5855 pub fn set_max_age_seconds<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
5856 self.max_age_seconds = v.into();
5857 self
5858 }
5859 }
5860
5861 impl wkt::message::Message for Cors {
5862 fn typename() -> &'static str {
5863 "type.googleapis.com/google.storage.v2.Bucket.Cors"
5864 }
5865 }
5866
5867 /// Encryption properties of a bucket.
5868 #[derive(Clone, Default, PartialEq)]
5869 #[non_exhaustive]
5870 pub struct Encryption {
5871 /// Optional. The name of the Cloud KMS key that is used to encrypt objects
5872 /// inserted into this bucket, if no encryption method is specified.
5873 pub default_kms_key: std::string::String,
5874
5875 /// Optional. If omitted, then new objects with GMEK encryption-type is
5876 /// allowed. If set, then new objects created in this bucket must comply with
5877 /// enforcement config. Changing this has no effect on existing objects; it
5878 /// applies to new objects only.
5879 pub google_managed_encryption_enforcement_config: std::option::Option<
5880 crate::model::bucket::encryption::GoogleManagedEncryptionEnforcementConfig,
5881 >,
5882
5883 /// Optional. If omitted, then new objects with CMEK encryption-type is
5884 /// allowed. If set, then new objects created in this bucket must comply with
5885 /// enforcement config. Changing this has no effect on existing objects; it
5886 /// applies to new objects only.
5887 pub customer_managed_encryption_enforcement_config: std::option::Option<
5888 crate::model::bucket::encryption::CustomerManagedEncryptionEnforcementConfig,
5889 >,
5890
5891 /// Optional. If omitted, then new objects with CSEK encryption-type is
5892 /// allowed. If set, then new objects created in this bucket must comply with
5893 /// enforcement config. Changing this has no effect on existing objects; it
5894 /// applies to new objects only.
5895 pub customer_supplied_encryption_enforcement_config: std::option::Option<
5896 crate::model::bucket::encryption::CustomerSuppliedEncryptionEnforcementConfig,
5897 >,
5898
5899 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5900 }
5901
5902 impl Encryption {
5903 /// Creates a new default instance.
5904 pub fn new() -> Self {
5905 std::default::Default::default()
5906 }
5907
5908 /// Sets the value of [default_kms_key][crate::model::bucket::Encryption::default_kms_key].
5909 ///
5910 /// # Example
5911 /// ```ignore,no_run
5912 /// # use google_cloud_storage::model::bucket::Encryption;
5913 /// let x = Encryption::new().set_default_kms_key("example");
5914 /// ```
5915 pub fn set_default_kms_key<T: std::convert::Into<std::string::String>>(
5916 mut self,
5917 v: T,
5918 ) -> Self {
5919 self.default_kms_key = v.into();
5920 self
5921 }
5922
5923 /// Sets the value of [google_managed_encryption_enforcement_config][crate::model::bucket::Encryption::google_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::GoogleManagedEncryptionEnforcementConfig;
5929 /// let x = Encryption::new().set_google_managed_encryption_enforcement_config(GoogleManagedEncryptionEnforcementConfig::default()/* use setters */);
5930 /// ```
5931 pub fn set_google_managed_encryption_enforcement_config<T>(mut self, v: T) -> Self
5932 where
5933 T: std::convert::Into<
5934 crate::model::bucket::encryption::GoogleManagedEncryptionEnforcementConfig,
5935 >,
5936 {
5937 self.google_managed_encryption_enforcement_config = std::option::Option::Some(v.into());
5938 self
5939 }
5940
5941 /// Sets or clears the value of [google_managed_encryption_enforcement_config][crate::model::bucket::Encryption::google_managed_encryption_enforcement_config].
5942 ///
5943 /// # Example
5944 /// ```ignore,no_run
5945 /// # use google_cloud_storage::model::bucket::Encryption;
5946 /// use google_cloud_storage::model::bucket::encryption::GoogleManagedEncryptionEnforcementConfig;
5947 /// let x = Encryption::new().set_or_clear_google_managed_encryption_enforcement_config(Some(GoogleManagedEncryptionEnforcementConfig::default()/* use setters */));
5948 /// let x = Encryption::new().set_or_clear_google_managed_encryption_enforcement_config(None::<GoogleManagedEncryptionEnforcementConfig>);
5949 /// ```
5950 pub fn set_or_clear_google_managed_encryption_enforcement_config<T>(
5951 mut self,
5952 v: std::option::Option<T>,
5953 ) -> Self
5954 where
5955 T: std::convert::Into<
5956 crate::model::bucket::encryption::GoogleManagedEncryptionEnforcementConfig,
5957 >,
5958 {
5959 self.google_managed_encryption_enforcement_config = v.map(|x| x.into());
5960 self
5961 }
5962
5963 /// Sets the value of [customer_managed_encryption_enforcement_config][crate::model::bucket::Encryption::customer_managed_encryption_enforcement_config].
5964 ///
5965 /// # Example
5966 /// ```ignore,no_run
5967 /// # use google_cloud_storage::model::bucket::Encryption;
5968 /// use google_cloud_storage::model::bucket::encryption::CustomerManagedEncryptionEnforcementConfig;
5969 /// let x = Encryption::new().set_customer_managed_encryption_enforcement_config(CustomerManagedEncryptionEnforcementConfig::default()/* use setters */);
5970 /// ```
5971 pub fn set_customer_managed_encryption_enforcement_config<T>(mut self, v: T) -> Self
5972 where
5973 T: std::convert::Into<
5974 crate::model::bucket::encryption::CustomerManagedEncryptionEnforcementConfig,
5975 >,
5976 {
5977 self.customer_managed_encryption_enforcement_config =
5978 std::option::Option::Some(v.into());
5979 self
5980 }
5981
5982 /// Sets or clears the value of [customer_managed_encryption_enforcement_config][crate::model::bucket::Encryption::customer_managed_encryption_enforcement_config].
5983 ///
5984 /// # Example
5985 /// ```ignore,no_run
5986 /// # use google_cloud_storage::model::bucket::Encryption;
5987 /// use google_cloud_storage::model::bucket::encryption::CustomerManagedEncryptionEnforcementConfig;
5988 /// let x = Encryption::new().set_or_clear_customer_managed_encryption_enforcement_config(Some(CustomerManagedEncryptionEnforcementConfig::default()/* use setters */));
5989 /// let x = Encryption::new().set_or_clear_customer_managed_encryption_enforcement_config(None::<CustomerManagedEncryptionEnforcementConfig>);
5990 /// ```
5991 pub fn set_or_clear_customer_managed_encryption_enforcement_config<T>(
5992 mut self,
5993 v: std::option::Option<T>,
5994 ) -> Self
5995 where
5996 T: std::convert::Into<
5997 crate::model::bucket::encryption::CustomerManagedEncryptionEnforcementConfig,
5998 >,
5999 {
6000 self.customer_managed_encryption_enforcement_config = v.map(|x| x.into());
6001 self
6002 }
6003
6004 /// Sets the value of [customer_supplied_encryption_enforcement_config][crate::model::bucket::Encryption::customer_supplied_encryption_enforcement_config].
6005 ///
6006 /// # Example
6007 /// ```ignore,no_run
6008 /// # use google_cloud_storage::model::bucket::Encryption;
6009 /// use google_cloud_storage::model::bucket::encryption::CustomerSuppliedEncryptionEnforcementConfig;
6010 /// let x = Encryption::new().set_customer_supplied_encryption_enforcement_config(CustomerSuppliedEncryptionEnforcementConfig::default()/* use setters */);
6011 /// ```
6012 pub fn set_customer_supplied_encryption_enforcement_config<T>(mut self, v: T) -> Self
6013 where
6014 T: std::convert::Into<
6015 crate::model::bucket::encryption::CustomerSuppliedEncryptionEnforcementConfig,
6016 >,
6017 {
6018 self.customer_supplied_encryption_enforcement_config =
6019 std::option::Option::Some(v.into());
6020 self
6021 }
6022
6023 /// Sets or clears the value of [customer_supplied_encryption_enforcement_config][crate::model::bucket::Encryption::customer_supplied_encryption_enforcement_config].
6024 ///
6025 /// # Example
6026 /// ```ignore,no_run
6027 /// # use google_cloud_storage::model::bucket::Encryption;
6028 /// use google_cloud_storage::model::bucket::encryption::CustomerSuppliedEncryptionEnforcementConfig;
6029 /// let x = Encryption::new().set_or_clear_customer_supplied_encryption_enforcement_config(Some(CustomerSuppliedEncryptionEnforcementConfig::default()/* use setters */));
6030 /// let x = Encryption::new().set_or_clear_customer_supplied_encryption_enforcement_config(None::<CustomerSuppliedEncryptionEnforcementConfig>);
6031 /// ```
6032 pub fn set_or_clear_customer_supplied_encryption_enforcement_config<T>(
6033 mut self,
6034 v: std::option::Option<T>,
6035 ) -> Self
6036 where
6037 T: std::convert::Into<
6038 crate::model::bucket::encryption::CustomerSuppliedEncryptionEnforcementConfig,
6039 >,
6040 {
6041 self.customer_supplied_encryption_enforcement_config = v.map(|x| x.into());
6042 self
6043 }
6044 }
6045
6046 impl wkt::message::Message for Encryption {
6047 fn typename() -> &'static str {
6048 "type.googleapis.com/google.storage.v2.Bucket.Encryption"
6049 }
6050 }
6051
6052 /// Defines additional types related to [Encryption].
6053 pub mod encryption {
6054 #[allow(unused_imports)]
6055 use super::*;
6056
6057 /// Google Managed Encryption (GMEK) enforcement config of a bucket.
6058 #[derive(Clone, Default, PartialEq)]
6059 #[non_exhaustive]
6060 pub struct GoogleManagedEncryptionEnforcementConfig {
6061 /// Restriction mode for google-managed encryption for new objects within
6062 /// the bucket. Valid values are: `NotRestricted` and `FullyRestricted`.
6063 /// If `NotRestricted` or unset, creation of new objects with
6064 /// google-managed encryption is allowed.
6065 /// If `FullyRestricted`, new objects can't be created using google-managed
6066 /// encryption.
6067 pub restriction_mode: std::option::Option<std::string::String>,
6068
6069 /// Time from which the config was effective. This is service-provided.
6070 pub effective_time: std::option::Option<wkt::Timestamp>,
6071
6072 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
6073 }
6074
6075 impl GoogleManagedEncryptionEnforcementConfig {
6076 /// Creates a new default instance.
6077 pub fn new() -> Self {
6078 std::default::Default::default()
6079 }
6080
6081 /// Sets the value of [restriction_mode][crate::model::bucket::encryption::GoogleManagedEncryptionEnforcementConfig::restriction_mode].
6082 ///
6083 /// # Example
6084 /// ```ignore,no_run
6085 /// # use google_cloud_storage::model::bucket::encryption::GoogleManagedEncryptionEnforcementConfig;
6086 /// let x = GoogleManagedEncryptionEnforcementConfig::new().set_restriction_mode("example");
6087 /// ```
6088 pub fn set_restriction_mode<T>(mut self, v: T) -> Self
6089 where
6090 T: std::convert::Into<std::string::String>,
6091 {
6092 self.restriction_mode = std::option::Option::Some(v.into());
6093 self
6094 }
6095
6096 /// Sets or clears the value of [restriction_mode][crate::model::bucket::encryption::GoogleManagedEncryptionEnforcementConfig::restriction_mode].
6097 ///
6098 /// # Example
6099 /// ```ignore,no_run
6100 /// # use google_cloud_storage::model::bucket::encryption::GoogleManagedEncryptionEnforcementConfig;
6101 /// let x = GoogleManagedEncryptionEnforcementConfig::new().set_or_clear_restriction_mode(Some("example"));
6102 /// let x = GoogleManagedEncryptionEnforcementConfig::new().set_or_clear_restriction_mode(None::<String>);
6103 /// ```
6104 pub fn set_or_clear_restriction_mode<T>(mut self, v: std::option::Option<T>) -> Self
6105 where
6106 T: std::convert::Into<std::string::String>,
6107 {
6108 self.restriction_mode = v.map(|x| x.into());
6109 self
6110 }
6111
6112 /// Sets the value of [effective_time][crate::model::bucket::encryption::GoogleManagedEncryptionEnforcementConfig::effective_time].
6113 ///
6114 /// # Example
6115 /// ```ignore,no_run
6116 /// # use google_cloud_storage::model::bucket::encryption::GoogleManagedEncryptionEnforcementConfig;
6117 /// use wkt::Timestamp;
6118 /// let x = GoogleManagedEncryptionEnforcementConfig::new().set_effective_time(Timestamp::default()/* use setters */);
6119 /// ```
6120 pub fn set_effective_time<T>(mut self, v: T) -> Self
6121 where
6122 T: std::convert::Into<wkt::Timestamp>,
6123 {
6124 self.effective_time = std::option::Option::Some(v.into());
6125 self
6126 }
6127
6128 /// Sets or clears the value of [effective_time][crate::model::bucket::encryption::GoogleManagedEncryptionEnforcementConfig::effective_time].
6129 ///
6130 /// # Example
6131 /// ```ignore,no_run
6132 /// # use google_cloud_storage::model::bucket::encryption::GoogleManagedEncryptionEnforcementConfig;
6133 /// use wkt::Timestamp;
6134 /// let x = GoogleManagedEncryptionEnforcementConfig::new().set_or_clear_effective_time(Some(Timestamp::default()/* use setters */));
6135 /// let x = GoogleManagedEncryptionEnforcementConfig::new().set_or_clear_effective_time(None::<Timestamp>);
6136 /// ```
6137 pub fn set_or_clear_effective_time<T>(mut self, v: std::option::Option<T>) -> Self
6138 where
6139 T: std::convert::Into<wkt::Timestamp>,
6140 {
6141 self.effective_time = v.map(|x| x.into());
6142 self
6143 }
6144 }
6145
6146 impl wkt::message::Message for GoogleManagedEncryptionEnforcementConfig {
6147 fn typename() -> &'static str {
6148 "type.googleapis.com/google.storage.v2.Bucket.Encryption.GoogleManagedEncryptionEnforcementConfig"
6149 }
6150 }
6151
6152 /// Customer Managed Encryption (CMEK) enforcement config of a bucket.
6153 #[derive(Clone, Default, PartialEq)]
6154 #[non_exhaustive]
6155 pub struct CustomerManagedEncryptionEnforcementConfig {
6156 /// Restriction mode for customer-managed encryption for new objects within
6157 /// the bucket. Valid values are: `NotRestricted` and `FullyRestricted`.
6158 /// If `NotRestricted` or unset, creation of new objects with
6159 /// customer-managed encryption is allowed.
6160 /// If `FullyRestricted`, new objects can't be created using
6161 /// customer-managed encryption.
6162 pub restriction_mode: std::option::Option<std::string::String>,
6163
6164 /// Time from which the config was effective. This is service-provided.
6165 pub effective_time: std::option::Option<wkt::Timestamp>,
6166
6167 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
6168 }
6169
6170 impl CustomerManagedEncryptionEnforcementConfig {
6171 /// Creates a new default instance.
6172 pub fn new() -> Self {
6173 std::default::Default::default()
6174 }
6175
6176 /// Sets the value of [restriction_mode][crate::model::bucket::encryption::CustomerManagedEncryptionEnforcementConfig::restriction_mode].
6177 ///
6178 /// # Example
6179 /// ```ignore,no_run
6180 /// # use google_cloud_storage::model::bucket::encryption::CustomerManagedEncryptionEnforcementConfig;
6181 /// let x = CustomerManagedEncryptionEnforcementConfig::new().set_restriction_mode("example");
6182 /// ```
6183 pub fn set_restriction_mode<T>(mut self, v: T) -> Self
6184 where
6185 T: std::convert::Into<std::string::String>,
6186 {
6187 self.restriction_mode = std::option::Option::Some(v.into());
6188 self
6189 }
6190
6191 /// Sets or clears the value of [restriction_mode][crate::model::bucket::encryption::CustomerManagedEncryptionEnforcementConfig::restriction_mode].
6192 ///
6193 /// # Example
6194 /// ```ignore,no_run
6195 /// # use google_cloud_storage::model::bucket::encryption::CustomerManagedEncryptionEnforcementConfig;
6196 /// let x = CustomerManagedEncryptionEnforcementConfig::new().set_or_clear_restriction_mode(Some("example"));
6197 /// let x = CustomerManagedEncryptionEnforcementConfig::new().set_or_clear_restriction_mode(None::<String>);
6198 /// ```
6199 pub fn set_or_clear_restriction_mode<T>(mut self, v: std::option::Option<T>) -> Self
6200 where
6201 T: std::convert::Into<std::string::String>,
6202 {
6203 self.restriction_mode = v.map(|x| x.into());
6204 self
6205 }
6206
6207 /// Sets the value of [effective_time][crate::model::bucket::encryption::CustomerManagedEncryptionEnforcementConfig::effective_time].
6208 ///
6209 /// # Example
6210 /// ```ignore,no_run
6211 /// # use google_cloud_storage::model::bucket::encryption::CustomerManagedEncryptionEnforcementConfig;
6212 /// use wkt::Timestamp;
6213 /// let x = CustomerManagedEncryptionEnforcementConfig::new().set_effective_time(Timestamp::default()/* use setters */);
6214 /// ```
6215 pub fn set_effective_time<T>(mut self, v: T) -> Self
6216 where
6217 T: std::convert::Into<wkt::Timestamp>,
6218 {
6219 self.effective_time = std::option::Option::Some(v.into());
6220 self
6221 }
6222
6223 /// Sets or clears the value of [effective_time][crate::model::bucket::encryption::CustomerManagedEncryptionEnforcementConfig::effective_time].
6224 ///
6225 /// # Example
6226 /// ```ignore,no_run
6227 /// # use google_cloud_storage::model::bucket::encryption::CustomerManagedEncryptionEnforcementConfig;
6228 /// use wkt::Timestamp;
6229 /// let x = CustomerManagedEncryptionEnforcementConfig::new().set_or_clear_effective_time(Some(Timestamp::default()/* use setters */));
6230 /// let x = CustomerManagedEncryptionEnforcementConfig::new().set_or_clear_effective_time(None::<Timestamp>);
6231 /// ```
6232 pub fn set_or_clear_effective_time<T>(mut self, v: std::option::Option<T>) -> Self
6233 where
6234 T: std::convert::Into<wkt::Timestamp>,
6235 {
6236 self.effective_time = v.map(|x| x.into());
6237 self
6238 }
6239 }
6240
6241 impl wkt::message::Message for CustomerManagedEncryptionEnforcementConfig {
6242 fn typename() -> &'static str {
6243 "type.googleapis.com/google.storage.v2.Bucket.Encryption.CustomerManagedEncryptionEnforcementConfig"
6244 }
6245 }
6246
6247 /// Customer Supplied Encryption (CSEK) enforcement config of a bucket.
6248 #[derive(Clone, Default, PartialEq)]
6249 #[non_exhaustive]
6250 pub struct CustomerSuppliedEncryptionEnforcementConfig {
6251 /// Restriction mode for customer-supplied encryption for new objects
6252 /// within the bucket. Valid values are: `NotRestricted` and
6253 /// `FullyRestricted`.
6254 /// If `NotRestricted` or unset, creation of new objects with
6255 /// customer-supplied encryption is allowed.
6256 /// If `FullyRestricted`, new objects can't be created using
6257 /// customer-supplied encryption.
6258 pub restriction_mode: std::option::Option<std::string::String>,
6259
6260 /// Time from which the config was effective. This is service-provided.
6261 pub effective_time: std::option::Option<wkt::Timestamp>,
6262
6263 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
6264 }
6265
6266 impl CustomerSuppliedEncryptionEnforcementConfig {
6267 /// Creates a new default instance.
6268 pub fn new() -> Self {
6269 std::default::Default::default()
6270 }
6271
6272 /// Sets the value of [restriction_mode][crate::model::bucket::encryption::CustomerSuppliedEncryptionEnforcementConfig::restriction_mode].
6273 ///
6274 /// # Example
6275 /// ```ignore,no_run
6276 /// # use google_cloud_storage::model::bucket::encryption::CustomerSuppliedEncryptionEnforcementConfig;
6277 /// let x = CustomerSuppliedEncryptionEnforcementConfig::new().set_restriction_mode("example");
6278 /// ```
6279 pub fn set_restriction_mode<T>(mut self, v: T) -> Self
6280 where
6281 T: std::convert::Into<std::string::String>,
6282 {
6283 self.restriction_mode = std::option::Option::Some(v.into());
6284 self
6285 }
6286
6287 /// Sets or clears the value of [restriction_mode][crate::model::bucket::encryption::CustomerSuppliedEncryptionEnforcementConfig::restriction_mode].
6288 ///
6289 /// # Example
6290 /// ```ignore,no_run
6291 /// # use google_cloud_storage::model::bucket::encryption::CustomerSuppliedEncryptionEnforcementConfig;
6292 /// let x = CustomerSuppliedEncryptionEnforcementConfig::new().set_or_clear_restriction_mode(Some("example"));
6293 /// let x = CustomerSuppliedEncryptionEnforcementConfig::new().set_or_clear_restriction_mode(None::<String>);
6294 /// ```
6295 pub fn set_or_clear_restriction_mode<T>(mut self, v: std::option::Option<T>) -> Self
6296 where
6297 T: std::convert::Into<std::string::String>,
6298 {
6299 self.restriction_mode = v.map(|x| x.into());
6300 self
6301 }
6302
6303 /// Sets the value of [effective_time][crate::model::bucket::encryption::CustomerSuppliedEncryptionEnforcementConfig::effective_time].
6304 ///
6305 /// # Example
6306 /// ```ignore,no_run
6307 /// # use google_cloud_storage::model::bucket::encryption::CustomerSuppliedEncryptionEnforcementConfig;
6308 /// use wkt::Timestamp;
6309 /// let x = CustomerSuppliedEncryptionEnforcementConfig::new().set_effective_time(Timestamp::default()/* use setters */);
6310 /// ```
6311 pub fn set_effective_time<T>(mut self, v: T) -> Self
6312 where
6313 T: std::convert::Into<wkt::Timestamp>,
6314 {
6315 self.effective_time = std::option::Option::Some(v.into());
6316 self
6317 }
6318
6319 /// Sets or clears the value of [effective_time][crate::model::bucket::encryption::CustomerSuppliedEncryptionEnforcementConfig::effective_time].
6320 ///
6321 /// # Example
6322 /// ```ignore,no_run
6323 /// # use google_cloud_storage::model::bucket::encryption::CustomerSuppliedEncryptionEnforcementConfig;
6324 /// use wkt::Timestamp;
6325 /// let x = CustomerSuppliedEncryptionEnforcementConfig::new().set_or_clear_effective_time(Some(Timestamp::default()/* use setters */));
6326 /// let x = CustomerSuppliedEncryptionEnforcementConfig::new().set_or_clear_effective_time(None::<Timestamp>);
6327 /// ```
6328 pub fn set_or_clear_effective_time<T>(mut self, v: std::option::Option<T>) -> Self
6329 where
6330 T: std::convert::Into<wkt::Timestamp>,
6331 {
6332 self.effective_time = v.map(|x| x.into());
6333 self
6334 }
6335 }
6336
6337 impl wkt::message::Message for CustomerSuppliedEncryptionEnforcementConfig {
6338 fn typename() -> &'static str {
6339 "type.googleapis.com/google.storage.v2.Bucket.Encryption.CustomerSuppliedEncryptionEnforcementConfig"
6340 }
6341 }
6342 }
6343
6344 /// Bucket restriction options.
6345 #[derive(Clone, Default, PartialEq)]
6346 #[non_exhaustive]
6347 pub struct IamConfig {
6348 /// Optional. Bucket restriction options currently enforced on the bucket.
6349 pub uniform_bucket_level_access:
6350 std::option::Option<crate::model::bucket::iam_config::UniformBucketLevelAccess>,
6351
6352 /// Optional. Whether IAM enforces public access prevention. Valid values are
6353 /// `enforced` or `inherited`.
6354 pub public_access_prevention: std::string::String,
6355
6356 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
6357 }
6358
6359 impl IamConfig {
6360 /// Creates a new default instance.
6361 pub fn new() -> Self {
6362 std::default::Default::default()
6363 }
6364
6365 /// Sets the value of [uniform_bucket_level_access][crate::model::bucket::IamConfig::uniform_bucket_level_access].
6366 ///
6367 /// # Example
6368 /// ```ignore,no_run
6369 /// # use google_cloud_storage::model::bucket::IamConfig;
6370 /// use google_cloud_storage::model::bucket::iam_config::UniformBucketLevelAccess;
6371 /// let x = IamConfig::new().set_uniform_bucket_level_access(UniformBucketLevelAccess::default()/* use setters */);
6372 /// ```
6373 pub fn set_uniform_bucket_level_access<T>(mut self, v: T) -> Self
6374 where
6375 T: std::convert::Into<crate::model::bucket::iam_config::UniformBucketLevelAccess>,
6376 {
6377 self.uniform_bucket_level_access = std::option::Option::Some(v.into());
6378 self
6379 }
6380
6381 /// Sets or clears the value of [uniform_bucket_level_access][crate::model::bucket::IamConfig::uniform_bucket_level_access].
6382 ///
6383 /// # Example
6384 /// ```ignore,no_run
6385 /// # use google_cloud_storage::model::bucket::IamConfig;
6386 /// use google_cloud_storage::model::bucket::iam_config::UniformBucketLevelAccess;
6387 /// let x = IamConfig::new().set_or_clear_uniform_bucket_level_access(Some(UniformBucketLevelAccess::default()/* use setters */));
6388 /// let x = IamConfig::new().set_or_clear_uniform_bucket_level_access(None::<UniformBucketLevelAccess>);
6389 /// ```
6390 pub fn set_or_clear_uniform_bucket_level_access<T>(
6391 mut self,
6392 v: std::option::Option<T>,
6393 ) -> Self
6394 where
6395 T: std::convert::Into<crate::model::bucket::iam_config::UniformBucketLevelAccess>,
6396 {
6397 self.uniform_bucket_level_access = v.map(|x| x.into());
6398 self
6399 }
6400
6401 /// Sets the value of [public_access_prevention][crate::model::bucket::IamConfig::public_access_prevention].
6402 ///
6403 /// # Example
6404 /// ```ignore,no_run
6405 /// # use google_cloud_storage::model::bucket::IamConfig;
6406 /// let x = IamConfig::new().set_public_access_prevention("example");
6407 /// ```
6408 pub fn set_public_access_prevention<T: std::convert::Into<std::string::String>>(
6409 mut self,
6410 v: T,
6411 ) -> Self {
6412 self.public_access_prevention = v.into();
6413 self
6414 }
6415 }
6416
6417 impl wkt::message::Message for IamConfig {
6418 fn typename() -> &'static str {
6419 "type.googleapis.com/google.storage.v2.Bucket.IamConfig"
6420 }
6421 }
6422
6423 /// Defines additional types related to [IamConfig].
6424 pub mod iam_config {
6425 #[allow(unused_imports)]
6426 use super::*;
6427
6428 /// Settings for Uniform Bucket level access.
6429 /// See <https://cloud.google.com/storage/docs/uniform-bucket-level-access>.
6430 #[derive(Clone, Default, PartialEq)]
6431 #[non_exhaustive]
6432 pub struct UniformBucketLevelAccess {
6433 /// Optional. If set, access checks only use bucket-level IAM policies or
6434 /// above.
6435 pub enabled: bool,
6436
6437 /// Optional. The deadline time for changing
6438 /// `iam_config.uniform_bucket_level_access.enabled` from `true` to
6439 /// `false`. Mutable until the specified deadline is reached, but not
6440 /// afterward.
6441 pub lock_time: std::option::Option<wkt::Timestamp>,
6442
6443 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
6444 }
6445
6446 impl UniformBucketLevelAccess {
6447 /// Creates a new default instance.
6448 pub fn new() -> Self {
6449 std::default::Default::default()
6450 }
6451
6452 /// Sets the value of [enabled][crate::model::bucket::iam_config::UniformBucketLevelAccess::enabled].
6453 ///
6454 /// # Example
6455 /// ```ignore,no_run
6456 /// # use google_cloud_storage::model::bucket::iam_config::UniformBucketLevelAccess;
6457 /// let x = UniformBucketLevelAccess::new().set_enabled(true);
6458 /// ```
6459 pub fn set_enabled<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
6460 self.enabled = v.into();
6461 self
6462 }
6463
6464 /// Sets the value of [lock_time][crate::model::bucket::iam_config::UniformBucketLevelAccess::lock_time].
6465 ///
6466 /// # Example
6467 /// ```ignore,no_run
6468 /// # use google_cloud_storage::model::bucket::iam_config::UniformBucketLevelAccess;
6469 /// use wkt::Timestamp;
6470 /// let x = UniformBucketLevelAccess::new().set_lock_time(Timestamp::default()/* use setters */);
6471 /// ```
6472 pub fn set_lock_time<T>(mut self, v: T) -> Self
6473 where
6474 T: std::convert::Into<wkt::Timestamp>,
6475 {
6476 self.lock_time = std::option::Option::Some(v.into());
6477 self
6478 }
6479
6480 /// Sets or clears the value of [lock_time][crate::model::bucket::iam_config::UniformBucketLevelAccess::lock_time].
6481 ///
6482 /// # Example
6483 /// ```ignore,no_run
6484 /// # use google_cloud_storage::model::bucket::iam_config::UniformBucketLevelAccess;
6485 /// use wkt::Timestamp;
6486 /// let x = UniformBucketLevelAccess::new().set_or_clear_lock_time(Some(Timestamp::default()/* use setters */));
6487 /// let x = UniformBucketLevelAccess::new().set_or_clear_lock_time(None::<Timestamp>);
6488 /// ```
6489 pub fn set_or_clear_lock_time<T>(mut self, v: std::option::Option<T>) -> Self
6490 where
6491 T: std::convert::Into<wkt::Timestamp>,
6492 {
6493 self.lock_time = v.map(|x| x.into());
6494 self
6495 }
6496 }
6497
6498 impl wkt::message::Message for UniformBucketLevelAccess {
6499 fn typename() -> &'static str {
6500 "type.googleapis.com/google.storage.v2.Bucket.IamConfig.UniformBucketLevelAccess"
6501 }
6502 }
6503 }
6504
6505 /// Lifecycle properties of a bucket.
6506 /// For more information, see [Object Lifecycle
6507 /// Management](https://cloud.google.com/storage/docs/lifecycle).
6508 #[derive(Clone, Default, PartialEq)]
6509 #[non_exhaustive]
6510 pub struct Lifecycle {
6511 /// Optional. A lifecycle management rule, which is made of an action to take
6512 /// and the condition under which the action is taken.
6513 pub rule: std::vec::Vec<crate::model::bucket::lifecycle::Rule>,
6514
6515 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
6516 }
6517
6518 impl Lifecycle {
6519 /// Creates a new default instance.
6520 pub fn new() -> Self {
6521 std::default::Default::default()
6522 }
6523
6524 /// Sets the value of [rule][crate::model::bucket::Lifecycle::rule].
6525 ///
6526 /// # Example
6527 /// ```ignore,no_run
6528 /// # use google_cloud_storage::model::bucket::Lifecycle;
6529 /// use google_cloud_storage::model::bucket::lifecycle::Rule;
6530 /// let x = Lifecycle::new()
6531 /// .set_rule([
6532 /// Rule::default()/* use setters */,
6533 /// Rule::default()/* use (different) setters */,
6534 /// ]);
6535 /// ```
6536 pub fn set_rule<T, V>(mut self, v: T) -> Self
6537 where
6538 T: std::iter::IntoIterator<Item = V>,
6539 V: std::convert::Into<crate::model::bucket::lifecycle::Rule>,
6540 {
6541 use std::iter::Iterator;
6542 self.rule = v.into_iter().map(|i| i.into()).collect();
6543 self
6544 }
6545 }
6546
6547 impl wkt::message::Message for Lifecycle {
6548 fn typename() -> &'static str {
6549 "type.googleapis.com/google.storage.v2.Bucket.Lifecycle"
6550 }
6551 }
6552
6553 /// Defines additional types related to [Lifecycle].
6554 pub mod lifecycle {
6555 #[allow(unused_imports)]
6556 use super::*;
6557
6558 /// A lifecycle Rule, combining an action to take on an object and a
6559 /// condition which triggers that action.
6560 #[derive(Clone, Default, PartialEq)]
6561 #[non_exhaustive]
6562 pub struct Rule {
6563 /// Optional. The action to take.
6564 pub action: std::option::Option<crate::model::bucket::lifecycle::rule::Action>,
6565
6566 /// Optional. The condition under which the action is taken.
6567 pub condition: std::option::Option<crate::model::bucket::lifecycle::rule::Condition>,
6568
6569 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
6570 }
6571
6572 impl Rule {
6573 /// Creates a new default instance.
6574 pub fn new() -> Self {
6575 std::default::Default::default()
6576 }
6577
6578 /// Sets the value of [action][crate::model::bucket::lifecycle::Rule::action].
6579 ///
6580 /// # Example
6581 /// ```ignore,no_run
6582 /// # use google_cloud_storage::model::bucket::lifecycle::Rule;
6583 /// use google_cloud_storage::model::bucket::lifecycle::rule::Action;
6584 /// let x = Rule::new().set_action(Action::default()/* use setters */);
6585 /// ```
6586 pub fn set_action<T>(mut self, v: T) -> Self
6587 where
6588 T: std::convert::Into<crate::model::bucket::lifecycle::rule::Action>,
6589 {
6590 self.action = std::option::Option::Some(v.into());
6591 self
6592 }
6593
6594 /// Sets or clears the value of [action][crate::model::bucket::lifecycle::Rule::action].
6595 ///
6596 /// # Example
6597 /// ```ignore,no_run
6598 /// # use google_cloud_storage::model::bucket::lifecycle::Rule;
6599 /// use google_cloud_storage::model::bucket::lifecycle::rule::Action;
6600 /// let x = Rule::new().set_or_clear_action(Some(Action::default()/* use setters */));
6601 /// let x = Rule::new().set_or_clear_action(None::<Action>);
6602 /// ```
6603 pub fn set_or_clear_action<T>(mut self, v: std::option::Option<T>) -> Self
6604 where
6605 T: std::convert::Into<crate::model::bucket::lifecycle::rule::Action>,
6606 {
6607 self.action = v.map(|x| x.into());
6608 self
6609 }
6610
6611 /// Sets the value of [condition][crate::model::bucket::lifecycle::Rule::condition].
6612 ///
6613 /// # Example
6614 /// ```ignore,no_run
6615 /// # use google_cloud_storage::model::bucket::lifecycle::Rule;
6616 /// use google_cloud_storage::model::bucket::lifecycle::rule::Condition;
6617 /// let x = Rule::new().set_condition(Condition::default()/* use setters */);
6618 /// ```
6619 pub fn set_condition<T>(mut self, v: T) -> Self
6620 where
6621 T: std::convert::Into<crate::model::bucket::lifecycle::rule::Condition>,
6622 {
6623 self.condition = std::option::Option::Some(v.into());
6624 self
6625 }
6626
6627 /// Sets or clears the value of [condition][crate::model::bucket::lifecycle::Rule::condition].
6628 ///
6629 /// # Example
6630 /// ```ignore,no_run
6631 /// # use google_cloud_storage::model::bucket::lifecycle::Rule;
6632 /// use google_cloud_storage::model::bucket::lifecycle::rule::Condition;
6633 /// let x = Rule::new().set_or_clear_condition(Some(Condition::default()/* use setters */));
6634 /// let x = Rule::new().set_or_clear_condition(None::<Condition>);
6635 /// ```
6636 pub fn set_or_clear_condition<T>(mut self, v: std::option::Option<T>) -> Self
6637 where
6638 T: std::convert::Into<crate::model::bucket::lifecycle::rule::Condition>,
6639 {
6640 self.condition = v.map(|x| x.into());
6641 self
6642 }
6643 }
6644
6645 impl wkt::message::Message for Rule {
6646 fn typename() -> &'static str {
6647 "type.googleapis.com/google.storage.v2.Bucket.Lifecycle.Rule"
6648 }
6649 }
6650
6651 /// Defines additional types related to [Rule].
6652 pub mod rule {
6653 #[allow(unused_imports)]
6654 use super::*;
6655
6656 /// An action to take on an object.
6657 #[derive(Clone, Default, PartialEq)]
6658 #[non_exhaustive]
6659 pub struct Action {
6660 /// Optional. Type of the action. Currently, only `Delete`,
6661 /// `SetStorageClass`, and `AbortIncompleteMultipartUpload` are
6662 /// supported.
6663 pub r#type: std::string::String,
6664
6665 /// Optional. Target storage class. Required iff the type of the action
6666 /// is SetStorageClass.
6667 pub storage_class: std::string::String,
6668
6669 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
6670 }
6671
6672 impl Action {
6673 /// Creates a new default instance.
6674 pub fn new() -> Self {
6675 std::default::Default::default()
6676 }
6677
6678 /// Sets the value of [r#type][crate::model::bucket::lifecycle::rule::Action::type].
6679 ///
6680 /// # Example
6681 /// ```ignore,no_run
6682 /// # use google_cloud_storage::model::bucket::lifecycle::rule::Action;
6683 /// let x = Action::new().set_type("example");
6684 /// ```
6685 pub fn set_type<T: std::convert::Into<std::string::String>>(
6686 mut self,
6687 v: T,
6688 ) -> Self {
6689 self.r#type = v.into();
6690 self
6691 }
6692
6693 /// Sets the value of [storage_class][crate::model::bucket::lifecycle::rule::Action::storage_class].
6694 ///
6695 /// # Example
6696 /// ```ignore,no_run
6697 /// # use google_cloud_storage::model::bucket::lifecycle::rule::Action;
6698 /// let x = Action::new().set_storage_class("example");
6699 /// ```
6700 pub fn set_storage_class<T: std::convert::Into<std::string::String>>(
6701 mut self,
6702 v: T,
6703 ) -> Self {
6704 self.storage_class = v.into();
6705 self
6706 }
6707 }
6708
6709 impl wkt::message::Message for Action {
6710 fn typename() -> &'static str {
6711 "type.googleapis.com/google.storage.v2.Bucket.Lifecycle.Rule.Action"
6712 }
6713 }
6714
6715 /// A condition of an object which triggers some action.
6716 #[derive(Clone, Default, PartialEq)]
6717 #[non_exhaustive]
6718 pub struct Condition {
6719 /// Age of an object (in days). This condition is satisfied when an
6720 /// object reaches the specified age.
6721 /// A value of 0 indicates that all objects immediately match this
6722 /// condition.
6723 pub age_days: std::option::Option<i32>,
6724
6725 /// Optional. This condition is satisfied when an object is created
6726 /// before midnight of the specified date in UTC.
6727 pub created_before: std::option::Option<google_cloud_type::model::Date>,
6728
6729 /// Relevant only for versioned objects. If the value is
6730 /// `true`, this condition matches live objects; if the value
6731 /// is `false`, it matches archived objects.
6732 pub is_live: std::option::Option<bool>,
6733
6734 /// Relevant only for versioned objects. If the value is N, this
6735 /// condition is satisfied when there are at least N versions (including
6736 /// the live version) newer than this version of the object.
6737 pub num_newer_versions: std::option::Option<i32>,
6738
6739 /// Optional. Objects having any of the storage classes specified by this
6740 /// condition are matched. Values include `MULTI_REGIONAL`, `REGIONAL`,
6741 /// `NEARLINE`, `COLDLINE`, `STANDARD`, and
6742 /// `DURABLE_REDUCED_AVAILABILITY`.
6743 pub matches_storage_class: std::vec::Vec<std::string::String>,
6744
6745 /// Number of days that have elapsed since the custom timestamp set on an
6746 /// object.
6747 /// The value of the field must be a nonnegative integer.
6748 pub days_since_custom_time: std::option::Option<i32>,
6749
6750 /// Optional. An object matches this condition if the custom timestamp
6751 /// set on the object is before the specified date in UTC.
6752 pub custom_time_before: std::option::Option<google_cloud_type::model::Date>,
6753
6754 /// This condition is relevant only for versioned objects. An object
6755 /// version satisfies this condition only if these many days have been
6756 /// passed since it became noncurrent. The value of the field must be a
6757 /// nonnegative integer. If it's zero, the object version becomes
6758 /// eligible for Lifecycle action as soon as it becomes noncurrent.
6759 pub days_since_noncurrent_time: std::option::Option<i32>,
6760
6761 /// Optional. This condition is relevant only for versioned objects. An
6762 /// object version satisfies this condition only if it became noncurrent
6763 /// before the specified date in UTC.
6764 pub noncurrent_time_before: std::option::Option<google_cloud_type::model::Date>,
6765
6766 /// Optional. List of object name prefixes. If any prefix exactly matches
6767 /// the beginning of the object name, the condition evaluates to true.
6768 pub matches_prefix: std::vec::Vec<std::string::String>,
6769
6770 /// Optional. List of object name suffixes. If any suffix exactly matches
6771 /// the end of the object name, the condition evaluates to true.
6772 pub matches_suffix: std::vec::Vec<std::string::String>,
6773
6774 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
6775 }
6776
6777 impl Condition {
6778 /// Creates a new default instance.
6779 pub fn new() -> Self {
6780 std::default::Default::default()
6781 }
6782
6783 /// Sets the value of [age_days][crate::model::bucket::lifecycle::rule::Condition::age_days].
6784 ///
6785 /// # Example
6786 /// ```ignore,no_run
6787 /// # use google_cloud_storage::model::bucket::lifecycle::rule::Condition;
6788 /// let x = Condition::new().set_age_days(42);
6789 /// ```
6790 pub fn set_age_days<T>(mut self, v: T) -> Self
6791 where
6792 T: std::convert::Into<i32>,
6793 {
6794 self.age_days = std::option::Option::Some(v.into());
6795 self
6796 }
6797
6798 /// Sets or clears the value of [age_days][crate::model::bucket::lifecycle::rule::Condition::age_days].
6799 ///
6800 /// # Example
6801 /// ```ignore,no_run
6802 /// # use google_cloud_storage::model::bucket::lifecycle::rule::Condition;
6803 /// let x = Condition::new().set_or_clear_age_days(Some(42));
6804 /// let x = Condition::new().set_or_clear_age_days(None::<i32>);
6805 /// ```
6806 pub fn set_or_clear_age_days<T>(mut self, v: std::option::Option<T>) -> Self
6807 where
6808 T: std::convert::Into<i32>,
6809 {
6810 self.age_days = v.map(|x| x.into());
6811 self
6812 }
6813
6814 /// Sets the value of [created_before][crate::model::bucket::lifecycle::rule::Condition::created_before].
6815 ///
6816 /// # Example
6817 /// ```ignore,no_run
6818 /// # use google_cloud_storage::model::bucket::lifecycle::rule::Condition;
6819 /// use google_cloud_type::model::Date;
6820 /// let x = Condition::new().set_created_before(Date::default()/* use setters */);
6821 /// ```
6822 pub fn set_created_before<T>(mut self, v: T) -> Self
6823 where
6824 T: std::convert::Into<google_cloud_type::model::Date>,
6825 {
6826 self.created_before = std::option::Option::Some(v.into());
6827 self
6828 }
6829
6830 /// Sets or clears the value of [created_before][crate::model::bucket::lifecycle::rule::Condition::created_before].
6831 ///
6832 /// # Example
6833 /// ```ignore,no_run
6834 /// # use google_cloud_storage::model::bucket::lifecycle::rule::Condition;
6835 /// use google_cloud_type::model::Date;
6836 /// let x = Condition::new().set_or_clear_created_before(Some(Date::default()/* use setters */));
6837 /// let x = Condition::new().set_or_clear_created_before(None::<Date>);
6838 /// ```
6839 pub fn set_or_clear_created_before<T>(mut self, v: std::option::Option<T>) -> Self
6840 where
6841 T: std::convert::Into<google_cloud_type::model::Date>,
6842 {
6843 self.created_before = v.map(|x| x.into());
6844 self
6845 }
6846
6847 /// Sets the value of [is_live][crate::model::bucket::lifecycle::rule::Condition::is_live].
6848 ///
6849 /// # Example
6850 /// ```ignore,no_run
6851 /// # use google_cloud_storage::model::bucket::lifecycle::rule::Condition;
6852 /// let x = Condition::new().set_is_live(true);
6853 /// ```
6854 pub fn set_is_live<T>(mut self, v: T) -> Self
6855 where
6856 T: std::convert::Into<bool>,
6857 {
6858 self.is_live = std::option::Option::Some(v.into());
6859 self
6860 }
6861
6862 /// Sets or clears the value of [is_live][crate::model::bucket::lifecycle::rule::Condition::is_live].
6863 ///
6864 /// # Example
6865 /// ```ignore,no_run
6866 /// # use google_cloud_storage::model::bucket::lifecycle::rule::Condition;
6867 /// let x = Condition::new().set_or_clear_is_live(Some(false));
6868 /// let x = Condition::new().set_or_clear_is_live(None::<bool>);
6869 /// ```
6870 pub fn set_or_clear_is_live<T>(mut self, v: std::option::Option<T>) -> Self
6871 where
6872 T: std::convert::Into<bool>,
6873 {
6874 self.is_live = v.map(|x| x.into());
6875 self
6876 }
6877
6878 /// Sets the value of [num_newer_versions][crate::model::bucket::lifecycle::rule::Condition::num_newer_versions].
6879 ///
6880 /// # Example
6881 /// ```ignore,no_run
6882 /// # use google_cloud_storage::model::bucket::lifecycle::rule::Condition;
6883 /// let x = Condition::new().set_num_newer_versions(42);
6884 /// ```
6885 pub fn set_num_newer_versions<T>(mut self, v: T) -> Self
6886 where
6887 T: std::convert::Into<i32>,
6888 {
6889 self.num_newer_versions = std::option::Option::Some(v.into());
6890 self
6891 }
6892
6893 /// Sets or clears the value of [num_newer_versions][crate::model::bucket::lifecycle::rule::Condition::num_newer_versions].
6894 ///
6895 /// # Example
6896 /// ```ignore,no_run
6897 /// # use google_cloud_storage::model::bucket::lifecycle::rule::Condition;
6898 /// let x = Condition::new().set_or_clear_num_newer_versions(Some(42));
6899 /// let x = Condition::new().set_or_clear_num_newer_versions(None::<i32>);
6900 /// ```
6901 pub fn set_or_clear_num_newer_versions<T>(
6902 mut self,
6903 v: std::option::Option<T>,
6904 ) -> Self
6905 where
6906 T: std::convert::Into<i32>,
6907 {
6908 self.num_newer_versions = v.map(|x| x.into());
6909 self
6910 }
6911
6912 /// Sets the value of [matches_storage_class][crate::model::bucket::lifecycle::rule::Condition::matches_storage_class].
6913 ///
6914 /// # Example
6915 /// ```ignore,no_run
6916 /// # use google_cloud_storage::model::bucket::lifecycle::rule::Condition;
6917 /// let x = Condition::new().set_matches_storage_class(["a", "b", "c"]);
6918 /// ```
6919 pub fn set_matches_storage_class<T, V>(mut self, v: T) -> Self
6920 where
6921 T: std::iter::IntoIterator<Item = V>,
6922 V: std::convert::Into<std::string::String>,
6923 {
6924 use std::iter::Iterator;
6925 self.matches_storage_class = v.into_iter().map(|i| i.into()).collect();
6926 self
6927 }
6928
6929 /// Sets the value of [days_since_custom_time][crate::model::bucket::lifecycle::rule::Condition::days_since_custom_time].
6930 ///
6931 /// # Example
6932 /// ```ignore,no_run
6933 /// # use google_cloud_storage::model::bucket::lifecycle::rule::Condition;
6934 /// let x = Condition::new().set_days_since_custom_time(42);
6935 /// ```
6936 pub fn set_days_since_custom_time<T>(mut self, v: T) -> Self
6937 where
6938 T: std::convert::Into<i32>,
6939 {
6940 self.days_since_custom_time = std::option::Option::Some(v.into());
6941 self
6942 }
6943
6944 /// Sets or clears the value of [days_since_custom_time][crate::model::bucket::lifecycle::rule::Condition::days_since_custom_time].
6945 ///
6946 /// # Example
6947 /// ```ignore,no_run
6948 /// # use google_cloud_storage::model::bucket::lifecycle::rule::Condition;
6949 /// let x = Condition::new().set_or_clear_days_since_custom_time(Some(42));
6950 /// let x = Condition::new().set_or_clear_days_since_custom_time(None::<i32>);
6951 /// ```
6952 pub fn set_or_clear_days_since_custom_time<T>(
6953 mut self,
6954 v: std::option::Option<T>,
6955 ) -> Self
6956 where
6957 T: std::convert::Into<i32>,
6958 {
6959 self.days_since_custom_time = v.map(|x| x.into());
6960 self
6961 }
6962
6963 /// Sets the value of [custom_time_before][crate::model::bucket::lifecycle::rule::Condition::custom_time_before].
6964 ///
6965 /// # Example
6966 /// ```ignore,no_run
6967 /// # use google_cloud_storage::model::bucket::lifecycle::rule::Condition;
6968 /// use google_cloud_type::model::Date;
6969 /// let x = Condition::new().set_custom_time_before(Date::default()/* use setters */);
6970 /// ```
6971 pub fn set_custom_time_before<T>(mut self, v: T) -> Self
6972 where
6973 T: std::convert::Into<google_cloud_type::model::Date>,
6974 {
6975 self.custom_time_before = std::option::Option::Some(v.into());
6976 self
6977 }
6978
6979 /// Sets or clears the value of [custom_time_before][crate::model::bucket::lifecycle::rule::Condition::custom_time_before].
6980 ///
6981 /// # Example
6982 /// ```ignore,no_run
6983 /// # use google_cloud_storage::model::bucket::lifecycle::rule::Condition;
6984 /// use google_cloud_type::model::Date;
6985 /// let x = Condition::new().set_or_clear_custom_time_before(Some(Date::default()/* use setters */));
6986 /// let x = Condition::new().set_or_clear_custom_time_before(None::<Date>);
6987 /// ```
6988 pub fn set_or_clear_custom_time_before<T>(
6989 mut self,
6990 v: std::option::Option<T>,
6991 ) -> Self
6992 where
6993 T: std::convert::Into<google_cloud_type::model::Date>,
6994 {
6995 self.custom_time_before = v.map(|x| x.into());
6996 self
6997 }
6998
6999 /// Sets the value of [days_since_noncurrent_time][crate::model::bucket::lifecycle::rule::Condition::days_since_noncurrent_time].
7000 ///
7001 /// # Example
7002 /// ```ignore,no_run
7003 /// # use google_cloud_storage::model::bucket::lifecycle::rule::Condition;
7004 /// let x = Condition::new().set_days_since_noncurrent_time(42);
7005 /// ```
7006 pub fn set_days_since_noncurrent_time<T>(mut self, v: T) -> Self
7007 where
7008 T: std::convert::Into<i32>,
7009 {
7010 self.days_since_noncurrent_time = std::option::Option::Some(v.into());
7011 self
7012 }
7013
7014 /// Sets or clears the value of [days_since_noncurrent_time][crate::model::bucket::lifecycle::rule::Condition::days_since_noncurrent_time].
7015 ///
7016 /// # Example
7017 /// ```ignore,no_run
7018 /// # use google_cloud_storage::model::bucket::lifecycle::rule::Condition;
7019 /// let x = Condition::new().set_or_clear_days_since_noncurrent_time(Some(42));
7020 /// let x = Condition::new().set_or_clear_days_since_noncurrent_time(None::<i32>);
7021 /// ```
7022 pub fn set_or_clear_days_since_noncurrent_time<T>(
7023 mut self,
7024 v: std::option::Option<T>,
7025 ) -> Self
7026 where
7027 T: std::convert::Into<i32>,
7028 {
7029 self.days_since_noncurrent_time = v.map(|x| x.into());
7030 self
7031 }
7032
7033 /// Sets the value of [noncurrent_time_before][crate::model::bucket::lifecycle::rule::Condition::noncurrent_time_before].
7034 ///
7035 /// # Example
7036 /// ```ignore,no_run
7037 /// # use google_cloud_storage::model::bucket::lifecycle::rule::Condition;
7038 /// use google_cloud_type::model::Date;
7039 /// let x = Condition::new().set_noncurrent_time_before(Date::default()/* use setters */);
7040 /// ```
7041 pub fn set_noncurrent_time_before<T>(mut self, v: T) -> Self
7042 where
7043 T: std::convert::Into<google_cloud_type::model::Date>,
7044 {
7045 self.noncurrent_time_before = std::option::Option::Some(v.into());
7046 self
7047 }
7048
7049 /// Sets or clears the value of [noncurrent_time_before][crate::model::bucket::lifecycle::rule::Condition::noncurrent_time_before].
7050 ///
7051 /// # Example
7052 /// ```ignore,no_run
7053 /// # use google_cloud_storage::model::bucket::lifecycle::rule::Condition;
7054 /// use google_cloud_type::model::Date;
7055 /// let x = Condition::new().set_or_clear_noncurrent_time_before(Some(Date::default()/* use setters */));
7056 /// let x = Condition::new().set_or_clear_noncurrent_time_before(None::<Date>);
7057 /// ```
7058 pub fn set_or_clear_noncurrent_time_before<T>(
7059 mut self,
7060 v: std::option::Option<T>,
7061 ) -> Self
7062 where
7063 T: std::convert::Into<google_cloud_type::model::Date>,
7064 {
7065 self.noncurrent_time_before = v.map(|x| x.into());
7066 self
7067 }
7068
7069 /// Sets the value of [matches_prefix][crate::model::bucket::lifecycle::rule::Condition::matches_prefix].
7070 ///
7071 /// # Example
7072 /// ```ignore,no_run
7073 /// # use google_cloud_storage::model::bucket::lifecycle::rule::Condition;
7074 /// let x = Condition::new().set_matches_prefix(["a", "b", "c"]);
7075 /// ```
7076 pub fn set_matches_prefix<T, V>(mut self, v: T) -> Self
7077 where
7078 T: std::iter::IntoIterator<Item = V>,
7079 V: std::convert::Into<std::string::String>,
7080 {
7081 use std::iter::Iterator;
7082 self.matches_prefix = v.into_iter().map(|i| i.into()).collect();
7083 self
7084 }
7085
7086 /// Sets the value of [matches_suffix][crate::model::bucket::lifecycle::rule::Condition::matches_suffix].
7087 ///
7088 /// # Example
7089 /// ```ignore,no_run
7090 /// # use google_cloud_storage::model::bucket::lifecycle::rule::Condition;
7091 /// let x = Condition::new().set_matches_suffix(["a", "b", "c"]);
7092 /// ```
7093 pub fn set_matches_suffix<T, V>(mut self, v: T) -> Self
7094 where
7095 T: std::iter::IntoIterator<Item = V>,
7096 V: std::convert::Into<std::string::String>,
7097 {
7098 use std::iter::Iterator;
7099 self.matches_suffix = v.into_iter().map(|i| i.into()).collect();
7100 self
7101 }
7102 }
7103
7104 impl wkt::message::Message for Condition {
7105 fn typename() -> &'static str {
7106 "type.googleapis.com/google.storage.v2.Bucket.Lifecycle.Rule.Condition"
7107 }
7108 }
7109 }
7110 }
7111
7112 /// Logging-related properties of a bucket.
7113 #[derive(Clone, Default, PartialEq)]
7114 #[non_exhaustive]
7115 pub struct Logging {
7116 /// Optional. The destination bucket where the current bucket's logs should
7117 /// be placed, using path format (like `projects/123456/buckets/foo`).
7118 pub log_bucket: std::string::String,
7119
7120 /// Optional. A prefix for log object names.
7121 pub log_object_prefix: std::string::String,
7122
7123 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
7124 }
7125
7126 impl Logging {
7127 /// Creates a new default instance.
7128 pub fn new() -> Self {
7129 std::default::Default::default()
7130 }
7131
7132 /// Sets the value of [log_bucket][crate::model::bucket::Logging::log_bucket].
7133 ///
7134 /// # Example
7135 /// ```ignore,no_run
7136 /// # use google_cloud_storage::model::bucket::Logging;
7137 /// let x = Logging::new().set_log_bucket("example");
7138 /// ```
7139 pub fn set_log_bucket<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
7140 self.log_bucket = v.into();
7141 self
7142 }
7143
7144 /// Sets the value of [log_object_prefix][crate::model::bucket::Logging::log_object_prefix].
7145 ///
7146 /// # Example
7147 /// ```ignore,no_run
7148 /// # use google_cloud_storage::model::bucket::Logging;
7149 /// let x = Logging::new().set_log_object_prefix("example");
7150 /// ```
7151 pub fn set_log_object_prefix<T: std::convert::Into<std::string::String>>(
7152 mut self,
7153 v: T,
7154 ) -> Self {
7155 self.log_object_prefix = v.into();
7156 self
7157 }
7158 }
7159
7160 impl wkt::message::Message for Logging {
7161 fn typename() -> &'static str {
7162 "type.googleapis.com/google.storage.v2.Bucket.Logging"
7163 }
7164 }
7165
7166 /// Object Retention related properties of a bucket.
7167 #[derive(Clone, Default, PartialEq)]
7168 #[non_exhaustive]
7169 pub struct ObjectRetention {
7170 /// Optional. Output only. If true, object retention is enabled for the
7171 /// bucket.
7172 pub enabled: bool,
7173
7174 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
7175 }
7176
7177 impl ObjectRetention {
7178 /// Creates a new default instance.
7179 pub fn new() -> Self {
7180 std::default::Default::default()
7181 }
7182
7183 /// Sets the value of [enabled][crate::model::bucket::ObjectRetention::enabled].
7184 ///
7185 /// # Example
7186 /// ```ignore,no_run
7187 /// # use google_cloud_storage::model::bucket::ObjectRetention;
7188 /// let x = ObjectRetention::new().set_enabled(true);
7189 /// ```
7190 pub fn set_enabled<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
7191 self.enabled = v.into();
7192 self
7193 }
7194 }
7195
7196 impl wkt::message::Message for ObjectRetention {
7197 fn typename() -> &'static str {
7198 "type.googleapis.com/google.storage.v2.Bucket.ObjectRetention"
7199 }
7200 }
7201
7202 /// Retention policy properties of a bucket.
7203 #[derive(Clone, Default, PartialEq)]
7204 #[non_exhaustive]
7205 pub struct RetentionPolicy {
7206 /// Optional. Server-determined value that indicates the time from which
7207 /// policy was enforced and effective.
7208 pub effective_time: std::option::Option<wkt::Timestamp>,
7209
7210 /// Optional. Once locked, an object retention policy cannot be modified.
7211 pub is_locked: bool,
7212
7213 /// Optional. The duration that objects need to be retained. Retention
7214 /// duration must be greater than zero and less than 100 years. Note that
7215 /// enforcement of retention periods less than a day is not guaranteed. Such
7216 /// periods should only be used for testing purposes. Any `nanos` value
7217 /// specified is rounded down to the nearest second.
7218 pub retention_duration: std::option::Option<wkt::Duration>,
7219
7220 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
7221 }
7222
7223 impl RetentionPolicy {
7224 /// Creates a new default instance.
7225 pub fn new() -> Self {
7226 std::default::Default::default()
7227 }
7228
7229 /// Sets the value of [effective_time][crate::model::bucket::RetentionPolicy::effective_time].
7230 ///
7231 /// # Example
7232 /// ```ignore,no_run
7233 /// # use google_cloud_storage::model::bucket::RetentionPolicy;
7234 /// use wkt::Timestamp;
7235 /// let x = RetentionPolicy::new().set_effective_time(Timestamp::default()/* use setters */);
7236 /// ```
7237 pub fn set_effective_time<T>(mut self, v: T) -> Self
7238 where
7239 T: std::convert::Into<wkt::Timestamp>,
7240 {
7241 self.effective_time = std::option::Option::Some(v.into());
7242 self
7243 }
7244
7245 /// Sets or clears the value of [effective_time][crate::model::bucket::RetentionPolicy::effective_time].
7246 ///
7247 /// # Example
7248 /// ```ignore,no_run
7249 /// # use google_cloud_storage::model::bucket::RetentionPolicy;
7250 /// use wkt::Timestamp;
7251 /// let x = RetentionPolicy::new().set_or_clear_effective_time(Some(Timestamp::default()/* use setters */));
7252 /// let x = RetentionPolicy::new().set_or_clear_effective_time(None::<Timestamp>);
7253 /// ```
7254 pub fn set_or_clear_effective_time<T>(mut self, v: std::option::Option<T>) -> Self
7255 where
7256 T: std::convert::Into<wkt::Timestamp>,
7257 {
7258 self.effective_time = v.map(|x| x.into());
7259 self
7260 }
7261
7262 /// Sets the value of [is_locked][crate::model::bucket::RetentionPolicy::is_locked].
7263 ///
7264 /// # Example
7265 /// ```ignore,no_run
7266 /// # use google_cloud_storage::model::bucket::RetentionPolicy;
7267 /// let x = RetentionPolicy::new().set_is_locked(true);
7268 /// ```
7269 pub fn set_is_locked<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
7270 self.is_locked = v.into();
7271 self
7272 }
7273
7274 /// Sets the value of [retention_duration][crate::model::bucket::RetentionPolicy::retention_duration].
7275 ///
7276 /// # Example
7277 /// ```ignore,no_run
7278 /// # use google_cloud_storage::model::bucket::RetentionPolicy;
7279 /// use wkt::Duration;
7280 /// let x = RetentionPolicy::new().set_retention_duration(Duration::default()/* use setters */);
7281 /// ```
7282 pub fn set_retention_duration<T>(mut self, v: T) -> Self
7283 where
7284 T: std::convert::Into<wkt::Duration>,
7285 {
7286 self.retention_duration = std::option::Option::Some(v.into());
7287 self
7288 }
7289
7290 /// Sets or clears the value of [retention_duration][crate::model::bucket::RetentionPolicy::retention_duration].
7291 ///
7292 /// # Example
7293 /// ```ignore,no_run
7294 /// # use google_cloud_storage::model::bucket::RetentionPolicy;
7295 /// use wkt::Duration;
7296 /// let x = RetentionPolicy::new().set_or_clear_retention_duration(Some(Duration::default()/* use setters */));
7297 /// let x = RetentionPolicy::new().set_or_clear_retention_duration(None::<Duration>);
7298 /// ```
7299 pub fn set_or_clear_retention_duration<T>(mut self, v: std::option::Option<T>) -> Self
7300 where
7301 T: std::convert::Into<wkt::Duration>,
7302 {
7303 self.retention_duration = v.map(|x| x.into());
7304 self
7305 }
7306 }
7307
7308 impl wkt::message::Message for RetentionPolicy {
7309 fn typename() -> &'static str {
7310 "type.googleapis.com/google.storage.v2.Bucket.RetentionPolicy"
7311 }
7312 }
7313
7314 /// Soft delete policy properties of a bucket.
7315 #[derive(Clone, Default, PartialEq)]
7316 #[non_exhaustive]
7317 pub struct SoftDeletePolicy {
7318 /// The period of time that soft-deleted objects in the bucket must be
7319 /// retained and cannot be permanently deleted. The duration must be greater
7320 /// than or equal to 7 days and less than 1 year.
7321 pub retention_duration: std::option::Option<wkt::Duration>,
7322
7323 /// Time from which the policy was effective. This is service-provided.
7324 pub effective_time: std::option::Option<wkt::Timestamp>,
7325
7326 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
7327 }
7328
7329 impl SoftDeletePolicy {
7330 /// Creates a new default instance.
7331 pub fn new() -> Self {
7332 std::default::Default::default()
7333 }
7334
7335 /// Sets the value of [retention_duration][crate::model::bucket::SoftDeletePolicy::retention_duration].
7336 ///
7337 /// # Example
7338 /// ```ignore,no_run
7339 /// # use google_cloud_storage::model::bucket::SoftDeletePolicy;
7340 /// use wkt::Duration;
7341 /// let x = SoftDeletePolicy::new().set_retention_duration(Duration::default()/* use setters */);
7342 /// ```
7343 pub fn set_retention_duration<T>(mut self, v: T) -> Self
7344 where
7345 T: std::convert::Into<wkt::Duration>,
7346 {
7347 self.retention_duration = std::option::Option::Some(v.into());
7348 self
7349 }
7350
7351 /// Sets or clears the value of [retention_duration][crate::model::bucket::SoftDeletePolicy::retention_duration].
7352 ///
7353 /// # Example
7354 /// ```ignore,no_run
7355 /// # use google_cloud_storage::model::bucket::SoftDeletePolicy;
7356 /// use wkt::Duration;
7357 /// let x = SoftDeletePolicy::new().set_or_clear_retention_duration(Some(Duration::default()/* use setters */));
7358 /// let x = SoftDeletePolicy::new().set_or_clear_retention_duration(None::<Duration>);
7359 /// ```
7360 pub fn set_or_clear_retention_duration<T>(mut self, v: std::option::Option<T>) -> Self
7361 where
7362 T: std::convert::Into<wkt::Duration>,
7363 {
7364 self.retention_duration = v.map(|x| x.into());
7365 self
7366 }
7367
7368 /// Sets the value of [effective_time][crate::model::bucket::SoftDeletePolicy::effective_time].
7369 ///
7370 /// # Example
7371 /// ```ignore,no_run
7372 /// # use google_cloud_storage::model::bucket::SoftDeletePolicy;
7373 /// use wkt::Timestamp;
7374 /// let x = SoftDeletePolicy::new().set_effective_time(Timestamp::default()/* use setters */);
7375 /// ```
7376 pub fn set_effective_time<T>(mut self, v: T) -> Self
7377 where
7378 T: std::convert::Into<wkt::Timestamp>,
7379 {
7380 self.effective_time = std::option::Option::Some(v.into());
7381 self
7382 }
7383
7384 /// Sets or clears the value of [effective_time][crate::model::bucket::SoftDeletePolicy::effective_time].
7385 ///
7386 /// # Example
7387 /// ```ignore,no_run
7388 /// # use google_cloud_storage::model::bucket::SoftDeletePolicy;
7389 /// use wkt::Timestamp;
7390 /// let x = SoftDeletePolicy::new().set_or_clear_effective_time(Some(Timestamp::default()/* use setters */));
7391 /// let x = SoftDeletePolicy::new().set_or_clear_effective_time(None::<Timestamp>);
7392 /// ```
7393 pub fn set_or_clear_effective_time<T>(mut self, v: std::option::Option<T>) -> Self
7394 where
7395 T: std::convert::Into<wkt::Timestamp>,
7396 {
7397 self.effective_time = v.map(|x| x.into());
7398 self
7399 }
7400 }
7401
7402 impl wkt::message::Message for SoftDeletePolicy {
7403 fn typename() -> &'static str {
7404 "type.googleapis.com/google.storage.v2.Bucket.SoftDeletePolicy"
7405 }
7406 }
7407
7408 /// Properties of a bucket related to versioning.
7409 /// For more information about Cloud Storage versioning, see [Object
7410 /// versioning](https://cloud.google.com/storage/docs/object-versioning).
7411 #[derive(Clone, Default, PartialEq)]
7412 #[non_exhaustive]
7413 pub struct Versioning {
7414 /// Optional. While set to true, versioning is fully enabled for this bucket.
7415 pub enabled: bool,
7416
7417 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
7418 }
7419
7420 impl Versioning {
7421 /// Creates a new default instance.
7422 pub fn new() -> Self {
7423 std::default::Default::default()
7424 }
7425
7426 /// Sets the value of [enabled][crate::model::bucket::Versioning::enabled].
7427 ///
7428 /// # Example
7429 /// ```ignore,no_run
7430 /// # use google_cloud_storage::model::bucket::Versioning;
7431 /// let x = Versioning::new().set_enabled(true);
7432 /// ```
7433 pub fn set_enabled<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
7434 self.enabled = v.into();
7435 self
7436 }
7437 }
7438
7439 impl wkt::message::Message for Versioning {
7440 fn typename() -> &'static str {
7441 "type.googleapis.com/google.storage.v2.Bucket.Versioning"
7442 }
7443 }
7444
7445 /// Properties of a bucket related to accessing the contents as a static
7446 /// website. For details, see [hosting a static website using Cloud
7447 /// Storage](https://cloud.google.com/storage/docs/hosting-static-website).
7448 #[derive(Clone, Default, PartialEq)]
7449 #[non_exhaustive]
7450 pub struct Website {
7451 /// Optional. If the requested object path is missing, the service ensures
7452 /// the path has a trailing '/', append this suffix, and attempt to retrieve
7453 /// the resulting object. This allows the creation of `index.html` objects to
7454 /// represent directory pages.
7455 pub main_page_suffix: std::string::String,
7456
7457 /// Optional. If the requested object path is missing, and any
7458 /// `mainPageSuffix` object is missing, if applicable, the service
7459 /// returns the named object from this bucket as the content for a
7460 /// [404 Not Found](https://tools.ietf.org/html/rfc7231#section-6.5.4)
7461 /// result.
7462 pub not_found_page: std::string::String,
7463
7464 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
7465 }
7466
7467 impl Website {
7468 /// Creates a new default instance.
7469 pub fn new() -> Self {
7470 std::default::Default::default()
7471 }
7472
7473 /// Sets the value of [main_page_suffix][crate::model::bucket::Website::main_page_suffix].
7474 ///
7475 /// # Example
7476 /// ```ignore,no_run
7477 /// # use google_cloud_storage::model::bucket::Website;
7478 /// let x = Website::new().set_main_page_suffix("example");
7479 /// ```
7480 pub fn set_main_page_suffix<T: std::convert::Into<std::string::String>>(
7481 mut self,
7482 v: T,
7483 ) -> Self {
7484 self.main_page_suffix = v.into();
7485 self
7486 }
7487
7488 /// Sets the value of [not_found_page][crate::model::bucket::Website::not_found_page].
7489 ///
7490 /// # Example
7491 /// ```ignore,no_run
7492 /// # use google_cloud_storage::model::bucket::Website;
7493 /// let x = Website::new().set_not_found_page("example");
7494 /// ```
7495 pub fn set_not_found_page<T: std::convert::Into<std::string::String>>(
7496 mut self,
7497 v: T,
7498 ) -> Self {
7499 self.not_found_page = v.into();
7500 self
7501 }
7502 }
7503
7504 impl wkt::message::Message for Website {
7505 fn typename() -> &'static str {
7506 "type.googleapis.com/google.storage.v2.Bucket.Website"
7507 }
7508 }
7509
7510 /// Configuration for [configurable dual-
7511 /// regions](https://cloud.google.com/storage/docs/locations#configurable). It
7512 /// should specify precisely two eligible regions within the same multi-region.
7513 /// For details, see
7514 /// [locations](https://cloud.google.com/storage/docs/locations).
7515 #[derive(Clone, Default, PartialEq)]
7516 #[non_exhaustive]
7517 pub struct CustomPlacementConfig {
7518 /// Optional. List of locations to use for data placement.
7519 pub data_locations: std::vec::Vec<std::string::String>,
7520
7521 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
7522 }
7523
7524 impl CustomPlacementConfig {
7525 /// Creates a new default instance.
7526 pub fn new() -> Self {
7527 std::default::Default::default()
7528 }
7529
7530 /// Sets the value of [data_locations][crate::model::bucket::CustomPlacementConfig::data_locations].
7531 ///
7532 /// # Example
7533 /// ```ignore,no_run
7534 /// # use google_cloud_storage::model::bucket::CustomPlacementConfig;
7535 /// let x = CustomPlacementConfig::new().set_data_locations(["a", "b", "c"]);
7536 /// ```
7537 pub fn set_data_locations<T, V>(mut self, v: T) -> Self
7538 where
7539 T: std::iter::IntoIterator<Item = V>,
7540 V: std::convert::Into<std::string::String>,
7541 {
7542 use std::iter::Iterator;
7543 self.data_locations = v.into_iter().map(|i| i.into()).collect();
7544 self
7545 }
7546 }
7547
7548 impl wkt::message::Message for CustomPlacementConfig {
7549 fn typename() -> &'static str {
7550 "type.googleapis.com/google.storage.v2.Bucket.CustomPlacementConfig"
7551 }
7552 }
7553
7554 /// Configuration for a bucket's Autoclass feature.
7555 #[derive(Clone, Default, PartialEq)]
7556 #[non_exhaustive]
7557 pub struct Autoclass {
7558 /// Optional. Enables Autoclass.
7559 pub enabled: bool,
7560
7561 /// Output only. Latest instant at which the `enabled` field was set to true
7562 /// after being disabled/unconfigured or set to false after being enabled. If
7563 /// Autoclass is enabled when the bucket is created, the value of the
7564 /// `toggle_time` field is set to the bucket `create_time`.
7565 pub toggle_time: std::option::Option<wkt::Timestamp>,
7566
7567 /// An object in an Autoclass bucket eventually cools down to the
7568 /// terminal storage class if there is no access to the object.
7569 /// The only valid values are NEARLINE and ARCHIVE.
7570 pub terminal_storage_class: std::option::Option<std::string::String>,
7571
7572 /// Output only. Latest instant at which the autoclass terminal storage class
7573 /// was updated.
7574 pub terminal_storage_class_update_time: std::option::Option<wkt::Timestamp>,
7575
7576 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
7577 }
7578
7579 impl Autoclass {
7580 /// Creates a new default instance.
7581 pub fn new() -> Self {
7582 std::default::Default::default()
7583 }
7584
7585 /// Sets the value of [enabled][crate::model::bucket::Autoclass::enabled].
7586 ///
7587 /// # Example
7588 /// ```ignore,no_run
7589 /// # use google_cloud_storage::model::bucket::Autoclass;
7590 /// let x = Autoclass::new().set_enabled(true);
7591 /// ```
7592 pub fn set_enabled<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
7593 self.enabled = v.into();
7594 self
7595 }
7596
7597 /// Sets the value of [toggle_time][crate::model::bucket::Autoclass::toggle_time].
7598 ///
7599 /// # Example
7600 /// ```ignore,no_run
7601 /// # use google_cloud_storage::model::bucket::Autoclass;
7602 /// use wkt::Timestamp;
7603 /// let x = Autoclass::new().set_toggle_time(Timestamp::default()/* use setters */);
7604 /// ```
7605 pub fn set_toggle_time<T>(mut self, v: T) -> Self
7606 where
7607 T: std::convert::Into<wkt::Timestamp>,
7608 {
7609 self.toggle_time = std::option::Option::Some(v.into());
7610 self
7611 }
7612
7613 /// Sets or clears the value of [toggle_time][crate::model::bucket::Autoclass::toggle_time].
7614 ///
7615 /// # Example
7616 /// ```ignore,no_run
7617 /// # use google_cloud_storage::model::bucket::Autoclass;
7618 /// use wkt::Timestamp;
7619 /// let x = Autoclass::new().set_or_clear_toggle_time(Some(Timestamp::default()/* use setters */));
7620 /// let x = Autoclass::new().set_or_clear_toggle_time(None::<Timestamp>);
7621 /// ```
7622 pub fn set_or_clear_toggle_time<T>(mut self, v: std::option::Option<T>) -> Self
7623 where
7624 T: std::convert::Into<wkt::Timestamp>,
7625 {
7626 self.toggle_time = v.map(|x| x.into());
7627 self
7628 }
7629
7630 /// Sets the value of [terminal_storage_class][crate::model::bucket::Autoclass::terminal_storage_class].
7631 ///
7632 /// # Example
7633 /// ```ignore,no_run
7634 /// # use google_cloud_storage::model::bucket::Autoclass;
7635 /// let x = Autoclass::new().set_terminal_storage_class("example");
7636 /// ```
7637 pub fn set_terminal_storage_class<T>(mut self, v: T) -> Self
7638 where
7639 T: std::convert::Into<std::string::String>,
7640 {
7641 self.terminal_storage_class = std::option::Option::Some(v.into());
7642 self
7643 }
7644
7645 /// Sets or clears the value of [terminal_storage_class][crate::model::bucket::Autoclass::terminal_storage_class].
7646 ///
7647 /// # Example
7648 /// ```ignore,no_run
7649 /// # use google_cloud_storage::model::bucket::Autoclass;
7650 /// let x = Autoclass::new().set_or_clear_terminal_storage_class(Some("example"));
7651 /// let x = Autoclass::new().set_or_clear_terminal_storage_class(None::<String>);
7652 /// ```
7653 pub fn set_or_clear_terminal_storage_class<T>(mut self, v: std::option::Option<T>) -> Self
7654 where
7655 T: std::convert::Into<std::string::String>,
7656 {
7657 self.terminal_storage_class = v.map(|x| x.into());
7658 self
7659 }
7660
7661 /// Sets the value of [terminal_storage_class_update_time][crate::model::bucket::Autoclass::terminal_storage_class_update_time].
7662 ///
7663 /// # Example
7664 /// ```ignore,no_run
7665 /// # use google_cloud_storage::model::bucket::Autoclass;
7666 /// use wkt::Timestamp;
7667 /// let x = Autoclass::new().set_terminal_storage_class_update_time(Timestamp::default()/* use setters */);
7668 /// ```
7669 pub fn set_terminal_storage_class_update_time<T>(mut self, v: T) -> Self
7670 where
7671 T: std::convert::Into<wkt::Timestamp>,
7672 {
7673 self.terminal_storage_class_update_time = std::option::Option::Some(v.into());
7674 self
7675 }
7676
7677 /// Sets or clears the value of [terminal_storage_class_update_time][crate::model::bucket::Autoclass::terminal_storage_class_update_time].
7678 ///
7679 /// # Example
7680 /// ```ignore,no_run
7681 /// # use google_cloud_storage::model::bucket::Autoclass;
7682 /// use wkt::Timestamp;
7683 /// let x = Autoclass::new().set_or_clear_terminal_storage_class_update_time(Some(Timestamp::default()/* use setters */));
7684 /// let x = Autoclass::new().set_or_clear_terminal_storage_class_update_time(None::<Timestamp>);
7685 /// ```
7686 pub fn set_or_clear_terminal_storage_class_update_time<T>(
7687 mut self,
7688 v: std::option::Option<T>,
7689 ) -> Self
7690 where
7691 T: std::convert::Into<wkt::Timestamp>,
7692 {
7693 self.terminal_storage_class_update_time = v.map(|x| x.into());
7694 self
7695 }
7696 }
7697
7698 impl wkt::message::Message for Autoclass {
7699 fn typename() -> &'static str {
7700 "type.googleapis.com/google.storage.v2.Bucket.Autoclass"
7701 }
7702 }
7703
7704 /// The [bucket IP
7705 /// filtering](https://cloud.google.com/storage/docs/ip-filtering-overview)
7706 /// configuration. Specifies the network sources that can access the bucket, as
7707 /// well as its underlying objects.
7708 #[derive(Clone, Default, PartialEq)]
7709 #[non_exhaustive]
7710 pub struct IpFilter {
7711 /// The state of the IP filter configuration. Valid values are `Enabled` and
7712 /// `Disabled`. When set to `Enabled`, IP filtering rules are applied to a
7713 /// bucket and all incoming requests to the bucket are evaluated against
7714 /// these rules. When set to `Disabled`, IP filtering rules are not applied
7715 /// to a bucket.
7716 pub mode: std::option::Option<std::string::String>,
7717
7718 /// Public IPs allowed to operate or access the bucket.
7719 pub public_network_source:
7720 std::option::Option<crate::model::bucket::ip_filter::PublicNetworkSource>,
7721
7722 /// Optional. The list of network sources that are allowed to access
7723 /// operations on the bucket or the underlying objects.
7724 pub vpc_network_sources: std::vec::Vec<crate::model::bucket::ip_filter::VpcNetworkSource>,
7725
7726 /// Optional. Whether or not to allow VPCs from orgs different than the
7727 /// bucket's parent org to access the bucket. When set to true, validations
7728 /// on the existence of the VPCs won't be performed. If set to false, each
7729 /// VPC network source is checked to belong to the same org as the bucket as
7730 /// well as validated for existence.
7731 pub allow_cross_org_vpcs: bool,
7732
7733 /// Whether or not to allow all P4SA access to the bucket. When set to true,
7734 /// IP filter config validation doesn't apply.
7735 pub allow_all_service_agent_access: std::option::Option<bool>,
7736
7737 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
7738 }
7739
7740 impl IpFilter {
7741 /// Creates a new default instance.
7742 pub fn new() -> Self {
7743 std::default::Default::default()
7744 }
7745
7746 /// Sets the value of [mode][crate::model::bucket::IpFilter::mode].
7747 ///
7748 /// # Example
7749 /// ```ignore,no_run
7750 /// # use google_cloud_storage::model::bucket::IpFilter;
7751 /// let x = IpFilter::new().set_mode("example");
7752 /// ```
7753 pub fn set_mode<T>(mut self, v: T) -> Self
7754 where
7755 T: std::convert::Into<std::string::String>,
7756 {
7757 self.mode = std::option::Option::Some(v.into());
7758 self
7759 }
7760
7761 /// Sets or clears the value of [mode][crate::model::bucket::IpFilter::mode].
7762 ///
7763 /// # Example
7764 /// ```ignore,no_run
7765 /// # use google_cloud_storage::model::bucket::IpFilter;
7766 /// let x = IpFilter::new().set_or_clear_mode(Some("example"));
7767 /// let x = IpFilter::new().set_or_clear_mode(None::<String>);
7768 /// ```
7769 pub fn set_or_clear_mode<T>(mut self, v: std::option::Option<T>) -> Self
7770 where
7771 T: std::convert::Into<std::string::String>,
7772 {
7773 self.mode = v.map(|x| x.into());
7774 self
7775 }
7776
7777 /// Sets the value of [public_network_source][crate::model::bucket::IpFilter::public_network_source].
7778 ///
7779 /// # Example
7780 /// ```ignore,no_run
7781 /// # use google_cloud_storage::model::bucket::IpFilter;
7782 /// use google_cloud_storage::model::bucket::ip_filter::PublicNetworkSource;
7783 /// let x = IpFilter::new().set_public_network_source(PublicNetworkSource::default()/* use setters */);
7784 /// ```
7785 pub fn set_public_network_source<T>(mut self, v: T) -> Self
7786 where
7787 T: std::convert::Into<crate::model::bucket::ip_filter::PublicNetworkSource>,
7788 {
7789 self.public_network_source = std::option::Option::Some(v.into());
7790 self
7791 }
7792
7793 /// Sets or clears the value of [public_network_source][crate::model::bucket::IpFilter::public_network_source].
7794 ///
7795 /// # Example
7796 /// ```ignore,no_run
7797 /// # use google_cloud_storage::model::bucket::IpFilter;
7798 /// use google_cloud_storage::model::bucket::ip_filter::PublicNetworkSource;
7799 /// let x = IpFilter::new().set_or_clear_public_network_source(Some(PublicNetworkSource::default()/* use setters */));
7800 /// let x = IpFilter::new().set_or_clear_public_network_source(None::<PublicNetworkSource>);
7801 /// ```
7802 pub fn set_or_clear_public_network_source<T>(mut self, v: std::option::Option<T>) -> Self
7803 where
7804 T: std::convert::Into<crate::model::bucket::ip_filter::PublicNetworkSource>,
7805 {
7806 self.public_network_source = v.map(|x| x.into());
7807 self
7808 }
7809
7810 /// Sets the value of [vpc_network_sources][crate::model::bucket::IpFilter::vpc_network_sources].
7811 ///
7812 /// # Example
7813 /// ```ignore,no_run
7814 /// # use google_cloud_storage::model::bucket::IpFilter;
7815 /// use google_cloud_storage::model::bucket::ip_filter::VpcNetworkSource;
7816 /// let x = IpFilter::new()
7817 /// .set_vpc_network_sources([
7818 /// VpcNetworkSource::default()/* use setters */,
7819 /// VpcNetworkSource::default()/* use (different) setters */,
7820 /// ]);
7821 /// ```
7822 pub fn set_vpc_network_sources<T, V>(mut self, v: T) -> Self
7823 where
7824 T: std::iter::IntoIterator<Item = V>,
7825 V: std::convert::Into<crate::model::bucket::ip_filter::VpcNetworkSource>,
7826 {
7827 use std::iter::Iterator;
7828 self.vpc_network_sources = v.into_iter().map(|i| i.into()).collect();
7829 self
7830 }
7831
7832 /// Sets the value of [allow_cross_org_vpcs][crate::model::bucket::IpFilter::allow_cross_org_vpcs].
7833 ///
7834 /// # Example
7835 /// ```ignore,no_run
7836 /// # use google_cloud_storage::model::bucket::IpFilter;
7837 /// let x = IpFilter::new().set_allow_cross_org_vpcs(true);
7838 /// ```
7839 pub fn set_allow_cross_org_vpcs<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
7840 self.allow_cross_org_vpcs = v.into();
7841 self
7842 }
7843
7844 /// Sets the value of [allow_all_service_agent_access][crate::model::bucket::IpFilter::allow_all_service_agent_access].
7845 ///
7846 /// # Example
7847 /// ```ignore,no_run
7848 /// # use google_cloud_storage::model::bucket::IpFilter;
7849 /// let x = IpFilter::new().set_allow_all_service_agent_access(true);
7850 /// ```
7851 pub fn set_allow_all_service_agent_access<T>(mut self, v: T) -> Self
7852 where
7853 T: std::convert::Into<bool>,
7854 {
7855 self.allow_all_service_agent_access = std::option::Option::Some(v.into());
7856 self
7857 }
7858
7859 /// Sets or clears the value of [allow_all_service_agent_access][crate::model::bucket::IpFilter::allow_all_service_agent_access].
7860 ///
7861 /// # Example
7862 /// ```ignore,no_run
7863 /// # use google_cloud_storage::model::bucket::IpFilter;
7864 /// let x = IpFilter::new().set_or_clear_allow_all_service_agent_access(Some(false));
7865 /// let x = IpFilter::new().set_or_clear_allow_all_service_agent_access(None::<bool>);
7866 /// ```
7867 pub fn set_or_clear_allow_all_service_agent_access<T>(
7868 mut self,
7869 v: std::option::Option<T>,
7870 ) -> Self
7871 where
7872 T: std::convert::Into<bool>,
7873 {
7874 self.allow_all_service_agent_access = v.map(|x| x.into());
7875 self
7876 }
7877 }
7878
7879 impl wkt::message::Message for IpFilter {
7880 fn typename() -> &'static str {
7881 "type.googleapis.com/google.storage.v2.Bucket.IpFilter"
7882 }
7883 }
7884
7885 /// Defines additional types related to [IpFilter].
7886 pub mod ip_filter {
7887 #[allow(unused_imports)]
7888 use super::*;
7889
7890 /// The public network IP address ranges that can access the bucket and its
7891 /// data.
7892 #[derive(Clone, Default, PartialEq)]
7893 #[non_exhaustive]
7894 pub struct PublicNetworkSource {
7895 /// Optional. The list of IPv4 and IPv6 cidr blocks that are allowed to
7896 /// operate or access the bucket and its underlying objects.
7897 pub allowed_ip_cidr_ranges: std::vec::Vec<std::string::String>,
7898
7899 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
7900 }
7901
7902 impl PublicNetworkSource {
7903 /// Creates a new default instance.
7904 pub fn new() -> Self {
7905 std::default::Default::default()
7906 }
7907
7908 /// Sets the value of [allowed_ip_cidr_ranges][crate::model::bucket::ip_filter::PublicNetworkSource::allowed_ip_cidr_ranges].
7909 ///
7910 /// # Example
7911 /// ```ignore,no_run
7912 /// # use google_cloud_storage::model::bucket::ip_filter::PublicNetworkSource;
7913 /// let x = PublicNetworkSource::new().set_allowed_ip_cidr_ranges(["a", "b", "c"]);
7914 /// ```
7915 pub fn set_allowed_ip_cidr_ranges<T, V>(mut self, v: T) -> Self
7916 where
7917 T: std::iter::IntoIterator<Item = V>,
7918 V: std::convert::Into<std::string::String>,
7919 {
7920 use std::iter::Iterator;
7921 self.allowed_ip_cidr_ranges = v.into_iter().map(|i| i.into()).collect();
7922 self
7923 }
7924 }
7925
7926 impl wkt::message::Message for PublicNetworkSource {
7927 fn typename() -> &'static str {
7928 "type.googleapis.com/google.storage.v2.Bucket.IpFilter.PublicNetworkSource"
7929 }
7930 }
7931
7932 /// The list of VPC networks that can access the bucket.
7933 #[derive(Clone, Default, PartialEq)]
7934 #[non_exhaustive]
7935 pub struct VpcNetworkSource {
7936 /// Name of the network.
7937 ///
7938 /// Format: `projects/PROJECT_ID/global/networks/NETWORK_NAME`
7939 pub network: std::option::Option<std::string::String>,
7940
7941 /// Optional. The list of public or private IPv4 and IPv6 CIDR ranges that
7942 /// can access the bucket. In the CIDR IP address block, the specified IP
7943 /// address must be properly truncated, meaning all the host bits must be
7944 /// zero or else the input is considered malformed. For example,
7945 /// `192.0.2.0/24` is accepted but `192.0.2.1/24` is not. Similarly, for
7946 /// IPv6, `2001:db8::/32` is accepted whereas `2001:db8::1/32` is not.
7947 pub allowed_ip_cidr_ranges: std::vec::Vec<std::string::String>,
7948
7949 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
7950 }
7951
7952 impl VpcNetworkSource {
7953 /// Creates a new default instance.
7954 pub fn new() -> Self {
7955 std::default::Default::default()
7956 }
7957
7958 /// Sets the value of [network][crate::model::bucket::ip_filter::VpcNetworkSource::network].
7959 ///
7960 /// # Example
7961 /// ```ignore,no_run
7962 /// # use google_cloud_storage::model::bucket::ip_filter::VpcNetworkSource;
7963 /// let x = VpcNetworkSource::new().set_network("example");
7964 /// ```
7965 pub fn set_network<T>(mut self, v: T) -> Self
7966 where
7967 T: std::convert::Into<std::string::String>,
7968 {
7969 self.network = std::option::Option::Some(v.into());
7970 self
7971 }
7972
7973 /// Sets or clears the value of [network][crate::model::bucket::ip_filter::VpcNetworkSource::network].
7974 ///
7975 /// # Example
7976 /// ```ignore,no_run
7977 /// # use google_cloud_storage::model::bucket::ip_filter::VpcNetworkSource;
7978 /// let x = VpcNetworkSource::new().set_or_clear_network(Some("example"));
7979 /// let x = VpcNetworkSource::new().set_or_clear_network(None::<String>);
7980 /// ```
7981 pub fn set_or_clear_network<T>(mut self, v: std::option::Option<T>) -> Self
7982 where
7983 T: std::convert::Into<std::string::String>,
7984 {
7985 self.network = v.map(|x| x.into());
7986 self
7987 }
7988
7989 /// Sets the value of [allowed_ip_cidr_ranges][crate::model::bucket::ip_filter::VpcNetworkSource::allowed_ip_cidr_ranges].
7990 ///
7991 /// # Example
7992 /// ```ignore,no_run
7993 /// # use google_cloud_storage::model::bucket::ip_filter::VpcNetworkSource;
7994 /// let x = VpcNetworkSource::new().set_allowed_ip_cidr_ranges(["a", "b", "c"]);
7995 /// ```
7996 pub fn set_allowed_ip_cidr_ranges<T, V>(mut self, v: T) -> Self
7997 where
7998 T: std::iter::IntoIterator<Item = V>,
7999 V: std::convert::Into<std::string::String>,
8000 {
8001 use std::iter::Iterator;
8002 self.allowed_ip_cidr_ranges = v.into_iter().map(|i| i.into()).collect();
8003 self
8004 }
8005 }
8006
8007 impl wkt::message::Message for VpcNetworkSource {
8008 fn typename() -> &'static str {
8009 "type.googleapis.com/google.storage.v2.Bucket.IpFilter.VpcNetworkSource"
8010 }
8011 }
8012 }
8013
8014 /// Configuration for a bucket's hierarchical namespace feature.
8015 #[derive(Clone, Default, PartialEq)]
8016 #[non_exhaustive]
8017 pub struct HierarchicalNamespace {
8018 /// Optional. Enables the hierarchical namespace feature.
8019 pub enabled: bool,
8020
8021 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
8022 }
8023
8024 impl HierarchicalNamespace {
8025 /// Creates a new default instance.
8026 pub fn new() -> Self {
8027 std::default::Default::default()
8028 }
8029
8030 /// Sets the value of [enabled][crate::model::bucket::HierarchicalNamespace::enabled].
8031 ///
8032 /// # Example
8033 /// ```ignore,no_run
8034 /// # use google_cloud_storage::model::bucket::HierarchicalNamespace;
8035 /// let x = HierarchicalNamespace::new().set_enabled(true);
8036 /// ```
8037 pub fn set_enabled<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
8038 self.enabled = v.into();
8039 self
8040 }
8041 }
8042
8043 impl wkt::message::Message for HierarchicalNamespace {
8044 fn typename() -> &'static str {
8045 "type.googleapis.com/google.storage.v2.Bucket.HierarchicalNamespace"
8046 }
8047 }
8048}
8049
8050/// An access-control entry.
8051#[derive(Clone, Default, PartialEq)]
8052#[non_exhaustive]
8053pub struct BucketAccessControl {
8054 /// Optional. The access permission for the entity.
8055 pub role: std::string::String,
8056
8057 /// Optional. The ID of the access-control entry.
8058 pub id: std::string::String,
8059
8060 /// Optional. The entity holding the permission, in one of the following forms:
8061 ///
8062 /// * `user-{userid}`
8063 /// * `user-{email}`
8064 /// * `group-{groupid}`
8065 /// * `group-{email}`
8066 /// * `domain-{domain}`
8067 /// * `project-{team}-{projectnumber}`
8068 /// * `project-{team}-{projectid}`
8069 /// * `allUsers`
8070 /// * `allAuthenticatedUsers`
8071 /// Examples:
8072 /// * The user `liz@example.com` would be `user-liz@example.com`.
8073 /// * The group `example@googlegroups.com` would be
8074 /// `group-example@googlegroups.com`
8075 /// * All members of the Google Apps for Business domain `example.com` would be
8076 /// `domain-example.com`
8077 /// For project entities, `project-{team}-{projectnumber}` format is
8078 /// returned on response.
8079 pub entity: std::string::String,
8080
8081 /// Output only. The alternative entity format, if exists. For project
8082 /// entities, `project-{team}-{projectid}` format is returned in the response.
8083 pub entity_alt: std::string::String,
8084
8085 /// Optional. The ID for the entity, if any.
8086 pub entity_id: std::string::String,
8087
8088 /// Optional. The `etag` of the `BucketAccessControl`.
8089 /// If included in the metadata of an update or delete request message, the
8090 /// operation operation is only performed if the etag matches that of the
8091 /// bucket's `BucketAccessControl`.
8092 pub etag: std::string::String,
8093
8094 /// Optional. The email address associated with the entity, if any.
8095 pub email: std::string::String,
8096
8097 /// Optional. The domain associated with the entity, if any.
8098 pub domain: std::string::String,
8099
8100 /// Optional. The project team associated with the entity, if any.
8101 pub project_team: std::option::Option<crate::model::ProjectTeam>,
8102
8103 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
8104}
8105
8106impl BucketAccessControl {
8107 /// Creates a new default instance.
8108 pub fn new() -> Self {
8109 std::default::Default::default()
8110 }
8111
8112 /// Sets the value of [role][crate::model::BucketAccessControl::role].
8113 ///
8114 /// # Example
8115 /// ```ignore,no_run
8116 /// # use google_cloud_storage::model::BucketAccessControl;
8117 /// let x = BucketAccessControl::new().set_role("example");
8118 /// ```
8119 pub fn set_role<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
8120 self.role = v.into();
8121 self
8122 }
8123
8124 /// Sets the value of [id][crate::model::BucketAccessControl::id].
8125 ///
8126 /// # Example
8127 /// ```ignore,no_run
8128 /// # use google_cloud_storage::model::BucketAccessControl;
8129 /// let x = BucketAccessControl::new().set_id("example");
8130 /// ```
8131 pub fn set_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
8132 self.id = v.into();
8133 self
8134 }
8135
8136 /// Sets the value of [entity][crate::model::BucketAccessControl::entity].
8137 ///
8138 /// # Example
8139 /// ```ignore,no_run
8140 /// # use google_cloud_storage::model::BucketAccessControl;
8141 /// let x = BucketAccessControl::new().set_entity("example");
8142 /// ```
8143 pub fn set_entity<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
8144 self.entity = v.into();
8145 self
8146 }
8147
8148 /// Sets the value of [entity_alt][crate::model::BucketAccessControl::entity_alt].
8149 ///
8150 /// # Example
8151 /// ```ignore,no_run
8152 /// # use google_cloud_storage::model::BucketAccessControl;
8153 /// let x = BucketAccessControl::new().set_entity_alt("example");
8154 /// ```
8155 pub fn set_entity_alt<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
8156 self.entity_alt = v.into();
8157 self
8158 }
8159
8160 /// Sets the value of [entity_id][crate::model::BucketAccessControl::entity_id].
8161 ///
8162 /// # Example
8163 /// ```ignore,no_run
8164 /// # use google_cloud_storage::model::BucketAccessControl;
8165 /// let x = BucketAccessControl::new().set_entity_id("example");
8166 /// ```
8167 pub fn set_entity_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
8168 self.entity_id = v.into();
8169 self
8170 }
8171
8172 /// Sets the value of [etag][crate::model::BucketAccessControl::etag].
8173 ///
8174 /// # Example
8175 /// ```ignore,no_run
8176 /// # use google_cloud_storage::model::BucketAccessControl;
8177 /// let x = BucketAccessControl::new().set_etag("example");
8178 /// ```
8179 pub fn set_etag<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
8180 self.etag = v.into();
8181 self
8182 }
8183
8184 /// Sets the value of [email][crate::model::BucketAccessControl::email].
8185 ///
8186 /// # Example
8187 /// ```ignore,no_run
8188 /// # use google_cloud_storage::model::BucketAccessControl;
8189 /// let x = BucketAccessControl::new().set_email("example");
8190 /// ```
8191 pub fn set_email<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
8192 self.email = v.into();
8193 self
8194 }
8195
8196 /// Sets the value of [domain][crate::model::BucketAccessControl::domain].
8197 ///
8198 /// # Example
8199 /// ```ignore,no_run
8200 /// # use google_cloud_storage::model::BucketAccessControl;
8201 /// let x = BucketAccessControl::new().set_domain("example");
8202 /// ```
8203 pub fn set_domain<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
8204 self.domain = v.into();
8205 self
8206 }
8207
8208 /// Sets the value of [project_team][crate::model::BucketAccessControl::project_team].
8209 ///
8210 /// # Example
8211 /// ```ignore,no_run
8212 /// # use google_cloud_storage::model::BucketAccessControl;
8213 /// use google_cloud_storage::model::ProjectTeam;
8214 /// let x = BucketAccessControl::new().set_project_team(ProjectTeam::default()/* use setters */);
8215 /// ```
8216 pub fn set_project_team<T>(mut self, v: T) -> Self
8217 where
8218 T: std::convert::Into<crate::model::ProjectTeam>,
8219 {
8220 self.project_team = std::option::Option::Some(v.into());
8221 self
8222 }
8223
8224 /// Sets or clears the value of [project_team][crate::model::BucketAccessControl::project_team].
8225 ///
8226 /// # Example
8227 /// ```ignore,no_run
8228 /// # use google_cloud_storage::model::BucketAccessControl;
8229 /// use google_cloud_storage::model::ProjectTeam;
8230 /// let x = BucketAccessControl::new().set_or_clear_project_team(Some(ProjectTeam::default()/* use setters */));
8231 /// let x = BucketAccessControl::new().set_or_clear_project_team(None::<ProjectTeam>);
8232 /// ```
8233 pub fn set_or_clear_project_team<T>(mut self, v: std::option::Option<T>) -> Self
8234 where
8235 T: std::convert::Into<crate::model::ProjectTeam>,
8236 {
8237 self.project_team = v.map(|x| x.into());
8238 self
8239 }
8240}
8241
8242impl wkt::message::Message for BucketAccessControl {
8243 fn typename() -> &'static str {
8244 "type.googleapis.com/google.storage.v2.BucketAccessControl"
8245 }
8246}
8247
8248/// Message used for storing full (not subrange) object checksums.
8249#[derive(Clone, Default, PartialEq)]
8250#[non_exhaustive]
8251pub struct ObjectChecksums {
8252 /// CRC32C digest of the object data. Computed by the Cloud Storage service for
8253 /// all written objects.
8254 /// If set in a WriteObjectRequest, service validates that the stored
8255 /// object matches this checksum.
8256 pub crc32c: std::option::Option<u32>,
8257
8258 /// Optional. 128 bit MD5 hash of the object data. For more information about
8259 /// using the MD5 hash, see [Data validation and change
8260 /// detection](https://cloud.google.com/storage/docs/data-validation). Not all
8261 /// objects provide an MD5 hash. For example, composite objects provide only
8262 /// crc32c hashes. This value is equivalent to running `cat object.txt |
8263 /// openssl md5 -binary`
8264 pub md5_hash: ::bytes::Bytes,
8265
8266 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
8267}
8268
8269impl ObjectChecksums {
8270 /// Creates a new default instance.
8271 pub fn new() -> Self {
8272 std::default::Default::default()
8273 }
8274
8275 /// Sets the value of [crc32c][crate::model::ObjectChecksums::crc32c].
8276 ///
8277 /// # Example
8278 /// ```ignore,no_run
8279 /// # use google_cloud_storage::model::ObjectChecksums;
8280 /// let x = ObjectChecksums::new().set_crc32c(42_u32);
8281 /// ```
8282 pub fn set_crc32c<T>(mut self, v: T) -> Self
8283 where
8284 T: std::convert::Into<u32>,
8285 {
8286 self.crc32c = std::option::Option::Some(v.into());
8287 self
8288 }
8289
8290 /// Sets or clears the value of [crc32c][crate::model::ObjectChecksums::crc32c].
8291 ///
8292 /// # Example
8293 /// ```ignore,no_run
8294 /// # use google_cloud_storage::model::ObjectChecksums;
8295 /// let x = ObjectChecksums::new().set_or_clear_crc32c(Some(42_u32));
8296 /// let x = ObjectChecksums::new().set_or_clear_crc32c(None::<u32>);
8297 /// ```
8298 pub fn set_or_clear_crc32c<T>(mut self, v: std::option::Option<T>) -> Self
8299 where
8300 T: std::convert::Into<u32>,
8301 {
8302 self.crc32c = v.map(|x| x.into());
8303 self
8304 }
8305
8306 /// Sets the value of [md5_hash][crate::model::ObjectChecksums::md5_hash].
8307 ///
8308 /// # Example
8309 /// ```ignore,no_run
8310 /// # use google_cloud_storage::model::ObjectChecksums;
8311 /// let x = ObjectChecksums::new().set_md5_hash(bytes::Bytes::from_static(b"example"));
8312 /// ```
8313 pub fn set_md5_hash<T: std::convert::Into<::bytes::Bytes>>(mut self, v: T) -> Self {
8314 self.md5_hash = v.into();
8315 self
8316 }
8317}
8318
8319impl wkt::message::Message for ObjectChecksums {
8320 fn typename() -> &'static str {
8321 "type.googleapis.com/google.storage.v2.ObjectChecksums"
8322 }
8323}
8324
8325/// The payload of a single user-defined object context.
8326#[derive(Clone, Default, PartialEq)]
8327#[non_exhaustive]
8328pub struct ObjectCustomContextPayload {
8329 /// Required. The value of the object context.
8330 pub value: std::string::String,
8331
8332 /// Output only. The time at which the object context was created.
8333 pub create_time: std::option::Option<wkt::Timestamp>,
8334
8335 /// Output only. The time at which the object context was last updated.
8336 pub update_time: std::option::Option<wkt::Timestamp>,
8337
8338 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
8339}
8340
8341impl ObjectCustomContextPayload {
8342 /// Creates a new default instance.
8343 pub fn new() -> Self {
8344 std::default::Default::default()
8345 }
8346
8347 /// Sets the value of [value][crate::model::ObjectCustomContextPayload::value].
8348 ///
8349 /// # Example
8350 /// ```ignore,no_run
8351 /// # use google_cloud_storage::model::ObjectCustomContextPayload;
8352 /// let x = ObjectCustomContextPayload::new().set_value("example");
8353 /// ```
8354 pub fn set_value<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
8355 self.value = v.into();
8356 self
8357 }
8358
8359 /// Sets the value of [create_time][crate::model::ObjectCustomContextPayload::create_time].
8360 ///
8361 /// # Example
8362 /// ```ignore,no_run
8363 /// # use google_cloud_storage::model::ObjectCustomContextPayload;
8364 /// use wkt::Timestamp;
8365 /// let x = ObjectCustomContextPayload::new().set_create_time(Timestamp::default()/* use setters */);
8366 /// ```
8367 pub fn set_create_time<T>(mut self, v: T) -> Self
8368 where
8369 T: std::convert::Into<wkt::Timestamp>,
8370 {
8371 self.create_time = std::option::Option::Some(v.into());
8372 self
8373 }
8374
8375 /// Sets or clears the value of [create_time][crate::model::ObjectCustomContextPayload::create_time].
8376 ///
8377 /// # Example
8378 /// ```ignore,no_run
8379 /// # use google_cloud_storage::model::ObjectCustomContextPayload;
8380 /// use wkt::Timestamp;
8381 /// let x = ObjectCustomContextPayload::new().set_or_clear_create_time(Some(Timestamp::default()/* use setters */));
8382 /// let x = ObjectCustomContextPayload::new().set_or_clear_create_time(None::<Timestamp>);
8383 /// ```
8384 pub fn set_or_clear_create_time<T>(mut self, v: std::option::Option<T>) -> Self
8385 where
8386 T: std::convert::Into<wkt::Timestamp>,
8387 {
8388 self.create_time = v.map(|x| x.into());
8389 self
8390 }
8391
8392 /// Sets the value of [update_time][crate::model::ObjectCustomContextPayload::update_time].
8393 ///
8394 /// # Example
8395 /// ```ignore,no_run
8396 /// # use google_cloud_storage::model::ObjectCustomContextPayload;
8397 /// use wkt::Timestamp;
8398 /// let x = ObjectCustomContextPayload::new().set_update_time(Timestamp::default()/* use setters */);
8399 /// ```
8400 pub fn set_update_time<T>(mut self, v: T) -> Self
8401 where
8402 T: std::convert::Into<wkt::Timestamp>,
8403 {
8404 self.update_time = std::option::Option::Some(v.into());
8405 self
8406 }
8407
8408 /// Sets or clears the value of [update_time][crate::model::ObjectCustomContextPayload::update_time].
8409 ///
8410 /// # Example
8411 /// ```ignore,no_run
8412 /// # use google_cloud_storage::model::ObjectCustomContextPayload;
8413 /// use wkt::Timestamp;
8414 /// let x = ObjectCustomContextPayload::new().set_or_clear_update_time(Some(Timestamp::default()/* use setters */));
8415 /// let x = ObjectCustomContextPayload::new().set_or_clear_update_time(None::<Timestamp>);
8416 /// ```
8417 pub fn set_or_clear_update_time<T>(mut self, v: std::option::Option<T>) -> Self
8418 where
8419 T: std::convert::Into<wkt::Timestamp>,
8420 {
8421 self.update_time = v.map(|x| x.into());
8422 self
8423 }
8424}
8425
8426impl wkt::message::Message for ObjectCustomContextPayload {
8427 fn typename() -> &'static str {
8428 "type.googleapis.com/google.storage.v2.ObjectCustomContextPayload"
8429 }
8430}
8431
8432/// All contexts of an object grouped by type.
8433#[derive(Clone, Default, PartialEq)]
8434#[non_exhaustive]
8435pub struct ObjectContexts {
8436 /// Optional. User-defined object contexts.
8437 /// The maximum key or value size is `256` characters.
8438 /// The maximum number of entries is `50`.
8439 /// The maximum total serialized size of all entries is `25KiB`.
8440 pub custom:
8441 std::collections::HashMap<std::string::String, crate::model::ObjectCustomContextPayload>,
8442
8443 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
8444}
8445
8446impl ObjectContexts {
8447 /// Creates a new default instance.
8448 pub fn new() -> Self {
8449 std::default::Default::default()
8450 }
8451
8452 /// Sets the value of [custom][crate::model::ObjectContexts::custom].
8453 ///
8454 /// # Example
8455 /// ```ignore,no_run
8456 /// # use google_cloud_storage::model::ObjectContexts;
8457 /// use google_cloud_storage::model::ObjectCustomContextPayload;
8458 /// let x = ObjectContexts::new().set_custom([
8459 /// ("key0", ObjectCustomContextPayload::default()/* use setters */),
8460 /// ("key1", ObjectCustomContextPayload::default()/* use (different) setters */),
8461 /// ]);
8462 /// ```
8463 pub fn set_custom<T, K, V>(mut self, v: T) -> Self
8464 where
8465 T: std::iter::IntoIterator<Item = (K, V)>,
8466 K: std::convert::Into<std::string::String>,
8467 V: std::convert::Into<crate::model::ObjectCustomContextPayload>,
8468 {
8469 use std::iter::Iterator;
8470 self.custom = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
8471 self
8472 }
8473}
8474
8475impl wkt::message::Message for ObjectContexts {
8476 fn typename() -> &'static str {
8477 "type.googleapis.com/google.storage.v2.ObjectContexts"
8478 }
8479}
8480
8481/// Describes the customer-supplied encryption key mechanism used to store an
8482/// object's data at rest.
8483#[derive(Clone, Default, PartialEq)]
8484#[non_exhaustive]
8485pub struct CustomerEncryption {
8486 /// Optional. The encryption algorithm.
8487 pub encryption_algorithm: std::string::String,
8488
8489 /// Optional. SHA256 hash value of the encryption key.
8490 /// In raw bytes format (not base64-encoded).
8491 pub key_sha256_bytes: ::bytes::Bytes,
8492
8493 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
8494}
8495
8496impl CustomerEncryption {
8497 /// Creates a new default instance.
8498 pub fn new() -> Self {
8499 std::default::Default::default()
8500 }
8501
8502 /// Sets the value of [encryption_algorithm][crate::model::CustomerEncryption::encryption_algorithm].
8503 ///
8504 /// # Example
8505 /// ```ignore,no_run
8506 /// # use google_cloud_storage::model::CustomerEncryption;
8507 /// let x = CustomerEncryption::new().set_encryption_algorithm("example");
8508 /// ```
8509 pub fn set_encryption_algorithm<T: std::convert::Into<std::string::String>>(
8510 mut self,
8511 v: T,
8512 ) -> Self {
8513 self.encryption_algorithm = v.into();
8514 self
8515 }
8516
8517 /// Sets the value of [key_sha256_bytes][crate::model::CustomerEncryption::key_sha256_bytes].
8518 ///
8519 /// # Example
8520 /// ```ignore,no_run
8521 /// # use google_cloud_storage::model::CustomerEncryption;
8522 /// let x = CustomerEncryption::new().set_key_sha256_bytes(bytes::Bytes::from_static(b"example"));
8523 /// ```
8524 pub fn set_key_sha256_bytes<T: std::convert::Into<::bytes::Bytes>>(mut self, v: T) -> Self {
8525 self.key_sha256_bytes = v.into();
8526 self
8527 }
8528}
8529
8530impl wkt::message::Message for CustomerEncryption {
8531 fn typename() -> &'static str {
8532 "type.googleapis.com/google.storage.v2.CustomerEncryption"
8533 }
8534}
8535
8536/// An object.
8537#[derive(Clone, Default, PartialEq)]
8538#[non_exhaustive]
8539pub struct Object {
8540 /// Immutable. The name of this object. Nearly any sequence of unicode
8541 /// characters is valid. See
8542 /// [Guidelines](https://cloud.google.com/storage/docs/objects#naming).
8543 /// Example: `test.txt`
8544 /// The `name` field by itself does not uniquely identify a Cloud Storage
8545 /// object. A Cloud Storage object is uniquely identified by the tuple of
8546 /// (bucket, object, generation).
8547 pub name: std::string::String,
8548
8549 /// Immutable. The name of the bucket containing this object.
8550 pub bucket: std::string::String,
8551
8552 /// Optional. The `etag` of an object.
8553 /// If included in the metadata of an update or delete request message, the
8554 /// operation is only performed if the etag matches that of the live
8555 /// object.
8556 pub etag: std::string::String,
8557
8558 /// Immutable. The content generation of this object. Used for object
8559 /// versioning.
8560 pub generation: i64,
8561
8562 /// Output only. Restore token used to differentiate deleted objects with the
8563 /// same name and generation. This field is output only, and only set for
8564 /// deleted objects in HNS buckets.
8565 pub restore_token: std::option::Option<std::string::String>,
8566
8567 /// Output only. The version of the metadata for this generation of this
8568 /// object. Used for preconditions and for detecting changes in metadata. A
8569 /// metageneration number is only meaningful in the context of a particular
8570 /// generation of a particular object.
8571 pub metageneration: i64,
8572
8573 /// Optional. Storage class of the object.
8574 pub storage_class: std::string::String,
8575
8576 /// Output only. Content-Length of the object data in bytes, matching
8577 /// [RFC 7230 §3.3.2](<https://tools.ietf.org/html/rfc7230#section-3.3.2>]).
8578 pub size: i64,
8579
8580 /// Optional. Content-Encoding of the object data, matching
8581 /// [RFC 7231 §3.1.2.2](https://tools.ietf.org/html/rfc7231#section-3.1.2.2)
8582 pub content_encoding: std::string::String,
8583
8584 /// Optional. Content-Disposition of the object data, matching
8585 /// [RFC 6266](https://tools.ietf.org/html/rfc6266).
8586 pub content_disposition: std::string::String,
8587
8588 /// Optional. Cache-Control directive for the object data, matching
8589 /// [RFC 7234 §5.2](https://tools.ietf.org/html/rfc7234#section-5.2).
8590 /// If omitted, and the object is accessible to all anonymous users, the
8591 /// default is `public, max-age=3600`.
8592 pub cache_control: std::string::String,
8593
8594 /// Optional. Access controls on the object.
8595 /// If `iam_config.uniform_bucket_level_access` is enabled on the parent
8596 /// bucket, requests to set, read, or modify acl is an error.
8597 pub acl: std::vec::Vec<crate::model::ObjectAccessControl>,
8598
8599 /// Optional. Content-Language of the object data, matching
8600 /// [RFC 7231 §3.1.3.2](https://tools.ietf.org/html/rfc7231#section-3.1.3.2).
8601 pub content_language: std::string::String,
8602
8603 /// Output only. If this object is noncurrent, this is the time when the object
8604 /// became noncurrent.
8605 pub delete_time: std::option::Option<wkt::Timestamp>,
8606
8607 /// Output only. The time when the object was finalized.
8608 pub finalize_time: std::option::Option<wkt::Timestamp>,
8609
8610 /// Optional. Content-Type of the object data, matching
8611 /// [RFC 7231 §3.1.1.5](https://tools.ietf.org/html/rfc7231#section-3.1.1.5).
8612 /// If an object is stored without a Content-Type, it is served as
8613 /// `application/octet-stream`.
8614 pub content_type: std::string::String,
8615
8616 /// Output only. The creation time of the object.
8617 pub create_time: std::option::Option<wkt::Timestamp>,
8618
8619 /// Output only. Number of underlying components that make up this object.
8620 /// Components are accumulated by compose operations.
8621 pub component_count: i32,
8622
8623 /// Output only. Hashes for the data part of this object. This field is used
8624 /// for output only and is silently ignored if provided in requests. The
8625 /// checksums of the complete object regardless of data range. If the object is
8626 /// downloaded in full, the client should compute one of these checksums over
8627 /// the downloaded object and compare it against the value provided here.
8628 pub checksums: std::option::Option<crate::model::ObjectChecksums>,
8629
8630 /// Output only. The modification time of the object metadata.
8631 /// Set initially to object creation time and then updated whenever any
8632 /// metadata of the object changes. This includes changes made by a requester,
8633 /// such as modifying custom metadata, as well as changes made by Cloud Storage
8634 /// on behalf of a requester, such as changing the storage class based on an
8635 /// Object Lifecycle Configuration.
8636 pub update_time: std::option::Option<wkt::Timestamp>,
8637
8638 /// Optional. Cloud KMS Key used to encrypt this object, if the object is
8639 /// encrypted by such a key.
8640 pub kms_key: std::string::String,
8641
8642 /// Output only. The time at which the object's storage class was last changed.
8643 /// When the object is initially created, it is set to `time_created`.
8644 pub update_storage_class_time: std::option::Option<wkt::Timestamp>,
8645
8646 /// Optional. Whether an object is under temporary hold. While this flag is set
8647 /// to true, the object is protected against deletion and overwrites. A common
8648 /// use case of this flag is regulatory investigations where objects need to be
8649 /// retained while the investigation is ongoing. Note that unlike event-based
8650 /// hold, temporary hold does not impact retention expiration time of an
8651 /// object.
8652 pub temporary_hold: bool,
8653
8654 /// Optional. A server-determined value that specifies the earliest time that
8655 /// the object's retention period expires. Note 1: This field is not provided
8656 /// for objects with an active event-based hold, since retention expiration is
8657 /// unknown until the hold is removed. Note 2: This value can be provided even
8658 /// when temporary hold is set (so that the user can reason about policy
8659 /// without having to first unset the temporary hold).
8660 pub retention_expire_time: std::option::Option<wkt::Timestamp>,
8661
8662 /// Optional. User-provided metadata, in key/value pairs.
8663 pub metadata: std::collections::HashMap<std::string::String, std::string::String>,
8664
8665 /// Optional. User-defined or system-defined object contexts. Each object
8666 /// context is a key-payload pair, where the key provides the identification
8667 /// and the payload holds the associated value and additional metadata.
8668 pub contexts: std::option::Option<crate::model::ObjectContexts>,
8669
8670 /// Whether an object is under event-based hold.
8671 /// An event-based hold is a way to force the retention of an object until
8672 /// after some event occurs. Once the hold is released by explicitly setting
8673 /// this field to `false`, the object becomes subject to any bucket-level
8674 /// retention policy, except that the retention duration is calculated
8675 /// from the time the event based hold was lifted, rather than the time the
8676 /// object was created.
8677 ///
8678 /// In a `WriteObject` request, not setting this field implies that the value
8679 /// should be taken from the parent bucket's `default_event_based_hold` field.
8680 /// In a response, this field is always set to `true` or `false`.
8681 pub event_based_hold: std::option::Option<bool>,
8682
8683 /// Output only. The owner of the object. This is always the uploader of the
8684 /// object.
8685 pub owner: std::option::Option<crate::model::Owner>,
8686
8687 /// Optional. Metadata of customer-supplied encryption key, if the object is
8688 /// encrypted by such a key.
8689 pub customer_encryption: std::option::Option<crate::model::CustomerEncryption>,
8690
8691 /// Optional. A user-specified timestamp set on an object.
8692 pub custom_time: std::option::Option<wkt::Timestamp>,
8693
8694 /// Output only. This is the time when the object became soft-deleted.
8695 ///
8696 /// Soft-deleted objects are only accessible if a soft_delete_policy is
8697 /// enabled. Also see `hard_delete_time`.
8698 pub soft_delete_time: std::option::Option<wkt::Timestamp>,
8699
8700 /// Output only. The time when the object is permanently deleted.
8701 ///
8702 /// Only set when an object becomes soft-deleted with a `soft_delete_policy`.
8703 /// Otherwise, the object is not accessible.
8704 pub hard_delete_time: std::option::Option<wkt::Timestamp>,
8705
8706 /// Optional. Retention configuration of this object.
8707 /// Might only be configured if the bucket has object retention enabled.
8708 pub retention: std::option::Option<crate::model::object::Retention>,
8709
8710 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
8711}
8712
8713impl Object {
8714 /// Creates a new default instance.
8715 pub fn new() -> Self {
8716 std::default::Default::default()
8717 }
8718
8719 /// Sets the value of [name][crate::model::Object::name].
8720 ///
8721 /// # Example
8722 /// ```ignore,no_run
8723 /// # use google_cloud_storage::model::Object;
8724 /// let x = Object::new().set_name("example");
8725 /// ```
8726 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
8727 self.name = v.into();
8728 self
8729 }
8730
8731 /// Sets the value of [bucket][crate::model::Object::bucket].
8732 ///
8733 /// # Example
8734 /// ```ignore,no_run
8735 /// # use google_cloud_storage::model::Object;
8736 /// let x = Object::new().set_bucket("example");
8737 /// ```
8738 pub fn set_bucket<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
8739 self.bucket = v.into();
8740 self
8741 }
8742
8743 /// Sets the value of [etag][crate::model::Object::etag].
8744 ///
8745 /// # Example
8746 /// ```ignore,no_run
8747 /// # use google_cloud_storage::model::Object;
8748 /// let x = Object::new().set_etag("example");
8749 /// ```
8750 pub fn set_etag<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
8751 self.etag = v.into();
8752 self
8753 }
8754
8755 /// Sets the value of [generation][crate::model::Object::generation].
8756 ///
8757 /// # Example
8758 /// ```ignore,no_run
8759 /// # use google_cloud_storage::model::Object;
8760 /// let x = Object::new().set_generation(42);
8761 /// ```
8762 pub fn set_generation<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
8763 self.generation = v.into();
8764 self
8765 }
8766
8767 /// Sets the value of [restore_token][crate::model::Object::restore_token].
8768 ///
8769 /// # Example
8770 /// ```ignore,no_run
8771 /// # use google_cloud_storage::model::Object;
8772 /// let x = Object::new().set_restore_token("example");
8773 /// ```
8774 pub fn set_restore_token<T>(mut self, v: T) -> Self
8775 where
8776 T: std::convert::Into<std::string::String>,
8777 {
8778 self.restore_token = std::option::Option::Some(v.into());
8779 self
8780 }
8781
8782 /// Sets or clears the value of [restore_token][crate::model::Object::restore_token].
8783 ///
8784 /// # Example
8785 /// ```ignore,no_run
8786 /// # use google_cloud_storage::model::Object;
8787 /// let x = Object::new().set_or_clear_restore_token(Some("example"));
8788 /// let x = Object::new().set_or_clear_restore_token(None::<String>);
8789 /// ```
8790 pub fn set_or_clear_restore_token<T>(mut self, v: std::option::Option<T>) -> Self
8791 where
8792 T: std::convert::Into<std::string::String>,
8793 {
8794 self.restore_token = v.map(|x| x.into());
8795 self
8796 }
8797
8798 /// Sets the value of [metageneration][crate::model::Object::metageneration].
8799 ///
8800 /// # Example
8801 /// ```ignore,no_run
8802 /// # use google_cloud_storage::model::Object;
8803 /// let x = Object::new().set_metageneration(42);
8804 /// ```
8805 pub fn set_metageneration<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
8806 self.metageneration = v.into();
8807 self
8808 }
8809
8810 /// Sets the value of [storage_class][crate::model::Object::storage_class].
8811 ///
8812 /// # Example
8813 /// ```ignore,no_run
8814 /// # use google_cloud_storage::model::Object;
8815 /// let x = Object::new().set_storage_class("example");
8816 /// ```
8817 pub fn set_storage_class<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
8818 self.storage_class = v.into();
8819 self
8820 }
8821
8822 /// Sets the value of [size][crate::model::Object::size].
8823 ///
8824 /// # Example
8825 /// ```ignore,no_run
8826 /// # use google_cloud_storage::model::Object;
8827 /// let x = Object::new().set_size(42);
8828 /// ```
8829 pub fn set_size<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
8830 self.size = v.into();
8831 self
8832 }
8833
8834 /// Sets the value of [content_encoding][crate::model::Object::content_encoding].
8835 ///
8836 /// # Example
8837 /// ```ignore,no_run
8838 /// # use google_cloud_storage::model::Object;
8839 /// let x = Object::new().set_content_encoding("example");
8840 /// ```
8841 pub fn set_content_encoding<T: std::convert::Into<std::string::String>>(
8842 mut self,
8843 v: T,
8844 ) -> Self {
8845 self.content_encoding = v.into();
8846 self
8847 }
8848
8849 /// Sets the value of [content_disposition][crate::model::Object::content_disposition].
8850 ///
8851 /// # Example
8852 /// ```ignore,no_run
8853 /// # use google_cloud_storage::model::Object;
8854 /// let x = Object::new().set_content_disposition("example");
8855 /// ```
8856 pub fn set_content_disposition<T: std::convert::Into<std::string::String>>(
8857 mut self,
8858 v: T,
8859 ) -> Self {
8860 self.content_disposition = v.into();
8861 self
8862 }
8863
8864 /// Sets the value of [cache_control][crate::model::Object::cache_control].
8865 ///
8866 /// # Example
8867 /// ```ignore,no_run
8868 /// # use google_cloud_storage::model::Object;
8869 /// let x = Object::new().set_cache_control("example");
8870 /// ```
8871 pub fn set_cache_control<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
8872 self.cache_control = v.into();
8873 self
8874 }
8875
8876 /// Sets the value of [acl][crate::model::Object::acl].
8877 ///
8878 /// # Example
8879 /// ```ignore,no_run
8880 /// # use google_cloud_storage::model::Object;
8881 /// use google_cloud_storage::model::ObjectAccessControl;
8882 /// let x = Object::new()
8883 /// .set_acl([
8884 /// ObjectAccessControl::default()/* use setters */,
8885 /// ObjectAccessControl::default()/* use (different) setters */,
8886 /// ]);
8887 /// ```
8888 pub fn set_acl<T, V>(mut self, v: T) -> Self
8889 where
8890 T: std::iter::IntoIterator<Item = V>,
8891 V: std::convert::Into<crate::model::ObjectAccessControl>,
8892 {
8893 use std::iter::Iterator;
8894 self.acl = v.into_iter().map(|i| i.into()).collect();
8895 self
8896 }
8897
8898 /// Sets the value of [content_language][crate::model::Object::content_language].
8899 ///
8900 /// # Example
8901 /// ```ignore,no_run
8902 /// # use google_cloud_storage::model::Object;
8903 /// let x = Object::new().set_content_language("example");
8904 /// ```
8905 pub fn set_content_language<T: std::convert::Into<std::string::String>>(
8906 mut self,
8907 v: T,
8908 ) -> Self {
8909 self.content_language = v.into();
8910 self
8911 }
8912
8913 /// Sets the value of [delete_time][crate::model::Object::delete_time].
8914 ///
8915 /// # Example
8916 /// ```ignore,no_run
8917 /// # use google_cloud_storage::model::Object;
8918 /// use wkt::Timestamp;
8919 /// let x = Object::new().set_delete_time(Timestamp::default()/* use setters */);
8920 /// ```
8921 pub fn set_delete_time<T>(mut self, v: T) -> Self
8922 where
8923 T: std::convert::Into<wkt::Timestamp>,
8924 {
8925 self.delete_time = std::option::Option::Some(v.into());
8926 self
8927 }
8928
8929 /// Sets or clears the value of [delete_time][crate::model::Object::delete_time].
8930 ///
8931 /// # Example
8932 /// ```ignore,no_run
8933 /// # use google_cloud_storage::model::Object;
8934 /// use wkt::Timestamp;
8935 /// let x = Object::new().set_or_clear_delete_time(Some(Timestamp::default()/* use setters */));
8936 /// let x = Object::new().set_or_clear_delete_time(None::<Timestamp>);
8937 /// ```
8938 pub fn set_or_clear_delete_time<T>(mut self, v: std::option::Option<T>) -> Self
8939 where
8940 T: std::convert::Into<wkt::Timestamp>,
8941 {
8942 self.delete_time = v.map(|x| x.into());
8943 self
8944 }
8945
8946 /// Sets the value of [finalize_time][crate::model::Object::finalize_time].
8947 ///
8948 /// # Example
8949 /// ```ignore,no_run
8950 /// # use google_cloud_storage::model::Object;
8951 /// use wkt::Timestamp;
8952 /// let x = Object::new().set_finalize_time(Timestamp::default()/* use setters */);
8953 /// ```
8954 pub fn set_finalize_time<T>(mut self, v: T) -> Self
8955 where
8956 T: std::convert::Into<wkt::Timestamp>,
8957 {
8958 self.finalize_time = std::option::Option::Some(v.into());
8959 self
8960 }
8961
8962 /// Sets or clears the value of [finalize_time][crate::model::Object::finalize_time].
8963 ///
8964 /// # Example
8965 /// ```ignore,no_run
8966 /// # use google_cloud_storage::model::Object;
8967 /// use wkt::Timestamp;
8968 /// let x = Object::new().set_or_clear_finalize_time(Some(Timestamp::default()/* use setters */));
8969 /// let x = Object::new().set_or_clear_finalize_time(None::<Timestamp>);
8970 /// ```
8971 pub fn set_or_clear_finalize_time<T>(mut self, v: std::option::Option<T>) -> Self
8972 where
8973 T: std::convert::Into<wkt::Timestamp>,
8974 {
8975 self.finalize_time = v.map(|x| x.into());
8976 self
8977 }
8978
8979 /// Sets the value of [content_type][crate::model::Object::content_type].
8980 ///
8981 /// # Example
8982 /// ```ignore,no_run
8983 /// # use google_cloud_storage::model::Object;
8984 /// let x = Object::new().set_content_type("example");
8985 /// ```
8986 pub fn set_content_type<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
8987 self.content_type = v.into();
8988 self
8989 }
8990
8991 /// Sets the value of [create_time][crate::model::Object::create_time].
8992 ///
8993 /// # Example
8994 /// ```ignore,no_run
8995 /// # use google_cloud_storage::model::Object;
8996 /// use wkt::Timestamp;
8997 /// let x = Object::new().set_create_time(Timestamp::default()/* use setters */);
8998 /// ```
8999 pub fn set_create_time<T>(mut self, v: T) -> Self
9000 where
9001 T: std::convert::Into<wkt::Timestamp>,
9002 {
9003 self.create_time = std::option::Option::Some(v.into());
9004 self
9005 }
9006
9007 /// Sets or clears the value of [create_time][crate::model::Object::create_time].
9008 ///
9009 /// # Example
9010 /// ```ignore,no_run
9011 /// # use google_cloud_storage::model::Object;
9012 /// use wkt::Timestamp;
9013 /// let x = Object::new().set_or_clear_create_time(Some(Timestamp::default()/* use setters */));
9014 /// let x = Object::new().set_or_clear_create_time(None::<Timestamp>);
9015 /// ```
9016 pub fn set_or_clear_create_time<T>(mut self, v: std::option::Option<T>) -> Self
9017 where
9018 T: std::convert::Into<wkt::Timestamp>,
9019 {
9020 self.create_time = v.map(|x| x.into());
9021 self
9022 }
9023
9024 /// Sets the value of [component_count][crate::model::Object::component_count].
9025 ///
9026 /// # Example
9027 /// ```ignore,no_run
9028 /// # use google_cloud_storage::model::Object;
9029 /// let x = Object::new().set_component_count(42);
9030 /// ```
9031 pub fn set_component_count<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
9032 self.component_count = v.into();
9033 self
9034 }
9035
9036 /// Sets the value of [checksums][crate::model::Object::checksums].
9037 ///
9038 /// # Example
9039 /// ```ignore,no_run
9040 /// # use google_cloud_storage::model::Object;
9041 /// use google_cloud_storage::model::ObjectChecksums;
9042 /// let x = Object::new().set_checksums(ObjectChecksums::default()/* use setters */);
9043 /// ```
9044 pub fn set_checksums<T>(mut self, v: T) -> Self
9045 where
9046 T: std::convert::Into<crate::model::ObjectChecksums>,
9047 {
9048 self.checksums = std::option::Option::Some(v.into());
9049 self
9050 }
9051
9052 /// Sets or clears the value of [checksums][crate::model::Object::checksums].
9053 ///
9054 /// # Example
9055 /// ```ignore,no_run
9056 /// # use google_cloud_storage::model::Object;
9057 /// use google_cloud_storage::model::ObjectChecksums;
9058 /// let x = Object::new().set_or_clear_checksums(Some(ObjectChecksums::default()/* use setters */));
9059 /// let x = Object::new().set_or_clear_checksums(None::<ObjectChecksums>);
9060 /// ```
9061 pub fn set_or_clear_checksums<T>(mut self, v: std::option::Option<T>) -> Self
9062 where
9063 T: std::convert::Into<crate::model::ObjectChecksums>,
9064 {
9065 self.checksums = v.map(|x| x.into());
9066 self
9067 }
9068
9069 /// Sets the value of [update_time][crate::model::Object::update_time].
9070 ///
9071 /// # Example
9072 /// ```ignore,no_run
9073 /// # use google_cloud_storage::model::Object;
9074 /// use wkt::Timestamp;
9075 /// let x = Object::new().set_update_time(Timestamp::default()/* use setters */);
9076 /// ```
9077 pub fn set_update_time<T>(mut self, v: T) -> Self
9078 where
9079 T: std::convert::Into<wkt::Timestamp>,
9080 {
9081 self.update_time = std::option::Option::Some(v.into());
9082 self
9083 }
9084
9085 /// Sets or clears the value of [update_time][crate::model::Object::update_time].
9086 ///
9087 /// # Example
9088 /// ```ignore,no_run
9089 /// # use google_cloud_storage::model::Object;
9090 /// use wkt::Timestamp;
9091 /// let x = Object::new().set_or_clear_update_time(Some(Timestamp::default()/* use setters */));
9092 /// let x = Object::new().set_or_clear_update_time(None::<Timestamp>);
9093 /// ```
9094 pub fn set_or_clear_update_time<T>(mut self, v: std::option::Option<T>) -> Self
9095 where
9096 T: std::convert::Into<wkt::Timestamp>,
9097 {
9098 self.update_time = v.map(|x| x.into());
9099 self
9100 }
9101
9102 /// Sets the value of [kms_key][crate::model::Object::kms_key].
9103 ///
9104 /// # Example
9105 /// ```ignore,no_run
9106 /// # use google_cloud_storage::model::Object;
9107 /// let x = Object::new().set_kms_key("example");
9108 /// ```
9109 pub fn set_kms_key<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9110 self.kms_key = v.into();
9111 self
9112 }
9113
9114 /// Sets the value of [update_storage_class_time][crate::model::Object::update_storage_class_time].
9115 ///
9116 /// # Example
9117 /// ```ignore,no_run
9118 /// # use google_cloud_storage::model::Object;
9119 /// use wkt::Timestamp;
9120 /// let x = Object::new().set_update_storage_class_time(Timestamp::default()/* use setters */);
9121 /// ```
9122 pub fn set_update_storage_class_time<T>(mut self, v: T) -> Self
9123 where
9124 T: std::convert::Into<wkt::Timestamp>,
9125 {
9126 self.update_storage_class_time = std::option::Option::Some(v.into());
9127 self
9128 }
9129
9130 /// Sets or clears the value of [update_storage_class_time][crate::model::Object::update_storage_class_time].
9131 ///
9132 /// # Example
9133 /// ```ignore,no_run
9134 /// # use google_cloud_storage::model::Object;
9135 /// use wkt::Timestamp;
9136 /// let x = Object::new().set_or_clear_update_storage_class_time(Some(Timestamp::default()/* use setters */));
9137 /// let x = Object::new().set_or_clear_update_storage_class_time(None::<Timestamp>);
9138 /// ```
9139 pub fn set_or_clear_update_storage_class_time<T>(mut self, v: std::option::Option<T>) -> Self
9140 where
9141 T: std::convert::Into<wkt::Timestamp>,
9142 {
9143 self.update_storage_class_time = v.map(|x| x.into());
9144 self
9145 }
9146
9147 /// Sets the value of [temporary_hold][crate::model::Object::temporary_hold].
9148 ///
9149 /// # Example
9150 /// ```ignore,no_run
9151 /// # use google_cloud_storage::model::Object;
9152 /// let x = Object::new().set_temporary_hold(true);
9153 /// ```
9154 pub fn set_temporary_hold<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
9155 self.temporary_hold = v.into();
9156 self
9157 }
9158
9159 /// Sets the value of [retention_expire_time][crate::model::Object::retention_expire_time].
9160 ///
9161 /// # Example
9162 /// ```ignore,no_run
9163 /// # use google_cloud_storage::model::Object;
9164 /// use wkt::Timestamp;
9165 /// let x = Object::new().set_retention_expire_time(Timestamp::default()/* use setters */);
9166 /// ```
9167 pub fn set_retention_expire_time<T>(mut self, v: T) -> Self
9168 where
9169 T: std::convert::Into<wkt::Timestamp>,
9170 {
9171 self.retention_expire_time = std::option::Option::Some(v.into());
9172 self
9173 }
9174
9175 /// Sets or clears the value of [retention_expire_time][crate::model::Object::retention_expire_time].
9176 ///
9177 /// # Example
9178 /// ```ignore,no_run
9179 /// # use google_cloud_storage::model::Object;
9180 /// use wkt::Timestamp;
9181 /// let x = Object::new().set_or_clear_retention_expire_time(Some(Timestamp::default()/* use setters */));
9182 /// let x = Object::new().set_or_clear_retention_expire_time(None::<Timestamp>);
9183 /// ```
9184 pub fn set_or_clear_retention_expire_time<T>(mut self, v: std::option::Option<T>) -> Self
9185 where
9186 T: std::convert::Into<wkt::Timestamp>,
9187 {
9188 self.retention_expire_time = v.map(|x| x.into());
9189 self
9190 }
9191
9192 /// Sets the value of [metadata][crate::model::Object::metadata].
9193 ///
9194 /// # Example
9195 /// ```ignore,no_run
9196 /// # use google_cloud_storage::model::Object;
9197 /// let x = Object::new().set_metadata([
9198 /// ("key0", "abc"),
9199 /// ("key1", "xyz"),
9200 /// ]);
9201 /// ```
9202 pub fn set_metadata<T, K, V>(mut self, v: T) -> Self
9203 where
9204 T: std::iter::IntoIterator<Item = (K, V)>,
9205 K: std::convert::Into<std::string::String>,
9206 V: std::convert::Into<std::string::String>,
9207 {
9208 use std::iter::Iterator;
9209 self.metadata = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
9210 self
9211 }
9212
9213 /// Sets the value of [contexts][crate::model::Object::contexts].
9214 ///
9215 /// # Example
9216 /// ```ignore,no_run
9217 /// # use google_cloud_storage::model::Object;
9218 /// use google_cloud_storage::model::ObjectContexts;
9219 /// let x = Object::new().set_contexts(ObjectContexts::default()/* use setters */);
9220 /// ```
9221 pub fn set_contexts<T>(mut self, v: T) -> Self
9222 where
9223 T: std::convert::Into<crate::model::ObjectContexts>,
9224 {
9225 self.contexts = std::option::Option::Some(v.into());
9226 self
9227 }
9228
9229 /// Sets or clears the value of [contexts][crate::model::Object::contexts].
9230 ///
9231 /// # Example
9232 /// ```ignore,no_run
9233 /// # use google_cloud_storage::model::Object;
9234 /// use google_cloud_storage::model::ObjectContexts;
9235 /// let x = Object::new().set_or_clear_contexts(Some(ObjectContexts::default()/* use setters */));
9236 /// let x = Object::new().set_or_clear_contexts(None::<ObjectContexts>);
9237 /// ```
9238 pub fn set_or_clear_contexts<T>(mut self, v: std::option::Option<T>) -> Self
9239 where
9240 T: std::convert::Into<crate::model::ObjectContexts>,
9241 {
9242 self.contexts = v.map(|x| x.into());
9243 self
9244 }
9245
9246 /// Sets the value of [event_based_hold][crate::model::Object::event_based_hold].
9247 ///
9248 /// # Example
9249 /// ```ignore,no_run
9250 /// # use google_cloud_storage::model::Object;
9251 /// let x = Object::new().set_event_based_hold(true);
9252 /// ```
9253 pub fn set_event_based_hold<T>(mut self, v: T) -> Self
9254 where
9255 T: std::convert::Into<bool>,
9256 {
9257 self.event_based_hold = std::option::Option::Some(v.into());
9258 self
9259 }
9260
9261 /// Sets or clears the value of [event_based_hold][crate::model::Object::event_based_hold].
9262 ///
9263 /// # Example
9264 /// ```ignore,no_run
9265 /// # use google_cloud_storage::model::Object;
9266 /// let x = Object::new().set_or_clear_event_based_hold(Some(false));
9267 /// let x = Object::new().set_or_clear_event_based_hold(None::<bool>);
9268 /// ```
9269 pub fn set_or_clear_event_based_hold<T>(mut self, v: std::option::Option<T>) -> Self
9270 where
9271 T: std::convert::Into<bool>,
9272 {
9273 self.event_based_hold = v.map(|x| x.into());
9274 self
9275 }
9276
9277 /// Sets the value of [owner][crate::model::Object::owner].
9278 ///
9279 /// # Example
9280 /// ```ignore,no_run
9281 /// # use google_cloud_storage::model::Object;
9282 /// use google_cloud_storage::model::Owner;
9283 /// let x = Object::new().set_owner(Owner::default()/* use setters */);
9284 /// ```
9285 pub fn set_owner<T>(mut self, v: T) -> Self
9286 where
9287 T: std::convert::Into<crate::model::Owner>,
9288 {
9289 self.owner = std::option::Option::Some(v.into());
9290 self
9291 }
9292
9293 /// Sets or clears the value of [owner][crate::model::Object::owner].
9294 ///
9295 /// # Example
9296 /// ```ignore,no_run
9297 /// # use google_cloud_storage::model::Object;
9298 /// use google_cloud_storage::model::Owner;
9299 /// let x = Object::new().set_or_clear_owner(Some(Owner::default()/* use setters */));
9300 /// let x = Object::new().set_or_clear_owner(None::<Owner>);
9301 /// ```
9302 pub fn set_or_clear_owner<T>(mut self, v: std::option::Option<T>) -> Self
9303 where
9304 T: std::convert::Into<crate::model::Owner>,
9305 {
9306 self.owner = v.map(|x| x.into());
9307 self
9308 }
9309
9310 /// Sets the value of [customer_encryption][crate::model::Object::customer_encryption].
9311 ///
9312 /// # Example
9313 /// ```ignore,no_run
9314 /// # use google_cloud_storage::model::Object;
9315 /// use google_cloud_storage::model::CustomerEncryption;
9316 /// let x = Object::new().set_customer_encryption(CustomerEncryption::default()/* use setters */);
9317 /// ```
9318 pub fn set_customer_encryption<T>(mut self, v: T) -> Self
9319 where
9320 T: std::convert::Into<crate::model::CustomerEncryption>,
9321 {
9322 self.customer_encryption = std::option::Option::Some(v.into());
9323 self
9324 }
9325
9326 /// Sets or clears the value of [customer_encryption][crate::model::Object::customer_encryption].
9327 ///
9328 /// # Example
9329 /// ```ignore,no_run
9330 /// # use google_cloud_storage::model::Object;
9331 /// use google_cloud_storage::model::CustomerEncryption;
9332 /// let x = Object::new().set_or_clear_customer_encryption(Some(CustomerEncryption::default()/* use setters */));
9333 /// let x = Object::new().set_or_clear_customer_encryption(None::<CustomerEncryption>);
9334 /// ```
9335 pub fn set_or_clear_customer_encryption<T>(mut self, v: std::option::Option<T>) -> Self
9336 where
9337 T: std::convert::Into<crate::model::CustomerEncryption>,
9338 {
9339 self.customer_encryption = v.map(|x| x.into());
9340 self
9341 }
9342
9343 /// Sets the value of [custom_time][crate::model::Object::custom_time].
9344 ///
9345 /// # Example
9346 /// ```ignore,no_run
9347 /// # use google_cloud_storage::model::Object;
9348 /// use wkt::Timestamp;
9349 /// let x = Object::new().set_custom_time(Timestamp::default()/* use setters */);
9350 /// ```
9351 pub fn set_custom_time<T>(mut self, v: T) -> Self
9352 where
9353 T: std::convert::Into<wkt::Timestamp>,
9354 {
9355 self.custom_time = std::option::Option::Some(v.into());
9356 self
9357 }
9358
9359 /// Sets or clears the value of [custom_time][crate::model::Object::custom_time].
9360 ///
9361 /// # Example
9362 /// ```ignore,no_run
9363 /// # use google_cloud_storage::model::Object;
9364 /// use wkt::Timestamp;
9365 /// let x = Object::new().set_or_clear_custom_time(Some(Timestamp::default()/* use setters */));
9366 /// let x = Object::new().set_or_clear_custom_time(None::<Timestamp>);
9367 /// ```
9368 pub fn set_or_clear_custom_time<T>(mut self, v: std::option::Option<T>) -> Self
9369 where
9370 T: std::convert::Into<wkt::Timestamp>,
9371 {
9372 self.custom_time = v.map(|x| x.into());
9373 self
9374 }
9375
9376 /// Sets the value of [soft_delete_time][crate::model::Object::soft_delete_time].
9377 ///
9378 /// # Example
9379 /// ```ignore,no_run
9380 /// # use google_cloud_storage::model::Object;
9381 /// use wkt::Timestamp;
9382 /// let x = Object::new().set_soft_delete_time(Timestamp::default()/* use setters */);
9383 /// ```
9384 pub fn set_soft_delete_time<T>(mut self, v: T) -> Self
9385 where
9386 T: std::convert::Into<wkt::Timestamp>,
9387 {
9388 self.soft_delete_time = std::option::Option::Some(v.into());
9389 self
9390 }
9391
9392 /// Sets or clears the value of [soft_delete_time][crate::model::Object::soft_delete_time].
9393 ///
9394 /// # Example
9395 /// ```ignore,no_run
9396 /// # use google_cloud_storage::model::Object;
9397 /// use wkt::Timestamp;
9398 /// let x = Object::new().set_or_clear_soft_delete_time(Some(Timestamp::default()/* use setters */));
9399 /// let x = Object::new().set_or_clear_soft_delete_time(None::<Timestamp>);
9400 /// ```
9401 pub fn set_or_clear_soft_delete_time<T>(mut self, v: std::option::Option<T>) -> Self
9402 where
9403 T: std::convert::Into<wkt::Timestamp>,
9404 {
9405 self.soft_delete_time = v.map(|x| x.into());
9406 self
9407 }
9408
9409 /// Sets the value of [hard_delete_time][crate::model::Object::hard_delete_time].
9410 ///
9411 /// # Example
9412 /// ```ignore,no_run
9413 /// # use google_cloud_storage::model::Object;
9414 /// use wkt::Timestamp;
9415 /// let x = Object::new().set_hard_delete_time(Timestamp::default()/* use setters */);
9416 /// ```
9417 pub fn set_hard_delete_time<T>(mut self, v: T) -> Self
9418 where
9419 T: std::convert::Into<wkt::Timestamp>,
9420 {
9421 self.hard_delete_time = std::option::Option::Some(v.into());
9422 self
9423 }
9424
9425 /// Sets or clears the value of [hard_delete_time][crate::model::Object::hard_delete_time].
9426 ///
9427 /// # Example
9428 /// ```ignore,no_run
9429 /// # use google_cloud_storage::model::Object;
9430 /// use wkt::Timestamp;
9431 /// let x = Object::new().set_or_clear_hard_delete_time(Some(Timestamp::default()/* use setters */));
9432 /// let x = Object::new().set_or_clear_hard_delete_time(None::<Timestamp>);
9433 /// ```
9434 pub fn set_or_clear_hard_delete_time<T>(mut self, v: std::option::Option<T>) -> Self
9435 where
9436 T: std::convert::Into<wkt::Timestamp>,
9437 {
9438 self.hard_delete_time = v.map(|x| x.into());
9439 self
9440 }
9441
9442 /// Sets the value of [retention][crate::model::Object::retention].
9443 ///
9444 /// # Example
9445 /// ```ignore,no_run
9446 /// # use google_cloud_storage::model::Object;
9447 /// use google_cloud_storage::model::object::Retention;
9448 /// let x = Object::new().set_retention(Retention::default()/* use setters */);
9449 /// ```
9450 pub fn set_retention<T>(mut self, v: T) -> Self
9451 where
9452 T: std::convert::Into<crate::model::object::Retention>,
9453 {
9454 self.retention = std::option::Option::Some(v.into());
9455 self
9456 }
9457
9458 /// Sets or clears the value of [retention][crate::model::Object::retention].
9459 ///
9460 /// # Example
9461 /// ```ignore,no_run
9462 /// # use google_cloud_storage::model::Object;
9463 /// use google_cloud_storage::model::object::Retention;
9464 /// let x = Object::new().set_or_clear_retention(Some(Retention::default()/* use setters */));
9465 /// let x = Object::new().set_or_clear_retention(None::<Retention>);
9466 /// ```
9467 pub fn set_or_clear_retention<T>(mut self, v: std::option::Option<T>) -> Self
9468 where
9469 T: std::convert::Into<crate::model::object::Retention>,
9470 {
9471 self.retention = v.map(|x| x.into());
9472 self
9473 }
9474}
9475
9476impl wkt::message::Message for Object {
9477 fn typename() -> &'static str {
9478 "type.googleapis.com/google.storage.v2.Object"
9479 }
9480}
9481
9482/// Defines additional types related to [Object].
9483pub mod object {
9484 #[allow(unused_imports)]
9485 use super::*;
9486
9487 /// Specifies retention parameters of the object. Objects under retention
9488 /// cannot be deleted or overwritten until their retention expires.
9489 #[derive(Clone, Default, PartialEq)]
9490 #[non_exhaustive]
9491 pub struct Retention {
9492 /// Optional. The mode of the Retention.
9493 pub mode: crate::model::object::retention::Mode,
9494
9495 /// Optional. The timestamp that the object needs to be retained until.
9496 /// Value cannot be set in the past or more than 100 years in the future.
9497 pub retain_until_time: std::option::Option<wkt::Timestamp>,
9498
9499 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
9500 }
9501
9502 impl Retention {
9503 /// Creates a new default instance.
9504 pub fn new() -> Self {
9505 std::default::Default::default()
9506 }
9507
9508 /// Sets the value of [mode][crate::model::object::Retention::mode].
9509 ///
9510 /// # Example
9511 /// ```ignore,no_run
9512 /// # use google_cloud_storage::model::object::Retention;
9513 /// use google_cloud_storage::model::object::retention::Mode;
9514 /// let x0 = Retention::new().set_mode(Mode::Unlocked);
9515 /// let x1 = Retention::new().set_mode(Mode::Locked);
9516 /// ```
9517 pub fn set_mode<T: std::convert::Into<crate::model::object::retention::Mode>>(
9518 mut self,
9519 v: T,
9520 ) -> Self {
9521 self.mode = v.into();
9522 self
9523 }
9524
9525 /// Sets the value of [retain_until_time][crate::model::object::Retention::retain_until_time].
9526 ///
9527 /// # Example
9528 /// ```ignore,no_run
9529 /// # use google_cloud_storage::model::object::Retention;
9530 /// use wkt::Timestamp;
9531 /// let x = Retention::new().set_retain_until_time(Timestamp::default()/* use setters */);
9532 /// ```
9533 pub fn set_retain_until_time<T>(mut self, v: T) -> Self
9534 where
9535 T: std::convert::Into<wkt::Timestamp>,
9536 {
9537 self.retain_until_time = std::option::Option::Some(v.into());
9538 self
9539 }
9540
9541 /// Sets or clears the value of [retain_until_time][crate::model::object::Retention::retain_until_time].
9542 ///
9543 /// # Example
9544 /// ```ignore,no_run
9545 /// # use google_cloud_storage::model::object::Retention;
9546 /// use wkt::Timestamp;
9547 /// let x = Retention::new().set_or_clear_retain_until_time(Some(Timestamp::default()/* use setters */));
9548 /// let x = Retention::new().set_or_clear_retain_until_time(None::<Timestamp>);
9549 /// ```
9550 pub fn set_or_clear_retain_until_time<T>(mut self, v: std::option::Option<T>) -> Self
9551 where
9552 T: std::convert::Into<wkt::Timestamp>,
9553 {
9554 self.retain_until_time = v.map(|x| x.into());
9555 self
9556 }
9557 }
9558
9559 impl wkt::message::Message for Retention {
9560 fn typename() -> &'static str {
9561 "type.googleapis.com/google.storage.v2.Object.Retention"
9562 }
9563 }
9564
9565 /// Defines additional types related to [Retention].
9566 pub mod retention {
9567 #[allow(unused_imports)]
9568 use super::*;
9569
9570 /// Retention mode values.
9571 ///
9572 /// # Working with unknown values
9573 ///
9574 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
9575 /// additional enum variants at any time. Adding new variants is not considered
9576 /// a breaking change. Applications should write their code in anticipation of:
9577 ///
9578 /// - New values appearing in future releases of the client library, **and**
9579 /// - New values received dynamically, without application changes.
9580 ///
9581 /// Please consult the [Working with enums] section in the user guide for some
9582 /// guidelines.
9583 ///
9584 /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
9585 #[derive(Clone, Debug, PartialEq)]
9586 #[non_exhaustive]
9587 pub enum Mode {
9588 /// No specified mode. Object is not under retention.
9589 Unspecified,
9590 /// Retention period might be decreased or increased.
9591 /// The Retention configuration might be removed.
9592 /// The mode might be changed to locked.
9593 Unlocked,
9594 /// Retention period might be increased.
9595 /// The Retention configuration cannot be removed.
9596 /// The mode cannot be changed.
9597 Locked,
9598 /// If set, the enum was initialized with an unknown value.
9599 ///
9600 /// Applications can examine the value using [Mode::value] or
9601 /// [Mode::name].
9602 UnknownValue(mode::UnknownValue),
9603 }
9604
9605 #[doc(hidden)]
9606 pub mod mode {
9607 #[allow(unused_imports)]
9608 use super::*;
9609 #[derive(Clone, Debug, PartialEq)]
9610 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
9611 }
9612
9613 impl Mode {
9614 /// Gets the enum value.
9615 ///
9616 /// Returns `None` if the enum contains an unknown value deserialized from
9617 /// the string representation of enums.
9618 pub fn value(&self) -> std::option::Option<i32> {
9619 match self {
9620 Self::Unspecified => std::option::Option::Some(0),
9621 Self::Unlocked => std::option::Option::Some(1),
9622 Self::Locked => std::option::Option::Some(2),
9623 Self::UnknownValue(u) => u.0.value(),
9624 }
9625 }
9626
9627 /// Gets the enum value as a string.
9628 ///
9629 /// Returns `None` if the enum contains an unknown value deserialized from
9630 /// the integer representation of enums.
9631 pub fn name(&self) -> std::option::Option<&str> {
9632 match self {
9633 Self::Unspecified => std::option::Option::Some("MODE_UNSPECIFIED"),
9634 Self::Unlocked => std::option::Option::Some("UNLOCKED"),
9635 Self::Locked => std::option::Option::Some("LOCKED"),
9636 Self::UnknownValue(u) => u.0.name(),
9637 }
9638 }
9639 }
9640
9641 impl std::default::Default for Mode {
9642 fn default() -> Self {
9643 use std::convert::From;
9644 Self::from(0)
9645 }
9646 }
9647
9648 impl std::fmt::Display for Mode {
9649 fn fmt(
9650 &self,
9651 f: &mut std::fmt::Formatter<'_>,
9652 ) -> std::result::Result<(), std::fmt::Error> {
9653 wkt::internal::display_enum(f, self.name(), self.value())
9654 }
9655 }
9656
9657 impl std::convert::From<i32> for Mode {
9658 fn from(value: i32) -> Self {
9659 match value {
9660 0 => Self::Unspecified,
9661 1 => Self::Unlocked,
9662 2 => Self::Locked,
9663 _ => Self::UnknownValue(mode::UnknownValue(
9664 wkt::internal::UnknownEnumValue::Integer(value),
9665 )),
9666 }
9667 }
9668 }
9669
9670 impl std::convert::From<&str> for Mode {
9671 fn from(value: &str) -> Self {
9672 use std::string::ToString;
9673 match value {
9674 "MODE_UNSPECIFIED" => Self::Unspecified,
9675 "UNLOCKED" => Self::Unlocked,
9676 "LOCKED" => Self::Locked,
9677 _ => Self::UnknownValue(mode::UnknownValue(
9678 wkt::internal::UnknownEnumValue::String(value.to_string()),
9679 )),
9680 }
9681 }
9682 }
9683
9684 impl serde::ser::Serialize for Mode {
9685 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
9686 where
9687 S: serde::Serializer,
9688 {
9689 match self {
9690 Self::Unspecified => serializer.serialize_i32(0),
9691 Self::Unlocked => serializer.serialize_i32(1),
9692 Self::Locked => serializer.serialize_i32(2),
9693 Self::UnknownValue(u) => u.0.serialize(serializer),
9694 }
9695 }
9696 }
9697
9698 impl<'de> serde::de::Deserialize<'de> for Mode {
9699 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
9700 where
9701 D: serde::Deserializer<'de>,
9702 {
9703 deserializer.deserialize_any(wkt::internal::EnumVisitor::<Mode>::new(
9704 ".google.storage.v2.Object.Retention.Mode",
9705 ))
9706 }
9707 }
9708 }
9709}
9710
9711/// An access-control entry.
9712#[derive(Clone, Default, PartialEq)]
9713#[non_exhaustive]
9714pub struct ObjectAccessControl {
9715 /// Optional. The access permission for the entity. One of the following
9716 /// values:
9717 ///
9718 /// * `READER`
9719 /// * `WRITER`
9720 /// * `OWNER`
9721 pub role: std::string::String,
9722
9723 /// Optional. The ID of the access-control entry.
9724 pub id: std::string::String,
9725
9726 /// Optional. The entity holding the permission, in one of the following forms:
9727 ///
9728 /// * `user-{userid}`
9729 /// * `user-{email}`
9730 /// * `group-{groupid}`
9731 /// * `group-{email}`
9732 /// * `domain-{domain}`
9733 /// * `project-{team}-{projectnumber}`
9734 /// * `project-{team}-{projectid}`
9735 /// * `allUsers`
9736 /// * `allAuthenticatedUsers`
9737 /// Examples:
9738 /// * The user `liz@example.com` would be `user-liz@example.com`.
9739 /// * The group `example@googlegroups.com` would be
9740 /// `group-example@googlegroups.com`.
9741 /// * All members of the Google Apps for Business domain `example.com` would be
9742 /// `domain-example.com`.
9743 /// For project entities, `project-{team}-{projectnumber}` format is
9744 /// returned in the response.
9745 pub entity: std::string::String,
9746
9747 /// Output only. The alternative entity format, if exists. For project
9748 /// entities, `project-{team}-{projectid}` format is returned in the response.
9749 pub entity_alt: std::string::String,
9750
9751 /// Optional. The ID for the entity, if any.
9752 pub entity_id: std::string::String,
9753
9754 /// Optional. The etag of the ObjectAccessControl.
9755 /// If included in the metadata of an update or delete request message, the
9756 /// operation is only performed if the etag matches that of the live
9757 /// object's ObjectAccessControl.
9758 pub etag: std::string::String,
9759
9760 /// Optional. The email address associated with the entity, if any.
9761 pub email: std::string::String,
9762
9763 /// Optional. The domain associated with the entity, if any.
9764 pub domain: std::string::String,
9765
9766 /// Optional. The project team associated with the entity, if any.
9767 pub project_team: std::option::Option<crate::model::ProjectTeam>,
9768
9769 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
9770}
9771
9772impl ObjectAccessControl {
9773 /// Creates a new default instance.
9774 pub fn new() -> Self {
9775 std::default::Default::default()
9776 }
9777
9778 /// Sets the value of [role][crate::model::ObjectAccessControl::role].
9779 ///
9780 /// # Example
9781 /// ```ignore,no_run
9782 /// # use google_cloud_storage::model::ObjectAccessControl;
9783 /// let x = ObjectAccessControl::new().set_role("example");
9784 /// ```
9785 pub fn set_role<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9786 self.role = v.into();
9787 self
9788 }
9789
9790 /// Sets the value of [id][crate::model::ObjectAccessControl::id].
9791 ///
9792 /// # Example
9793 /// ```ignore,no_run
9794 /// # use google_cloud_storage::model::ObjectAccessControl;
9795 /// let x = ObjectAccessControl::new().set_id("example");
9796 /// ```
9797 pub fn set_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9798 self.id = v.into();
9799 self
9800 }
9801
9802 /// Sets the value of [entity][crate::model::ObjectAccessControl::entity].
9803 ///
9804 /// # Example
9805 /// ```ignore,no_run
9806 /// # use google_cloud_storage::model::ObjectAccessControl;
9807 /// let x = ObjectAccessControl::new().set_entity("example");
9808 /// ```
9809 pub fn set_entity<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9810 self.entity = v.into();
9811 self
9812 }
9813
9814 /// Sets the value of [entity_alt][crate::model::ObjectAccessControl::entity_alt].
9815 ///
9816 /// # Example
9817 /// ```ignore,no_run
9818 /// # use google_cloud_storage::model::ObjectAccessControl;
9819 /// let x = ObjectAccessControl::new().set_entity_alt("example");
9820 /// ```
9821 pub fn set_entity_alt<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9822 self.entity_alt = v.into();
9823 self
9824 }
9825
9826 /// Sets the value of [entity_id][crate::model::ObjectAccessControl::entity_id].
9827 ///
9828 /// # Example
9829 /// ```ignore,no_run
9830 /// # use google_cloud_storage::model::ObjectAccessControl;
9831 /// let x = ObjectAccessControl::new().set_entity_id("example");
9832 /// ```
9833 pub fn set_entity_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9834 self.entity_id = v.into();
9835 self
9836 }
9837
9838 /// Sets the value of [etag][crate::model::ObjectAccessControl::etag].
9839 ///
9840 /// # Example
9841 /// ```ignore,no_run
9842 /// # use google_cloud_storage::model::ObjectAccessControl;
9843 /// let x = ObjectAccessControl::new().set_etag("example");
9844 /// ```
9845 pub fn set_etag<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9846 self.etag = v.into();
9847 self
9848 }
9849
9850 /// Sets the value of [email][crate::model::ObjectAccessControl::email].
9851 ///
9852 /// # Example
9853 /// ```ignore,no_run
9854 /// # use google_cloud_storage::model::ObjectAccessControl;
9855 /// let x = ObjectAccessControl::new().set_email("example");
9856 /// ```
9857 pub fn set_email<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9858 self.email = v.into();
9859 self
9860 }
9861
9862 /// Sets the value of [domain][crate::model::ObjectAccessControl::domain].
9863 ///
9864 /// # Example
9865 /// ```ignore,no_run
9866 /// # use google_cloud_storage::model::ObjectAccessControl;
9867 /// let x = ObjectAccessControl::new().set_domain("example");
9868 /// ```
9869 pub fn set_domain<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9870 self.domain = v.into();
9871 self
9872 }
9873
9874 /// Sets the value of [project_team][crate::model::ObjectAccessControl::project_team].
9875 ///
9876 /// # Example
9877 /// ```ignore,no_run
9878 /// # use google_cloud_storage::model::ObjectAccessControl;
9879 /// use google_cloud_storage::model::ProjectTeam;
9880 /// let x = ObjectAccessControl::new().set_project_team(ProjectTeam::default()/* use setters */);
9881 /// ```
9882 pub fn set_project_team<T>(mut self, v: T) -> Self
9883 where
9884 T: std::convert::Into<crate::model::ProjectTeam>,
9885 {
9886 self.project_team = std::option::Option::Some(v.into());
9887 self
9888 }
9889
9890 /// Sets or clears the value of [project_team][crate::model::ObjectAccessControl::project_team].
9891 ///
9892 /// # Example
9893 /// ```ignore,no_run
9894 /// # use google_cloud_storage::model::ObjectAccessControl;
9895 /// use google_cloud_storage::model::ProjectTeam;
9896 /// let x = ObjectAccessControl::new().set_or_clear_project_team(Some(ProjectTeam::default()/* use setters */));
9897 /// let x = ObjectAccessControl::new().set_or_clear_project_team(None::<ProjectTeam>);
9898 /// ```
9899 pub fn set_or_clear_project_team<T>(mut self, v: std::option::Option<T>) -> Self
9900 where
9901 T: std::convert::Into<crate::model::ProjectTeam>,
9902 {
9903 self.project_team = v.map(|x| x.into());
9904 self
9905 }
9906}
9907
9908impl wkt::message::Message for ObjectAccessControl {
9909 fn typename() -> &'static str {
9910 "type.googleapis.com/google.storage.v2.ObjectAccessControl"
9911 }
9912}
9913
9914/// The result of a call to Objects.ListObjects
9915#[derive(Clone, Default, PartialEq)]
9916#[non_exhaustive]
9917pub struct ListObjectsResponse {
9918 /// The list of items.
9919 pub objects: std::vec::Vec<crate::model::Object>,
9920
9921 /// The list of prefixes of objects matching-but-not-listed up to and including
9922 /// the requested delimiter.
9923 pub prefixes: std::vec::Vec<std::string::String>,
9924
9925 /// The continuation token, used to page through large result sets. Provide
9926 /// this value in a subsequent request to return the next page of results.
9927 pub next_page_token: std::string::String,
9928
9929 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
9930}
9931
9932impl ListObjectsResponse {
9933 /// Creates a new default instance.
9934 pub fn new() -> Self {
9935 std::default::Default::default()
9936 }
9937
9938 /// Sets the value of [objects][crate::model::ListObjectsResponse::objects].
9939 ///
9940 /// # Example
9941 /// ```ignore,no_run
9942 /// # use google_cloud_storage::model::ListObjectsResponse;
9943 /// use google_cloud_storage::model::Object;
9944 /// let x = ListObjectsResponse::new()
9945 /// .set_objects([
9946 /// Object::default()/* use setters */,
9947 /// Object::default()/* use (different) setters */,
9948 /// ]);
9949 /// ```
9950 pub fn set_objects<T, V>(mut self, v: T) -> Self
9951 where
9952 T: std::iter::IntoIterator<Item = V>,
9953 V: std::convert::Into<crate::model::Object>,
9954 {
9955 use std::iter::Iterator;
9956 self.objects = v.into_iter().map(|i| i.into()).collect();
9957 self
9958 }
9959
9960 /// Sets the value of [prefixes][crate::model::ListObjectsResponse::prefixes].
9961 ///
9962 /// # Example
9963 /// ```ignore,no_run
9964 /// # use google_cloud_storage::model::ListObjectsResponse;
9965 /// let x = ListObjectsResponse::new().set_prefixes(["a", "b", "c"]);
9966 /// ```
9967 pub fn set_prefixes<T, V>(mut self, v: T) -> Self
9968 where
9969 T: std::iter::IntoIterator<Item = V>,
9970 V: std::convert::Into<std::string::String>,
9971 {
9972 use std::iter::Iterator;
9973 self.prefixes = v.into_iter().map(|i| i.into()).collect();
9974 self
9975 }
9976
9977 /// Sets the value of [next_page_token][crate::model::ListObjectsResponse::next_page_token].
9978 ///
9979 /// # Example
9980 /// ```ignore,no_run
9981 /// # use google_cloud_storage::model::ListObjectsResponse;
9982 /// let x = ListObjectsResponse::new().set_next_page_token("example");
9983 /// ```
9984 pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9985 self.next_page_token = v.into();
9986 self
9987 }
9988}
9989
9990impl wkt::message::Message for ListObjectsResponse {
9991 fn typename() -> &'static str {
9992 "type.googleapis.com/google.storage.v2.ListObjectsResponse"
9993 }
9994}
9995
9996#[doc(hidden)]
9997impl google_cloud_gax::paginator::internal::PageableResponse for ListObjectsResponse {
9998 type PageItem = crate::model::Object;
9999
10000 fn items(self) -> std::vec::Vec<Self::PageItem> {
10001 self.objects
10002 }
10003
10004 fn next_page_token(&self) -> std::string::String {
10005 use std::clone::Clone;
10006 self.next_page_token.clone()
10007 }
10008}
10009
10010/// Represents the Viewers, Editors, or Owners of a given project.
10011#[derive(Clone, Default, PartialEq)]
10012#[non_exhaustive]
10013pub struct ProjectTeam {
10014 /// Optional. The project number.
10015 pub project_number: std::string::String,
10016
10017 /// Optional. The team.
10018 pub team: std::string::String,
10019
10020 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
10021}
10022
10023impl ProjectTeam {
10024 /// Creates a new default instance.
10025 pub fn new() -> Self {
10026 std::default::Default::default()
10027 }
10028
10029 /// Sets the value of [project_number][crate::model::ProjectTeam::project_number].
10030 ///
10031 /// # Example
10032 /// ```ignore,no_run
10033 /// # use google_cloud_storage::model::ProjectTeam;
10034 /// let x = ProjectTeam::new().set_project_number("example");
10035 /// ```
10036 pub fn set_project_number<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
10037 self.project_number = v.into();
10038 self
10039 }
10040
10041 /// Sets the value of [team][crate::model::ProjectTeam::team].
10042 ///
10043 /// # Example
10044 /// ```ignore,no_run
10045 /// # use google_cloud_storage::model::ProjectTeam;
10046 /// let x = ProjectTeam::new().set_team("example");
10047 /// ```
10048 pub fn set_team<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
10049 self.team = v.into();
10050 self
10051 }
10052}
10053
10054impl wkt::message::Message for ProjectTeam {
10055 fn typename() -> &'static str {
10056 "type.googleapis.com/google.storage.v2.ProjectTeam"
10057 }
10058}
10059
10060/// The owner of a specific resource.
10061#[derive(Clone, Default, PartialEq)]
10062#[non_exhaustive]
10063pub struct Owner {
10064 /// Optional. The entity, in the form `user-`*userId*.
10065 pub entity: std::string::String,
10066
10067 /// Optional. The ID for the entity.
10068 pub entity_id: std::string::String,
10069
10070 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
10071}
10072
10073impl Owner {
10074 /// Creates a new default instance.
10075 pub fn new() -> Self {
10076 std::default::Default::default()
10077 }
10078
10079 /// Sets the value of [entity][crate::model::Owner::entity].
10080 ///
10081 /// # Example
10082 /// ```ignore,no_run
10083 /// # use google_cloud_storage::model::Owner;
10084 /// let x = Owner::new().set_entity("example");
10085 /// ```
10086 pub fn set_entity<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
10087 self.entity = v.into();
10088 self
10089 }
10090
10091 /// Sets the value of [entity_id][crate::model::Owner::entity_id].
10092 ///
10093 /// # Example
10094 /// ```ignore,no_run
10095 /// # use google_cloud_storage::model::Owner;
10096 /// let x = Owner::new().set_entity_id("example");
10097 /// ```
10098 pub fn set_entity_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
10099 self.entity_id = v.into();
10100 self
10101 }
10102}
10103
10104impl wkt::message::Message for Owner {
10105 fn typename() -> &'static str {
10106 "type.googleapis.com/google.storage.v2.Owner"
10107 }
10108}