1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
// Copyright 2025 Google LLC
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// https://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//
// Code generated by sidekick. DO NOT EDIT.
use crate::control::client::*;
impl StorageControl {
/// Returns a builder for [StorageControl].
///
/// ```no_run
/// # tokio_test::block_on(async {
/// # use google_cloud_storage::client::StorageControl;
/// let client = StorageControl::builder().build().await?;
/// # gax::client_builder::Result::<()>::Ok(()) });
/// ```
pub fn builder() -> ClientBuilder {
gax::client_builder::internal::new_builder(client_builder::Factory)
}
/// Permanently deletes an empty bucket.
pub fn delete_bucket(&self) -> crate::builder::storage_control::DeleteBucket {
self.storage.delete_bucket()
}
/// Returns metadata for the specified bucket.
pub fn get_bucket(&self) -> crate::builder::storage_control::GetBucket {
self.storage.get_bucket()
}
/// Creates a new bucket.
pub fn create_bucket(&self) -> crate::builder::storage_control::CreateBucket {
self.storage.create_bucket()
}
/// Retrieves a list of buckets for a given project.
pub fn list_buckets(&self) -> crate::builder::storage_control::ListBuckets {
self.storage.list_buckets()
}
/// Locks retention policy on a bucket.
pub fn lock_bucket_retention_policy(
&self,
) -> crate::builder::storage_control::LockBucketRetentionPolicy {
self.storage.lock_bucket_retention_policy()
}
/// Updates a bucket. Equivalent to JSON API's storage.buckets.patch method.
pub fn update_bucket(&self) -> crate::builder::storage_control::UpdateBucket {
self.storage.update_bucket()
}
/// Concatenates a list of existing objects into a new object in the same
/// bucket.
pub fn compose_object(&self) -> crate::builder::storage_control::ComposeObject {
self.storage.compose_object()
}
/// Deletes an object and its metadata. Deletions are permanent if versioning
/// is not enabled for the bucket, or if the generation parameter is used, or
/// if [soft delete](https://cloud.google.com/storage/docs/soft-delete) is not
/// enabled for the bucket.
/// When this API is used to delete an object from a bucket that has soft
/// delete policy enabled, the object becomes soft deleted, and the
/// `softDeleteTime` and `hardDeleteTime` properties are set on the object.
/// This API cannot be used to permanently delete soft-deleted objects.
/// Soft-deleted objects are permanently deleted according to their
/// `hardDeleteTime`.
///
/// You can use the [`RestoreObject`][google.storage.v2.Storage.RestoreObject]
/// API to restore soft-deleted objects until the soft delete retention period
/// has passed.
///
/// **IAM Permissions**:
///
/// Requires `storage.objects.delete`
/// [IAM permission](https://cloud.google.com/iam/docs/overview#permissions) on
/// the bucket.
///
/// [google.storage.v2.Storage.RestoreObject]: crate::client::StorageControl::restore_object
pub fn delete_object(&self) -> crate::builder::storage_control::DeleteObject {
self.storage.delete_object()
}
/// Restores a soft-deleted object.
pub fn restore_object(&self) -> crate::builder::storage_control::RestoreObject {
self.storage.restore_object()
}
/// Retrieves object metadata.
///
/// **IAM Permissions**:
///
/// Requires `storage.objects.get`
/// [IAM permission](https://cloud.google.com/iam/docs/overview#permissions) on
/// the bucket. To return object ACLs, the authenticated user must also have
/// the `storage.objects.getIamPolicy` permission.
pub fn get_object(&self) -> crate::builder::storage_control::GetObject {
self.storage.get_object()
}
/// Updates an object's metadata.
/// Equivalent to JSON API's storage.objects.patch.
pub fn update_object(&self) -> crate::builder::storage_control::UpdateObject {
self.storage.update_object()
}
/// Retrieves a list of objects matching the criteria.
///
/// **IAM Permissions**:
///
/// The authenticated user requires `storage.objects.list`
/// [IAM permission](https://cloud.google.com/iam/docs/overview#permissions)
/// to use this method. To return object ACLs, the authenticated user must also
/// have the `storage.objects.getIamPolicy` permission.
pub fn list_objects(&self) -> crate::builder::storage_control::ListObjects {
self.storage.list_objects()
}
/// Rewrites a source object to a destination object. Optionally overrides
/// metadata.
pub fn rewrite_object(&self) -> crate::builder::storage_control::RewriteObject {
self.storage.rewrite_object()
}
/// Moves the source object to the destination object in the same bucket.
pub fn move_object(&self) -> crate::builder::storage_control::MoveObject {
self.storage.move_object()
}
/// Creates a new folder. This operation is only applicable to a hierarchical
/// namespace enabled bucket.
pub fn create_folder(&self) -> crate::builder::storage_control::CreateFolder {
self.control.create_folder()
}
/// Permanently deletes an empty folder. This operation is only applicable to a
/// hierarchical namespace enabled bucket.
pub fn delete_folder(&self) -> crate::builder::storage_control::DeleteFolder {
self.control.delete_folder()
}
/// Returns metadata for the specified folder. This operation is only
/// applicable to a hierarchical namespace enabled bucket.
pub fn get_folder(&self) -> crate::builder::storage_control::GetFolder {
self.control.get_folder()
}
/// Retrieves a list of folders. This operation is only applicable to a
/// hierarchical namespace enabled bucket.
pub fn list_folders(&self) -> crate::builder::storage_control::ListFolders {
self.control.list_folders()
}
/// Renames a source folder to a destination folder. This operation is only
/// applicable to a hierarchical namespace enabled bucket. During a rename, the
/// source and destination folders are locked until the long running operation
/// completes.
///
/// # Long running operations
///
/// This method is used to start, and/or poll a [long-running Operation].
/// The [Working with long-running operations] chapter in the [user guide]
/// covers these operations in detail.
///
/// [long-running operation]: https://google.aip.dev/151
/// [user guide]: https://googleapis.github.io/google-cloud-rust/
/// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
pub fn rename_folder(&self) -> crate::builder::storage_control::RenameFolder {
self.control.rename_folder()
}
/// Returns the storage layout configuration for a given bucket.
pub fn get_storage_layout(&self) -> crate::builder::storage_control::GetStorageLayout {
self.control.get_storage_layout()
}
/// Creates a new managed folder.
pub fn create_managed_folder(&self) -> crate::builder::storage_control::CreateManagedFolder {
self.control.create_managed_folder()
}
/// Permanently deletes an empty managed folder.
pub fn delete_managed_folder(&self) -> crate::builder::storage_control::DeleteManagedFolder {
self.control.delete_managed_folder()
}
/// Returns metadata for the specified managed folder.
pub fn get_managed_folder(&self) -> crate::builder::storage_control::GetManagedFolder {
self.control.get_managed_folder()
}
/// Retrieves a list of managed folders for a given bucket.
pub fn list_managed_folders(&self) -> crate::builder::storage_control::ListManagedFolders {
self.control.list_managed_folders()
}
/// Creates an Anywhere Cache instance.
///
/// # Long running operations
///
/// This method is used to start, and/or poll a [long-running Operation].
/// The [Working with long-running operations] chapter in the [user guide]
/// covers these operations in detail.
///
/// [long-running operation]: https://google.aip.dev/151
/// [user guide]: https://googleapis.github.io/google-cloud-rust/
/// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
pub fn create_anywhere_cache(&self) -> crate::builder::storage_control::CreateAnywhereCache {
self.control.create_anywhere_cache()
}
/// Updates an Anywhere Cache instance. Mutable fields include `ttl` and
/// `admission_policy`.
///
/// # Long running operations
///
/// This method is used to start, and/or poll a [long-running Operation].
/// The [Working with long-running operations] chapter in the [user guide]
/// covers these operations in detail.
///
/// [long-running operation]: https://google.aip.dev/151
/// [user guide]: https://googleapis.github.io/google-cloud-rust/
/// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
pub fn update_anywhere_cache(&self) -> crate::builder::storage_control::UpdateAnywhereCache {
self.control.update_anywhere_cache()
}
/// Disables an Anywhere Cache instance. A disabled instance is read-only. The
/// disablement could be revoked by calling ResumeAnywhereCache. The cache
/// instance will be deleted automatically if it remains in the disabled state
/// for at least one hour.
pub fn disable_anywhere_cache(&self) -> crate::builder::storage_control::DisableAnywhereCache {
self.control.disable_anywhere_cache()
}
/// Pauses an Anywhere Cache instance.
pub fn pause_anywhere_cache(&self) -> crate::builder::storage_control::PauseAnywhereCache {
self.control.pause_anywhere_cache()
}
/// Resumes a disabled or paused Anywhere Cache instance.
pub fn resume_anywhere_cache(&self) -> crate::builder::storage_control::ResumeAnywhereCache {
self.control.resume_anywhere_cache()
}
/// Gets an Anywhere Cache instance.
pub fn get_anywhere_cache(&self) -> crate::builder::storage_control::GetAnywhereCache {
self.control.get_anywhere_cache()
}
/// Lists Anywhere Cache instances for a given bucket.
pub fn list_anywhere_caches(&self) -> crate::builder::storage_control::ListAnywhereCaches {
self.control.list_anywhere_caches()
}
/// Returns the Project scoped singleton IntelligenceConfig resource.
pub fn get_project_intelligence_config(
&self,
) -> crate::builder::storage_control::GetProjectIntelligenceConfig {
self.control.get_project_intelligence_config()
}
/// Updates the Project scoped singleton IntelligenceConfig resource.
pub fn update_project_intelligence_config(
&self,
) -> crate::builder::storage_control::UpdateProjectIntelligenceConfig {
self.control.update_project_intelligence_config()
}
/// Returns the Folder scoped singleton IntelligenceConfig resource.
pub fn get_folder_intelligence_config(
&self,
) -> crate::builder::storage_control::GetFolderIntelligenceConfig {
self.control.get_folder_intelligence_config()
}
/// Updates the Folder scoped singleton IntelligenceConfig resource.
pub fn update_folder_intelligence_config(
&self,
) -> crate::builder::storage_control::UpdateFolderIntelligenceConfig {
self.control.update_folder_intelligence_config()
}
/// Returns the Organization scoped singleton IntelligenceConfig resource.
pub fn get_organization_intelligence_config(
&self,
) -> crate::builder::storage_control::GetOrganizationIntelligenceConfig {
self.control.get_organization_intelligence_config()
}
/// Updates the Organization scoped singleton IntelligenceConfig resource.
pub fn update_organization_intelligence_config(
&self,
) -> crate::builder::storage_control::UpdateOrganizationIntelligenceConfig {
self.control.update_organization_intelligence_config()
}
/// Gets the IAM policy for a specified bucket.
/// The `resource` field in the request should be
/// `projects/_/buckets/{bucket}` for a bucket, or
/// `projects/_/buckets/{bucket}/managedFolders/{managedFolder}`
/// for a managed folder.
pub fn get_iam_policy(&self) -> crate::builder::storage_control::GetIamPolicy {
self.control.get_iam_policy()
}
/// Updates an IAM policy for the specified bucket.
/// The `resource` field in the request should be
/// `projects/_/buckets/{bucket}` for a bucket, or
/// `projects/_/buckets/{bucket}/managedFolders/{managedFolder}`
/// for a managed folder.
pub fn set_iam_policy(&self) -> crate::builder::storage_control::SetIamPolicy {
self.control.set_iam_policy()
}
/// Tests a set of permissions on the given bucket, object, or managed folder
/// to see which, if any, are held by the caller.
/// The `resource` field in the request should be
/// `projects/_/buckets/{bucket}` for a bucket,
/// `projects/_/buckets/{bucket}/objects/{object}` for an object, or
/// `projects/_/buckets/{bucket}/managedFolders/{managedFolder}`
/// for a managed folder.
pub fn test_iam_permissions(&self) -> crate::builder::storage_control::TestIamPermissions {
self.control.test_iam_permissions()
}
/// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
///
/// [google.longrunning.Operations]: longrunning::client::Operations
pub fn get_operation(&self) -> crate::builder::storage_control::GetOperation {
self.control.get_operation()
}
/// Creates a new client from the provided stub.
///
/// The most common case for calling this function is in tests mocking the
/// client's behavior.
pub fn from_stub<T>(stub: T) -> Self
where
T: crate::stub::StorageControl + 'static,
{
let stub = std::sync::Arc::new(stub);
Self {
storage: crate::generated::gapic::client::StorageControl::from_stub(stub.clone()),
control: crate::generated::gapic_control::client::StorageControl::from_stub(stub),
}
}
pub(crate) async fn new(
config: gaxi::options::ClientConfig,
) -> gax::client_builder::Result<Self> {
let storage = crate::generated::gapic::client::StorageControl::new(config.clone()).await?;
let control = crate::generated::gapic_control::client::StorageControl::new(config).await?;
Ok(Self { storage, control })
}
}