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::bare_urls)]
18#![allow(rustdoc::broken_intra_doc_links)]
19#![allow(rustdoc::invalid_html_tags)]
20#![allow(rustdoc::redundant_explicit_links)]
21
22mod debug;
23mod deserialize;
24mod serialize;
25
26/// Request message for [DeleteBucket][google.storage.v2.Storage.DeleteBucket].
27///
28/// [google.storage.v2.Storage.DeleteBucket]: crate::client::StorageControl::delete_bucket
29#[derive(Clone, Default, PartialEq)]
30#[non_exhaustive]
31pub struct DeleteBucketRequest {
32 /// Required. Name of a bucket to delete.
33 pub name: std::string::String,
34
35 /// If set, only deletes the bucket if its metageneration matches this value.
36 pub if_metageneration_match: std::option::Option<i64>,
37
38 /// If set, only deletes the bucket if its metageneration does not match this
39 /// value.
40 pub if_metageneration_not_match: std::option::Option<i64>,
41
42 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
43}
44
45impl DeleteBucketRequest {
46 /// Creates a new default instance.
47 pub fn new() -> Self {
48 std::default::Default::default()
49 }
50
51 /// Sets the value of [name][crate::model::DeleteBucketRequest::name].
52 ///
53 /// # Example
54 /// ```ignore,no_run
55 /// # use google_cloud_storage::model::DeleteBucketRequest;
56 /// # let project_id = "project_id";
57 /// # let bucket_id = "bucket_id";
58 /// let x = DeleteBucketRequest::new().set_name(format!("projects/{project_id}/buckets/{bucket_id}"));
59 /// ```
60 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
61 self.name = v.into();
62 self
63 }
64
65 /// Sets the value of [if_metageneration_match][crate::model::DeleteBucketRequest::if_metageneration_match].
66 ///
67 /// # Example
68 /// ```ignore,no_run
69 /// # use google_cloud_storage::model::DeleteBucketRequest;
70 /// let x = DeleteBucketRequest::new().set_if_metageneration_match(42);
71 /// ```
72 pub fn set_if_metageneration_match<T>(mut self, v: T) -> Self
73 where
74 T: std::convert::Into<i64>,
75 {
76 self.if_metageneration_match = std::option::Option::Some(v.into());
77 self
78 }
79
80 /// Sets or clears the value of [if_metageneration_match][crate::model::DeleteBucketRequest::if_metageneration_match].
81 ///
82 /// # Example
83 /// ```ignore,no_run
84 /// # use google_cloud_storage::model::DeleteBucketRequest;
85 /// let x = DeleteBucketRequest::new().set_or_clear_if_metageneration_match(Some(42));
86 /// let x = DeleteBucketRequest::new().set_or_clear_if_metageneration_match(None::<i32>);
87 /// ```
88 pub fn set_or_clear_if_metageneration_match<T>(mut self, v: std::option::Option<T>) -> Self
89 where
90 T: std::convert::Into<i64>,
91 {
92 self.if_metageneration_match = v.map(|x| x.into());
93 self
94 }
95
96 /// Sets the value of [if_metageneration_not_match][crate::model::DeleteBucketRequest::if_metageneration_not_match].
97 ///
98 /// # Example
99 /// ```ignore,no_run
100 /// # use google_cloud_storage::model::DeleteBucketRequest;
101 /// let x = DeleteBucketRequest::new().set_if_metageneration_not_match(42);
102 /// ```
103 pub fn set_if_metageneration_not_match<T>(mut self, v: T) -> Self
104 where
105 T: std::convert::Into<i64>,
106 {
107 self.if_metageneration_not_match = std::option::Option::Some(v.into());
108 self
109 }
110
111 /// Sets or clears the value of [if_metageneration_not_match][crate::model::DeleteBucketRequest::if_metageneration_not_match].
112 ///
113 /// # Example
114 /// ```ignore,no_run
115 /// # use google_cloud_storage::model::DeleteBucketRequest;
116 /// let x = DeleteBucketRequest::new().set_or_clear_if_metageneration_not_match(Some(42));
117 /// let x = DeleteBucketRequest::new().set_or_clear_if_metageneration_not_match(None::<i32>);
118 /// ```
119 pub fn set_or_clear_if_metageneration_not_match<T>(mut self, v: std::option::Option<T>) -> Self
120 where
121 T: std::convert::Into<i64>,
122 {
123 self.if_metageneration_not_match = v.map(|x| x.into());
124 self
125 }
126}
127
128impl wkt::message::Message for DeleteBucketRequest {
129 fn typename() -> &'static str {
130 "type.googleapis.com/google.storage.v2.DeleteBucketRequest"
131 }
132}
133
134/// Request message for [GetBucket][google.storage.v2.Storage.GetBucket].
135///
136/// [google.storage.v2.Storage.GetBucket]: crate::client::StorageControl::get_bucket
137#[derive(Clone, Default, PartialEq)]
138#[non_exhaustive]
139pub struct GetBucketRequest {
140 /// Required. Name of a bucket.
141 pub name: std::string::String,
142
143 /// If set, only gets the bucket metadata if its metageneration matches this
144 /// value.
145 pub if_metageneration_match: std::option::Option<i64>,
146
147 /// If set, and if the bucket's current metageneration matches the specified
148 /// value, the request returns an error.
149 pub if_metageneration_not_match: std::option::Option<i64>,
150
151 /// Mask specifying which fields to read.
152 /// A `*` field might be used to indicate all fields.
153 /// If no mask is specified, it defaults to all fields.
154 pub read_mask: std::option::Option<wkt::FieldMask>,
155
156 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
157}
158
159impl GetBucketRequest {
160 /// Creates a new default instance.
161 pub fn new() -> Self {
162 std::default::Default::default()
163 }
164
165 /// Sets the value of [name][crate::model::GetBucketRequest::name].
166 ///
167 /// # Example
168 /// ```ignore,no_run
169 /// # use google_cloud_storage::model::GetBucketRequest;
170 /// # let project_id = "project_id";
171 /// # let bucket_id = "bucket_id";
172 /// let x = GetBucketRequest::new().set_name(format!("projects/{project_id}/buckets/{bucket_id}"));
173 /// ```
174 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
175 self.name = v.into();
176 self
177 }
178
179 /// Sets the value of [if_metageneration_match][crate::model::GetBucketRequest::if_metageneration_match].
180 ///
181 /// # Example
182 /// ```ignore,no_run
183 /// # use google_cloud_storage::model::GetBucketRequest;
184 /// let x = GetBucketRequest::new().set_if_metageneration_match(42);
185 /// ```
186 pub fn set_if_metageneration_match<T>(mut self, v: T) -> Self
187 where
188 T: std::convert::Into<i64>,
189 {
190 self.if_metageneration_match = std::option::Option::Some(v.into());
191 self
192 }
193
194 /// Sets or clears the value of [if_metageneration_match][crate::model::GetBucketRequest::if_metageneration_match].
195 ///
196 /// # Example
197 /// ```ignore,no_run
198 /// # use google_cloud_storage::model::GetBucketRequest;
199 /// let x = GetBucketRequest::new().set_or_clear_if_metageneration_match(Some(42));
200 /// let x = GetBucketRequest::new().set_or_clear_if_metageneration_match(None::<i32>);
201 /// ```
202 pub fn set_or_clear_if_metageneration_match<T>(mut self, v: std::option::Option<T>) -> Self
203 where
204 T: std::convert::Into<i64>,
205 {
206 self.if_metageneration_match = v.map(|x| x.into());
207 self
208 }
209
210 /// Sets the value of [if_metageneration_not_match][crate::model::GetBucketRequest::if_metageneration_not_match].
211 ///
212 /// # Example
213 /// ```ignore,no_run
214 /// # use google_cloud_storage::model::GetBucketRequest;
215 /// let x = GetBucketRequest::new().set_if_metageneration_not_match(42);
216 /// ```
217 pub fn set_if_metageneration_not_match<T>(mut self, v: T) -> Self
218 where
219 T: std::convert::Into<i64>,
220 {
221 self.if_metageneration_not_match = std::option::Option::Some(v.into());
222 self
223 }
224
225 /// Sets or clears the value of [if_metageneration_not_match][crate::model::GetBucketRequest::if_metageneration_not_match].
226 ///
227 /// # Example
228 /// ```ignore,no_run
229 /// # use google_cloud_storage::model::GetBucketRequest;
230 /// let x = GetBucketRequest::new().set_or_clear_if_metageneration_not_match(Some(42));
231 /// let x = GetBucketRequest::new().set_or_clear_if_metageneration_not_match(None::<i32>);
232 /// ```
233 pub fn set_or_clear_if_metageneration_not_match<T>(mut self, v: std::option::Option<T>) -> Self
234 where
235 T: std::convert::Into<i64>,
236 {
237 self.if_metageneration_not_match = v.map(|x| x.into());
238 self
239 }
240
241 /// Sets the value of [read_mask][crate::model::GetBucketRequest::read_mask].
242 ///
243 /// # Example
244 /// ```ignore,no_run
245 /// # use google_cloud_storage::model::GetBucketRequest;
246 /// use wkt::FieldMask;
247 /// let x = GetBucketRequest::new().set_read_mask(FieldMask::default()/* use setters */);
248 /// ```
249 pub fn set_read_mask<T>(mut self, v: T) -> Self
250 where
251 T: std::convert::Into<wkt::FieldMask>,
252 {
253 self.read_mask = std::option::Option::Some(v.into());
254 self
255 }
256
257 /// Sets or clears the value of [read_mask][crate::model::GetBucketRequest::read_mask].
258 ///
259 /// # Example
260 /// ```ignore,no_run
261 /// # use google_cloud_storage::model::GetBucketRequest;
262 /// use wkt::FieldMask;
263 /// let x = GetBucketRequest::new().set_or_clear_read_mask(Some(FieldMask::default()/* use setters */));
264 /// let x = GetBucketRequest::new().set_or_clear_read_mask(None::<FieldMask>);
265 /// ```
266 pub fn set_or_clear_read_mask<T>(mut self, v: std::option::Option<T>) -> Self
267 where
268 T: std::convert::Into<wkt::FieldMask>,
269 {
270 self.read_mask = v.map(|x| x.into());
271 self
272 }
273}
274
275impl wkt::message::Message for GetBucketRequest {
276 fn typename() -> &'static str {
277 "type.googleapis.com/google.storage.v2.GetBucketRequest"
278 }
279}
280
281/// Request message for [CreateBucket][google.storage.v2.Storage.CreateBucket].
282///
283/// [google.storage.v2.Storage.CreateBucket]: crate::client::StorageControl::create_bucket
284#[derive(Clone, Default, PartialEq)]
285#[non_exhaustive]
286pub struct CreateBucketRequest {
287 /// Required. The project to which this bucket belongs. This field must either
288 /// be empty or `projects/_`. The project ID that owns this bucket should be
289 /// specified in the `bucket.project` field.
290 pub parent: std::string::String,
291
292 /// Optional. Properties of the new bucket being inserted.
293 /// The name of the bucket is specified in the `bucket_id` field. Populating
294 /// `bucket.name` field results in an error.
295 /// The project of the bucket must be specified in the `bucket.project` field.
296 /// This field must be in `projects/{projectIdentifier}` format,
297 /// {projectIdentifier} can be the project ID or project number. The `parent`
298 /// field must be either empty or `projects/_`.
299 pub bucket: std::option::Option<crate::model::Bucket>,
300
301 /// Required. The ID to use for this bucket, which becomes the final component
302 /// of the bucket's resource name. For example, the value `foo` might result in
303 /// a bucket with the name `projects/123456/buckets/foo`.
304 pub bucket_id: std::string::String,
305
306 /// Optional. Apply a predefined set of access controls to this bucket.
307 /// Valid values are `authenticatedRead`, `private`, `projectPrivate`,
308 /// `publicRead`, or `publicReadWrite`.
309 pub predefined_acl: std::string::String,
310
311 /// Optional. Apply a predefined set of default object access controls to this
312 /// bucket. Valid values are `authenticatedRead`, `bucketOwnerFullControl`,
313 /// `bucketOwnerRead`, `private`, `projectPrivate`, or `publicRead`.
314 pub predefined_default_object_acl: std::string::String,
315
316 /// Optional. If true, enable object retention on the bucket.
317 pub enable_object_retention: bool,
318
319 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
320}
321
322impl CreateBucketRequest {
323 /// Creates a new default instance.
324 pub fn new() -> Self {
325 std::default::Default::default()
326 }
327
328 /// Sets the value of [parent][crate::model::CreateBucketRequest::parent].
329 ///
330 /// # Example
331 /// ```ignore,no_run
332 /// # use google_cloud_storage::model::CreateBucketRequest;
333 /// # let project_id = "project_id";
334 /// let x = CreateBucketRequest::new().set_parent(format!("projects/{project_id}"));
335 /// ```
336 pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
337 self.parent = v.into();
338 self
339 }
340
341 /// Sets the value of [bucket][crate::model::CreateBucketRequest::bucket].
342 ///
343 /// # Example
344 /// ```ignore,no_run
345 /// # use google_cloud_storage::model::CreateBucketRequest;
346 /// use google_cloud_storage::model::Bucket;
347 /// let x = CreateBucketRequest::new().set_bucket(Bucket::default()/* use setters */);
348 /// ```
349 pub fn set_bucket<T>(mut self, v: T) -> Self
350 where
351 T: std::convert::Into<crate::model::Bucket>,
352 {
353 self.bucket = std::option::Option::Some(v.into());
354 self
355 }
356
357 /// Sets or clears the value of [bucket][crate::model::CreateBucketRequest::bucket].
358 ///
359 /// # Example
360 /// ```ignore,no_run
361 /// # use google_cloud_storage::model::CreateBucketRequest;
362 /// use google_cloud_storage::model::Bucket;
363 /// let x = CreateBucketRequest::new().set_or_clear_bucket(Some(Bucket::default()/* use setters */));
364 /// let x = CreateBucketRequest::new().set_or_clear_bucket(None::<Bucket>);
365 /// ```
366 pub fn set_or_clear_bucket<T>(mut self, v: std::option::Option<T>) -> Self
367 where
368 T: std::convert::Into<crate::model::Bucket>,
369 {
370 self.bucket = v.map(|x| x.into());
371 self
372 }
373
374 /// Sets the value of [bucket_id][crate::model::CreateBucketRequest::bucket_id].
375 ///
376 /// # Example
377 /// ```ignore,no_run
378 /// # use google_cloud_storage::model::CreateBucketRequest;
379 /// let x = CreateBucketRequest::new().set_bucket_id("example");
380 /// ```
381 pub fn set_bucket_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
382 self.bucket_id = v.into();
383 self
384 }
385
386 /// Sets the value of [predefined_acl][crate::model::CreateBucketRequest::predefined_acl].
387 ///
388 /// # Example
389 /// ```ignore,no_run
390 /// # use google_cloud_storage::model::CreateBucketRequest;
391 /// let x = CreateBucketRequest::new().set_predefined_acl("example");
392 /// ```
393 pub fn set_predefined_acl<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
394 self.predefined_acl = v.into();
395 self
396 }
397
398 /// Sets the value of [predefined_default_object_acl][crate::model::CreateBucketRequest::predefined_default_object_acl].
399 ///
400 /// # Example
401 /// ```ignore,no_run
402 /// # use google_cloud_storage::model::CreateBucketRequest;
403 /// let x = CreateBucketRequest::new().set_predefined_default_object_acl("example");
404 /// ```
405 pub fn set_predefined_default_object_acl<T: std::convert::Into<std::string::String>>(
406 mut self,
407 v: T,
408 ) -> Self {
409 self.predefined_default_object_acl = v.into();
410 self
411 }
412
413 /// Sets the value of [enable_object_retention][crate::model::CreateBucketRequest::enable_object_retention].
414 ///
415 /// # Example
416 /// ```ignore,no_run
417 /// # use google_cloud_storage::model::CreateBucketRequest;
418 /// let x = CreateBucketRequest::new().set_enable_object_retention(true);
419 /// ```
420 pub fn set_enable_object_retention<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
421 self.enable_object_retention = v.into();
422 self
423 }
424}
425
426impl wkt::message::Message for CreateBucketRequest {
427 fn typename() -> &'static str {
428 "type.googleapis.com/google.storage.v2.CreateBucketRequest"
429 }
430}
431
432/// Request message for [ListBuckets][google.storage.v2.Storage.ListBuckets].
433///
434/// [google.storage.v2.Storage.ListBuckets]: crate::client::StorageControl::list_buckets
435#[derive(Clone, Default, PartialEq)]
436#[non_exhaustive]
437pub struct ListBucketsRequest {
438 /// Required. The project whose buckets we are listing.
439 pub parent: std::string::String,
440
441 /// Optional. Maximum number of buckets to return in a single response. The
442 /// service uses this parameter or `1,000` items, whichever is smaller. If
443 /// `acl` is present in the `read_mask`, the service uses this parameter of
444 /// `200` items, whichever is smaller.
445 pub page_size: i32,
446
447 /// Optional. A previously-returned page token representing part of the larger
448 /// set of results to view.
449 pub page_token: std::string::String,
450
451 /// Optional. Filter results to buckets whose names begin with this prefix.
452 pub prefix: std::string::String,
453
454 /// Mask specifying which fields to read from each result.
455 /// If no mask is specified, it defaults to all fields except `items.
456 /// owner`, `items.acl`, and `items.default_object_acl`.
457 /// `*` might be used to mean "all fields".
458 pub read_mask: std::option::Option<wkt::FieldMask>,
459
460 /// Optional. Allows listing of buckets, even if there are buckets that are
461 /// unreachable.
462 pub return_partial_success: bool,
463
464 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
465}
466
467impl ListBucketsRequest {
468 /// Creates a new default instance.
469 pub fn new() -> Self {
470 std::default::Default::default()
471 }
472
473 /// Sets the value of [parent][crate::model::ListBucketsRequest::parent].
474 ///
475 /// # Example
476 /// ```ignore,no_run
477 /// # use google_cloud_storage::model::ListBucketsRequest;
478 /// # let project_id = "project_id";
479 /// let x = ListBucketsRequest::new().set_parent(format!("projects/{project_id}"));
480 /// ```
481 pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
482 self.parent = v.into();
483 self
484 }
485
486 /// Sets the value of [page_size][crate::model::ListBucketsRequest::page_size].
487 ///
488 /// # Example
489 /// ```ignore,no_run
490 /// # use google_cloud_storage::model::ListBucketsRequest;
491 /// let x = ListBucketsRequest::new().set_page_size(42);
492 /// ```
493 pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
494 self.page_size = v.into();
495 self
496 }
497
498 /// Sets the value of [page_token][crate::model::ListBucketsRequest::page_token].
499 ///
500 /// # Example
501 /// ```ignore,no_run
502 /// # use google_cloud_storage::model::ListBucketsRequest;
503 /// let x = ListBucketsRequest::new().set_page_token("example");
504 /// ```
505 pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
506 self.page_token = v.into();
507 self
508 }
509
510 /// Sets the value of [prefix][crate::model::ListBucketsRequest::prefix].
511 ///
512 /// # Example
513 /// ```ignore,no_run
514 /// # use google_cloud_storage::model::ListBucketsRequest;
515 /// let x = ListBucketsRequest::new().set_prefix("example");
516 /// ```
517 pub fn set_prefix<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
518 self.prefix = v.into();
519 self
520 }
521
522 /// Sets the value of [read_mask][crate::model::ListBucketsRequest::read_mask].
523 ///
524 /// # Example
525 /// ```ignore,no_run
526 /// # use google_cloud_storage::model::ListBucketsRequest;
527 /// use wkt::FieldMask;
528 /// let x = ListBucketsRequest::new().set_read_mask(FieldMask::default()/* use setters */);
529 /// ```
530 pub fn set_read_mask<T>(mut self, v: T) -> Self
531 where
532 T: std::convert::Into<wkt::FieldMask>,
533 {
534 self.read_mask = std::option::Option::Some(v.into());
535 self
536 }
537
538 /// Sets or clears the value of [read_mask][crate::model::ListBucketsRequest::read_mask].
539 ///
540 /// # Example
541 /// ```ignore,no_run
542 /// # use google_cloud_storage::model::ListBucketsRequest;
543 /// use wkt::FieldMask;
544 /// let x = ListBucketsRequest::new().set_or_clear_read_mask(Some(FieldMask::default()/* use setters */));
545 /// let x = ListBucketsRequest::new().set_or_clear_read_mask(None::<FieldMask>);
546 /// ```
547 pub fn set_or_clear_read_mask<T>(mut self, v: std::option::Option<T>) -> Self
548 where
549 T: std::convert::Into<wkt::FieldMask>,
550 {
551 self.read_mask = v.map(|x| x.into());
552 self
553 }
554
555 /// Sets the value of [return_partial_success][crate::model::ListBucketsRequest::return_partial_success].
556 ///
557 /// # Example
558 /// ```ignore,no_run
559 /// # use google_cloud_storage::model::ListBucketsRequest;
560 /// let x = ListBucketsRequest::new().set_return_partial_success(true);
561 /// ```
562 pub fn set_return_partial_success<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
563 self.return_partial_success = v.into();
564 self
565 }
566}
567
568impl wkt::message::Message for ListBucketsRequest {
569 fn typename() -> &'static str {
570 "type.googleapis.com/google.storage.v2.ListBucketsRequest"
571 }
572}
573
574/// Response message for [ListBuckets][google.storage.v2.Storage.ListBuckets].
575///
576/// [google.storage.v2.Storage.ListBuckets]: crate::client::StorageControl::list_buckets
577#[derive(Clone, Default, PartialEq)]
578#[non_exhaustive]
579pub struct ListBucketsResponse {
580 /// The list of items.
581 pub buckets: std::vec::Vec<crate::model::Bucket>,
582
583 /// The continuation token, used to page through large result sets. Provide
584 /// this value in a subsequent request to return the next page of results.
585 pub next_page_token: std::string::String,
586
587 /// Unreachable resources.
588 /// This field can only be present if the caller specified
589 /// return_partial_success to be true in the request to receive indications
590 /// of temporarily missing resources.
591 /// unreachable might be:
592 /// unreachable = [
593 /// "projects/_/buckets/bucket1",
594 /// "projects/_/buckets/bucket2",
595 /// "projects/_/buckets/bucket3",
596 /// ]
597 pub unreachable: std::vec::Vec<std::string::String>,
598
599 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
600}
601
602impl ListBucketsResponse {
603 /// Creates a new default instance.
604 pub fn new() -> Self {
605 std::default::Default::default()
606 }
607
608 /// Sets the value of [buckets][crate::model::ListBucketsResponse::buckets].
609 ///
610 /// # Example
611 /// ```ignore,no_run
612 /// # use google_cloud_storage::model::ListBucketsResponse;
613 /// use google_cloud_storage::model::Bucket;
614 /// let x = ListBucketsResponse::new()
615 /// .set_buckets([
616 /// Bucket::default()/* use setters */,
617 /// Bucket::default()/* use (different) setters */,
618 /// ]);
619 /// ```
620 pub fn set_buckets<T, V>(mut self, v: T) -> Self
621 where
622 T: std::iter::IntoIterator<Item = V>,
623 V: std::convert::Into<crate::model::Bucket>,
624 {
625 use std::iter::Iterator;
626 self.buckets = v.into_iter().map(|i| i.into()).collect();
627 self
628 }
629
630 /// Sets the value of [next_page_token][crate::model::ListBucketsResponse::next_page_token].
631 ///
632 /// # Example
633 /// ```ignore,no_run
634 /// # use google_cloud_storage::model::ListBucketsResponse;
635 /// let x = ListBucketsResponse::new().set_next_page_token("example");
636 /// ```
637 pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
638 self.next_page_token = v.into();
639 self
640 }
641
642 /// Sets the value of [unreachable][crate::model::ListBucketsResponse::unreachable].
643 ///
644 /// # Example
645 /// ```ignore,no_run
646 /// # use google_cloud_storage::model::ListBucketsResponse;
647 /// let x = ListBucketsResponse::new().set_unreachable(["a", "b", "c"]);
648 /// ```
649 pub fn set_unreachable<T, V>(mut self, v: T) -> Self
650 where
651 T: std::iter::IntoIterator<Item = V>,
652 V: std::convert::Into<std::string::String>,
653 {
654 use std::iter::Iterator;
655 self.unreachable = v.into_iter().map(|i| i.into()).collect();
656 self
657 }
658}
659
660impl wkt::message::Message for ListBucketsResponse {
661 fn typename() -> &'static str {
662 "type.googleapis.com/google.storage.v2.ListBucketsResponse"
663 }
664}
665
666#[doc(hidden)]
667impl google_cloud_gax::paginator::internal::PageableResponse for ListBucketsResponse {
668 type PageItem = crate::model::Bucket;
669
670 fn items(self) -> std::vec::Vec<Self::PageItem> {
671 self.buckets
672 }
673
674 fn next_page_token(&self) -> std::string::String {
675 use std::clone::Clone;
676 self.next_page_token.clone()
677 }
678}
679
680/// Request message for
681/// [LockBucketRetentionPolicy][google.storage.v2.Storage.LockBucketRetentionPolicy].
682///
683/// [google.storage.v2.Storage.LockBucketRetentionPolicy]: crate::client::StorageControl::lock_bucket_retention_policy
684#[derive(Clone, Default, PartialEq)]
685#[non_exhaustive]
686pub struct LockBucketRetentionPolicyRequest {
687 /// Required. Name of a bucket.
688 pub bucket: std::string::String,
689
690 /// Required. Makes the operation conditional on whether bucket's current
691 /// metageneration matches the given value. Must be positive.
692 pub if_metageneration_match: i64,
693
694 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
695}
696
697impl LockBucketRetentionPolicyRequest {
698 /// Creates a new default instance.
699 pub fn new() -> Self {
700 std::default::Default::default()
701 }
702
703 /// Sets the value of [bucket][crate::model::LockBucketRetentionPolicyRequest::bucket].
704 ///
705 /// # Example
706 /// ```ignore,no_run
707 /// # use google_cloud_storage::model::LockBucketRetentionPolicyRequest;
708 /// # let project_id = "project_id";
709 /// # let bucket_id = "bucket_id";
710 /// let x = LockBucketRetentionPolicyRequest::new().set_bucket(format!("projects/{project_id}/buckets/{bucket_id}"));
711 /// ```
712 pub fn set_bucket<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
713 self.bucket = v.into();
714 self
715 }
716
717 /// Sets the value of [if_metageneration_match][crate::model::LockBucketRetentionPolicyRequest::if_metageneration_match].
718 ///
719 /// # Example
720 /// ```ignore,no_run
721 /// # use google_cloud_storage::model::LockBucketRetentionPolicyRequest;
722 /// let x = LockBucketRetentionPolicyRequest::new().set_if_metageneration_match(42);
723 /// ```
724 pub fn set_if_metageneration_match<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
725 self.if_metageneration_match = v.into();
726 self
727 }
728}
729
730impl wkt::message::Message for LockBucketRetentionPolicyRequest {
731 fn typename() -> &'static str {
732 "type.googleapis.com/google.storage.v2.LockBucketRetentionPolicyRequest"
733 }
734}
735
736/// Request for [UpdateBucket][google.storage.v2.Storage.UpdateBucket] method.
737///
738/// [google.storage.v2.Storage.UpdateBucket]: crate::client::StorageControl::update_bucket
739#[derive(Clone, Default, PartialEq)]
740#[non_exhaustive]
741pub struct UpdateBucketRequest {
742 /// Required. The bucket to update.
743 /// The bucket's `name` field is used to identify the bucket.
744 pub bucket: std::option::Option<crate::model::Bucket>,
745
746 /// If set, the request modifies the bucket if its metageneration matches this
747 /// value.
748 pub if_metageneration_match: std::option::Option<i64>,
749
750 /// If set, the request modifies the bucket if its metageneration doesn't
751 /// match this value.
752 pub if_metageneration_not_match: std::option::Option<i64>,
753
754 /// Optional. Apply a predefined set of access controls to this bucket.
755 /// Valid values are `authenticatedRead`, `private`, `projectPrivate`,
756 /// `publicRead`, or `publicReadWrite`.
757 pub predefined_acl: std::string::String,
758
759 /// Optional. Apply a predefined set of default object access controls to this
760 /// bucket. Valid values are `authenticatedRead`, `bucketOwnerFullControl`,
761 /// `bucketOwnerRead`, `private`, `projectPrivate`, or `publicRead`.
762 pub predefined_default_object_acl: std::string::String,
763
764 /// Required. List of fields to be updated.
765 ///
766 /// To specify ALL fields, equivalent to the JSON API's "update" function,
767 /// specify a single field with the value `*`. Note: not recommended. If a new
768 /// field is introduced at a later time, an older client updating with the `*`
769 /// might accidentally reset the new field's value.
770 ///
771 /// Not specifying any fields is an error.
772 pub update_mask: std::option::Option<wkt::FieldMask>,
773
774 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
775}
776
777impl UpdateBucketRequest {
778 /// Creates a new default instance.
779 pub fn new() -> Self {
780 std::default::Default::default()
781 }
782
783 /// Sets the value of [bucket][crate::model::UpdateBucketRequest::bucket].
784 ///
785 /// # Example
786 /// ```ignore,no_run
787 /// # use google_cloud_storage::model::UpdateBucketRequest;
788 /// use google_cloud_storage::model::Bucket;
789 /// let x = UpdateBucketRequest::new().set_bucket(Bucket::default()/* use setters */);
790 /// ```
791 pub fn set_bucket<T>(mut self, v: T) -> Self
792 where
793 T: std::convert::Into<crate::model::Bucket>,
794 {
795 self.bucket = std::option::Option::Some(v.into());
796 self
797 }
798
799 /// Sets or clears the value of [bucket][crate::model::UpdateBucketRequest::bucket].
800 ///
801 /// # Example
802 /// ```ignore,no_run
803 /// # use google_cloud_storage::model::UpdateBucketRequest;
804 /// use google_cloud_storage::model::Bucket;
805 /// let x = UpdateBucketRequest::new().set_or_clear_bucket(Some(Bucket::default()/* use setters */));
806 /// let x = UpdateBucketRequest::new().set_or_clear_bucket(None::<Bucket>);
807 /// ```
808 pub fn set_or_clear_bucket<T>(mut self, v: std::option::Option<T>) -> Self
809 where
810 T: std::convert::Into<crate::model::Bucket>,
811 {
812 self.bucket = v.map(|x| x.into());
813 self
814 }
815
816 /// Sets the value of [if_metageneration_match][crate::model::UpdateBucketRequest::if_metageneration_match].
817 ///
818 /// # Example
819 /// ```ignore,no_run
820 /// # use google_cloud_storage::model::UpdateBucketRequest;
821 /// let x = UpdateBucketRequest::new().set_if_metageneration_match(42);
822 /// ```
823 pub fn set_if_metageneration_match<T>(mut self, v: T) -> Self
824 where
825 T: std::convert::Into<i64>,
826 {
827 self.if_metageneration_match = std::option::Option::Some(v.into());
828 self
829 }
830
831 /// Sets or clears the value of [if_metageneration_match][crate::model::UpdateBucketRequest::if_metageneration_match].
832 ///
833 /// # Example
834 /// ```ignore,no_run
835 /// # use google_cloud_storage::model::UpdateBucketRequest;
836 /// let x = UpdateBucketRequest::new().set_or_clear_if_metageneration_match(Some(42));
837 /// let x = UpdateBucketRequest::new().set_or_clear_if_metageneration_match(None::<i32>);
838 /// ```
839 pub fn set_or_clear_if_metageneration_match<T>(mut self, v: std::option::Option<T>) -> Self
840 where
841 T: std::convert::Into<i64>,
842 {
843 self.if_metageneration_match = v.map(|x| x.into());
844 self
845 }
846
847 /// Sets the value of [if_metageneration_not_match][crate::model::UpdateBucketRequest::if_metageneration_not_match].
848 ///
849 /// # Example
850 /// ```ignore,no_run
851 /// # use google_cloud_storage::model::UpdateBucketRequest;
852 /// let x = UpdateBucketRequest::new().set_if_metageneration_not_match(42);
853 /// ```
854 pub fn set_if_metageneration_not_match<T>(mut self, v: T) -> Self
855 where
856 T: std::convert::Into<i64>,
857 {
858 self.if_metageneration_not_match = std::option::Option::Some(v.into());
859 self
860 }
861
862 /// Sets or clears the value of [if_metageneration_not_match][crate::model::UpdateBucketRequest::if_metageneration_not_match].
863 ///
864 /// # Example
865 /// ```ignore,no_run
866 /// # use google_cloud_storage::model::UpdateBucketRequest;
867 /// let x = UpdateBucketRequest::new().set_or_clear_if_metageneration_not_match(Some(42));
868 /// let x = UpdateBucketRequest::new().set_or_clear_if_metageneration_not_match(None::<i32>);
869 /// ```
870 pub fn set_or_clear_if_metageneration_not_match<T>(mut self, v: std::option::Option<T>) -> Self
871 where
872 T: std::convert::Into<i64>,
873 {
874 self.if_metageneration_not_match = v.map(|x| x.into());
875 self
876 }
877
878 /// Sets the value of [predefined_acl][crate::model::UpdateBucketRequest::predefined_acl].
879 ///
880 /// # Example
881 /// ```ignore,no_run
882 /// # use google_cloud_storage::model::UpdateBucketRequest;
883 /// let x = UpdateBucketRequest::new().set_predefined_acl("example");
884 /// ```
885 pub fn set_predefined_acl<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
886 self.predefined_acl = v.into();
887 self
888 }
889
890 /// Sets the value of [predefined_default_object_acl][crate::model::UpdateBucketRequest::predefined_default_object_acl].
891 ///
892 /// # Example
893 /// ```ignore,no_run
894 /// # use google_cloud_storage::model::UpdateBucketRequest;
895 /// let x = UpdateBucketRequest::new().set_predefined_default_object_acl("example");
896 /// ```
897 pub fn set_predefined_default_object_acl<T: std::convert::Into<std::string::String>>(
898 mut self,
899 v: T,
900 ) -> Self {
901 self.predefined_default_object_acl = v.into();
902 self
903 }
904
905 /// Sets the value of [update_mask][crate::model::UpdateBucketRequest::update_mask].
906 ///
907 /// # Example
908 /// ```ignore,no_run
909 /// # use google_cloud_storage::model::UpdateBucketRequest;
910 /// use wkt::FieldMask;
911 /// let x = UpdateBucketRequest::new().set_update_mask(FieldMask::default()/* use setters */);
912 /// ```
913 pub fn set_update_mask<T>(mut self, v: T) -> Self
914 where
915 T: std::convert::Into<wkt::FieldMask>,
916 {
917 self.update_mask = std::option::Option::Some(v.into());
918 self
919 }
920
921 /// Sets or clears the value of [update_mask][crate::model::UpdateBucketRequest::update_mask].
922 ///
923 /// # Example
924 /// ```ignore,no_run
925 /// # use google_cloud_storage::model::UpdateBucketRequest;
926 /// use wkt::FieldMask;
927 /// let x = UpdateBucketRequest::new().set_or_clear_update_mask(Some(FieldMask::default()/* use setters */));
928 /// let x = UpdateBucketRequest::new().set_or_clear_update_mask(None::<FieldMask>);
929 /// ```
930 pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
931 where
932 T: std::convert::Into<wkt::FieldMask>,
933 {
934 self.update_mask = v.map(|x| x.into());
935 self
936 }
937}
938
939impl wkt::message::Message for UpdateBucketRequest {
940 fn typename() -> &'static str {
941 "type.googleapis.com/google.storage.v2.UpdateBucketRequest"
942 }
943}
944
945/// Request message for [ComposeObject][google.storage.v2.Storage.ComposeObject].
946///
947/// [google.storage.v2.Storage.ComposeObject]: crate::client::StorageControl::compose_object
948#[derive(Clone, Default, PartialEq)]
949#[non_exhaustive]
950pub struct ComposeObjectRequest {
951 /// Required. Properties of the resulting object.
952 pub destination: std::option::Option<crate::model::Object>,
953
954 /// Optional. The list of source objects that is concatenated into a single
955 /// object.
956 pub source_objects: std::vec::Vec<crate::model::compose_object_request::SourceObject>,
957
958 /// Optional. Apply a predefined set of access controls to the destination
959 /// object. Valid values are `authenticatedRead`, `bucketOwnerFullControl`,
960 /// `bucketOwnerRead`, `private`, `projectPrivate`, or `publicRead`.
961 pub destination_predefined_acl: std::string::String,
962
963 /// Makes the operation conditional on whether the object's current generation
964 /// matches the given value. Setting to 0 makes the operation succeed only if
965 /// there are no live versions of the object.
966 pub if_generation_match: std::option::Option<i64>,
967
968 /// Makes the operation conditional on whether the object's current
969 /// metageneration matches the given value.
970 pub if_metageneration_match: std::option::Option<i64>,
971
972 /// Optional. Resource name of the Cloud KMS key, of the form
973 /// `projects/my-project/locations/my-location/keyRings/my-kr/cryptoKeys/my-key`,
974 /// that is used to encrypt the object. Overrides the object
975 /// metadata's `kms_key_name` value, if any.
976 pub kms_key: std::string::String,
977
978 /// Optional. A set of parameters common to Storage API requests concerning an
979 /// object.
980 pub common_object_request_params: std::option::Option<crate::model::CommonObjectRequestParams>,
981
982 /// Optional. The checksums of the complete object. This is validated against
983 /// the combined checksums of the component objects.
984 pub object_checksums: std::option::Option<crate::model::ObjectChecksums>,
985
986 /// Whether the source objects should be deleted in the compose request.
987 pub delete_source_objects: std::option::Option<bool>,
988
989 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
990}
991
992impl ComposeObjectRequest {
993 /// Creates a new default instance.
994 pub fn new() -> Self {
995 std::default::Default::default()
996 }
997
998 /// Sets the value of [destination][crate::model::ComposeObjectRequest::destination].
999 ///
1000 /// # Example
1001 /// ```ignore,no_run
1002 /// # use google_cloud_storage::model::ComposeObjectRequest;
1003 /// use google_cloud_storage::model::Object;
1004 /// let x = ComposeObjectRequest::new().set_destination(Object::default()/* use setters */);
1005 /// ```
1006 pub fn set_destination<T>(mut self, v: T) -> Self
1007 where
1008 T: std::convert::Into<crate::model::Object>,
1009 {
1010 self.destination = std::option::Option::Some(v.into());
1011 self
1012 }
1013
1014 /// Sets or clears the value of [destination][crate::model::ComposeObjectRequest::destination].
1015 ///
1016 /// # Example
1017 /// ```ignore,no_run
1018 /// # use google_cloud_storage::model::ComposeObjectRequest;
1019 /// use google_cloud_storage::model::Object;
1020 /// let x = ComposeObjectRequest::new().set_or_clear_destination(Some(Object::default()/* use setters */));
1021 /// let x = ComposeObjectRequest::new().set_or_clear_destination(None::<Object>);
1022 /// ```
1023 pub fn set_or_clear_destination<T>(mut self, v: std::option::Option<T>) -> Self
1024 where
1025 T: std::convert::Into<crate::model::Object>,
1026 {
1027 self.destination = v.map(|x| x.into());
1028 self
1029 }
1030
1031 /// Sets the value of [source_objects][crate::model::ComposeObjectRequest::source_objects].
1032 ///
1033 /// # Example
1034 /// ```ignore,no_run
1035 /// # use google_cloud_storage::model::ComposeObjectRequest;
1036 /// use google_cloud_storage::model::compose_object_request::SourceObject;
1037 /// let x = ComposeObjectRequest::new()
1038 /// .set_source_objects([
1039 /// SourceObject::default()/* use setters */,
1040 /// SourceObject::default()/* use (different) setters */,
1041 /// ]);
1042 /// ```
1043 pub fn set_source_objects<T, V>(mut self, v: T) -> Self
1044 where
1045 T: std::iter::IntoIterator<Item = V>,
1046 V: std::convert::Into<crate::model::compose_object_request::SourceObject>,
1047 {
1048 use std::iter::Iterator;
1049 self.source_objects = v.into_iter().map(|i| i.into()).collect();
1050 self
1051 }
1052
1053 /// Sets the value of [destination_predefined_acl][crate::model::ComposeObjectRequest::destination_predefined_acl].
1054 ///
1055 /// # Example
1056 /// ```ignore,no_run
1057 /// # use google_cloud_storage::model::ComposeObjectRequest;
1058 /// let x = ComposeObjectRequest::new().set_destination_predefined_acl("example");
1059 /// ```
1060 pub fn set_destination_predefined_acl<T: std::convert::Into<std::string::String>>(
1061 mut self,
1062 v: T,
1063 ) -> Self {
1064 self.destination_predefined_acl = v.into();
1065 self
1066 }
1067
1068 /// Sets the value of [if_generation_match][crate::model::ComposeObjectRequest::if_generation_match].
1069 ///
1070 /// # Example
1071 /// ```ignore,no_run
1072 /// # use google_cloud_storage::model::ComposeObjectRequest;
1073 /// let x = ComposeObjectRequest::new().set_if_generation_match(42);
1074 /// ```
1075 pub fn set_if_generation_match<T>(mut self, v: T) -> Self
1076 where
1077 T: std::convert::Into<i64>,
1078 {
1079 self.if_generation_match = std::option::Option::Some(v.into());
1080 self
1081 }
1082
1083 /// Sets or clears the value of [if_generation_match][crate::model::ComposeObjectRequest::if_generation_match].
1084 ///
1085 /// # Example
1086 /// ```ignore,no_run
1087 /// # use google_cloud_storage::model::ComposeObjectRequest;
1088 /// let x = ComposeObjectRequest::new().set_or_clear_if_generation_match(Some(42));
1089 /// let x = ComposeObjectRequest::new().set_or_clear_if_generation_match(None::<i32>);
1090 /// ```
1091 pub fn set_or_clear_if_generation_match<T>(mut self, v: std::option::Option<T>) -> Self
1092 where
1093 T: std::convert::Into<i64>,
1094 {
1095 self.if_generation_match = v.map(|x| x.into());
1096 self
1097 }
1098
1099 /// Sets the value of [if_metageneration_match][crate::model::ComposeObjectRequest::if_metageneration_match].
1100 ///
1101 /// # Example
1102 /// ```ignore,no_run
1103 /// # use google_cloud_storage::model::ComposeObjectRequest;
1104 /// let x = ComposeObjectRequest::new().set_if_metageneration_match(42);
1105 /// ```
1106 pub fn set_if_metageneration_match<T>(mut self, v: T) -> Self
1107 where
1108 T: std::convert::Into<i64>,
1109 {
1110 self.if_metageneration_match = std::option::Option::Some(v.into());
1111 self
1112 }
1113
1114 /// Sets or clears the value of [if_metageneration_match][crate::model::ComposeObjectRequest::if_metageneration_match].
1115 ///
1116 /// # Example
1117 /// ```ignore,no_run
1118 /// # use google_cloud_storage::model::ComposeObjectRequest;
1119 /// let x = ComposeObjectRequest::new().set_or_clear_if_metageneration_match(Some(42));
1120 /// let x = ComposeObjectRequest::new().set_or_clear_if_metageneration_match(None::<i32>);
1121 /// ```
1122 pub fn set_or_clear_if_metageneration_match<T>(mut self, v: std::option::Option<T>) -> Self
1123 where
1124 T: std::convert::Into<i64>,
1125 {
1126 self.if_metageneration_match = v.map(|x| x.into());
1127 self
1128 }
1129
1130 /// Sets the value of [kms_key][crate::model::ComposeObjectRequest::kms_key].
1131 ///
1132 /// # Example
1133 /// ```ignore,no_run
1134 /// # use google_cloud_storage::model::ComposeObjectRequest;
1135 /// let x = ComposeObjectRequest::new().set_kms_key("example");
1136 /// ```
1137 pub fn set_kms_key<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1138 self.kms_key = v.into();
1139 self
1140 }
1141
1142 /// Sets the value of [common_object_request_params][crate::model::ComposeObjectRequest::common_object_request_params].
1143 ///
1144 /// # Example
1145 /// ```ignore,no_run
1146 /// # use google_cloud_storage::model::ComposeObjectRequest;
1147 /// use google_cloud_storage::model::CommonObjectRequestParams;
1148 /// let x = ComposeObjectRequest::new().set_common_object_request_params(CommonObjectRequestParams::default()/* use setters */);
1149 /// ```
1150 pub fn set_common_object_request_params<T>(mut self, v: T) -> Self
1151 where
1152 T: std::convert::Into<crate::model::CommonObjectRequestParams>,
1153 {
1154 self.common_object_request_params = std::option::Option::Some(v.into());
1155 self
1156 }
1157
1158 /// Sets or clears the value of [common_object_request_params][crate::model::ComposeObjectRequest::common_object_request_params].
1159 ///
1160 /// # Example
1161 /// ```ignore,no_run
1162 /// # use google_cloud_storage::model::ComposeObjectRequest;
1163 /// use google_cloud_storage::model::CommonObjectRequestParams;
1164 /// let x = ComposeObjectRequest::new().set_or_clear_common_object_request_params(Some(CommonObjectRequestParams::default()/* use setters */));
1165 /// let x = ComposeObjectRequest::new().set_or_clear_common_object_request_params(None::<CommonObjectRequestParams>);
1166 /// ```
1167 pub fn set_or_clear_common_object_request_params<T>(mut self, v: std::option::Option<T>) -> Self
1168 where
1169 T: std::convert::Into<crate::model::CommonObjectRequestParams>,
1170 {
1171 self.common_object_request_params = v.map(|x| x.into());
1172 self
1173 }
1174
1175 /// Sets the value of [object_checksums][crate::model::ComposeObjectRequest::object_checksums].
1176 ///
1177 /// # Example
1178 /// ```ignore,no_run
1179 /// # use google_cloud_storage::model::ComposeObjectRequest;
1180 /// use google_cloud_storage::model::ObjectChecksums;
1181 /// let x = ComposeObjectRequest::new().set_object_checksums(ObjectChecksums::default()/* use setters */);
1182 /// ```
1183 pub fn set_object_checksums<T>(mut self, v: T) -> Self
1184 where
1185 T: std::convert::Into<crate::model::ObjectChecksums>,
1186 {
1187 self.object_checksums = std::option::Option::Some(v.into());
1188 self
1189 }
1190
1191 /// Sets or clears the value of [object_checksums][crate::model::ComposeObjectRequest::object_checksums].
1192 ///
1193 /// # Example
1194 /// ```ignore,no_run
1195 /// # use google_cloud_storage::model::ComposeObjectRequest;
1196 /// use google_cloud_storage::model::ObjectChecksums;
1197 /// let x = ComposeObjectRequest::new().set_or_clear_object_checksums(Some(ObjectChecksums::default()/* use setters */));
1198 /// let x = ComposeObjectRequest::new().set_or_clear_object_checksums(None::<ObjectChecksums>);
1199 /// ```
1200 pub fn set_or_clear_object_checksums<T>(mut self, v: std::option::Option<T>) -> Self
1201 where
1202 T: std::convert::Into<crate::model::ObjectChecksums>,
1203 {
1204 self.object_checksums = v.map(|x| x.into());
1205 self
1206 }
1207
1208 /// Sets the value of [delete_source_objects][crate::model::ComposeObjectRequest::delete_source_objects].
1209 ///
1210 /// # Example
1211 /// ```ignore,no_run
1212 /// # use google_cloud_storage::model::ComposeObjectRequest;
1213 /// let x = ComposeObjectRequest::new().set_delete_source_objects(true);
1214 /// ```
1215 pub fn set_delete_source_objects<T>(mut self, v: T) -> Self
1216 where
1217 T: std::convert::Into<bool>,
1218 {
1219 self.delete_source_objects = std::option::Option::Some(v.into());
1220 self
1221 }
1222
1223 /// Sets or clears the value of [delete_source_objects][crate::model::ComposeObjectRequest::delete_source_objects].
1224 ///
1225 /// # Example
1226 /// ```ignore,no_run
1227 /// # use google_cloud_storage::model::ComposeObjectRequest;
1228 /// let x = ComposeObjectRequest::new().set_or_clear_delete_source_objects(Some(false));
1229 /// let x = ComposeObjectRequest::new().set_or_clear_delete_source_objects(None::<bool>);
1230 /// ```
1231 pub fn set_or_clear_delete_source_objects<T>(mut self, v: std::option::Option<T>) -> Self
1232 where
1233 T: std::convert::Into<bool>,
1234 {
1235 self.delete_source_objects = v.map(|x| x.into());
1236 self
1237 }
1238}
1239
1240impl wkt::message::Message for ComposeObjectRequest {
1241 fn typename() -> &'static str {
1242 "type.googleapis.com/google.storage.v2.ComposeObjectRequest"
1243 }
1244}
1245
1246/// Defines additional types related to [ComposeObjectRequest].
1247pub mod compose_object_request {
1248 #[allow(unused_imports)]
1249 use super::*;
1250
1251 /// Description of a source object for a composition request.
1252 #[derive(Clone, Default, PartialEq)]
1253 #[non_exhaustive]
1254 pub struct SourceObject {
1255 /// Required. The source object's name. All source objects must reside in the
1256 /// same bucket.
1257 pub name: std::string::String,
1258
1259 /// Optional. The generation of this object to use as the source.
1260 pub generation: i64,
1261
1262 /// Optional. Conditions that must be met for this operation to execute.
1263 pub object_preconditions: std::option::Option<
1264 crate::model::compose_object_request::source_object::ObjectPreconditions,
1265 >,
1266
1267 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1268 }
1269
1270 impl SourceObject {
1271 /// Creates a new default instance.
1272 pub fn new() -> Self {
1273 std::default::Default::default()
1274 }
1275
1276 /// Sets the value of [name][crate::model::compose_object_request::SourceObject::name].
1277 ///
1278 /// # Example
1279 /// ```ignore,no_run
1280 /// # use google_cloud_storage::model::compose_object_request::SourceObject;
1281 /// let x = SourceObject::new().set_name("example");
1282 /// ```
1283 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1284 self.name = v.into();
1285 self
1286 }
1287
1288 /// Sets the value of [generation][crate::model::compose_object_request::SourceObject::generation].
1289 ///
1290 /// # Example
1291 /// ```ignore,no_run
1292 /// # use google_cloud_storage::model::compose_object_request::SourceObject;
1293 /// let x = SourceObject::new().set_generation(42);
1294 /// ```
1295 pub fn set_generation<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
1296 self.generation = v.into();
1297 self
1298 }
1299
1300 /// Sets the value of [object_preconditions][crate::model::compose_object_request::SourceObject::object_preconditions].
1301 ///
1302 /// # Example
1303 /// ```ignore,no_run
1304 /// # use google_cloud_storage::model::compose_object_request::SourceObject;
1305 /// use google_cloud_storage::model::compose_object_request::source_object::ObjectPreconditions;
1306 /// let x = SourceObject::new().set_object_preconditions(ObjectPreconditions::default()/* use setters */);
1307 /// ```
1308 pub fn set_object_preconditions<T>(mut self, v: T) -> Self
1309 where
1310 T: std::convert::Into<
1311 crate::model::compose_object_request::source_object::ObjectPreconditions,
1312 >,
1313 {
1314 self.object_preconditions = std::option::Option::Some(v.into());
1315 self
1316 }
1317
1318 /// Sets or clears the value of [object_preconditions][crate::model::compose_object_request::SourceObject::object_preconditions].
1319 ///
1320 /// # Example
1321 /// ```ignore,no_run
1322 /// # use google_cloud_storage::model::compose_object_request::SourceObject;
1323 /// use google_cloud_storage::model::compose_object_request::source_object::ObjectPreconditions;
1324 /// let x = SourceObject::new().set_or_clear_object_preconditions(Some(ObjectPreconditions::default()/* use setters */));
1325 /// let x = SourceObject::new().set_or_clear_object_preconditions(None::<ObjectPreconditions>);
1326 /// ```
1327 pub fn set_or_clear_object_preconditions<T>(mut self, v: std::option::Option<T>) -> Self
1328 where
1329 T: std::convert::Into<
1330 crate::model::compose_object_request::source_object::ObjectPreconditions,
1331 >,
1332 {
1333 self.object_preconditions = v.map(|x| x.into());
1334 self
1335 }
1336 }
1337
1338 impl wkt::message::Message for SourceObject {
1339 fn typename() -> &'static str {
1340 "type.googleapis.com/google.storage.v2.ComposeObjectRequest.SourceObject"
1341 }
1342 }
1343
1344 /// Defines additional types related to [SourceObject].
1345 pub mod source_object {
1346 #[allow(unused_imports)]
1347 use super::*;
1348
1349 /// Preconditions for a source object of a composition request.
1350 #[derive(Clone, Default, PartialEq)]
1351 #[non_exhaustive]
1352 pub struct ObjectPreconditions {
1353 /// Only perform the composition if the generation of the source object
1354 /// that would be used matches this value. If this value and a generation
1355 /// are both specified, they must be the same value or the call fails.
1356 pub if_generation_match: std::option::Option<i64>,
1357
1358 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1359 }
1360
1361 impl ObjectPreconditions {
1362 /// Creates a new default instance.
1363 pub fn new() -> Self {
1364 std::default::Default::default()
1365 }
1366
1367 /// Sets the value of [if_generation_match][crate::model::compose_object_request::source_object::ObjectPreconditions::if_generation_match].
1368 ///
1369 /// # Example
1370 /// ```ignore,no_run
1371 /// # use google_cloud_storage::model::compose_object_request::source_object::ObjectPreconditions;
1372 /// let x = ObjectPreconditions::new().set_if_generation_match(42);
1373 /// ```
1374 pub fn set_if_generation_match<T>(mut self, v: T) -> Self
1375 where
1376 T: std::convert::Into<i64>,
1377 {
1378 self.if_generation_match = std::option::Option::Some(v.into());
1379 self
1380 }
1381
1382 /// Sets or clears the value of [if_generation_match][crate::model::compose_object_request::source_object::ObjectPreconditions::if_generation_match].
1383 ///
1384 /// # Example
1385 /// ```ignore,no_run
1386 /// # use google_cloud_storage::model::compose_object_request::source_object::ObjectPreconditions;
1387 /// let x = ObjectPreconditions::new().set_or_clear_if_generation_match(Some(42));
1388 /// let x = ObjectPreconditions::new().set_or_clear_if_generation_match(None::<i32>);
1389 /// ```
1390 pub fn set_or_clear_if_generation_match<T>(mut self, v: std::option::Option<T>) -> Self
1391 where
1392 T: std::convert::Into<i64>,
1393 {
1394 self.if_generation_match = v.map(|x| x.into());
1395 self
1396 }
1397 }
1398
1399 impl wkt::message::Message for ObjectPreconditions {
1400 fn typename() -> &'static str {
1401 "type.googleapis.com/google.storage.v2.ComposeObjectRequest.SourceObject.ObjectPreconditions"
1402 }
1403 }
1404 }
1405}
1406
1407/// Request message for deleting an object.
1408#[derive(Clone, Default, PartialEq)]
1409#[non_exhaustive]
1410pub struct DeleteObjectRequest {
1411 /// Required. Name of the bucket in which the object resides.
1412 pub bucket: std::string::String,
1413
1414 /// Required. The name of the finalized object to delete.
1415 /// Note: If you want to delete an unfinalized resumable upload please use
1416 /// `CancelResumableWrite`.
1417 pub object: std::string::String,
1418
1419 /// Optional. If present, permanently deletes a specific revision of this
1420 /// object (as opposed to the latest version, the default).
1421 pub generation: i64,
1422
1423 /// Makes the operation conditional on whether the object's current generation
1424 /// matches the given value. Setting to 0 makes the operation succeed only if
1425 /// there are no live versions of the object.
1426 pub if_generation_match: std::option::Option<i64>,
1427
1428 /// Makes the operation conditional on whether the object's live generation
1429 /// does not match the given value. If no live object exists, the precondition
1430 /// fails. Setting to 0 makes the operation succeed only if there is a live
1431 /// version of the object.
1432 pub if_generation_not_match: std::option::Option<i64>,
1433
1434 /// Makes the operation conditional on whether the object's current
1435 /// metageneration matches the given value.
1436 pub if_metageneration_match: std::option::Option<i64>,
1437
1438 /// Makes the operation conditional on whether the object's current
1439 /// metageneration does not match the given value.
1440 pub if_metageneration_not_match: std::option::Option<i64>,
1441
1442 /// Optional. A set of parameters common to Storage API requests concerning an
1443 /// object.
1444 pub common_object_request_params: std::option::Option<crate::model::CommonObjectRequestParams>,
1445
1446 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1447}
1448
1449impl DeleteObjectRequest {
1450 /// Creates a new default instance.
1451 pub fn new() -> Self {
1452 std::default::Default::default()
1453 }
1454
1455 /// Sets the value of [bucket][crate::model::DeleteObjectRequest::bucket].
1456 ///
1457 /// # Example
1458 /// ```ignore,no_run
1459 /// # use google_cloud_storage::model::DeleteObjectRequest;
1460 /// # let project_id = "project_id";
1461 /// # let bucket_id = "bucket_id";
1462 /// let x = DeleteObjectRequest::new().set_bucket(format!("projects/{project_id}/buckets/{bucket_id}"));
1463 /// ```
1464 pub fn set_bucket<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1465 self.bucket = v.into();
1466 self
1467 }
1468
1469 /// Sets the value of [object][crate::model::DeleteObjectRequest::object].
1470 ///
1471 /// # Example
1472 /// ```ignore,no_run
1473 /// # use google_cloud_storage::model::DeleteObjectRequest;
1474 /// let x = DeleteObjectRequest::new().set_object("example");
1475 /// ```
1476 pub fn set_object<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1477 self.object = v.into();
1478 self
1479 }
1480
1481 /// Sets the value of [generation][crate::model::DeleteObjectRequest::generation].
1482 ///
1483 /// # Example
1484 /// ```ignore,no_run
1485 /// # use google_cloud_storage::model::DeleteObjectRequest;
1486 /// let x = DeleteObjectRequest::new().set_generation(42);
1487 /// ```
1488 pub fn set_generation<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
1489 self.generation = v.into();
1490 self
1491 }
1492
1493 /// Sets the value of [if_generation_match][crate::model::DeleteObjectRequest::if_generation_match].
1494 ///
1495 /// # Example
1496 /// ```ignore,no_run
1497 /// # use google_cloud_storage::model::DeleteObjectRequest;
1498 /// let x = DeleteObjectRequest::new().set_if_generation_match(42);
1499 /// ```
1500 pub fn set_if_generation_match<T>(mut self, v: T) -> Self
1501 where
1502 T: std::convert::Into<i64>,
1503 {
1504 self.if_generation_match = std::option::Option::Some(v.into());
1505 self
1506 }
1507
1508 /// Sets or clears the value of [if_generation_match][crate::model::DeleteObjectRequest::if_generation_match].
1509 ///
1510 /// # Example
1511 /// ```ignore,no_run
1512 /// # use google_cloud_storage::model::DeleteObjectRequest;
1513 /// let x = DeleteObjectRequest::new().set_or_clear_if_generation_match(Some(42));
1514 /// let x = DeleteObjectRequest::new().set_or_clear_if_generation_match(None::<i32>);
1515 /// ```
1516 pub fn set_or_clear_if_generation_match<T>(mut self, v: std::option::Option<T>) -> Self
1517 where
1518 T: std::convert::Into<i64>,
1519 {
1520 self.if_generation_match = v.map(|x| x.into());
1521 self
1522 }
1523
1524 /// Sets the value of [if_generation_not_match][crate::model::DeleteObjectRequest::if_generation_not_match].
1525 ///
1526 /// # Example
1527 /// ```ignore,no_run
1528 /// # use google_cloud_storage::model::DeleteObjectRequest;
1529 /// let x = DeleteObjectRequest::new().set_if_generation_not_match(42);
1530 /// ```
1531 pub fn set_if_generation_not_match<T>(mut self, v: T) -> Self
1532 where
1533 T: std::convert::Into<i64>,
1534 {
1535 self.if_generation_not_match = std::option::Option::Some(v.into());
1536 self
1537 }
1538
1539 /// Sets or clears the value of [if_generation_not_match][crate::model::DeleteObjectRequest::if_generation_not_match].
1540 ///
1541 /// # Example
1542 /// ```ignore,no_run
1543 /// # use google_cloud_storage::model::DeleteObjectRequest;
1544 /// let x = DeleteObjectRequest::new().set_or_clear_if_generation_not_match(Some(42));
1545 /// let x = DeleteObjectRequest::new().set_or_clear_if_generation_not_match(None::<i32>);
1546 /// ```
1547 pub fn set_or_clear_if_generation_not_match<T>(mut self, v: std::option::Option<T>) -> Self
1548 where
1549 T: std::convert::Into<i64>,
1550 {
1551 self.if_generation_not_match = v.map(|x| x.into());
1552 self
1553 }
1554
1555 /// Sets the value of [if_metageneration_match][crate::model::DeleteObjectRequest::if_metageneration_match].
1556 ///
1557 /// # Example
1558 /// ```ignore,no_run
1559 /// # use google_cloud_storage::model::DeleteObjectRequest;
1560 /// let x = DeleteObjectRequest::new().set_if_metageneration_match(42);
1561 /// ```
1562 pub fn set_if_metageneration_match<T>(mut self, v: T) -> Self
1563 where
1564 T: std::convert::Into<i64>,
1565 {
1566 self.if_metageneration_match = std::option::Option::Some(v.into());
1567 self
1568 }
1569
1570 /// Sets or clears the value of [if_metageneration_match][crate::model::DeleteObjectRequest::if_metageneration_match].
1571 ///
1572 /// # Example
1573 /// ```ignore,no_run
1574 /// # use google_cloud_storage::model::DeleteObjectRequest;
1575 /// let x = DeleteObjectRequest::new().set_or_clear_if_metageneration_match(Some(42));
1576 /// let x = DeleteObjectRequest::new().set_or_clear_if_metageneration_match(None::<i32>);
1577 /// ```
1578 pub fn set_or_clear_if_metageneration_match<T>(mut self, v: std::option::Option<T>) -> Self
1579 where
1580 T: std::convert::Into<i64>,
1581 {
1582 self.if_metageneration_match = v.map(|x| x.into());
1583 self
1584 }
1585
1586 /// Sets the value of [if_metageneration_not_match][crate::model::DeleteObjectRequest::if_metageneration_not_match].
1587 ///
1588 /// # Example
1589 /// ```ignore,no_run
1590 /// # use google_cloud_storage::model::DeleteObjectRequest;
1591 /// let x = DeleteObjectRequest::new().set_if_metageneration_not_match(42);
1592 /// ```
1593 pub fn set_if_metageneration_not_match<T>(mut self, v: T) -> Self
1594 where
1595 T: std::convert::Into<i64>,
1596 {
1597 self.if_metageneration_not_match = std::option::Option::Some(v.into());
1598 self
1599 }
1600
1601 /// Sets or clears the value of [if_metageneration_not_match][crate::model::DeleteObjectRequest::if_metageneration_not_match].
1602 ///
1603 /// # Example
1604 /// ```ignore,no_run
1605 /// # use google_cloud_storage::model::DeleteObjectRequest;
1606 /// let x = DeleteObjectRequest::new().set_or_clear_if_metageneration_not_match(Some(42));
1607 /// let x = DeleteObjectRequest::new().set_or_clear_if_metageneration_not_match(None::<i32>);
1608 /// ```
1609 pub fn set_or_clear_if_metageneration_not_match<T>(mut self, v: std::option::Option<T>) -> Self
1610 where
1611 T: std::convert::Into<i64>,
1612 {
1613 self.if_metageneration_not_match = v.map(|x| x.into());
1614 self
1615 }
1616
1617 /// Sets the value of [common_object_request_params][crate::model::DeleteObjectRequest::common_object_request_params].
1618 ///
1619 /// # Example
1620 /// ```ignore,no_run
1621 /// # use google_cloud_storage::model::DeleteObjectRequest;
1622 /// use google_cloud_storage::model::CommonObjectRequestParams;
1623 /// let x = DeleteObjectRequest::new().set_common_object_request_params(CommonObjectRequestParams::default()/* use setters */);
1624 /// ```
1625 pub fn set_common_object_request_params<T>(mut self, v: T) -> Self
1626 where
1627 T: std::convert::Into<crate::model::CommonObjectRequestParams>,
1628 {
1629 self.common_object_request_params = std::option::Option::Some(v.into());
1630 self
1631 }
1632
1633 /// Sets or clears the value of [common_object_request_params][crate::model::DeleteObjectRequest::common_object_request_params].
1634 ///
1635 /// # Example
1636 /// ```ignore,no_run
1637 /// # use google_cloud_storage::model::DeleteObjectRequest;
1638 /// use google_cloud_storage::model::CommonObjectRequestParams;
1639 /// let x = DeleteObjectRequest::new().set_or_clear_common_object_request_params(Some(CommonObjectRequestParams::default()/* use setters */));
1640 /// let x = DeleteObjectRequest::new().set_or_clear_common_object_request_params(None::<CommonObjectRequestParams>);
1641 /// ```
1642 pub fn set_or_clear_common_object_request_params<T>(mut self, v: std::option::Option<T>) -> Self
1643 where
1644 T: std::convert::Into<crate::model::CommonObjectRequestParams>,
1645 {
1646 self.common_object_request_params = v.map(|x| x.into());
1647 self
1648 }
1649}
1650
1651impl wkt::message::Message for DeleteObjectRequest {
1652 fn typename() -> &'static str {
1653 "type.googleapis.com/google.storage.v2.DeleteObjectRequest"
1654 }
1655}
1656
1657/// Request message for
1658/// [RestoreObject][google.storage.v2.Storage.RestoreObject].
1659/// `bucket`, `object`, and `generation` **must** be set.
1660///
1661/// [google.storage.v2.Storage.RestoreObject]: crate::client::StorageControl::restore_object
1662#[derive(Clone, Default, PartialEq)]
1663#[non_exhaustive]
1664pub struct RestoreObjectRequest {
1665 /// Required. Name of the bucket in which the object resides.
1666 pub bucket: std::string::String,
1667
1668 /// Required. The name of the object to restore.
1669 pub object: std::string::String,
1670
1671 /// Required. The specific revision of the object to restore.
1672 pub generation: i64,
1673
1674 /// Optional. Restore token used to differentiate soft-deleted objects with the
1675 /// same name and generation. Only applicable for hierarchical namespace
1676 /// buckets. This parameter is optional, and is only required in the rare case
1677 /// when there are multiple soft-deleted objects with the same name and
1678 /// generation.
1679 pub restore_token: std::string::String,
1680
1681 /// Makes the operation conditional on whether the object's current generation
1682 /// matches the given value. Setting to 0 makes the operation succeed only if
1683 /// there are no live versions of the object.
1684 pub if_generation_match: std::option::Option<i64>,
1685
1686 /// Makes the operation conditional on whether the object's live generation
1687 /// does not match the given value. If no live object exists, the precondition
1688 /// fails. Setting to 0 makes the operation succeed only if there is a live
1689 /// version of the object.
1690 pub if_generation_not_match: std::option::Option<i64>,
1691
1692 /// Makes the operation conditional on whether the object's current
1693 /// metageneration matches the given value.
1694 pub if_metageneration_match: std::option::Option<i64>,
1695
1696 /// Makes the operation conditional on whether the object's current
1697 /// metageneration does not match the given value.
1698 pub if_metageneration_not_match: std::option::Option<i64>,
1699
1700 /// If false or unset, the bucket's default object ACL is used.
1701 /// If true, copy the source object's access controls.
1702 /// Return an error if bucket has UBLA enabled.
1703 pub copy_source_acl: std::option::Option<bool>,
1704
1705 /// Optional. A set of parameters common to Storage API requests concerning an
1706 /// object.
1707 pub common_object_request_params: std::option::Option<crate::model::CommonObjectRequestParams>,
1708
1709 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1710}
1711
1712impl RestoreObjectRequest {
1713 /// Creates a new default instance.
1714 pub fn new() -> Self {
1715 std::default::Default::default()
1716 }
1717
1718 /// Sets the value of [bucket][crate::model::RestoreObjectRequest::bucket].
1719 ///
1720 /// # Example
1721 /// ```ignore,no_run
1722 /// # use google_cloud_storage::model::RestoreObjectRequest;
1723 /// # let project_id = "project_id";
1724 /// # let bucket_id = "bucket_id";
1725 /// let x = RestoreObjectRequest::new().set_bucket(format!("projects/{project_id}/buckets/{bucket_id}"));
1726 /// ```
1727 pub fn set_bucket<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1728 self.bucket = v.into();
1729 self
1730 }
1731
1732 /// Sets the value of [object][crate::model::RestoreObjectRequest::object].
1733 ///
1734 /// # Example
1735 /// ```ignore,no_run
1736 /// # use google_cloud_storage::model::RestoreObjectRequest;
1737 /// let x = RestoreObjectRequest::new().set_object("example");
1738 /// ```
1739 pub fn set_object<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1740 self.object = v.into();
1741 self
1742 }
1743
1744 /// Sets the value of [generation][crate::model::RestoreObjectRequest::generation].
1745 ///
1746 /// # Example
1747 /// ```ignore,no_run
1748 /// # use google_cloud_storage::model::RestoreObjectRequest;
1749 /// let x = RestoreObjectRequest::new().set_generation(42);
1750 /// ```
1751 pub fn set_generation<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
1752 self.generation = v.into();
1753 self
1754 }
1755
1756 /// Sets the value of [restore_token][crate::model::RestoreObjectRequest::restore_token].
1757 ///
1758 /// # Example
1759 /// ```ignore,no_run
1760 /// # use google_cloud_storage::model::RestoreObjectRequest;
1761 /// let x = RestoreObjectRequest::new().set_restore_token("example");
1762 /// ```
1763 pub fn set_restore_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1764 self.restore_token = v.into();
1765 self
1766 }
1767
1768 /// Sets the value of [if_generation_match][crate::model::RestoreObjectRequest::if_generation_match].
1769 ///
1770 /// # Example
1771 /// ```ignore,no_run
1772 /// # use google_cloud_storage::model::RestoreObjectRequest;
1773 /// let x = RestoreObjectRequest::new().set_if_generation_match(42);
1774 /// ```
1775 pub fn set_if_generation_match<T>(mut self, v: T) -> Self
1776 where
1777 T: std::convert::Into<i64>,
1778 {
1779 self.if_generation_match = std::option::Option::Some(v.into());
1780 self
1781 }
1782
1783 /// Sets or clears the value of [if_generation_match][crate::model::RestoreObjectRequest::if_generation_match].
1784 ///
1785 /// # Example
1786 /// ```ignore,no_run
1787 /// # use google_cloud_storage::model::RestoreObjectRequest;
1788 /// let x = RestoreObjectRequest::new().set_or_clear_if_generation_match(Some(42));
1789 /// let x = RestoreObjectRequest::new().set_or_clear_if_generation_match(None::<i32>);
1790 /// ```
1791 pub fn set_or_clear_if_generation_match<T>(mut self, v: std::option::Option<T>) -> Self
1792 where
1793 T: std::convert::Into<i64>,
1794 {
1795 self.if_generation_match = v.map(|x| x.into());
1796 self
1797 }
1798
1799 /// Sets the value of [if_generation_not_match][crate::model::RestoreObjectRequest::if_generation_not_match].
1800 ///
1801 /// # Example
1802 /// ```ignore,no_run
1803 /// # use google_cloud_storage::model::RestoreObjectRequest;
1804 /// let x = RestoreObjectRequest::new().set_if_generation_not_match(42);
1805 /// ```
1806 pub fn set_if_generation_not_match<T>(mut self, v: T) -> Self
1807 where
1808 T: std::convert::Into<i64>,
1809 {
1810 self.if_generation_not_match = std::option::Option::Some(v.into());
1811 self
1812 }
1813
1814 /// Sets or clears the value of [if_generation_not_match][crate::model::RestoreObjectRequest::if_generation_not_match].
1815 ///
1816 /// # Example
1817 /// ```ignore,no_run
1818 /// # use google_cloud_storage::model::RestoreObjectRequest;
1819 /// let x = RestoreObjectRequest::new().set_or_clear_if_generation_not_match(Some(42));
1820 /// let x = RestoreObjectRequest::new().set_or_clear_if_generation_not_match(None::<i32>);
1821 /// ```
1822 pub fn set_or_clear_if_generation_not_match<T>(mut self, v: std::option::Option<T>) -> Self
1823 where
1824 T: std::convert::Into<i64>,
1825 {
1826 self.if_generation_not_match = v.map(|x| x.into());
1827 self
1828 }
1829
1830 /// Sets the value of [if_metageneration_match][crate::model::RestoreObjectRequest::if_metageneration_match].
1831 ///
1832 /// # Example
1833 /// ```ignore,no_run
1834 /// # use google_cloud_storage::model::RestoreObjectRequest;
1835 /// let x = RestoreObjectRequest::new().set_if_metageneration_match(42);
1836 /// ```
1837 pub fn set_if_metageneration_match<T>(mut self, v: T) -> Self
1838 where
1839 T: std::convert::Into<i64>,
1840 {
1841 self.if_metageneration_match = std::option::Option::Some(v.into());
1842 self
1843 }
1844
1845 /// Sets or clears the value of [if_metageneration_match][crate::model::RestoreObjectRequest::if_metageneration_match].
1846 ///
1847 /// # Example
1848 /// ```ignore,no_run
1849 /// # use google_cloud_storage::model::RestoreObjectRequest;
1850 /// let x = RestoreObjectRequest::new().set_or_clear_if_metageneration_match(Some(42));
1851 /// let x = RestoreObjectRequest::new().set_or_clear_if_metageneration_match(None::<i32>);
1852 /// ```
1853 pub fn set_or_clear_if_metageneration_match<T>(mut self, v: std::option::Option<T>) -> Self
1854 where
1855 T: std::convert::Into<i64>,
1856 {
1857 self.if_metageneration_match = v.map(|x| x.into());
1858 self
1859 }
1860
1861 /// Sets the value of [if_metageneration_not_match][crate::model::RestoreObjectRequest::if_metageneration_not_match].
1862 ///
1863 /// # Example
1864 /// ```ignore,no_run
1865 /// # use google_cloud_storage::model::RestoreObjectRequest;
1866 /// let x = RestoreObjectRequest::new().set_if_metageneration_not_match(42);
1867 /// ```
1868 pub fn set_if_metageneration_not_match<T>(mut self, v: T) -> Self
1869 where
1870 T: std::convert::Into<i64>,
1871 {
1872 self.if_metageneration_not_match = std::option::Option::Some(v.into());
1873 self
1874 }
1875
1876 /// Sets or clears the value of [if_metageneration_not_match][crate::model::RestoreObjectRequest::if_metageneration_not_match].
1877 ///
1878 /// # Example
1879 /// ```ignore,no_run
1880 /// # use google_cloud_storage::model::RestoreObjectRequest;
1881 /// let x = RestoreObjectRequest::new().set_or_clear_if_metageneration_not_match(Some(42));
1882 /// let x = RestoreObjectRequest::new().set_or_clear_if_metageneration_not_match(None::<i32>);
1883 /// ```
1884 pub fn set_or_clear_if_metageneration_not_match<T>(mut self, v: std::option::Option<T>) -> Self
1885 where
1886 T: std::convert::Into<i64>,
1887 {
1888 self.if_metageneration_not_match = v.map(|x| x.into());
1889 self
1890 }
1891
1892 /// Sets the value of [copy_source_acl][crate::model::RestoreObjectRequest::copy_source_acl].
1893 ///
1894 /// # Example
1895 /// ```ignore,no_run
1896 /// # use google_cloud_storage::model::RestoreObjectRequest;
1897 /// let x = RestoreObjectRequest::new().set_copy_source_acl(true);
1898 /// ```
1899 pub fn set_copy_source_acl<T>(mut self, v: T) -> Self
1900 where
1901 T: std::convert::Into<bool>,
1902 {
1903 self.copy_source_acl = std::option::Option::Some(v.into());
1904 self
1905 }
1906
1907 /// Sets or clears the value of [copy_source_acl][crate::model::RestoreObjectRequest::copy_source_acl].
1908 ///
1909 /// # Example
1910 /// ```ignore,no_run
1911 /// # use google_cloud_storage::model::RestoreObjectRequest;
1912 /// let x = RestoreObjectRequest::new().set_or_clear_copy_source_acl(Some(false));
1913 /// let x = RestoreObjectRequest::new().set_or_clear_copy_source_acl(None::<bool>);
1914 /// ```
1915 pub fn set_or_clear_copy_source_acl<T>(mut self, v: std::option::Option<T>) -> Self
1916 where
1917 T: std::convert::Into<bool>,
1918 {
1919 self.copy_source_acl = v.map(|x| x.into());
1920 self
1921 }
1922
1923 /// Sets the value of [common_object_request_params][crate::model::RestoreObjectRequest::common_object_request_params].
1924 ///
1925 /// # Example
1926 /// ```ignore,no_run
1927 /// # use google_cloud_storage::model::RestoreObjectRequest;
1928 /// use google_cloud_storage::model::CommonObjectRequestParams;
1929 /// let x = RestoreObjectRequest::new().set_common_object_request_params(CommonObjectRequestParams::default()/* use setters */);
1930 /// ```
1931 pub fn set_common_object_request_params<T>(mut self, v: T) -> Self
1932 where
1933 T: std::convert::Into<crate::model::CommonObjectRequestParams>,
1934 {
1935 self.common_object_request_params = std::option::Option::Some(v.into());
1936 self
1937 }
1938
1939 /// Sets or clears the value of [common_object_request_params][crate::model::RestoreObjectRequest::common_object_request_params].
1940 ///
1941 /// # Example
1942 /// ```ignore,no_run
1943 /// # use google_cloud_storage::model::RestoreObjectRequest;
1944 /// use google_cloud_storage::model::CommonObjectRequestParams;
1945 /// let x = RestoreObjectRequest::new().set_or_clear_common_object_request_params(Some(CommonObjectRequestParams::default()/* use setters */));
1946 /// let x = RestoreObjectRequest::new().set_or_clear_common_object_request_params(None::<CommonObjectRequestParams>);
1947 /// ```
1948 pub fn set_or_clear_common_object_request_params<T>(mut self, v: std::option::Option<T>) -> Self
1949 where
1950 T: std::convert::Into<crate::model::CommonObjectRequestParams>,
1951 {
1952 self.common_object_request_params = v.map(|x| x.into());
1953 self
1954 }
1955}
1956
1957impl wkt::message::Message for RestoreObjectRequest {
1958 fn typename() -> &'static str {
1959 "type.googleapis.com/google.storage.v2.RestoreObjectRequest"
1960 }
1961}
1962
1963/// Request message for [ReadObject][google.storage.v2.Storage.ReadObject].
1964#[derive(Clone, Default, PartialEq)]
1965#[non_exhaustive]
1966pub struct ReadObjectRequest {
1967 /// Required. The name of the bucket containing the object to read.
1968 pub bucket: std::string::String,
1969
1970 /// Required. The name of the object to read.
1971 pub object: std::string::String,
1972
1973 /// Optional. If present, selects a specific revision of this object (as
1974 /// opposed to the latest version, the default).
1975 pub generation: i64,
1976
1977 /// Optional. The offset for the first byte to return in the read, relative to
1978 /// the start of the object.
1979 ///
1980 /// A negative `read_offset` value is interpreted as the number of bytes
1981 /// back from the end of the object to be returned. For example, if an object's
1982 /// length is `15` bytes, a `ReadObjectRequest` with `read_offset` = `-5` and
1983 /// `read_limit` = `3` would return bytes `10` through `12` of the object.
1984 /// Requesting a negative offset with magnitude larger than the size of the
1985 /// object returns the entire object.
1986 pub read_offset: i64,
1987
1988 /// Optional. The maximum number of `data` bytes the server is allowed to
1989 /// return in the sum of all `Object` messages. A `read_limit` of zero
1990 /// indicates that there is no limit, and a negative `read_limit` causes an
1991 /// error.
1992 ///
1993 /// If the stream returns fewer bytes than allowed by the `read_limit` and no
1994 /// error occurred, the stream includes all data from the `read_offset` to the
1995 /// end of the resource.
1996 pub read_limit: i64,
1997
1998 /// Makes the operation conditional on whether the object's current generation
1999 /// matches the given value. Setting to 0 makes the operation succeed only if
2000 /// there are no live versions of the object.
2001 pub if_generation_match: std::option::Option<i64>,
2002
2003 /// Makes the operation conditional on whether the object's live generation
2004 /// does not match the given value. If no live object exists, the precondition
2005 /// fails. Setting to 0 makes the operation succeed only if there is a live
2006 /// version of the object.
2007 pub if_generation_not_match: std::option::Option<i64>,
2008
2009 /// Makes the operation conditional on whether the object's current
2010 /// metageneration matches the given value.
2011 pub if_metageneration_match: std::option::Option<i64>,
2012
2013 /// Makes the operation conditional on whether the object's current
2014 /// metageneration does not match the given value.
2015 pub if_metageneration_not_match: std::option::Option<i64>,
2016
2017 /// Optional. A set of parameters common to Storage API requests concerning an
2018 /// object.
2019 pub common_object_request_params: std::option::Option<crate::model::CommonObjectRequestParams>,
2020
2021 /// Mask specifying which fields to read.
2022 /// The `checksummed_data` field and its children are always present.
2023 /// If no mask is specified, it defaults to all fields except `metadata.
2024 /// owner` and `metadata.acl`.
2025 /// `*` might be used to mean "all fields".
2026 pub read_mask: std::option::Option<wkt::FieldMask>,
2027
2028 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2029}
2030
2031impl ReadObjectRequest {
2032 /// Creates a new default instance.
2033 pub fn new() -> Self {
2034 std::default::Default::default()
2035 }
2036
2037 /// Sets the value of [bucket][crate::model::ReadObjectRequest::bucket].
2038 ///
2039 /// # Example
2040 /// ```ignore,no_run
2041 /// # use google_cloud_storage::model::ReadObjectRequest;
2042 /// # let project_id = "project_id";
2043 /// # let bucket_id = "bucket_id";
2044 /// let x = ReadObjectRequest::new().set_bucket(format!("projects/{project_id}/buckets/{bucket_id}"));
2045 /// ```
2046 pub fn set_bucket<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2047 self.bucket = v.into();
2048 self
2049 }
2050
2051 /// Sets the value of [object][crate::model::ReadObjectRequest::object].
2052 ///
2053 /// # Example
2054 /// ```ignore,no_run
2055 /// # use google_cloud_storage::model::ReadObjectRequest;
2056 /// let x = ReadObjectRequest::new().set_object("example");
2057 /// ```
2058 pub fn set_object<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2059 self.object = v.into();
2060 self
2061 }
2062
2063 /// Sets the value of [generation][crate::model::ReadObjectRequest::generation].
2064 ///
2065 /// # Example
2066 /// ```ignore,no_run
2067 /// # use google_cloud_storage::model::ReadObjectRequest;
2068 /// let x = ReadObjectRequest::new().set_generation(42);
2069 /// ```
2070 pub fn set_generation<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
2071 self.generation = v.into();
2072 self
2073 }
2074
2075 /// Sets the value of [read_offset][crate::model::ReadObjectRequest::read_offset].
2076 ///
2077 /// # Example
2078 /// ```ignore,no_run
2079 /// # use google_cloud_storage::model::ReadObjectRequest;
2080 /// let x = ReadObjectRequest::new().set_read_offset(42);
2081 /// ```
2082 pub fn set_read_offset<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
2083 self.read_offset = v.into();
2084 self
2085 }
2086
2087 /// Sets the value of [read_limit][crate::model::ReadObjectRequest::read_limit].
2088 ///
2089 /// # Example
2090 /// ```ignore,no_run
2091 /// # use google_cloud_storage::model::ReadObjectRequest;
2092 /// let x = ReadObjectRequest::new().set_read_limit(42);
2093 /// ```
2094 pub fn set_read_limit<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
2095 self.read_limit = v.into();
2096 self
2097 }
2098
2099 /// Sets the value of [if_generation_match][crate::model::ReadObjectRequest::if_generation_match].
2100 ///
2101 /// # Example
2102 /// ```ignore,no_run
2103 /// # use google_cloud_storage::model::ReadObjectRequest;
2104 /// let x = ReadObjectRequest::new().set_if_generation_match(42);
2105 /// ```
2106 pub fn set_if_generation_match<T>(mut self, v: T) -> Self
2107 where
2108 T: std::convert::Into<i64>,
2109 {
2110 self.if_generation_match = std::option::Option::Some(v.into());
2111 self
2112 }
2113
2114 /// Sets or clears the value of [if_generation_match][crate::model::ReadObjectRequest::if_generation_match].
2115 ///
2116 /// # Example
2117 /// ```ignore,no_run
2118 /// # use google_cloud_storage::model::ReadObjectRequest;
2119 /// let x = ReadObjectRequest::new().set_or_clear_if_generation_match(Some(42));
2120 /// let x = ReadObjectRequest::new().set_or_clear_if_generation_match(None::<i32>);
2121 /// ```
2122 pub fn set_or_clear_if_generation_match<T>(mut self, v: std::option::Option<T>) -> Self
2123 where
2124 T: std::convert::Into<i64>,
2125 {
2126 self.if_generation_match = v.map(|x| x.into());
2127 self
2128 }
2129
2130 /// Sets the value of [if_generation_not_match][crate::model::ReadObjectRequest::if_generation_not_match].
2131 ///
2132 /// # Example
2133 /// ```ignore,no_run
2134 /// # use google_cloud_storage::model::ReadObjectRequest;
2135 /// let x = ReadObjectRequest::new().set_if_generation_not_match(42);
2136 /// ```
2137 pub fn set_if_generation_not_match<T>(mut self, v: T) -> Self
2138 where
2139 T: std::convert::Into<i64>,
2140 {
2141 self.if_generation_not_match = std::option::Option::Some(v.into());
2142 self
2143 }
2144
2145 /// Sets or clears the value of [if_generation_not_match][crate::model::ReadObjectRequest::if_generation_not_match].
2146 ///
2147 /// # Example
2148 /// ```ignore,no_run
2149 /// # use google_cloud_storage::model::ReadObjectRequest;
2150 /// let x = ReadObjectRequest::new().set_or_clear_if_generation_not_match(Some(42));
2151 /// let x = ReadObjectRequest::new().set_or_clear_if_generation_not_match(None::<i32>);
2152 /// ```
2153 pub fn set_or_clear_if_generation_not_match<T>(mut self, v: std::option::Option<T>) -> Self
2154 where
2155 T: std::convert::Into<i64>,
2156 {
2157 self.if_generation_not_match = v.map(|x| x.into());
2158 self
2159 }
2160
2161 /// Sets the value of [if_metageneration_match][crate::model::ReadObjectRequest::if_metageneration_match].
2162 ///
2163 /// # Example
2164 /// ```ignore,no_run
2165 /// # use google_cloud_storage::model::ReadObjectRequest;
2166 /// let x = ReadObjectRequest::new().set_if_metageneration_match(42);
2167 /// ```
2168 pub fn set_if_metageneration_match<T>(mut self, v: T) -> Self
2169 where
2170 T: std::convert::Into<i64>,
2171 {
2172 self.if_metageneration_match = std::option::Option::Some(v.into());
2173 self
2174 }
2175
2176 /// Sets or clears the value of [if_metageneration_match][crate::model::ReadObjectRequest::if_metageneration_match].
2177 ///
2178 /// # Example
2179 /// ```ignore,no_run
2180 /// # use google_cloud_storage::model::ReadObjectRequest;
2181 /// let x = ReadObjectRequest::new().set_or_clear_if_metageneration_match(Some(42));
2182 /// let x = ReadObjectRequest::new().set_or_clear_if_metageneration_match(None::<i32>);
2183 /// ```
2184 pub fn set_or_clear_if_metageneration_match<T>(mut self, v: std::option::Option<T>) -> Self
2185 where
2186 T: std::convert::Into<i64>,
2187 {
2188 self.if_metageneration_match = v.map(|x| x.into());
2189 self
2190 }
2191
2192 /// Sets the value of [if_metageneration_not_match][crate::model::ReadObjectRequest::if_metageneration_not_match].
2193 ///
2194 /// # Example
2195 /// ```ignore,no_run
2196 /// # use google_cloud_storage::model::ReadObjectRequest;
2197 /// let x = ReadObjectRequest::new().set_if_metageneration_not_match(42);
2198 /// ```
2199 pub fn set_if_metageneration_not_match<T>(mut self, v: T) -> Self
2200 where
2201 T: std::convert::Into<i64>,
2202 {
2203 self.if_metageneration_not_match = std::option::Option::Some(v.into());
2204 self
2205 }
2206
2207 /// Sets or clears the value of [if_metageneration_not_match][crate::model::ReadObjectRequest::if_metageneration_not_match].
2208 ///
2209 /// # Example
2210 /// ```ignore,no_run
2211 /// # use google_cloud_storage::model::ReadObjectRequest;
2212 /// let x = ReadObjectRequest::new().set_or_clear_if_metageneration_not_match(Some(42));
2213 /// let x = ReadObjectRequest::new().set_or_clear_if_metageneration_not_match(None::<i32>);
2214 /// ```
2215 pub fn set_or_clear_if_metageneration_not_match<T>(mut self, v: std::option::Option<T>) -> Self
2216 where
2217 T: std::convert::Into<i64>,
2218 {
2219 self.if_metageneration_not_match = v.map(|x| x.into());
2220 self
2221 }
2222
2223 /// Sets 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_common_object_request_params(CommonObjectRequestParams::default()/* use setters */);
2230 /// ```
2231 pub fn set_common_object_request_params<T>(mut self, v: T) -> Self
2232 where
2233 T: std::convert::Into<crate::model::CommonObjectRequestParams>,
2234 {
2235 self.common_object_request_params = std::option::Option::Some(v.into());
2236 self
2237 }
2238
2239 /// Sets or clears the value of [common_object_request_params][crate::model::ReadObjectRequest::common_object_request_params].
2240 ///
2241 /// # Example
2242 /// ```ignore,no_run
2243 /// # use google_cloud_storage::model::ReadObjectRequest;
2244 /// use google_cloud_storage::model::CommonObjectRequestParams;
2245 /// let x = ReadObjectRequest::new().set_or_clear_common_object_request_params(Some(CommonObjectRequestParams::default()/* use setters */));
2246 /// let x = ReadObjectRequest::new().set_or_clear_common_object_request_params(None::<CommonObjectRequestParams>);
2247 /// ```
2248 pub fn set_or_clear_common_object_request_params<T>(mut self, v: std::option::Option<T>) -> Self
2249 where
2250 T: std::convert::Into<crate::model::CommonObjectRequestParams>,
2251 {
2252 self.common_object_request_params = v.map(|x| x.into());
2253 self
2254 }
2255
2256 /// Sets 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_read_mask(FieldMask::default()/* use setters */);
2263 /// ```
2264 pub fn set_read_mask<T>(mut self, v: T) -> Self
2265 where
2266 T: std::convert::Into<wkt::FieldMask>,
2267 {
2268 self.read_mask = std::option::Option::Some(v.into());
2269 self
2270 }
2271
2272 /// Sets or clears the value of [read_mask][crate::model::ReadObjectRequest::read_mask].
2273 ///
2274 /// # Example
2275 /// ```ignore,no_run
2276 /// # use google_cloud_storage::model::ReadObjectRequest;
2277 /// use wkt::FieldMask;
2278 /// let x = ReadObjectRequest::new().set_or_clear_read_mask(Some(FieldMask::default()/* use setters */));
2279 /// let x = ReadObjectRequest::new().set_or_clear_read_mask(None::<FieldMask>);
2280 /// ```
2281 pub fn set_or_clear_read_mask<T>(mut self, v: std::option::Option<T>) -> Self
2282 where
2283 T: std::convert::Into<wkt::FieldMask>,
2284 {
2285 self.read_mask = v.map(|x| x.into());
2286 self
2287 }
2288}
2289
2290impl wkt::message::Message for ReadObjectRequest {
2291 fn typename() -> &'static str {
2292 "type.googleapis.com/google.storage.v2.ReadObjectRequest"
2293 }
2294}
2295
2296/// Request message for [GetObject][google.storage.v2.Storage.GetObject].
2297///
2298/// [google.storage.v2.Storage.GetObject]: crate::client::StorageControl::get_object
2299#[derive(Clone, Default, PartialEq)]
2300#[non_exhaustive]
2301pub struct GetObjectRequest {
2302 /// Required. Name of the bucket in which the object resides.
2303 pub bucket: std::string::String,
2304
2305 /// Required. Name of the object.
2306 pub object: std::string::String,
2307
2308 /// Optional. If present, selects a specific revision of this object (as
2309 /// opposed to the latest version, the default).
2310 pub generation: i64,
2311
2312 /// If true, return the soft-deleted version of this object.
2313 pub soft_deleted: std::option::Option<bool>,
2314
2315 /// Makes the operation conditional on whether the object's current generation
2316 /// matches the given value. Setting to 0 makes the operation succeed only if
2317 /// there are no live versions of the object.
2318 pub if_generation_match: std::option::Option<i64>,
2319
2320 /// Makes the operation conditional on whether the object's live generation
2321 /// does not match the given value. If no live object exists, the precondition
2322 /// fails. Setting to 0 makes the operation succeed only if there is a live
2323 /// version of the object.
2324 pub if_generation_not_match: std::option::Option<i64>,
2325
2326 /// Makes the operation conditional on whether the object's current
2327 /// metageneration matches the given value.
2328 pub if_metageneration_match: std::option::Option<i64>,
2329
2330 /// Makes the operation conditional on whether the object's current
2331 /// metageneration does not match the given value.
2332 pub if_metageneration_not_match: std::option::Option<i64>,
2333
2334 /// Optional. A set of parameters common to Storage API requests concerning an
2335 /// object.
2336 pub common_object_request_params: std::option::Option<crate::model::CommonObjectRequestParams>,
2337
2338 /// Mask specifying which fields to read.
2339 /// If no mask is specified, it defaults to all fields except `metadata.
2340 /// acl` and `metadata.owner`.
2341 /// `*` might be used to mean "all fields".
2342 pub read_mask: std::option::Option<wkt::FieldMask>,
2343
2344 /// Optional. Restore token used to differentiate soft-deleted objects with the
2345 /// same name and generation. Only applicable for hierarchical namespace
2346 /// buckets and if `soft_deleted` is set to `true`. This parameter is optional,
2347 /// and is only required in the rare case when there are multiple soft-deleted
2348 /// objects with the same `name` and `generation`.
2349 pub restore_token: std::string::String,
2350
2351 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2352}
2353
2354impl GetObjectRequest {
2355 /// Creates a new default instance.
2356 pub fn new() -> Self {
2357 std::default::Default::default()
2358 }
2359
2360 /// Sets the value of [bucket][crate::model::GetObjectRequest::bucket].
2361 ///
2362 /// # Example
2363 /// ```ignore,no_run
2364 /// # use google_cloud_storage::model::GetObjectRequest;
2365 /// # let project_id = "project_id";
2366 /// # let bucket_id = "bucket_id";
2367 /// let x = GetObjectRequest::new().set_bucket(format!("projects/{project_id}/buckets/{bucket_id}"));
2368 /// ```
2369 pub fn set_bucket<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2370 self.bucket = v.into();
2371 self
2372 }
2373
2374 /// Sets the value of [object][crate::model::GetObjectRequest::object].
2375 ///
2376 /// # Example
2377 /// ```ignore,no_run
2378 /// # use google_cloud_storage::model::GetObjectRequest;
2379 /// let x = GetObjectRequest::new().set_object("example");
2380 /// ```
2381 pub fn set_object<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2382 self.object = v.into();
2383 self
2384 }
2385
2386 /// Sets the value of [generation][crate::model::GetObjectRequest::generation].
2387 ///
2388 /// # Example
2389 /// ```ignore,no_run
2390 /// # use google_cloud_storage::model::GetObjectRequest;
2391 /// let x = GetObjectRequest::new().set_generation(42);
2392 /// ```
2393 pub fn set_generation<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
2394 self.generation = v.into();
2395 self
2396 }
2397
2398 /// Sets the value of [soft_deleted][crate::model::GetObjectRequest::soft_deleted].
2399 ///
2400 /// # Example
2401 /// ```ignore,no_run
2402 /// # use google_cloud_storage::model::GetObjectRequest;
2403 /// let x = GetObjectRequest::new().set_soft_deleted(true);
2404 /// ```
2405 pub fn set_soft_deleted<T>(mut self, v: T) -> Self
2406 where
2407 T: std::convert::Into<bool>,
2408 {
2409 self.soft_deleted = std::option::Option::Some(v.into());
2410 self
2411 }
2412
2413 /// Sets or clears the value of [soft_deleted][crate::model::GetObjectRequest::soft_deleted].
2414 ///
2415 /// # Example
2416 /// ```ignore,no_run
2417 /// # use google_cloud_storage::model::GetObjectRequest;
2418 /// let x = GetObjectRequest::new().set_or_clear_soft_deleted(Some(false));
2419 /// let x = GetObjectRequest::new().set_or_clear_soft_deleted(None::<bool>);
2420 /// ```
2421 pub fn set_or_clear_soft_deleted<T>(mut self, v: std::option::Option<T>) -> Self
2422 where
2423 T: std::convert::Into<bool>,
2424 {
2425 self.soft_deleted = v.map(|x| x.into());
2426 self
2427 }
2428
2429 /// Sets the value of [if_generation_match][crate::model::GetObjectRequest::if_generation_match].
2430 ///
2431 /// # Example
2432 /// ```ignore,no_run
2433 /// # use google_cloud_storage::model::GetObjectRequest;
2434 /// let x = GetObjectRequest::new().set_if_generation_match(42);
2435 /// ```
2436 pub fn set_if_generation_match<T>(mut self, v: T) -> Self
2437 where
2438 T: std::convert::Into<i64>,
2439 {
2440 self.if_generation_match = std::option::Option::Some(v.into());
2441 self
2442 }
2443
2444 /// Sets or clears the value of [if_generation_match][crate::model::GetObjectRequest::if_generation_match].
2445 ///
2446 /// # Example
2447 /// ```ignore,no_run
2448 /// # use google_cloud_storage::model::GetObjectRequest;
2449 /// let x = GetObjectRequest::new().set_or_clear_if_generation_match(Some(42));
2450 /// let x = GetObjectRequest::new().set_or_clear_if_generation_match(None::<i32>);
2451 /// ```
2452 pub fn set_or_clear_if_generation_match<T>(mut self, v: std::option::Option<T>) -> Self
2453 where
2454 T: std::convert::Into<i64>,
2455 {
2456 self.if_generation_match = v.map(|x| x.into());
2457 self
2458 }
2459
2460 /// Sets the value of [if_generation_not_match][crate::model::GetObjectRequest::if_generation_not_match].
2461 ///
2462 /// # Example
2463 /// ```ignore,no_run
2464 /// # use google_cloud_storage::model::GetObjectRequest;
2465 /// let x = GetObjectRequest::new().set_if_generation_not_match(42);
2466 /// ```
2467 pub fn set_if_generation_not_match<T>(mut self, v: T) -> Self
2468 where
2469 T: std::convert::Into<i64>,
2470 {
2471 self.if_generation_not_match = std::option::Option::Some(v.into());
2472 self
2473 }
2474
2475 /// Sets or clears the value of [if_generation_not_match][crate::model::GetObjectRequest::if_generation_not_match].
2476 ///
2477 /// # Example
2478 /// ```ignore,no_run
2479 /// # use google_cloud_storage::model::GetObjectRequest;
2480 /// let x = GetObjectRequest::new().set_or_clear_if_generation_not_match(Some(42));
2481 /// let x = GetObjectRequest::new().set_or_clear_if_generation_not_match(None::<i32>);
2482 /// ```
2483 pub fn set_or_clear_if_generation_not_match<T>(mut self, v: std::option::Option<T>) -> Self
2484 where
2485 T: std::convert::Into<i64>,
2486 {
2487 self.if_generation_not_match = v.map(|x| x.into());
2488 self
2489 }
2490
2491 /// Sets the value of [if_metageneration_match][crate::model::GetObjectRequest::if_metageneration_match].
2492 ///
2493 /// # Example
2494 /// ```ignore,no_run
2495 /// # use google_cloud_storage::model::GetObjectRequest;
2496 /// let x = GetObjectRequest::new().set_if_metageneration_match(42);
2497 /// ```
2498 pub fn set_if_metageneration_match<T>(mut self, v: T) -> Self
2499 where
2500 T: std::convert::Into<i64>,
2501 {
2502 self.if_metageneration_match = std::option::Option::Some(v.into());
2503 self
2504 }
2505
2506 /// Sets or clears the value of [if_metageneration_match][crate::model::GetObjectRequest::if_metageneration_match].
2507 ///
2508 /// # Example
2509 /// ```ignore,no_run
2510 /// # use google_cloud_storage::model::GetObjectRequest;
2511 /// let x = GetObjectRequest::new().set_or_clear_if_metageneration_match(Some(42));
2512 /// let x = GetObjectRequest::new().set_or_clear_if_metageneration_match(None::<i32>);
2513 /// ```
2514 pub fn set_or_clear_if_metageneration_match<T>(mut self, v: std::option::Option<T>) -> Self
2515 where
2516 T: std::convert::Into<i64>,
2517 {
2518 self.if_metageneration_match = v.map(|x| x.into());
2519 self
2520 }
2521
2522 /// Sets the value of [if_metageneration_not_match][crate::model::GetObjectRequest::if_metageneration_not_match].
2523 ///
2524 /// # Example
2525 /// ```ignore,no_run
2526 /// # use google_cloud_storage::model::GetObjectRequest;
2527 /// let x = GetObjectRequest::new().set_if_metageneration_not_match(42);
2528 /// ```
2529 pub fn set_if_metageneration_not_match<T>(mut self, v: T) -> Self
2530 where
2531 T: std::convert::Into<i64>,
2532 {
2533 self.if_metageneration_not_match = std::option::Option::Some(v.into());
2534 self
2535 }
2536
2537 /// Sets or clears the value of [if_metageneration_not_match][crate::model::GetObjectRequest::if_metageneration_not_match].
2538 ///
2539 /// # Example
2540 /// ```ignore,no_run
2541 /// # use google_cloud_storage::model::GetObjectRequest;
2542 /// let x = GetObjectRequest::new().set_or_clear_if_metageneration_not_match(Some(42));
2543 /// let x = GetObjectRequest::new().set_or_clear_if_metageneration_not_match(None::<i32>);
2544 /// ```
2545 pub fn set_or_clear_if_metageneration_not_match<T>(mut self, v: std::option::Option<T>) -> Self
2546 where
2547 T: std::convert::Into<i64>,
2548 {
2549 self.if_metageneration_not_match = v.map(|x| x.into());
2550 self
2551 }
2552
2553 /// Sets the value of [common_object_request_params][crate::model::GetObjectRequest::common_object_request_params].
2554 ///
2555 /// # Example
2556 /// ```ignore,no_run
2557 /// # use google_cloud_storage::model::GetObjectRequest;
2558 /// use google_cloud_storage::model::CommonObjectRequestParams;
2559 /// let x = GetObjectRequest::new().set_common_object_request_params(CommonObjectRequestParams::default()/* use setters */);
2560 /// ```
2561 pub fn set_common_object_request_params<T>(mut self, v: T) -> Self
2562 where
2563 T: std::convert::Into<crate::model::CommonObjectRequestParams>,
2564 {
2565 self.common_object_request_params = std::option::Option::Some(v.into());
2566 self
2567 }
2568
2569 /// Sets or clears the value of [common_object_request_params][crate::model::GetObjectRequest::common_object_request_params].
2570 ///
2571 /// # Example
2572 /// ```ignore,no_run
2573 /// # use google_cloud_storage::model::GetObjectRequest;
2574 /// use google_cloud_storage::model::CommonObjectRequestParams;
2575 /// let x = GetObjectRequest::new().set_or_clear_common_object_request_params(Some(CommonObjectRequestParams::default()/* use setters */));
2576 /// let x = GetObjectRequest::new().set_or_clear_common_object_request_params(None::<CommonObjectRequestParams>);
2577 /// ```
2578 pub fn set_or_clear_common_object_request_params<T>(mut self, v: std::option::Option<T>) -> Self
2579 where
2580 T: std::convert::Into<crate::model::CommonObjectRequestParams>,
2581 {
2582 self.common_object_request_params = v.map(|x| x.into());
2583 self
2584 }
2585
2586 /// Sets the value of [read_mask][crate::model::GetObjectRequest::read_mask].
2587 ///
2588 /// # Example
2589 /// ```ignore,no_run
2590 /// # use google_cloud_storage::model::GetObjectRequest;
2591 /// use wkt::FieldMask;
2592 /// let x = GetObjectRequest::new().set_read_mask(FieldMask::default()/* use setters */);
2593 /// ```
2594 pub fn set_read_mask<T>(mut self, v: T) -> Self
2595 where
2596 T: std::convert::Into<wkt::FieldMask>,
2597 {
2598 self.read_mask = std::option::Option::Some(v.into());
2599 self
2600 }
2601
2602 /// Sets or clears the value of [read_mask][crate::model::GetObjectRequest::read_mask].
2603 ///
2604 /// # Example
2605 /// ```ignore,no_run
2606 /// # use google_cloud_storage::model::GetObjectRequest;
2607 /// use wkt::FieldMask;
2608 /// let x = GetObjectRequest::new().set_or_clear_read_mask(Some(FieldMask::default()/* use setters */));
2609 /// let x = GetObjectRequest::new().set_or_clear_read_mask(None::<FieldMask>);
2610 /// ```
2611 pub fn set_or_clear_read_mask<T>(mut self, v: std::option::Option<T>) -> Self
2612 where
2613 T: std::convert::Into<wkt::FieldMask>,
2614 {
2615 self.read_mask = v.map(|x| x.into());
2616 self
2617 }
2618
2619 /// Sets the value of [restore_token][crate::model::GetObjectRequest::restore_token].
2620 ///
2621 /// # Example
2622 /// ```ignore,no_run
2623 /// # use google_cloud_storage::model::GetObjectRequest;
2624 /// let x = GetObjectRequest::new().set_restore_token("example");
2625 /// ```
2626 pub fn set_restore_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2627 self.restore_token = v.into();
2628 self
2629 }
2630}
2631
2632impl wkt::message::Message for GetObjectRequest {
2633 fn typename() -> &'static str {
2634 "type.googleapis.com/google.storage.v2.GetObjectRequest"
2635 }
2636}
2637
2638/// Describes an attempt to insert an object, possibly over multiple requests.
2639#[derive(Clone, Default, PartialEq)]
2640#[non_exhaustive]
2641pub struct WriteObjectSpec {
2642 /// Required. Destination object, including its name and its metadata.
2643 pub resource: std::option::Option<crate::model::Object>,
2644
2645 /// Optional. Apply a predefined set of access controls to this object.
2646 /// Valid values are `authenticatedRead`, `bucketOwnerFullControl`,
2647 /// `bucketOwnerRead`, `private`, `projectPrivate`, or `publicRead`.
2648 pub predefined_acl: std::string::String,
2649
2650 /// Makes the operation conditional on whether the object's current
2651 /// generation matches the given value. Setting to `0` makes the operation
2652 /// succeed only if there are no live versions of the object.
2653 pub if_generation_match: std::option::Option<i64>,
2654
2655 /// Makes the operation conditional on whether the object's live
2656 /// generation does not match the given value. If no live object exists, the
2657 /// precondition fails. Setting to `0` makes the operation succeed only if
2658 /// there is a live version of the object.
2659 pub if_generation_not_match: std::option::Option<i64>,
2660
2661 /// Makes the operation conditional on whether the object's current
2662 /// metageneration matches the given value.
2663 pub if_metageneration_match: std::option::Option<i64>,
2664
2665 /// Makes the operation conditional on whether the object's current
2666 /// metageneration does not match the given value.
2667 pub if_metageneration_not_match: std::option::Option<i64>,
2668
2669 /// The expected final object size being uploaded.
2670 /// If this value is set, closing the stream after writing fewer or more than
2671 /// `object_size` bytes results in an `OUT_OF_RANGE` error.
2672 ///
2673 /// This situation is considered a client error, and if such an error occurs
2674 /// you must start the upload over from scratch, this time sending the correct
2675 /// number of bytes.
2676 pub object_size: std::option::Option<i64>,
2677
2678 /// If `true`, the object is created in appendable mode.
2679 /// This field might only be set when using `BidiWriteObject`.
2680 pub appendable: std::option::Option<bool>,
2681
2682 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2683}
2684
2685impl WriteObjectSpec {
2686 /// Creates a new default instance.
2687 pub fn new() -> Self {
2688 std::default::Default::default()
2689 }
2690
2691 /// Sets the value of [resource][crate::model::WriteObjectSpec::resource].
2692 ///
2693 /// # Example
2694 /// ```ignore,no_run
2695 /// # use google_cloud_storage::model::WriteObjectSpec;
2696 /// use google_cloud_storage::model::Object;
2697 /// let x = WriteObjectSpec::new().set_resource(Object::default()/* use setters */);
2698 /// ```
2699 pub fn set_resource<T>(mut self, v: T) -> Self
2700 where
2701 T: std::convert::Into<crate::model::Object>,
2702 {
2703 self.resource = std::option::Option::Some(v.into());
2704 self
2705 }
2706
2707 /// Sets or clears the value of [resource][crate::model::WriteObjectSpec::resource].
2708 ///
2709 /// # Example
2710 /// ```ignore,no_run
2711 /// # use google_cloud_storage::model::WriteObjectSpec;
2712 /// use google_cloud_storage::model::Object;
2713 /// let x = WriteObjectSpec::new().set_or_clear_resource(Some(Object::default()/* use setters */));
2714 /// let x = WriteObjectSpec::new().set_or_clear_resource(None::<Object>);
2715 /// ```
2716 pub fn set_or_clear_resource<T>(mut self, v: std::option::Option<T>) -> Self
2717 where
2718 T: std::convert::Into<crate::model::Object>,
2719 {
2720 self.resource = v.map(|x| x.into());
2721 self
2722 }
2723
2724 /// Sets the value of [predefined_acl][crate::model::WriteObjectSpec::predefined_acl].
2725 ///
2726 /// # Example
2727 /// ```ignore,no_run
2728 /// # use google_cloud_storage::model::WriteObjectSpec;
2729 /// let x = WriteObjectSpec::new().set_predefined_acl("example");
2730 /// ```
2731 pub fn set_predefined_acl<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2732 self.predefined_acl = v.into();
2733 self
2734 }
2735
2736 /// Sets the value of [if_generation_match][crate::model::WriteObjectSpec::if_generation_match].
2737 ///
2738 /// # Example
2739 /// ```ignore,no_run
2740 /// # use google_cloud_storage::model::WriteObjectSpec;
2741 /// let x = WriteObjectSpec::new().set_if_generation_match(42);
2742 /// ```
2743 pub fn set_if_generation_match<T>(mut self, v: T) -> Self
2744 where
2745 T: std::convert::Into<i64>,
2746 {
2747 self.if_generation_match = std::option::Option::Some(v.into());
2748 self
2749 }
2750
2751 /// Sets or clears the value of [if_generation_match][crate::model::WriteObjectSpec::if_generation_match].
2752 ///
2753 /// # Example
2754 /// ```ignore,no_run
2755 /// # use google_cloud_storage::model::WriteObjectSpec;
2756 /// let x = WriteObjectSpec::new().set_or_clear_if_generation_match(Some(42));
2757 /// let x = WriteObjectSpec::new().set_or_clear_if_generation_match(None::<i32>);
2758 /// ```
2759 pub fn set_or_clear_if_generation_match<T>(mut self, v: std::option::Option<T>) -> Self
2760 where
2761 T: std::convert::Into<i64>,
2762 {
2763 self.if_generation_match = v.map(|x| x.into());
2764 self
2765 }
2766
2767 /// Sets the value of [if_generation_not_match][crate::model::WriteObjectSpec::if_generation_not_match].
2768 ///
2769 /// # Example
2770 /// ```ignore,no_run
2771 /// # use google_cloud_storage::model::WriteObjectSpec;
2772 /// let x = WriteObjectSpec::new().set_if_generation_not_match(42);
2773 /// ```
2774 pub fn set_if_generation_not_match<T>(mut self, v: T) -> Self
2775 where
2776 T: std::convert::Into<i64>,
2777 {
2778 self.if_generation_not_match = std::option::Option::Some(v.into());
2779 self
2780 }
2781
2782 /// Sets or clears the value of [if_generation_not_match][crate::model::WriteObjectSpec::if_generation_not_match].
2783 ///
2784 /// # Example
2785 /// ```ignore,no_run
2786 /// # use google_cloud_storage::model::WriteObjectSpec;
2787 /// let x = WriteObjectSpec::new().set_or_clear_if_generation_not_match(Some(42));
2788 /// let x = WriteObjectSpec::new().set_or_clear_if_generation_not_match(None::<i32>);
2789 /// ```
2790 pub fn set_or_clear_if_generation_not_match<T>(mut self, v: std::option::Option<T>) -> Self
2791 where
2792 T: std::convert::Into<i64>,
2793 {
2794 self.if_generation_not_match = v.map(|x| x.into());
2795 self
2796 }
2797
2798 /// Sets the value of [if_metageneration_match][crate::model::WriteObjectSpec::if_metageneration_match].
2799 ///
2800 /// # Example
2801 /// ```ignore,no_run
2802 /// # use google_cloud_storage::model::WriteObjectSpec;
2803 /// let x = WriteObjectSpec::new().set_if_metageneration_match(42);
2804 /// ```
2805 pub fn set_if_metageneration_match<T>(mut self, v: T) -> Self
2806 where
2807 T: std::convert::Into<i64>,
2808 {
2809 self.if_metageneration_match = std::option::Option::Some(v.into());
2810 self
2811 }
2812
2813 /// Sets or clears the value of [if_metageneration_match][crate::model::WriteObjectSpec::if_metageneration_match].
2814 ///
2815 /// # Example
2816 /// ```ignore,no_run
2817 /// # use google_cloud_storage::model::WriteObjectSpec;
2818 /// let x = WriteObjectSpec::new().set_or_clear_if_metageneration_match(Some(42));
2819 /// let x = WriteObjectSpec::new().set_or_clear_if_metageneration_match(None::<i32>);
2820 /// ```
2821 pub fn set_or_clear_if_metageneration_match<T>(mut self, v: std::option::Option<T>) -> Self
2822 where
2823 T: std::convert::Into<i64>,
2824 {
2825 self.if_metageneration_match = v.map(|x| x.into());
2826 self
2827 }
2828
2829 /// Sets the value of [if_metageneration_not_match][crate::model::WriteObjectSpec::if_metageneration_not_match].
2830 ///
2831 /// # Example
2832 /// ```ignore,no_run
2833 /// # use google_cloud_storage::model::WriteObjectSpec;
2834 /// let x = WriteObjectSpec::new().set_if_metageneration_not_match(42);
2835 /// ```
2836 pub fn set_if_metageneration_not_match<T>(mut self, v: T) -> Self
2837 where
2838 T: std::convert::Into<i64>,
2839 {
2840 self.if_metageneration_not_match = std::option::Option::Some(v.into());
2841 self
2842 }
2843
2844 /// Sets or clears the value of [if_metageneration_not_match][crate::model::WriteObjectSpec::if_metageneration_not_match].
2845 ///
2846 /// # Example
2847 /// ```ignore,no_run
2848 /// # use google_cloud_storage::model::WriteObjectSpec;
2849 /// let x = WriteObjectSpec::new().set_or_clear_if_metageneration_not_match(Some(42));
2850 /// let x = WriteObjectSpec::new().set_or_clear_if_metageneration_not_match(None::<i32>);
2851 /// ```
2852 pub fn set_or_clear_if_metageneration_not_match<T>(mut self, v: std::option::Option<T>) -> Self
2853 where
2854 T: std::convert::Into<i64>,
2855 {
2856 self.if_metageneration_not_match = v.map(|x| x.into());
2857 self
2858 }
2859
2860 /// Sets the value of [object_size][crate::model::WriteObjectSpec::object_size].
2861 ///
2862 /// # Example
2863 /// ```ignore,no_run
2864 /// # use google_cloud_storage::model::WriteObjectSpec;
2865 /// let x = WriteObjectSpec::new().set_object_size(42);
2866 /// ```
2867 pub fn set_object_size<T>(mut self, v: T) -> Self
2868 where
2869 T: std::convert::Into<i64>,
2870 {
2871 self.object_size = std::option::Option::Some(v.into());
2872 self
2873 }
2874
2875 /// Sets or clears the value of [object_size][crate::model::WriteObjectSpec::object_size].
2876 ///
2877 /// # Example
2878 /// ```ignore,no_run
2879 /// # use google_cloud_storage::model::WriteObjectSpec;
2880 /// let x = WriteObjectSpec::new().set_or_clear_object_size(Some(42));
2881 /// let x = WriteObjectSpec::new().set_or_clear_object_size(None::<i32>);
2882 /// ```
2883 pub fn set_or_clear_object_size<T>(mut self, v: std::option::Option<T>) -> Self
2884 where
2885 T: std::convert::Into<i64>,
2886 {
2887 self.object_size = v.map(|x| x.into());
2888 self
2889 }
2890
2891 /// Sets the value of [appendable][crate::model::WriteObjectSpec::appendable].
2892 ///
2893 /// # Example
2894 /// ```ignore,no_run
2895 /// # use google_cloud_storage::model::WriteObjectSpec;
2896 /// let x = WriteObjectSpec::new().set_appendable(true);
2897 /// ```
2898 pub fn set_appendable<T>(mut self, v: T) -> Self
2899 where
2900 T: std::convert::Into<bool>,
2901 {
2902 self.appendable = std::option::Option::Some(v.into());
2903 self
2904 }
2905
2906 /// Sets or clears the value of [appendable][crate::model::WriteObjectSpec::appendable].
2907 ///
2908 /// # Example
2909 /// ```ignore,no_run
2910 /// # use google_cloud_storage::model::WriteObjectSpec;
2911 /// let x = WriteObjectSpec::new().set_or_clear_appendable(Some(false));
2912 /// let x = WriteObjectSpec::new().set_or_clear_appendable(None::<bool>);
2913 /// ```
2914 pub fn set_or_clear_appendable<T>(mut self, v: std::option::Option<T>) -> Self
2915 where
2916 T: std::convert::Into<bool>,
2917 {
2918 self.appendable = v.map(|x| x.into());
2919 self
2920 }
2921}
2922
2923impl wkt::message::Message for WriteObjectSpec {
2924 fn typename() -> &'static str {
2925 "type.googleapis.com/google.storage.v2.WriteObjectSpec"
2926 }
2927}
2928
2929/// Request message for [ListObjects][google.storage.v2.Storage.ListObjects].
2930///
2931/// [google.storage.v2.Storage.ListObjects]: crate::client::StorageControl::list_objects
2932#[derive(Clone, Default, PartialEq)]
2933#[non_exhaustive]
2934pub struct ListObjectsRequest {
2935 /// Required. Name of the bucket in which to look for objects.
2936 pub parent: std::string::String,
2937
2938 /// Optional. Maximum number of `items` plus `prefixes` to return
2939 /// in a single page of responses. As duplicate `prefixes` are
2940 /// omitted, fewer total results might be returned than requested. The service
2941 /// uses this parameter or 1,000 items, whichever is smaller.
2942 pub page_size: i32,
2943
2944 /// Optional. A previously-returned page token representing part of the larger
2945 /// set of results to view.
2946 pub page_token: std::string::String,
2947
2948 /// Optional. If set, returns results in a directory-like mode. `items`
2949 /// contains only objects whose names, aside from the `prefix`, do not contain
2950 /// `delimiter`. Objects whose names, aside from the `prefix`, contain
2951 /// `delimiter` has their name, truncated after the `delimiter`, returned in
2952 /// `prefixes`. Duplicate `prefixes` are omitted.
2953 pub delimiter: std::string::String,
2954
2955 /// Optional. If true, objects that end in exactly one instance of `delimiter`
2956 /// has their metadata included in `items` in addition to
2957 /// `prefixes`.
2958 pub include_trailing_delimiter: bool,
2959
2960 /// Optional. Filter results to objects whose names begin with this prefix.
2961 pub prefix: std::string::String,
2962
2963 /// Optional. If `true`, lists all versions of an object as distinct results.
2964 pub versions: bool,
2965
2966 /// Mask specifying which fields to read from each result.
2967 /// If no mask is specified, defaults to all fields except `items.acl` and
2968 /// `items.owner`.
2969 /// `*` might be used to mean all fields.
2970 pub read_mask: std::option::Option<wkt::FieldMask>,
2971
2972 /// Optional. Filter results to objects whose names are lexicographically equal
2973 /// to or after `lexicographic_start`. If `lexicographic_end` is also set, the
2974 /// objects listed have names between `lexicographic_start` (inclusive) and
2975 /// `lexicographic_end` (exclusive).
2976 pub lexicographic_start: std::string::String,
2977
2978 /// Optional. Filter results to objects whose names are lexicographically
2979 /// before `lexicographic_end`. If `lexicographic_start` is also set, the
2980 /// objects listed have names between `lexicographic_start` (inclusive) and
2981 /// `lexicographic_end` (exclusive).
2982 pub lexicographic_end: std::string::String,
2983
2984 /// Optional. If true, only list all soft-deleted versions of the object.
2985 /// Soft delete policy is required to set this option.
2986 pub soft_deleted: bool,
2987
2988 /// Optional. If true, includes folders and managed folders (besides objects)
2989 /// in the returned `prefixes`. Requires `delimiter` to be set to '/'.
2990 pub include_folders_as_prefixes: bool,
2991
2992 /// Optional. Filter results to objects and prefixes that match this glob
2993 /// pattern. See [List objects using
2994 /// glob](https://cloud.google.com/storage/docs/json_api/v1/objects/list#list-objects-and-prefixes-using-glob)
2995 /// for the full syntax.
2996 pub match_glob: std::string::String,
2997
2998 /// Optional. An expression used to filter the returned objects by the
2999 /// `context` field. For the full syntax, see [Filter objects by contexts
3000 /// syntax](https://cloud.google.com/storage/docs/listing-objects#filter-by-object-contexts-syntax).
3001 /// If a `delimiter` is set, the returned `prefixes` are exempt from this
3002 /// filter.
3003 pub filter: std::string::String,
3004
3005 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3006}
3007
3008impl ListObjectsRequest {
3009 /// Creates a new default instance.
3010 pub fn new() -> Self {
3011 std::default::Default::default()
3012 }
3013
3014 /// Sets the value of [parent][crate::model::ListObjectsRequest::parent].
3015 ///
3016 /// # Example
3017 /// ```ignore,no_run
3018 /// # use google_cloud_storage::model::ListObjectsRequest;
3019 /// # let project_id = "project_id";
3020 /// # let bucket_id = "bucket_id";
3021 /// let x = ListObjectsRequest::new().set_parent(format!("projects/{project_id}/buckets/{bucket_id}"));
3022 /// ```
3023 pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3024 self.parent = v.into();
3025 self
3026 }
3027
3028 /// Sets the value of [page_size][crate::model::ListObjectsRequest::page_size].
3029 ///
3030 /// # Example
3031 /// ```ignore,no_run
3032 /// # use google_cloud_storage::model::ListObjectsRequest;
3033 /// let x = ListObjectsRequest::new().set_page_size(42);
3034 /// ```
3035 pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
3036 self.page_size = v.into();
3037 self
3038 }
3039
3040 /// Sets the value of [page_token][crate::model::ListObjectsRequest::page_token].
3041 ///
3042 /// # Example
3043 /// ```ignore,no_run
3044 /// # use google_cloud_storage::model::ListObjectsRequest;
3045 /// let x = ListObjectsRequest::new().set_page_token("example");
3046 /// ```
3047 pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3048 self.page_token = v.into();
3049 self
3050 }
3051
3052 /// Sets the value of [delimiter][crate::model::ListObjectsRequest::delimiter].
3053 ///
3054 /// # Example
3055 /// ```ignore,no_run
3056 /// # use google_cloud_storage::model::ListObjectsRequest;
3057 /// let x = ListObjectsRequest::new().set_delimiter("example");
3058 /// ```
3059 pub fn set_delimiter<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3060 self.delimiter = v.into();
3061 self
3062 }
3063
3064 /// Sets the value of [include_trailing_delimiter][crate::model::ListObjectsRequest::include_trailing_delimiter].
3065 ///
3066 /// # Example
3067 /// ```ignore,no_run
3068 /// # use google_cloud_storage::model::ListObjectsRequest;
3069 /// let x = ListObjectsRequest::new().set_include_trailing_delimiter(true);
3070 /// ```
3071 pub fn set_include_trailing_delimiter<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
3072 self.include_trailing_delimiter = v.into();
3073 self
3074 }
3075
3076 /// Sets the value of [prefix][crate::model::ListObjectsRequest::prefix].
3077 ///
3078 /// # Example
3079 /// ```ignore,no_run
3080 /// # use google_cloud_storage::model::ListObjectsRequest;
3081 /// let x = ListObjectsRequest::new().set_prefix("example");
3082 /// ```
3083 pub fn set_prefix<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3084 self.prefix = v.into();
3085 self
3086 }
3087
3088 /// Sets the value of [versions][crate::model::ListObjectsRequest::versions].
3089 ///
3090 /// # Example
3091 /// ```ignore,no_run
3092 /// # use google_cloud_storage::model::ListObjectsRequest;
3093 /// let x = ListObjectsRequest::new().set_versions(true);
3094 /// ```
3095 pub fn set_versions<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
3096 self.versions = v.into();
3097 self
3098 }
3099
3100 /// Sets the value of [read_mask][crate::model::ListObjectsRequest::read_mask].
3101 ///
3102 /// # Example
3103 /// ```ignore,no_run
3104 /// # use google_cloud_storage::model::ListObjectsRequest;
3105 /// use wkt::FieldMask;
3106 /// let x = ListObjectsRequest::new().set_read_mask(FieldMask::default()/* use setters */);
3107 /// ```
3108 pub fn set_read_mask<T>(mut self, v: T) -> Self
3109 where
3110 T: std::convert::Into<wkt::FieldMask>,
3111 {
3112 self.read_mask = std::option::Option::Some(v.into());
3113 self
3114 }
3115
3116 /// Sets or clears the value of [read_mask][crate::model::ListObjectsRequest::read_mask].
3117 ///
3118 /// # Example
3119 /// ```ignore,no_run
3120 /// # use google_cloud_storage::model::ListObjectsRequest;
3121 /// use wkt::FieldMask;
3122 /// let x = ListObjectsRequest::new().set_or_clear_read_mask(Some(FieldMask::default()/* use setters */));
3123 /// let x = ListObjectsRequest::new().set_or_clear_read_mask(None::<FieldMask>);
3124 /// ```
3125 pub fn set_or_clear_read_mask<T>(mut self, v: std::option::Option<T>) -> Self
3126 where
3127 T: std::convert::Into<wkt::FieldMask>,
3128 {
3129 self.read_mask = v.map(|x| x.into());
3130 self
3131 }
3132
3133 /// Sets the value of [lexicographic_start][crate::model::ListObjectsRequest::lexicographic_start].
3134 ///
3135 /// # Example
3136 /// ```ignore,no_run
3137 /// # use google_cloud_storage::model::ListObjectsRequest;
3138 /// let x = ListObjectsRequest::new().set_lexicographic_start("example");
3139 /// ```
3140 pub fn set_lexicographic_start<T: std::convert::Into<std::string::String>>(
3141 mut self,
3142 v: T,
3143 ) -> Self {
3144 self.lexicographic_start = v.into();
3145 self
3146 }
3147
3148 /// Sets the value of [lexicographic_end][crate::model::ListObjectsRequest::lexicographic_end].
3149 ///
3150 /// # Example
3151 /// ```ignore,no_run
3152 /// # use google_cloud_storage::model::ListObjectsRequest;
3153 /// let x = ListObjectsRequest::new().set_lexicographic_end("example");
3154 /// ```
3155 pub fn set_lexicographic_end<T: std::convert::Into<std::string::String>>(
3156 mut self,
3157 v: T,
3158 ) -> Self {
3159 self.lexicographic_end = v.into();
3160 self
3161 }
3162
3163 /// Sets the value of [soft_deleted][crate::model::ListObjectsRequest::soft_deleted].
3164 ///
3165 /// # Example
3166 /// ```ignore,no_run
3167 /// # use google_cloud_storage::model::ListObjectsRequest;
3168 /// let x = ListObjectsRequest::new().set_soft_deleted(true);
3169 /// ```
3170 pub fn set_soft_deleted<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
3171 self.soft_deleted = v.into();
3172 self
3173 }
3174
3175 /// Sets the value of [include_folders_as_prefixes][crate::model::ListObjectsRequest::include_folders_as_prefixes].
3176 ///
3177 /// # Example
3178 /// ```ignore,no_run
3179 /// # use google_cloud_storage::model::ListObjectsRequest;
3180 /// let x = ListObjectsRequest::new().set_include_folders_as_prefixes(true);
3181 /// ```
3182 pub fn set_include_folders_as_prefixes<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
3183 self.include_folders_as_prefixes = v.into();
3184 self
3185 }
3186
3187 /// Sets the value of [match_glob][crate::model::ListObjectsRequest::match_glob].
3188 ///
3189 /// # Example
3190 /// ```ignore,no_run
3191 /// # use google_cloud_storage::model::ListObjectsRequest;
3192 /// let x = ListObjectsRequest::new().set_match_glob("example");
3193 /// ```
3194 pub fn set_match_glob<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3195 self.match_glob = v.into();
3196 self
3197 }
3198
3199 /// Sets the value of [filter][crate::model::ListObjectsRequest::filter].
3200 ///
3201 /// # Example
3202 /// ```ignore,no_run
3203 /// # use google_cloud_storage::model::ListObjectsRequest;
3204 /// let x = ListObjectsRequest::new().set_filter("example");
3205 /// ```
3206 pub fn set_filter<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3207 self.filter = v.into();
3208 self
3209 }
3210}
3211
3212impl wkt::message::Message for ListObjectsRequest {
3213 fn typename() -> &'static str {
3214 "type.googleapis.com/google.storage.v2.ListObjectsRequest"
3215 }
3216}
3217
3218/// Request message for [RewriteObject][google.storage.v2.Storage.RewriteObject].
3219/// If the source object is encrypted using a Customer-Supplied Encryption Key
3220/// the key information must be provided in the
3221/// `copy_source_encryption_algorithm`, `copy_source_encryption_key_bytes`, and
3222/// `copy_source_encryption_key_sha256_bytes` fields. If the destination object
3223/// should be encrypted the keying information should be provided in the
3224/// `encryption_algorithm`, `encryption_key_bytes`, and
3225/// `encryption_key_sha256_bytes` fields of the
3226/// `common_object_request_params.customer_encryption` field.
3227///
3228/// [google.storage.v2.Storage.RewriteObject]: crate::client::StorageControl::rewrite_object
3229#[derive(Clone, Default, PartialEq)]
3230#[non_exhaustive]
3231pub struct RewriteObjectRequest {
3232 /// Required. Immutable. The name of the destination object.
3233 /// See the
3234 /// [Naming Guidelines](https://cloud.google.com/storage/docs/objects#naming).
3235 /// Example: `test.txt`
3236 /// The `name` field by itself does not uniquely identify a Cloud Storage
3237 /// object. A Cloud Storage object is uniquely identified by the tuple of
3238 /// (bucket, object, generation).
3239 pub destination_name: std::string::String,
3240
3241 /// Required. Immutable. The name of the bucket containing the destination
3242 /// object.
3243 pub destination_bucket: std::string::String,
3244
3245 /// Optional. The name of the Cloud KMS key that is used to encrypt the
3246 /// destination object. The Cloud KMS key must be located in same location as
3247 /// the object. If the parameter is not specified, the request uses the
3248 /// destination bucket's default encryption key, if any, or else the
3249 /// Google-managed encryption key.
3250 pub destination_kms_key: std::string::String,
3251
3252 /// Optional. Properties of the destination, post-rewrite object.
3253 /// The `name`, `bucket` and `kms_key` fields must not be populated (these
3254 /// values are specified in the `destination_name`, `destination_bucket`, and
3255 /// `destination_kms_key` fields).
3256 /// If `destination` is present it is used to construct the destination
3257 /// object's metadata; otherwise the destination object's metadata is
3258 /// copied from the source object.
3259 pub destination: std::option::Option<crate::model::Object>,
3260
3261 /// Required. Name of the bucket in which to find the source object.
3262 pub source_bucket: std::string::String,
3263
3264 /// Required. Name of the source object.
3265 pub source_object: std::string::String,
3266
3267 /// Optional. If present, selects a specific revision of the source object (as
3268 /// opposed to the latest version, the default).
3269 pub source_generation: i64,
3270
3271 /// Optional. Include this field (from the previous rewrite response) on each
3272 /// rewrite request after the first one, until the rewrite response 'done' flag
3273 /// is true. Calls that provide a rewriteToken can omit all other request
3274 /// fields, but if included those fields must match the values provided in the
3275 /// first rewrite request.
3276 pub rewrite_token: std::string::String,
3277
3278 /// Optional. Apply a predefined set of access controls to the destination
3279 /// object. Valid values are `authenticatedRead`, `bucketOwnerFullControl`,
3280 /// `bucketOwnerRead`, `private`, `projectPrivate`, or `publicRead`.
3281 pub destination_predefined_acl: std::string::String,
3282
3283 /// Makes the operation conditional on whether the object's current generation
3284 /// matches the given value. Setting to 0 makes the operation succeed only if
3285 /// there are no live versions of the object.
3286 pub if_generation_match: std::option::Option<i64>,
3287
3288 /// Makes the operation conditional on whether the object's live generation
3289 /// does not match the given value. If no live object exists, the precondition
3290 /// fails. Setting to 0 makes the operation succeed only if there is a live
3291 /// version of the object.
3292 pub if_generation_not_match: std::option::Option<i64>,
3293
3294 /// Makes the operation conditional on whether the destination object's current
3295 /// metageneration matches the given value.
3296 pub if_metageneration_match: std::option::Option<i64>,
3297
3298 /// Makes the operation conditional on whether the destination object's current
3299 /// metageneration does not match the given value.
3300 pub if_metageneration_not_match: std::option::Option<i64>,
3301
3302 /// Makes the operation conditional on whether the source object's live
3303 /// generation matches the given value.
3304 pub if_source_generation_match: std::option::Option<i64>,
3305
3306 /// Makes the operation conditional on whether the source object's live
3307 /// generation does not match the given value.
3308 pub if_source_generation_not_match: std::option::Option<i64>,
3309
3310 /// Makes the operation conditional on whether the source object's current
3311 /// metageneration matches the given value.
3312 pub if_source_metageneration_match: std::option::Option<i64>,
3313
3314 /// Makes the operation conditional on whether the source object's current
3315 /// metageneration does not match the given value.
3316 pub if_source_metageneration_not_match: std::option::Option<i64>,
3317
3318 /// Optional. The maximum number of bytes that are rewritten per rewrite
3319 /// request. Most callers shouldn't need to specify this parameter - it is
3320 /// primarily in place to support testing. If specified the value must be an
3321 /// integral multiple of 1 MiB (1048576). Also, this only applies to requests
3322 /// where the source and destination span locations and/or storage classes.
3323 /// Finally, this value must not change across rewrite calls else you'll get an
3324 /// error that the `rewriteToken` is invalid.
3325 pub max_bytes_rewritten_per_call: i64,
3326
3327 /// Optional. The algorithm used to encrypt the source object, if any. Used if
3328 /// the source object was encrypted with a Customer-Supplied Encryption Key.
3329 pub copy_source_encryption_algorithm: std::string::String,
3330
3331 /// Optional. The raw bytes (not base64-encoded) AES-256 encryption key used to
3332 /// encrypt the source object, if it was encrypted with a Customer-Supplied
3333 /// Encryption Key.
3334 pub copy_source_encryption_key_bytes: ::bytes::Bytes,
3335
3336 /// Optional. The raw bytes (not base64-encoded) SHA256 hash of the encryption
3337 /// key used to encrypt the source object, if it was encrypted with a
3338 /// Customer-Supplied Encryption Key.
3339 pub copy_source_encryption_key_sha256_bytes: ::bytes::Bytes,
3340
3341 /// Optional. A set of parameters common to Storage API requests concerning an
3342 /// object.
3343 pub common_object_request_params: std::option::Option<crate::model::CommonObjectRequestParams>,
3344
3345 /// Optional. The checksums of the complete object. This is used to validate
3346 /// the destination object after rewriting.
3347 pub object_checksums: std::option::Option<crate::model::ObjectChecksums>,
3348
3349 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3350}
3351
3352impl RewriteObjectRequest {
3353 /// Creates a new default instance.
3354 pub fn new() -> Self {
3355 std::default::Default::default()
3356 }
3357
3358 /// Sets the value of [destination_name][crate::model::RewriteObjectRequest::destination_name].
3359 ///
3360 /// # Example
3361 /// ```ignore,no_run
3362 /// # use google_cloud_storage::model::RewriteObjectRequest;
3363 /// let x = RewriteObjectRequest::new().set_destination_name("example");
3364 /// ```
3365 pub fn set_destination_name<T: std::convert::Into<std::string::String>>(
3366 mut self,
3367 v: T,
3368 ) -> Self {
3369 self.destination_name = v.into();
3370 self
3371 }
3372
3373 /// Sets the value of [destination_bucket][crate::model::RewriteObjectRequest::destination_bucket].
3374 ///
3375 /// # Example
3376 /// ```ignore,no_run
3377 /// # use google_cloud_storage::model::RewriteObjectRequest;
3378 /// # let project_id = "project_id";
3379 /// # let bucket_id = "bucket_id";
3380 /// let x = RewriteObjectRequest::new().set_destination_bucket(format!("projects/{project_id}/buckets/{bucket_id}"));
3381 /// ```
3382 pub fn set_destination_bucket<T: std::convert::Into<std::string::String>>(
3383 mut self,
3384 v: T,
3385 ) -> Self {
3386 self.destination_bucket = v.into();
3387 self
3388 }
3389
3390 /// Sets the value of [destination_kms_key][crate::model::RewriteObjectRequest::destination_kms_key].
3391 ///
3392 /// # Example
3393 /// ```ignore,no_run
3394 /// # use google_cloud_storage::model::RewriteObjectRequest;
3395 /// let x = RewriteObjectRequest::new().set_destination_kms_key("example");
3396 /// ```
3397 pub fn set_destination_kms_key<T: std::convert::Into<std::string::String>>(
3398 mut self,
3399 v: T,
3400 ) -> Self {
3401 self.destination_kms_key = v.into();
3402 self
3403 }
3404
3405 /// Sets the value of [destination][crate::model::RewriteObjectRequest::destination].
3406 ///
3407 /// # Example
3408 /// ```ignore,no_run
3409 /// # use google_cloud_storage::model::RewriteObjectRequest;
3410 /// use google_cloud_storage::model::Object;
3411 /// let x = RewriteObjectRequest::new().set_destination(Object::default()/* use setters */);
3412 /// ```
3413 pub fn set_destination<T>(mut self, v: T) -> Self
3414 where
3415 T: std::convert::Into<crate::model::Object>,
3416 {
3417 self.destination = std::option::Option::Some(v.into());
3418 self
3419 }
3420
3421 /// Sets or clears the value of [destination][crate::model::RewriteObjectRequest::destination].
3422 ///
3423 /// # Example
3424 /// ```ignore,no_run
3425 /// # use google_cloud_storage::model::RewriteObjectRequest;
3426 /// use google_cloud_storage::model::Object;
3427 /// let x = RewriteObjectRequest::new().set_or_clear_destination(Some(Object::default()/* use setters */));
3428 /// let x = RewriteObjectRequest::new().set_or_clear_destination(None::<Object>);
3429 /// ```
3430 pub fn set_or_clear_destination<T>(mut self, v: std::option::Option<T>) -> Self
3431 where
3432 T: std::convert::Into<crate::model::Object>,
3433 {
3434 self.destination = v.map(|x| x.into());
3435 self
3436 }
3437
3438 /// Sets the value of [source_bucket][crate::model::RewriteObjectRequest::source_bucket].
3439 ///
3440 /// # Example
3441 /// ```ignore,no_run
3442 /// # use google_cloud_storage::model::RewriteObjectRequest;
3443 /// # let project_id = "project_id";
3444 /// # let bucket_id = "bucket_id";
3445 /// let x = RewriteObjectRequest::new().set_source_bucket(format!("projects/{project_id}/buckets/{bucket_id}"));
3446 /// ```
3447 pub fn set_source_bucket<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3448 self.source_bucket = v.into();
3449 self
3450 }
3451
3452 /// Sets the value of [source_object][crate::model::RewriteObjectRequest::source_object].
3453 ///
3454 /// # Example
3455 /// ```ignore,no_run
3456 /// # use google_cloud_storage::model::RewriteObjectRequest;
3457 /// let x = RewriteObjectRequest::new().set_source_object("example");
3458 /// ```
3459 pub fn set_source_object<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3460 self.source_object = v.into();
3461 self
3462 }
3463
3464 /// Sets the value of [source_generation][crate::model::RewriteObjectRequest::source_generation].
3465 ///
3466 /// # Example
3467 /// ```ignore,no_run
3468 /// # use google_cloud_storage::model::RewriteObjectRequest;
3469 /// let x = RewriteObjectRequest::new().set_source_generation(42);
3470 /// ```
3471 pub fn set_source_generation<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
3472 self.source_generation = v.into();
3473 self
3474 }
3475
3476 /// Sets the value of [rewrite_token][crate::model::RewriteObjectRequest::rewrite_token].
3477 ///
3478 /// # Example
3479 /// ```ignore,no_run
3480 /// # use google_cloud_storage::model::RewriteObjectRequest;
3481 /// let x = RewriteObjectRequest::new().set_rewrite_token("example");
3482 /// ```
3483 pub fn set_rewrite_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3484 self.rewrite_token = v.into();
3485 self
3486 }
3487
3488 /// Sets the value of [destination_predefined_acl][crate::model::RewriteObjectRequest::destination_predefined_acl].
3489 ///
3490 /// # Example
3491 /// ```ignore,no_run
3492 /// # use google_cloud_storage::model::RewriteObjectRequest;
3493 /// let x = RewriteObjectRequest::new().set_destination_predefined_acl("example");
3494 /// ```
3495 pub fn set_destination_predefined_acl<T: std::convert::Into<std::string::String>>(
3496 mut self,
3497 v: T,
3498 ) -> Self {
3499 self.destination_predefined_acl = v.into();
3500 self
3501 }
3502
3503 /// Sets the value of [if_generation_match][crate::model::RewriteObjectRequest::if_generation_match].
3504 ///
3505 /// # Example
3506 /// ```ignore,no_run
3507 /// # use google_cloud_storage::model::RewriteObjectRequest;
3508 /// let x = RewriteObjectRequest::new().set_if_generation_match(42);
3509 /// ```
3510 pub fn set_if_generation_match<T>(mut self, v: T) -> Self
3511 where
3512 T: std::convert::Into<i64>,
3513 {
3514 self.if_generation_match = std::option::Option::Some(v.into());
3515 self
3516 }
3517
3518 /// Sets or clears the value of [if_generation_match][crate::model::RewriteObjectRequest::if_generation_match].
3519 ///
3520 /// # Example
3521 /// ```ignore,no_run
3522 /// # use google_cloud_storage::model::RewriteObjectRequest;
3523 /// let x = RewriteObjectRequest::new().set_or_clear_if_generation_match(Some(42));
3524 /// let x = RewriteObjectRequest::new().set_or_clear_if_generation_match(None::<i32>);
3525 /// ```
3526 pub fn set_or_clear_if_generation_match<T>(mut self, v: std::option::Option<T>) -> Self
3527 where
3528 T: std::convert::Into<i64>,
3529 {
3530 self.if_generation_match = v.map(|x| x.into());
3531 self
3532 }
3533
3534 /// Sets the value of [if_generation_not_match][crate::model::RewriteObjectRequest::if_generation_not_match].
3535 ///
3536 /// # Example
3537 /// ```ignore,no_run
3538 /// # use google_cloud_storage::model::RewriteObjectRequest;
3539 /// let x = RewriteObjectRequest::new().set_if_generation_not_match(42);
3540 /// ```
3541 pub fn set_if_generation_not_match<T>(mut self, v: T) -> Self
3542 where
3543 T: std::convert::Into<i64>,
3544 {
3545 self.if_generation_not_match = std::option::Option::Some(v.into());
3546 self
3547 }
3548
3549 /// Sets or clears the value of [if_generation_not_match][crate::model::RewriteObjectRequest::if_generation_not_match].
3550 ///
3551 /// # Example
3552 /// ```ignore,no_run
3553 /// # use google_cloud_storage::model::RewriteObjectRequest;
3554 /// let x = RewriteObjectRequest::new().set_or_clear_if_generation_not_match(Some(42));
3555 /// let x = RewriteObjectRequest::new().set_or_clear_if_generation_not_match(None::<i32>);
3556 /// ```
3557 pub fn set_or_clear_if_generation_not_match<T>(mut self, v: std::option::Option<T>) -> Self
3558 where
3559 T: std::convert::Into<i64>,
3560 {
3561 self.if_generation_not_match = v.map(|x| x.into());
3562 self
3563 }
3564
3565 /// Sets the value of [if_metageneration_match][crate::model::RewriteObjectRequest::if_metageneration_match].
3566 ///
3567 /// # Example
3568 /// ```ignore,no_run
3569 /// # use google_cloud_storage::model::RewriteObjectRequest;
3570 /// let x = RewriteObjectRequest::new().set_if_metageneration_match(42);
3571 /// ```
3572 pub fn set_if_metageneration_match<T>(mut self, v: T) -> Self
3573 where
3574 T: std::convert::Into<i64>,
3575 {
3576 self.if_metageneration_match = std::option::Option::Some(v.into());
3577 self
3578 }
3579
3580 /// Sets or clears the value of [if_metageneration_match][crate::model::RewriteObjectRequest::if_metageneration_match].
3581 ///
3582 /// # Example
3583 /// ```ignore,no_run
3584 /// # use google_cloud_storage::model::RewriteObjectRequest;
3585 /// let x = RewriteObjectRequest::new().set_or_clear_if_metageneration_match(Some(42));
3586 /// let x = RewriteObjectRequest::new().set_or_clear_if_metageneration_match(None::<i32>);
3587 /// ```
3588 pub fn set_or_clear_if_metageneration_match<T>(mut self, v: std::option::Option<T>) -> Self
3589 where
3590 T: std::convert::Into<i64>,
3591 {
3592 self.if_metageneration_match = v.map(|x| x.into());
3593 self
3594 }
3595
3596 /// Sets the value of [if_metageneration_not_match][crate::model::RewriteObjectRequest::if_metageneration_not_match].
3597 ///
3598 /// # Example
3599 /// ```ignore,no_run
3600 /// # use google_cloud_storage::model::RewriteObjectRequest;
3601 /// let x = RewriteObjectRequest::new().set_if_metageneration_not_match(42);
3602 /// ```
3603 pub fn set_if_metageneration_not_match<T>(mut self, v: T) -> Self
3604 where
3605 T: std::convert::Into<i64>,
3606 {
3607 self.if_metageneration_not_match = std::option::Option::Some(v.into());
3608 self
3609 }
3610
3611 /// Sets or clears the value of [if_metageneration_not_match][crate::model::RewriteObjectRequest::if_metageneration_not_match].
3612 ///
3613 /// # Example
3614 /// ```ignore,no_run
3615 /// # use google_cloud_storage::model::RewriteObjectRequest;
3616 /// let x = RewriteObjectRequest::new().set_or_clear_if_metageneration_not_match(Some(42));
3617 /// let x = RewriteObjectRequest::new().set_or_clear_if_metageneration_not_match(None::<i32>);
3618 /// ```
3619 pub fn set_or_clear_if_metageneration_not_match<T>(mut self, v: std::option::Option<T>) -> Self
3620 where
3621 T: std::convert::Into<i64>,
3622 {
3623 self.if_metageneration_not_match = v.map(|x| x.into());
3624 self
3625 }
3626
3627 /// Sets the value of [if_source_generation_match][crate::model::RewriteObjectRequest::if_source_generation_match].
3628 ///
3629 /// # Example
3630 /// ```ignore,no_run
3631 /// # use google_cloud_storage::model::RewriteObjectRequest;
3632 /// let x = RewriteObjectRequest::new().set_if_source_generation_match(42);
3633 /// ```
3634 pub fn set_if_source_generation_match<T>(mut self, v: T) -> Self
3635 where
3636 T: std::convert::Into<i64>,
3637 {
3638 self.if_source_generation_match = std::option::Option::Some(v.into());
3639 self
3640 }
3641
3642 /// Sets or clears the value of [if_source_generation_match][crate::model::RewriteObjectRequest::if_source_generation_match].
3643 ///
3644 /// # Example
3645 /// ```ignore,no_run
3646 /// # use google_cloud_storage::model::RewriteObjectRequest;
3647 /// let x = RewriteObjectRequest::new().set_or_clear_if_source_generation_match(Some(42));
3648 /// let x = RewriteObjectRequest::new().set_or_clear_if_source_generation_match(None::<i32>);
3649 /// ```
3650 pub fn set_or_clear_if_source_generation_match<T>(mut self, v: std::option::Option<T>) -> Self
3651 where
3652 T: std::convert::Into<i64>,
3653 {
3654 self.if_source_generation_match = v.map(|x| x.into());
3655 self
3656 }
3657
3658 /// Sets the value of [if_source_generation_not_match][crate::model::RewriteObjectRequest::if_source_generation_not_match].
3659 ///
3660 /// # Example
3661 /// ```ignore,no_run
3662 /// # use google_cloud_storage::model::RewriteObjectRequest;
3663 /// let x = RewriteObjectRequest::new().set_if_source_generation_not_match(42);
3664 /// ```
3665 pub fn set_if_source_generation_not_match<T>(mut self, v: T) -> Self
3666 where
3667 T: std::convert::Into<i64>,
3668 {
3669 self.if_source_generation_not_match = std::option::Option::Some(v.into());
3670 self
3671 }
3672
3673 /// Sets or clears the value of [if_source_generation_not_match][crate::model::RewriteObjectRequest::if_source_generation_not_match].
3674 ///
3675 /// # Example
3676 /// ```ignore,no_run
3677 /// # use google_cloud_storage::model::RewriteObjectRequest;
3678 /// let x = RewriteObjectRequest::new().set_or_clear_if_source_generation_not_match(Some(42));
3679 /// let x = RewriteObjectRequest::new().set_or_clear_if_source_generation_not_match(None::<i32>);
3680 /// ```
3681 pub fn set_or_clear_if_source_generation_not_match<T>(
3682 mut self,
3683 v: std::option::Option<T>,
3684 ) -> Self
3685 where
3686 T: std::convert::Into<i64>,
3687 {
3688 self.if_source_generation_not_match = v.map(|x| x.into());
3689 self
3690 }
3691
3692 /// Sets the value of [if_source_metageneration_match][crate::model::RewriteObjectRequest::if_source_metageneration_match].
3693 ///
3694 /// # Example
3695 /// ```ignore,no_run
3696 /// # use google_cloud_storage::model::RewriteObjectRequest;
3697 /// let x = RewriteObjectRequest::new().set_if_source_metageneration_match(42);
3698 /// ```
3699 pub fn set_if_source_metageneration_match<T>(mut self, v: T) -> Self
3700 where
3701 T: std::convert::Into<i64>,
3702 {
3703 self.if_source_metageneration_match = std::option::Option::Some(v.into());
3704 self
3705 }
3706
3707 /// Sets or clears the value of [if_source_metageneration_match][crate::model::RewriteObjectRequest::if_source_metageneration_match].
3708 ///
3709 /// # Example
3710 /// ```ignore,no_run
3711 /// # use google_cloud_storage::model::RewriteObjectRequest;
3712 /// let x = RewriteObjectRequest::new().set_or_clear_if_source_metageneration_match(Some(42));
3713 /// let x = RewriteObjectRequest::new().set_or_clear_if_source_metageneration_match(None::<i32>);
3714 /// ```
3715 pub fn set_or_clear_if_source_metageneration_match<T>(
3716 mut self,
3717 v: std::option::Option<T>,
3718 ) -> Self
3719 where
3720 T: std::convert::Into<i64>,
3721 {
3722 self.if_source_metageneration_match = v.map(|x| x.into());
3723 self
3724 }
3725
3726 /// Sets the value of [if_source_metageneration_not_match][crate::model::RewriteObjectRequest::if_source_metageneration_not_match].
3727 ///
3728 /// # Example
3729 /// ```ignore,no_run
3730 /// # use google_cloud_storage::model::RewriteObjectRequest;
3731 /// let x = RewriteObjectRequest::new().set_if_source_metageneration_not_match(42);
3732 /// ```
3733 pub fn set_if_source_metageneration_not_match<T>(mut self, v: T) -> Self
3734 where
3735 T: std::convert::Into<i64>,
3736 {
3737 self.if_source_metageneration_not_match = std::option::Option::Some(v.into());
3738 self
3739 }
3740
3741 /// Sets or clears the value of [if_source_metageneration_not_match][crate::model::RewriteObjectRequest::if_source_metageneration_not_match].
3742 ///
3743 /// # Example
3744 /// ```ignore,no_run
3745 /// # use google_cloud_storage::model::RewriteObjectRequest;
3746 /// let x = RewriteObjectRequest::new().set_or_clear_if_source_metageneration_not_match(Some(42));
3747 /// let x = RewriteObjectRequest::new().set_or_clear_if_source_metageneration_not_match(None::<i32>);
3748 /// ```
3749 pub fn set_or_clear_if_source_metageneration_not_match<T>(
3750 mut self,
3751 v: std::option::Option<T>,
3752 ) -> Self
3753 where
3754 T: std::convert::Into<i64>,
3755 {
3756 self.if_source_metageneration_not_match = v.map(|x| x.into());
3757 self
3758 }
3759
3760 /// Sets the value of [max_bytes_rewritten_per_call][crate::model::RewriteObjectRequest::max_bytes_rewritten_per_call].
3761 ///
3762 /// # Example
3763 /// ```ignore,no_run
3764 /// # use google_cloud_storage::model::RewriteObjectRequest;
3765 /// let x = RewriteObjectRequest::new().set_max_bytes_rewritten_per_call(42);
3766 /// ```
3767 pub fn set_max_bytes_rewritten_per_call<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
3768 self.max_bytes_rewritten_per_call = v.into();
3769 self
3770 }
3771
3772 /// Sets the value of [copy_source_encryption_algorithm][crate::model::RewriteObjectRequest::copy_source_encryption_algorithm].
3773 ///
3774 /// # Example
3775 /// ```ignore,no_run
3776 /// # use google_cloud_storage::model::RewriteObjectRequest;
3777 /// let x = RewriteObjectRequest::new().set_copy_source_encryption_algorithm("example");
3778 /// ```
3779 pub fn set_copy_source_encryption_algorithm<T: std::convert::Into<std::string::String>>(
3780 mut self,
3781 v: T,
3782 ) -> Self {
3783 self.copy_source_encryption_algorithm = v.into();
3784 self
3785 }
3786
3787 /// Sets the value of [copy_source_encryption_key_bytes][crate::model::RewriteObjectRequest::copy_source_encryption_key_bytes].
3788 ///
3789 /// # Example
3790 /// ```ignore,no_run
3791 /// # use google_cloud_storage::model::RewriteObjectRequest;
3792 /// let x = RewriteObjectRequest::new().set_copy_source_encryption_key_bytes(bytes::Bytes::from_static(b"example"));
3793 /// ```
3794 pub fn set_copy_source_encryption_key_bytes<T: std::convert::Into<::bytes::Bytes>>(
3795 mut self,
3796 v: T,
3797 ) -> Self {
3798 self.copy_source_encryption_key_bytes = v.into();
3799 self
3800 }
3801
3802 /// Sets the value of [copy_source_encryption_key_sha256_bytes][crate::model::RewriteObjectRequest::copy_source_encryption_key_sha256_bytes].
3803 ///
3804 /// # Example
3805 /// ```ignore,no_run
3806 /// # use google_cloud_storage::model::RewriteObjectRequest;
3807 /// let x = RewriteObjectRequest::new().set_copy_source_encryption_key_sha256_bytes(bytes::Bytes::from_static(b"example"));
3808 /// ```
3809 pub fn set_copy_source_encryption_key_sha256_bytes<T: std::convert::Into<::bytes::Bytes>>(
3810 mut self,
3811 v: T,
3812 ) -> Self {
3813 self.copy_source_encryption_key_sha256_bytes = v.into();
3814 self
3815 }
3816
3817 /// Sets the value of [common_object_request_params][crate::model::RewriteObjectRequest::common_object_request_params].
3818 ///
3819 /// # Example
3820 /// ```ignore,no_run
3821 /// # use google_cloud_storage::model::RewriteObjectRequest;
3822 /// use google_cloud_storage::model::CommonObjectRequestParams;
3823 /// let x = RewriteObjectRequest::new().set_common_object_request_params(CommonObjectRequestParams::default()/* use setters */);
3824 /// ```
3825 pub fn set_common_object_request_params<T>(mut self, v: T) -> Self
3826 where
3827 T: std::convert::Into<crate::model::CommonObjectRequestParams>,
3828 {
3829 self.common_object_request_params = std::option::Option::Some(v.into());
3830 self
3831 }
3832
3833 /// Sets or clears the value of [common_object_request_params][crate::model::RewriteObjectRequest::common_object_request_params].
3834 ///
3835 /// # Example
3836 /// ```ignore,no_run
3837 /// # use google_cloud_storage::model::RewriteObjectRequest;
3838 /// use google_cloud_storage::model::CommonObjectRequestParams;
3839 /// let x = RewriteObjectRequest::new().set_or_clear_common_object_request_params(Some(CommonObjectRequestParams::default()/* use setters */));
3840 /// let x = RewriteObjectRequest::new().set_or_clear_common_object_request_params(None::<CommonObjectRequestParams>);
3841 /// ```
3842 pub fn set_or_clear_common_object_request_params<T>(mut self, v: std::option::Option<T>) -> Self
3843 where
3844 T: std::convert::Into<crate::model::CommonObjectRequestParams>,
3845 {
3846 self.common_object_request_params = v.map(|x| x.into());
3847 self
3848 }
3849
3850 /// Sets the value of [object_checksums][crate::model::RewriteObjectRequest::object_checksums].
3851 ///
3852 /// # Example
3853 /// ```ignore,no_run
3854 /// # use google_cloud_storage::model::RewriteObjectRequest;
3855 /// use google_cloud_storage::model::ObjectChecksums;
3856 /// let x = RewriteObjectRequest::new().set_object_checksums(ObjectChecksums::default()/* use setters */);
3857 /// ```
3858 pub fn set_object_checksums<T>(mut self, v: T) -> Self
3859 where
3860 T: std::convert::Into<crate::model::ObjectChecksums>,
3861 {
3862 self.object_checksums = std::option::Option::Some(v.into());
3863 self
3864 }
3865
3866 /// Sets or clears the value of [object_checksums][crate::model::RewriteObjectRequest::object_checksums].
3867 ///
3868 /// # Example
3869 /// ```ignore,no_run
3870 /// # use google_cloud_storage::model::RewriteObjectRequest;
3871 /// use google_cloud_storage::model::ObjectChecksums;
3872 /// let x = RewriteObjectRequest::new().set_or_clear_object_checksums(Some(ObjectChecksums::default()/* use setters */));
3873 /// let x = RewriteObjectRequest::new().set_or_clear_object_checksums(None::<ObjectChecksums>);
3874 /// ```
3875 pub fn set_or_clear_object_checksums<T>(mut self, v: std::option::Option<T>) -> Self
3876 where
3877 T: std::convert::Into<crate::model::ObjectChecksums>,
3878 {
3879 self.object_checksums = v.map(|x| x.into());
3880 self
3881 }
3882}
3883
3884impl wkt::message::Message for RewriteObjectRequest {
3885 fn typename() -> &'static str {
3886 "type.googleapis.com/google.storage.v2.RewriteObjectRequest"
3887 }
3888}
3889
3890/// A rewrite response.
3891#[derive(Clone, Default, PartialEq)]
3892#[non_exhaustive]
3893pub struct RewriteResponse {
3894 /// The total bytes written so far, which can be used to provide a waiting user
3895 /// with a progress indicator. This property is always present in the response.
3896 pub total_bytes_rewritten: i64,
3897
3898 /// The total size of the object being copied in bytes. This property is always
3899 /// present in the response.
3900 pub object_size: i64,
3901
3902 /// `true` if the copy is finished; otherwise, `false` if
3903 /// the copy is in progress. This property is always present in the response.
3904 pub done: bool,
3905
3906 /// A token to use in subsequent requests to continue copying data. This token
3907 /// is present in the response only when there is more data to copy.
3908 pub rewrite_token: std::string::String,
3909
3910 /// A resource containing the metadata for the copied-to object. This property
3911 /// is present in the response only when copying completes.
3912 pub resource: std::option::Option<crate::model::Object>,
3913
3914 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3915}
3916
3917impl RewriteResponse {
3918 /// Creates a new default instance.
3919 pub fn new() -> Self {
3920 std::default::Default::default()
3921 }
3922
3923 /// Sets the value of [total_bytes_rewritten][crate::model::RewriteResponse::total_bytes_rewritten].
3924 ///
3925 /// # Example
3926 /// ```ignore,no_run
3927 /// # use google_cloud_storage::model::RewriteResponse;
3928 /// let x = RewriteResponse::new().set_total_bytes_rewritten(42);
3929 /// ```
3930 pub fn set_total_bytes_rewritten<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
3931 self.total_bytes_rewritten = v.into();
3932 self
3933 }
3934
3935 /// Sets the value of [object_size][crate::model::RewriteResponse::object_size].
3936 ///
3937 /// # Example
3938 /// ```ignore,no_run
3939 /// # use google_cloud_storage::model::RewriteResponse;
3940 /// let x = RewriteResponse::new().set_object_size(42);
3941 /// ```
3942 pub fn set_object_size<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
3943 self.object_size = v.into();
3944 self
3945 }
3946
3947 /// Sets the value of [done][crate::model::RewriteResponse::done].
3948 ///
3949 /// # Example
3950 /// ```ignore,no_run
3951 /// # use google_cloud_storage::model::RewriteResponse;
3952 /// let x = RewriteResponse::new().set_done(true);
3953 /// ```
3954 pub fn set_done<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
3955 self.done = v.into();
3956 self
3957 }
3958
3959 /// Sets the value of [rewrite_token][crate::model::RewriteResponse::rewrite_token].
3960 ///
3961 /// # Example
3962 /// ```ignore,no_run
3963 /// # use google_cloud_storage::model::RewriteResponse;
3964 /// let x = RewriteResponse::new().set_rewrite_token("example");
3965 /// ```
3966 pub fn set_rewrite_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3967 self.rewrite_token = v.into();
3968 self
3969 }
3970
3971 /// Sets the value of [resource][crate::model::RewriteResponse::resource].
3972 ///
3973 /// # Example
3974 /// ```ignore,no_run
3975 /// # use google_cloud_storage::model::RewriteResponse;
3976 /// use google_cloud_storage::model::Object;
3977 /// let x = RewriteResponse::new().set_resource(Object::default()/* use setters */);
3978 /// ```
3979 pub fn set_resource<T>(mut self, v: T) -> Self
3980 where
3981 T: std::convert::Into<crate::model::Object>,
3982 {
3983 self.resource = std::option::Option::Some(v.into());
3984 self
3985 }
3986
3987 /// Sets or clears the value of [resource][crate::model::RewriteResponse::resource].
3988 ///
3989 /// # Example
3990 /// ```ignore,no_run
3991 /// # use google_cloud_storage::model::RewriteResponse;
3992 /// use google_cloud_storage::model::Object;
3993 /// let x = RewriteResponse::new().set_or_clear_resource(Some(Object::default()/* use setters */));
3994 /// let x = RewriteResponse::new().set_or_clear_resource(None::<Object>);
3995 /// ```
3996 pub fn set_or_clear_resource<T>(mut self, v: std::option::Option<T>) -> Self
3997 where
3998 T: std::convert::Into<crate::model::Object>,
3999 {
4000 self.resource = v.map(|x| x.into());
4001 self
4002 }
4003}
4004
4005impl wkt::message::Message for RewriteResponse {
4006 fn typename() -> &'static str {
4007 "type.googleapis.com/google.storage.v2.RewriteResponse"
4008 }
4009}
4010
4011/// Request message for [MoveObject][google.storage.v2.Storage.MoveObject].
4012///
4013/// [google.storage.v2.Storage.MoveObject]: crate::client::StorageControl::move_object
4014#[derive(Clone, Default, PartialEq)]
4015#[non_exhaustive]
4016pub struct MoveObjectRequest {
4017 /// Required. Name of the bucket in which the object resides.
4018 pub bucket: std::string::String,
4019
4020 /// Required. Name of the source object.
4021 pub source_object: std::string::String,
4022
4023 /// Required. Name of the destination object.
4024 pub destination_object: std::string::String,
4025
4026 /// Optional. Makes the operation conditional on whether the source object's
4027 /// current generation matches the given value. `if_source_generation_match`
4028 /// and `if_source_generation_not_match` conditions are mutually exclusive:
4029 /// it's an error for both of them to be set in the request.
4030 pub if_source_generation_match: std::option::Option<i64>,
4031
4032 /// Optional. Makes the operation conditional on whether the source object's
4033 /// current generation does not match the given value.
4034 /// `if_source_generation_match` and `if_source_generation_not_match`
4035 /// conditions are mutually exclusive: it's an error for both of them to be set
4036 /// in the request.
4037 pub if_source_generation_not_match: std::option::Option<i64>,
4038
4039 /// Optional. Makes the operation conditional on whether the source object's
4040 /// current metageneration matches the given value.
4041 /// `if_source_metageneration_match` and `if_source_metageneration_not_match`
4042 /// conditions are mutually exclusive: it's an error for both of them to be set
4043 /// in the request.
4044 pub if_source_metageneration_match: std::option::Option<i64>,
4045
4046 /// Optional. Makes the operation conditional on whether the source object's
4047 /// current metageneration does not match the given value.
4048 /// `if_source_metageneration_match` and `if_source_metageneration_not_match`
4049 /// conditions are mutually exclusive: it's an error for both of them to be set
4050 /// in the request.
4051 pub if_source_metageneration_not_match: std::option::Option<i64>,
4052
4053 /// Optional. Makes the operation conditional on whether the destination
4054 /// object's current generation matches the given value. Setting to 0 makes the
4055 /// operation succeed only if there are no live versions of the object.
4056 /// `if_generation_match` and `if_generation_not_match` conditions are mutually
4057 /// exclusive: it's an error for both of them to be set in the request.
4058 pub if_generation_match: std::option::Option<i64>,
4059
4060 /// Optional. Makes the operation conditional on whether the destination
4061 /// object's current generation does not match the given value. If no live
4062 /// object exists, the precondition fails. Setting to 0 makes the operation
4063 /// succeed only if there is a live version of the object.
4064 /// `if_generation_match` and `if_generation_not_match` conditions are mutually
4065 /// exclusive: it's an error for both of them to be set in the request.
4066 pub if_generation_not_match: std::option::Option<i64>,
4067
4068 /// Optional. Makes the operation conditional on whether the destination
4069 /// object's current metageneration matches the given value.
4070 /// `if_metageneration_match` and `if_metageneration_not_match` conditions are
4071 /// mutually exclusive: it's an error for both of them to be set in the
4072 /// request.
4073 pub if_metageneration_match: std::option::Option<i64>,
4074
4075 /// Optional. Makes the operation conditional on whether the destination
4076 /// object's current metageneration does not match the given value.
4077 /// `if_metageneration_match` and `if_metageneration_not_match` conditions are
4078 /// mutually exclusive: it's an error for both of them to be set in the
4079 /// request.
4080 pub if_metageneration_not_match: std::option::Option<i64>,
4081
4082 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4083}
4084
4085impl MoveObjectRequest {
4086 /// Creates a new default instance.
4087 pub fn new() -> Self {
4088 std::default::Default::default()
4089 }
4090
4091 /// Sets the value of [bucket][crate::model::MoveObjectRequest::bucket].
4092 ///
4093 /// # Example
4094 /// ```ignore,no_run
4095 /// # use google_cloud_storage::model::MoveObjectRequest;
4096 /// # let project_id = "project_id";
4097 /// # let bucket_id = "bucket_id";
4098 /// let x = MoveObjectRequest::new().set_bucket(format!("projects/{project_id}/buckets/{bucket_id}"));
4099 /// ```
4100 pub fn set_bucket<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4101 self.bucket = v.into();
4102 self
4103 }
4104
4105 /// Sets the value of [source_object][crate::model::MoveObjectRequest::source_object].
4106 ///
4107 /// # Example
4108 /// ```ignore,no_run
4109 /// # use google_cloud_storage::model::MoveObjectRequest;
4110 /// let x = MoveObjectRequest::new().set_source_object("example");
4111 /// ```
4112 pub fn set_source_object<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4113 self.source_object = v.into();
4114 self
4115 }
4116
4117 /// Sets the value of [destination_object][crate::model::MoveObjectRequest::destination_object].
4118 ///
4119 /// # Example
4120 /// ```ignore,no_run
4121 /// # use google_cloud_storage::model::MoveObjectRequest;
4122 /// let x = MoveObjectRequest::new().set_destination_object("example");
4123 /// ```
4124 pub fn set_destination_object<T: std::convert::Into<std::string::String>>(
4125 mut self,
4126 v: T,
4127 ) -> Self {
4128 self.destination_object = v.into();
4129 self
4130 }
4131
4132 /// Sets the value of [if_source_generation_match][crate::model::MoveObjectRequest::if_source_generation_match].
4133 ///
4134 /// # Example
4135 /// ```ignore,no_run
4136 /// # use google_cloud_storage::model::MoveObjectRequest;
4137 /// let x = MoveObjectRequest::new().set_if_source_generation_match(42);
4138 /// ```
4139 pub fn set_if_source_generation_match<T>(mut self, v: T) -> Self
4140 where
4141 T: std::convert::Into<i64>,
4142 {
4143 self.if_source_generation_match = std::option::Option::Some(v.into());
4144 self
4145 }
4146
4147 /// Sets or clears the value of [if_source_generation_match][crate::model::MoveObjectRequest::if_source_generation_match].
4148 ///
4149 /// # Example
4150 /// ```ignore,no_run
4151 /// # use google_cloud_storage::model::MoveObjectRequest;
4152 /// let x = MoveObjectRequest::new().set_or_clear_if_source_generation_match(Some(42));
4153 /// let x = MoveObjectRequest::new().set_or_clear_if_source_generation_match(None::<i32>);
4154 /// ```
4155 pub fn set_or_clear_if_source_generation_match<T>(mut self, v: std::option::Option<T>) -> Self
4156 where
4157 T: std::convert::Into<i64>,
4158 {
4159 self.if_source_generation_match = v.map(|x| x.into());
4160 self
4161 }
4162
4163 /// Sets the value of [if_source_generation_not_match][crate::model::MoveObjectRequest::if_source_generation_not_match].
4164 ///
4165 /// # Example
4166 /// ```ignore,no_run
4167 /// # use google_cloud_storage::model::MoveObjectRequest;
4168 /// let x = MoveObjectRequest::new().set_if_source_generation_not_match(42);
4169 /// ```
4170 pub fn set_if_source_generation_not_match<T>(mut self, v: T) -> Self
4171 where
4172 T: std::convert::Into<i64>,
4173 {
4174 self.if_source_generation_not_match = std::option::Option::Some(v.into());
4175 self
4176 }
4177
4178 /// Sets or clears the value of [if_source_generation_not_match][crate::model::MoveObjectRequest::if_source_generation_not_match].
4179 ///
4180 /// # Example
4181 /// ```ignore,no_run
4182 /// # use google_cloud_storage::model::MoveObjectRequest;
4183 /// let x = MoveObjectRequest::new().set_or_clear_if_source_generation_not_match(Some(42));
4184 /// let x = MoveObjectRequest::new().set_or_clear_if_source_generation_not_match(None::<i32>);
4185 /// ```
4186 pub fn set_or_clear_if_source_generation_not_match<T>(
4187 mut self,
4188 v: std::option::Option<T>,
4189 ) -> Self
4190 where
4191 T: std::convert::Into<i64>,
4192 {
4193 self.if_source_generation_not_match = v.map(|x| x.into());
4194 self
4195 }
4196
4197 /// Sets the value of [if_source_metageneration_match][crate::model::MoveObjectRequest::if_source_metageneration_match].
4198 ///
4199 /// # Example
4200 /// ```ignore,no_run
4201 /// # use google_cloud_storage::model::MoveObjectRequest;
4202 /// let x = MoveObjectRequest::new().set_if_source_metageneration_match(42);
4203 /// ```
4204 pub fn set_if_source_metageneration_match<T>(mut self, v: T) -> Self
4205 where
4206 T: std::convert::Into<i64>,
4207 {
4208 self.if_source_metageneration_match = std::option::Option::Some(v.into());
4209 self
4210 }
4211
4212 /// Sets or clears the value of [if_source_metageneration_match][crate::model::MoveObjectRequest::if_source_metageneration_match].
4213 ///
4214 /// # Example
4215 /// ```ignore,no_run
4216 /// # use google_cloud_storage::model::MoveObjectRequest;
4217 /// let x = MoveObjectRequest::new().set_or_clear_if_source_metageneration_match(Some(42));
4218 /// let x = MoveObjectRequest::new().set_or_clear_if_source_metageneration_match(None::<i32>);
4219 /// ```
4220 pub fn set_or_clear_if_source_metageneration_match<T>(
4221 mut self,
4222 v: std::option::Option<T>,
4223 ) -> Self
4224 where
4225 T: std::convert::Into<i64>,
4226 {
4227 self.if_source_metageneration_match = v.map(|x| x.into());
4228 self
4229 }
4230
4231 /// Sets the value of [if_source_metageneration_not_match][crate::model::MoveObjectRequest::if_source_metageneration_not_match].
4232 ///
4233 /// # Example
4234 /// ```ignore,no_run
4235 /// # use google_cloud_storage::model::MoveObjectRequest;
4236 /// let x = MoveObjectRequest::new().set_if_source_metageneration_not_match(42);
4237 /// ```
4238 pub fn set_if_source_metageneration_not_match<T>(mut self, v: T) -> Self
4239 where
4240 T: std::convert::Into<i64>,
4241 {
4242 self.if_source_metageneration_not_match = std::option::Option::Some(v.into());
4243 self
4244 }
4245
4246 /// Sets or clears the value of [if_source_metageneration_not_match][crate::model::MoveObjectRequest::if_source_metageneration_not_match].
4247 ///
4248 /// # Example
4249 /// ```ignore,no_run
4250 /// # use google_cloud_storage::model::MoveObjectRequest;
4251 /// let x = MoveObjectRequest::new().set_or_clear_if_source_metageneration_not_match(Some(42));
4252 /// let x = MoveObjectRequest::new().set_or_clear_if_source_metageneration_not_match(None::<i32>);
4253 /// ```
4254 pub fn set_or_clear_if_source_metageneration_not_match<T>(
4255 mut self,
4256 v: std::option::Option<T>,
4257 ) -> Self
4258 where
4259 T: std::convert::Into<i64>,
4260 {
4261 self.if_source_metageneration_not_match = v.map(|x| x.into());
4262 self
4263 }
4264
4265 /// Sets the value of [if_generation_match][crate::model::MoveObjectRequest::if_generation_match].
4266 ///
4267 /// # Example
4268 /// ```ignore,no_run
4269 /// # use google_cloud_storage::model::MoveObjectRequest;
4270 /// let x = MoveObjectRequest::new().set_if_generation_match(42);
4271 /// ```
4272 pub fn set_if_generation_match<T>(mut self, v: T) -> Self
4273 where
4274 T: std::convert::Into<i64>,
4275 {
4276 self.if_generation_match = std::option::Option::Some(v.into());
4277 self
4278 }
4279
4280 /// Sets or clears the value of [if_generation_match][crate::model::MoveObjectRequest::if_generation_match].
4281 ///
4282 /// # Example
4283 /// ```ignore,no_run
4284 /// # use google_cloud_storage::model::MoveObjectRequest;
4285 /// let x = MoveObjectRequest::new().set_or_clear_if_generation_match(Some(42));
4286 /// let x = MoveObjectRequest::new().set_or_clear_if_generation_match(None::<i32>);
4287 /// ```
4288 pub fn set_or_clear_if_generation_match<T>(mut self, v: std::option::Option<T>) -> Self
4289 where
4290 T: std::convert::Into<i64>,
4291 {
4292 self.if_generation_match = v.map(|x| x.into());
4293 self
4294 }
4295
4296 /// Sets the value of [if_generation_not_match][crate::model::MoveObjectRequest::if_generation_not_match].
4297 ///
4298 /// # Example
4299 /// ```ignore,no_run
4300 /// # use google_cloud_storage::model::MoveObjectRequest;
4301 /// let x = MoveObjectRequest::new().set_if_generation_not_match(42);
4302 /// ```
4303 pub fn set_if_generation_not_match<T>(mut self, v: T) -> Self
4304 where
4305 T: std::convert::Into<i64>,
4306 {
4307 self.if_generation_not_match = std::option::Option::Some(v.into());
4308 self
4309 }
4310
4311 /// Sets or clears the value of [if_generation_not_match][crate::model::MoveObjectRequest::if_generation_not_match].
4312 ///
4313 /// # Example
4314 /// ```ignore,no_run
4315 /// # use google_cloud_storage::model::MoveObjectRequest;
4316 /// let x = MoveObjectRequest::new().set_or_clear_if_generation_not_match(Some(42));
4317 /// let x = MoveObjectRequest::new().set_or_clear_if_generation_not_match(None::<i32>);
4318 /// ```
4319 pub fn set_or_clear_if_generation_not_match<T>(mut self, v: std::option::Option<T>) -> Self
4320 where
4321 T: std::convert::Into<i64>,
4322 {
4323 self.if_generation_not_match = v.map(|x| x.into());
4324 self
4325 }
4326
4327 /// Sets the value of [if_metageneration_match][crate::model::MoveObjectRequest::if_metageneration_match].
4328 ///
4329 /// # Example
4330 /// ```ignore,no_run
4331 /// # use google_cloud_storage::model::MoveObjectRequest;
4332 /// let x = MoveObjectRequest::new().set_if_metageneration_match(42);
4333 /// ```
4334 pub fn set_if_metageneration_match<T>(mut self, v: T) -> Self
4335 where
4336 T: std::convert::Into<i64>,
4337 {
4338 self.if_metageneration_match = std::option::Option::Some(v.into());
4339 self
4340 }
4341
4342 /// Sets or clears the value of [if_metageneration_match][crate::model::MoveObjectRequest::if_metageneration_match].
4343 ///
4344 /// # Example
4345 /// ```ignore,no_run
4346 /// # use google_cloud_storage::model::MoveObjectRequest;
4347 /// let x = MoveObjectRequest::new().set_or_clear_if_metageneration_match(Some(42));
4348 /// let x = MoveObjectRequest::new().set_or_clear_if_metageneration_match(None::<i32>);
4349 /// ```
4350 pub fn set_or_clear_if_metageneration_match<T>(mut self, v: std::option::Option<T>) -> Self
4351 where
4352 T: std::convert::Into<i64>,
4353 {
4354 self.if_metageneration_match = v.map(|x| x.into());
4355 self
4356 }
4357
4358 /// Sets the value of [if_metageneration_not_match][crate::model::MoveObjectRequest::if_metageneration_not_match].
4359 ///
4360 /// # Example
4361 /// ```ignore,no_run
4362 /// # use google_cloud_storage::model::MoveObjectRequest;
4363 /// let x = MoveObjectRequest::new().set_if_metageneration_not_match(42);
4364 /// ```
4365 pub fn set_if_metageneration_not_match<T>(mut self, v: T) -> Self
4366 where
4367 T: std::convert::Into<i64>,
4368 {
4369 self.if_metageneration_not_match = std::option::Option::Some(v.into());
4370 self
4371 }
4372
4373 /// Sets or clears the value of [if_metageneration_not_match][crate::model::MoveObjectRequest::if_metageneration_not_match].
4374 ///
4375 /// # Example
4376 /// ```ignore,no_run
4377 /// # use google_cloud_storage::model::MoveObjectRequest;
4378 /// let x = MoveObjectRequest::new().set_or_clear_if_metageneration_not_match(Some(42));
4379 /// let x = MoveObjectRequest::new().set_or_clear_if_metageneration_not_match(None::<i32>);
4380 /// ```
4381 pub fn set_or_clear_if_metageneration_not_match<T>(mut self, v: std::option::Option<T>) -> Self
4382 where
4383 T: std::convert::Into<i64>,
4384 {
4385 self.if_metageneration_not_match = v.map(|x| x.into());
4386 self
4387 }
4388}
4389
4390impl wkt::message::Message for MoveObjectRequest {
4391 fn typename() -> &'static str {
4392 "type.googleapis.com/google.storage.v2.MoveObjectRequest"
4393 }
4394}
4395
4396/// Request message for [UpdateObject][google.storage.v2.Storage.UpdateObject].
4397///
4398/// [google.storage.v2.Storage.UpdateObject]: crate::client::StorageControl::update_object
4399#[derive(Clone, Default, PartialEq)]
4400#[non_exhaustive]
4401pub struct UpdateObjectRequest {
4402 /// Required. The object to update.
4403 /// The object's bucket and name fields are used to identify the object to
4404 /// update. If present, the object's generation field selects a specific
4405 /// revision of this object whose metadata should be updated. Otherwise,
4406 /// assumes the live version of the object.
4407 pub object: std::option::Option<crate::model::Object>,
4408
4409 /// Makes the operation conditional on whether the object's current generation
4410 /// matches the given value. Setting to 0 makes the operation succeed only if
4411 /// there are no live versions of the object.
4412 pub if_generation_match: std::option::Option<i64>,
4413
4414 /// Makes the operation conditional on whether the object's live generation
4415 /// does not match the given value. If no live object exists, the precondition
4416 /// fails. Setting to 0 makes the operation succeed only if there is a live
4417 /// version of the object.
4418 pub if_generation_not_match: std::option::Option<i64>,
4419
4420 /// Makes the operation conditional on whether the object's current
4421 /// metageneration matches the given value.
4422 pub if_metageneration_match: std::option::Option<i64>,
4423
4424 /// Makes the operation conditional on whether the object's current
4425 /// metageneration does not match the given value.
4426 pub if_metageneration_not_match: std::option::Option<i64>,
4427
4428 /// Optional. Apply a predefined set of access controls to this object.
4429 /// Valid values are "authenticatedRead", "bucketOwnerFullControl",
4430 /// "bucketOwnerRead", "private", "projectPrivate", or "publicRead".
4431 pub predefined_acl: std::string::String,
4432
4433 /// Required. List of fields to be updated.
4434 ///
4435 /// To specify ALL fields, equivalent to the JSON API's "update" function,
4436 /// specify a single field with the value `*`. Note: not recommended. If a new
4437 /// field is introduced at a later time, an older client updating with the `*`
4438 /// might accidentally reset the new field's value.
4439 ///
4440 /// Not specifying any fields is an error.
4441 pub update_mask: std::option::Option<wkt::FieldMask>,
4442
4443 /// Optional. A set of parameters common to Storage API requests concerning an
4444 /// object.
4445 pub common_object_request_params: std::option::Option<crate::model::CommonObjectRequestParams>,
4446
4447 /// Optional. Overrides the unlocked retention config on the object.
4448 pub override_unlocked_retention: bool,
4449
4450 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4451}
4452
4453impl UpdateObjectRequest {
4454 /// Creates a new default instance.
4455 pub fn new() -> Self {
4456 std::default::Default::default()
4457 }
4458
4459 /// Sets the value of [object][crate::model::UpdateObjectRequest::object].
4460 ///
4461 /// # Example
4462 /// ```ignore,no_run
4463 /// # use google_cloud_storage::model::UpdateObjectRequest;
4464 /// use google_cloud_storage::model::Object;
4465 /// let x = UpdateObjectRequest::new().set_object(Object::default()/* use setters */);
4466 /// ```
4467 pub fn set_object<T>(mut self, v: T) -> Self
4468 where
4469 T: std::convert::Into<crate::model::Object>,
4470 {
4471 self.object = std::option::Option::Some(v.into());
4472 self
4473 }
4474
4475 /// Sets or clears the value of [object][crate::model::UpdateObjectRequest::object].
4476 ///
4477 /// # Example
4478 /// ```ignore,no_run
4479 /// # use google_cloud_storage::model::UpdateObjectRequest;
4480 /// use google_cloud_storage::model::Object;
4481 /// let x = UpdateObjectRequest::new().set_or_clear_object(Some(Object::default()/* use setters */));
4482 /// let x = UpdateObjectRequest::new().set_or_clear_object(None::<Object>);
4483 /// ```
4484 pub fn set_or_clear_object<T>(mut self, v: std::option::Option<T>) -> Self
4485 where
4486 T: std::convert::Into<crate::model::Object>,
4487 {
4488 self.object = v.map(|x| x.into());
4489 self
4490 }
4491
4492 /// Sets the value of [if_generation_match][crate::model::UpdateObjectRequest::if_generation_match].
4493 ///
4494 /// # Example
4495 /// ```ignore,no_run
4496 /// # use google_cloud_storage::model::UpdateObjectRequest;
4497 /// let x = UpdateObjectRequest::new().set_if_generation_match(42);
4498 /// ```
4499 pub fn set_if_generation_match<T>(mut self, v: T) -> Self
4500 where
4501 T: std::convert::Into<i64>,
4502 {
4503 self.if_generation_match = std::option::Option::Some(v.into());
4504 self
4505 }
4506
4507 /// Sets or clears the value of [if_generation_match][crate::model::UpdateObjectRequest::if_generation_match].
4508 ///
4509 /// # Example
4510 /// ```ignore,no_run
4511 /// # use google_cloud_storage::model::UpdateObjectRequest;
4512 /// let x = UpdateObjectRequest::new().set_or_clear_if_generation_match(Some(42));
4513 /// let x = UpdateObjectRequest::new().set_or_clear_if_generation_match(None::<i32>);
4514 /// ```
4515 pub fn set_or_clear_if_generation_match<T>(mut self, v: std::option::Option<T>) -> Self
4516 where
4517 T: std::convert::Into<i64>,
4518 {
4519 self.if_generation_match = v.map(|x| x.into());
4520 self
4521 }
4522
4523 /// Sets the value of [if_generation_not_match][crate::model::UpdateObjectRequest::if_generation_not_match].
4524 ///
4525 /// # Example
4526 /// ```ignore,no_run
4527 /// # use google_cloud_storage::model::UpdateObjectRequest;
4528 /// let x = UpdateObjectRequest::new().set_if_generation_not_match(42);
4529 /// ```
4530 pub fn set_if_generation_not_match<T>(mut self, v: T) -> Self
4531 where
4532 T: std::convert::Into<i64>,
4533 {
4534 self.if_generation_not_match = std::option::Option::Some(v.into());
4535 self
4536 }
4537
4538 /// Sets or clears the value of [if_generation_not_match][crate::model::UpdateObjectRequest::if_generation_not_match].
4539 ///
4540 /// # Example
4541 /// ```ignore,no_run
4542 /// # use google_cloud_storage::model::UpdateObjectRequest;
4543 /// let x = UpdateObjectRequest::new().set_or_clear_if_generation_not_match(Some(42));
4544 /// let x = UpdateObjectRequest::new().set_or_clear_if_generation_not_match(None::<i32>);
4545 /// ```
4546 pub fn set_or_clear_if_generation_not_match<T>(mut self, v: std::option::Option<T>) -> Self
4547 where
4548 T: std::convert::Into<i64>,
4549 {
4550 self.if_generation_not_match = v.map(|x| x.into());
4551 self
4552 }
4553
4554 /// Sets the value of [if_metageneration_match][crate::model::UpdateObjectRequest::if_metageneration_match].
4555 ///
4556 /// # Example
4557 /// ```ignore,no_run
4558 /// # use google_cloud_storage::model::UpdateObjectRequest;
4559 /// let x = UpdateObjectRequest::new().set_if_metageneration_match(42);
4560 /// ```
4561 pub fn set_if_metageneration_match<T>(mut self, v: T) -> Self
4562 where
4563 T: std::convert::Into<i64>,
4564 {
4565 self.if_metageneration_match = std::option::Option::Some(v.into());
4566 self
4567 }
4568
4569 /// Sets or clears the value of [if_metageneration_match][crate::model::UpdateObjectRequest::if_metageneration_match].
4570 ///
4571 /// # Example
4572 /// ```ignore,no_run
4573 /// # use google_cloud_storage::model::UpdateObjectRequest;
4574 /// let x = UpdateObjectRequest::new().set_or_clear_if_metageneration_match(Some(42));
4575 /// let x = UpdateObjectRequest::new().set_or_clear_if_metageneration_match(None::<i32>);
4576 /// ```
4577 pub fn set_or_clear_if_metageneration_match<T>(mut self, v: std::option::Option<T>) -> Self
4578 where
4579 T: std::convert::Into<i64>,
4580 {
4581 self.if_metageneration_match = v.map(|x| x.into());
4582 self
4583 }
4584
4585 /// Sets the value of [if_metageneration_not_match][crate::model::UpdateObjectRequest::if_metageneration_not_match].
4586 ///
4587 /// # Example
4588 /// ```ignore,no_run
4589 /// # use google_cloud_storage::model::UpdateObjectRequest;
4590 /// let x = UpdateObjectRequest::new().set_if_metageneration_not_match(42);
4591 /// ```
4592 pub fn set_if_metageneration_not_match<T>(mut self, v: T) -> Self
4593 where
4594 T: std::convert::Into<i64>,
4595 {
4596 self.if_metageneration_not_match = std::option::Option::Some(v.into());
4597 self
4598 }
4599
4600 /// Sets or clears the value of [if_metageneration_not_match][crate::model::UpdateObjectRequest::if_metageneration_not_match].
4601 ///
4602 /// # Example
4603 /// ```ignore,no_run
4604 /// # use google_cloud_storage::model::UpdateObjectRequest;
4605 /// let x = UpdateObjectRequest::new().set_or_clear_if_metageneration_not_match(Some(42));
4606 /// let x = UpdateObjectRequest::new().set_or_clear_if_metageneration_not_match(None::<i32>);
4607 /// ```
4608 pub fn set_or_clear_if_metageneration_not_match<T>(mut self, v: std::option::Option<T>) -> Self
4609 where
4610 T: std::convert::Into<i64>,
4611 {
4612 self.if_metageneration_not_match = v.map(|x| x.into());
4613 self
4614 }
4615
4616 /// Sets the value of [predefined_acl][crate::model::UpdateObjectRequest::predefined_acl].
4617 ///
4618 /// # Example
4619 /// ```ignore,no_run
4620 /// # use google_cloud_storage::model::UpdateObjectRequest;
4621 /// let x = UpdateObjectRequest::new().set_predefined_acl("example");
4622 /// ```
4623 pub fn set_predefined_acl<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4624 self.predefined_acl = v.into();
4625 self
4626 }
4627
4628 /// Sets the value of [update_mask][crate::model::UpdateObjectRequest::update_mask].
4629 ///
4630 /// # Example
4631 /// ```ignore,no_run
4632 /// # use google_cloud_storage::model::UpdateObjectRequest;
4633 /// use wkt::FieldMask;
4634 /// let x = UpdateObjectRequest::new().set_update_mask(FieldMask::default()/* use setters */);
4635 /// ```
4636 pub fn set_update_mask<T>(mut self, v: T) -> Self
4637 where
4638 T: std::convert::Into<wkt::FieldMask>,
4639 {
4640 self.update_mask = std::option::Option::Some(v.into());
4641 self
4642 }
4643
4644 /// Sets or clears the value of [update_mask][crate::model::UpdateObjectRequest::update_mask].
4645 ///
4646 /// # Example
4647 /// ```ignore,no_run
4648 /// # use google_cloud_storage::model::UpdateObjectRequest;
4649 /// use wkt::FieldMask;
4650 /// let x = UpdateObjectRequest::new().set_or_clear_update_mask(Some(FieldMask::default()/* use setters */));
4651 /// let x = UpdateObjectRequest::new().set_or_clear_update_mask(None::<FieldMask>);
4652 /// ```
4653 pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
4654 where
4655 T: std::convert::Into<wkt::FieldMask>,
4656 {
4657 self.update_mask = v.map(|x| x.into());
4658 self
4659 }
4660
4661 /// Sets the value of [common_object_request_params][crate::model::UpdateObjectRequest::common_object_request_params].
4662 ///
4663 /// # Example
4664 /// ```ignore,no_run
4665 /// # use google_cloud_storage::model::UpdateObjectRequest;
4666 /// use google_cloud_storage::model::CommonObjectRequestParams;
4667 /// let x = UpdateObjectRequest::new().set_common_object_request_params(CommonObjectRequestParams::default()/* use setters */);
4668 /// ```
4669 pub fn set_common_object_request_params<T>(mut self, v: T) -> Self
4670 where
4671 T: std::convert::Into<crate::model::CommonObjectRequestParams>,
4672 {
4673 self.common_object_request_params = std::option::Option::Some(v.into());
4674 self
4675 }
4676
4677 /// Sets or clears the value of [common_object_request_params][crate::model::UpdateObjectRequest::common_object_request_params].
4678 ///
4679 /// # Example
4680 /// ```ignore,no_run
4681 /// # use google_cloud_storage::model::UpdateObjectRequest;
4682 /// use google_cloud_storage::model::CommonObjectRequestParams;
4683 /// let x = UpdateObjectRequest::new().set_or_clear_common_object_request_params(Some(CommonObjectRequestParams::default()/* use setters */));
4684 /// let x = UpdateObjectRequest::new().set_or_clear_common_object_request_params(None::<CommonObjectRequestParams>);
4685 /// ```
4686 pub fn set_or_clear_common_object_request_params<T>(mut self, v: std::option::Option<T>) -> Self
4687 where
4688 T: std::convert::Into<crate::model::CommonObjectRequestParams>,
4689 {
4690 self.common_object_request_params = v.map(|x| x.into());
4691 self
4692 }
4693
4694 /// Sets the value of [override_unlocked_retention][crate::model::UpdateObjectRequest::override_unlocked_retention].
4695 ///
4696 /// # Example
4697 /// ```ignore,no_run
4698 /// # use google_cloud_storage::model::UpdateObjectRequest;
4699 /// let x = UpdateObjectRequest::new().set_override_unlocked_retention(true);
4700 /// ```
4701 pub fn set_override_unlocked_retention<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
4702 self.override_unlocked_retention = v.into();
4703 self
4704 }
4705}
4706
4707impl wkt::message::Message for UpdateObjectRequest {
4708 fn typename() -> &'static str {
4709 "type.googleapis.com/google.storage.v2.UpdateObjectRequest"
4710 }
4711}
4712
4713/// Parameters that can be passed to any object request.
4714#[derive(Clone, Default, PartialEq)]
4715#[non_exhaustive]
4716pub struct CommonObjectRequestParams {
4717 /// Optional. Encryption algorithm used with the Customer-Supplied Encryption
4718 /// Keys feature.
4719 pub encryption_algorithm: std::string::String,
4720
4721 /// Optional. Encryption key used with the Customer-Supplied Encryption Keys
4722 /// feature. In raw bytes format (not base64-encoded).
4723 pub encryption_key_bytes: ::bytes::Bytes,
4724
4725 /// Optional. SHA256 hash of encryption key used with the Customer-supplied
4726 /// encryption keys feature.
4727 pub encryption_key_sha256_bytes: ::bytes::Bytes,
4728
4729 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4730}
4731
4732impl CommonObjectRequestParams {
4733 /// Creates a new default instance.
4734 pub fn new() -> Self {
4735 std::default::Default::default()
4736 }
4737
4738 /// Sets the value of [encryption_algorithm][crate::model::CommonObjectRequestParams::encryption_algorithm].
4739 ///
4740 /// # Example
4741 /// ```ignore,no_run
4742 /// # use google_cloud_storage::model::CommonObjectRequestParams;
4743 /// let x = CommonObjectRequestParams::new().set_encryption_algorithm("example");
4744 /// ```
4745 pub fn set_encryption_algorithm<T: std::convert::Into<std::string::String>>(
4746 mut self,
4747 v: T,
4748 ) -> Self {
4749 self.encryption_algorithm = v.into();
4750 self
4751 }
4752
4753 /// Sets the value of [encryption_key_bytes][crate::model::CommonObjectRequestParams::encryption_key_bytes].
4754 ///
4755 /// # Example
4756 /// ```ignore,no_run
4757 /// # use google_cloud_storage::model::CommonObjectRequestParams;
4758 /// let x = CommonObjectRequestParams::new().set_encryption_key_bytes(bytes::Bytes::from_static(b"example"));
4759 /// ```
4760 pub fn set_encryption_key_bytes<T: std::convert::Into<::bytes::Bytes>>(mut self, v: T) -> Self {
4761 self.encryption_key_bytes = v.into();
4762 self
4763 }
4764
4765 /// Sets the value of [encryption_key_sha256_bytes][crate::model::CommonObjectRequestParams::encryption_key_sha256_bytes].
4766 ///
4767 /// # Example
4768 /// ```ignore,no_run
4769 /// # use google_cloud_storage::model::CommonObjectRequestParams;
4770 /// let x = CommonObjectRequestParams::new().set_encryption_key_sha256_bytes(bytes::Bytes::from_static(b"example"));
4771 /// ```
4772 pub fn set_encryption_key_sha256_bytes<T: std::convert::Into<::bytes::Bytes>>(
4773 mut self,
4774 v: T,
4775 ) -> Self {
4776 self.encryption_key_sha256_bytes = v.into();
4777 self
4778 }
4779}
4780
4781impl wkt::message::Message for CommonObjectRequestParams {
4782 fn typename() -> &'static str {
4783 "type.googleapis.com/google.storage.v2.CommonObjectRequestParams"
4784 }
4785}
4786
4787/// A bucket.
4788#[derive(Clone, Default, PartialEq)]
4789#[non_exhaustive]
4790pub struct Bucket {
4791 /// Identifier. The name of the bucket.
4792 /// Format: `projects/{project}/buckets/{bucket}`
4793 pub name: std::string::String,
4794
4795 /// Output only. The user-chosen part of the bucket name. The `{bucket}`
4796 /// portion of the `name` field. For globally unique buckets, this is equal to
4797 /// the `bucket name` of other Cloud Storage APIs. Example: `pub`.
4798 pub bucket_id: std::string::String,
4799
4800 /// The etag of the bucket.
4801 /// If included in the metadata of an `UpdateBucketRequest`, the operation is
4802 /// only performed if the `etag` matches that of the bucket.
4803 pub etag: std::string::String,
4804
4805 /// Immutable. The project which owns this bucket, in the format of
4806 /// `projects/{projectIdentifier}`.
4807 /// `{projectIdentifier}` can be the project ID or project number.
4808 /// Output values are always in the project number format.
4809 pub project: std::string::String,
4810
4811 /// Output only. The metadata generation of this bucket.
4812 pub metageneration: i64,
4813
4814 /// Immutable. The location of the bucket. Object data for objects in the
4815 /// bucket resides in physical storage within this region. Defaults to `US`.
4816 /// Attempting to update this field after the bucket is created results in an
4817 /// error.
4818 pub location: std::string::String,
4819
4820 /// Output only. The location type of the bucket (region, dual-region,
4821 /// multi-region, etc).
4822 pub location_type: std::string::String,
4823
4824 /// Optional. The bucket's default storage class, used whenever no storageClass
4825 /// is specified for a newly-created object. This defines how objects in the
4826 /// bucket are stored and determines the SLA and the cost of storage.
4827 /// If this value is not specified when the bucket is created, it defaults
4828 /// to `STANDARD`. For more information, see [Storage
4829 /// classes](https://developers.google.com/storage/docs/storage-classes).
4830 pub storage_class: std::string::String,
4831
4832 /// Optional. The recovery point objective for cross-region replication of the
4833 /// bucket. Applicable only for dual- and multi-region buckets. `DEFAULT` uses
4834 /// default replication. `ASYNC_TURBO` enables turbo replication, valid for
4835 /// dual-region buckets only. If rpo is not specified when the bucket is
4836 /// created, it defaults to `DEFAULT`. For more information, see [Turbo
4837 /// replication](https://cloud.google.com/storage/docs/availability-durability#turbo-replication).
4838 pub rpo: std::string::String,
4839
4840 /// Optional. Access controls on the bucket.
4841 /// If `iam_config.uniform_bucket_level_access` is enabled on this bucket,
4842 /// requests to set, read, or modify acl is an error.
4843 pub acl: std::vec::Vec<crate::model::BucketAccessControl>,
4844
4845 /// Optional. Default access controls to apply to new objects when no ACL is
4846 /// provided. If `iam_config.uniform_bucket_level_access` is enabled on this
4847 /// bucket, requests to set, read, or modify acl is an error.
4848 pub default_object_acl: std::vec::Vec<crate::model::ObjectAccessControl>,
4849
4850 /// Optional. The bucket's lifecycle configuration. See [Lifecycle
4851 /// Management](https://developers.google.com/storage/docs/lifecycle) for more
4852 /// information.
4853 pub lifecycle: std::option::Option<crate::model::bucket::Lifecycle>,
4854
4855 /// Output only. The creation time of the bucket.
4856 pub create_time: std::option::Option<wkt::Timestamp>,
4857
4858 /// Optional. The bucket's [CORS](https://www.w3.org/TR/cors/)
4859 /// configuration.
4860 pub cors: std::vec::Vec<crate::model::bucket::Cors>,
4861
4862 /// Output only. The modification time of the bucket.
4863 pub update_time: std::option::Option<wkt::Timestamp>,
4864
4865 /// Optional. The default value for event-based hold on newly created objects
4866 /// in this bucket. Event-based hold is a way to retain objects indefinitely
4867 /// until an event occurs, signified by the hold's release. After being
4868 /// released, such objects are subject to bucket-level retention (if any). One
4869 /// sample use case of this flag is for banks to hold loan documents for at
4870 /// least 3 years after loan is paid in full. Here, bucket-level retention is 3
4871 /// years and the event is loan being paid in full. In this example, these
4872 /// objects are held intact for any number of years until the event has
4873 /// occurred (event-based hold on the object is released) and then 3 more years
4874 /// after that. That means retention duration of the objects begins from the
4875 /// moment event-based hold transitioned from true to false. Objects under
4876 /// event-based hold cannot be deleted, overwritten or archived until the hold
4877 /// is removed.
4878 pub default_event_based_hold: bool,
4879
4880 /// Optional. User-provided labels, in key/value pairs.
4881 pub labels: std::collections::HashMap<std::string::String, std::string::String>,
4882
4883 /// Optional. The bucket's website config, controlling how the service behaves
4884 /// when accessing bucket contents as a web site. See the [Static website
4885 /// examples](https://cloud.google.com/storage/docs/static-website) for more
4886 /// information.
4887 pub website: std::option::Option<crate::model::bucket::Website>,
4888
4889 /// Optional. The bucket's versioning configuration.
4890 pub versioning: std::option::Option<crate::model::bucket::Versioning>,
4891
4892 /// Optional. The bucket's logging config, which defines the destination bucket
4893 /// and name prefix (if any) for the current bucket's logs.
4894 pub logging: std::option::Option<crate::model::bucket::Logging>,
4895
4896 /// Output only. The owner of the bucket. This is always the project team's
4897 /// owner group.
4898 pub owner: std::option::Option<crate::model::Owner>,
4899
4900 /// Optional. Encryption config for a bucket.
4901 pub encryption: std::option::Option<crate::model::bucket::Encryption>,
4902
4903 /// Optional. The bucket's billing configuration.
4904 pub billing: std::option::Option<crate::model::bucket::Billing>,
4905
4906 /// Optional. The bucket's retention policy. The retention policy enforces a
4907 /// minimum retention time for all objects contained in the bucket, based on
4908 /// their creation time. Any attempt to overwrite or delete objects younger
4909 /// than the retention period results in a `PERMISSION_DENIED` error. An
4910 /// unlocked retention policy can be modified or removed from the bucket via a
4911 /// storage.buckets.update operation. A locked retention policy cannot be
4912 /// removed or shortened in duration for the lifetime of the bucket.
4913 /// Attempting to remove or decrease period of a locked retention policy
4914 /// results in a `PERMISSION_DENIED` error.
4915 pub retention_policy: std::option::Option<crate::model::bucket::RetentionPolicy>,
4916
4917 /// Optional. The bucket's IAM configuration.
4918 pub iam_config: std::option::Option<crate::model::bucket::IamConfig>,
4919
4920 /// Optional. Reserved for future use.
4921 pub satisfies_pzs: bool,
4922
4923 /// Optional. Configuration that, if present, specifies the data placement for
4924 /// a [configurable
4925 /// dual-region](https://cloud.google.com/storage/docs/locations#location-dr).
4926 pub custom_placement_config: std::option::Option<crate::model::bucket::CustomPlacementConfig>,
4927
4928 /// Optional. The bucket's Autoclass configuration. If there is no
4929 /// configuration, the Autoclass feature is disabled and has no effect on the
4930 /// bucket.
4931 pub autoclass: std::option::Option<crate::model::bucket::Autoclass>,
4932
4933 /// Optional. The bucket's hierarchical namespace configuration. If there is no
4934 /// configuration, the hierarchical namespace feature is disabled and has
4935 /// no effect on the bucket.
4936 pub hierarchical_namespace: std::option::Option<crate::model::bucket::HierarchicalNamespace>,
4937
4938 /// Optional. The bucket's soft delete policy. The soft delete policy prevents
4939 /// soft-deleted objects from being permanently deleted.
4940 pub soft_delete_policy: std::option::Option<crate::model::bucket::SoftDeletePolicy>,
4941
4942 /// Optional. The bucket's object retention configuration. Must be enabled
4943 /// before objects in the bucket might have retention configured.
4944 pub object_retention: std::option::Option<crate::model::bucket::ObjectRetention>,
4945
4946 /// Optional. The bucket's IP filter configuration.
4947 pub ip_filter: std::option::Option<crate::model::bucket::IpFilter>,
4948
4949 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4950}
4951
4952impl Bucket {
4953 /// Creates a new default instance.
4954 pub fn new() -> Self {
4955 std::default::Default::default()
4956 }
4957
4958 /// Sets the value of [name][crate::model::Bucket::name].
4959 ///
4960 /// # Example
4961 /// ```ignore,no_run
4962 /// # use google_cloud_storage::model::Bucket;
4963 /// # let project_id = "project_id";
4964 /// # let bucket_id = "bucket_id";
4965 /// let x = Bucket::new().set_name(format!("projects/{project_id}/buckets/{bucket_id}"));
4966 /// ```
4967 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4968 self.name = v.into();
4969 self
4970 }
4971
4972 /// Sets the value of [bucket_id][crate::model::Bucket::bucket_id].
4973 ///
4974 /// # Example
4975 /// ```ignore,no_run
4976 /// # use google_cloud_storage::model::Bucket;
4977 /// let x = Bucket::new().set_bucket_id("example");
4978 /// ```
4979 pub fn set_bucket_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4980 self.bucket_id = v.into();
4981 self
4982 }
4983
4984 /// Sets the value of [etag][crate::model::Bucket::etag].
4985 ///
4986 /// # Example
4987 /// ```ignore,no_run
4988 /// # use google_cloud_storage::model::Bucket;
4989 /// let x = Bucket::new().set_etag("example");
4990 /// ```
4991 pub fn set_etag<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4992 self.etag = v.into();
4993 self
4994 }
4995
4996 /// Sets the value of [project][crate::model::Bucket::project].
4997 ///
4998 /// # Example
4999 /// ```ignore,no_run
5000 /// # use google_cloud_storage::model::Bucket;
5001 /// let x = Bucket::new().set_project("example");
5002 /// ```
5003 pub fn set_project<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5004 self.project = v.into();
5005 self
5006 }
5007
5008 /// Sets the value of [metageneration][crate::model::Bucket::metageneration].
5009 ///
5010 /// # Example
5011 /// ```ignore,no_run
5012 /// # use google_cloud_storage::model::Bucket;
5013 /// let x = Bucket::new().set_metageneration(42);
5014 /// ```
5015 pub fn set_metageneration<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
5016 self.metageneration = v.into();
5017 self
5018 }
5019
5020 /// Sets the value of [location][crate::model::Bucket::location].
5021 ///
5022 /// # Example
5023 /// ```ignore,no_run
5024 /// # use google_cloud_storage::model::Bucket;
5025 /// let x = Bucket::new().set_location("example");
5026 /// ```
5027 pub fn set_location<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5028 self.location = v.into();
5029 self
5030 }
5031
5032 /// Sets the value of [location_type][crate::model::Bucket::location_type].
5033 ///
5034 /// # Example
5035 /// ```ignore,no_run
5036 /// # use google_cloud_storage::model::Bucket;
5037 /// let x = Bucket::new().set_location_type("example");
5038 /// ```
5039 pub fn set_location_type<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5040 self.location_type = v.into();
5041 self
5042 }
5043
5044 /// Sets the value of [storage_class][crate::model::Bucket::storage_class].
5045 ///
5046 /// # Example
5047 /// ```ignore,no_run
5048 /// # use google_cloud_storage::model::Bucket;
5049 /// let x = Bucket::new().set_storage_class("example");
5050 /// ```
5051 pub fn set_storage_class<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5052 self.storage_class = v.into();
5053 self
5054 }
5055
5056 /// Sets the value of [rpo][crate::model::Bucket::rpo].
5057 ///
5058 /// # Example
5059 /// ```ignore,no_run
5060 /// # use google_cloud_storage::model::Bucket;
5061 /// let x = Bucket::new().set_rpo("example");
5062 /// ```
5063 pub fn set_rpo<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5064 self.rpo = v.into();
5065 self
5066 }
5067
5068 /// Sets the value of [acl][crate::model::Bucket::acl].
5069 ///
5070 /// # Example
5071 /// ```ignore,no_run
5072 /// # use google_cloud_storage::model::Bucket;
5073 /// use google_cloud_storage::model::BucketAccessControl;
5074 /// let x = Bucket::new()
5075 /// .set_acl([
5076 /// BucketAccessControl::default()/* use setters */,
5077 /// BucketAccessControl::default()/* use (different) setters */,
5078 /// ]);
5079 /// ```
5080 pub fn set_acl<T, V>(mut self, v: T) -> Self
5081 where
5082 T: std::iter::IntoIterator<Item = V>,
5083 V: std::convert::Into<crate::model::BucketAccessControl>,
5084 {
5085 use std::iter::Iterator;
5086 self.acl = v.into_iter().map(|i| i.into()).collect();
5087 self
5088 }
5089
5090 /// Sets the value of [default_object_acl][crate::model::Bucket::default_object_acl].
5091 ///
5092 /// # Example
5093 /// ```ignore,no_run
5094 /// # use google_cloud_storage::model::Bucket;
5095 /// use google_cloud_storage::model::ObjectAccessControl;
5096 /// let x = Bucket::new()
5097 /// .set_default_object_acl([
5098 /// ObjectAccessControl::default()/* use setters */,
5099 /// ObjectAccessControl::default()/* use (different) setters */,
5100 /// ]);
5101 /// ```
5102 pub fn set_default_object_acl<T, V>(mut self, v: T) -> Self
5103 where
5104 T: std::iter::IntoIterator<Item = V>,
5105 V: std::convert::Into<crate::model::ObjectAccessControl>,
5106 {
5107 use std::iter::Iterator;
5108 self.default_object_acl = v.into_iter().map(|i| i.into()).collect();
5109 self
5110 }
5111
5112 /// Sets the value of [lifecycle][crate::model::Bucket::lifecycle].
5113 ///
5114 /// # Example
5115 /// ```ignore,no_run
5116 /// # use google_cloud_storage::model::Bucket;
5117 /// use google_cloud_storage::model::bucket::Lifecycle;
5118 /// let x = Bucket::new().set_lifecycle(Lifecycle::default()/* use setters */);
5119 /// ```
5120 pub fn set_lifecycle<T>(mut self, v: T) -> Self
5121 where
5122 T: std::convert::Into<crate::model::bucket::Lifecycle>,
5123 {
5124 self.lifecycle = std::option::Option::Some(v.into());
5125 self
5126 }
5127
5128 /// Sets or clears the value of [lifecycle][crate::model::Bucket::lifecycle].
5129 ///
5130 /// # Example
5131 /// ```ignore,no_run
5132 /// # use google_cloud_storage::model::Bucket;
5133 /// use google_cloud_storage::model::bucket::Lifecycle;
5134 /// let x = Bucket::new().set_or_clear_lifecycle(Some(Lifecycle::default()/* use setters */));
5135 /// let x = Bucket::new().set_or_clear_lifecycle(None::<Lifecycle>);
5136 /// ```
5137 pub fn set_or_clear_lifecycle<T>(mut self, v: std::option::Option<T>) -> Self
5138 where
5139 T: std::convert::Into<crate::model::bucket::Lifecycle>,
5140 {
5141 self.lifecycle = v.map(|x| x.into());
5142 self
5143 }
5144
5145 /// Sets the value of [create_time][crate::model::Bucket::create_time].
5146 ///
5147 /// # Example
5148 /// ```ignore,no_run
5149 /// # use google_cloud_storage::model::Bucket;
5150 /// use wkt::Timestamp;
5151 /// let x = Bucket::new().set_create_time(Timestamp::default()/* use setters */);
5152 /// ```
5153 pub fn set_create_time<T>(mut self, v: T) -> Self
5154 where
5155 T: std::convert::Into<wkt::Timestamp>,
5156 {
5157 self.create_time = std::option::Option::Some(v.into());
5158 self
5159 }
5160
5161 /// Sets or clears the value of [create_time][crate::model::Bucket::create_time].
5162 ///
5163 /// # Example
5164 /// ```ignore,no_run
5165 /// # use google_cloud_storage::model::Bucket;
5166 /// use wkt::Timestamp;
5167 /// let x = Bucket::new().set_or_clear_create_time(Some(Timestamp::default()/* use setters */));
5168 /// let x = Bucket::new().set_or_clear_create_time(None::<Timestamp>);
5169 /// ```
5170 pub fn set_or_clear_create_time<T>(mut self, v: std::option::Option<T>) -> Self
5171 where
5172 T: std::convert::Into<wkt::Timestamp>,
5173 {
5174 self.create_time = v.map(|x| x.into());
5175 self
5176 }
5177
5178 /// Sets the value of [cors][crate::model::Bucket::cors].
5179 ///
5180 /// # Example
5181 /// ```ignore,no_run
5182 /// # use google_cloud_storage::model::Bucket;
5183 /// use google_cloud_storage::model::bucket::Cors;
5184 /// let x = Bucket::new()
5185 /// .set_cors([
5186 /// Cors::default()/* use setters */,
5187 /// Cors::default()/* use (different) setters */,
5188 /// ]);
5189 /// ```
5190 pub fn set_cors<T, V>(mut self, v: T) -> Self
5191 where
5192 T: std::iter::IntoIterator<Item = V>,
5193 V: std::convert::Into<crate::model::bucket::Cors>,
5194 {
5195 use std::iter::Iterator;
5196 self.cors = v.into_iter().map(|i| i.into()).collect();
5197 self
5198 }
5199
5200 /// Sets the value of [update_time][crate::model::Bucket::update_time].
5201 ///
5202 /// # Example
5203 /// ```ignore,no_run
5204 /// # use google_cloud_storage::model::Bucket;
5205 /// use wkt::Timestamp;
5206 /// let x = Bucket::new().set_update_time(Timestamp::default()/* use setters */);
5207 /// ```
5208 pub fn set_update_time<T>(mut self, v: T) -> Self
5209 where
5210 T: std::convert::Into<wkt::Timestamp>,
5211 {
5212 self.update_time = std::option::Option::Some(v.into());
5213 self
5214 }
5215
5216 /// Sets or clears the value of [update_time][crate::model::Bucket::update_time].
5217 ///
5218 /// # Example
5219 /// ```ignore,no_run
5220 /// # use google_cloud_storage::model::Bucket;
5221 /// use wkt::Timestamp;
5222 /// let x = Bucket::new().set_or_clear_update_time(Some(Timestamp::default()/* use setters */));
5223 /// let x = Bucket::new().set_or_clear_update_time(None::<Timestamp>);
5224 /// ```
5225 pub fn set_or_clear_update_time<T>(mut self, v: std::option::Option<T>) -> Self
5226 where
5227 T: std::convert::Into<wkt::Timestamp>,
5228 {
5229 self.update_time = v.map(|x| x.into());
5230 self
5231 }
5232
5233 /// Sets the value of [default_event_based_hold][crate::model::Bucket::default_event_based_hold].
5234 ///
5235 /// # Example
5236 /// ```ignore,no_run
5237 /// # use google_cloud_storage::model::Bucket;
5238 /// let x = Bucket::new().set_default_event_based_hold(true);
5239 /// ```
5240 pub fn set_default_event_based_hold<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
5241 self.default_event_based_hold = v.into();
5242 self
5243 }
5244
5245 /// Sets the value of [labels][crate::model::Bucket::labels].
5246 ///
5247 /// # Example
5248 /// ```ignore,no_run
5249 /// # use google_cloud_storage::model::Bucket;
5250 /// let x = Bucket::new().set_labels([
5251 /// ("key0", "abc"),
5252 /// ("key1", "xyz"),
5253 /// ]);
5254 /// ```
5255 pub fn set_labels<T, K, V>(mut self, v: T) -> Self
5256 where
5257 T: std::iter::IntoIterator<Item = (K, V)>,
5258 K: std::convert::Into<std::string::String>,
5259 V: std::convert::Into<std::string::String>,
5260 {
5261 use std::iter::Iterator;
5262 self.labels = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
5263 self
5264 }
5265
5266 /// Sets the value of [website][crate::model::Bucket::website].
5267 ///
5268 /// # Example
5269 /// ```ignore,no_run
5270 /// # use google_cloud_storage::model::Bucket;
5271 /// use google_cloud_storage::model::bucket::Website;
5272 /// let x = Bucket::new().set_website(Website::default()/* use setters */);
5273 /// ```
5274 pub fn set_website<T>(mut self, v: T) -> Self
5275 where
5276 T: std::convert::Into<crate::model::bucket::Website>,
5277 {
5278 self.website = std::option::Option::Some(v.into());
5279 self
5280 }
5281
5282 /// Sets or clears the value of [website][crate::model::Bucket::website].
5283 ///
5284 /// # Example
5285 /// ```ignore,no_run
5286 /// # use google_cloud_storage::model::Bucket;
5287 /// use google_cloud_storage::model::bucket::Website;
5288 /// let x = Bucket::new().set_or_clear_website(Some(Website::default()/* use setters */));
5289 /// let x = Bucket::new().set_or_clear_website(None::<Website>);
5290 /// ```
5291 pub fn set_or_clear_website<T>(mut self, v: std::option::Option<T>) -> Self
5292 where
5293 T: std::convert::Into<crate::model::bucket::Website>,
5294 {
5295 self.website = v.map(|x| x.into());
5296 self
5297 }
5298
5299 /// Sets the value of [versioning][crate::model::Bucket::versioning].
5300 ///
5301 /// # Example
5302 /// ```ignore,no_run
5303 /// # use google_cloud_storage::model::Bucket;
5304 /// use google_cloud_storage::model::bucket::Versioning;
5305 /// let x = Bucket::new().set_versioning(Versioning::default()/* use setters */);
5306 /// ```
5307 pub fn set_versioning<T>(mut self, v: T) -> Self
5308 where
5309 T: std::convert::Into<crate::model::bucket::Versioning>,
5310 {
5311 self.versioning = std::option::Option::Some(v.into());
5312 self
5313 }
5314
5315 /// Sets or clears the value of [versioning][crate::model::Bucket::versioning].
5316 ///
5317 /// # Example
5318 /// ```ignore,no_run
5319 /// # use google_cloud_storage::model::Bucket;
5320 /// use google_cloud_storage::model::bucket::Versioning;
5321 /// let x = Bucket::new().set_or_clear_versioning(Some(Versioning::default()/* use setters */));
5322 /// let x = Bucket::new().set_or_clear_versioning(None::<Versioning>);
5323 /// ```
5324 pub fn set_or_clear_versioning<T>(mut self, v: std::option::Option<T>) -> Self
5325 where
5326 T: std::convert::Into<crate::model::bucket::Versioning>,
5327 {
5328 self.versioning = v.map(|x| x.into());
5329 self
5330 }
5331
5332 /// Sets the value of [logging][crate::model::Bucket::logging].
5333 ///
5334 /// # Example
5335 /// ```ignore,no_run
5336 /// # use google_cloud_storage::model::Bucket;
5337 /// use google_cloud_storage::model::bucket::Logging;
5338 /// let x = Bucket::new().set_logging(Logging::default()/* use setters */);
5339 /// ```
5340 pub fn set_logging<T>(mut self, v: T) -> Self
5341 where
5342 T: std::convert::Into<crate::model::bucket::Logging>,
5343 {
5344 self.logging = std::option::Option::Some(v.into());
5345 self
5346 }
5347
5348 /// Sets or clears the value of [logging][crate::model::Bucket::logging].
5349 ///
5350 /// # Example
5351 /// ```ignore,no_run
5352 /// # use google_cloud_storage::model::Bucket;
5353 /// use google_cloud_storage::model::bucket::Logging;
5354 /// let x = Bucket::new().set_or_clear_logging(Some(Logging::default()/* use setters */));
5355 /// let x = Bucket::new().set_or_clear_logging(None::<Logging>);
5356 /// ```
5357 pub fn set_or_clear_logging<T>(mut self, v: std::option::Option<T>) -> Self
5358 where
5359 T: std::convert::Into<crate::model::bucket::Logging>,
5360 {
5361 self.logging = v.map(|x| x.into());
5362 self
5363 }
5364
5365 /// Sets the value of [owner][crate::model::Bucket::owner].
5366 ///
5367 /// # Example
5368 /// ```ignore,no_run
5369 /// # use google_cloud_storage::model::Bucket;
5370 /// use google_cloud_storage::model::Owner;
5371 /// let x = Bucket::new().set_owner(Owner::default()/* use setters */);
5372 /// ```
5373 pub fn set_owner<T>(mut self, v: T) -> Self
5374 where
5375 T: std::convert::Into<crate::model::Owner>,
5376 {
5377 self.owner = std::option::Option::Some(v.into());
5378 self
5379 }
5380
5381 /// Sets or clears the value of [owner][crate::model::Bucket::owner].
5382 ///
5383 /// # Example
5384 /// ```ignore,no_run
5385 /// # use google_cloud_storage::model::Bucket;
5386 /// use google_cloud_storage::model::Owner;
5387 /// let x = Bucket::new().set_or_clear_owner(Some(Owner::default()/* use setters */));
5388 /// let x = Bucket::new().set_or_clear_owner(None::<Owner>);
5389 /// ```
5390 pub fn set_or_clear_owner<T>(mut self, v: std::option::Option<T>) -> Self
5391 where
5392 T: std::convert::Into<crate::model::Owner>,
5393 {
5394 self.owner = v.map(|x| x.into());
5395 self
5396 }
5397
5398 /// Sets the value of [encryption][crate::model::Bucket::encryption].
5399 ///
5400 /// # Example
5401 /// ```ignore,no_run
5402 /// # use google_cloud_storage::model::Bucket;
5403 /// use google_cloud_storage::model::bucket::Encryption;
5404 /// let x = Bucket::new().set_encryption(Encryption::default()/* use setters */);
5405 /// ```
5406 pub fn set_encryption<T>(mut self, v: T) -> Self
5407 where
5408 T: std::convert::Into<crate::model::bucket::Encryption>,
5409 {
5410 self.encryption = std::option::Option::Some(v.into());
5411 self
5412 }
5413
5414 /// Sets or clears the value of [encryption][crate::model::Bucket::encryption].
5415 ///
5416 /// # Example
5417 /// ```ignore,no_run
5418 /// # use google_cloud_storage::model::Bucket;
5419 /// use google_cloud_storage::model::bucket::Encryption;
5420 /// let x = Bucket::new().set_or_clear_encryption(Some(Encryption::default()/* use setters */));
5421 /// let x = Bucket::new().set_or_clear_encryption(None::<Encryption>);
5422 /// ```
5423 pub fn set_or_clear_encryption<T>(mut self, v: std::option::Option<T>) -> Self
5424 where
5425 T: std::convert::Into<crate::model::bucket::Encryption>,
5426 {
5427 self.encryption = v.map(|x| x.into());
5428 self
5429 }
5430
5431 /// Sets the value of [billing][crate::model::Bucket::billing].
5432 ///
5433 /// # Example
5434 /// ```ignore,no_run
5435 /// # use google_cloud_storage::model::Bucket;
5436 /// use google_cloud_storage::model::bucket::Billing;
5437 /// let x = Bucket::new().set_billing(Billing::default()/* use setters */);
5438 /// ```
5439 pub fn set_billing<T>(mut self, v: T) -> Self
5440 where
5441 T: std::convert::Into<crate::model::bucket::Billing>,
5442 {
5443 self.billing = std::option::Option::Some(v.into());
5444 self
5445 }
5446
5447 /// Sets or clears the value of [billing][crate::model::Bucket::billing].
5448 ///
5449 /// # Example
5450 /// ```ignore,no_run
5451 /// # use google_cloud_storage::model::Bucket;
5452 /// use google_cloud_storage::model::bucket::Billing;
5453 /// let x = Bucket::new().set_or_clear_billing(Some(Billing::default()/* use setters */));
5454 /// let x = Bucket::new().set_or_clear_billing(None::<Billing>);
5455 /// ```
5456 pub fn set_or_clear_billing<T>(mut self, v: std::option::Option<T>) -> Self
5457 where
5458 T: std::convert::Into<crate::model::bucket::Billing>,
5459 {
5460 self.billing = v.map(|x| x.into());
5461 self
5462 }
5463
5464 /// Sets the value of [retention_policy][crate::model::Bucket::retention_policy].
5465 ///
5466 /// # Example
5467 /// ```ignore,no_run
5468 /// # use google_cloud_storage::model::Bucket;
5469 /// use google_cloud_storage::model::bucket::RetentionPolicy;
5470 /// let x = Bucket::new().set_retention_policy(RetentionPolicy::default()/* use setters */);
5471 /// ```
5472 pub fn set_retention_policy<T>(mut self, v: T) -> Self
5473 where
5474 T: std::convert::Into<crate::model::bucket::RetentionPolicy>,
5475 {
5476 self.retention_policy = std::option::Option::Some(v.into());
5477 self
5478 }
5479
5480 /// Sets or clears the value of [retention_policy][crate::model::Bucket::retention_policy].
5481 ///
5482 /// # Example
5483 /// ```ignore,no_run
5484 /// # use google_cloud_storage::model::Bucket;
5485 /// use google_cloud_storage::model::bucket::RetentionPolicy;
5486 /// let x = Bucket::new().set_or_clear_retention_policy(Some(RetentionPolicy::default()/* use setters */));
5487 /// let x = Bucket::new().set_or_clear_retention_policy(None::<RetentionPolicy>);
5488 /// ```
5489 pub fn set_or_clear_retention_policy<T>(mut self, v: std::option::Option<T>) -> Self
5490 where
5491 T: std::convert::Into<crate::model::bucket::RetentionPolicy>,
5492 {
5493 self.retention_policy = v.map(|x| x.into());
5494 self
5495 }
5496
5497 /// Sets the value of [iam_config][crate::model::Bucket::iam_config].
5498 ///
5499 /// # Example
5500 /// ```ignore,no_run
5501 /// # use google_cloud_storage::model::Bucket;
5502 /// use google_cloud_storage::model::bucket::IamConfig;
5503 /// let x = Bucket::new().set_iam_config(IamConfig::default()/* use setters */);
5504 /// ```
5505 pub fn set_iam_config<T>(mut self, v: T) -> Self
5506 where
5507 T: std::convert::Into<crate::model::bucket::IamConfig>,
5508 {
5509 self.iam_config = std::option::Option::Some(v.into());
5510 self
5511 }
5512
5513 /// Sets or clears the value of [iam_config][crate::model::Bucket::iam_config].
5514 ///
5515 /// # Example
5516 /// ```ignore,no_run
5517 /// # use google_cloud_storage::model::Bucket;
5518 /// use google_cloud_storage::model::bucket::IamConfig;
5519 /// let x = Bucket::new().set_or_clear_iam_config(Some(IamConfig::default()/* use setters */));
5520 /// let x = Bucket::new().set_or_clear_iam_config(None::<IamConfig>);
5521 /// ```
5522 pub fn set_or_clear_iam_config<T>(mut self, v: std::option::Option<T>) -> Self
5523 where
5524 T: std::convert::Into<crate::model::bucket::IamConfig>,
5525 {
5526 self.iam_config = v.map(|x| x.into());
5527 self
5528 }
5529
5530 /// Sets the value of [satisfies_pzs][crate::model::Bucket::satisfies_pzs].
5531 ///
5532 /// # Example
5533 /// ```ignore,no_run
5534 /// # use google_cloud_storage::model::Bucket;
5535 /// let x = Bucket::new().set_satisfies_pzs(true);
5536 /// ```
5537 pub fn set_satisfies_pzs<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
5538 self.satisfies_pzs = v.into();
5539 self
5540 }
5541
5542 /// Sets the value of [custom_placement_config][crate::model::Bucket::custom_placement_config].
5543 ///
5544 /// # Example
5545 /// ```ignore,no_run
5546 /// # use google_cloud_storage::model::Bucket;
5547 /// use google_cloud_storage::model::bucket::CustomPlacementConfig;
5548 /// let x = Bucket::new().set_custom_placement_config(CustomPlacementConfig::default()/* use setters */);
5549 /// ```
5550 pub fn set_custom_placement_config<T>(mut self, v: T) -> Self
5551 where
5552 T: std::convert::Into<crate::model::bucket::CustomPlacementConfig>,
5553 {
5554 self.custom_placement_config = std::option::Option::Some(v.into());
5555 self
5556 }
5557
5558 /// Sets or clears the value of [custom_placement_config][crate::model::Bucket::custom_placement_config].
5559 ///
5560 /// # Example
5561 /// ```ignore,no_run
5562 /// # use google_cloud_storage::model::Bucket;
5563 /// use google_cloud_storage::model::bucket::CustomPlacementConfig;
5564 /// let x = Bucket::new().set_or_clear_custom_placement_config(Some(CustomPlacementConfig::default()/* use setters */));
5565 /// let x = Bucket::new().set_or_clear_custom_placement_config(None::<CustomPlacementConfig>);
5566 /// ```
5567 pub fn set_or_clear_custom_placement_config<T>(mut self, v: std::option::Option<T>) -> Self
5568 where
5569 T: std::convert::Into<crate::model::bucket::CustomPlacementConfig>,
5570 {
5571 self.custom_placement_config = v.map(|x| x.into());
5572 self
5573 }
5574
5575 /// Sets the value of [autoclass][crate::model::Bucket::autoclass].
5576 ///
5577 /// # Example
5578 /// ```ignore,no_run
5579 /// # use google_cloud_storage::model::Bucket;
5580 /// use google_cloud_storage::model::bucket::Autoclass;
5581 /// let x = Bucket::new().set_autoclass(Autoclass::default()/* use setters */);
5582 /// ```
5583 pub fn set_autoclass<T>(mut self, v: T) -> Self
5584 where
5585 T: std::convert::Into<crate::model::bucket::Autoclass>,
5586 {
5587 self.autoclass = std::option::Option::Some(v.into());
5588 self
5589 }
5590
5591 /// Sets or clears the value of [autoclass][crate::model::Bucket::autoclass].
5592 ///
5593 /// # Example
5594 /// ```ignore,no_run
5595 /// # use google_cloud_storage::model::Bucket;
5596 /// use google_cloud_storage::model::bucket::Autoclass;
5597 /// let x = Bucket::new().set_or_clear_autoclass(Some(Autoclass::default()/* use setters */));
5598 /// let x = Bucket::new().set_or_clear_autoclass(None::<Autoclass>);
5599 /// ```
5600 pub fn set_or_clear_autoclass<T>(mut self, v: std::option::Option<T>) -> Self
5601 where
5602 T: std::convert::Into<crate::model::bucket::Autoclass>,
5603 {
5604 self.autoclass = v.map(|x| x.into());
5605 self
5606 }
5607
5608 /// Sets the value of [hierarchical_namespace][crate::model::Bucket::hierarchical_namespace].
5609 ///
5610 /// # Example
5611 /// ```ignore,no_run
5612 /// # use google_cloud_storage::model::Bucket;
5613 /// use google_cloud_storage::model::bucket::HierarchicalNamespace;
5614 /// let x = Bucket::new().set_hierarchical_namespace(HierarchicalNamespace::default()/* use setters */);
5615 /// ```
5616 pub fn set_hierarchical_namespace<T>(mut self, v: T) -> Self
5617 where
5618 T: std::convert::Into<crate::model::bucket::HierarchicalNamespace>,
5619 {
5620 self.hierarchical_namespace = std::option::Option::Some(v.into());
5621 self
5622 }
5623
5624 /// Sets or clears the value of [hierarchical_namespace][crate::model::Bucket::hierarchical_namespace].
5625 ///
5626 /// # Example
5627 /// ```ignore,no_run
5628 /// # use google_cloud_storage::model::Bucket;
5629 /// use google_cloud_storage::model::bucket::HierarchicalNamespace;
5630 /// let x = Bucket::new().set_or_clear_hierarchical_namespace(Some(HierarchicalNamespace::default()/* use setters */));
5631 /// let x = Bucket::new().set_or_clear_hierarchical_namespace(None::<HierarchicalNamespace>);
5632 /// ```
5633 pub fn set_or_clear_hierarchical_namespace<T>(mut self, v: std::option::Option<T>) -> Self
5634 where
5635 T: std::convert::Into<crate::model::bucket::HierarchicalNamespace>,
5636 {
5637 self.hierarchical_namespace = v.map(|x| x.into());
5638 self
5639 }
5640
5641 /// Sets the value of [soft_delete_policy][crate::model::Bucket::soft_delete_policy].
5642 ///
5643 /// # Example
5644 /// ```ignore,no_run
5645 /// # use google_cloud_storage::model::Bucket;
5646 /// use google_cloud_storage::model::bucket::SoftDeletePolicy;
5647 /// let x = Bucket::new().set_soft_delete_policy(SoftDeletePolicy::default()/* use setters */);
5648 /// ```
5649 pub fn set_soft_delete_policy<T>(mut self, v: T) -> Self
5650 where
5651 T: std::convert::Into<crate::model::bucket::SoftDeletePolicy>,
5652 {
5653 self.soft_delete_policy = std::option::Option::Some(v.into());
5654 self
5655 }
5656
5657 /// Sets or clears the value of [soft_delete_policy][crate::model::Bucket::soft_delete_policy].
5658 ///
5659 /// # Example
5660 /// ```ignore,no_run
5661 /// # use google_cloud_storage::model::Bucket;
5662 /// use google_cloud_storage::model::bucket::SoftDeletePolicy;
5663 /// let x = Bucket::new().set_or_clear_soft_delete_policy(Some(SoftDeletePolicy::default()/* use setters */));
5664 /// let x = Bucket::new().set_or_clear_soft_delete_policy(None::<SoftDeletePolicy>);
5665 /// ```
5666 pub fn set_or_clear_soft_delete_policy<T>(mut self, v: std::option::Option<T>) -> Self
5667 where
5668 T: std::convert::Into<crate::model::bucket::SoftDeletePolicy>,
5669 {
5670 self.soft_delete_policy = v.map(|x| x.into());
5671 self
5672 }
5673
5674 /// Sets the value of [object_retention][crate::model::Bucket::object_retention].
5675 ///
5676 /// # Example
5677 /// ```ignore,no_run
5678 /// # use google_cloud_storage::model::Bucket;
5679 /// use google_cloud_storage::model::bucket::ObjectRetention;
5680 /// let x = Bucket::new().set_object_retention(ObjectRetention::default()/* use setters */);
5681 /// ```
5682 pub fn set_object_retention<T>(mut self, v: T) -> Self
5683 where
5684 T: std::convert::Into<crate::model::bucket::ObjectRetention>,
5685 {
5686 self.object_retention = std::option::Option::Some(v.into());
5687 self
5688 }
5689
5690 /// Sets or clears the value of [object_retention][crate::model::Bucket::object_retention].
5691 ///
5692 /// # Example
5693 /// ```ignore,no_run
5694 /// # use google_cloud_storage::model::Bucket;
5695 /// use google_cloud_storage::model::bucket::ObjectRetention;
5696 /// let x = Bucket::new().set_or_clear_object_retention(Some(ObjectRetention::default()/* use setters */));
5697 /// let x = Bucket::new().set_or_clear_object_retention(None::<ObjectRetention>);
5698 /// ```
5699 pub fn set_or_clear_object_retention<T>(mut self, v: std::option::Option<T>) -> Self
5700 where
5701 T: std::convert::Into<crate::model::bucket::ObjectRetention>,
5702 {
5703 self.object_retention = v.map(|x| x.into());
5704 self
5705 }
5706
5707 /// Sets the value of [ip_filter][crate::model::Bucket::ip_filter].
5708 ///
5709 /// # Example
5710 /// ```ignore,no_run
5711 /// # use google_cloud_storage::model::Bucket;
5712 /// use google_cloud_storage::model::bucket::IpFilter;
5713 /// let x = Bucket::new().set_ip_filter(IpFilter::default()/* use setters */);
5714 /// ```
5715 pub fn set_ip_filter<T>(mut self, v: T) -> Self
5716 where
5717 T: std::convert::Into<crate::model::bucket::IpFilter>,
5718 {
5719 self.ip_filter = std::option::Option::Some(v.into());
5720 self
5721 }
5722
5723 /// Sets or clears the value of [ip_filter][crate::model::Bucket::ip_filter].
5724 ///
5725 /// # Example
5726 /// ```ignore,no_run
5727 /// # use google_cloud_storage::model::Bucket;
5728 /// use google_cloud_storage::model::bucket::IpFilter;
5729 /// let x = Bucket::new().set_or_clear_ip_filter(Some(IpFilter::default()/* use setters */));
5730 /// let x = Bucket::new().set_or_clear_ip_filter(None::<IpFilter>);
5731 /// ```
5732 pub fn set_or_clear_ip_filter<T>(mut self, v: std::option::Option<T>) -> Self
5733 where
5734 T: std::convert::Into<crate::model::bucket::IpFilter>,
5735 {
5736 self.ip_filter = v.map(|x| x.into());
5737 self
5738 }
5739}
5740
5741impl wkt::message::Message for Bucket {
5742 fn typename() -> &'static str {
5743 "type.googleapis.com/google.storage.v2.Bucket"
5744 }
5745}
5746
5747/// Defines additional types related to [Bucket].
5748pub mod bucket {
5749 #[allow(unused_imports)]
5750 use super::*;
5751
5752 /// Billing properties of a bucket.
5753 #[derive(Clone, Default, PartialEq)]
5754 #[non_exhaustive]
5755 pub struct Billing {
5756 /// Optional. When set to true, Requester Pays is enabled for this bucket.
5757 pub requester_pays: bool,
5758
5759 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5760 }
5761
5762 impl Billing {
5763 /// Creates a new default instance.
5764 pub fn new() -> Self {
5765 std::default::Default::default()
5766 }
5767
5768 /// Sets the value of [requester_pays][crate::model::bucket::Billing::requester_pays].
5769 ///
5770 /// # Example
5771 /// ```ignore,no_run
5772 /// # use google_cloud_storage::model::bucket::Billing;
5773 /// let x = Billing::new().set_requester_pays(true);
5774 /// ```
5775 pub fn set_requester_pays<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
5776 self.requester_pays = v.into();
5777 self
5778 }
5779 }
5780
5781 impl wkt::message::Message for Billing {
5782 fn typename() -> &'static str {
5783 "type.googleapis.com/google.storage.v2.Bucket.Billing"
5784 }
5785 }
5786
5787 /// Cross-Origin Response sharing (CORS) properties for a bucket.
5788 /// For more on Cloud Storage and CORS, see
5789 /// <https://cloud.google.com/storage/docs/cross-origin>.
5790 /// For more on CORS in general, see <https://tools.ietf.org/html/rfc6454>.
5791 #[derive(Clone, Default, PartialEq)]
5792 #[non_exhaustive]
5793 pub struct Cors {
5794 /// Optional. The list of origins eligible to receive CORS response headers.
5795 /// For more information about origins, see [RFC
5796 /// 6454](https://tools.ietf.org/html/rfc6454). Note: `*` is permitted in the
5797 /// list of origins, and means `any origin`.
5798 pub origin: std::vec::Vec<std::string::String>,
5799
5800 /// Optional. The list of HTTP methods on which to include CORS response
5801 /// headers,
5802 /// (`GET`, `OPTIONS`, `POST`, etc) Note: `*` is permitted in the list of
5803 /// methods, and means "any method".
5804 pub method: std::vec::Vec<std::string::String>,
5805
5806 /// Optional. The list of HTTP headers other than the [simple response
5807 /// headers](https://www.w3.org/TR/cors/#simple-response-headers) to give
5808 /// permission for the user-agent to share across domains.
5809 pub response_header: std::vec::Vec<std::string::String>,
5810
5811 /// Optional. The value, in seconds, to return in the [Access-Control-Max-Age
5812 /// header](https://www.w3.org/TR/cors/#access-control-max-age-response-header)
5813 /// used in preflight responses.
5814 pub max_age_seconds: i32,
5815
5816 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5817 }
5818
5819 impl Cors {
5820 /// Creates a new default instance.
5821 pub fn new() -> Self {
5822 std::default::Default::default()
5823 }
5824
5825 /// Sets the value of [origin][crate::model::bucket::Cors::origin].
5826 ///
5827 /// # Example
5828 /// ```ignore,no_run
5829 /// # use google_cloud_storage::model::bucket::Cors;
5830 /// let x = Cors::new().set_origin(["a", "b", "c"]);
5831 /// ```
5832 pub fn set_origin<T, V>(mut self, v: T) -> Self
5833 where
5834 T: std::iter::IntoIterator<Item = V>,
5835 V: std::convert::Into<std::string::String>,
5836 {
5837 use std::iter::Iterator;
5838 self.origin = v.into_iter().map(|i| i.into()).collect();
5839 self
5840 }
5841
5842 /// Sets the value of [method][crate::model::bucket::Cors::method].
5843 ///
5844 /// # Example
5845 /// ```ignore,no_run
5846 /// # use google_cloud_storage::model::bucket::Cors;
5847 /// let x = Cors::new().set_method(["a", "b", "c"]);
5848 /// ```
5849 pub fn set_method<T, V>(mut self, v: T) -> Self
5850 where
5851 T: std::iter::IntoIterator<Item = V>,
5852 V: std::convert::Into<std::string::String>,
5853 {
5854 use std::iter::Iterator;
5855 self.method = v.into_iter().map(|i| i.into()).collect();
5856 self
5857 }
5858
5859 /// Sets the value of [response_header][crate::model::bucket::Cors::response_header].
5860 ///
5861 /// # Example
5862 /// ```ignore,no_run
5863 /// # use google_cloud_storage::model::bucket::Cors;
5864 /// let x = Cors::new().set_response_header(["a", "b", "c"]);
5865 /// ```
5866 pub fn set_response_header<T, V>(mut self, v: T) -> Self
5867 where
5868 T: std::iter::IntoIterator<Item = V>,
5869 V: std::convert::Into<std::string::String>,
5870 {
5871 use std::iter::Iterator;
5872 self.response_header = v.into_iter().map(|i| i.into()).collect();
5873 self
5874 }
5875
5876 /// Sets the value of [max_age_seconds][crate::model::bucket::Cors::max_age_seconds].
5877 ///
5878 /// # Example
5879 /// ```ignore,no_run
5880 /// # use google_cloud_storage::model::bucket::Cors;
5881 /// let x = Cors::new().set_max_age_seconds(42);
5882 /// ```
5883 pub fn set_max_age_seconds<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
5884 self.max_age_seconds = v.into();
5885 self
5886 }
5887 }
5888
5889 impl wkt::message::Message for Cors {
5890 fn typename() -> &'static str {
5891 "type.googleapis.com/google.storage.v2.Bucket.Cors"
5892 }
5893 }
5894
5895 /// Encryption properties of a bucket.
5896 #[derive(Clone, Default, PartialEq)]
5897 #[non_exhaustive]
5898 pub struct Encryption {
5899 /// Optional. The name of the Cloud KMS key that is used to encrypt objects
5900 /// inserted into this bucket, if no encryption method is specified.
5901 pub default_kms_key: std::string::String,
5902
5903 /// Optional. If omitted, then new objects with GMEK encryption-type is
5904 /// allowed. If set, then new objects created in this bucket must comply with
5905 /// enforcement config. Changing this has no effect on existing objects; it
5906 /// applies to new objects only.
5907 pub google_managed_encryption_enforcement_config: std::option::Option<
5908 crate::model::bucket::encryption::GoogleManagedEncryptionEnforcementConfig,
5909 >,
5910
5911 /// Optional. If omitted, then new objects with CMEK encryption-type is
5912 /// allowed. If set, then new objects created in this bucket must comply with
5913 /// enforcement config. Changing this has no effect on existing objects; it
5914 /// applies to new objects only.
5915 pub customer_managed_encryption_enforcement_config: std::option::Option<
5916 crate::model::bucket::encryption::CustomerManagedEncryptionEnforcementConfig,
5917 >,
5918
5919 /// Optional. If omitted, then new objects with CSEK encryption-type is
5920 /// allowed. If set, then new objects created in this bucket must comply with
5921 /// enforcement config. Changing this has no effect on existing objects; it
5922 /// applies to new objects only.
5923 pub customer_supplied_encryption_enforcement_config: std::option::Option<
5924 crate::model::bucket::encryption::CustomerSuppliedEncryptionEnforcementConfig,
5925 >,
5926
5927 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5928 }
5929
5930 impl Encryption {
5931 /// Creates a new default instance.
5932 pub fn new() -> Self {
5933 std::default::Default::default()
5934 }
5935
5936 /// Sets the value of [default_kms_key][crate::model::bucket::Encryption::default_kms_key].
5937 ///
5938 /// # Example
5939 /// ```ignore,no_run
5940 /// # use google_cloud_storage::model::bucket::Encryption;
5941 /// let x = Encryption::new().set_default_kms_key("example");
5942 /// ```
5943 pub fn set_default_kms_key<T: std::convert::Into<std::string::String>>(
5944 mut self,
5945 v: T,
5946 ) -> Self {
5947 self.default_kms_key = v.into();
5948 self
5949 }
5950
5951 /// Sets the value of [google_managed_encryption_enforcement_config][crate::model::bucket::Encryption::google_managed_encryption_enforcement_config].
5952 ///
5953 /// # Example
5954 /// ```ignore,no_run
5955 /// # use google_cloud_storage::model::bucket::Encryption;
5956 /// use google_cloud_storage::model::bucket::encryption::GoogleManagedEncryptionEnforcementConfig;
5957 /// let x = Encryption::new().set_google_managed_encryption_enforcement_config(GoogleManagedEncryptionEnforcementConfig::default()/* use setters */);
5958 /// ```
5959 pub fn set_google_managed_encryption_enforcement_config<T>(mut self, v: T) -> Self
5960 where
5961 T: std::convert::Into<
5962 crate::model::bucket::encryption::GoogleManagedEncryptionEnforcementConfig,
5963 >,
5964 {
5965 self.google_managed_encryption_enforcement_config = std::option::Option::Some(v.into());
5966 self
5967 }
5968
5969 /// Sets or clears the value of [google_managed_encryption_enforcement_config][crate::model::bucket::Encryption::google_managed_encryption_enforcement_config].
5970 ///
5971 /// # Example
5972 /// ```ignore,no_run
5973 /// # use google_cloud_storage::model::bucket::Encryption;
5974 /// use google_cloud_storage::model::bucket::encryption::GoogleManagedEncryptionEnforcementConfig;
5975 /// let x = Encryption::new().set_or_clear_google_managed_encryption_enforcement_config(Some(GoogleManagedEncryptionEnforcementConfig::default()/* use setters */));
5976 /// let x = Encryption::new().set_or_clear_google_managed_encryption_enforcement_config(None::<GoogleManagedEncryptionEnforcementConfig>);
5977 /// ```
5978 pub fn set_or_clear_google_managed_encryption_enforcement_config<T>(
5979 mut self,
5980 v: std::option::Option<T>,
5981 ) -> Self
5982 where
5983 T: std::convert::Into<
5984 crate::model::bucket::encryption::GoogleManagedEncryptionEnforcementConfig,
5985 >,
5986 {
5987 self.google_managed_encryption_enforcement_config = v.map(|x| x.into());
5988 self
5989 }
5990
5991 /// Sets the value of [customer_managed_encryption_enforcement_config][crate::model::bucket::Encryption::customer_managed_encryption_enforcement_config].
5992 ///
5993 /// # Example
5994 /// ```ignore,no_run
5995 /// # use google_cloud_storage::model::bucket::Encryption;
5996 /// use google_cloud_storage::model::bucket::encryption::CustomerManagedEncryptionEnforcementConfig;
5997 /// let x = Encryption::new().set_customer_managed_encryption_enforcement_config(CustomerManagedEncryptionEnforcementConfig::default()/* use setters */);
5998 /// ```
5999 pub fn set_customer_managed_encryption_enforcement_config<T>(mut self, v: T) -> Self
6000 where
6001 T: std::convert::Into<
6002 crate::model::bucket::encryption::CustomerManagedEncryptionEnforcementConfig,
6003 >,
6004 {
6005 self.customer_managed_encryption_enforcement_config =
6006 std::option::Option::Some(v.into());
6007 self
6008 }
6009
6010 /// Sets or clears the value of [customer_managed_encryption_enforcement_config][crate::model::bucket::Encryption::customer_managed_encryption_enforcement_config].
6011 ///
6012 /// # Example
6013 /// ```ignore,no_run
6014 /// # use google_cloud_storage::model::bucket::Encryption;
6015 /// use google_cloud_storage::model::bucket::encryption::CustomerManagedEncryptionEnforcementConfig;
6016 /// let x = Encryption::new().set_or_clear_customer_managed_encryption_enforcement_config(Some(CustomerManagedEncryptionEnforcementConfig::default()/* use setters */));
6017 /// let x = Encryption::new().set_or_clear_customer_managed_encryption_enforcement_config(None::<CustomerManagedEncryptionEnforcementConfig>);
6018 /// ```
6019 pub fn set_or_clear_customer_managed_encryption_enforcement_config<T>(
6020 mut self,
6021 v: std::option::Option<T>,
6022 ) -> Self
6023 where
6024 T: std::convert::Into<
6025 crate::model::bucket::encryption::CustomerManagedEncryptionEnforcementConfig,
6026 >,
6027 {
6028 self.customer_managed_encryption_enforcement_config = v.map(|x| x.into());
6029 self
6030 }
6031
6032 /// Sets the value of [customer_supplied_encryption_enforcement_config][crate::model::bucket::Encryption::customer_supplied_encryption_enforcement_config].
6033 ///
6034 /// # Example
6035 /// ```ignore,no_run
6036 /// # use google_cloud_storage::model::bucket::Encryption;
6037 /// use google_cloud_storage::model::bucket::encryption::CustomerSuppliedEncryptionEnforcementConfig;
6038 /// let x = Encryption::new().set_customer_supplied_encryption_enforcement_config(CustomerSuppliedEncryptionEnforcementConfig::default()/* use setters */);
6039 /// ```
6040 pub fn set_customer_supplied_encryption_enforcement_config<T>(mut self, v: T) -> Self
6041 where
6042 T: std::convert::Into<
6043 crate::model::bucket::encryption::CustomerSuppliedEncryptionEnforcementConfig,
6044 >,
6045 {
6046 self.customer_supplied_encryption_enforcement_config =
6047 std::option::Option::Some(v.into());
6048 self
6049 }
6050
6051 /// Sets or clears the value of [customer_supplied_encryption_enforcement_config][crate::model::bucket::Encryption::customer_supplied_encryption_enforcement_config].
6052 ///
6053 /// # Example
6054 /// ```ignore,no_run
6055 /// # use google_cloud_storage::model::bucket::Encryption;
6056 /// use google_cloud_storage::model::bucket::encryption::CustomerSuppliedEncryptionEnforcementConfig;
6057 /// let x = Encryption::new().set_or_clear_customer_supplied_encryption_enforcement_config(Some(CustomerSuppliedEncryptionEnforcementConfig::default()/* use setters */));
6058 /// let x = Encryption::new().set_or_clear_customer_supplied_encryption_enforcement_config(None::<CustomerSuppliedEncryptionEnforcementConfig>);
6059 /// ```
6060 pub fn set_or_clear_customer_supplied_encryption_enforcement_config<T>(
6061 mut self,
6062 v: std::option::Option<T>,
6063 ) -> Self
6064 where
6065 T: std::convert::Into<
6066 crate::model::bucket::encryption::CustomerSuppliedEncryptionEnforcementConfig,
6067 >,
6068 {
6069 self.customer_supplied_encryption_enforcement_config = v.map(|x| x.into());
6070 self
6071 }
6072 }
6073
6074 impl wkt::message::Message for Encryption {
6075 fn typename() -> &'static str {
6076 "type.googleapis.com/google.storage.v2.Bucket.Encryption"
6077 }
6078 }
6079
6080 /// Defines additional types related to [Encryption].
6081 pub mod encryption {
6082 #[allow(unused_imports)]
6083 use super::*;
6084
6085 /// Google Managed Encryption (GMEK) enforcement config of a bucket.
6086 #[derive(Clone, Default, PartialEq)]
6087 #[non_exhaustive]
6088 pub struct GoogleManagedEncryptionEnforcementConfig {
6089 /// Restriction mode for google-managed encryption for new objects within
6090 /// the bucket. Valid values are: `NotRestricted` and `FullyRestricted`.
6091 /// If `NotRestricted` or unset, creation of new objects with
6092 /// google-managed encryption is allowed.
6093 /// If `FullyRestricted`, new objects can't be created using google-managed
6094 /// encryption.
6095 pub restriction_mode: std::option::Option<std::string::String>,
6096
6097 /// Time from which the config was effective. This is service-provided.
6098 pub effective_time: std::option::Option<wkt::Timestamp>,
6099
6100 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
6101 }
6102
6103 impl GoogleManagedEncryptionEnforcementConfig {
6104 /// Creates a new default instance.
6105 pub fn new() -> Self {
6106 std::default::Default::default()
6107 }
6108
6109 /// Sets the value of [restriction_mode][crate::model::bucket::encryption::GoogleManagedEncryptionEnforcementConfig::restriction_mode].
6110 ///
6111 /// # Example
6112 /// ```ignore,no_run
6113 /// # use google_cloud_storage::model::bucket::encryption::GoogleManagedEncryptionEnforcementConfig;
6114 /// let x = GoogleManagedEncryptionEnforcementConfig::new().set_restriction_mode("example");
6115 /// ```
6116 pub fn set_restriction_mode<T>(mut self, v: T) -> Self
6117 where
6118 T: std::convert::Into<std::string::String>,
6119 {
6120 self.restriction_mode = std::option::Option::Some(v.into());
6121 self
6122 }
6123
6124 /// Sets or clears the value of [restriction_mode][crate::model::bucket::encryption::GoogleManagedEncryptionEnforcementConfig::restriction_mode].
6125 ///
6126 /// # Example
6127 /// ```ignore,no_run
6128 /// # use google_cloud_storage::model::bucket::encryption::GoogleManagedEncryptionEnforcementConfig;
6129 /// let x = GoogleManagedEncryptionEnforcementConfig::new().set_or_clear_restriction_mode(Some("example"));
6130 /// let x = GoogleManagedEncryptionEnforcementConfig::new().set_or_clear_restriction_mode(None::<String>);
6131 /// ```
6132 pub fn set_or_clear_restriction_mode<T>(mut self, v: std::option::Option<T>) -> Self
6133 where
6134 T: std::convert::Into<std::string::String>,
6135 {
6136 self.restriction_mode = v.map(|x| x.into());
6137 self
6138 }
6139
6140 /// Sets the value of [effective_time][crate::model::bucket::encryption::GoogleManagedEncryptionEnforcementConfig::effective_time].
6141 ///
6142 /// # Example
6143 /// ```ignore,no_run
6144 /// # use google_cloud_storage::model::bucket::encryption::GoogleManagedEncryptionEnforcementConfig;
6145 /// use wkt::Timestamp;
6146 /// let x = GoogleManagedEncryptionEnforcementConfig::new().set_effective_time(Timestamp::default()/* use setters */);
6147 /// ```
6148 pub fn set_effective_time<T>(mut self, v: T) -> Self
6149 where
6150 T: std::convert::Into<wkt::Timestamp>,
6151 {
6152 self.effective_time = std::option::Option::Some(v.into());
6153 self
6154 }
6155
6156 /// Sets or clears the value of [effective_time][crate::model::bucket::encryption::GoogleManagedEncryptionEnforcementConfig::effective_time].
6157 ///
6158 /// # Example
6159 /// ```ignore,no_run
6160 /// # use google_cloud_storage::model::bucket::encryption::GoogleManagedEncryptionEnforcementConfig;
6161 /// use wkt::Timestamp;
6162 /// let x = GoogleManagedEncryptionEnforcementConfig::new().set_or_clear_effective_time(Some(Timestamp::default()/* use setters */));
6163 /// let x = GoogleManagedEncryptionEnforcementConfig::new().set_or_clear_effective_time(None::<Timestamp>);
6164 /// ```
6165 pub fn set_or_clear_effective_time<T>(mut self, v: std::option::Option<T>) -> Self
6166 where
6167 T: std::convert::Into<wkt::Timestamp>,
6168 {
6169 self.effective_time = v.map(|x| x.into());
6170 self
6171 }
6172 }
6173
6174 impl wkt::message::Message for GoogleManagedEncryptionEnforcementConfig {
6175 fn typename() -> &'static str {
6176 "type.googleapis.com/google.storage.v2.Bucket.Encryption.GoogleManagedEncryptionEnforcementConfig"
6177 }
6178 }
6179
6180 /// Customer Managed Encryption (CMEK) enforcement config of a bucket.
6181 #[derive(Clone, Default, PartialEq)]
6182 #[non_exhaustive]
6183 pub struct CustomerManagedEncryptionEnforcementConfig {
6184 /// Restriction mode for customer-managed encryption for new objects within
6185 /// the bucket. Valid values are: `NotRestricted` and `FullyRestricted`.
6186 /// If `NotRestricted` or unset, creation of new objects with
6187 /// customer-managed encryption is allowed.
6188 /// If `FullyRestricted`, new objects can't be created using
6189 /// customer-managed encryption.
6190 pub restriction_mode: std::option::Option<std::string::String>,
6191
6192 /// Time from which the config was effective. This is service-provided.
6193 pub effective_time: std::option::Option<wkt::Timestamp>,
6194
6195 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
6196 }
6197
6198 impl CustomerManagedEncryptionEnforcementConfig {
6199 /// Creates a new default instance.
6200 pub fn new() -> Self {
6201 std::default::Default::default()
6202 }
6203
6204 /// Sets the value of [restriction_mode][crate::model::bucket::encryption::CustomerManagedEncryptionEnforcementConfig::restriction_mode].
6205 ///
6206 /// # Example
6207 /// ```ignore,no_run
6208 /// # use google_cloud_storage::model::bucket::encryption::CustomerManagedEncryptionEnforcementConfig;
6209 /// let x = CustomerManagedEncryptionEnforcementConfig::new().set_restriction_mode("example");
6210 /// ```
6211 pub fn set_restriction_mode<T>(mut self, v: T) -> Self
6212 where
6213 T: std::convert::Into<std::string::String>,
6214 {
6215 self.restriction_mode = std::option::Option::Some(v.into());
6216 self
6217 }
6218
6219 /// Sets or clears the value of [restriction_mode][crate::model::bucket::encryption::CustomerManagedEncryptionEnforcementConfig::restriction_mode].
6220 ///
6221 /// # Example
6222 /// ```ignore,no_run
6223 /// # use google_cloud_storage::model::bucket::encryption::CustomerManagedEncryptionEnforcementConfig;
6224 /// let x = CustomerManagedEncryptionEnforcementConfig::new().set_or_clear_restriction_mode(Some("example"));
6225 /// let x = CustomerManagedEncryptionEnforcementConfig::new().set_or_clear_restriction_mode(None::<String>);
6226 /// ```
6227 pub fn set_or_clear_restriction_mode<T>(mut self, v: std::option::Option<T>) -> Self
6228 where
6229 T: std::convert::Into<std::string::String>,
6230 {
6231 self.restriction_mode = v.map(|x| x.into());
6232 self
6233 }
6234
6235 /// Sets the value of [effective_time][crate::model::bucket::encryption::CustomerManagedEncryptionEnforcementConfig::effective_time].
6236 ///
6237 /// # Example
6238 /// ```ignore,no_run
6239 /// # use google_cloud_storage::model::bucket::encryption::CustomerManagedEncryptionEnforcementConfig;
6240 /// use wkt::Timestamp;
6241 /// let x = CustomerManagedEncryptionEnforcementConfig::new().set_effective_time(Timestamp::default()/* use setters */);
6242 /// ```
6243 pub fn set_effective_time<T>(mut self, v: T) -> Self
6244 where
6245 T: std::convert::Into<wkt::Timestamp>,
6246 {
6247 self.effective_time = std::option::Option::Some(v.into());
6248 self
6249 }
6250
6251 /// Sets or clears the value of [effective_time][crate::model::bucket::encryption::CustomerManagedEncryptionEnforcementConfig::effective_time].
6252 ///
6253 /// # Example
6254 /// ```ignore,no_run
6255 /// # use google_cloud_storage::model::bucket::encryption::CustomerManagedEncryptionEnforcementConfig;
6256 /// use wkt::Timestamp;
6257 /// let x = CustomerManagedEncryptionEnforcementConfig::new().set_or_clear_effective_time(Some(Timestamp::default()/* use setters */));
6258 /// let x = CustomerManagedEncryptionEnforcementConfig::new().set_or_clear_effective_time(None::<Timestamp>);
6259 /// ```
6260 pub fn set_or_clear_effective_time<T>(mut self, v: std::option::Option<T>) -> Self
6261 where
6262 T: std::convert::Into<wkt::Timestamp>,
6263 {
6264 self.effective_time = v.map(|x| x.into());
6265 self
6266 }
6267 }
6268
6269 impl wkt::message::Message for CustomerManagedEncryptionEnforcementConfig {
6270 fn typename() -> &'static str {
6271 "type.googleapis.com/google.storage.v2.Bucket.Encryption.CustomerManagedEncryptionEnforcementConfig"
6272 }
6273 }
6274
6275 /// Customer Supplied Encryption (CSEK) enforcement config of a bucket.
6276 #[derive(Clone, Default, PartialEq)]
6277 #[non_exhaustive]
6278 pub struct CustomerSuppliedEncryptionEnforcementConfig {
6279 /// Restriction mode for customer-supplied encryption for new objects
6280 /// within the bucket. Valid values are: `NotRestricted` and
6281 /// `FullyRestricted`.
6282 /// If `NotRestricted` or unset, creation of new objects with
6283 /// customer-supplied encryption is allowed.
6284 /// If `FullyRestricted`, new objects can't be created using
6285 /// customer-supplied encryption.
6286 pub restriction_mode: std::option::Option<std::string::String>,
6287
6288 /// Time from which the config was effective. This is service-provided.
6289 pub effective_time: std::option::Option<wkt::Timestamp>,
6290
6291 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
6292 }
6293
6294 impl CustomerSuppliedEncryptionEnforcementConfig {
6295 /// Creates a new default instance.
6296 pub fn new() -> Self {
6297 std::default::Default::default()
6298 }
6299
6300 /// Sets the value of [restriction_mode][crate::model::bucket::encryption::CustomerSuppliedEncryptionEnforcementConfig::restriction_mode].
6301 ///
6302 /// # Example
6303 /// ```ignore,no_run
6304 /// # use google_cloud_storage::model::bucket::encryption::CustomerSuppliedEncryptionEnforcementConfig;
6305 /// let x = CustomerSuppliedEncryptionEnforcementConfig::new().set_restriction_mode("example");
6306 /// ```
6307 pub fn set_restriction_mode<T>(mut self, v: T) -> Self
6308 where
6309 T: std::convert::Into<std::string::String>,
6310 {
6311 self.restriction_mode = std::option::Option::Some(v.into());
6312 self
6313 }
6314
6315 /// Sets or clears the value of [restriction_mode][crate::model::bucket::encryption::CustomerSuppliedEncryptionEnforcementConfig::restriction_mode].
6316 ///
6317 /// # Example
6318 /// ```ignore,no_run
6319 /// # use google_cloud_storage::model::bucket::encryption::CustomerSuppliedEncryptionEnforcementConfig;
6320 /// let x = CustomerSuppliedEncryptionEnforcementConfig::new().set_or_clear_restriction_mode(Some("example"));
6321 /// let x = CustomerSuppliedEncryptionEnforcementConfig::new().set_or_clear_restriction_mode(None::<String>);
6322 /// ```
6323 pub fn set_or_clear_restriction_mode<T>(mut self, v: std::option::Option<T>) -> Self
6324 where
6325 T: std::convert::Into<std::string::String>,
6326 {
6327 self.restriction_mode = v.map(|x| x.into());
6328 self
6329 }
6330
6331 /// Sets the value of [effective_time][crate::model::bucket::encryption::CustomerSuppliedEncryptionEnforcementConfig::effective_time].
6332 ///
6333 /// # Example
6334 /// ```ignore,no_run
6335 /// # use google_cloud_storage::model::bucket::encryption::CustomerSuppliedEncryptionEnforcementConfig;
6336 /// use wkt::Timestamp;
6337 /// let x = CustomerSuppliedEncryptionEnforcementConfig::new().set_effective_time(Timestamp::default()/* use setters */);
6338 /// ```
6339 pub fn set_effective_time<T>(mut self, v: T) -> Self
6340 where
6341 T: std::convert::Into<wkt::Timestamp>,
6342 {
6343 self.effective_time = std::option::Option::Some(v.into());
6344 self
6345 }
6346
6347 /// Sets or clears the value of [effective_time][crate::model::bucket::encryption::CustomerSuppliedEncryptionEnforcementConfig::effective_time].
6348 ///
6349 /// # Example
6350 /// ```ignore,no_run
6351 /// # use google_cloud_storage::model::bucket::encryption::CustomerSuppliedEncryptionEnforcementConfig;
6352 /// use wkt::Timestamp;
6353 /// let x = CustomerSuppliedEncryptionEnforcementConfig::new().set_or_clear_effective_time(Some(Timestamp::default()/* use setters */));
6354 /// let x = CustomerSuppliedEncryptionEnforcementConfig::new().set_or_clear_effective_time(None::<Timestamp>);
6355 /// ```
6356 pub fn set_or_clear_effective_time<T>(mut self, v: std::option::Option<T>) -> Self
6357 where
6358 T: std::convert::Into<wkt::Timestamp>,
6359 {
6360 self.effective_time = v.map(|x| x.into());
6361 self
6362 }
6363 }
6364
6365 impl wkt::message::Message for CustomerSuppliedEncryptionEnforcementConfig {
6366 fn typename() -> &'static str {
6367 "type.googleapis.com/google.storage.v2.Bucket.Encryption.CustomerSuppliedEncryptionEnforcementConfig"
6368 }
6369 }
6370 }
6371
6372 /// Bucket restriction options.
6373 #[derive(Clone, Default, PartialEq)]
6374 #[non_exhaustive]
6375 pub struct IamConfig {
6376 /// Optional. Bucket restriction options currently enforced on the bucket.
6377 pub uniform_bucket_level_access:
6378 std::option::Option<crate::model::bucket::iam_config::UniformBucketLevelAccess>,
6379
6380 /// Optional. Whether IAM enforces public access prevention. Valid values are
6381 /// `enforced` or `inherited`.
6382 pub public_access_prevention: std::string::String,
6383
6384 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
6385 }
6386
6387 impl IamConfig {
6388 /// Creates a new default instance.
6389 pub fn new() -> Self {
6390 std::default::Default::default()
6391 }
6392
6393 /// Sets the value of [uniform_bucket_level_access][crate::model::bucket::IamConfig::uniform_bucket_level_access].
6394 ///
6395 /// # Example
6396 /// ```ignore,no_run
6397 /// # use google_cloud_storage::model::bucket::IamConfig;
6398 /// use google_cloud_storage::model::bucket::iam_config::UniformBucketLevelAccess;
6399 /// let x = IamConfig::new().set_uniform_bucket_level_access(UniformBucketLevelAccess::default()/* use setters */);
6400 /// ```
6401 pub fn set_uniform_bucket_level_access<T>(mut self, v: T) -> Self
6402 where
6403 T: std::convert::Into<crate::model::bucket::iam_config::UniformBucketLevelAccess>,
6404 {
6405 self.uniform_bucket_level_access = std::option::Option::Some(v.into());
6406 self
6407 }
6408
6409 /// Sets or clears the value of [uniform_bucket_level_access][crate::model::bucket::IamConfig::uniform_bucket_level_access].
6410 ///
6411 /// # Example
6412 /// ```ignore,no_run
6413 /// # use google_cloud_storage::model::bucket::IamConfig;
6414 /// use google_cloud_storage::model::bucket::iam_config::UniformBucketLevelAccess;
6415 /// let x = IamConfig::new().set_or_clear_uniform_bucket_level_access(Some(UniformBucketLevelAccess::default()/* use setters */));
6416 /// let x = IamConfig::new().set_or_clear_uniform_bucket_level_access(None::<UniformBucketLevelAccess>);
6417 /// ```
6418 pub fn set_or_clear_uniform_bucket_level_access<T>(
6419 mut self,
6420 v: std::option::Option<T>,
6421 ) -> Self
6422 where
6423 T: std::convert::Into<crate::model::bucket::iam_config::UniformBucketLevelAccess>,
6424 {
6425 self.uniform_bucket_level_access = v.map(|x| x.into());
6426 self
6427 }
6428
6429 /// Sets the value of [public_access_prevention][crate::model::bucket::IamConfig::public_access_prevention].
6430 ///
6431 /// # Example
6432 /// ```ignore,no_run
6433 /// # use google_cloud_storage::model::bucket::IamConfig;
6434 /// let x = IamConfig::new().set_public_access_prevention("example");
6435 /// ```
6436 pub fn set_public_access_prevention<T: std::convert::Into<std::string::String>>(
6437 mut self,
6438 v: T,
6439 ) -> Self {
6440 self.public_access_prevention = v.into();
6441 self
6442 }
6443 }
6444
6445 impl wkt::message::Message for IamConfig {
6446 fn typename() -> &'static str {
6447 "type.googleapis.com/google.storage.v2.Bucket.IamConfig"
6448 }
6449 }
6450
6451 /// Defines additional types related to [IamConfig].
6452 pub mod iam_config {
6453 #[allow(unused_imports)]
6454 use super::*;
6455
6456 /// Settings for Uniform Bucket level access.
6457 /// See <https://cloud.google.com/storage/docs/uniform-bucket-level-access>.
6458 #[derive(Clone, Default, PartialEq)]
6459 #[non_exhaustive]
6460 pub struct UniformBucketLevelAccess {
6461 /// Optional. If set, access checks only use bucket-level IAM policies or
6462 /// above.
6463 pub enabled: bool,
6464
6465 /// Optional. The deadline time for changing
6466 /// `iam_config.uniform_bucket_level_access.enabled` from `true` to
6467 /// `false`. Mutable until the specified deadline is reached, but not
6468 /// afterward.
6469 pub lock_time: std::option::Option<wkt::Timestamp>,
6470
6471 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
6472 }
6473
6474 impl UniformBucketLevelAccess {
6475 /// Creates a new default instance.
6476 pub fn new() -> Self {
6477 std::default::Default::default()
6478 }
6479
6480 /// Sets the value of [enabled][crate::model::bucket::iam_config::UniformBucketLevelAccess::enabled].
6481 ///
6482 /// # Example
6483 /// ```ignore,no_run
6484 /// # use google_cloud_storage::model::bucket::iam_config::UniformBucketLevelAccess;
6485 /// let x = UniformBucketLevelAccess::new().set_enabled(true);
6486 /// ```
6487 pub fn set_enabled<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
6488 self.enabled = v.into();
6489 self
6490 }
6491
6492 /// Sets the value of [lock_time][crate::model::bucket::iam_config::UniformBucketLevelAccess::lock_time].
6493 ///
6494 /// # Example
6495 /// ```ignore,no_run
6496 /// # use google_cloud_storage::model::bucket::iam_config::UniformBucketLevelAccess;
6497 /// use wkt::Timestamp;
6498 /// let x = UniformBucketLevelAccess::new().set_lock_time(Timestamp::default()/* use setters */);
6499 /// ```
6500 pub fn set_lock_time<T>(mut self, v: T) -> Self
6501 where
6502 T: std::convert::Into<wkt::Timestamp>,
6503 {
6504 self.lock_time = std::option::Option::Some(v.into());
6505 self
6506 }
6507
6508 /// Sets or clears the value of [lock_time][crate::model::bucket::iam_config::UniformBucketLevelAccess::lock_time].
6509 ///
6510 /// # Example
6511 /// ```ignore,no_run
6512 /// # use google_cloud_storage::model::bucket::iam_config::UniformBucketLevelAccess;
6513 /// use wkt::Timestamp;
6514 /// let x = UniformBucketLevelAccess::new().set_or_clear_lock_time(Some(Timestamp::default()/* use setters */));
6515 /// let x = UniformBucketLevelAccess::new().set_or_clear_lock_time(None::<Timestamp>);
6516 /// ```
6517 pub fn set_or_clear_lock_time<T>(mut self, v: std::option::Option<T>) -> Self
6518 where
6519 T: std::convert::Into<wkt::Timestamp>,
6520 {
6521 self.lock_time = v.map(|x| x.into());
6522 self
6523 }
6524 }
6525
6526 impl wkt::message::Message for UniformBucketLevelAccess {
6527 fn typename() -> &'static str {
6528 "type.googleapis.com/google.storage.v2.Bucket.IamConfig.UniformBucketLevelAccess"
6529 }
6530 }
6531 }
6532
6533 /// Lifecycle properties of a bucket.
6534 /// For more information, see [Object Lifecycle
6535 /// Management](https://cloud.google.com/storage/docs/lifecycle).
6536 #[derive(Clone, Default, PartialEq)]
6537 #[non_exhaustive]
6538 pub struct Lifecycle {
6539 /// Optional. A lifecycle management rule, which is made of an action to take
6540 /// and the condition under which the action is taken.
6541 pub rule: std::vec::Vec<crate::model::bucket::lifecycle::Rule>,
6542
6543 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
6544 }
6545
6546 impl Lifecycle {
6547 /// Creates a new default instance.
6548 pub fn new() -> Self {
6549 std::default::Default::default()
6550 }
6551
6552 /// Sets the value of [rule][crate::model::bucket::Lifecycle::rule].
6553 ///
6554 /// # Example
6555 /// ```ignore,no_run
6556 /// # use google_cloud_storage::model::bucket::Lifecycle;
6557 /// use google_cloud_storage::model::bucket::lifecycle::Rule;
6558 /// let x = Lifecycle::new()
6559 /// .set_rule([
6560 /// Rule::default()/* use setters */,
6561 /// Rule::default()/* use (different) setters */,
6562 /// ]);
6563 /// ```
6564 pub fn set_rule<T, V>(mut self, v: T) -> Self
6565 where
6566 T: std::iter::IntoIterator<Item = V>,
6567 V: std::convert::Into<crate::model::bucket::lifecycle::Rule>,
6568 {
6569 use std::iter::Iterator;
6570 self.rule = v.into_iter().map(|i| i.into()).collect();
6571 self
6572 }
6573 }
6574
6575 impl wkt::message::Message for Lifecycle {
6576 fn typename() -> &'static str {
6577 "type.googleapis.com/google.storage.v2.Bucket.Lifecycle"
6578 }
6579 }
6580
6581 /// Defines additional types related to [Lifecycle].
6582 pub mod lifecycle {
6583 #[allow(unused_imports)]
6584 use super::*;
6585
6586 /// A lifecycle Rule, combining an action to take on an object and a
6587 /// condition which triggers that action.
6588 #[derive(Clone, Default, PartialEq)]
6589 #[non_exhaustive]
6590 pub struct Rule {
6591 /// Optional. The action to take.
6592 pub action: std::option::Option<crate::model::bucket::lifecycle::rule::Action>,
6593
6594 /// Optional. The condition under which the action is taken.
6595 pub condition: std::option::Option<crate::model::bucket::lifecycle::rule::Condition>,
6596
6597 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
6598 }
6599
6600 impl Rule {
6601 /// Creates a new default instance.
6602 pub fn new() -> Self {
6603 std::default::Default::default()
6604 }
6605
6606 /// Sets the value of [action][crate::model::bucket::lifecycle::Rule::action].
6607 ///
6608 /// # Example
6609 /// ```ignore,no_run
6610 /// # use google_cloud_storage::model::bucket::lifecycle::Rule;
6611 /// use google_cloud_storage::model::bucket::lifecycle::rule::Action;
6612 /// let x = Rule::new().set_action(Action::default()/* use setters */);
6613 /// ```
6614 pub fn set_action<T>(mut self, v: T) -> Self
6615 where
6616 T: std::convert::Into<crate::model::bucket::lifecycle::rule::Action>,
6617 {
6618 self.action = std::option::Option::Some(v.into());
6619 self
6620 }
6621
6622 /// Sets or clears the value of [action][crate::model::bucket::lifecycle::Rule::action].
6623 ///
6624 /// # Example
6625 /// ```ignore,no_run
6626 /// # use google_cloud_storage::model::bucket::lifecycle::Rule;
6627 /// use google_cloud_storage::model::bucket::lifecycle::rule::Action;
6628 /// let x = Rule::new().set_or_clear_action(Some(Action::default()/* use setters */));
6629 /// let x = Rule::new().set_or_clear_action(None::<Action>);
6630 /// ```
6631 pub fn set_or_clear_action<T>(mut self, v: std::option::Option<T>) -> Self
6632 where
6633 T: std::convert::Into<crate::model::bucket::lifecycle::rule::Action>,
6634 {
6635 self.action = v.map(|x| x.into());
6636 self
6637 }
6638
6639 /// Sets the value of [condition][crate::model::bucket::lifecycle::Rule::condition].
6640 ///
6641 /// # Example
6642 /// ```ignore,no_run
6643 /// # use google_cloud_storage::model::bucket::lifecycle::Rule;
6644 /// use google_cloud_storage::model::bucket::lifecycle::rule::Condition;
6645 /// let x = Rule::new().set_condition(Condition::default()/* use setters */);
6646 /// ```
6647 pub fn set_condition<T>(mut self, v: T) -> Self
6648 where
6649 T: std::convert::Into<crate::model::bucket::lifecycle::rule::Condition>,
6650 {
6651 self.condition = std::option::Option::Some(v.into());
6652 self
6653 }
6654
6655 /// Sets or clears the value of [condition][crate::model::bucket::lifecycle::Rule::condition].
6656 ///
6657 /// # Example
6658 /// ```ignore,no_run
6659 /// # use google_cloud_storage::model::bucket::lifecycle::Rule;
6660 /// use google_cloud_storage::model::bucket::lifecycle::rule::Condition;
6661 /// let x = Rule::new().set_or_clear_condition(Some(Condition::default()/* use setters */));
6662 /// let x = Rule::new().set_or_clear_condition(None::<Condition>);
6663 /// ```
6664 pub fn set_or_clear_condition<T>(mut self, v: std::option::Option<T>) -> Self
6665 where
6666 T: std::convert::Into<crate::model::bucket::lifecycle::rule::Condition>,
6667 {
6668 self.condition = v.map(|x| x.into());
6669 self
6670 }
6671 }
6672
6673 impl wkt::message::Message for Rule {
6674 fn typename() -> &'static str {
6675 "type.googleapis.com/google.storage.v2.Bucket.Lifecycle.Rule"
6676 }
6677 }
6678
6679 /// Defines additional types related to [Rule].
6680 pub mod rule {
6681 #[allow(unused_imports)]
6682 use super::*;
6683
6684 /// An action to take on an object.
6685 #[derive(Clone, Default, PartialEq)]
6686 #[non_exhaustive]
6687 pub struct Action {
6688 /// Optional. Type of the action. Currently, only `Delete`,
6689 /// `SetStorageClass`, and `AbortIncompleteMultipartUpload` are
6690 /// supported.
6691 pub r#type: std::string::String,
6692
6693 /// Optional. Target storage class. Required iff the type of the action
6694 /// is SetStorageClass.
6695 pub storage_class: std::string::String,
6696
6697 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
6698 }
6699
6700 impl Action {
6701 /// Creates a new default instance.
6702 pub fn new() -> Self {
6703 std::default::Default::default()
6704 }
6705
6706 /// Sets the value of [r#type][crate::model::bucket::lifecycle::rule::Action::type].
6707 ///
6708 /// # Example
6709 /// ```ignore,no_run
6710 /// # use google_cloud_storage::model::bucket::lifecycle::rule::Action;
6711 /// let x = Action::new().set_type("example");
6712 /// ```
6713 pub fn set_type<T: std::convert::Into<std::string::String>>(
6714 mut self,
6715 v: T,
6716 ) -> Self {
6717 self.r#type = v.into();
6718 self
6719 }
6720
6721 /// Sets the value of [storage_class][crate::model::bucket::lifecycle::rule::Action::storage_class].
6722 ///
6723 /// # Example
6724 /// ```ignore,no_run
6725 /// # use google_cloud_storage::model::bucket::lifecycle::rule::Action;
6726 /// let x = Action::new().set_storage_class("example");
6727 /// ```
6728 pub fn set_storage_class<T: std::convert::Into<std::string::String>>(
6729 mut self,
6730 v: T,
6731 ) -> Self {
6732 self.storage_class = v.into();
6733 self
6734 }
6735 }
6736
6737 impl wkt::message::Message for Action {
6738 fn typename() -> &'static str {
6739 "type.googleapis.com/google.storage.v2.Bucket.Lifecycle.Rule.Action"
6740 }
6741 }
6742
6743 /// A condition of an object which triggers some action.
6744 #[derive(Clone, Default, PartialEq)]
6745 #[non_exhaustive]
6746 pub struct Condition {
6747 /// Age of an object (in days). This condition is satisfied when an
6748 /// object reaches the specified age.
6749 /// A value of 0 indicates that all objects immediately match this
6750 /// condition.
6751 pub age_days: std::option::Option<i32>,
6752
6753 /// Optional. This condition is satisfied when an object is created
6754 /// before midnight of the specified date in UTC.
6755 pub created_before: std::option::Option<google_cloud_type::model::Date>,
6756
6757 /// Relevant only for versioned objects. If the value is
6758 /// `true`, this condition matches live objects; if the value
6759 /// is `false`, it matches archived objects.
6760 pub is_live: std::option::Option<bool>,
6761
6762 /// Relevant only for versioned objects. If the value is N, this
6763 /// condition is satisfied when there are at least N versions (including
6764 /// the live version) newer than this version of the object.
6765 pub num_newer_versions: std::option::Option<i32>,
6766
6767 /// Optional. Objects having any of the storage classes specified by this
6768 /// condition are matched. Values include `MULTI_REGIONAL`, `REGIONAL`,
6769 /// `NEARLINE`, `COLDLINE`, `STANDARD`, and
6770 /// `DURABLE_REDUCED_AVAILABILITY`.
6771 pub matches_storage_class: std::vec::Vec<std::string::String>,
6772
6773 /// Number of days that have elapsed since the custom timestamp set on an
6774 /// object.
6775 /// The value of the field must be a nonnegative integer.
6776 pub days_since_custom_time: std::option::Option<i32>,
6777
6778 /// Optional. An object matches this condition if the custom timestamp
6779 /// set on the object is before the specified date in UTC.
6780 pub custom_time_before: std::option::Option<google_cloud_type::model::Date>,
6781
6782 /// This condition is relevant only for versioned objects. An object
6783 /// version satisfies this condition only if these many days have been
6784 /// passed since it became noncurrent. The value of the field must be a
6785 /// nonnegative integer. If it's zero, the object version becomes
6786 /// eligible for Lifecycle action as soon as it becomes noncurrent.
6787 pub days_since_noncurrent_time: std::option::Option<i32>,
6788
6789 /// Optional. This condition is relevant only for versioned objects. An
6790 /// object version satisfies this condition only if it became noncurrent
6791 /// before the specified date in UTC.
6792 pub noncurrent_time_before: std::option::Option<google_cloud_type::model::Date>,
6793
6794 /// Optional. List of object name prefixes. If any prefix exactly matches
6795 /// the beginning of the object name, the condition evaluates to true.
6796 pub matches_prefix: std::vec::Vec<std::string::String>,
6797
6798 /// Optional. List of object name suffixes. If any suffix exactly matches
6799 /// the end of the object name, the condition evaluates to true.
6800 pub matches_suffix: std::vec::Vec<std::string::String>,
6801
6802 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
6803 }
6804
6805 impl Condition {
6806 /// Creates a new default instance.
6807 pub fn new() -> Self {
6808 std::default::Default::default()
6809 }
6810
6811 /// Sets the value of [age_days][crate::model::bucket::lifecycle::rule::Condition::age_days].
6812 ///
6813 /// # Example
6814 /// ```ignore,no_run
6815 /// # use google_cloud_storage::model::bucket::lifecycle::rule::Condition;
6816 /// let x = Condition::new().set_age_days(42);
6817 /// ```
6818 pub fn set_age_days<T>(mut self, v: T) -> Self
6819 where
6820 T: std::convert::Into<i32>,
6821 {
6822 self.age_days = std::option::Option::Some(v.into());
6823 self
6824 }
6825
6826 /// Sets or clears the value of [age_days][crate::model::bucket::lifecycle::rule::Condition::age_days].
6827 ///
6828 /// # Example
6829 /// ```ignore,no_run
6830 /// # use google_cloud_storage::model::bucket::lifecycle::rule::Condition;
6831 /// let x = Condition::new().set_or_clear_age_days(Some(42));
6832 /// let x = Condition::new().set_or_clear_age_days(None::<i32>);
6833 /// ```
6834 pub fn set_or_clear_age_days<T>(mut self, v: std::option::Option<T>) -> Self
6835 where
6836 T: std::convert::Into<i32>,
6837 {
6838 self.age_days = v.map(|x| x.into());
6839 self
6840 }
6841
6842 /// Sets the value of [created_before][crate::model::bucket::lifecycle::rule::Condition::created_before].
6843 ///
6844 /// # Example
6845 /// ```ignore,no_run
6846 /// # use google_cloud_storage::model::bucket::lifecycle::rule::Condition;
6847 /// use google_cloud_type::model::Date;
6848 /// let x = Condition::new().set_created_before(Date::default()/* use setters */);
6849 /// ```
6850 pub fn set_created_before<T>(mut self, v: T) -> Self
6851 where
6852 T: std::convert::Into<google_cloud_type::model::Date>,
6853 {
6854 self.created_before = std::option::Option::Some(v.into());
6855 self
6856 }
6857
6858 /// Sets or clears the value of [created_before][crate::model::bucket::lifecycle::rule::Condition::created_before].
6859 ///
6860 /// # Example
6861 /// ```ignore,no_run
6862 /// # use google_cloud_storage::model::bucket::lifecycle::rule::Condition;
6863 /// use google_cloud_type::model::Date;
6864 /// let x = Condition::new().set_or_clear_created_before(Some(Date::default()/* use setters */));
6865 /// let x = Condition::new().set_or_clear_created_before(None::<Date>);
6866 /// ```
6867 pub fn set_or_clear_created_before<T>(mut self, v: std::option::Option<T>) -> Self
6868 where
6869 T: std::convert::Into<google_cloud_type::model::Date>,
6870 {
6871 self.created_before = v.map(|x| x.into());
6872 self
6873 }
6874
6875 /// Sets the value of [is_live][crate::model::bucket::lifecycle::rule::Condition::is_live].
6876 ///
6877 /// # Example
6878 /// ```ignore,no_run
6879 /// # use google_cloud_storage::model::bucket::lifecycle::rule::Condition;
6880 /// let x = Condition::new().set_is_live(true);
6881 /// ```
6882 pub fn set_is_live<T>(mut self, v: T) -> Self
6883 where
6884 T: std::convert::Into<bool>,
6885 {
6886 self.is_live = std::option::Option::Some(v.into());
6887 self
6888 }
6889
6890 /// Sets or clears the value of [is_live][crate::model::bucket::lifecycle::rule::Condition::is_live].
6891 ///
6892 /// # Example
6893 /// ```ignore,no_run
6894 /// # use google_cloud_storage::model::bucket::lifecycle::rule::Condition;
6895 /// let x = Condition::new().set_or_clear_is_live(Some(false));
6896 /// let x = Condition::new().set_or_clear_is_live(None::<bool>);
6897 /// ```
6898 pub fn set_or_clear_is_live<T>(mut self, v: std::option::Option<T>) -> Self
6899 where
6900 T: std::convert::Into<bool>,
6901 {
6902 self.is_live = v.map(|x| x.into());
6903 self
6904 }
6905
6906 /// Sets the value of [num_newer_versions][crate::model::bucket::lifecycle::rule::Condition::num_newer_versions].
6907 ///
6908 /// # Example
6909 /// ```ignore,no_run
6910 /// # use google_cloud_storage::model::bucket::lifecycle::rule::Condition;
6911 /// let x = Condition::new().set_num_newer_versions(42);
6912 /// ```
6913 pub fn set_num_newer_versions<T>(mut self, v: T) -> Self
6914 where
6915 T: std::convert::Into<i32>,
6916 {
6917 self.num_newer_versions = std::option::Option::Some(v.into());
6918 self
6919 }
6920
6921 /// Sets or clears the value of [num_newer_versions][crate::model::bucket::lifecycle::rule::Condition::num_newer_versions].
6922 ///
6923 /// # Example
6924 /// ```ignore,no_run
6925 /// # use google_cloud_storage::model::bucket::lifecycle::rule::Condition;
6926 /// let x = Condition::new().set_or_clear_num_newer_versions(Some(42));
6927 /// let x = Condition::new().set_or_clear_num_newer_versions(None::<i32>);
6928 /// ```
6929 pub fn set_or_clear_num_newer_versions<T>(
6930 mut self,
6931 v: std::option::Option<T>,
6932 ) -> Self
6933 where
6934 T: std::convert::Into<i32>,
6935 {
6936 self.num_newer_versions = v.map(|x| x.into());
6937 self
6938 }
6939
6940 /// Sets the value of [matches_storage_class][crate::model::bucket::lifecycle::rule::Condition::matches_storage_class].
6941 ///
6942 /// # Example
6943 /// ```ignore,no_run
6944 /// # use google_cloud_storage::model::bucket::lifecycle::rule::Condition;
6945 /// let x = Condition::new().set_matches_storage_class(["a", "b", "c"]);
6946 /// ```
6947 pub fn set_matches_storage_class<T, V>(mut self, v: T) -> Self
6948 where
6949 T: std::iter::IntoIterator<Item = V>,
6950 V: std::convert::Into<std::string::String>,
6951 {
6952 use std::iter::Iterator;
6953 self.matches_storage_class = v.into_iter().map(|i| i.into()).collect();
6954 self
6955 }
6956
6957 /// Sets the value of [days_since_custom_time][crate::model::bucket::lifecycle::rule::Condition::days_since_custom_time].
6958 ///
6959 /// # Example
6960 /// ```ignore,no_run
6961 /// # use google_cloud_storage::model::bucket::lifecycle::rule::Condition;
6962 /// let x = Condition::new().set_days_since_custom_time(42);
6963 /// ```
6964 pub fn set_days_since_custom_time<T>(mut self, v: T) -> Self
6965 where
6966 T: std::convert::Into<i32>,
6967 {
6968 self.days_since_custom_time = std::option::Option::Some(v.into());
6969 self
6970 }
6971
6972 /// Sets or clears the value of [days_since_custom_time][crate::model::bucket::lifecycle::rule::Condition::days_since_custom_time].
6973 ///
6974 /// # Example
6975 /// ```ignore,no_run
6976 /// # use google_cloud_storage::model::bucket::lifecycle::rule::Condition;
6977 /// let x = Condition::new().set_or_clear_days_since_custom_time(Some(42));
6978 /// let x = Condition::new().set_or_clear_days_since_custom_time(None::<i32>);
6979 /// ```
6980 pub fn set_or_clear_days_since_custom_time<T>(
6981 mut self,
6982 v: std::option::Option<T>,
6983 ) -> Self
6984 where
6985 T: std::convert::Into<i32>,
6986 {
6987 self.days_since_custom_time = v.map(|x| x.into());
6988 self
6989 }
6990
6991 /// Sets the value of [custom_time_before][crate::model::bucket::lifecycle::rule::Condition::custom_time_before].
6992 ///
6993 /// # Example
6994 /// ```ignore,no_run
6995 /// # use google_cloud_storage::model::bucket::lifecycle::rule::Condition;
6996 /// use google_cloud_type::model::Date;
6997 /// let x = Condition::new().set_custom_time_before(Date::default()/* use setters */);
6998 /// ```
6999 pub fn set_custom_time_before<T>(mut self, v: T) -> Self
7000 where
7001 T: std::convert::Into<google_cloud_type::model::Date>,
7002 {
7003 self.custom_time_before = std::option::Option::Some(v.into());
7004 self
7005 }
7006
7007 /// Sets or clears the value of [custom_time_before][crate::model::bucket::lifecycle::rule::Condition::custom_time_before].
7008 ///
7009 /// # Example
7010 /// ```ignore,no_run
7011 /// # use google_cloud_storage::model::bucket::lifecycle::rule::Condition;
7012 /// use google_cloud_type::model::Date;
7013 /// let x = Condition::new().set_or_clear_custom_time_before(Some(Date::default()/* use setters */));
7014 /// let x = Condition::new().set_or_clear_custom_time_before(None::<Date>);
7015 /// ```
7016 pub fn set_or_clear_custom_time_before<T>(
7017 mut self,
7018 v: std::option::Option<T>,
7019 ) -> Self
7020 where
7021 T: std::convert::Into<google_cloud_type::model::Date>,
7022 {
7023 self.custom_time_before = v.map(|x| x.into());
7024 self
7025 }
7026
7027 /// Sets the value of [days_since_noncurrent_time][crate::model::bucket::lifecycle::rule::Condition::days_since_noncurrent_time].
7028 ///
7029 /// # Example
7030 /// ```ignore,no_run
7031 /// # use google_cloud_storage::model::bucket::lifecycle::rule::Condition;
7032 /// let x = Condition::new().set_days_since_noncurrent_time(42);
7033 /// ```
7034 pub fn set_days_since_noncurrent_time<T>(mut self, v: T) -> Self
7035 where
7036 T: std::convert::Into<i32>,
7037 {
7038 self.days_since_noncurrent_time = std::option::Option::Some(v.into());
7039 self
7040 }
7041
7042 /// Sets or clears the value of [days_since_noncurrent_time][crate::model::bucket::lifecycle::rule::Condition::days_since_noncurrent_time].
7043 ///
7044 /// # Example
7045 /// ```ignore,no_run
7046 /// # use google_cloud_storage::model::bucket::lifecycle::rule::Condition;
7047 /// let x = Condition::new().set_or_clear_days_since_noncurrent_time(Some(42));
7048 /// let x = Condition::new().set_or_clear_days_since_noncurrent_time(None::<i32>);
7049 /// ```
7050 pub fn set_or_clear_days_since_noncurrent_time<T>(
7051 mut self,
7052 v: std::option::Option<T>,
7053 ) -> Self
7054 where
7055 T: std::convert::Into<i32>,
7056 {
7057 self.days_since_noncurrent_time = v.map(|x| x.into());
7058 self
7059 }
7060
7061 /// Sets the value of [noncurrent_time_before][crate::model::bucket::lifecycle::rule::Condition::noncurrent_time_before].
7062 ///
7063 /// # Example
7064 /// ```ignore,no_run
7065 /// # use google_cloud_storage::model::bucket::lifecycle::rule::Condition;
7066 /// use google_cloud_type::model::Date;
7067 /// let x = Condition::new().set_noncurrent_time_before(Date::default()/* use setters */);
7068 /// ```
7069 pub fn set_noncurrent_time_before<T>(mut self, v: T) -> Self
7070 where
7071 T: std::convert::Into<google_cloud_type::model::Date>,
7072 {
7073 self.noncurrent_time_before = std::option::Option::Some(v.into());
7074 self
7075 }
7076
7077 /// Sets or clears the value of [noncurrent_time_before][crate::model::bucket::lifecycle::rule::Condition::noncurrent_time_before].
7078 ///
7079 /// # Example
7080 /// ```ignore,no_run
7081 /// # use google_cloud_storage::model::bucket::lifecycle::rule::Condition;
7082 /// use google_cloud_type::model::Date;
7083 /// let x = Condition::new().set_or_clear_noncurrent_time_before(Some(Date::default()/* use setters */));
7084 /// let x = Condition::new().set_or_clear_noncurrent_time_before(None::<Date>);
7085 /// ```
7086 pub fn set_or_clear_noncurrent_time_before<T>(
7087 mut self,
7088 v: std::option::Option<T>,
7089 ) -> Self
7090 where
7091 T: std::convert::Into<google_cloud_type::model::Date>,
7092 {
7093 self.noncurrent_time_before = v.map(|x| x.into());
7094 self
7095 }
7096
7097 /// Sets the value of [matches_prefix][crate::model::bucket::lifecycle::rule::Condition::matches_prefix].
7098 ///
7099 /// # Example
7100 /// ```ignore,no_run
7101 /// # use google_cloud_storage::model::bucket::lifecycle::rule::Condition;
7102 /// let x = Condition::new().set_matches_prefix(["a", "b", "c"]);
7103 /// ```
7104 pub fn set_matches_prefix<T, V>(mut self, v: T) -> Self
7105 where
7106 T: std::iter::IntoIterator<Item = V>,
7107 V: std::convert::Into<std::string::String>,
7108 {
7109 use std::iter::Iterator;
7110 self.matches_prefix = v.into_iter().map(|i| i.into()).collect();
7111 self
7112 }
7113
7114 /// Sets the value of [matches_suffix][crate::model::bucket::lifecycle::rule::Condition::matches_suffix].
7115 ///
7116 /// # Example
7117 /// ```ignore,no_run
7118 /// # use google_cloud_storage::model::bucket::lifecycle::rule::Condition;
7119 /// let x = Condition::new().set_matches_suffix(["a", "b", "c"]);
7120 /// ```
7121 pub fn set_matches_suffix<T, V>(mut self, v: T) -> Self
7122 where
7123 T: std::iter::IntoIterator<Item = V>,
7124 V: std::convert::Into<std::string::String>,
7125 {
7126 use std::iter::Iterator;
7127 self.matches_suffix = v.into_iter().map(|i| i.into()).collect();
7128 self
7129 }
7130 }
7131
7132 impl wkt::message::Message for Condition {
7133 fn typename() -> &'static str {
7134 "type.googleapis.com/google.storage.v2.Bucket.Lifecycle.Rule.Condition"
7135 }
7136 }
7137 }
7138 }
7139
7140 /// Logging-related properties of a bucket.
7141 #[derive(Clone, Default, PartialEq)]
7142 #[non_exhaustive]
7143 pub struct Logging {
7144 /// Optional. The destination bucket where the current bucket's logs should
7145 /// be placed, using path format (like `projects/123456/buckets/foo`).
7146 pub log_bucket: std::string::String,
7147
7148 /// Optional. A prefix for log object names.
7149 pub log_object_prefix: std::string::String,
7150
7151 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
7152 }
7153
7154 impl Logging {
7155 /// Creates a new default instance.
7156 pub fn new() -> Self {
7157 std::default::Default::default()
7158 }
7159
7160 /// Sets the value of [log_bucket][crate::model::bucket::Logging::log_bucket].
7161 ///
7162 /// # Example
7163 /// ```ignore,no_run
7164 /// # use google_cloud_storage::model::bucket::Logging;
7165 /// let x = Logging::new().set_log_bucket("example");
7166 /// ```
7167 pub fn set_log_bucket<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
7168 self.log_bucket = v.into();
7169 self
7170 }
7171
7172 /// Sets the value of [log_object_prefix][crate::model::bucket::Logging::log_object_prefix].
7173 ///
7174 /// # Example
7175 /// ```ignore,no_run
7176 /// # use google_cloud_storage::model::bucket::Logging;
7177 /// let x = Logging::new().set_log_object_prefix("example");
7178 /// ```
7179 pub fn set_log_object_prefix<T: std::convert::Into<std::string::String>>(
7180 mut self,
7181 v: T,
7182 ) -> Self {
7183 self.log_object_prefix = v.into();
7184 self
7185 }
7186 }
7187
7188 impl wkt::message::Message for Logging {
7189 fn typename() -> &'static str {
7190 "type.googleapis.com/google.storage.v2.Bucket.Logging"
7191 }
7192 }
7193
7194 /// Object Retention related properties of a bucket.
7195 #[derive(Clone, Default, PartialEq)]
7196 #[non_exhaustive]
7197 pub struct ObjectRetention {
7198 /// Optional. Output only. If true, object retention is enabled for the
7199 /// bucket.
7200 pub enabled: bool,
7201
7202 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
7203 }
7204
7205 impl ObjectRetention {
7206 /// Creates a new default instance.
7207 pub fn new() -> Self {
7208 std::default::Default::default()
7209 }
7210
7211 /// Sets the value of [enabled][crate::model::bucket::ObjectRetention::enabled].
7212 ///
7213 /// # Example
7214 /// ```ignore,no_run
7215 /// # use google_cloud_storage::model::bucket::ObjectRetention;
7216 /// let x = ObjectRetention::new().set_enabled(true);
7217 /// ```
7218 pub fn set_enabled<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
7219 self.enabled = v.into();
7220 self
7221 }
7222 }
7223
7224 impl wkt::message::Message for ObjectRetention {
7225 fn typename() -> &'static str {
7226 "type.googleapis.com/google.storage.v2.Bucket.ObjectRetention"
7227 }
7228 }
7229
7230 /// Retention policy properties of a bucket.
7231 #[derive(Clone, Default, PartialEq)]
7232 #[non_exhaustive]
7233 pub struct RetentionPolicy {
7234 /// Optional. Server-determined value that indicates the time from which
7235 /// policy was enforced and effective.
7236 pub effective_time: std::option::Option<wkt::Timestamp>,
7237
7238 /// Optional. Once locked, an object retention policy cannot be modified.
7239 pub is_locked: bool,
7240
7241 /// Optional. The duration that objects need to be retained. Retention
7242 /// duration must be greater than zero and less than 100 years. Note that
7243 /// enforcement of retention periods less than a day is not guaranteed. Such
7244 /// periods should only be used for testing purposes. Any `nanos` value
7245 /// specified is rounded down to the nearest second.
7246 pub retention_duration: std::option::Option<wkt::Duration>,
7247
7248 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
7249 }
7250
7251 impl RetentionPolicy {
7252 /// Creates a new default instance.
7253 pub fn new() -> Self {
7254 std::default::Default::default()
7255 }
7256
7257 /// Sets the value of [effective_time][crate::model::bucket::RetentionPolicy::effective_time].
7258 ///
7259 /// # Example
7260 /// ```ignore,no_run
7261 /// # use google_cloud_storage::model::bucket::RetentionPolicy;
7262 /// use wkt::Timestamp;
7263 /// let x = RetentionPolicy::new().set_effective_time(Timestamp::default()/* use setters */);
7264 /// ```
7265 pub fn set_effective_time<T>(mut self, v: T) -> Self
7266 where
7267 T: std::convert::Into<wkt::Timestamp>,
7268 {
7269 self.effective_time = std::option::Option::Some(v.into());
7270 self
7271 }
7272
7273 /// Sets or clears the value of [effective_time][crate::model::bucket::RetentionPolicy::effective_time].
7274 ///
7275 /// # Example
7276 /// ```ignore,no_run
7277 /// # use google_cloud_storage::model::bucket::RetentionPolicy;
7278 /// use wkt::Timestamp;
7279 /// let x = RetentionPolicy::new().set_or_clear_effective_time(Some(Timestamp::default()/* use setters */));
7280 /// let x = RetentionPolicy::new().set_or_clear_effective_time(None::<Timestamp>);
7281 /// ```
7282 pub fn set_or_clear_effective_time<T>(mut self, v: std::option::Option<T>) -> Self
7283 where
7284 T: std::convert::Into<wkt::Timestamp>,
7285 {
7286 self.effective_time = v.map(|x| x.into());
7287 self
7288 }
7289
7290 /// Sets the value of [is_locked][crate::model::bucket::RetentionPolicy::is_locked].
7291 ///
7292 /// # Example
7293 /// ```ignore,no_run
7294 /// # use google_cloud_storage::model::bucket::RetentionPolicy;
7295 /// let x = RetentionPolicy::new().set_is_locked(true);
7296 /// ```
7297 pub fn set_is_locked<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
7298 self.is_locked = v.into();
7299 self
7300 }
7301
7302 /// Sets the value of [retention_duration][crate::model::bucket::RetentionPolicy::retention_duration].
7303 ///
7304 /// # Example
7305 /// ```ignore,no_run
7306 /// # use google_cloud_storage::model::bucket::RetentionPolicy;
7307 /// use wkt::Duration;
7308 /// let x = RetentionPolicy::new().set_retention_duration(Duration::default()/* use setters */);
7309 /// ```
7310 pub fn set_retention_duration<T>(mut self, v: T) -> Self
7311 where
7312 T: std::convert::Into<wkt::Duration>,
7313 {
7314 self.retention_duration = std::option::Option::Some(v.into());
7315 self
7316 }
7317
7318 /// Sets or clears the value of [retention_duration][crate::model::bucket::RetentionPolicy::retention_duration].
7319 ///
7320 /// # Example
7321 /// ```ignore,no_run
7322 /// # use google_cloud_storage::model::bucket::RetentionPolicy;
7323 /// use wkt::Duration;
7324 /// let x = RetentionPolicy::new().set_or_clear_retention_duration(Some(Duration::default()/* use setters */));
7325 /// let x = RetentionPolicy::new().set_or_clear_retention_duration(None::<Duration>);
7326 /// ```
7327 pub fn set_or_clear_retention_duration<T>(mut self, v: std::option::Option<T>) -> Self
7328 where
7329 T: std::convert::Into<wkt::Duration>,
7330 {
7331 self.retention_duration = v.map(|x| x.into());
7332 self
7333 }
7334 }
7335
7336 impl wkt::message::Message for RetentionPolicy {
7337 fn typename() -> &'static str {
7338 "type.googleapis.com/google.storage.v2.Bucket.RetentionPolicy"
7339 }
7340 }
7341
7342 /// Soft delete policy properties of a bucket.
7343 #[derive(Clone, Default, PartialEq)]
7344 #[non_exhaustive]
7345 pub struct SoftDeletePolicy {
7346 /// The period of time that soft-deleted objects in the bucket must be
7347 /// retained and cannot be permanently deleted. The duration must be greater
7348 /// than or equal to 7 days and less than 1 year.
7349 pub retention_duration: std::option::Option<wkt::Duration>,
7350
7351 /// Time from which the policy was effective. This is service-provided.
7352 pub effective_time: std::option::Option<wkt::Timestamp>,
7353
7354 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
7355 }
7356
7357 impl SoftDeletePolicy {
7358 /// Creates a new default instance.
7359 pub fn new() -> Self {
7360 std::default::Default::default()
7361 }
7362
7363 /// Sets the value of [retention_duration][crate::model::bucket::SoftDeletePolicy::retention_duration].
7364 ///
7365 /// # Example
7366 /// ```ignore,no_run
7367 /// # use google_cloud_storage::model::bucket::SoftDeletePolicy;
7368 /// use wkt::Duration;
7369 /// let x = SoftDeletePolicy::new().set_retention_duration(Duration::default()/* use setters */);
7370 /// ```
7371 pub fn set_retention_duration<T>(mut self, v: T) -> Self
7372 where
7373 T: std::convert::Into<wkt::Duration>,
7374 {
7375 self.retention_duration = std::option::Option::Some(v.into());
7376 self
7377 }
7378
7379 /// Sets or clears the value of [retention_duration][crate::model::bucket::SoftDeletePolicy::retention_duration].
7380 ///
7381 /// # Example
7382 /// ```ignore,no_run
7383 /// # use google_cloud_storage::model::bucket::SoftDeletePolicy;
7384 /// use wkt::Duration;
7385 /// let x = SoftDeletePolicy::new().set_or_clear_retention_duration(Some(Duration::default()/* use setters */));
7386 /// let x = SoftDeletePolicy::new().set_or_clear_retention_duration(None::<Duration>);
7387 /// ```
7388 pub fn set_or_clear_retention_duration<T>(mut self, v: std::option::Option<T>) -> Self
7389 where
7390 T: std::convert::Into<wkt::Duration>,
7391 {
7392 self.retention_duration = v.map(|x| x.into());
7393 self
7394 }
7395
7396 /// Sets the value of [effective_time][crate::model::bucket::SoftDeletePolicy::effective_time].
7397 ///
7398 /// # Example
7399 /// ```ignore,no_run
7400 /// # use google_cloud_storage::model::bucket::SoftDeletePolicy;
7401 /// use wkt::Timestamp;
7402 /// let x = SoftDeletePolicy::new().set_effective_time(Timestamp::default()/* use setters */);
7403 /// ```
7404 pub fn set_effective_time<T>(mut self, v: T) -> Self
7405 where
7406 T: std::convert::Into<wkt::Timestamp>,
7407 {
7408 self.effective_time = std::option::Option::Some(v.into());
7409 self
7410 }
7411
7412 /// Sets or clears the value of [effective_time][crate::model::bucket::SoftDeletePolicy::effective_time].
7413 ///
7414 /// # Example
7415 /// ```ignore,no_run
7416 /// # use google_cloud_storage::model::bucket::SoftDeletePolicy;
7417 /// use wkt::Timestamp;
7418 /// let x = SoftDeletePolicy::new().set_or_clear_effective_time(Some(Timestamp::default()/* use setters */));
7419 /// let x = SoftDeletePolicy::new().set_or_clear_effective_time(None::<Timestamp>);
7420 /// ```
7421 pub fn set_or_clear_effective_time<T>(mut self, v: std::option::Option<T>) -> Self
7422 where
7423 T: std::convert::Into<wkt::Timestamp>,
7424 {
7425 self.effective_time = v.map(|x| x.into());
7426 self
7427 }
7428 }
7429
7430 impl wkt::message::Message for SoftDeletePolicy {
7431 fn typename() -> &'static str {
7432 "type.googleapis.com/google.storage.v2.Bucket.SoftDeletePolicy"
7433 }
7434 }
7435
7436 /// Properties of a bucket related to versioning.
7437 /// For more information about Cloud Storage versioning, see [Object
7438 /// versioning](https://cloud.google.com/storage/docs/object-versioning).
7439 #[derive(Clone, Default, PartialEq)]
7440 #[non_exhaustive]
7441 pub struct Versioning {
7442 /// Optional. While set to true, versioning is fully enabled for this bucket.
7443 pub enabled: bool,
7444
7445 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
7446 }
7447
7448 impl Versioning {
7449 /// Creates a new default instance.
7450 pub fn new() -> Self {
7451 std::default::Default::default()
7452 }
7453
7454 /// Sets the value of [enabled][crate::model::bucket::Versioning::enabled].
7455 ///
7456 /// # Example
7457 /// ```ignore,no_run
7458 /// # use google_cloud_storage::model::bucket::Versioning;
7459 /// let x = Versioning::new().set_enabled(true);
7460 /// ```
7461 pub fn set_enabled<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
7462 self.enabled = v.into();
7463 self
7464 }
7465 }
7466
7467 impl wkt::message::Message for Versioning {
7468 fn typename() -> &'static str {
7469 "type.googleapis.com/google.storage.v2.Bucket.Versioning"
7470 }
7471 }
7472
7473 /// Properties of a bucket related to accessing the contents as a static
7474 /// website. For details, see [hosting a static website using Cloud
7475 /// Storage](https://cloud.google.com/storage/docs/hosting-static-website).
7476 #[derive(Clone, Default, PartialEq)]
7477 #[non_exhaustive]
7478 pub struct Website {
7479 /// Optional. If the requested object path is missing, the service ensures
7480 /// the path has a trailing '/', append this suffix, and attempt to retrieve
7481 /// the resulting object. This allows the creation of `index.html` objects to
7482 /// represent directory pages.
7483 pub main_page_suffix: std::string::String,
7484
7485 /// Optional. If the requested object path is missing, and any
7486 /// `mainPageSuffix` object is missing, if applicable, the service
7487 /// returns the named object from this bucket as the content for a
7488 /// [404 Not Found](https://tools.ietf.org/html/rfc7231#section-6.5.4)
7489 /// result.
7490 pub not_found_page: std::string::String,
7491
7492 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
7493 }
7494
7495 impl Website {
7496 /// Creates a new default instance.
7497 pub fn new() -> Self {
7498 std::default::Default::default()
7499 }
7500
7501 /// Sets the value of [main_page_suffix][crate::model::bucket::Website::main_page_suffix].
7502 ///
7503 /// # Example
7504 /// ```ignore,no_run
7505 /// # use google_cloud_storage::model::bucket::Website;
7506 /// let x = Website::new().set_main_page_suffix("example");
7507 /// ```
7508 pub fn set_main_page_suffix<T: std::convert::Into<std::string::String>>(
7509 mut self,
7510 v: T,
7511 ) -> Self {
7512 self.main_page_suffix = v.into();
7513 self
7514 }
7515
7516 /// Sets the value of [not_found_page][crate::model::bucket::Website::not_found_page].
7517 ///
7518 /// # Example
7519 /// ```ignore,no_run
7520 /// # use google_cloud_storage::model::bucket::Website;
7521 /// let x = Website::new().set_not_found_page("example");
7522 /// ```
7523 pub fn set_not_found_page<T: std::convert::Into<std::string::String>>(
7524 mut self,
7525 v: T,
7526 ) -> Self {
7527 self.not_found_page = v.into();
7528 self
7529 }
7530 }
7531
7532 impl wkt::message::Message for Website {
7533 fn typename() -> &'static str {
7534 "type.googleapis.com/google.storage.v2.Bucket.Website"
7535 }
7536 }
7537
7538 /// Configuration for [configurable dual-
7539 /// regions](https://cloud.google.com/storage/docs/locations#configurable). It
7540 /// should specify precisely two eligible regions within the same multi-region.
7541 /// For details, see
7542 /// [locations](https://cloud.google.com/storage/docs/locations).
7543 #[derive(Clone, Default, PartialEq)]
7544 #[non_exhaustive]
7545 pub struct CustomPlacementConfig {
7546 /// Optional. List of locations to use for data placement.
7547 pub data_locations: std::vec::Vec<std::string::String>,
7548
7549 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
7550 }
7551
7552 impl CustomPlacementConfig {
7553 /// Creates a new default instance.
7554 pub fn new() -> Self {
7555 std::default::Default::default()
7556 }
7557
7558 /// Sets the value of [data_locations][crate::model::bucket::CustomPlacementConfig::data_locations].
7559 ///
7560 /// # Example
7561 /// ```ignore,no_run
7562 /// # use google_cloud_storage::model::bucket::CustomPlacementConfig;
7563 /// let x = CustomPlacementConfig::new().set_data_locations(["a", "b", "c"]);
7564 /// ```
7565 pub fn set_data_locations<T, V>(mut self, v: T) -> Self
7566 where
7567 T: std::iter::IntoIterator<Item = V>,
7568 V: std::convert::Into<std::string::String>,
7569 {
7570 use std::iter::Iterator;
7571 self.data_locations = v.into_iter().map(|i| i.into()).collect();
7572 self
7573 }
7574 }
7575
7576 impl wkt::message::Message for CustomPlacementConfig {
7577 fn typename() -> &'static str {
7578 "type.googleapis.com/google.storage.v2.Bucket.CustomPlacementConfig"
7579 }
7580 }
7581
7582 /// Configuration for a bucket's Autoclass feature.
7583 #[derive(Clone, Default, PartialEq)]
7584 #[non_exhaustive]
7585 pub struct Autoclass {
7586 /// Optional. Enables Autoclass.
7587 pub enabled: bool,
7588
7589 /// Output only. Latest instant at which the `enabled` field was set to true
7590 /// after being disabled/unconfigured or set to false after being enabled. If
7591 /// Autoclass is enabled when the bucket is created, the value of the
7592 /// `toggle_time` field is set to the bucket `create_time`.
7593 pub toggle_time: std::option::Option<wkt::Timestamp>,
7594
7595 /// An object in an Autoclass bucket eventually cools down to the
7596 /// terminal storage class if there is no access to the object.
7597 /// The only valid values are NEARLINE and ARCHIVE.
7598 pub terminal_storage_class: std::option::Option<std::string::String>,
7599
7600 /// Output only. Latest instant at which the autoclass terminal storage class
7601 /// was updated.
7602 pub terminal_storage_class_update_time: std::option::Option<wkt::Timestamp>,
7603
7604 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
7605 }
7606
7607 impl Autoclass {
7608 /// Creates a new default instance.
7609 pub fn new() -> Self {
7610 std::default::Default::default()
7611 }
7612
7613 /// Sets the value of [enabled][crate::model::bucket::Autoclass::enabled].
7614 ///
7615 /// # Example
7616 /// ```ignore,no_run
7617 /// # use google_cloud_storage::model::bucket::Autoclass;
7618 /// let x = Autoclass::new().set_enabled(true);
7619 /// ```
7620 pub fn set_enabled<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
7621 self.enabled = v.into();
7622 self
7623 }
7624
7625 /// Sets the value of [toggle_time][crate::model::bucket::Autoclass::toggle_time].
7626 ///
7627 /// # Example
7628 /// ```ignore,no_run
7629 /// # use google_cloud_storage::model::bucket::Autoclass;
7630 /// use wkt::Timestamp;
7631 /// let x = Autoclass::new().set_toggle_time(Timestamp::default()/* use setters */);
7632 /// ```
7633 pub fn set_toggle_time<T>(mut self, v: T) -> Self
7634 where
7635 T: std::convert::Into<wkt::Timestamp>,
7636 {
7637 self.toggle_time = std::option::Option::Some(v.into());
7638 self
7639 }
7640
7641 /// Sets or clears the value of [toggle_time][crate::model::bucket::Autoclass::toggle_time].
7642 ///
7643 /// # Example
7644 /// ```ignore,no_run
7645 /// # use google_cloud_storage::model::bucket::Autoclass;
7646 /// use wkt::Timestamp;
7647 /// let x = Autoclass::new().set_or_clear_toggle_time(Some(Timestamp::default()/* use setters */));
7648 /// let x = Autoclass::new().set_or_clear_toggle_time(None::<Timestamp>);
7649 /// ```
7650 pub fn set_or_clear_toggle_time<T>(mut self, v: std::option::Option<T>) -> Self
7651 where
7652 T: std::convert::Into<wkt::Timestamp>,
7653 {
7654 self.toggle_time = v.map(|x| x.into());
7655 self
7656 }
7657
7658 /// Sets the value of [terminal_storage_class][crate::model::bucket::Autoclass::terminal_storage_class].
7659 ///
7660 /// # Example
7661 /// ```ignore,no_run
7662 /// # use google_cloud_storage::model::bucket::Autoclass;
7663 /// let x = Autoclass::new().set_terminal_storage_class("example");
7664 /// ```
7665 pub fn set_terminal_storage_class<T>(mut self, v: T) -> Self
7666 where
7667 T: std::convert::Into<std::string::String>,
7668 {
7669 self.terminal_storage_class = std::option::Option::Some(v.into());
7670 self
7671 }
7672
7673 /// Sets or clears the value of [terminal_storage_class][crate::model::bucket::Autoclass::terminal_storage_class].
7674 ///
7675 /// # Example
7676 /// ```ignore,no_run
7677 /// # use google_cloud_storage::model::bucket::Autoclass;
7678 /// let x = Autoclass::new().set_or_clear_terminal_storage_class(Some("example"));
7679 /// let x = Autoclass::new().set_or_clear_terminal_storage_class(None::<String>);
7680 /// ```
7681 pub fn set_or_clear_terminal_storage_class<T>(mut self, v: std::option::Option<T>) -> Self
7682 where
7683 T: std::convert::Into<std::string::String>,
7684 {
7685 self.terminal_storage_class = v.map(|x| x.into());
7686 self
7687 }
7688
7689 /// Sets the value of [terminal_storage_class_update_time][crate::model::bucket::Autoclass::terminal_storage_class_update_time].
7690 ///
7691 /// # Example
7692 /// ```ignore,no_run
7693 /// # use google_cloud_storage::model::bucket::Autoclass;
7694 /// use wkt::Timestamp;
7695 /// let x = Autoclass::new().set_terminal_storage_class_update_time(Timestamp::default()/* use setters */);
7696 /// ```
7697 pub fn set_terminal_storage_class_update_time<T>(mut self, v: T) -> Self
7698 where
7699 T: std::convert::Into<wkt::Timestamp>,
7700 {
7701 self.terminal_storage_class_update_time = std::option::Option::Some(v.into());
7702 self
7703 }
7704
7705 /// Sets or clears the value of [terminal_storage_class_update_time][crate::model::bucket::Autoclass::terminal_storage_class_update_time].
7706 ///
7707 /// # Example
7708 /// ```ignore,no_run
7709 /// # use google_cloud_storage::model::bucket::Autoclass;
7710 /// use wkt::Timestamp;
7711 /// let x = Autoclass::new().set_or_clear_terminal_storage_class_update_time(Some(Timestamp::default()/* use setters */));
7712 /// let x = Autoclass::new().set_or_clear_terminal_storage_class_update_time(None::<Timestamp>);
7713 /// ```
7714 pub fn set_or_clear_terminal_storage_class_update_time<T>(
7715 mut self,
7716 v: std::option::Option<T>,
7717 ) -> Self
7718 where
7719 T: std::convert::Into<wkt::Timestamp>,
7720 {
7721 self.terminal_storage_class_update_time = v.map(|x| x.into());
7722 self
7723 }
7724 }
7725
7726 impl wkt::message::Message for Autoclass {
7727 fn typename() -> &'static str {
7728 "type.googleapis.com/google.storage.v2.Bucket.Autoclass"
7729 }
7730 }
7731
7732 /// The [bucket IP
7733 /// filtering](https://cloud.google.com/storage/docs/ip-filtering-overview)
7734 /// configuration. Specifies the network sources that can access the bucket, as
7735 /// well as its underlying objects.
7736 #[derive(Clone, Default, PartialEq)]
7737 #[non_exhaustive]
7738 pub struct IpFilter {
7739 /// The state of the IP filter configuration. Valid values are `Enabled` and
7740 /// `Disabled`. When set to `Enabled`, IP filtering rules are applied to a
7741 /// bucket and all incoming requests to the bucket are evaluated against
7742 /// these rules. When set to `Disabled`, IP filtering rules are not applied
7743 /// to a bucket.
7744 pub mode: std::option::Option<std::string::String>,
7745
7746 /// Public IPs allowed to operate or access the bucket.
7747 pub public_network_source:
7748 std::option::Option<crate::model::bucket::ip_filter::PublicNetworkSource>,
7749
7750 /// Optional. The list of network sources that are allowed to access
7751 /// operations on the bucket or the underlying objects.
7752 pub vpc_network_sources: std::vec::Vec<crate::model::bucket::ip_filter::VpcNetworkSource>,
7753
7754 /// Optional. Whether or not to allow VPCs from orgs different than the
7755 /// bucket's parent org to access the bucket. When set to true, validations
7756 /// on the existence of the VPCs won't be performed. If set to false, each
7757 /// VPC network source is checked to belong to the same org as the bucket as
7758 /// well as validated for existence.
7759 pub allow_cross_org_vpcs: bool,
7760
7761 /// Whether or not to allow all P4SA access to the bucket. When set to true,
7762 /// IP filter config validation doesn't apply.
7763 pub allow_all_service_agent_access: std::option::Option<bool>,
7764
7765 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
7766 }
7767
7768 impl IpFilter {
7769 /// Creates a new default instance.
7770 pub fn new() -> Self {
7771 std::default::Default::default()
7772 }
7773
7774 /// Sets the value of [mode][crate::model::bucket::IpFilter::mode].
7775 ///
7776 /// # Example
7777 /// ```ignore,no_run
7778 /// # use google_cloud_storage::model::bucket::IpFilter;
7779 /// let x = IpFilter::new().set_mode("example");
7780 /// ```
7781 pub fn set_mode<T>(mut self, v: T) -> Self
7782 where
7783 T: std::convert::Into<std::string::String>,
7784 {
7785 self.mode = std::option::Option::Some(v.into());
7786 self
7787 }
7788
7789 /// Sets or clears the value of [mode][crate::model::bucket::IpFilter::mode].
7790 ///
7791 /// # Example
7792 /// ```ignore,no_run
7793 /// # use google_cloud_storage::model::bucket::IpFilter;
7794 /// let x = IpFilter::new().set_or_clear_mode(Some("example"));
7795 /// let x = IpFilter::new().set_or_clear_mode(None::<String>);
7796 /// ```
7797 pub fn set_or_clear_mode<T>(mut self, v: std::option::Option<T>) -> Self
7798 where
7799 T: std::convert::Into<std::string::String>,
7800 {
7801 self.mode = v.map(|x| x.into());
7802 self
7803 }
7804
7805 /// Sets the value of [public_network_source][crate::model::bucket::IpFilter::public_network_source].
7806 ///
7807 /// # Example
7808 /// ```ignore,no_run
7809 /// # use google_cloud_storage::model::bucket::IpFilter;
7810 /// use google_cloud_storage::model::bucket::ip_filter::PublicNetworkSource;
7811 /// let x = IpFilter::new().set_public_network_source(PublicNetworkSource::default()/* use setters */);
7812 /// ```
7813 pub fn set_public_network_source<T>(mut self, v: T) -> Self
7814 where
7815 T: std::convert::Into<crate::model::bucket::ip_filter::PublicNetworkSource>,
7816 {
7817 self.public_network_source = std::option::Option::Some(v.into());
7818 self
7819 }
7820
7821 /// Sets or clears the value of [public_network_source][crate::model::bucket::IpFilter::public_network_source].
7822 ///
7823 /// # Example
7824 /// ```ignore,no_run
7825 /// # use google_cloud_storage::model::bucket::IpFilter;
7826 /// use google_cloud_storage::model::bucket::ip_filter::PublicNetworkSource;
7827 /// let x = IpFilter::new().set_or_clear_public_network_source(Some(PublicNetworkSource::default()/* use setters */));
7828 /// let x = IpFilter::new().set_or_clear_public_network_source(None::<PublicNetworkSource>);
7829 /// ```
7830 pub fn set_or_clear_public_network_source<T>(mut self, v: std::option::Option<T>) -> Self
7831 where
7832 T: std::convert::Into<crate::model::bucket::ip_filter::PublicNetworkSource>,
7833 {
7834 self.public_network_source = v.map(|x| x.into());
7835 self
7836 }
7837
7838 /// Sets the value of [vpc_network_sources][crate::model::bucket::IpFilter::vpc_network_sources].
7839 ///
7840 /// # Example
7841 /// ```ignore,no_run
7842 /// # use google_cloud_storage::model::bucket::IpFilter;
7843 /// use google_cloud_storage::model::bucket::ip_filter::VpcNetworkSource;
7844 /// let x = IpFilter::new()
7845 /// .set_vpc_network_sources([
7846 /// VpcNetworkSource::default()/* use setters */,
7847 /// VpcNetworkSource::default()/* use (different) setters */,
7848 /// ]);
7849 /// ```
7850 pub fn set_vpc_network_sources<T, V>(mut self, v: T) -> Self
7851 where
7852 T: std::iter::IntoIterator<Item = V>,
7853 V: std::convert::Into<crate::model::bucket::ip_filter::VpcNetworkSource>,
7854 {
7855 use std::iter::Iterator;
7856 self.vpc_network_sources = v.into_iter().map(|i| i.into()).collect();
7857 self
7858 }
7859
7860 /// Sets the value of [allow_cross_org_vpcs][crate::model::bucket::IpFilter::allow_cross_org_vpcs].
7861 ///
7862 /// # Example
7863 /// ```ignore,no_run
7864 /// # use google_cloud_storage::model::bucket::IpFilter;
7865 /// let x = IpFilter::new().set_allow_cross_org_vpcs(true);
7866 /// ```
7867 pub fn set_allow_cross_org_vpcs<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
7868 self.allow_cross_org_vpcs = v.into();
7869 self
7870 }
7871
7872 /// Sets the value of [allow_all_service_agent_access][crate::model::bucket::IpFilter::allow_all_service_agent_access].
7873 ///
7874 /// # Example
7875 /// ```ignore,no_run
7876 /// # use google_cloud_storage::model::bucket::IpFilter;
7877 /// let x = IpFilter::new().set_allow_all_service_agent_access(true);
7878 /// ```
7879 pub fn set_allow_all_service_agent_access<T>(mut self, v: T) -> Self
7880 where
7881 T: std::convert::Into<bool>,
7882 {
7883 self.allow_all_service_agent_access = std::option::Option::Some(v.into());
7884 self
7885 }
7886
7887 /// Sets or clears the value of [allow_all_service_agent_access][crate::model::bucket::IpFilter::allow_all_service_agent_access].
7888 ///
7889 /// # Example
7890 /// ```ignore,no_run
7891 /// # use google_cloud_storage::model::bucket::IpFilter;
7892 /// let x = IpFilter::new().set_or_clear_allow_all_service_agent_access(Some(false));
7893 /// let x = IpFilter::new().set_or_clear_allow_all_service_agent_access(None::<bool>);
7894 /// ```
7895 pub fn set_or_clear_allow_all_service_agent_access<T>(
7896 mut self,
7897 v: std::option::Option<T>,
7898 ) -> Self
7899 where
7900 T: std::convert::Into<bool>,
7901 {
7902 self.allow_all_service_agent_access = v.map(|x| x.into());
7903 self
7904 }
7905 }
7906
7907 impl wkt::message::Message for IpFilter {
7908 fn typename() -> &'static str {
7909 "type.googleapis.com/google.storage.v2.Bucket.IpFilter"
7910 }
7911 }
7912
7913 /// Defines additional types related to [IpFilter].
7914 pub mod ip_filter {
7915 #[allow(unused_imports)]
7916 use super::*;
7917
7918 /// The public network IP address ranges that can access the bucket and its
7919 /// data.
7920 #[derive(Clone, Default, PartialEq)]
7921 #[non_exhaustive]
7922 pub struct PublicNetworkSource {
7923 /// Optional. The list of IPv4 and IPv6 cidr blocks that are allowed to
7924 /// operate or access the bucket and its underlying objects.
7925 pub allowed_ip_cidr_ranges: std::vec::Vec<std::string::String>,
7926
7927 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
7928 }
7929
7930 impl PublicNetworkSource {
7931 /// Creates a new default instance.
7932 pub fn new() -> Self {
7933 std::default::Default::default()
7934 }
7935
7936 /// Sets the value of [allowed_ip_cidr_ranges][crate::model::bucket::ip_filter::PublicNetworkSource::allowed_ip_cidr_ranges].
7937 ///
7938 /// # Example
7939 /// ```ignore,no_run
7940 /// # use google_cloud_storage::model::bucket::ip_filter::PublicNetworkSource;
7941 /// let x = PublicNetworkSource::new().set_allowed_ip_cidr_ranges(["a", "b", "c"]);
7942 /// ```
7943 pub fn set_allowed_ip_cidr_ranges<T, V>(mut self, v: T) -> Self
7944 where
7945 T: std::iter::IntoIterator<Item = V>,
7946 V: std::convert::Into<std::string::String>,
7947 {
7948 use std::iter::Iterator;
7949 self.allowed_ip_cidr_ranges = v.into_iter().map(|i| i.into()).collect();
7950 self
7951 }
7952 }
7953
7954 impl wkt::message::Message for PublicNetworkSource {
7955 fn typename() -> &'static str {
7956 "type.googleapis.com/google.storage.v2.Bucket.IpFilter.PublicNetworkSource"
7957 }
7958 }
7959
7960 /// The list of VPC networks that can access the bucket.
7961 #[derive(Clone, Default, PartialEq)]
7962 #[non_exhaustive]
7963 pub struct VpcNetworkSource {
7964 /// Name of the network.
7965 ///
7966 /// Format: `projects/PROJECT_ID/global/networks/NETWORK_NAME`
7967 pub network: std::option::Option<std::string::String>,
7968
7969 /// Optional. The list of public or private IPv4 and IPv6 CIDR ranges that
7970 /// can access the bucket. In the CIDR IP address block, the specified IP
7971 /// address must be properly truncated, meaning all the host bits must be
7972 /// zero or else the input is considered malformed. For example,
7973 /// `192.0.2.0/24` is accepted but `192.0.2.1/24` is not. Similarly, for
7974 /// IPv6, `2001:db8::/32` is accepted whereas `2001:db8::1/32` is not.
7975 pub allowed_ip_cidr_ranges: std::vec::Vec<std::string::String>,
7976
7977 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
7978 }
7979
7980 impl VpcNetworkSource {
7981 /// Creates a new default instance.
7982 pub fn new() -> Self {
7983 std::default::Default::default()
7984 }
7985
7986 /// Sets the value of [network][crate::model::bucket::ip_filter::VpcNetworkSource::network].
7987 ///
7988 /// # Example
7989 /// ```ignore,no_run
7990 /// # use google_cloud_storage::model::bucket::ip_filter::VpcNetworkSource;
7991 /// let x = VpcNetworkSource::new().set_network("example");
7992 /// ```
7993 pub fn set_network<T>(mut self, v: T) -> Self
7994 where
7995 T: std::convert::Into<std::string::String>,
7996 {
7997 self.network = std::option::Option::Some(v.into());
7998 self
7999 }
8000
8001 /// Sets or clears the value of [network][crate::model::bucket::ip_filter::VpcNetworkSource::network].
8002 ///
8003 /// # Example
8004 /// ```ignore,no_run
8005 /// # use google_cloud_storage::model::bucket::ip_filter::VpcNetworkSource;
8006 /// let x = VpcNetworkSource::new().set_or_clear_network(Some("example"));
8007 /// let x = VpcNetworkSource::new().set_or_clear_network(None::<String>);
8008 /// ```
8009 pub fn set_or_clear_network<T>(mut self, v: std::option::Option<T>) -> Self
8010 where
8011 T: std::convert::Into<std::string::String>,
8012 {
8013 self.network = v.map(|x| x.into());
8014 self
8015 }
8016
8017 /// Sets the value of [allowed_ip_cidr_ranges][crate::model::bucket::ip_filter::VpcNetworkSource::allowed_ip_cidr_ranges].
8018 ///
8019 /// # Example
8020 /// ```ignore,no_run
8021 /// # use google_cloud_storage::model::bucket::ip_filter::VpcNetworkSource;
8022 /// let x = VpcNetworkSource::new().set_allowed_ip_cidr_ranges(["a", "b", "c"]);
8023 /// ```
8024 pub fn set_allowed_ip_cidr_ranges<T, V>(mut self, v: T) -> Self
8025 where
8026 T: std::iter::IntoIterator<Item = V>,
8027 V: std::convert::Into<std::string::String>,
8028 {
8029 use std::iter::Iterator;
8030 self.allowed_ip_cidr_ranges = v.into_iter().map(|i| i.into()).collect();
8031 self
8032 }
8033 }
8034
8035 impl wkt::message::Message for VpcNetworkSource {
8036 fn typename() -> &'static str {
8037 "type.googleapis.com/google.storage.v2.Bucket.IpFilter.VpcNetworkSource"
8038 }
8039 }
8040 }
8041
8042 /// Configuration for a bucket's hierarchical namespace feature.
8043 #[derive(Clone, Default, PartialEq)]
8044 #[non_exhaustive]
8045 pub struct HierarchicalNamespace {
8046 /// Optional. Enables the hierarchical namespace feature.
8047 pub enabled: bool,
8048
8049 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
8050 }
8051
8052 impl HierarchicalNamespace {
8053 /// Creates a new default instance.
8054 pub fn new() -> Self {
8055 std::default::Default::default()
8056 }
8057
8058 /// Sets the value of [enabled][crate::model::bucket::HierarchicalNamespace::enabled].
8059 ///
8060 /// # Example
8061 /// ```ignore,no_run
8062 /// # use google_cloud_storage::model::bucket::HierarchicalNamespace;
8063 /// let x = HierarchicalNamespace::new().set_enabled(true);
8064 /// ```
8065 pub fn set_enabled<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
8066 self.enabled = v.into();
8067 self
8068 }
8069 }
8070
8071 impl wkt::message::Message for HierarchicalNamespace {
8072 fn typename() -> &'static str {
8073 "type.googleapis.com/google.storage.v2.Bucket.HierarchicalNamespace"
8074 }
8075 }
8076}
8077
8078/// An access-control entry.
8079#[derive(Clone, Default, PartialEq)]
8080#[non_exhaustive]
8081pub struct BucketAccessControl {
8082 /// Optional. The access permission for the entity.
8083 pub role: std::string::String,
8084
8085 /// Optional. The ID of the access-control entry.
8086 pub id: std::string::String,
8087
8088 /// Optional. The entity holding the permission, in one of the following forms:
8089 ///
8090 /// * `user-{userid}`
8091 /// * `user-{email}`
8092 /// * `group-{groupid}`
8093 /// * `group-{email}`
8094 /// * `domain-{domain}`
8095 /// * `project-{team}-{projectnumber}`
8096 /// * `project-{team}-{projectid}`
8097 /// * `allUsers`
8098 /// * `allAuthenticatedUsers`
8099 /// Examples:
8100 /// * The user `liz@example.com` would be `user-liz@example.com`.
8101 /// * The group `example@googlegroups.com` would be
8102 /// `group-example@googlegroups.com`
8103 /// * All members of the Google Apps for Business domain `example.com` would be
8104 /// `domain-example.com`
8105 /// For project entities, `project-{team}-{projectnumber}` format is
8106 /// returned on response.
8107 pub entity: std::string::String,
8108
8109 /// Output only. The alternative entity format, if exists. For project
8110 /// entities, `project-{team}-{projectid}` format is returned in the response.
8111 pub entity_alt: std::string::String,
8112
8113 /// Optional. The ID for the entity, if any.
8114 pub entity_id: std::string::String,
8115
8116 /// Optional. The `etag` of the `BucketAccessControl`.
8117 /// If included in the metadata of an update or delete request message, the
8118 /// operation operation is only performed if the etag matches that of the
8119 /// bucket's `BucketAccessControl`.
8120 pub etag: std::string::String,
8121
8122 /// Optional. The email address associated with the entity, if any.
8123 pub email: std::string::String,
8124
8125 /// Optional. The domain associated with the entity, if any.
8126 pub domain: std::string::String,
8127
8128 /// Optional. The project team associated with the entity, if any.
8129 pub project_team: std::option::Option<crate::model::ProjectTeam>,
8130
8131 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
8132}
8133
8134impl BucketAccessControl {
8135 /// Creates a new default instance.
8136 pub fn new() -> Self {
8137 std::default::Default::default()
8138 }
8139
8140 /// Sets the value of [role][crate::model::BucketAccessControl::role].
8141 ///
8142 /// # Example
8143 /// ```ignore,no_run
8144 /// # use google_cloud_storage::model::BucketAccessControl;
8145 /// let x = BucketAccessControl::new().set_role("example");
8146 /// ```
8147 pub fn set_role<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
8148 self.role = v.into();
8149 self
8150 }
8151
8152 /// Sets the value of [id][crate::model::BucketAccessControl::id].
8153 ///
8154 /// # Example
8155 /// ```ignore,no_run
8156 /// # use google_cloud_storage::model::BucketAccessControl;
8157 /// let x = BucketAccessControl::new().set_id("example");
8158 /// ```
8159 pub fn set_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
8160 self.id = v.into();
8161 self
8162 }
8163
8164 /// Sets the value of [entity][crate::model::BucketAccessControl::entity].
8165 ///
8166 /// # Example
8167 /// ```ignore,no_run
8168 /// # use google_cloud_storage::model::BucketAccessControl;
8169 /// let x = BucketAccessControl::new().set_entity("example");
8170 /// ```
8171 pub fn set_entity<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
8172 self.entity = v.into();
8173 self
8174 }
8175
8176 /// Sets the value of [entity_alt][crate::model::BucketAccessControl::entity_alt].
8177 ///
8178 /// # Example
8179 /// ```ignore,no_run
8180 /// # use google_cloud_storage::model::BucketAccessControl;
8181 /// let x = BucketAccessControl::new().set_entity_alt("example");
8182 /// ```
8183 pub fn set_entity_alt<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
8184 self.entity_alt = v.into();
8185 self
8186 }
8187
8188 /// Sets the value of [entity_id][crate::model::BucketAccessControl::entity_id].
8189 ///
8190 /// # Example
8191 /// ```ignore,no_run
8192 /// # use google_cloud_storage::model::BucketAccessControl;
8193 /// let x = BucketAccessControl::new().set_entity_id("example");
8194 /// ```
8195 pub fn set_entity_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
8196 self.entity_id = v.into();
8197 self
8198 }
8199
8200 /// Sets the value of [etag][crate::model::BucketAccessControl::etag].
8201 ///
8202 /// # Example
8203 /// ```ignore,no_run
8204 /// # use google_cloud_storage::model::BucketAccessControl;
8205 /// let x = BucketAccessControl::new().set_etag("example");
8206 /// ```
8207 pub fn set_etag<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
8208 self.etag = v.into();
8209 self
8210 }
8211
8212 /// Sets the value of [email][crate::model::BucketAccessControl::email].
8213 ///
8214 /// # Example
8215 /// ```ignore,no_run
8216 /// # use google_cloud_storage::model::BucketAccessControl;
8217 /// let x = BucketAccessControl::new().set_email("example");
8218 /// ```
8219 pub fn set_email<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
8220 self.email = v.into();
8221 self
8222 }
8223
8224 /// Sets the value of [domain][crate::model::BucketAccessControl::domain].
8225 ///
8226 /// # Example
8227 /// ```ignore,no_run
8228 /// # use google_cloud_storage::model::BucketAccessControl;
8229 /// let x = BucketAccessControl::new().set_domain("example");
8230 /// ```
8231 pub fn set_domain<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
8232 self.domain = v.into();
8233 self
8234 }
8235
8236 /// Sets the value of [project_team][crate::model::BucketAccessControl::project_team].
8237 ///
8238 /// # Example
8239 /// ```ignore,no_run
8240 /// # use google_cloud_storage::model::BucketAccessControl;
8241 /// use google_cloud_storage::model::ProjectTeam;
8242 /// let x = BucketAccessControl::new().set_project_team(ProjectTeam::default()/* use setters */);
8243 /// ```
8244 pub fn set_project_team<T>(mut self, v: T) -> Self
8245 where
8246 T: std::convert::Into<crate::model::ProjectTeam>,
8247 {
8248 self.project_team = std::option::Option::Some(v.into());
8249 self
8250 }
8251
8252 /// Sets or clears the value of [project_team][crate::model::BucketAccessControl::project_team].
8253 ///
8254 /// # Example
8255 /// ```ignore,no_run
8256 /// # use google_cloud_storage::model::BucketAccessControl;
8257 /// use google_cloud_storage::model::ProjectTeam;
8258 /// let x = BucketAccessControl::new().set_or_clear_project_team(Some(ProjectTeam::default()/* use setters */));
8259 /// let x = BucketAccessControl::new().set_or_clear_project_team(None::<ProjectTeam>);
8260 /// ```
8261 pub fn set_or_clear_project_team<T>(mut self, v: std::option::Option<T>) -> Self
8262 where
8263 T: std::convert::Into<crate::model::ProjectTeam>,
8264 {
8265 self.project_team = v.map(|x| x.into());
8266 self
8267 }
8268}
8269
8270impl wkt::message::Message for BucketAccessControl {
8271 fn typename() -> &'static str {
8272 "type.googleapis.com/google.storage.v2.BucketAccessControl"
8273 }
8274}
8275
8276/// Message used for storing full (not subrange) object checksums.
8277#[derive(Clone, Default, PartialEq)]
8278#[non_exhaustive]
8279pub struct ObjectChecksums {
8280 /// CRC32C digest of the object data. Computed by the Cloud Storage service for
8281 /// all written objects.
8282 /// If set in a WriteObjectRequest, service validates that the stored
8283 /// object matches this checksum.
8284 pub crc32c: std::option::Option<u32>,
8285
8286 /// Optional. 128 bit MD5 hash of the object data. For more information about
8287 /// using the MD5 hash, see [Data validation and change
8288 /// detection](https://cloud.google.com/storage/docs/data-validation). Not all
8289 /// objects provide an MD5 hash. For example, composite objects provide only
8290 /// crc32c hashes. This value is equivalent to running `cat object.txt |
8291 /// openssl md5 -binary`
8292 pub md5_hash: ::bytes::Bytes,
8293
8294 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
8295}
8296
8297impl ObjectChecksums {
8298 /// Creates a new default instance.
8299 pub fn new() -> Self {
8300 std::default::Default::default()
8301 }
8302
8303 /// Sets the value of [crc32c][crate::model::ObjectChecksums::crc32c].
8304 ///
8305 /// # Example
8306 /// ```ignore,no_run
8307 /// # use google_cloud_storage::model::ObjectChecksums;
8308 /// let x = ObjectChecksums::new().set_crc32c(42_u32);
8309 /// ```
8310 pub fn set_crc32c<T>(mut self, v: T) -> Self
8311 where
8312 T: std::convert::Into<u32>,
8313 {
8314 self.crc32c = std::option::Option::Some(v.into());
8315 self
8316 }
8317
8318 /// Sets or clears the value of [crc32c][crate::model::ObjectChecksums::crc32c].
8319 ///
8320 /// # Example
8321 /// ```ignore,no_run
8322 /// # use google_cloud_storage::model::ObjectChecksums;
8323 /// let x = ObjectChecksums::new().set_or_clear_crc32c(Some(42_u32));
8324 /// let x = ObjectChecksums::new().set_or_clear_crc32c(None::<u32>);
8325 /// ```
8326 pub fn set_or_clear_crc32c<T>(mut self, v: std::option::Option<T>) -> Self
8327 where
8328 T: std::convert::Into<u32>,
8329 {
8330 self.crc32c = v.map(|x| x.into());
8331 self
8332 }
8333
8334 /// Sets the value of [md5_hash][crate::model::ObjectChecksums::md5_hash].
8335 ///
8336 /// # Example
8337 /// ```ignore,no_run
8338 /// # use google_cloud_storage::model::ObjectChecksums;
8339 /// let x = ObjectChecksums::new().set_md5_hash(bytes::Bytes::from_static(b"example"));
8340 /// ```
8341 pub fn set_md5_hash<T: std::convert::Into<::bytes::Bytes>>(mut self, v: T) -> Self {
8342 self.md5_hash = v.into();
8343 self
8344 }
8345}
8346
8347impl wkt::message::Message for ObjectChecksums {
8348 fn typename() -> &'static str {
8349 "type.googleapis.com/google.storage.v2.ObjectChecksums"
8350 }
8351}
8352
8353/// The payload of a single user-defined object context.
8354#[derive(Clone, Default, PartialEq)]
8355#[non_exhaustive]
8356pub struct ObjectCustomContextPayload {
8357 /// Required. The value of the object context.
8358 pub value: std::string::String,
8359
8360 /// Output only. The time at which the object context was created.
8361 pub create_time: std::option::Option<wkt::Timestamp>,
8362
8363 /// Output only. The time at which the object context was last updated.
8364 pub update_time: std::option::Option<wkt::Timestamp>,
8365
8366 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
8367}
8368
8369impl ObjectCustomContextPayload {
8370 /// Creates a new default instance.
8371 pub fn new() -> Self {
8372 std::default::Default::default()
8373 }
8374
8375 /// Sets the value of [value][crate::model::ObjectCustomContextPayload::value].
8376 ///
8377 /// # Example
8378 /// ```ignore,no_run
8379 /// # use google_cloud_storage::model::ObjectCustomContextPayload;
8380 /// let x = ObjectCustomContextPayload::new().set_value("example");
8381 /// ```
8382 pub fn set_value<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
8383 self.value = v.into();
8384 self
8385 }
8386
8387 /// Sets the value of [create_time][crate::model::ObjectCustomContextPayload::create_time].
8388 ///
8389 /// # Example
8390 /// ```ignore,no_run
8391 /// # use google_cloud_storage::model::ObjectCustomContextPayload;
8392 /// use wkt::Timestamp;
8393 /// let x = ObjectCustomContextPayload::new().set_create_time(Timestamp::default()/* use setters */);
8394 /// ```
8395 pub fn set_create_time<T>(mut self, v: T) -> Self
8396 where
8397 T: std::convert::Into<wkt::Timestamp>,
8398 {
8399 self.create_time = std::option::Option::Some(v.into());
8400 self
8401 }
8402
8403 /// Sets or clears the value of [create_time][crate::model::ObjectCustomContextPayload::create_time].
8404 ///
8405 /// # Example
8406 /// ```ignore,no_run
8407 /// # use google_cloud_storage::model::ObjectCustomContextPayload;
8408 /// use wkt::Timestamp;
8409 /// let x = ObjectCustomContextPayload::new().set_or_clear_create_time(Some(Timestamp::default()/* use setters */));
8410 /// let x = ObjectCustomContextPayload::new().set_or_clear_create_time(None::<Timestamp>);
8411 /// ```
8412 pub fn set_or_clear_create_time<T>(mut self, v: std::option::Option<T>) -> Self
8413 where
8414 T: std::convert::Into<wkt::Timestamp>,
8415 {
8416 self.create_time = v.map(|x| x.into());
8417 self
8418 }
8419
8420 /// Sets the value of [update_time][crate::model::ObjectCustomContextPayload::update_time].
8421 ///
8422 /// # Example
8423 /// ```ignore,no_run
8424 /// # use google_cloud_storage::model::ObjectCustomContextPayload;
8425 /// use wkt::Timestamp;
8426 /// let x = ObjectCustomContextPayload::new().set_update_time(Timestamp::default()/* use setters */);
8427 /// ```
8428 pub fn set_update_time<T>(mut self, v: T) -> Self
8429 where
8430 T: std::convert::Into<wkt::Timestamp>,
8431 {
8432 self.update_time = std::option::Option::Some(v.into());
8433 self
8434 }
8435
8436 /// Sets or clears the value of [update_time][crate::model::ObjectCustomContextPayload::update_time].
8437 ///
8438 /// # Example
8439 /// ```ignore,no_run
8440 /// # use google_cloud_storage::model::ObjectCustomContextPayload;
8441 /// use wkt::Timestamp;
8442 /// let x = ObjectCustomContextPayload::new().set_or_clear_update_time(Some(Timestamp::default()/* use setters */));
8443 /// let x = ObjectCustomContextPayload::new().set_or_clear_update_time(None::<Timestamp>);
8444 /// ```
8445 pub fn set_or_clear_update_time<T>(mut self, v: std::option::Option<T>) -> Self
8446 where
8447 T: std::convert::Into<wkt::Timestamp>,
8448 {
8449 self.update_time = v.map(|x| x.into());
8450 self
8451 }
8452}
8453
8454impl wkt::message::Message for ObjectCustomContextPayload {
8455 fn typename() -> &'static str {
8456 "type.googleapis.com/google.storage.v2.ObjectCustomContextPayload"
8457 }
8458}
8459
8460/// All contexts of an object grouped by type.
8461#[derive(Clone, Default, PartialEq)]
8462#[non_exhaustive]
8463pub struct ObjectContexts {
8464 /// Optional. User-defined object contexts.
8465 /// The maximum key or value size is `256` characters.
8466 /// The maximum number of entries is `50`.
8467 /// The maximum total serialized size of all entries is `25KiB`.
8468 pub custom:
8469 std::collections::HashMap<std::string::String, crate::model::ObjectCustomContextPayload>,
8470
8471 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
8472}
8473
8474impl ObjectContexts {
8475 /// Creates a new default instance.
8476 pub fn new() -> Self {
8477 std::default::Default::default()
8478 }
8479
8480 /// Sets the value of [custom][crate::model::ObjectContexts::custom].
8481 ///
8482 /// # Example
8483 /// ```ignore,no_run
8484 /// # use google_cloud_storage::model::ObjectContexts;
8485 /// use google_cloud_storage::model::ObjectCustomContextPayload;
8486 /// let x = ObjectContexts::new().set_custom([
8487 /// ("key0", ObjectCustomContextPayload::default()/* use setters */),
8488 /// ("key1", ObjectCustomContextPayload::default()/* use (different) setters */),
8489 /// ]);
8490 /// ```
8491 pub fn set_custom<T, K, V>(mut self, v: T) -> Self
8492 where
8493 T: std::iter::IntoIterator<Item = (K, V)>,
8494 K: std::convert::Into<std::string::String>,
8495 V: std::convert::Into<crate::model::ObjectCustomContextPayload>,
8496 {
8497 use std::iter::Iterator;
8498 self.custom = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
8499 self
8500 }
8501}
8502
8503impl wkt::message::Message for ObjectContexts {
8504 fn typename() -> &'static str {
8505 "type.googleapis.com/google.storage.v2.ObjectContexts"
8506 }
8507}
8508
8509/// Describes the customer-supplied encryption key mechanism used to store an
8510/// object's data at rest.
8511#[derive(Clone, Default, PartialEq)]
8512#[non_exhaustive]
8513pub struct CustomerEncryption {
8514 /// Optional. The encryption algorithm.
8515 pub encryption_algorithm: std::string::String,
8516
8517 /// Optional. SHA256 hash value of the encryption key.
8518 /// In raw bytes format (not base64-encoded).
8519 pub key_sha256_bytes: ::bytes::Bytes,
8520
8521 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
8522}
8523
8524impl CustomerEncryption {
8525 /// Creates a new default instance.
8526 pub fn new() -> Self {
8527 std::default::Default::default()
8528 }
8529
8530 /// Sets the value of [encryption_algorithm][crate::model::CustomerEncryption::encryption_algorithm].
8531 ///
8532 /// # Example
8533 /// ```ignore,no_run
8534 /// # use google_cloud_storage::model::CustomerEncryption;
8535 /// let x = CustomerEncryption::new().set_encryption_algorithm("example");
8536 /// ```
8537 pub fn set_encryption_algorithm<T: std::convert::Into<std::string::String>>(
8538 mut self,
8539 v: T,
8540 ) -> Self {
8541 self.encryption_algorithm = v.into();
8542 self
8543 }
8544
8545 /// Sets the value of [key_sha256_bytes][crate::model::CustomerEncryption::key_sha256_bytes].
8546 ///
8547 /// # Example
8548 /// ```ignore,no_run
8549 /// # use google_cloud_storage::model::CustomerEncryption;
8550 /// let x = CustomerEncryption::new().set_key_sha256_bytes(bytes::Bytes::from_static(b"example"));
8551 /// ```
8552 pub fn set_key_sha256_bytes<T: std::convert::Into<::bytes::Bytes>>(mut self, v: T) -> Self {
8553 self.key_sha256_bytes = v.into();
8554 self
8555 }
8556}
8557
8558impl wkt::message::Message for CustomerEncryption {
8559 fn typename() -> &'static str {
8560 "type.googleapis.com/google.storage.v2.CustomerEncryption"
8561 }
8562}
8563
8564/// An object.
8565#[derive(Clone, Default, PartialEq)]
8566#[non_exhaustive]
8567pub struct Object {
8568 /// Immutable. The name of this object. Nearly any sequence of unicode
8569 /// characters is valid. See
8570 /// [Guidelines](https://cloud.google.com/storage/docs/objects#naming).
8571 /// Example: `test.txt`
8572 /// The `name` field by itself does not uniquely identify a Cloud Storage
8573 /// object. A Cloud Storage object is uniquely identified by the tuple of
8574 /// (bucket, object, generation).
8575 pub name: std::string::String,
8576
8577 /// Immutable. The name of the bucket containing this object.
8578 pub bucket: std::string::String,
8579
8580 /// Optional. The `etag` of an object.
8581 /// If included in the metadata of an update or delete request message, the
8582 /// operation is only performed if the etag matches that of the live
8583 /// object.
8584 pub etag: std::string::String,
8585
8586 /// Immutable. The content generation of this object. Used for object
8587 /// versioning.
8588 pub generation: i64,
8589
8590 /// Output only. Restore token used to differentiate deleted objects with the
8591 /// same name and generation. This field is output only, and only set for
8592 /// deleted objects in HNS buckets.
8593 pub restore_token: std::option::Option<std::string::String>,
8594
8595 /// Output only. The version of the metadata for this generation of this
8596 /// object. Used for preconditions and for detecting changes in metadata. A
8597 /// metageneration number is only meaningful in the context of a particular
8598 /// generation of a particular object.
8599 pub metageneration: i64,
8600
8601 /// Optional. Storage class of the object.
8602 pub storage_class: std::string::String,
8603
8604 /// Output only. Content-Length of the object data in bytes, matching
8605 /// [RFC 7230 §3.3.2](<https://tools.ietf.org/html/rfc7230#section-3.3.2>]).
8606 pub size: i64,
8607
8608 /// Optional. Content-Encoding of the object data, matching
8609 /// [RFC 7231 §3.1.2.2](https://tools.ietf.org/html/rfc7231#section-3.1.2.2)
8610 pub content_encoding: std::string::String,
8611
8612 /// Optional. Content-Disposition of the object data, matching
8613 /// [RFC 6266](https://tools.ietf.org/html/rfc6266).
8614 pub content_disposition: std::string::String,
8615
8616 /// Optional. Cache-Control directive for the object data, matching
8617 /// [RFC 7234 §5.2](https://tools.ietf.org/html/rfc7234#section-5.2).
8618 /// If omitted, and the object is accessible to all anonymous users, the
8619 /// default is `public, max-age=3600`.
8620 pub cache_control: std::string::String,
8621
8622 /// Optional. Access controls on the object.
8623 /// If `iam_config.uniform_bucket_level_access` is enabled on the parent
8624 /// bucket, requests to set, read, or modify acl is an error.
8625 pub acl: std::vec::Vec<crate::model::ObjectAccessControl>,
8626
8627 /// Optional. Content-Language of the object data, matching
8628 /// [RFC 7231 §3.1.3.2](https://tools.ietf.org/html/rfc7231#section-3.1.3.2).
8629 pub content_language: std::string::String,
8630
8631 /// Output only. If this object is noncurrent, this is the time when the object
8632 /// became noncurrent.
8633 pub delete_time: std::option::Option<wkt::Timestamp>,
8634
8635 /// Output only. The time when the object was finalized.
8636 pub finalize_time: std::option::Option<wkt::Timestamp>,
8637
8638 /// Optional. Content-Type of the object data, matching
8639 /// [RFC 7231 §3.1.1.5](https://tools.ietf.org/html/rfc7231#section-3.1.1.5).
8640 /// If an object is stored without a Content-Type, it is served as
8641 /// `application/octet-stream`.
8642 pub content_type: std::string::String,
8643
8644 /// Output only. The creation time of the object.
8645 pub create_time: std::option::Option<wkt::Timestamp>,
8646
8647 /// Output only. Number of underlying components that make up this object.
8648 /// Components are accumulated by compose operations.
8649 pub component_count: i32,
8650
8651 /// Output only. Hashes for the data part of this object. This field is used
8652 /// for output only and is silently ignored if provided in requests. The
8653 /// checksums of the complete object regardless of data range. If the object is
8654 /// downloaded in full, the client should compute one of these checksums over
8655 /// the downloaded object and compare it against the value provided here.
8656 pub checksums: std::option::Option<crate::model::ObjectChecksums>,
8657
8658 /// Output only. The modification time of the object metadata.
8659 /// Set initially to object creation time and then updated whenever any
8660 /// metadata of the object changes. This includes changes made by a requester,
8661 /// such as modifying custom metadata, as well as changes made by Cloud Storage
8662 /// on behalf of a requester, such as changing the storage class based on an
8663 /// Object Lifecycle Configuration.
8664 pub update_time: std::option::Option<wkt::Timestamp>,
8665
8666 /// Optional. Cloud KMS Key used to encrypt this object, if the object is
8667 /// encrypted by such a key.
8668 pub kms_key: std::string::String,
8669
8670 /// Output only. The time at which the object's storage class was last changed.
8671 /// When the object is initially created, it is set to `time_created`.
8672 pub update_storage_class_time: std::option::Option<wkt::Timestamp>,
8673
8674 /// Optional. Whether an object is under temporary hold. While this flag is set
8675 /// to true, the object is protected against deletion and overwrites. A common
8676 /// use case of this flag is regulatory investigations where objects need to be
8677 /// retained while the investigation is ongoing. Note that unlike event-based
8678 /// hold, temporary hold does not impact retention expiration time of an
8679 /// object.
8680 pub temporary_hold: bool,
8681
8682 /// Optional. A server-determined value that specifies the earliest time that
8683 /// the object's retention period expires. Note 1: This field is not provided
8684 /// for objects with an active event-based hold, since retention expiration is
8685 /// unknown until the hold is removed. Note 2: This value can be provided even
8686 /// when temporary hold is set (so that the user can reason about policy
8687 /// without having to first unset the temporary hold).
8688 pub retention_expire_time: std::option::Option<wkt::Timestamp>,
8689
8690 /// Optional. User-provided metadata, in key/value pairs.
8691 pub metadata: std::collections::HashMap<std::string::String, std::string::String>,
8692
8693 /// Optional. User-defined or system-defined object contexts. Each object
8694 /// context is a key-payload pair, where the key provides the identification
8695 /// and the payload holds the associated value and additional metadata.
8696 pub contexts: std::option::Option<crate::model::ObjectContexts>,
8697
8698 /// Whether an object is under event-based hold.
8699 /// An event-based hold is a way to force the retention of an object until
8700 /// after some event occurs. Once the hold is released by explicitly setting
8701 /// this field to `false`, the object becomes subject to any bucket-level
8702 /// retention policy, except that the retention duration is calculated
8703 /// from the time the event based hold was lifted, rather than the time the
8704 /// object was created.
8705 ///
8706 /// In a `WriteObject` request, not setting this field implies that the value
8707 /// should be taken from the parent bucket's `default_event_based_hold` field.
8708 /// In a response, this field is always set to `true` or `false`.
8709 pub event_based_hold: std::option::Option<bool>,
8710
8711 /// Output only. The owner of the object. This is always the uploader of the
8712 /// object.
8713 pub owner: std::option::Option<crate::model::Owner>,
8714
8715 /// Optional. Metadata of customer-supplied encryption key, if the object is
8716 /// encrypted by such a key.
8717 pub customer_encryption: std::option::Option<crate::model::CustomerEncryption>,
8718
8719 /// Optional. A user-specified timestamp set on an object.
8720 pub custom_time: std::option::Option<wkt::Timestamp>,
8721
8722 /// Output only. This is the time when the object became soft-deleted.
8723 ///
8724 /// Soft-deleted objects are only accessible if a soft_delete_policy is
8725 /// enabled. Also see `hard_delete_time`.
8726 pub soft_delete_time: std::option::Option<wkt::Timestamp>,
8727
8728 /// Output only. The time when the object is permanently deleted.
8729 ///
8730 /// Only set when an object becomes soft-deleted with a `soft_delete_policy`.
8731 /// Otherwise, the object is not accessible.
8732 pub hard_delete_time: std::option::Option<wkt::Timestamp>,
8733
8734 /// Optional. Retention configuration of this object.
8735 /// Might only be configured if the bucket has object retention enabled.
8736 pub retention: std::option::Option<crate::model::object::Retention>,
8737
8738 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
8739}
8740
8741impl Object {
8742 /// Creates a new default instance.
8743 pub fn new() -> Self {
8744 std::default::Default::default()
8745 }
8746
8747 /// Sets the value of [name][crate::model::Object::name].
8748 ///
8749 /// # Example
8750 /// ```ignore,no_run
8751 /// # use google_cloud_storage::model::Object;
8752 /// let x = Object::new().set_name("example");
8753 /// ```
8754 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
8755 self.name = v.into();
8756 self
8757 }
8758
8759 /// Sets the value of [bucket][crate::model::Object::bucket].
8760 ///
8761 /// # Example
8762 /// ```ignore,no_run
8763 /// # use google_cloud_storage::model::Object;
8764 /// # let project_id = "project_id";
8765 /// # let bucket_id = "bucket_id";
8766 /// let x = Object::new().set_bucket(format!("projects/{project_id}/buckets/{bucket_id}"));
8767 /// ```
8768 pub fn set_bucket<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
8769 self.bucket = v.into();
8770 self
8771 }
8772
8773 /// Sets the value of [etag][crate::model::Object::etag].
8774 ///
8775 /// # Example
8776 /// ```ignore,no_run
8777 /// # use google_cloud_storage::model::Object;
8778 /// let x = Object::new().set_etag("example");
8779 /// ```
8780 pub fn set_etag<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
8781 self.etag = v.into();
8782 self
8783 }
8784
8785 /// Sets the value of [generation][crate::model::Object::generation].
8786 ///
8787 /// # Example
8788 /// ```ignore,no_run
8789 /// # use google_cloud_storage::model::Object;
8790 /// let x = Object::new().set_generation(42);
8791 /// ```
8792 pub fn set_generation<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
8793 self.generation = v.into();
8794 self
8795 }
8796
8797 /// Sets the value of [restore_token][crate::model::Object::restore_token].
8798 ///
8799 /// # Example
8800 /// ```ignore,no_run
8801 /// # use google_cloud_storage::model::Object;
8802 /// let x = Object::new().set_restore_token("example");
8803 /// ```
8804 pub fn set_restore_token<T>(mut self, v: T) -> Self
8805 where
8806 T: std::convert::Into<std::string::String>,
8807 {
8808 self.restore_token = std::option::Option::Some(v.into());
8809 self
8810 }
8811
8812 /// Sets or clears the value of [restore_token][crate::model::Object::restore_token].
8813 ///
8814 /// # Example
8815 /// ```ignore,no_run
8816 /// # use google_cloud_storage::model::Object;
8817 /// let x = Object::new().set_or_clear_restore_token(Some("example"));
8818 /// let x = Object::new().set_or_clear_restore_token(None::<String>);
8819 /// ```
8820 pub fn set_or_clear_restore_token<T>(mut self, v: std::option::Option<T>) -> Self
8821 where
8822 T: std::convert::Into<std::string::String>,
8823 {
8824 self.restore_token = v.map(|x| x.into());
8825 self
8826 }
8827
8828 /// Sets the value of [metageneration][crate::model::Object::metageneration].
8829 ///
8830 /// # Example
8831 /// ```ignore,no_run
8832 /// # use google_cloud_storage::model::Object;
8833 /// let x = Object::new().set_metageneration(42);
8834 /// ```
8835 pub fn set_metageneration<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
8836 self.metageneration = v.into();
8837 self
8838 }
8839
8840 /// Sets the value of [storage_class][crate::model::Object::storage_class].
8841 ///
8842 /// # Example
8843 /// ```ignore,no_run
8844 /// # use google_cloud_storage::model::Object;
8845 /// let x = Object::new().set_storage_class("example");
8846 /// ```
8847 pub fn set_storage_class<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
8848 self.storage_class = v.into();
8849 self
8850 }
8851
8852 /// Sets the value of [size][crate::model::Object::size].
8853 ///
8854 /// # Example
8855 /// ```ignore,no_run
8856 /// # use google_cloud_storage::model::Object;
8857 /// let x = Object::new().set_size(42);
8858 /// ```
8859 pub fn set_size<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
8860 self.size = v.into();
8861 self
8862 }
8863
8864 /// Sets the value of [content_encoding][crate::model::Object::content_encoding].
8865 ///
8866 /// # Example
8867 /// ```ignore,no_run
8868 /// # use google_cloud_storage::model::Object;
8869 /// let x = Object::new().set_content_encoding("example");
8870 /// ```
8871 pub fn set_content_encoding<T: std::convert::Into<std::string::String>>(
8872 mut self,
8873 v: T,
8874 ) -> Self {
8875 self.content_encoding = v.into();
8876 self
8877 }
8878
8879 /// Sets the value of [content_disposition][crate::model::Object::content_disposition].
8880 ///
8881 /// # Example
8882 /// ```ignore,no_run
8883 /// # use google_cloud_storage::model::Object;
8884 /// let x = Object::new().set_content_disposition("example");
8885 /// ```
8886 pub fn set_content_disposition<T: std::convert::Into<std::string::String>>(
8887 mut self,
8888 v: T,
8889 ) -> Self {
8890 self.content_disposition = v.into();
8891 self
8892 }
8893
8894 /// Sets the value of [cache_control][crate::model::Object::cache_control].
8895 ///
8896 /// # Example
8897 /// ```ignore,no_run
8898 /// # use google_cloud_storage::model::Object;
8899 /// let x = Object::new().set_cache_control("example");
8900 /// ```
8901 pub fn set_cache_control<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
8902 self.cache_control = v.into();
8903 self
8904 }
8905
8906 /// Sets the value of [acl][crate::model::Object::acl].
8907 ///
8908 /// # Example
8909 /// ```ignore,no_run
8910 /// # use google_cloud_storage::model::Object;
8911 /// use google_cloud_storage::model::ObjectAccessControl;
8912 /// let x = Object::new()
8913 /// .set_acl([
8914 /// ObjectAccessControl::default()/* use setters */,
8915 /// ObjectAccessControl::default()/* use (different) setters */,
8916 /// ]);
8917 /// ```
8918 pub fn set_acl<T, V>(mut self, v: T) -> Self
8919 where
8920 T: std::iter::IntoIterator<Item = V>,
8921 V: std::convert::Into<crate::model::ObjectAccessControl>,
8922 {
8923 use std::iter::Iterator;
8924 self.acl = v.into_iter().map(|i| i.into()).collect();
8925 self
8926 }
8927
8928 /// Sets the value of [content_language][crate::model::Object::content_language].
8929 ///
8930 /// # Example
8931 /// ```ignore,no_run
8932 /// # use google_cloud_storage::model::Object;
8933 /// let x = Object::new().set_content_language("example");
8934 /// ```
8935 pub fn set_content_language<T: std::convert::Into<std::string::String>>(
8936 mut self,
8937 v: T,
8938 ) -> Self {
8939 self.content_language = v.into();
8940 self
8941 }
8942
8943 /// Sets the value of [delete_time][crate::model::Object::delete_time].
8944 ///
8945 /// # Example
8946 /// ```ignore,no_run
8947 /// # use google_cloud_storage::model::Object;
8948 /// use wkt::Timestamp;
8949 /// let x = Object::new().set_delete_time(Timestamp::default()/* use setters */);
8950 /// ```
8951 pub fn set_delete_time<T>(mut self, v: T) -> Self
8952 where
8953 T: std::convert::Into<wkt::Timestamp>,
8954 {
8955 self.delete_time = std::option::Option::Some(v.into());
8956 self
8957 }
8958
8959 /// Sets or clears the value of [delete_time][crate::model::Object::delete_time].
8960 ///
8961 /// # Example
8962 /// ```ignore,no_run
8963 /// # use google_cloud_storage::model::Object;
8964 /// use wkt::Timestamp;
8965 /// let x = Object::new().set_or_clear_delete_time(Some(Timestamp::default()/* use setters */));
8966 /// let x = Object::new().set_or_clear_delete_time(None::<Timestamp>);
8967 /// ```
8968 pub fn set_or_clear_delete_time<T>(mut self, v: std::option::Option<T>) -> Self
8969 where
8970 T: std::convert::Into<wkt::Timestamp>,
8971 {
8972 self.delete_time = v.map(|x| x.into());
8973 self
8974 }
8975
8976 /// Sets the value of [finalize_time][crate::model::Object::finalize_time].
8977 ///
8978 /// # Example
8979 /// ```ignore,no_run
8980 /// # use google_cloud_storage::model::Object;
8981 /// use wkt::Timestamp;
8982 /// let x = Object::new().set_finalize_time(Timestamp::default()/* use setters */);
8983 /// ```
8984 pub fn set_finalize_time<T>(mut self, v: T) -> Self
8985 where
8986 T: std::convert::Into<wkt::Timestamp>,
8987 {
8988 self.finalize_time = std::option::Option::Some(v.into());
8989 self
8990 }
8991
8992 /// Sets or clears the value of [finalize_time][crate::model::Object::finalize_time].
8993 ///
8994 /// # Example
8995 /// ```ignore,no_run
8996 /// # use google_cloud_storage::model::Object;
8997 /// use wkt::Timestamp;
8998 /// let x = Object::new().set_or_clear_finalize_time(Some(Timestamp::default()/* use setters */));
8999 /// let x = Object::new().set_or_clear_finalize_time(None::<Timestamp>);
9000 /// ```
9001 pub fn set_or_clear_finalize_time<T>(mut self, v: std::option::Option<T>) -> Self
9002 where
9003 T: std::convert::Into<wkt::Timestamp>,
9004 {
9005 self.finalize_time = v.map(|x| x.into());
9006 self
9007 }
9008
9009 /// Sets the value of [content_type][crate::model::Object::content_type].
9010 ///
9011 /// # Example
9012 /// ```ignore,no_run
9013 /// # use google_cloud_storage::model::Object;
9014 /// let x = Object::new().set_content_type("example");
9015 /// ```
9016 pub fn set_content_type<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9017 self.content_type = v.into();
9018 self
9019 }
9020
9021 /// Sets the value of [create_time][crate::model::Object::create_time].
9022 ///
9023 /// # Example
9024 /// ```ignore,no_run
9025 /// # use google_cloud_storage::model::Object;
9026 /// use wkt::Timestamp;
9027 /// let x = Object::new().set_create_time(Timestamp::default()/* use setters */);
9028 /// ```
9029 pub fn set_create_time<T>(mut self, v: T) -> Self
9030 where
9031 T: std::convert::Into<wkt::Timestamp>,
9032 {
9033 self.create_time = std::option::Option::Some(v.into());
9034 self
9035 }
9036
9037 /// Sets or clears the value of [create_time][crate::model::Object::create_time].
9038 ///
9039 /// # Example
9040 /// ```ignore,no_run
9041 /// # use google_cloud_storage::model::Object;
9042 /// use wkt::Timestamp;
9043 /// let x = Object::new().set_or_clear_create_time(Some(Timestamp::default()/* use setters */));
9044 /// let x = Object::new().set_or_clear_create_time(None::<Timestamp>);
9045 /// ```
9046 pub fn set_or_clear_create_time<T>(mut self, v: std::option::Option<T>) -> Self
9047 where
9048 T: std::convert::Into<wkt::Timestamp>,
9049 {
9050 self.create_time = v.map(|x| x.into());
9051 self
9052 }
9053
9054 /// Sets the value of [component_count][crate::model::Object::component_count].
9055 ///
9056 /// # Example
9057 /// ```ignore,no_run
9058 /// # use google_cloud_storage::model::Object;
9059 /// let x = Object::new().set_component_count(42);
9060 /// ```
9061 pub fn set_component_count<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
9062 self.component_count = v.into();
9063 self
9064 }
9065
9066 /// Sets the value of [checksums][crate::model::Object::checksums].
9067 ///
9068 /// # Example
9069 /// ```ignore,no_run
9070 /// # use google_cloud_storage::model::Object;
9071 /// use google_cloud_storage::model::ObjectChecksums;
9072 /// let x = Object::new().set_checksums(ObjectChecksums::default()/* use setters */);
9073 /// ```
9074 pub fn set_checksums<T>(mut self, v: T) -> Self
9075 where
9076 T: std::convert::Into<crate::model::ObjectChecksums>,
9077 {
9078 self.checksums = std::option::Option::Some(v.into());
9079 self
9080 }
9081
9082 /// Sets or clears the value of [checksums][crate::model::Object::checksums].
9083 ///
9084 /// # Example
9085 /// ```ignore,no_run
9086 /// # use google_cloud_storage::model::Object;
9087 /// use google_cloud_storage::model::ObjectChecksums;
9088 /// let x = Object::new().set_or_clear_checksums(Some(ObjectChecksums::default()/* use setters */));
9089 /// let x = Object::new().set_or_clear_checksums(None::<ObjectChecksums>);
9090 /// ```
9091 pub fn set_or_clear_checksums<T>(mut self, v: std::option::Option<T>) -> Self
9092 where
9093 T: std::convert::Into<crate::model::ObjectChecksums>,
9094 {
9095 self.checksums = v.map(|x| x.into());
9096 self
9097 }
9098
9099 /// Sets the value of [update_time][crate::model::Object::update_time].
9100 ///
9101 /// # Example
9102 /// ```ignore,no_run
9103 /// # use google_cloud_storage::model::Object;
9104 /// use wkt::Timestamp;
9105 /// let x = Object::new().set_update_time(Timestamp::default()/* use setters */);
9106 /// ```
9107 pub fn set_update_time<T>(mut self, v: T) -> Self
9108 where
9109 T: std::convert::Into<wkt::Timestamp>,
9110 {
9111 self.update_time = std::option::Option::Some(v.into());
9112 self
9113 }
9114
9115 /// Sets or clears the value of [update_time][crate::model::Object::update_time].
9116 ///
9117 /// # Example
9118 /// ```ignore,no_run
9119 /// # use google_cloud_storage::model::Object;
9120 /// use wkt::Timestamp;
9121 /// let x = Object::new().set_or_clear_update_time(Some(Timestamp::default()/* use setters */));
9122 /// let x = Object::new().set_or_clear_update_time(None::<Timestamp>);
9123 /// ```
9124 pub fn set_or_clear_update_time<T>(mut self, v: std::option::Option<T>) -> Self
9125 where
9126 T: std::convert::Into<wkt::Timestamp>,
9127 {
9128 self.update_time = v.map(|x| x.into());
9129 self
9130 }
9131
9132 /// Sets the value of [kms_key][crate::model::Object::kms_key].
9133 ///
9134 /// # Example
9135 /// ```ignore,no_run
9136 /// # use google_cloud_storage::model::Object;
9137 /// let x = Object::new().set_kms_key("example");
9138 /// ```
9139 pub fn set_kms_key<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9140 self.kms_key = v.into();
9141 self
9142 }
9143
9144 /// Sets the value of [update_storage_class_time][crate::model::Object::update_storage_class_time].
9145 ///
9146 /// # Example
9147 /// ```ignore,no_run
9148 /// # use google_cloud_storage::model::Object;
9149 /// use wkt::Timestamp;
9150 /// let x = Object::new().set_update_storage_class_time(Timestamp::default()/* use setters */);
9151 /// ```
9152 pub fn set_update_storage_class_time<T>(mut self, v: T) -> Self
9153 where
9154 T: std::convert::Into<wkt::Timestamp>,
9155 {
9156 self.update_storage_class_time = std::option::Option::Some(v.into());
9157 self
9158 }
9159
9160 /// Sets or clears the value of [update_storage_class_time][crate::model::Object::update_storage_class_time].
9161 ///
9162 /// # Example
9163 /// ```ignore,no_run
9164 /// # use google_cloud_storage::model::Object;
9165 /// use wkt::Timestamp;
9166 /// let x = Object::new().set_or_clear_update_storage_class_time(Some(Timestamp::default()/* use setters */));
9167 /// let x = Object::new().set_or_clear_update_storage_class_time(None::<Timestamp>);
9168 /// ```
9169 pub fn set_or_clear_update_storage_class_time<T>(mut self, v: std::option::Option<T>) -> Self
9170 where
9171 T: std::convert::Into<wkt::Timestamp>,
9172 {
9173 self.update_storage_class_time = v.map(|x| x.into());
9174 self
9175 }
9176
9177 /// Sets the value of [temporary_hold][crate::model::Object::temporary_hold].
9178 ///
9179 /// # Example
9180 /// ```ignore,no_run
9181 /// # use google_cloud_storage::model::Object;
9182 /// let x = Object::new().set_temporary_hold(true);
9183 /// ```
9184 pub fn set_temporary_hold<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
9185 self.temporary_hold = v.into();
9186 self
9187 }
9188
9189 /// Sets the value of [retention_expire_time][crate::model::Object::retention_expire_time].
9190 ///
9191 /// # Example
9192 /// ```ignore,no_run
9193 /// # use google_cloud_storage::model::Object;
9194 /// use wkt::Timestamp;
9195 /// let x = Object::new().set_retention_expire_time(Timestamp::default()/* use setters */);
9196 /// ```
9197 pub fn set_retention_expire_time<T>(mut self, v: T) -> Self
9198 where
9199 T: std::convert::Into<wkt::Timestamp>,
9200 {
9201 self.retention_expire_time = std::option::Option::Some(v.into());
9202 self
9203 }
9204
9205 /// Sets or clears the value of [retention_expire_time][crate::model::Object::retention_expire_time].
9206 ///
9207 /// # Example
9208 /// ```ignore,no_run
9209 /// # use google_cloud_storage::model::Object;
9210 /// use wkt::Timestamp;
9211 /// let x = Object::new().set_or_clear_retention_expire_time(Some(Timestamp::default()/* use setters */));
9212 /// let x = Object::new().set_or_clear_retention_expire_time(None::<Timestamp>);
9213 /// ```
9214 pub fn set_or_clear_retention_expire_time<T>(mut self, v: std::option::Option<T>) -> Self
9215 where
9216 T: std::convert::Into<wkt::Timestamp>,
9217 {
9218 self.retention_expire_time = v.map(|x| x.into());
9219 self
9220 }
9221
9222 /// Sets the value of [metadata][crate::model::Object::metadata].
9223 ///
9224 /// # Example
9225 /// ```ignore,no_run
9226 /// # use google_cloud_storage::model::Object;
9227 /// let x = Object::new().set_metadata([
9228 /// ("key0", "abc"),
9229 /// ("key1", "xyz"),
9230 /// ]);
9231 /// ```
9232 pub fn set_metadata<T, K, V>(mut self, v: T) -> Self
9233 where
9234 T: std::iter::IntoIterator<Item = (K, V)>,
9235 K: std::convert::Into<std::string::String>,
9236 V: std::convert::Into<std::string::String>,
9237 {
9238 use std::iter::Iterator;
9239 self.metadata = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
9240 self
9241 }
9242
9243 /// Sets the value of [contexts][crate::model::Object::contexts].
9244 ///
9245 /// # Example
9246 /// ```ignore,no_run
9247 /// # use google_cloud_storage::model::Object;
9248 /// use google_cloud_storage::model::ObjectContexts;
9249 /// let x = Object::new().set_contexts(ObjectContexts::default()/* use setters */);
9250 /// ```
9251 pub fn set_contexts<T>(mut self, v: T) -> Self
9252 where
9253 T: std::convert::Into<crate::model::ObjectContexts>,
9254 {
9255 self.contexts = std::option::Option::Some(v.into());
9256 self
9257 }
9258
9259 /// Sets or clears the value of [contexts][crate::model::Object::contexts].
9260 ///
9261 /// # Example
9262 /// ```ignore,no_run
9263 /// # use google_cloud_storage::model::Object;
9264 /// use google_cloud_storage::model::ObjectContexts;
9265 /// let x = Object::new().set_or_clear_contexts(Some(ObjectContexts::default()/* use setters */));
9266 /// let x = Object::new().set_or_clear_contexts(None::<ObjectContexts>);
9267 /// ```
9268 pub fn set_or_clear_contexts<T>(mut self, v: std::option::Option<T>) -> Self
9269 where
9270 T: std::convert::Into<crate::model::ObjectContexts>,
9271 {
9272 self.contexts = v.map(|x| x.into());
9273 self
9274 }
9275
9276 /// Sets the value of [event_based_hold][crate::model::Object::event_based_hold].
9277 ///
9278 /// # Example
9279 /// ```ignore,no_run
9280 /// # use google_cloud_storage::model::Object;
9281 /// let x = Object::new().set_event_based_hold(true);
9282 /// ```
9283 pub fn set_event_based_hold<T>(mut self, v: T) -> Self
9284 where
9285 T: std::convert::Into<bool>,
9286 {
9287 self.event_based_hold = std::option::Option::Some(v.into());
9288 self
9289 }
9290
9291 /// Sets or clears the value of [event_based_hold][crate::model::Object::event_based_hold].
9292 ///
9293 /// # Example
9294 /// ```ignore,no_run
9295 /// # use google_cloud_storage::model::Object;
9296 /// let x = Object::new().set_or_clear_event_based_hold(Some(false));
9297 /// let x = Object::new().set_or_clear_event_based_hold(None::<bool>);
9298 /// ```
9299 pub fn set_or_clear_event_based_hold<T>(mut self, v: std::option::Option<T>) -> Self
9300 where
9301 T: std::convert::Into<bool>,
9302 {
9303 self.event_based_hold = v.map(|x| x.into());
9304 self
9305 }
9306
9307 /// Sets the value of [owner][crate::model::Object::owner].
9308 ///
9309 /// # Example
9310 /// ```ignore,no_run
9311 /// # use google_cloud_storage::model::Object;
9312 /// use google_cloud_storage::model::Owner;
9313 /// let x = Object::new().set_owner(Owner::default()/* use setters */);
9314 /// ```
9315 pub fn set_owner<T>(mut self, v: T) -> Self
9316 where
9317 T: std::convert::Into<crate::model::Owner>,
9318 {
9319 self.owner = std::option::Option::Some(v.into());
9320 self
9321 }
9322
9323 /// Sets or clears the value of [owner][crate::model::Object::owner].
9324 ///
9325 /// # Example
9326 /// ```ignore,no_run
9327 /// # use google_cloud_storage::model::Object;
9328 /// use google_cloud_storage::model::Owner;
9329 /// let x = Object::new().set_or_clear_owner(Some(Owner::default()/* use setters */));
9330 /// let x = Object::new().set_or_clear_owner(None::<Owner>);
9331 /// ```
9332 pub fn set_or_clear_owner<T>(mut self, v: std::option::Option<T>) -> Self
9333 where
9334 T: std::convert::Into<crate::model::Owner>,
9335 {
9336 self.owner = v.map(|x| x.into());
9337 self
9338 }
9339
9340 /// Sets the value of [customer_encryption][crate::model::Object::customer_encryption].
9341 ///
9342 /// # Example
9343 /// ```ignore,no_run
9344 /// # use google_cloud_storage::model::Object;
9345 /// use google_cloud_storage::model::CustomerEncryption;
9346 /// let x = Object::new().set_customer_encryption(CustomerEncryption::default()/* use setters */);
9347 /// ```
9348 pub fn set_customer_encryption<T>(mut self, v: T) -> Self
9349 where
9350 T: std::convert::Into<crate::model::CustomerEncryption>,
9351 {
9352 self.customer_encryption = std::option::Option::Some(v.into());
9353 self
9354 }
9355
9356 /// Sets or clears the value of [customer_encryption][crate::model::Object::customer_encryption].
9357 ///
9358 /// # Example
9359 /// ```ignore,no_run
9360 /// # use google_cloud_storage::model::Object;
9361 /// use google_cloud_storage::model::CustomerEncryption;
9362 /// let x = Object::new().set_or_clear_customer_encryption(Some(CustomerEncryption::default()/* use setters */));
9363 /// let x = Object::new().set_or_clear_customer_encryption(None::<CustomerEncryption>);
9364 /// ```
9365 pub fn set_or_clear_customer_encryption<T>(mut self, v: std::option::Option<T>) -> Self
9366 where
9367 T: std::convert::Into<crate::model::CustomerEncryption>,
9368 {
9369 self.customer_encryption = v.map(|x| x.into());
9370 self
9371 }
9372
9373 /// Sets the value of [custom_time][crate::model::Object::custom_time].
9374 ///
9375 /// # Example
9376 /// ```ignore,no_run
9377 /// # use google_cloud_storage::model::Object;
9378 /// use wkt::Timestamp;
9379 /// let x = Object::new().set_custom_time(Timestamp::default()/* use setters */);
9380 /// ```
9381 pub fn set_custom_time<T>(mut self, v: T) -> Self
9382 where
9383 T: std::convert::Into<wkt::Timestamp>,
9384 {
9385 self.custom_time = std::option::Option::Some(v.into());
9386 self
9387 }
9388
9389 /// Sets or clears the value of [custom_time][crate::model::Object::custom_time].
9390 ///
9391 /// # Example
9392 /// ```ignore,no_run
9393 /// # use google_cloud_storage::model::Object;
9394 /// use wkt::Timestamp;
9395 /// let x = Object::new().set_or_clear_custom_time(Some(Timestamp::default()/* use setters */));
9396 /// let x = Object::new().set_or_clear_custom_time(None::<Timestamp>);
9397 /// ```
9398 pub fn set_or_clear_custom_time<T>(mut self, v: std::option::Option<T>) -> Self
9399 where
9400 T: std::convert::Into<wkt::Timestamp>,
9401 {
9402 self.custom_time = v.map(|x| x.into());
9403 self
9404 }
9405
9406 /// Sets the value of [soft_delete_time][crate::model::Object::soft_delete_time].
9407 ///
9408 /// # Example
9409 /// ```ignore,no_run
9410 /// # use google_cloud_storage::model::Object;
9411 /// use wkt::Timestamp;
9412 /// let x = Object::new().set_soft_delete_time(Timestamp::default()/* use setters */);
9413 /// ```
9414 pub fn set_soft_delete_time<T>(mut self, v: T) -> Self
9415 where
9416 T: std::convert::Into<wkt::Timestamp>,
9417 {
9418 self.soft_delete_time = std::option::Option::Some(v.into());
9419 self
9420 }
9421
9422 /// Sets or clears the value of [soft_delete_time][crate::model::Object::soft_delete_time].
9423 ///
9424 /// # Example
9425 /// ```ignore,no_run
9426 /// # use google_cloud_storage::model::Object;
9427 /// use wkt::Timestamp;
9428 /// let x = Object::new().set_or_clear_soft_delete_time(Some(Timestamp::default()/* use setters */));
9429 /// let x = Object::new().set_or_clear_soft_delete_time(None::<Timestamp>);
9430 /// ```
9431 pub fn set_or_clear_soft_delete_time<T>(mut self, v: std::option::Option<T>) -> Self
9432 where
9433 T: std::convert::Into<wkt::Timestamp>,
9434 {
9435 self.soft_delete_time = v.map(|x| x.into());
9436 self
9437 }
9438
9439 /// Sets the value of [hard_delete_time][crate::model::Object::hard_delete_time].
9440 ///
9441 /// # Example
9442 /// ```ignore,no_run
9443 /// # use google_cloud_storage::model::Object;
9444 /// use wkt::Timestamp;
9445 /// let x = Object::new().set_hard_delete_time(Timestamp::default()/* use setters */);
9446 /// ```
9447 pub fn set_hard_delete_time<T>(mut self, v: T) -> Self
9448 where
9449 T: std::convert::Into<wkt::Timestamp>,
9450 {
9451 self.hard_delete_time = std::option::Option::Some(v.into());
9452 self
9453 }
9454
9455 /// Sets or clears the value of [hard_delete_time][crate::model::Object::hard_delete_time].
9456 ///
9457 /// # Example
9458 /// ```ignore,no_run
9459 /// # use google_cloud_storage::model::Object;
9460 /// use wkt::Timestamp;
9461 /// let x = Object::new().set_or_clear_hard_delete_time(Some(Timestamp::default()/* use setters */));
9462 /// let x = Object::new().set_or_clear_hard_delete_time(None::<Timestamp>);
9463 /// ```
9464 pub fn set_or_clear_hard_delete_time<T>(mut self, v: std::option::Option<T>) -> Self
9465 where
9466 T: std::convert::Into<wkt::Timestamp>,
9467 {
9468 self.hard_delete_time = v.map(|x| x.into());
9469 self
9470 }
9471
9472 /// Sets the value of [retention][crate::model::Object::retention].
9473 ///
9474 /// # Example
9475 /// ```ignore,no_run
9476 /// # use google_cloud_storage::model::Object;
9477 /// use google_cloud_storage::model::object::Retention;
9478 /// let x = Object::new().set_retention(Retention::default()/* use setters */);
9479 /// ```
9480 pub fn set_retention<T>(mut self, v: T) -> Self
9481 where
9482 T: std::convert::Into<crate::model::object::Retention>,
9483 {
9484 self.retention = std::option::Option::Some(v.into());
9485 self
9486 }
9487
9488 /// Sets or clears the value of [retention][crate::model::Object::retention].
9489 ///
9490 /// # Example
9491 /// ```ignore,no_run
9492 /// # use google_cloud_storage::model::Object;
9493 /// use google_cloud_storage::model::object::Retention;
9494 /// let x = Object::new().set_or_clear_retention(Some(Retention::default()/* use setters */));
9495 /// let x = Object::new().set_or_clear_retention(None::<Retention>);
9496 /// ```
9497 pub fn set_or_clear_retention<T>(mut self, v: std::option::Option<T>) -> Self
9498 where
9499 T: std::convert::Into<crate::model::object::Retention>,
9500 {
9501 self.retention = v.map(|x| x.into());
9502 self
9503 }
9504}
9505
9506impl wkt::message::Message for Object {
9507 fn typename() -> &'static str {
9508 "type.googleapis.com/google.storage.v2.Object"
9509 }
9510}
9511
9512/// Defines additional types related to [Object].
9513pub mod object {
9514 #[allow(unused_imports)]
9515 use super::*;
9516
9517 /// Specifies retention parameters of the object. Objects under retention
9518 /// cannot be deleted or overwritten until their retention expires.
9519 #[derive(Clone, Default, PartialEq)]
9520 #[non_exhaustive]
9521 pub struct Retention {
9522 /// Optional. The mode of the Retention.
9523 pub mode: crate::model::object::retention::Mode,
9524
9525 /// Optional. The timestamp that the object needs to be retained until.
9526 /// Value cannot be set in the past or more than 100 years in the future.
9527 pub retain_until_time: std::option::Option<wkt::Timestamp>,
9528
9529 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
9530 }
9531
9532 impl Retention {
9533 /// Creates a new default instance.
9534 pub fn new() -> Self {
9535 std::default::Default::default()
9536 }
9537
9538 /// Sets the value of [mode][crate::model::object::Retention::mode].
9539 ///
9540 /// # Example
9541 /// ```ignore,no_run
9542 /// # use google_cloud_storage::model::object::Retention;
9543 /// use google_cloud_storage::model::object::retention::Mode;
9544 /// let x0 = Retention::new().set_mode(Mode::Unlocked);
9545 /// let x1 = Retention::new().set_mode(Mode::Locked);
9546 /// ```
9547 pub fn set_mode<T: std::convert::Into<crate::model::object::retention::Mode>>(
9548 mut self,
9549 v: T,
9550 ) -> Self {
9551 self.mode = v.into();
9552 self
9553 }
9554
9555 /// Sets the value of [retain_until_time][crate::model::object::Retention::retain_until_time].
9556 ///
9557 /// # Example
9558 /// ```ignore,no_run
9559 /// # use google_cloud_storage::model::object::Retention;
9560 /// use wkt::Timestamp;
9561 /// let x = Retention::new().set_retain_until_time(Timestamp::default()/* use setters */);
9562 /// ```
9563 pub fn set_retain_until_time<T>(mut self, v: T) -> Self
9564 where
9565 T: std::convert::Into<wkt::Timestamp>,
9566 {
9567 self.retain_until_time = std::option::Option::Some(v.into());
9568 self
9569 }
9570
9571 /// Sets or clears the value of [retain_until_time][crate::model::object::Retention::retain_until_time].
9572 ///
9573 /// # Example
9574 /// ```ignore,no_run
9575 /// # use google_cloud_storage::model::object::Retention;
9576 /// use wkt::Timestamp;
9577 /// let x = Retention::new().set_or_clear_retain_until_time(Some(Timestamp::default()/* use setters */));
9578 /// let x = Retention::new().set_or_clear_retain_until_time(None::<Timestamp>);
9579 /// ```
9580 pub fn set_or_clear_retain_until_time<T>(mut self, v: std::option::Option<T>) -> Self
9581 where
9582 T: std::convert::Into<wkt::Timestamp>,
9583 {
9584 self.retain_until_time = v.map(|x| x.into());
9585 self
9586 }
9587 }
9588
9589 impl wkt::message::Message for Retention {
9590 fn typename() -> &'static str {
9591 "type.googleapis.com/google.storage.v2.Object.Retention"
9592 }
9593 }
9594
9595 /// Defines additional types related to [Retention].
9596 pub mod retention {
9597 #[allow(unused_imports)]
9598 use super::*;
9599
9600 /// Retention mode values.
9601 ///
9602 /// # Working with unknown values
9603 ///
9604 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
9605 /// additional enum variants at any time. Adding new variants is not considered
9606 /// a breaking change. Applications should write their code in anticipation of:
9607 ///
9608 /// - New values appearing in future releases of the client library, **and**
9609 /// - New values received dynamically, without application changes.
9610 ///
9611 /// Please consult the [Working with enums] section in the user guide for some
9612 /// guidelines.
9613 ///
9614 /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
9615 #[derive(Clone, Debug, PartialEq)]
9616 #[non_exhaustive]
9617 pub enum Mode {
9618 /// No specified mode. Object is not under retention.
9619 Unspecified,
9620 /// Retention period might be decreased or increased.
9621 /// The Retention configuration might be removed.
9622 /// The mode might be changed to locked.
9623 Unlocked,
9624 /// Retention period might be increased.
9625 /// The Retention configuration cannot be removed.
9626 /// The mode cannot be changed.
9627 Locked,
9628 /// If set, the enum was initialized with an unknown value.
9629 ///
9630 /// Applications can examine the value using [Mode::value] or
9631 /// [Mode::name].
9632 UnknownValue(mode::UnknownValue),
9633 }
9634
9635 #[doc(hidden)]
9636 pub mod mode {
9637 #[allow(unused_imports)]
9638 use super::*;
9639 #[derive(Clone, Debug, PartialEq)]
9640 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
9641 }
9642
9643 impl Mode {
9644 /// Gets the enum value.
9645 ///
9646 /// Returns `None` if the enum contains an unknown value deserialized from
9647 /// the string representation of enums.
9648 pub fn value(&self) -> std::option::Option<i32> {
9649 match self {
9650 Self::Unspecified => std::option::Option::Some(0),
9651 Self::Unlocked => std::option::Option::Some(1),
9652 Self::Locked => std::option::Option::Some(2),
9653 Self::UnknownValue(u) => u.0.value(),
9654 }
9655 }
9656
9657 /// Gets the enum value as a string.
9658 ///
9659 /// Returns `None` if the enum contains an unknown value deserialized from
9660 /// the integer representation of enums.
9661 pub fn name(&self) -> std::option::Option<&str> {
9662 match self {
9663 Self::Unspecified => std::option::Option::Some("MODE_UNSPECIFIED"),
9664 Self::Unlocked => std::option::Option::Some("UNLOCKED"),
9665 Self::Locked => std::option::Option::Some("LOCKED"),
9666 Self::UnknownValue(u) => u.0.name(),
9667 }
9668 }
9669 }
9670
9671 impl std::default::Default for Mode {
9672 fn default() -> Self {
9673 use std::convert::From;
9674 Self::from(0)
9675 }
9676 }
9677
9678 impl std::fmt::Display for Mode {
9679 fn fmt(
9680 &self,
9681 f: &mut std::fmt::Formatter<'_>,
9682 ) -> std::result::Result<(), std::fmt::Error> {
9683 wkt::internal::display_enum(f, self.name(), self.value())
9684 }
9685 }
9686
9687 impl std::convert::From<i32> for Mode {
9688 fn from(value: i32) -> Self {
9689 match value {
9690 0 => Self::Unspecified,
9691 1 => Self::Unlocked,
9692 2 => Self::Locked,
9693 _ => Self::UnknownValue(mode::UnknownValue(
9694 wkt::internal::UnknownEnumValue::Integer(value),
9695 )),
9696 }
9697 }
9698 }
9699
9700 impl std::convert::From<&str> for Mode {
9701 fn from(value: &str) -> Self {
9702 use std::string::ToString;
9703 match value {
9704 "MODE_UNSPECIFIED" => Self::Unspecified,
9705 "UNLOCKED" => Self::Unlocked,
9706 "LOCKED" => Self::Locked,
9707 _ => Self::UnknownValue(mode::UnknownValue(
9708 wkt::internal::UnknownEnumValue::String(value.to_string()),
9709 )),
9710 }
9711 }
9712 }
9713
9714 impl serde::ser::Serialize for Mode {
9715 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
9716 where
9717 S: serde::Serializer,
9718 {
9719 match self {
9720 Self::Unspecified => serializer.serialize_i32(0),
9721 Self::Unlocked => serializer.serialize_i32(1),
9722 Self::Locked => serializer.serialize_i32(2),
9723 Self::UnknownValue(u) => u.0.serialize(serializer),
9724 }
9725 }
9726 }
9727
9728 impl<'de> serde::de::Deserialize<'de> for Mode {
9729 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
9730 where
9731 D: serde::Deserializer<'de>,
9732 {
9733 deserializer.deserialize_any(wkt::internal::EnumVisitor::<Mode>::new(
9734 ".google.storage.v2.Object.Retention.Mode",
9735 ))
9736 }
9737 }
9738 }
9739}
9740
9741/// An access-control entry.
9742#[derive(Clone, Default, PartialEq)]
9743#[non_exhaustive]
9744pub struct ObjectAccessControl {
9745 /// Optional. The access permission for the entity. One of the following
9746 /// values:
9747 ///
9748 /// * `READER`
9749 /// * `WRITER`
9750 /// * `OWNER`
9751 pub role: std::string::String,
9752
9753 /// Optional. The ID of the access-control entry.
9754 pub id: std::string::String,
9755
9756 /// Optional. The entity holding the permission, in one of the following forms:
9757 ///
9758 /// * `user-{userid}`
9759 /// * `user-{email}`
9760 /// * `group-{groupid}`
9761 /// * `group-{email}`
9762 /// * `domain-{domain}`
9763 /// * `project-{team}-{projectnumber}`
9764 /// * `project-{team}-{projectid}`
9765 /// * `allUsers`
9766 /// * `allAuthenticatedUsers`
9767 /// Examples:
9768 /// * The user `liz@example.com` would be `user-liz@example.com`.
9769 /// * The group `example@googlegroups.com` would be
9770 /// `group-example@googlegroups.com`.
9771 /// * All members of the Google Apps for Business domain `example.com` would be
9772 /// `domain-example.com`.
9773 /// For project entities, `project-{team}-{projectnumber}` format is
9774 /// returned in the response.
9775 pub entity: std::string::String,
9776
9777 /// Output only. The alternative entity format, if exists. For project
9778 /// entities, `project-{team}-{projectid}` format is returned in the response.
9779 pub entity_alt: std::string::String,
9780
9781 /// Optional. The ID for the entity, if any.
9782 pub entity_id: std::string::String,
9783
9784 /// Optional. The etag of the ObjectAccessControl.
9785 /// If included in the metadata of an update or delete request message, the
9786 /// operation is only performed if the etag matches that of the live
9787 /// object's ObjectAccessControl.
9788 pub etag: std::string::String,
9789
9790 /// Optional. The email address associated with the entity, if any.
9791 pub email: std::string::String,
9792
9793 /// Optional. The domain associated with the entity, if any.
9794 pub domain: std::string::String,
9795
9796 /// Optional. The project team associated with the entity, if any.
9797 pub project_team: std::option::Option<crate::model::ProjectTeam>,
9798
9799 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
9800}
9801
9802impl ObjectAccessControl {
9803 /// Creates a new default instance.
9804 pub fn new() -> Self {
9805 std::default::Default::default()
9806 }
9807
9808 /// Sets the value of [role][crate::model::ObjectAccessControl::role].
9809 ///
9810 /// # Example
9811 /// ```ignore,no_run
9812 /// # use google_cloud_storage::model::ObjectAccessControl;
9813 /// let x = ObjectAccessControl::new().set_role("example");
9814 /// ```
9815 pub fn set_role<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9816 self.role = v.into();
9817 self
9818 }
9819
9820 /// Sets the value of [id][crate::model::ObjectAccessControl::id].
9821 ///
9822 /// # Example
9823 /// ```ignore,no_run
9824 /// # use google_cloud_storage::model::ObjectAccessControl;
9825 /// let x = ObjectAccessControl::new().set_id("example");
9826 /// ```
9827 pub fn set_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9828 self.id = v.into();
9829 self
9830 }
9831
9832 /// Sets the value of [entity][crate::model::ObjectAccessControl::entity].
9833 ///
9834 /// # Example
9835 /// ```ignore,no_run
9836 /// # use google_cloud_storage::model::ObjectAccessControl;
9837 /// let x = ObjectAccessControl::new().set_entity("example");
9838 /// ```
9839 pub fn set_entity<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9840 self.entity = v.into();
9841 self
9842 }
9843
9844 /// Sets the value of [entity_alt][crate::model::ObjectAccessControl::entity_alt].
9845 ///
9846 /// # Example
9847 /// ```ignore,no_run
9848 /// # use google_cloud_storage::model::ObjectAccessControl;
9849 /// let x = ObjectAccessControl::new().set_entity_alt("example");
9850 /// ```
9851 pub fn set_entity_alt<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9852 self.entity_alt = v.into();
9853 self
9854 }
9855
9856 /// Sets the value of [entity_id][crate::model::ObjectAccessControl::entity_id].
9857 ///
9858 /// # Example
9859 /// ```ignore,no_run
9860 /// # use google_cloud_storage::model::ObjectAccessControl;
9861 /// let x = ObjectAccessControl::new().set_entity_id("example");
9862 /// ```
9863 pub fn set_entity_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9864 self.entity_id = v.into();
9865 self
9866 }
9867
9868 /// Sets the value of [etag][crate::model::ObjectAccessControl::etag].
9869 ///
9870 /// # Example
9871 /// ```ignore,no_run
9872 /// # use google_cloud_storage::model::ObjectAccessControl;
9873 /// let x = ObjectAccessControl::new().set_etag("example");
9874 /// ```
9875 pub fn set_etag<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9876 self.etag = v.into();
9877 self
9878 }
9879
9880 /// Sets the value of [email][crate::model::ObjectAccessControl::email].
9881 ///
9882 /// # Example
9883 /// ```ignore,no_run
9884 /// # use google_cloud_storage::model::ObjectAccessControl;
9885 /// let x = ObjectAccessControl::new().set_email("example");
9886 /// ```
9887 pub fn set_email<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9888 self.email = v.into();
9889 self
9890 }
9891
9892 /// Sets the value of [domain][crate::model::ObjectAccessControl::domain].
9893 ///
9894 /// # Example
9895 /// ```ignore,no_run
9896 /// # use google_cloud_storage::model::ObjectAccessControl;
9897 /// let x = ObjectAccessControl::new().set_domain("example");
9898 /// ```
9899 pub fn set_domain<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9900 self.domain = v.into();
9901 self
9902 }
9903
9904 /// Sets the value of [project_team][crate::model::ObjectAccessControl::project_team].
9905 ///
9906 /// # Example
9907 /// ```ignore,no_run
9908 /// # use google_cloud_storage::model::ObjectAccessControl;
9909 /// use google_cloud_storage::model::ProjectTeam;
9910 /// let x = ObjectAccessControl::new().set_project_team(ProjectTeam::default()/* use setters */);
9911 /// ```
9912 pub fn set_project_team<T>(mut self, v: T) -> Self
9913 where
9914 T: std::convert::Into<crate::model::ProjectTeam>,
9915 {
9916 self.project_team = std::option::Option::Some(v.into());
9917 self
9918 }
9919
9920 /// Sets or clears the value of [project_team][crate::model::ObjectAccessControl::project_team].
9921 ///
9922 /// # Example
9923 /// ```ignore,no_run
9924 /// # use google_cloud_storage::model::ObjectAccessControl;
9925 /// use google_cloud_storage::model::ProjectTeam;
9926 /// let x = ObjectAccessControl::new().set_or_clear_project_team(Some(ProjectTeam::default()/* use setters */));
9927 /// let x = ObjectAccessControl::new().set_or_clear_project_team(None::<ProjectTeam>);
9928 /// ```
9929 pub fn set_or_clear_project_team<T>(mut self, v: std::option::Option<T>) -> Self
9930 where
9931 T: std::convert::Into<crate::model::ProjectTeam>,
9932 {
9933 self.project_team = v.map(|x| x.into());
9934 self
9935 }
9936}
9937
9938impl wkt::message::Message for ObjectAccessControl {
9939 fn typename() -> &'static str {
9940 "type.googleapis.com/google.storage.v2.ObjectAccessControl"
9941 }
9942}
9943
9944/// The result of a call to Objects.ListObjects
9945#[derive(Clone, Default, PartialEq)]
9946#[non_exhaustive]
9947pub struct ListObjectsResponse {
9948 /// The list of items.
9949 pub objects: std::vec::Vec<crate::model::Object>,
9950
9951 /// The list of prefixes of objects matching-but-not-listed up to and including
9952 /// the requested delimiter.
9953 pub prefixes: std::vec::Vec<std::string::String>,
9954
9955 /// The continuation token, used to page through large result sets. Provide
9956 /// this value in a subsequent request to return the next page of results.
9957 pub next_page_token: std::string::String,
9958
9959 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
9960}
9961
9962impl ListObjectsResponse {
9963 /// Creates a new default instance.
9964 pub fn new() -> Self {
9965 std::default::Default::default()
9966 }
9967
9968 /// Sets the value of [objects][crate::model::ListObjectsResponse::objects].
9969 ///
9970 /// # Example
9971 /// ```ignore,no_run
9972 /// # use google_cloud_storage::model::ListObjectsResponse;
9973 /// use google_cloud_storage::model::Object;
9974 /// let x = ListObjectsResponse::new()
9975 /// .set_objects([
9976 /// Object::default()/* use setters */,
9977 /// Object::default()/* use (different) setters */,
9978 /// ]);
9979 /// ```
9980 pub fn set_objects<T, V>(mut self, v: T) -> Self
9981 where
9982 T: std::iter::IntoIterator<Item = V>,
9983 V: std::convert::Into<crate::model::Object>,
9984 {
9985 use std::iter::Iterator;
9986 self.objects = v.into_iter().map(|i| i.into()).collect();
9987 self
9988 }
9989
9990 /// Sets the value of [prefixes][crate::model::ListObjectsResponse::prefixes].
9991 ///
9992 /// # Example
9993 /// ```ignore,no_run
9994 /// # use google_cloud_storage::model::ListObjectsResponse;
9995 /// let x = ListObjectsResponse::new().set_prefixes(["a", "b", "c"]);
9996 /// ```
9997 pub fn set_prefixes<T, V>(mut self, v: T) -> Self
9998 where
9999 T: std::iter::IntoIterator<Item = V>,
10000 V: std::convert::Into<std::string::String>,
10001 {
10002 use std::iter::Iterator;
10003 self.prefixes = v.into_iter().map(|i| i.into()).collect();
10004 self
10005 }
10006
10007 /// Sets the value of [next_page_token][crate::model::ListObjectsResponse::next_page_token].
10008 ///
10009 /// # Example
10010 /// ```ignore,no_run
10011 /// # use google_cloud_storage::model::ListObjectsResponse;
10012 /// let x = ListObjectsResponse::new().set_next_page_token("example");
10013 /// ```
10014 pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
10015 self.next_page_token = v.into();
10016 self
10017 }
10018}
10019
10020impl wkt::message::Message for ListObjectsResponse {
10021 fn typename() -> &'static str {
10022 "type.googleapis.com/google.storage.v2.ListObjectsResponse"
10023 }
10024}
10025
10026#[doc(hidden)]
10027impl google_cloud_gax::paginator::internal::PageableResponse for ListObjectsResponse {
10028 type PageItem = crate::model::Object;
10029
10030 fn items(self) -> std::vec::Vec<Self::PageItem> {
10031 self.objects
10032 }
10033
10034 fn next_page_token(&self) -> std::string::String {
10035 use std::clone::Clone;
10036 self.next_page_token.clone()
10037 }
10038}
10039
10040/// Represents the Viewers, Editors, or Owners of a given project.
10041#[derive(Clone, Default, PartialEq)]
10042#[non_exhaustive]
10043pub struct ProjectTeam {
10044 /// Optional. The project number.
10045 pub project_number: std::string::String,
10046
10047 /// Optional. The team.
10048 pub team: std::string::String,
10049
10050 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
10051}
10052
10053impl ProjectTeam {
10054 /// Creates a new default instance.
10055 pub fn new() -> Self {
10056 std::default::Default::default()
10057 }
10058
10059 /// Sets the value of [project_number][crate::model::ProjectTeam::project_number].
10060 ///
10061 /// # Example
10062 /// ```ignore,no_run
10063 /// # use google_cloud_storage::model::ProjectTeam;
10064 /// let x = ProjectTeam::new().set_project_number("example");
10065 /// ```
10066 pub fn set_project_number<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
10067 self.project_number = v.into();
10068 self
10069 }
10070
10071 /// Sets the value of [team][crate::model::ProjectTeam::team].
10072 ///
10073 /// # Example
10074 /// ```ignore,no_run
10075 /// # use google_cloud_storage::model::ProjectTeam;
10076 /// let x = ProjectTeam::new().set_team("example");
10077 /// ```
10078 pub fn set_team<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
10079 self.team = v.into();
10080 self
10081 }
10082}
10083
10084impl wkt::message::Message for ProjectTeam {
10085 fn typename() -> &'static str {
10086 "type.googleapis.com/google.storage.v2.ProjectTeam"
10087 }
10088}
10089
10090/// The owner of a specific resource.
10091#[derive(Clone, Default, PartialEq)]
10092#[non_exhaustive]
10093pub struct Owner {
10094 /// Optional. The entity, in the form `user-`*userId*.
10095 pub entity: std::string::String,
10096
10097 /// Optional. The ID for the entity.
10098 pub entity_id: std::string::String,
10099
10100 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
10101}
10102
10103impl Owner {
10104 /// Creates a new default instance.
10105 pub fn new() -> Self {
10106 std::default::Default::default()
10107 }
10108
10109 /// Sets the value of [entity][crate::model::Owner::entity].
10110 ///
10111 /// # Example
10112 /// ```ignore,no_run
10113 /// # use google_cloud_storage::model::Owner;
10114 /// let x = Owner::new().set_entity("example");
10115 /// ```
10116 pub fn set_entity<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
10117 self.entity = v.into();
10118 self
10119 }
10120
10121 /// Sets the value of [entity_id][crate::model::Owner::entity_id].
10122 ///
10123 /// # Example
10124 /// ```ignore,no_run
10125 /// # use google_cloud_storage::model::Owner;
10126 /// let x = Owner::new().set_entity_id("example");
10127 /// ```
10128 pub fn set_entity_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
10129 self.entity_id = v.into();
10130 self
10131 }
10132}
10133
10134impl wkt::message::Message for Owner {
10135 fn typename() -> &'static str {
10136 "type.googleapis.com/google.storage.v2.Owner"
10137 }
10138}