Mercurial > lbo > hg > async-google-apis
changeset 213:77b59bfc935a
update gcs example
author | Daniel Boline <ddboline@gmail.com> |
---|---|
date | Mon, 22 Feb 2021 18:44:22 -0500 |
parents | da65a19d5883 |
children | 5c0542a6d314 |
files | example_crates/gcs_example/src/main.rs example_crates/gcs_example/src/storage_v1_types.rs |
diffstat | 2 files changed, 92 insertions(+), 117 deletions(-) [+] |
line wrap: on
line diff
--- a/example_crates/gcs_example/src/main.rs Mon Feb 22 17:35:01 2021 -0500 +++ b/example_crates/gcs_example/src/main.rs Mon Feb 22 18:44:22 2021 -0500 @@ -14,7 +14,7 @@ } async fn upload_file( - mut cl: storage_v1_types::ObjectsService, + cl: &storage_v1_types::ObjectsService, bucket: &str, p: &Path, prefix: &str, @@ -39,7 +39,7 @@ } async fn download_file( - mut cl: storage_v1_types::ObjectsService, + cl: &storage_v1_types::ObjectsService, bucket: &str, id: &str, ) -> common::Result<()> { @@ -96,7 +96,7 @@ } async fn list_objects( - mut cl: storage_v1_types::ObjectsService, + cl: &storage_v1_types::ObjectsService, bucket: &str, prefix: &str, ) -> common::Result<()> { @@ -121,7 +121,7 @@ } async fn rm_object( - mut cl: storage_v1_types::ObjectsService, + cl: &storage_v1_types::ObjectsService, bucket: &str, id: &str, ) -> common::Result<()> { @@ -183,7 +183,7 @@ .build() .await .expect("ServiceAccount authenticator failed."); - let authenticator = std::rc::Rc::new(authenticator); + let authenticator = std::sync::Arc::new(authenticator); let action = matches.value_of("ACTION").expect("--action is required."); let buck = matches @@ -196,7 +196,7 @@ let obj = matches .value_of("FILE_OR_OBJECT") .expect("OBJECT is a mandatory argument."); - download_file(cl, buck, obj) + download_file(&cl, buck, obj) .await .expect("Download failed :("); } else if action == "put" { @@ -207,13 +207,13 @@ if !pre.ends_with("/") && !pre.is_empty() { pre = pre.to_string() + "/"; } - upload_file(cl, buck, Path::new(&fp), &pre) + upload_file(&cl, buck, Path::new(&fp), &pre) .await .expect("Upload failed :("); return; } else if action == "list" { let prefix = matches.value_of("PREFIX").unwrap_or(""); - list_objects(cl, buck, prefix) + list_objects(&cl, buck, prefix) .await .expect("List failed :("); return; @@ -221,7 +221,7 @@ let obj = matches .value_of("FILE_OR_OBJECT") .expect("OBJECT is a mandatory argument."); - rm_object(cl, buck, obj).await.expect("rm failed :("); + rm_object(&cl, buck, obj).await.expect("rm failed :("); return; } }
--- a/example_crates/gcs_example/src/storage_v1_types.rs Mon Feb 22 17:35:01 2021 -0500 +++ b/example_crates/gcs_example/src/storage_v1_types.rs Mon Feb 22 18:44:22 2021 -0500 @@ -1,4 +1,4 @@ -#![allow(unused_variables, unused_mut, dead_code)] +#![allow(unused_variables, unused_mut, dead_code, non_camel_case_types)] //! This file was generated by async-google-apis. (https://github.com/dermesser/async-google-apis) //! //! (c) 2020 Lewin Bormann <lbo@spheniscida.de> @@ -139,6 +139,10 @@ #[serde(rename = "uniformBucketLevelAccess")] #[serde(skip_serializing_if = "Option::is_none")] pub uniform_bucket_level_access: Option<BucketIamConfigurationUniformBucketLevelAccess>, + /// The bucket's Public Access Prevention configuration. Currently, 'unspecified' and 'enforced' are supported. + #[serde(rename = "publicAccessPrevention")] + #[serde(skip_serializing_if = "Option::is_none")] + pub public_access_prevention: Option<String>, } /// The action to take. @@ -397,6 +401,10 @@ #[serde(rename = "zoneAffinity")] #[serde(skip_serializing_if = "Option::is_none")] pub zone_affinity: Option<Vec<String>>, + /// Reserved for future use. + #[serde(rename = "satisfiesPZS")] + #[serde(skip_serializing_if = "Option::is_none")] + pub satisfies_p_z_s: Option<bool>, } /// The project team associated with the entity, if any. @@ -5335,7 +5343,7 @@ /// The Storage BucketAccessControls service represents the BucketAccessControls resource. pub struct BucketAccessControlsService { client: TlsClient, - authenticator: Box<dyn 'static + std::ops::Deref<Target = Authenticator>>, + authenticator: Box<dyn 'static + DerefAuth>, scopes: Vec<String>, base_url: String, @@ -5346,10 +5354,7 @@ /// Create a new BucketAccessControlsService object. The easiest way to call this is wrapping the Authenticator /// into an `Rc`: `new(client.clone(), Rc::new(authenticator))`. /// This way, one authenticator can be shared among several services. - pub fn new<A: 'static + std::ops::Deref<Target = Authenticator>>( - client: TlsClient, - auth: A, - ) -> BucketAccessControlsService { + pub fn new<A: 'static + DerefAuth>(client: TlsClient, auth: A) -> BucketAccessControlsService { BucketAccessControlsService { client: client, authenticator: Box::new(auth), @@ -5403,7 +5408,7 @@ } /// Permanently deletes the ACL entry for the specified entity on the specified bucket. - pub async fn delete(&mut self, params: &BucketAccessControlsDeleteParams) -> Result<()> { + pub async fn delete(&self, params: &BucketAccessControlsDeleteParams) -> Result<()> { let rel_path = format!( "b/{bucket}/acl/{entity}", bucket = percent_encode(format!("{}", params.bucket).as_bytes(), NON_ALPHANUMERIC), @@ -5436,10 +5441,7 @@ } /// Returns the ACL entry for the specified entity on the specified bucket. - pub async fn get( - &mut self, - params: &BucketAccessControlsGetParams, - ) -> Result<BucketAccessControl> { + pub async fn get(&self, params: &BucketAccessControlsGetParams) -> Result<BucketAccessControl> { let rel_path = format!( "b/{bucket}/acl/{entity}", bucket = percent_encode(format!("{}", params.bucket).as_bytes(), NON_ALPHANUMERIC), @@ -5473,7 +5475,7 @@ /// Creates a new ACL entry on the specified bucket. pub async fn insert( - &mut self, + &self, params: &BucketAccessControlsInsertParams, req: &BucketAccessControl, ) -> Result<BucketAccessControl> { @@ -5510,7 +5512,7 @@ /// Retrieves ACL entries on the specified bucket. pub async fn list( - &mut self, + &self, params: &BucketAccessControlsListParams, ) -> Result<BucketAccessControls> { let rel_path = format!( @@ -5545,7 +5547,7 @@ /// Patches an ACL entry on the specified bucket. pub async fn patch( - &mut self, + &self, params: &BucketAccessControlsPatchParams, req: &BucketAccessControl, ) -> Result<BucketAccessControl> { @@ -5583,7 +5585,7 @@ /// Updates an ACL entry on the specified bucket. pub async fn update( - &mut self, + &self, params: &BucketAccessControlsUpdateParams, req: &BucketAccessControl, ) -> Result<BucketAccessControl> { @@ -5623,7 +5625,7 @@ /// The Storage Buckets service represents the Buckets resource. pub struct BucketsService { client: TlsClient, - authenticator: Box<dyn 'static + std::ops::Deref<Target = Authenticator>>, + authenticator: Box<dyn 'static + DerefAuth>, scopes: Vec<String>, base_url: String, @@ -5634,10 +5636,7 @@ /// Create a new BucketsService object. The easiest way to call this is wrapping the Authenticator /// into an `Rc`: `new(client.clone(), Rc::new(authenticator))`. /// This way, one authenticator can be shared among several services. - pub fn new<A: 'static + std::ops::Deref<Target = Authenticator>>( - client: TlsClient, - auth: A, - ) -> BucketsService { + pub fn new<A: 'static + DerefAuth>(client: TlsClient, auth: A) -> BucketsService { BucketsService { client: client, authenticator: Box::new(auth), @@ -5691,7 +5690,7 @@ } /// Permanently deletes an empty bucket. - pub async fn delete(&mut self, params: &BucketsDeleteParams) -> Result<()> { + pub async fn delete(&self, params: &BucketsDeleteParams) -> Result<()> { let rel_path = format!( "b/{bucket}", bucket = percent_encode(format!("{}", params.bucket).as_bytes(), NON_ALPHANUMERIC) @@ -5723,7 +5722,7 @@ } /// Returns metadata for the specified bucket. - pub async fn get(&mut self, params: &BucketsGetParams) -> Result<Bucket> { + pub async fn get(&self, params: &BucketsGetParams) -> Result<Bucket> { let rel_path = format!( "b/{bucket}", bucket = percent_encode(format!("{}", params.bucket).as_bytes(), NON_ALPHANUMERIC) @@ -5755,7 +5754,7 @@ } /// Returns an IAM policy for the specified bucket. - pub async fn get_iam_policy(&mut self, params: &BucketsGetIamPolicyParams) -> Result<Policy> { + pub async fn get_iam_policy(&self, params: &BucketsGetIamPolicyParams) -> Result<Policy> { let rel_path = format!( "b/{bucket}/iam", bucket = percent_encode(format!("{}", params.bucket).as_bytes(), NON_ALPHANUMERIC) @@ -5787,7 +5786,7 @@ } /// Creates a new bucket. - pub async fn insert(&mut self, params: &BucketsInsertParams, req: &Bucket) -> Result<Bucket> { + pub async fn insert(&self, params: &BucketsInsertParams, req: &Bucket) -> Result<Bucket> { let rel_path = format!("b",); let path = self.format_path(rel_path.as_str()); @@ -5817,7 +5816,7 @@ } /// Retrieves a list of buckets for a given project. - pub async fn list(&mut self, params: &BucketsListParams) -> Result<Buckets> { + pub async fn list(&self, params: &BucketsListParams) -> Result<Buckets> { let rel_path = format!("b",); let path = self.format_path(rel_path.as_str()); @@ -5847,7 +5846,7 @@ /// Locks retention policy on a bucket. pub async fn lock_retention_policy( - &mut self, + &self, params: &BucketsLockRetentionPolicyParams, ) -> Result<Bucket> { let rel_path = format!( @@ -5881,7 +5880,7 @@ } /// Patches a bucket. Changes to the bucket will be readable immediately after writing, but configuration changes may take time to propagate. - pub async fn patch(&mut self, params: &BucketsPatchParams, req: &Bucket) -> Result<Bucket> { + pub async fn patch(&self, params: &BucketsPatchParams, req: &Bucket) -> Result<Bucket> { let rel_path = format!( "b/{bucket}", bucket = percent_encode(format!("{}", params.bucket).as_bytes(), NON_ALPHANUMERIC) @@ -5915,7 +5914,7 @@ /// Updates an IAM policy for the specified bucket. pub async fn set_iam_policy( - &mut self, + &self, params: &BucketsSetIamPolicyParams, req: &Policy, ) -> Result<Policy> { @@ -5952,7 +5951,7 @@ /// Tests a set of permissions on the given bucket to see which, if any, are held by the caller. pub async fn test_iam_permissions( - &mut self, + &self, params: &BucketsTestIamPermissionsParams, ) -> Result<TestIamPermissionsResponse> { let rel_path = format!( @@ -5986,7 +5985,7 @@ } /// Updates a bucket. Changes to the bucket will be readable immediately after writing, but configuration changes may take time to propagate. - pub async fn update(&mut self, params: &BucketsUpdateParams, req: &Bucket) -> Result<Bucket> { + pub async fn update(&self, params: &BucketsUpdateParams, req: &Bucket) -> Result<Bucket> { let rel_path = format!( "b/{bucket}", bucket = percent_encode(format!("{}", params.bucket).as_bytes(), NON_ALPHANUMERIC) @@ -6022,7 +6021,7 @@ /// The Storage Channels service represents the Channels resource. pub struct ChannelsService { client: TlsClient, - authenticator: Box<dyn 'static + std::ops::Deref<Target = Authenticator>>, + authenticator: Box<dyn 'static + DerefAuth>, scopes: Vec<String>, base_url: String, @@ -6033,10 +6032,7 @@ /// Create a new ChannelsService object. The easiest way to call this is wrapping the Authenticator /// into an `Rc`: `new(client.clone(), Rc::new(authenticator))`. /// This way, one authenticator can be shared among several services. - pub fn new<A: 'static + std::ops::Deref<Target = Authenticator>>( - client: TlsClient, - auth: A, - ) -> ChannelsService { + pub fn new<A: 'static + DerefAuth>(client: TlsClient, auth: A) -> ChannelsService { ChannelsService { client: client, authenticator: Box::new(auth), @@ -6090,7 +6086,7 @@ } /// Stop watching resources through this channel - pub async fn stop(&mut self, params: &ChannelsStopParams, req: &Channel) -> Result<()> { + pub async fn stop(&self, params: &ChannelsStopParams, req: &Channel) -> Result<()> { let rel_path = format!("channels/stop",); let path = self.format_path(rel_path.as_str()); @@ -6123,7 +6119,7 @@ /// The Storage DefaultObjectAccessControls service represents the DefaultObjectAccessControls resource. pub struct DefaultObjectAccessControlsService { client: TlsClient, - authenticator: Box<dyn 'static + std::ops::Deref<Target = Authenticator>>, + authenticator: Box<dyn 'static + DerefAuth>, scopes: Vec<String>, base_url: String, @@ -6134,7 +6130,7 @@ /// Create a new DefaultObjectAccessControlsService object. The easiest way to call this is wrapping the Authenticator /// into an `Rc`: `new(client.clone(), Rc::new(authenticator))`. /// This way, one authenticator can be shared among several services. - pub fn new<A: 'static + std::ops::Deref<Target = Authenticator>>( + pub fn new<A: 'static + DerefAuth>( client: TlsClient, auth: A, ) -> DefaultObjectAccessControlsService { @@ -6191,7 +6187,7 @@ } /// Permanently deletes the default object ACL entry for the specified entity on the specified bucket. - pub async fn delete(&mut self, params: &DefaultObjectAccessControlsDeleteParams) -> Result<()> { + pub async fn delete(&self, params: &DefaultObjectAccessControlsDeleteParams) -> Result<()> { let rel_path = format!( "b/{bucket}/defaultObjectAcl/{entity}", bucket = percent_encode(format!("{}", params.bucket).as_bytes(), NON_ALPHANUMERIC), @@ -6225,7 +6221,7 @@ /// Returns the default object ACL entry for the specified entity on the specified bucket. pub async fn get( - &mut self, + &self, params: &DefaultObjectAccessControlsGetParams, ) -> Result<ObjectAccessControl> { let rel_path = format!( @@ -6261,7 +6257,7 @@ /// Creates a new default object ACL entry on the specified bucket. pub async fn insert( - &mut self, + &self, params: &DefaultObjectAccessControlsInsertParams, req: &ObjectAccessControl, ) -> Result<ObjectAccessControl> { @@ -6298,7 +6294,7 @@ /// Retrieves default object ACL entries on the specified bucket. pub async fn list( - &mut self, + &self, params: &DefaultObjectAccessControlsListParams, ) -> Result<ObjectAccessControls> { let rel_path = format!( @@ -6333,7 +6329,7 @@ /// Patches a default object ACL entry on the specified bucket. pub async fn patch( - &mut self, + &self, params: &DefaultObjectAccessControlsPatchParams, req: &ObjectAccessControl, ) -> Result<ObjectAccessControl> { @@ -6371,7 +6367,7 @@ /// Updates a default object ACL entry on the specified bucket. pub async fn update( - &mut self, + &self, params: &DefaultObjectAccessControlsUpdateParams, req: &ObjectAccessControl, ) -> Result<ObjectAccessControl> { @@ -6411,7 +6407,7 @@ /// The Storage Notifications service represents the Notifications resource. pub struct NotificationsService { client: TlsClient, - authenticator: Box<dyn 'static + std::ops::Deref<Target = Authenticator>>, + authenticator: Box<dyn 'static + DerefAuth>, scopes: Vec<String>, base_url: String, @@ -6422,10 +6418,7 @@ /// Create a new NotificationsService object. The easiest way to call this is wrapping the Authenticator /// into an `Rc`: `new(client.clone(), Rc::new(authenticator))`. /// This way, one authenticator can be shared among several services. - pub fn new<A: 'static + std::ops::Deref<Target = Authenticator>>( - client: TlsClient, - auth: A, - ) -> NotificationsService { + pub fn new<A: 'static + DerefAuth>(client: TlsClient, auth: A) -> NotificationsService { NotificationsService { client: client, authenticator: Box::new(auth), @@ -6479,7 +6472,7 @@ } /// Permanently deletes a notification subscription. - pub async fn delete(&mut self, params: &NotificationsDeleteParams) -> Result<()> { + pub async fn delete(&self, params: &NotificationsDeleteParams) -> Result<()> { let rel_path = format!( "b/{bucket}/notificationConfigs/{notification}", bucket = percent_encode(format!("{}", params.bucket).as_bytes(), NON_ALPHANUMERIC), @@ -6515,7 +6508,7 @@ } /// View a notification configuration. - pub async fn get(&mut self, params: &NotificationsGetParams) -> Result<Notification> { + pub async fn get(&self, params: &NotificationsGetParams) -> Result<Notification> { let rel_path = format!( "b/{bucket}/notificationConfigs/{notification}", bucket = percent_encode(format!("{}", params.bucket).as_bytes(), NON_ALPHANUMERIC), @@ -6552,7 +6545,7 @@ /// Creates a notification subscription for a given bucket. pub async fn insert( - &mut self, + &self, params: &NotificationsInsertParams, req: &Notification, ) -> Result<Notification> { @@ -6588,7 +6581,7 @@ } /// Retrieves a list of notification subscriptions for a given bucket. - pub async fn list(&mut self, params: &NotificationsListParams) -> Result<Notifications> { + pub async fn list(&self, params: &NotificationsListParams) -> Result<Notifications> { let rel_path = format!( "b/{bucket}/notificationConfigs", bucket = percent_encode(format!("{}", params.bucket).as_bytes(), NON_ALPHANUMERIC) @@ -6623,7 +6616,7 @@ /// The Storage ObjectAccessControls service represents the ObjectAccessControls resource. pub struct ObjectAccessControlsService { client: TlsClient, - authenticator: Box<dyn 'static + std::ops::Deref<Target = Authenticator>>, + authenticator: Box<dyn 'static + DerefAuth>, scopes: Vec<String>, base_url: String, @@ -6634,10 +6627,7 @@ /// Create a new ObjectAccessControlsService object. The easiest way to call this is wrapping the Authenticator /// into an `Rc`: `new(client.clone(), Rc::new(authenticator))`. /// This way, one authenticator can be shared among several services. - pub fn new<A: 'static + std::ops::Deref<Target = Authenticator>>( - client: TlsClient, - auth: A, - ) -> ObjectAccessControlsService { + pub fn new<A: 'static + DerefAuth>(client: TlsClient, auth: A) -> ObjectAccessControlsService { ObjectAccessControlsService { client: client, authenticator: Box::new(auth), @@ -6691,7 +6681,7 @@ } /// Permanently deletes the ACL entry for the specified entity on the specified object. - pub async fn delete(&mut self, params: &ObjectAccessControlsDeleteParams) -> Result<()> { + pub async fn delete(&self, params: &ObjectAccessControlsDeleteParams) -> Result<()> { let rel_path = format!( "b/{bucket}/o/{object}/acl/{entity}", bucket = percent_encode(format!("{}", params.bucket).as_bytes(), NON_ALPHANUMERIC), @@ -6725,10 +6715,7 @@ } /// Returns the ACL entry for the specified entity on the specified object. - pub async fn get( - &mut self, - params: &ObjectAccessControlsGetParams, - ) -> Result<ObjectAccessControl> { + pub async fn get(&self, params: &ObjectAccessControlsGetParams) -> Result<ObjectAccessControl> { let rel_path = format!( "b/{bucket}/o/{object}/acl/{entity}", bucket = percent_encode(format!("{}", params.bucket).as_bytes(), NON_ALPHANUMERIC), @@ -6763,7 +6750,7 @@ /// Creates a new ACL entry on the specified object. pub async fn insert( - &mut self, + &self, params: &ObjectAccessControlsInsertParams, req: &ObjectAccessControl, ) -> Result<ObjectAccessControl> { @@ -6801,7 +6788,7 @@ /// Retrieves ACL entries on the specified object. pub async fn list( - &mut self, + &self, params: &ObjectAccessControlsListParams, ) -> Result<ObjectAccessControls> { let rel_path = format!( @@ -6837,7 +6824,7 @@ /// Patches an ACL entry on the specified object. pub async fn patch( - &mut self, + &self, params: &ObjectAccessControlsPatchParams, req: &ObjectAccessControl, ) -> Result<ObjectAccessControl> { @@ -6876,7 +6863,7 @@ /// Updates an ACL entry on the specified object. pub async fn update( - &mut self, + &self, params: &ObjectAccessControlsUpdateParams, req: &ObjectAccessControl, ) -> Result<ObjectAccessControl> { @@ -6917,7 +6904,7 @@ /// The Storage Objects service represents the Objects resource. pub struct ObjectsService { client: TlsClient, - authenticator: Box<dyn 'static + std::ops::Deref<Target = Authenticator>>, + authenticator: Box<dyn 'static + DerefAuth>, scopes: Vec<String>, base_url: String, @@ -6928,10 +6915,7 @@ /// Create a new ObjectsService object. The easiest way to call this is wrapping the Authenticator /// into an `Rc`: `new(client.clone(), Rc::new(authenticator))`. /// This way, one authenticator can be shared among several services. - pub fn new<A: 'static + std::ops::Deref<Target = Authenticator>>( - client: TlsClient, - auth: A, - ) -> ObjectsService { + pub fn new<A: 'static + DerefAuth>(client: TlsClient, auth: A) -> ObjectsService { ObjectsService { client: client, authenticator: Box::new(auth), @@ -6986,7 +6970,7 @@ /// Concatenates a list of existing objects into a new object in the same bucket. pub async fn compose( - &mut self, + &self, params: &ObjectsComposeParams, req: &ComposeRequest, ) -> Result<Object> { @@ -7029,7 +7013,7 @@ } /// Copies a source object to a destination object. Optionally overrides metadata. - pub async fn copy(&mut self, params: &ObjectsCopyParams, req: &Object) -> Result<Object> { + pub async fn copy(&self, params: &ObjectsCopyParams, req: &Object) -> Result<Object> { let rel_path = format!( "b/{sourceBucket}/o/{sourceObject}/copyTo/b/{destinationBucket}/o/{destinationObject}", sourceBucket = percent_encode( @@ -7077,7 +7061,7 @@ } /// Deletes an object and its metadata. Deletions are permanent if versioning is not enabled for the bucket, or if the generation parameter is used. - pub async fn delete(&mut self, params: &ObjectsDeleteParams) -> Result<()> { + pub async fn delete(&self, params: &ObjectsDeleteParams) -> Result<()> { let rel_path = format!( "b/{bucket}/o/{object}", bucket = percent_encode(format!("{}", params.bucket).as_bytes(), NON_ALPHANUMERIC), @@ -7113,7 +7097,7 @@ /// /// This method potentially downloads data. See documentation of `Download`. pub async fn get<'a>( - &'a mut self, + &'a self, params: &ObjectsGetParams, ) -> Result<Download<'a, EmptyRequest, Object>> { let rel_path = format!( @@ -7148,7 +7132,7 @@ } /// Returns an IAM policy for the specified object. - pub async fn get_iam_policy(&mut self, params: &ObjectsGetIamPolicyParams) -> Result<Policy> { + pub async fn get_iam_policy(&self, params: &ObjectsGetIamPolicyParams) -> Result<Policy> { let rel_path = format!( "b/{bucket}/o/{object}/iam", bucket = percent_encode(format!("{}", params.bucket).as_bytes(), NON_ALPHANUMERIC), @@ -7181,7 +7165,7 @@ } /// Stores a new object and metadata. - pub async fn insert(&mut self, params: &ObjectsInsertParams, req: &Object) -> Result<Object> { + pub async fn insert(&self, params: &ObjectsInsertParams, req: &Object) -> Result<Object> { let rel_path = format!( "b/{bucket}/o", bucket = percent_encode(format!("{}", params.bucket).as_bytes(), NON_ALPHANUMERIC) @@ -7217,7 +7201,7 @@ /// /// This method is a variant of `insert()`, taking data for upload. It performs a multipart upload. pub async fn insert_upload( - &mut self, + &self, params: &ObjectsInsertParams, req: &Object, data: hyper::body::Bytes, @@ -7261,7 +7245,7 @@ /// of data to the API. The result of this call will be returned by the `ResumableUpload` method /// you choose for the upload. pub async fn insert_resumable_upload<'client>( - &'client mut self, + &'client self, params: &ObjectsInsertParams, req: &Object, ) -> Result<ResumableUpload<'client, Object>> { @@ -7312,7 +7296,7 @@ } /// Retrieves a list of objects matching the criteria. - pub async fn list(&mut self, params: &ObjectsListParams) -> Result<Objects> { + pub async fn list(&self, params: &ObjectsListParams) -> Result<Objects> { let rel_path = format!( "b/{bucket}/o", bucket = percent_encode(format!("{}", params.bucket).as_bytes(), NON_ALPHANUMERIC) @@ -7344,7 +7328,7 @@ } /// Patches an object's metadata. - pub async fn patch(&mut self, params: &ObjectsPatchParams, req: &Object) -> Result<Object> { + pub async fn patch(&self, params: &ObjectsPatchParams, req: &Object) -> Result<Object> { let rel_path = format!( "b/{bucket}/o/{object}", bucket = percent_encode(format!("{}", params.bucket).as_bytes(), NON_ALPHANUMERIC), @@ -7379,7 +7363,7 @@ /// Rewrites a source object to a destination object. Optionally overrides metadata. pub async fn rewrite( - &mut self, + &self, params: &ObjectsRewriteParams, req: &Object, ) -> Result<RewriteResponse> { @@ -7413,7 +7397,7 @@ /// Updates an IAM policy for the specified object. pub async fn set_iam_policy( - &mut self, + &self, params: &ObjectsSetIamPolicyParams, req: &Policy, ) -> Result<Policy> { @@ -7451,7 +7435,7 @@ /// Tests a set of permissions on the given object to see which, if any, are held by the caller. pub async fn test_iam_permissions( - &mut self, + &self, params: &ObjectsTestIamPermissionsParams, ) -> Result<TestIamPermissionsResponse> { let rel_path = format!( @@ -7486,7 +7470,7 @@ } /// Updates an object's metadata. - pub async fn update(&mut self, params: &ObjectsUpdateParams, req: &Object) -> Result<Object> { + pub async fn update(&self, params: &ObjectsUpdateParams, req: &Object) -> Result<Object> { let rel_path = format!( "b/{bucket}/o/{object}", bucket = percent_encode(format!("{}", params.bucket).as_bytes(), NON_ALPHANUMERIC), @@ -7521,7 +7505,7 @@ /// Watch for changes on all objects in a bucket. pub async fn watch_all( - &mut self, + &self, params: &ObjectsWatchAllParams, req: &Channel, ) -> Result<Channel> { @@ -7560,7 +7544,7 @@ /// The Storage Projects service represents the Projects resource. pub struct ProjectsService { client: TlsClient, - authenticator: Box<dyn 'static + std::ops::Deref<Target = Authenticator>>, + authenticator: Box<dyn 'static + DerefAuth>, scopes: Vec<String>, base_url: String, @@ -7571,10 +7555,7 @@ /// Create a new ProjectsService object. The easiest way to call this is wrapping the Authenticator /// into an `Rc`: `new(client.clone(), Rc::new(authenticator))`. /// This way, one authenticator can be shared among several services. - pub fn new<A: 'static + std::ops::Deref<Target = Authenticator>>( - client: TlsClient, - auth: A, - ) -> ProjectsService { + pub fn new<A: 'static + DerefAuth>(client: TlsClient, auth: A) -> ProjectsService { ProjectsService { client: client, authenticator: Box::new(auth), @@ -7631,7 +7612,7 @@ /// The Storage ProjectsHmacKeys service represents the ProjectsHmacKeys resource. pub struct ProjectsHmacKeysService { client: TlsClient, - authenticator: Box<dyn 'static + std::ops::Deref<Target = Authenticator>>, + authenticator: Box<dyn 'static + DerefAuth>, scopes: Vec<String>, base_url: String, @@ -7642,10 +7623,7 @@ /// Create a new ProjectsHmacKeysService object. The easiest way to call this is wrapping the Authenticator /// into an `Rc`: `new(client.clone(), Rc::new(authenticator))`. /// This way, one authenticator can be shared among several services. - pub fn new<A: 'static + std::ops::Deref<Target = Authenticator>>( - client: TlsClient, - auth: A, - ) -> ProjectsHmacKeysService { + pub fn new<A: 'static + DerefAuth>(client: TlsClient, auth: A) -> ProjectsHmacKeysService { ProjectsHmacKeysService { client: client, authenticator: Box::new(auth), @@ -7699,7 +7677,7 @@ } /// Creates a new HMAC key for the specified service account. - pub async fn create(&mut self, params: &ProjectsHmacKeysCreateParams) -> Result<HmacKey> { + pub async fn create(&self, params: &ProjectsHmacKeysCreateParams) -> Result<HmacKey> { let rel_path = format!( "projects/{projectId}/hmacKeys", projectId = percent_encode( @@ -7734,7 +7712,7 @@ } /// Deletes an HMAC key. - pub async fn delete(&mut self, params: &ProjectsHmacKeysDeleteParams) -> Result<()> { + pub async fn delete(&self, params: &ProjectsHmacKeysDeleteParams) -> Result<()> { let rel_path = format!( "projects/{projectId}/hmacKeys/{accessId}", projectId = percent_encode( @@ -7770,7 +7748,7 @@ } /// Retrieves an HMAC key's metadata - pub async fn get(&mut self, params: &ProjectsHmacKeysGetParams) -> Result<HmacKeyMetadata> { + pub async fn get(&self, params: &ProjectsHmacKeysGetParams) -> Result<HmacKeyMetadata> { let rel_path = format!( "projects/{projectId}/hmacKeys/{accessId}", projectId = percent_encode( @@ -7806,7 +7784,7 @@ } /// Retrieves a list of HMAC keys matching the criteria. - pub async fn list(&mut self, params: &ProjectsHmacKeysListParams) -> Result<HmacKeysMetadata> { + pub async fn list(&self, params: &ProjectsHmacKeysListParams) -> Result<HmacKeysMetadata> { let rel_path = format!( "projects/{projectId}/hmacKeys", projectId = percent_encode( @@ -7842,7 +7820,7 @@ /// Updates the state of an HMAC key. See the HMAC Key resource descriptor for valid states. pub async fn update( - &mut self, + &self, params: &ProjectsHmacKeysUpdateParams, req: &HmacKeyMetadata, ) -> Result<HmacKeyMetadata> { @@ -7885,7 +7863,7 @@ /// The Storage ProjectsServiceAccount service represents the ProjectsServiceAccount resource. pub struct ProjectsServiceAccountService { client: TlsClient, - authenticator: Box<dyn 'static + std::ops::Deref<Target = Authenticator>>, + authenticator: Box<dyn 'static + DerefAuth>, scopes: Vec<String>, base_url: String, @@ -7896,7 +7874,7 @@ /// Create a new ProjectsServiceAccountService object. The easiest way to call this is wrapping the Authenticator /// into an `Rc`: `new(client.clone(), Rc::new(authenticator))`. /// This way, one authenticator can be shared among several services. - pub fn new<A: 'static + std::ops::Deref<Target = Authenticator>>( + pub fn new<A: 'static + DerefAuth>( client: TlsClient, auth: A, ) -> ProjectsServiceAccountService { @@ -7953,10 +7931,7 @@ } /// Get the email address of this project's Google Cloud Storage service account. - pub async fn get( - &mut self, - params: &ProjectsServiceAccountGetParams, - ) -> Result<ServiceAccount> { + pub async fn get(&self, params: &ProjectsServiceAccountGetParams) -> Result<ServiceAccount> { let rel_path = format!( "projects/{projectId}/serviceAccount", projectId = percent_encode(