google_cloud_storage/control/generated/client.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
17use crate::control::client::*;
18
19impl StorageControl {
20 /// Returns a builder for [StorageControl].
21 ///
22 /// ```
23 /// # async fn sample() -> anyhow::Result<()> {
24 /// # use google_cloud_storage::client::StorageControl;
25 /// let client = StorageControl::builder().build().await?;
26 /// # Ok(()) }
27 /// ```
28 pub fn builder() -> ClientBuilder {
29 crate::new_client_builder(client_builder::Factory)
30 }
31
32 /// Permanently deletes an empty bucket.
33 /// The request fails if there are any live or
34 /// noncurrent objects in the bucket, but the request succeeds if the
35 /// bucket only contains soft-deleted objects or incomplete uploads, such
36 /// as ongoing XML API multipart uploads. Does not permanently delete
37 /// soft-deleted objects.
38 ///
39 /// When this API is used to delete a bucket containing an object that has a
40 /// soft delete policy
41 /// enabled, the object becomes soft deleted, and the
42 /// `softDeleteTime` and `hardDeleteTime` properties are set on the
43 /// object.
44 ///
45 /// Objects and multipart uploads that were in the bucket at the time of
46 /// deletion are also retained for the specified retention duration. When
47 /// a soft-deleted bucket reaches the end of its retention duration, it
48 /// is permanently deleted. The `hardDeleteTime` of the bucket always
49 /// equals
50 /// or exceeds the expiration time of the last soft-deleted object in the
51 /// bucket.
52 ///
53 /// **IAM Permissions**:
54 ///
55 /// Requires `storage.buckets.delete` IAM permission on the bucket.
56 ///
57 /// # Example
58 /// ```
59 /// # use google_cloud_storage::client::StorageControl;
60 /// use google_cloud_storage::Result;
61 /// async fn sample(
62 /// client: &StorageControl, project_id: &str, bucket_id: &str
63 /// ) -> Result<()> {
64 /// client.delete_bucket()
65 /// .set_name(format!("projects/{project_id}/buckets/{bucket_id}"))
66 /// .send().await?;
67 /// Ok(())
68 /// }
69 /// ```
70 pub fn delete_bucket(&self) -> crate::builder::storage_control::DeleteBucket {
71 self.storage.delete_bucket()
72 }
73
74 /// Returns metadata for the specified bucket.
75 ///
76 /// **IAM Permissions**:
77 ///
78 /// Requires `storage.buckets.get`
79 /// IAM permission on
80 /// the bucket. Additionally, to return specific bucket metadata, the
81 /// authenticated user must have the following permissions:
82 ///
83 /// - To return the IAM policies: `storage.buckets.getIamPolicy`
84 /// - To return the bucket IP filtering rules: `storage.buckets.getIpFilter`
85 ///
86 /// # Example
87 /// ```
88 /// # use google_cloud_storage::client::StorageControl;
89 /// use google_cloud_storage::Result;
90 /// async fn sample(
91 /// client: &StorageControl, project_id: &str, bucket_id: &str
92 /// ) -> Result<()> {
93 /// let response = client.get_bucket()
94 /// .set_name(format!("projects/{project_id}/buckets/{bucket_id}"))
95 /// .send().await?;
96 /// println!("response {:?}", response);
97 /// Ok(())
98 /// }
99 /// ```
100 pub fn get_bucket(&self) -> crate::builder::storage_control::GetBucket {
101 self.storage.get_bucket()
102 }
103
104 /// Creates a new bucket.
105 ///
106 /// **IAM Permissions**:
107 ///
108 /// Requires `storage.buckets.create` IAM permission on the bucket.
109 /// Additionally, to enable specific bucket features, the authenticated user
110 /// must have the following permissions:
111 ///
112 /// - To enable object retention using the `enableObjectRetention` query
113 /// parameter: `storage.buckets.enableObjectRetention`
114 /// - To set the bucket IP filtering rules: `storage.buckets.setIpFilter`
115 ///
116 /// # Example
117 /// ```
118 /// # use google_cloud_storage::client::StorageControl;
119 /// use google_cloud_storage::model::Bucket;
120 /// use google_cloud_storage::Result;
121 /// async fn sample(
122 /// client: &StorageControl, project_id: &str
123 /// ) -> Result<()> {
124 /// let response = client.create_bucket()
125 /// .set_parent(format!("projects/{project_id}"))
126 /// .set_bucket_id("bucket_id_value")
127 /// .set_bucket(
128 /// Bucket::new()/* set fields */
129 /// )
130 /// .send().await?;
131 /// println!("response {:?}", response);
132 /// Ok(())
133 /// }
134 /// ```
135 pub fn create_bucket(&self) -> crate::builder::storage_control::CreateBucket {
136 self.storage.create_bucket()
137 }
138
139 /// Retrieves a list of buckets for a given project, ordered
140 /// lexicographically by name.
141 ///
142 /// **IAM Permissions**:
143 ///
144 /// Requires `storage.buckets.list` IAM permission on the bucket.
145 /// Additionally, to enable specific bucket features, the authenticated
146 /// user must have the following permissions:
147 ///
148 /// - To list the IAM policies: `storage.buckets.getIamPolicy`
149 /// - To list the bucket IP filtering rules: `storage.buckets.getIpFilter`
150 ///
151 /// # Example
152 /// ```
153 /// # use google_cloud_storage::client::StorageControl;
154 /// use google_cloud_gax::paginator::ItemPaginator as _;
155 /// use google_cloud_storage::Result;
156 /// async fn sample(
157 /// client: &StorageControl, project_id: &str
158 /// ) -> Result<()> {
159 /// let mut list = client.list_buckets()
160 /// .set_parent(format!("projects/{project_id}"))
161 /// .by_item();
162 /// while let Some(item) = list.next().await.transpose()? {
163 /// println!("{:?}", item);
164 /// }
165 /// Ok(())
166 /// }
167 /// ```
168 pub fn list_buckets(&self) -> crate::builder::storage_control::ListBuckets {
169 self.storage.list_buckets()
170 }
171
172 /// Permanently locks the retention
173 /// policy that is
174 /// currently applied to the specified bucket.
175 ///
176 /// Caution: Locking a bucket is an
177 /// irreversible action. Once you lock a bucket:
178 ///
179 /// - You cannot remove the retention policy from the bucket.
180 /// - You cannot decrease the retention period for the policy.
181 ///
182 /// Once locked, you must delete the entire bucket in order to remove the
183 /// bucket's retention policy. However, before you can delete the bucket, you
184 /// must delete all the objects in the bucket, which is only
185 /// possible if all the objects have reached the retention period set by the
186 /// retention policy.
187 ///
188 /// **IAM Permissions**:
189 ///
190 /// Requires `storage.buckets.update` IAM permission on the bucket.
191 ///
192 /// # Example
193 /// ```
194 /// # use google_cloud_storage::client::StorageControl;
195 /// use google_cloud_storage::Result;
196 /// async fn sample(
197 /// client: &StorageControl
198 /// ) -> Result<()> {
199 /// let response = client.lock_bucket_retention_policy()
200 /// /* set fields */
201 /// .send().await?;
202 /// println!("response {:?}", response);
203 /// Ok(())
204 /// }
205 /// ```
206 pub fn lock_bucket_retention_policy(
207 &self,
208 ) -> crate::builder::storage_control::LockBucketRetentionPolicy {
209 self.storage.lock_bucket_retention_policy()
210 }
211
212 /// Updates a bucket. Changes to the bucket are readable immediately after
213 /// writing, but configuration changes might take time to propagate. This
214 /// method supports `patch` semantics.
215 ///
216 /// **IAM Permissions**:
217 ///
218 /// Requires `storage.buckets.update` IAM permission on the bucket.
219 /// Additionally, to enable specific bucket features, the authenticated user
220 /// must have the following permissions:
221 ///
222 /// - To set bucket IP filtering rules: `storage.buckets.setIpFilter`
223 /// - To update public access prevention policies or access control lists
224 /// (ACLs): `storage.buckets.setIamPolicy`
225 ///
226 /// # Example
227 /// ```
228 /// # use google_cloud_storage::client::StorageControl;
229 /// # extern crate wkt as google_cloud_wkt;
230 /// use google_cloud_wkt::FieldMask;
231 /// use google_cloud_storage::model::Bucket;
232 /// use google_cloud_storage::Result;
233 /// async fn sample(
234 /// client: &StorageControl, project_id: &str, bucket_id: &str
235 /// ) -> Result<()> {
236 /// let response = client.update_bucket()
237 /// .set_bucket(
238 /// Bucket::new().set_name(format!("projects/{project_id}/buckets/{bucket_id}"))/* set fields */
239 /// )
240 /// .set_update_mask(FieldMask::default().set_paths(["updated.field.path1", "updated.field.path2"]))
241 /// .send().await?;
242 /// println!("response {:?}", response);
243 /// Ok(())
244 /// }
245 /// ```
246 pub fn update_bucket(&self) -> crate::builder::storage_control::UpdateBucket {
247 self.storage.update_bucket()
248 }
249
250 /// Concatenates a list of existing objects into a new object in the same
251 /// bucket. The existing source objects are unaffected by this operation.
252 ///
253 /// **IAM Permissions**:
254 ///
255 /// Requires the `storage.objects.create` and `storage.objects.get` IAM
256 /// permissions to use this method. If the new composite object
257 /// overwrites an existing object, the authenticated user must also have
258 /// the `storage.objects.delete` permission. If the request body includes
259 /// the retention property, the authenticated user must also have the
260 /// `storage.objects.setRetention` IAM permission.
261 ///
262 /// # Example
263 /// ```
264 /// # use google_cloud_storage::client::StorageControl;
265 /// use google_cloud_storage::Result;
266 /// async fn sample(
267 /// client: &StorageControl
268 /// ) -> Result<()> {
269 /// let response = client.compose_object()
270 /// /* set fields */
271 /// .send().await?;
272 /// println!("response {:?}", response);
273 /// Ok(())
274 /// }
275 /// ```
276 pub fn compose_object(&self) -> crate::builder::storage_control::ComposeObject {
277 self.storage.compose_object()
278 }
279
280 /// Deletes an object and its metadata. Deletions are permanent if versioning
281 /// is not enabled for the bucket, or if the generation parameter is used, or
282 /// if soft delete is not
283 /// enabled for the bucket.
284 /// When this API is used to delete an object from a bucket that has soft
285 /// delete policy enabled, the object becomes soft deleted, and the
286 /// `softDeleteTime` and `hardDeleteTime` properties are set on the object.
287 /// This API cannot be used to permanently delete soft-deleted objects.
288 /// Soft-deleted objects are permanently deleted according to their
289 /// `hardDeleteTime`.
290 ///
291 /// You can use the [`RestoreObject`][google.storage.v2.Storage.RestoreObject]
292 /// API to restore soft-deleted objects until the soft delete retention period
293 /// has passed.
294 ///
295 /// **IAM Permissions**:
296 ///
297 /// Requires `storage.objects.delete` IAM permission on the bucket.
298 ///
299 /// [google.storage.v2.Storage.RestoreObject]: crate::client::StorageControl::restore_object
300 ///
301 /// # Example
302 /// ```
303 /// # use google_cloud_storage::client::StorageControl;
304 /// use google_cloud_storage::Result;
305 /// async fn sample(
306 /// client: &StorageControl
307 /// ) -> Result<()> {
308 /// client.delete_object()
309 /// /* set fields */
310 /// .send().await?;
311 /// Ok(())
312 /// }
313 /// ```
314 pub fn delete_object(&self) -> crate::builder::storage_control::DeleteObject {
315 self.storage.delete_object()
316 }
317
318 /// Restores a
319 /// soft-deleted object.
320 /// When a soft-deleted object is restored, a new copy of that object is
321 /// created in the same bucket and inherits the same metadata as the
322 /// soft-deleted object. The inherited metadata is the metadata that existed
323 /// when the original object became soft deleted, with the following
324 /// exceptions:
325 ///
326 /// - The `createTime` of the new object is set to the time at which the
327 /// soft-deleted object was restored.
328 /// - The `softDeleteTime` and `hardDeleteTime` values are cleared.
329 /// - A new generation is assigned and the metageneration is reset to 1.
330 /// - If the soft-deleted object was in a bucket that had Autoclass enabled,
331 /// the new object is
332 /// restored to Standard storage.
333 /// - The restored object inherits the bucket's default object ACL, unless
334 /// `copySourceAcl` is `true`.
335 ///
336 /// If a live object using the same name already exists in the bucket and
337 /// becomes overwritten, the live object becomes a noncurrent object if Object
338 /// Versioning is enabled on the bucket. If Object Versioning is not enabled,
339 /// the live object becomes soft deleted.
340 ///
341 /// **IAM Permissions**:
342 ///
343 /// Requires the following IAM permissions to use this method:
344 ///
345 /// - `storage.objects.restore`
346 /// - `storage.objects.create`
347 /// - `storage.objects.delete` (only required if overwriting an existing
348 /// object)
349 /// - `storage.objects.getIamPolicy` (only required if `projection` is `full`
350 /// and the relevant bucket
351 /// has uniform bucket-level access disabled)
352 /// - `storage.objects.setIamPolicy` (only required if `copySourceAcl` is
353 /// `true` and the relevant
354 /// bucket has uniform bucket-level access disabled)
355 ///
356 /// # Example
357 /// ```
358 /// # use google_cloud_storage::client::StorageControl;
359 /// use google_cloud_storage::Result;
360 /// async fn sample(
361 /// client: &StorageControl
362 /// ) -> Result<()> {
363 /// let response = client.restore_object()
364 /// /* set fields */
365 /// .send().await?;
366 /// println!("response {:?}", response);
367 /// Ok(())
368 /// }
369 /// ```
370 pub fn restore_object(&self) -> crate::builder::storage_control::RestoreObject {
371 self.storage.restore_object()
372 }
373
374 /// Retrieves object metadata.
375 ///
376 /// **IAM Permissions**:
377 ///
378 /// Requires `storage.objects.get` IAM permission on the bucket.
379 /// To return object ACLs, the authenticated user must also have
380 /// the `storage.objects.getIamPolicy` permission.
381 ///
382 /// # Example
383 /// ```
384 /// # use google_cloud_storage::client::StorageControl;
385 /// use google_cloud_storage::Result;
386 /// async fn sample(
387 /// client: &StorageControl
388 /// ) -> Result<()> {
389 /// let response = client.get_object()
390 /// /* set fields */
391 /// .send().await?;
392 /// println!("response {:?}", response);
393 /// Ok(())
394 /// }
395 /// ```
396 pub fn get_object(&self) -> crate::builder::storage_control::GetObject {
397 self.storage.get_object()
398 }
399
400 /// Updates an object's metadata.
401 /// Equivalent to JSON API's `storage.objects.patch` method.
402 ///
403 /// **IAM Permissions**:
404 ///
405 /// Requires `storage.objects.update` IAM permission on the bucket.
406 ///
407 /// # Example
408 /// ```
409 /// # use google_cloud_storage::client::StorageControl;
410 /// use google_cloud_storage::Result;
411 /// async fn sample(
412 /// client: &StorageControl
413 /// ) -> Result<()> {
414 /// let response = client.update_object()
415 /// /* set fields */
416 /// .send().await?;
417 /// println!("response {:?}", response);
418 /// Ok(())
419 /// }
420 /// ```
421 pub fn update_object(&self) -> crate::builder::storage_control::UpdateObject {
422 self.storage.update_object()
423 }
424
425 /// Retrieves a list of objects matching the criteria.
426 ///
427 /// **IAM Permissions**:
428 ///
429 /// The authenticated user requires `storage.objects.list`
430 /// IAM permission to use this method. To return object ACLs, the
431 /// authenticated user must also
432 /// have the `storage.objects.getIamPolicy` permission.
433 ///
434 /// # Example
435 /// ```
436 /// # use google_cloud_storage::client::StorageControl;
437 /// use google_cloud_gax::paginator::ItemPaginator as _;
438 /// use google_cloud_storage::Result;
439 /// async fn sample(
440 /// client: &StorageControl
441 /// ) -> Result<()> {
442 /// let mut list = client.list_objects()
443 /// /* set fields */
444 /// .by_item();
445 /// while let Some(item) = list.next().await.transpose()? {
446 /// println!("{:?}", item);
447 /// }
448 /// Ok(())
449 /// }
450 /// ```
451 pub fn list_objects(&self) -> crate::builder::storage_control::ListObjects {
452 self.storage.list_objects()
453 }
454
455 /// Rewrites a source object to a destination object. Optionally overrides
456 /// metadata.
457 ///
458 /// # Example
459 /// ```
460 /// # use google_cloud_storage::client::StorageControl;
461 /// use google_cloud_storage::Result;
462 /// async fn sample(
463 /// client: &StorageControl
464 /// ) -> Result<()> {
465 /// let response = client.rewrite_object()
466 /// /* set fields */
467 /// .send().await?;
468 /// println!("response {:?}", response);
469 /// Ok(())
470 /// }
471 /// ```
472 pub fn rewrite_object(&self) -> crate::builder::storage_control::RewriteObject {
473 self.storage.rewrite_object()
474 }
475
476 /// Moves the source object to the destination object in the same bucket.
477 /// This operation moves a source object to a destination object in the
478 /// same bucket by renaming the object. The move itself is an atomic
479 /// transaction, ensuring all steps either complete successfully or no
480 /// changes are made.
481 ///
482 /// **IAM Permissions**:
483 ///
484 /// Requires the following IAM permissions to use this method:
485 ///
486 /// - `storage.objects.move`
487 /// - `storage.objects.create`
488 /// - `storage.objects.delete` (only required if overwriting an existing
489 /// object)
490 ///
491 /// # Example
492 /// ```
493 /// # use google_cloud_storage::client::StorageControl;
494 /// use google_cloud_storage::Result;
495 /// async fn sample(
496 /// client: &StorageControl
497 /// ) -> Result<()> {
498 /// let response = client.move_object()
499 /// /* set fields */
500 /// .send().await?;
501 /// println!("response {:?}", response);
502 /// Ok(())
503 /// }
504 /// ```
505 pub fn move_object(&self) -> crate::builder::storage_control::MoveObject {
506 self.storage.move_object()
507 }
508
509 /// Creates a new folder. This operation is only applicable to a hierarchical
510 /// namespace enabled bucket.
511 ///
512 /// # Example
513 /// ```
514 /// # use google_cloud_storage::client::StorageControl;
515 /// use google_cloud_storage::model::Folder;
516 /// use google_cloud_storage::Result;
517 /// async fn sample(
518 /// client: &StorageControl, project_id: &str, bucket_id: &str
519 /// ) -> Result<()> {
520 /// let response = client.create_folder()
521 /// .set_parent(format!("projects/{project_id}/buckets/{bucket_id}"))
522 /// .set_folder_id("folder_id_value")
523 /// .set_folder(
524 /// Folder::new()/* set fields */
525 /// )
526 /// .send().await?;
527 /// println!("response {:?}", response);
528 /// Ok(())
529 /// }
530 /// ```
531 pub fn create_folder(&self) -> crate::builder::storage_control::CreateFolder {
532 self.control.create_folder()
533 }
534
535 /// Permanently deletes an empty folder. This operation is only applicable to a
536 /// hierarchical namespace enabled bucket.
537 ///
538 /// # Example
539 /// ```
540 /// # use google_cloud_storage::client::StorageControl;
541 /// use google_cloud_storage::Result;
542 /// async fn sample(
543 /// client: &StorageControl, project_id: &str, bucket_id: &str, folder_id: &str
544 /// ) -> Result<()> {
545 /// client.delete_folder()
546 /// .set_name(format!("projects/{project_id}/buckets/{bucket_id}/folders/{folder_id}"))
547 /// .send().await?;
548 /// Ok(())
549 /// }
550 /// ```
551 pub fn delete_folder(&self) -> crate::builder::storage_control::DeleteFolder {
552 self.control.delete_folder()
553 }
554
555 /// Returns metadata for the specified folder. This operation is only
556 /// applicable to a hierarchical namespace enabled bucket.
557 ///
558 /// # Example
559 /// ```
560 /// # use google_cloud_storage::client::StorageControl;
561 /// use google_cloud_storage::Result;
562 /// async fn sample(
563 /// client: &StorageControl, project_id: &str, bucket_id: &str, folder_id: &str
564 /// ) -> Result<()> {
565 /// let response = client.get_folder()
566 /// .set_name(format!("projects/{project_id}/buckets/{bucket_id}/folders/{folder_id}"))
567 /// .send().await?;
568 /// println!("response {:?}", response);
569 /// Ok(())
570 /// }
571 /// ```
572 pub fn get_folder(&self) -> crate::builder::storage_control::GetFolder {
573 self.control.get_folder()
574 }
575
576 /// Retrieves a list of folders. This operation is only applicable to a
577 /// hierarchical namespace enabled bucket.
578 ///
579 /// # Example
580 /// ```
581 /// # use google_cloud_storage::client::StorageControl;
582 /// use google_cloud_gax::paginator::ItemPaginator as _;
583 /// use google_cloud_storage::Result;
584 /// async fn sample(
585 /// client: &StorageControl, project_id: &str, bucket_id: &str
586 /// ) -> Result<()> {
587 /// let mut list = client.list_folders()
588 /// .set_parent(format!("projects/{project_id}/buckets/{bucket_id}"))
589 /// .by_item();
590 /// while let Some(item) = list.next().await.transpose()? {
591 /// println!("{:?}", item);
592 /// }
593 /// Ok(())
594 /// }
595 /// ```
596 pub fn list_folders(&self) -> crate::builder::storage_control::ListFolders {
597 self.control.list_folders()
598 }
599
600 /// Renames a source folder to a destination folder. This operation is only
601 /// applicable to a hierarchical namespace enabled bucket. During a rename, the
602 /// source and destination folders are locked until the long running operation
603 /// completes.
604 ///
605 /// # Long running operations
606 ///
607 /// This method is used to start, and/or poll a [long-running Operation].
608 /// The [Working with long-running operations] chapter in the [user guide]
609 /// covers these operations in detail.
610 ///
611 /// [long-running operation]: https://google.aip.dev/151
612 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
613 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
614 ///
615 /// # Example
616 /// ```
617 /// # use google_cloud_storage::client::StorageControl;
618 /// use google_cloud_lro::Poller;
619 /// use google_cloud_storage::Result;
620 /// async fn sample(
621 /// client: &StorageControl
622 /// ) -> Result<()> {
623 /// let response = client.rename_folder()
624 /// /* set fields */
625 /// .poller().until_done().await?;
626 /// println!("response {:?}", response);
627 /// Ok(())
628 /// }
629 /// ```
630 pub fn rename_folder(&self) -> crate::builder::storage_control::RenameFolder {
631 self.control.rename_folder()
632 }
633
634 /// Deletes a folder recursively. This operation is only applicable to a
635 /// hierarchical namespace enabled bucket.
636 ///
637 /// # Long running operations
638 ///
639 /// This method is used to start, and/or poll a [long-running Operation].
640 /// The [Working with long-running operations] chapter in the [user guide]
641 /// covers these operations in detail.
642 ///
643 /// [long-running operation]: https://google.aip.dev/151
644 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
645 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
646 ///
647 /// # Example
648 /// ```
649 /// # use google_cloud_storage::client::StorageControl;
650 /// use google_cloud_lro::Poller;
651 /// use google_cloud_storage::Result;
652 /// async fn sample(
653 /// client: &StorageControl
654 /// ) -> Result<()> {
655 /// client.delete_folder_recursive()
656 /// /* set fields */
657 /// .poller().until_done().await?;
658 /// Ok(())
659 /// }
660 /// ```
661 pub fn delete_folder_recursive(
662 &self,
663 ) -> crate::builder::storage_control::DeleteFolderRecursive {
664 self.control.delete_folder_recursive()
665 }
666
667 /// Returns the storage layout configuration for a given bucket.
668 ///
669 /// # Example
670 /// ```
671 /// # use google_cloud_storage::client::StorageControl;
672 /// use google_cloud_storage::Result;
673 /// async fn sample(
674 /// client: &StorageControl, project_id: &str, bucket_id: &str
675 /// ) -> Result<()> {
676 /// let response = client.get_storage_layout()
677 /// .set_name(format!("projects/{project_id}/buckets/{bucket_id}/storageLayout"))
678 /// .send().await?;
679 /// println!("response {:?}", response);
680 /// Ok(())
681 /// }
682 /// ```
683 pub fn get_storage_layout(&self) -> crate::builder::storage_control::GetStorageLayout {
684 self.control.get_storage_layout()
685 }
686
687 /// Creates a new managed folder.
688 ///
689 /// # Example
690 /// ```
691 /// # use google_cloud_storage::client::StorageControl;
692 /// use google_cloud_storage::Result;
693 /// async fn sample(
694 /// client: &StorageControl
695 /// ) -> Result<()> {
696 /// let response = client.create_managed_folder()
697 /// /* set fields */
698 /// .send().await?;
699 /// println!("response {:?}", response);
700 /// Ok(())
701 /// }
702 /// ```
703 pub fn create_managed_folder(&self) -> crate::builder::storage_control::CreateManagedFolder {
704 self.control.create_managed_folder()
705 }
706
707 /// Permanently deletes an empty managed folder.
708 ///
709 /// # Example
710 /// ```
711 /// # use google_cloud_storage::client::StorageControl;
712 /// use google_cloud_storage::Result;
713 /// async fn sample(
714 /// client: &StorageControl, project_id: &str, bucket_id: &str, managed_folder_id: &str
715 /// ) -> Result<()> {
716 /// client.delete_managed_folder()
717 /// .set_name(format!("projects/{project_id}/buckets/{bucket_id}/managedFolders/{managed_folder_id}"))
718 /// .send().await?;
719 /// Ok(())
720 /// }
721 /// ```
722 pub fn delete_managed_folder(&self) -> crate::builder::storage_control::DeleteManagedFolder {
723 self.control.delete_managed_folder()
724 }
725
726 /// Returns metadata for the specified managed folder.
727 ///
728 /// # Example
729 /// ```
730 /// # use google_cloud_storage::client::StorageControl;
731 /// use google_cloud_storage::Result;
732 /// async fn sample(
733 /// client: &StorageControl, project_id: &str, bucket_id: &str, managed_folder_id: &str
734 /// ) -> Result<()> {
735 /// let response = client.get_managed_folder()
736 /// .set_name(format!("projects/{project_id}/buckets/{bucket_id}/managedFolders/{managed_folder_id}"))
737 /// .send().await?;
738 /// println!("response {:?}", response);
739 /// Ok(())
740 /// }
741 /// ```
742 pub fn get_managed_folder(&self) -> crate::builder::storage_control::GetManagedFolder {
743 self.control.get_managed_folder()
744 }
745
746 /// Retrieves a list of managed folders for a given bucket.
747 ///
748 /// # Example
749 /// ```
750 /// # use google_cloud_storage::client::StorageControl;
751 /// use google_cloud_gax::paginator::ItemPaginator as _;
752 /// use google_cloud_storage::Result;
753 /// async fn sample(
754 /// client: &StorageControl, project_id: &str, bucket_id: &str
755 /// ) -> Result<()> {
756 /// let mut list = client.list_managed_folders()
757 /// .set_parent(format!("projects/{project_id}/buckets/{bucket_id}"))
758 /// .by_item();
759 /// while let Some(item) = list.next().await.transpose()? {
760 /// println!("{:?}", item);
761 /// }
762 /// Ok(())
763 /// }
764 /// ```
765 pub fn list_managed_folders(&self) -> crate::builder::storage_control::ListManagedFolders {
766 self.control.list_managed_folders()
767 }
768
769 /// Updates a managed folder. Currently, this RPC only supports updating the
770 /// `rapid_cache_config` field.
771 ///
772 /// # Example
773 /// ```
774 /// # use google_cloud_storage::client::StorageControl;
775 /// use google_cloud_storage::Result;
776 /// async fn sample(
777 /// client: &StorageControl
778 /// ) -> Result<()> {
779 /// let response = client.update_managed_folder()
780 /// /* set fields */
781 /// .send().await?;
782 /// println!("response {:?}", response);
783 /// Ok(())
784 /// }
785 /// ```
786 pub fn update_managed_folder(&self) -> crate::builder::storage_control::UpdateManagedFolder {
787 self.control.update_managed_folder()
788 }
789
790 /// Creates an Anywhere Cache instance.
791 ///
792 /// # Long running operations
793 ///
794 /// This method is used to start, and/or poll a [long-running Operation].
795 /// The [Working with long-running operations] chapter in the [user guide]
796 /// covers these operations in detail.
797 ///
798 /// [long-running operation]: https://google.aip.dev/151
799 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
800 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
801 ///
802 /// # Example
803 /// ```
804 /// # use google_cloud_storage::client::StorageControl;
805 /// use google_cloud_lro::Poller;
806 /// use google_cloud_storage::Result;
807 /// async fn sample(
808 /// client: &StorageControl
809 /// ) -> Result<()> {
810 /// let response = client.create_anywhere_cache()
811 /// /* set fields */
812 /// .poller().until_done().await?;
813 /// println!("response {:?}", response);
814 /// Ok(())
815 /// }
816 /// ```
817 pub fn create_anywhere_cache(&self) -> crate::builder::storage_control::CreateAnywhereCache {
818 self.control.create_anywhere_cache()
819 }
820
821 /// Updates an Anywhere Cache instance. Mutable fields include `ttl` and
822 /// `admission_policy`.
823 ///
824 /// # Long running operations
825 ///
826 /// This method is used to start, and/or poll a [long-running Operation].
827 /// The [Working with long-running operations] chapter in the [user guide]
828 /// covers these operations in detail.
829 ///
830 /// [long-running operation]: https://google.aip.dev/151
831 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
832 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
833 ///
834 /// # Example
835 /// ```
836 /// # use google_cloud_storage::client::StorageControl;
837 /// use google_cloud_lro::Poller;
838 /// use google_cloud_storage::Result;
839 /// async fn sample(
840 /// client: &StorageControl
841 /// ) -> Result<()> {
842 /// let response = client.update_anywhere_cache()
843 /// /* set fields */
844 /// .poller().until_done().await?;
845 /// println!("response {:?}", response);
846 /// Ok(())
847 /// }
848 /// ```
849 pub fn update_anywhere_cache(&self) -> crate::builder::storage_control::UpdateAnywhereCache {
850 self.control.update_anywhere_cache()
851 }
852
853 /// Disables an Anywhere Cache instance. A disabled instance is read-only. The
854 /// disablement could be revoked by calling ResumeAnywhereCache. The cache
855 /// instance will be deleted automatically if it remains in the disabled state
856 /// for at least one hour.
857 ///
858 /// # Example
859 /// ```
860 /// # use google_cloud_storage::client::StorageControl;
861 /// use google_cloud_storage::Result;
862 /// async fn sample(
863 /// client: &StorageControl
864 /// ) -> Result<()> {
865 /// let response = client.disable_anywhere_cache()
866 /// /* set fields */
867 /// .send().await?;
868 /// println!("response {:?}", response);
869 /// Ok(())
870 /// }
871 /// ```
872 pub fn disable_anywhere_cache(&self) -> crate::builder::storage_control::DisableAnywhereCache {
873 self.control.disable_anywhere_cache()
874 }
875
876 /// Pauses an Anywhere Cache instance.
877 ///
878 /// # Example
879 /// ```
880 /// # use google_cloud_storage::client::StorageControl;
881 /// use google_cloud_storage::Result;
882 /// async fn sample(
883 /// client: &StorageControl
884 /// ) -> Result<()> {
885 /// let response = client.pause_anywhere_cache()
886 /// /* set fields */
887 /// .send().await?;
888 /// println!("response {:?}", response);
889 /// Ok(())
890 /// }
891 /// ```
892 pub fn pause_anywhere_cache(&self) -> crate::builder::storage_control::PauseAnywhereCache {
893 self.control.pause_anywhere_cache()
894 }
895
896 /// Resumes a disabled or paused Anywhere Cache instance.
897 ///
898 /// # Example
899 /// ```
900 /// # use google_cloud_storage::client::StorageControl;
901 /// use google_cloud_storage::Result;
902 /// async fn sample(
903 /// client: &StorageControl
904 /// ) -> Result<()> {
905 /// let response = client.resume_anywhere_cache()
906 /// /* set fields */
907 /// .send().await?;
908 /// println!("response {:?}", response);
909 /// Ok(())
910 /// }
911 /// ```
912 pub fn resume_anywhere_cache(&self) -> crate::builder::storage_control::ResumeAnywhereCache {
913 self.control.resume_anywhere_cache()
914 }
915
916 /// Gets an Anywhere Cache instance.
917 ///
918 /// # Example
919 /// ```
920 /// # use google_cloud_storage::client::StorageControl;
921 /// use google_cloud_storage::Result;
922 /// async fn sample(
923 /// client: &StorageControl, project_id: &str, bucket_id: &str, anywhere_cache_id: &str
924 /// ) -> Result<()> {
925 /// let response = client.get_anywhere_cache()
926 /// .set_name(format!("projects/{project_id}/buckets/{bucket_id}/anywhereCaches/{anywhere_cache_id}"))
927 /// .send().await?;
928 /// println!("response {:?}", response);
929 /// Ok(())
930 /// }
931 /// ```
932 pub fn get_anywhere_cache(&self) -> crate::builder::storage_control::GetAnywhereCache {
933 self.control.get_anywhere_cache()
934 }
935
936 /// Lists Anywhere Cache instances for a given bucket.
937 ///
938 /// # Example
939 /// ```
940 /// # use google_cloud_storage::client::StorageControl;
941 /// use google_cloud_gax::paginator::ItemPaginator as _;
942 /// use google_cloud_storage::Result;
943 /// async fn sample(
944 /// client: &StorageControl, project_id: &str, bucket_id: &str
945 /// ) -> Result<()> {
946 /// let mut list = client.list_anywhere_caches()
947 /// .set_parent(format!("projects/{project_id}/buckets/{bucket_id}"))
948 /// .by_item();
949 /// while let Some(item) = list.next().await.transpose()? {
950 /// println!("{:?}", item);
951 /// }
952 /// Ok(())
953 /// }
954 /// ```
955 pub fn list_anywhere_caches(&self) -> crate::builder::storage_control::ListAnywhereCaches {
956 self.control.list_anywhere_caches()
957 }
958
959 /// Creates a Rapid Cache instance.
960 ///
961 /// # Long running operations
962 ///
963 /// This method is used to start, and/or poll a [long-running Operation].
964 /// The [Working with long-running operations] chapter in the [user guide]
965 /// covers these operations in detail.
966 ///
967 /// [long-running operation]: https://google.aip.dev/151
968 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
969 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
970 ///
971 /// # Example
972 /// ```
973 /// # use google_cloud_storage::client::StorageControl;
974 /// use google_cloud_lro::Poller;
975 /// use google_cloud_storage::Result;
976 /// async fn sample(
977 /// client: &StorageControl
978 /// ) -> Result<()> {
979 /// let response = client.create_rapid_cache()
980 /// /* set fields */
981 /// .poller().until_done().await?;
982 /// println!("response {:?}", response);
983 /// Ok(())
984 /// }
985 /// ```
986 pub fn create_rapid_cache(&self) -> crate::builder::storage_control::CreateRapidCache {
987 self.control.create_rapid_cache()
988 }
989
990 /// Updates a Rapid Cache instance.
991 ///
992 /// # Long running operations
993 ///
994 /// This method is used to start, and/or poll a [long-running Operation].
995 /// The [Working with long-running operations] chapter in the [user guide]
996 /// covers these operations in detail.
997 ///
998 /// [long-running operation]: https://google.aip.dev/151
999 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
1000 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
1001 ///
1002 /// # Example
1003 /// ```
1004 /// # use google_cloud_storage::client::StorageControl;
1005 /// use google_cloud_lro::Poller;
1006 /// use google_cloud_storage::Result;
1007 /// async fn sample(
1008 /// client: &StorageControl
1009 /// ) -> Result<()> {
1010 /// let response = client.update_rapid_cache()
1011 /// /* set fields */
1012 /// .poller().until_done().await?;
1013 /// println!("response {:?}", response);
1014 /// Ok(())
1015 /// }
1016 /// ```
1017 pub fn update_rapid_cache(&self) -> crate::builder::storage_control::UpdateRapidCache {
1018 self.control.update_rapid_cache()
1019 }
1020
1021 /// Disables a Rapid Cache instance.
1022 ///
1023 /// # Long running operations
1024 ///
1025 /// This method is used to start, and/or poll a [long-running Operation].
1026 /// The [Working with long-running operations] chapter in the [user guide]
1027 /// covers these operations in detail.
1028 ///
1029 /// [long-running operation]: https://google.aip.dev/151
1030 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
1031 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
1032 ///
1033 /// # Example
1034 /// ```
1035 /// # use google_cloud_storage::client::StorageControl;
1036 /// use google_cloud_lro::Poller;
1037 /// use google_cloud_storage::Result;
1038 /// async fn sample(
1039 /// client: &StorageControl
1040 /// ) -> Result<()> {
1041 /// let response = client.disable_rapid_cache()
1042 /// /* set fields */
1043 /// .poller().until_done().await?;
1044 /// println!("response {:?}", response);
1045 /// Ok(())
1046 /// }
1047 /// ```
1048 pub fn disable_rapid_cache(&self) -> crate::builder::storage_control::DisableRapidCache {
1049 self.control.disable_rapid_cache()
1050 }
1051
1052 /// Gets a Rapid Cache instance.
1053 ///
1054 /// # Example
1055 /// ```
1056 /// # use google_cloud_storage::client::StorageControl;
1057 /// use google_cloud_storage::Result;
1058 /// async fn sample(
1059 /// client: &StorageControl, project_id: &str, bucket_id: &str, rapid_cache_id: &str
1060 /// ) -> Result<()> {
1061 /// let response = client.get_rapid_cache()
1062 /// .set_name(format!("projects/{project_id}/buckets/{bucket_id}/rapidCaches/{rapid_cache_id}"))
1063 /// .send().await?;
1064 /// println!("response {:?}", response);
1065 /// Ok(())
1066 /// }
1067 /// ```
1068 pub fn get_rapid_cache(&self) -> crate::builder::storage_control::GetRapidCache {
1069 self.control.get_rapid_cache()
1070 }
1071
1072 /// Lists Rapid Cache instances for a given bucket.
1073 ///
1074 /// # Example
1075 /// ```
1076 /// # use google_cloud_storage::client::StorageControl;
1077 /// use google_cloud_gax::paginator::ItemPaginator as _;
1078 /// use google_cloud_storage::Result;
1079 /// async fn sample(
1080 /// client: &StorageControl, project_id: &str, bucket_id: &str
1081 /// ) -> Result<()> {
1082 /// let mut list = client.list_rapid_caches()
1083 /// .set_parent(format!("projects/{project_id}/buckets/{bucket_id}"))
1084 /// .by_item();
1085 /// while let Some(item) = list.next().await.transpose()? {
1086 /// println!("{:?}", item);
1087 /// }
1088 /// Ok(())
1089 /// }
1090 /// ```
1091 pub fn list_rapid_caches(&self) -> crate::builder::storage_control::ListRapidCaches {
1092 self.control.list_rapid_caches()
1093 }
1094
1095 /// Returns the Project scoped singleton IntelligenceConfig resource.
1096 ///
1097 /// # Example
1098 /// ```
1099 /// # use google_cloud_storage::client::StorageControl;
1100 /// use google_cloud_storage::Result;
1101 /// async fn sample(
1102 /// client: &StorageControl
1103 /// ) -> Result<()> {
1104 /// let response = client.get_project_intelligence_config()
1105 /// /* set fields */
1106 /// .send().await?;
1107 /// println!("response {:?}", response);
1108 /// Ok(())
1109 /// }
1110 /// ```
1111 pub fn get_project_intelligence_config(
1112 &self,
1113 ) -> crate::builder::storage_control::GetProjectIntelligenceConfig {
1114 self.control.get_project_intelligence_config()
1115 }
1116
1117 /// Updates the Project scoped singleton IntelligenceConfig resource.
1118 ///
1119 /// # Example
1120 /// ```
1121 /// # use google_cloud_storage::client::StorageControl;
1122 /// use google_cloud_storage::Result;
1123 /// async fn sample(
1124 /// client: &StorageControl
1125 /// ) -> Result<()> {
1126 /// let response = client.update_project_intelligence_config()
1127 /// /* set fields */
1128 /// .send().await?;
1129 /// println!("response {:?}", response);
1130 /// Ok(())
1131 /// }
1132 /// ```
1133 pub fn update_project_intelligence_config(
1134 &self,
1135 ) -> crate::builder::storage_control::UpdateProjectIntelligenceConfig {
1136 self.control.update_project_intelligence_config()
1137 }
1138
1139 /// Returns the Folder scoped singleton IntelligenceConfig resource.
1140 ///
1141 /// # Example
1142 /// ```
1143 /// # use google_cloud_storage::client::StorageControl;
1144 /// use google_cloud_storage::Result;
1145 /// async fn sample(
1146 /// client: &StorageControl
1147 /// ) -> Result<()> {
1148 /// let response = client.get_folder_intelligence_config()
1149 /// /* set fields */
1150 /// .send().await?;
1151 /// println!("response {:?}", response);
1152 /// Ok(())
1153 /// }
1154 /// ```
1155 pub fn get_folder_intelligence_config(
1156 &self,
1157 ) -> crate::builder::storage_control::GetFolderIntelligenceConfig {
1158 self.control.get_folder_intelligence_config()
1159 }
1160
1161 /// Updates the Folder scoped singleton IntelligenceConfig resource.
1162 ///
1163 /// # Example
1164 /// ```
1165 /// # use google_cloud_storage::client::StorageControl;
1166 /// use google_cloud_storage::Result;
1167 /// async fn sample(
1168 /// client: &StorageControl
1169 /// ) -> Result<()> {
1170 /// let response = client.update_folder_intelligence_config()
1171 /// /* set fields */
1172 /// .send().await?;
1173 /// println!("response {:?}", response);
1174 /// Ok(())
1175 /// }
1176 /// ```
1177 pub fn update_folder_intelligence_config(
1178 &self,
1179 ) -> crate::builder::storage_control::UpdateFolderIntelligenceConfig {
1180 self.control.update_folder_intelligence_config()
1181 }
1182
1183 /// Returns the Organization scoped singleton IntelligenceConfig resource.
1184 ///
1185 /// # Example
1186 /// ```
1187 /// # use google_cloud_storage::client::StorageControl;
1188 /// use google_cloud_storage::Result;
1189 /// async fn sample(
1190 /// client: &StorageControl
1191 /// ) -> Result<()> {
1192 /// let response = client.get_organization_intelligence_config()
1193 /// /* set fields */
1194 /// .send().await?;
1195 /// println!("response {:?}", response);
1196 /// Ok(())
1197 /// }
1198 /// ```
1199 pub fn get_organization_intelligence_config(
1200 &self,
1201 ) -> crate::builder::storage_control::GetOrganizationIntelligenceConfig {
1202 self.control.get_organization_intelligence_config()
1203 }
1204
1205 /// Updates the Organization scoped singleton IntelligenceConfig resource.
1206 ///
1207 /// # Example
1208 /// ```
1209 /// # use google_cloud_storage::client::StorageControl;
1210 /// use google_cloud_storage::Result;
1211 /// async fn sample(
1212 /// client: &StorageControl
1213 /// ) -> Result<()> {
1214 /// let response = client.update_organization_intelligence_config()
1215 /// /* set fields */
1216 /// .send().await?;
1217 /// println!("response {:?}", response);
1218 /// Ok(())
1219 /// }
1220 /// ```
1221 pub fn update_organization_intelligence_config(
1222 &self,
1223 ) -> crate::builder::storage_control::UpdateOrganizationIntelligenceConfig {
1224 self.control.update_organization_intelligence_config()
1225 }
1226
1227 /// Gets the IAM policy for a specified bucket.
1228 /// The `resource` field in the request should be
1229 /// `projects/_/buckets/{bucket}` for a bucket, or
1230 /// `projects/_/buckets/{bucket}/managedFolders/{managedFolder}`
1231 /// for a managed folder.
1232 ///
1233 /// # Example
1234 /// ```
1235 /// # use google_cloud_storage::client::StorageControl;
1236 /// use google_cloud_storage::Result;
1237 /// async fn sample(
1238 /// client: &StorageControl
1239 /// ) -> Result<()> {
1240 /// let response = client.get_iam_policy()
1241 /// /* set fields */
1242 /// .send().await?;
1243 /// println!("response {:?}", response);
1244 /// Ok(())
1245 /// }
1246 /// ```
1247 pub fn get_iam_policy(&self) -> crate::builder::storage_control::GetIamPolicy {
1248 self.control.get_iam_policy()
1249 }
1250
1251 /// Updates an IAM policy for the specified bucket.
1252 /// The `resource` field in the request should be
1253 /// `projects/_/buckets/{bucket}` for a bucket, or
1254 /// `projects/_/buckets/{bucket}/managedFolders/{managedFolder}`
1255 /// for a managed folder.
1256 ///
1257 /// # Example
1258 /// ```
1259 /// # use google_cloud_storage::client::StorageControl;
1260 /// use google_cloud_storage::Result;
1261 /// async fn sample(
1262 /// client: &StorageControl
1263 /// ) -> Result<()> {
1264 /// let response = client.set_iam_policy()
1265 /// /* set fields */
1266 /// .send().await?;
1267 /// println!("response {:?}", response);
1268 /// Ok(())
1269 /// }
1270 /// ```
1271 pub fn set_iam_policy(&self) -> crate::builder::storage_control::SetIamPolicy {
1272 self.control.set_iam_policy()
1273 }
1274
1275 /// Tests a set of permissions on the given bucket, object, or managed folder
1276 /// to see which, if any, are held by the caller.
1277 /// The `resource` field in the request should be
1278 /// `projects/_/buckets/{bucket}` for a bucket,
1279 /// `projects/_/buckets/{bucket}/objects/{object}` for an object, or
1280 /// `projects/_/buckets/{bucket}/managedFolders/{managedFolder}`
1281 /// for a managed folder.
1282 ///
1283 /// # Example
1284 /// ```
1285 /// # use google_cloud_storage::client::StorageControl;
1286 /// use google_cloud_storage::Result;
1287 /// async fn sample(
1288 /// client: &StorageControl
1289 /// ) -> Result<()> {
1290 /// let response = client.test_iam_permissions()
1291 /// /* set fields */
1292 /// .send().await?;
1293 /// println!("response {:?}", response);
1294 /// Ok(())
1295 /// }
1296 /// ```
1297 pub fn test_iam_permissions(&self) -> crate::builder::storage_control::TestIamPermissions {
1298 self.control.test_iam_permissions()
1299 }
1300
1301 /// Gets the `IntelligenceFinding` for a project.
1302 ///
1303 /// # Example
1304 /// ```
1305 /// # use google_cloud_storage::client::StorageControl;
1306 /// use google_cloud_storage::Result;
1307 /// async fn sample(
1308 /// client: &StorageControl, project_id: &str, location_id: &str, intelligence_finding_id: &str
1309 /// ) -> Result<()> {
1310 /// let response = client.get_intelligence_finding()
1311 /// .set_name(format!("projects/{project_id}/locations/{location_id}/intelligenceFindings/{intelligence_finding_id}"))
1312 /// .send().await?;
1313 /// println!("response {:?}", response);
1314 /// Ok(())
1315 /// }
1316 /// ```
1317 pub fn get_intelligence_finding(
1318 &self,
1319 ) -> crate::builder::storage_control::GetIntelligenceFinding {
1320 self.control.get_intelligence_finding()
1321 }
1322
1323 /// Lists the `IntelligenceFinding` resources for the specified the project.
1324 ///
1325 /// # Example
1326 /// ```
1327 /// # use google_cloud_storage::client::StorageControl;
1328 /// use google_cloud_gax::paginator::ItemPaginator as _;
1329 /// use google_cloud_storage::Result;
1330 /// async fn sample(
1331 /// client: &StorageControl, project_id: &str, location_id: &str
1332 /// ) -> Result<()> {
1333 /// let mut list = client.list_intelligence_findings()
1334 /// .set_parent(format!("projects/{project_id}/locations/{location_id}"))
1335 /// .by_item();
1336 /// while let Some(item) = list.next().await.transpose()? {
1337 /// println!("{:?}", item);
1338 /// }
1339 /// Ok(())
1340 /// }
1341 /// ```
1342 pub fn list_intelligence_findings(
1343 &self,
1344 ) -> crate::builder::storage_control::ListIntelligenceFindings {
1345 self.control.list_intelligence_findings()
1346 }
1347
1348 /// Summarizes the intelligence findings for the specified scope (organization,
1349 /// folder or project).
1350 ///
1351 /// # Example
1352 /// ```
1353 /// # use google_cloud_storage::client::StorageControl;
1354 /// use google_cloud_gax::paginator::ItemPaginator as _;
1355 /// use google_cloud_storage::Result;
1356 /// async fn sample(
1357 /// client: &StorageControl
1358 /// ) -> Result<()> {
1359 /// let mut list = client.summarize_intelligence_findings()
1360 /// /* set fields */
1361 /// .by_item();
1362 /// while let Some(item) = list.next().await.transpose()? {
1363 /// println!("{:?}", item);
1364 /// }
1365 /// Ok(())
1366 /// }
1367 /// ```
1368 pub fn summarize_intelligence_findings(
1369 &self,
1370 ) -> crate::builder::storage_control::SummarizeIntelligenceFindings {
1371 self.control.summarize_intelligence_findings()
1372 }
1373
1374 /// Gets the `IntelligenceFindingRevision` resource.
1375 ///
1376 /// # Example
1377 /// ```
1378 /// # use google_cloud_storage::client::StorageControl;
1379 /// use google_cloud_storage::Result;
1380 /// async fn sample(
1381 /// client: &StorageControl, project_id: &str, location_id: &str, intelligence_finding_id: &str, revision_id: &str
1382 /// ) -> Result<()> {
1383 /// let response = client.get_intelligence_finding_revision()
1384 /// .set_name(format!("projects/{project_id}/locations/{location_id}/intelligenceFindings/{intelligence_finding_id}/revisions/{revision_id}"))
1385 /// .send().await?;
1386 /// println!("response {:?}", response);
1387 /// Ok(())
1388 /// }
1389 /// ```
1390 pub fn get_intelligence_finding_revision(
1391 &self,
1392 ) -> crate::builder::storage_control::GetIntelligenceFindingRevision {
1393 self.control.get_intelligence_finding_revision()
1394 }
1395
1396 /// Lists all the revisions of an `IntelligenceFinding` resource.
1397 ///
1398 /// # Example
1399 /// ```
1400 /// # use google_cloud_storage::client::StorageControl;
1401 /// use google_cloud_gax::paginator::ItemPaginator as _;
1402 /// use google_cloud_storage::Result;
1403 /// async fn sample(
1404 /// client: &StorageControl, project_id: &str, location_id: &str, intelligence_finding_id: &str
1405 /// ) -> Result<()> {
1406 /// let mut list = client.list_intelligence_finding_revisions()
1407 /// .set_parent(format!("projects/{project_id}/locations/{location_id}/intelligenceFindings/{intelligence_finding_id}"))
1408 /// .by_item();
1409 /// while let Some(item) = list.next().await.transpose()? {
1410 /// println!("{:?}", item);
1411 /// }
1412 /// Ok(())
1413 /// }
1414 /// ```
1415 pub fn list_intelligence_finding_revisions(
1416 &self,
1417 ) -> crate::builder::storage_control::ListIntelligenceFindingRevisions {
1418 self.control.list_intelligence_finding_revisions()
1419 }
1420
1421 /// Retrieves the full content of an object context, including its key, value,
1422 /// and any associated extended data for a given context key.
1423 ///
1424 /// Object contexts can optionally contain extended data. If an object context
1425 /// contains extended data, the metadata payload structure will contain only
1426 /// its type URL. To retrieve the full extended data, call this method.
1427 ///
1428 /// Returns the complete representation of the context as an
1429 /// [`ObjectFullContext`][google.storage.control.v2.ObjectFullContext].
1430 ///
1431 /// [google.storage.control.v2.ObjectFullContext]: crate::model::ObjectFullContext
1432 ///
1433 /// # Example
1434 /// ```
1435 /// # use google_cloud_storage::client::StorageControl;
1436 /// use google_cloud_storage::Result;
1437 /// async fn sample(
1438 /// client: &StorageControl
1439 /// ) -> Result<()> {
1440 /// let response = client.view_object_full_context()
1441 /// /* set fields */
1442 /// .send().await?;
1443 /// println!("response {:?}", response);
1444 /// Ok(())
1445 /// }
1446 /// ```
1447 pub fn view_object_full_context(
1448 &self,
1449 ) -> crate::builder::storage_control::ViewObjectFullContext {
1450 self.control.view_object_full_context()
1451 }
1452
1453 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
1454 ///
1455 /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
1456 ///
1457 /// # Example
1458 /// ```
1459 /// # use google_cloud_storage::client::StorageControl;
1460 /// use google_cloud_storage::Result;
1461 /// async fn sample(
1462 /// client: &StorageControl
1463 /// ) -> Result<()> {
1464 /// let response = client.get_operation()
1465 /// /* set fields */
1466 /// .send().await?;
1467 /// println!("response {:?}", response);
1468 /// Ok(())
1469 /// }
1470 /// ```
1471 pub fn get_operation(&self) -> crate::builder::storage_control::GetOperation {
1472 self.control.get_operation()
1473 }
1474
1475 /// Creates a new client from the provided stub.
1476 ///
1477 /// The most common case for calling this function is in tests mocking the
1478 /// client's behavior.
1479 pub fn from_stub<T>(stub: impl Into<std::sync::Arc<T>>) -> Self
1480 where
1481 T: crate::stub::StorageControl + 'static,
1482 {
1483 let stub: std::sync::Arc<T> = stub.into();
1484 Self {
1485 storage: crate::generated::gapic::client::StorageControl::from_stub::<std::sync::Arc<T>>(
1486 stub.clone(),
1487 ),
1488 control: crate::generated::gapic_control::client::StorageControl::from_stub::<
1489 std::sync::Arc<T>,
1490 >(stub),
1491 }
1492 }
1493
1494 pub(crate) async fn new(
1495 config: gaxi::options::ClientConfig,
1496 ) -> crate::ClientBuilderResult<Self> {
1497 let storage = crate::generated::gapic::client::StorageControl::new(config.clone()).await?;
1498 let control = crate::generated::gapic_control::client::StorageControl::new(config).await?;
1499 Ok(Self { storage, control })
1500 }
1501}