Struct google_cloud_storage::http::storage_client::StorageClient
source · [−]pub struct StorageClient { /* private fields */ }Implementations
sourceimpl StorageClient
impl StorageClient
sourcepub async fn delete_bucket(
&self,
req: &DeleteBucketRequest,
cancel: Option<CancellationToken>
) -> Result<(), Error>
pub async fn delete_bucket(
&self,
req: &DeleteBucketRequest,
cancel: Option<CancellationToken>
) -> Result<(), Error>
Deletes the bucket. https://cloud.google.com/storage/docs/json_api/v1/buckets/delete
use google_cloud_storage::client::Client;
use google_cloud_storage::http::buckets::delete::DeleteBucketRequest;
#[tokio::main]
async fn main() {
let client = Client::new().await.unwrap();
let result = client.delete_bucket(&DeleteBucketRequest {
bucket: "bucket".to_string(),
..Default::default()
}, None).await;
}sourcepub async fn insert_bucket(
&self,
req: &InsertBucketRequest,
cancel: Option<CancellationToken>
) -> Result<Bucket, Error>
pub async fn insert_bucket(
&self,
req: &InsertBucketRequest,
cancel: Option<CancellationToken>
) -> Result<Bucket, Error>
Inserts the bucket. https://cloud.google.com/storage/docs/json_api/v1/buckets/insert
use google_cloud_storage::client::Client;
use google_cloud_storage::http::buckets::insert::{BucketCreationConfig, InsertBucketParam, InsertBucketRequest};
#[tokio::main]
async fn main() {
let client = Client::new().await.unwrap();
let result = client.insert_bucket(&InsertBucketRequest {
name: "bucket".to_string(),
param: InsertBucketParam {
project: client.project_id().to_string(),
..Default::default()
},
..Default::default()
}, None).await;
}sourcepub async fn get_bucket(
&self,
req: &GetBucketRequest,
cancel: Option<CancellationToken>
) -> Result<Bucket, Error>
pub async fn get_bucket(
&self,
req: &GetBucketRequest,
cancel: Option<CancellationToken>
) -> Result<Bucket, Error>
Gets the bucket. https://cloud.google.com/storage/docs/json_api/v1/buckets/get
use google_cloud_storage::client::Client;
use google_cloud_storage::http::buckets::get::GetBucketRequest;
#[tokio::main]
async fn main() {
let client = Client::new().await.unwrap();
let result = client.get_bucket(&GetBucketRequest {
bucket: "bucket".to_string(),
..Default::default()
}, None).await;
}sourcepub async fn patch_bucket(
&self,
req: &PatchBucketRequest,
cancel: Option<CancellationToken>
) -> Result<Bucket, Error>
pub async fn patch_bucket(
&self,
req: &PatchBucketRequest,
cancel: Option<CancellationToken>
) -> Result<Bucket, Error>
Patches the bucket. https://cloud.google.com/storage/docs/json_api/v1/buckets/patch
use google_cloud_storage::client::Client;
use google_cloud_storage::http::buckets::patch::{BucketPatchConfig, PatchBucketRequest};
#[tokio::main]
async fn main() {
let client = Client::new().await.unwrap();
let result = client.patch_bucket(&PatchBucketRequest {
bucket: "bucket".to_string(),
metadata: Some(BucketPatchConfig {
..Default::default()
}),
..Default::default()
}, None).await;
}sourcepub async fn list_buckets(
&self,
req: &ListBucketsRequest,
cancel: Option<CancellationToken>
) -> Result<ListBucketsResponse, Error>
pub async fn list_buckets(
&self,
req: &ListBucketsRequest,
cancel: Option<CancellationToken>
) -> Result<ListBucketsResponse, Error>
Lists the bucket. https://cloud.google.com/storage/docs/json_api/v1/buckets/list
use google_cloud_storage::client::Client;
use google_cloud_storage::http::buckets::list::ListBucketsRequest;
#[tokio::main]
async fn main() {
let client = Client::new().await.unwrap();
let result = client.list_buckets(&ListBucketsRequest{
project: client.project_id().to_string(),
..Default::default()
}, None).await;
}sourcepub async fn set_iam_policy(
&self,
req: &SetIamPolicyRequest,
cancel: Option<CancellationToken>
) -> Result<Policy, Error>
pub async fn set_iam_policy(
&self,
req: &SetIamPolicyRequest,
cancel: Option<CancellationToken>
) -> Result<Policy, Error>
Sets the iam policy. https://cloud.google.com/storage/docs/json_api/v1/buckets/setIamPolicy
use google_cloud_storage::client::Client;
use google_cloud_storage::http::buckets::{Binding, Policy};
use google_cloud_storage::http::buckets::set_iam_policy::SetIamPolicyRequest;
#[tokio::main]
async fn main() {
let client = Client::new().await.unwrap();
let result = client.set_iam_policy(&SetIamPolicyRequest{
resource: "bucket".to_string(),
policy: Policy {
bindings: vec![Binding {
role: "roles/storage.objectViewer".to_string(),
members: vec!["allAuthenticatedUsers".to_string()],
condition: None,
}],
..Default::default()
},
..Default::default()
}, None).await;
}sourcepub async fn get_iam_policy(
&self,
req: &GetIamPolicyRequest,
cancel: Option<CancellationToken>
) -> Result<Policy, Error>
pub async fn get_iam_policy(
&self,
req: &GetIamPolicyRequest,
cancel: Option<CancellationToken>
) -> Result<Policy, Error>
Gets the iam policy. https://cloud.google.com/storage/docs/json_api/v1/buckets/getIamPolicy
use google_cloud_storage::client::Client;
use google_cloud_storage::http::buckets::get_iam_policy::GetIamPolicyRequest;
use google_cloud_storage::http::buckets::list::ListBucketsRequest;
#[tokio::main]
async fn main() {
let client = Client::new().await.unwrap();
let result = client.get_iam_policy(&GetIamPolicyRequest{
resource: "bucket".to_string(),
..Default::default()
}, None).await;
}sourcepub async fn test_iam_permissions(
&self,
req: &TestIamPermissionsRequest,
cancel: Option<CancellationToken>
) -> Result<TestIamPermissionsResponse, Error>
pub async fn test_iam_permissions(
&self,
req: &TestIamPermissionsRequest,
cancel: Option<CancellationToken>
) -> Result<TestIamPermissionsResponse, Error>
Tests the iam permissions. https://cloud.google.com/storage/docs/json_api/v1/buckets/testIamPermissions
use google_cloud_storage::client::Client;
use google_cloud_storage::http::buckets::test_iam_permissions::TestIamPermissionsRequest;
#[tokio::main]
async fn main() {
let client = Client::new().await.unwrap();
let result = client.test_iam_permissions(&TestIamPermissionsRequest{
resource: "bucket".to_string(),
permissions: vec!["storage.buckets.get".to_string()],
}, None).await;
}sourcepub async fn list_default_object_access_controls(
&self,
req: &ListDefaultObjectAccessControlsRequest,
cancel: Option<CancellationToken>
) -> Result<ListDefaultObjectAccessControlsResponse, Error>
pub async fn list_default_object_access_controls(
&self,
req: &ListDefaultObjectAccessControlsRequest,
cancel: Option<CancellationToken>
) -> Result<ListDefaultObjectAccessControlsResponse, Error>
Lists the default object ACL. https://cloud.google.com/storage/docs/json_api/v1/defaultObjectAccessControls/list
use google_cloud_storage::client::Client;
use google_cloud_storage::http::buckets::test_iam_permissions::TestIamPermissionsRequest;
use google_cloud_storage::http::default_object_access_controls::list::ListDefaultObjectAccessControlsRequest;
#[tokio::main]
async fn main() {
let client = Client::new().await.unwrap();
let result = client.list_default_object_access_controls(&ListDefaultObjectAccessControlsRequest{
bucket: "bucket".to_string(),
..Default::default()
}, None).await;
}sourcepub async fn get_default_object_access_control(
&self,
req: &GetDefaultObjectAccessControlRequest,
cancel: Option<CancellationToken>
) -> Result<ObjectAccessControl, Error>
pub async fn get_default_object_access_control(
&self,
req: &GetDefaultObjectAccessControlRequest,
cancel: Option<CancellationToken>
) -> Result<ObjectAccessControl, Error>
Gets the default object ACL. https://cloud.google.com/storage/docs/json_api/v1/defaultObjectAccessControls/get
use google_cloud_storage::client::Client;
use google_cloud_storage::http::default_object_access_controls::get::GetDefaultObjectAccessControlRequest;
#[tokio::main]
async fn main() {
let client = Client::new().await.unwrap();
let result = client.get_default_object_access_control(&GetDefaultObjectAccessControlRequest{
bucket: "bucket".to_string(),
entity: "allAuthenticatedUsers".to_string(),
}, None).await;
}sourcepub async fn insert_default_object_access_control(
&self,
req: &InsertDefaultObjectAccessControlRequest,
cancel: Option<CancellationToken>
) -> Result<ObjectAccessControl, Error>
pub async fn insert_default_object_access_control(
&self,
req: &InsertDefaultObjectAccessControlRequest,
cancel: Option<CancellationToken>
) -> Result<ObjectAccessControl, Error>
Inserts the default object ACL. https://cloud.google.com/storage/docs/json_api/v1/defaultObjectAccessControls/insert
use google_cloud_storage::client::Client;
use google_cloud_storage::http::default_object_access_controls::insert::InsertDefaultObjectAccessControlRequest;
use google_cloud_storage::http::object_access_controls::insert::ObjectAccessControlCreationConfig;
use google_cloud_storage::http::object_access_controls::ObjectACLRole;
#[tokio::main]
async fn main() {
let client = Client::new().await.unwrap();
let result = client.insert_default_object_access_control(&InsertDefaultObjectAccessControlRequest{
bucket: "bucket".to_string(),
object_access_control: ObjectAccessControlCreationConfig {
entity: "allAuthenticatedUsers".to_string(),
role: ObjectACLRole::READER
} ,
}, None).await;
}sourcepub async fn patch_default_object_access_control(
&self,
req: &PatchDefaultObjectAccessControlRequest,
cancel: Option<CancellationToken>
) -> Result<ObjectAccessControl, Error>
pub async fn patch_default_object_access_control(
&self,
req: &PatchDefaultObjectAccessControlRequest,
cancel: Option<CancellationToken>
) -> Result<ObjectAccessControl, Error>
Patches the default object ACL. https://cloud.google.com/storage/docs/json_api/v1/defaultObjectAccessControls/patch
use google_cloud_storage::client::Client;
use google_cloud_storage::http::default_object_access_controls::patch::PatchDefaultObjectAccessControlRequest;
use google_cloud_storage::http::object_access_controls::insert::ObjectAccessControlCreationConfig;
use google_cloud_storage::http::object_access_controls::{ObjectAccessControl, ObjectACLRole};
use google_cloud_storage::http::object_access_controls::patch::PatchObjectAccessControlRequest;
#[tokio::main]
async fn main() {
let client = Client::new().await.unwrap();
let result = client.patch_default_object_access_control(&PatchDefaultObjectAccessControlRequest{
bucket: "bucket".to_string(),
entity: "allAuthenticatedUsers".to_string(),
object_access_control: ObjectAccessControl {
role: ObjectACLRole::READER,
..Default::default()
},
}, None).await;
}sourcepub async fn delete_default_object_access_control(
&self,
req: &DeleteDefaultObjectAccessControlRequest,
cancel: Option<CancellationToken>
) -> Result<(), Error>
pub async fn delete_default_object_access_control(
&self,
req: &DeleteDefaultObjectAccessControlRequest,
cancel: Option<CancellationToken>
) -> Result<(), Error>
Deletes the default object ACL. https://cloud.google.com/storage/docs/json_api/v1/defaultObjectAccessControls/delete
use google_cloud_storage::client::Client;
use google_cloud_storage::http::default_object_access_controls::delete::DeleteDefaultObjectAccessControlRequest;
#[tokio::main]
async fn main() {
let client = Client::new().await.unwrap();
let result = client.delete_default_object_access_control(&DeleteDefaultObjectAccessControlRequest{
bucket: "bucket".to_string(),
entity: "allAuthenticatedUsers".to_string(),
}, None).await;
}sourcepub async fn list_bucket_access_controls(
&self,
req: &ListBucketAccessControlsRequest,
cancel: Option<CancellationToken>
) -> Result<ListBucketAccessControlsResponse, Error>
pub async fn list_bucket_access_controls(
&self,
req: &ListBucketAccessControlsRequest,
cancel: Option<CancellationToken>
) -> Result<ListBucketAccessControlsResponse, Error>
Lists the bucket ACL. https://cloud.google.com/storage/docs/json_api/v1/bucketAccessControls/list
use google_cloud_storage::client::Client;
use google_cloud_storage::http::bucket_access_controls::list::ListBucketAccessControlsRequest;
#[tokio::main]
async fn main() {
let client = Client::new().await.unwrap();
let result = client.list_bucket_access_controls(&ListBucketAccessControlsRequest{
bucket: "bucket".to_string(),
}, None).await;
}sourcepub async fn get_bucket_access_control(
&self,
req: &GetBucketAccessControlRequest,
cancel: Option<CancellationToken>
) -> Result<BucketAccessControl, Error>
pub async fn get_bucket_access_control(
&self,
req: &GetBucketAccessControlRequest,
cancel: Option<CancellationToken>
) -> Result<BucketAccessControl, Error>
Gets the bucket ACL. https://cloud.google.com/storage/docs/json_api/v1/bucketAccessControls/get
use google_cloud_storage::client::Client;
use google_cloud_storage::http::bucket_access_controls::get::GetBucketAccessControlRequest;
#[tokio::main]
async fn main() {
let client = Client::new().await.unwrap();
let result = client.get_bucket_access_control(&GetBucketAccessControlRequest{
bucket: "bucket".to_string(),
entity: "allAuthenticatedUsers".to_string(),
}, None).await;
}sourcepub async fn insert_bucket_access_control(
&self,
req: &InsertBucketAccessControlRequest,
cancel: Option<CancellationToken>
) -> Result<BucketAccessControl, Error>
pub async fn insert_bucket_access_control(
&self,
req: &InsertBucketAccessControlRequest,
cancel: Option<CancellationToken>
) -> Result<BucketAccessControl, Error>
Inserts the bucket ACL. https://cloud.google.com/storage/docs/json_api/v1/bucketAccessControls/insert
use google_cloud_storage::client::Client;
use google_cloud_storage::http::bucket_access_controls::BucketACLRole;
use google_cloud_storage::http::bucket_access_controls::insert::{BucketAccessControlCreationConfig, InsertBucketAccessControlRequest};
#[tokio::main]
async fn main() {
let client = Client::new().await.unwrap();
let result = client.insert_bucket_access_control(&InsertBucketAccessControlRequest{
bucket: "bucket".to_string(),
acl: BucketAccessControlCreationConfig {
entity: "allAuthenticatedUsers".to_string(),
role: BucketACLRole::READER
}
}, None).await;
}sourcepub async fn patch_bucket_access_control(
&self,
req: &PatchBucketAccessControlRequest,
cancel: Option<CancellationToken>
) -> Result<BucketAccessControl, Error>
pub async fn patch_bucket_access_control(
&self,
req: &PatchBucketAccessControlRequest,
cancel: Option<CancellationToken>
) -> Result<BucketAccessControl, Error>
Patches the bucket ACL. https://cloud.google.com/storage/docs/json_api/v1/bucketAccessControls/patch
use google_cloud_storage::client::Client;
use google_cloud_storage::http::bucket_access_controls::BucketAccessControl;
use google_cloud_storage::http::bucket_access_controls::BucketACLRole;
use google_cloud_storage::http::bucket_access_controls::patch::PatchBucketAccessControlRequest;
#[tokio::main]
async fn main() {
let client = Client::new().await.unwrap();
let result = client.patch_bucket_access_control(&PatchBucketAccessControlRequest{
bucket: "bucket".to_string(),
entity: "allAuthenticatedUsers".to_string(),
acl: BucketAccessControl {
role: BucketACLRole::READER,
..Default::default()
}
}, None).await;
}sourcepub async fn delete_bucket_access_control(
&self,
req: &DeleteBucketAccessControlRequest,
cancel: Option<CancellationToken>
) -> Result<(), Error>
pub async fn delete_bucket_access_control(
&self,
req: &DeleteBucketAccessControlRequest,
cancel: Option<CancellationToken>
) -> Result<(), Error>
Deletes the bucket ACL.
use google_cloud_storage::client::Client;
use google_cloud_storage::http::bucket_access_controls::BucketAccessControl;
use google_cloud_storage::http::bucket_access_controls::delete::DeleteBucketAccessControlRequest;
#[tokio::main]
async fn main() {
let client = Client::new().await.unwrap();
let result = client.delete_bucket_access_control(&DeleteBucketAccessControlRequest{
bucket: "bucket".to_string(),
entity: "allAuthenticatedUsers".to_string(),
}, None).await;
}sourcepub async fn list_object_access_controls(
&self,
req: &ListObjectAccessControlsRequest,
cancel: Option<CancellationToken>
) -> Result<ListBucketAccessControlsResponse, Error>
pub async fn list_object_access_controls(
&self,
req: &ListObjectAccessControlsRequest,
cancel: Option<CancellationToken>
) -> Result<ListBucketAccessControlsResponse, Error>
Lists the object ACL. https://cloud.google.com/storage/docs/json_api/v1/objectAccessControls/list
use google_cloud_storage::client::Client;
use google_cloud_storage::http::object_access_controls::list::ListObjectAccessControlsRequest;
#[tokio::main]
async fn main() {
let client = Client::new().await.unwrap();
let result = client.list_object_access_controls(&ListObjectAccessControlsRequest{
bucket: "bucket".to_string(),
object: "filename".to_string(),
..Default::default()
}, None).await;
}sourcepub async fn get_object_access_control(
&self,
req: &GetObjectAccessControlRequest,
cancel: Option<CancellationToken>
) -> Result<ObjectAccessControl, Error>
pub async fn get_object_access_control(
&self,
req: &GetObjectAccessControlRequest,
cancel: Option<CancellationToken>
) -> Result<ObjectAccessControl, Error>
Gets the object ACL. https://cloud.google.com/storage/docs/json_api/v1/objectAccessControls/get
use google_cloud_storage::client::Client;
use google_cloud_storage::http::object_access_controls::get::GetObjectAccessControlRequest;
#[tokio::main]
async fn main() {
let client = Client::new().await.unwrap();
let result = client.get_object_access_control(&GetObjectAccessControlRequest{
bucket: "bucket".to_string(),
object: "filename".to_string(),
entity: "allAuthenticatedUsers".to_string(),
..Default::default()
}, None).await;
}sourcepub async fn insert_object_access_control(
&self,
req: &InsertObjectAccessControlRequest,
cancel: Option<CancellationToken>
) -> Result<ObjectAccessControl, Error>
pub async fn insert_object_access_control(
&self,
req: &InsertObjectAccessControlRequest,
cancel: Option<CancellationToken>
) -> Result<ObjectAccessControl, Error>
Inserts the object ACL. https://cloud.google.com/storage/docs/json_api/v1/objectAccessControls/insert
use google_cloud_storage::client::Client;
use google_cloud_storage::http::object_access_controls::insert::{InsertObjectAccessControlRequest, ObjectAccessControlCreationConfig};
use google_cloud_storage::http::object_access_controls::ObjectACLRole;
#[tokio::main]
async fn main() {
let client = Client::new().await.unwrap();
let result = client.insert_object_access_control(&InsertObjectAccessControlRequest{
bucket: "bucket".to_string(),
object: "filename".to_string(),
acl: ObjectAccessControlCreationConfig {
entity: "allAuthenticatedUsers".to_string(),
role: ObjectACLRole::READER
},
..Default::default()
}, None).await;
}sourcepub async fn patch_object_access_control(
&self,
req: &PatchObjectAccessControlRequest,
cancel: Option<CancellationToken>
) -> Result<ObjectAccessControl, Error>
pub async fn patch_object_access_control(
&self,
req: &PatchObjectAccessControlRequest,
cancel: Option<CancellationToken>
) -> Result<ObjectAccessControl, Error>
Patches the bucket ACL. https://cloud.google.com/storage/docs/json_api/v1/objectAccessControls/patch
use google_cloud_storage::client::Client;
use google_cloud_storage::http::object_access_controls::{ObjectAccessControl, ObjectACLRole};
use google_cloud_storage::http::object_access_controls::patch::PatchObjectAccessControlRequest;
#[tokio::main]
async fn main() {
let client = Client::new().await.unwrap();
let result = client.patch_object_access_control(&PatchObjectAccessControlRequest{
bucket: "bucket".to_string(),
object: "filename".to_string(),
entity: "allAuthenticatedUsers".to_string(),
acl: ObjectAccessControl {
role: ObjectACLRole::READER,
..Default::default()
},
..Default::default()
}, None).await;
}sourcepub async fn delete_object_access_control(
&self,
req: &DeleteObjectAccessControlRequest,
cancel: Option<CancellationToken>
) -> Result<(), Error>
pub async fn delete_object_access_control(
&self,
req: &DeleteObjectAccessControlRequest,
cancel: Option<CancellationToken>
) -> Result<(), Error>
Deletes the bucket ACL. https://cloud.google.com/storage/docs/json_api/v1/objectAccessControls/delete
use google_cloud_storage::client::Client;
use google_cloud_storage::http::object_access_controls::{ObjectAccessControl, ObjectACLRole};
use google_cloud_storage::http::object_access_controls::delete::DeleteObjectAccessControlRequest;
#[tokio::main]
async fn main() {
let client = Client::new().await.unwrap();
let result = client.delete_object_access_control(&DeleteObjectAccessControlRequest{
bucket: "bucket".to_string(),
object: "filename".to_string(),
entity: "allAuthenticatedUsers".to_string(),
..Default::default()
}, None).await;
}sourcepub async fn list_notifications(
&self,
req: &ListNotificationsRequest,
cancel: Option<CancellationToken>
) -> Result<ListNotificationsResponse, Error>
pub async fn list_notifications(
&self,
req: &ListNotificationsRequest,
cancel: Option<CancellationToken>
) -> Result<ListNotificationsResponse, Error>
Lists the notification. https://cloud.google.com/storage/docs/json_api/v1/notifications/list
use google_cloud_storage::client::Client;
use google_cloud_storage::http::notifications::list::ListNotificationsRequest;
#[tokio::main]
async fn main() {
let client = Client::new().await.unwrap();
let result = client.list_notifications(&ListNotificationsRequest{
bucket: "bucket".to_string(),
..Default::default()
}, None).await;
}sourcepub async fn get_notification(
&self,
req: &GetNotificationRequest,
cancel: Option<CancellationToken>
) -> Result<Notification, Error>
pub async fn get_notification(
&self,
req: &GetNotificationRequest,
cancel: Option<CancellationToken>
) -> Result<Notification, Error>
Gets the notification. https://cloud.google.com/storage/docs/json_api/v1/notifications/get
use google_cloud_storage::client::Client;
use google_cloud_storage::http::notifications::get::GetNotificationRequest;
#[tokio::main]
async fn main() {
let client = Client::new().await.unwrap();
let result = client.get_notification(&GetNotificationRequest{
bucket: "bucket".to_string(),
notification: "notification".to_string()
}, None).await;
}sourcepub async fn insert_notification(
&self,
req: &InsertNotificationRequest,
cancel: Option<CancellationToken>
) -> Result<Notification, Error>
pub async fn insert_notification(
&self,
req: &InsertNotificationRequest,
cancel: Option<CancellationToken>
) -> Result<Notification, Error>
Inserts the notification. https://cloud.google.com/storage/docs/json_api/v1/notifications/insert
use google_cloud_storage::client::Client;
use google_cloud_storage::http::notifications::EventType;
use google_cloud_storage::http::notifications::insert::{InsertNotificationRequest, NotificationCreationConfig};
#[tokio::main]
async fn main() {
let client = Client::new().await.unwrap();
let result = client.insert_notification(&InsertNotificationRequest {
bucket: "bucket".to_string(),
notification: NotificationCreationConfig {
topic: format!("projects/{}/topics/{}", "project","bucket"),
event_types: Some(vec![EventType::ObjectMetadataUpdate, EventType::ObjectDelete]),
..Default::default()
}
}, None).await;
}sourcepub async fn delete_notification(
&self,
req: &DeleteNotificationRequest,
cancel: Option<CancellationToken>
) -> Result<(), Error>
pub async fn delete_notification(
&self,
req: &DeleteNotificationRequest,
cancel: Option<CancellationToken>
) -> Result<(), Error>
Deletes the notification. https://cloud.google.com/storage/docs/json_api/v1/notifications/delete
use google_cloud_storage::client::Client;
use google_cloud_storage::http::notifications::delete::DeleteNotificationRequest;
#[tokio::main]
async fn main() {
let client = Client::new().await.unwrap();
let result = client.delete_notification(&DeleteNotificationRequest {
bucket: "bucket".to_string(),
notification: "notification".to_string()
}, None).await;
}sourcepub async fn list_hmac_keys(
&self,
req: &ListHmacKeysRequest,
cancel: Option<CancellationToken>
) -> Result<ListHmacKeysResponse, Error>
pub async fn list_hmac_keys(
&self,
req: &ListHmacKeysRequest,
cancel: Option<CancellationToken>
) -> Result<ListHmacKeysResponse, Error>
Lists the hmac keys. https://cloud.google.com/storage/docs/json_api/v1/projects/hmacKeys/list
use google_cloud_storage::client::Client;
use google_cloud_storage::http::hmac_keys::list::ListHmacKeysRequest;
#[tokio::main]
async fn main() {
let client = Client::new().await.unwrap();
let result = client.list_hmac_keys(&ListHmacKeysRequest {
project_id: client.project_id().to_string(),
..Default::default()
}, None).await;
}sourcepub async fn get_hmac_key(
&self,
req: &GetHmacKeyRequest,
cancel: Option<CancellationToken>
) -> Result<HmacKeyMetadata, Error>
pub async fn get_hmac_key(
&self,
req: &GetHmacKeyRequest,
cancel: Option<CancellationToken>
) -> Result<HmacKeyMetadata, Error>
Gets the hmac keys. https://cloud.google.com/storage/docs/json_api/v1/projects/hmacKeys/get
use google_cloud_storage::client::Client;
use google_cloud_storage::http::hmac_keys::get::GetHmacKeyRequest;
#[tokio::main]
async fn main() {
let client = Client::new().await.unwrap();
let result = client.get_hmac_key(&GetHmacKeyRequest {
access_id: "access_id".to_string(),
project_id: client.project_id().to_string(),
}, None).await;
}sourcepub async fn create_hmac_key(
&self,
req: &CreateHmacKeyRequest,
cancel: Option<CancellationToken>
) -> Result<CreateHmacKeyResponse, Error>
pub async fn create_hmac_key(
&self,
req: &CreateHmacKeyRequest,
cancel: Option<CancellationToken>
) -> Result<CreateHmacKeyResponse, Error>
Creates the hmac key. https://cloud.google.com/storage/docs/json_api/v1/projects/hmacKeys/create
use google_cloud_storage::client::Client;
use google_cloud_storage::http::hmac_keys::create::CreateHmacKeyRequest;
#[tokio::main]
async fn main() {
let client = Client::new().await.unwrap();
let result = client.create_hmac_key(&CreateHmacKeyRequest {
service_account_email: "service_account_email".to_string(),
project_id: client.project_id().to_string(),
}, None).await;
}sourcepub async fn update_hmac_key(
&self,
req: &UpdateHmacKeyRequest,
cancel: Option<CancellationToken>
) -> Result<HmacKeyMetadata, Error>
pub async fn update_hmac_key(
&self,
req: &UpdateHmacKeyRequest,
cancel: Option<CancellationToken>
) -> Result<HmacKeyMetadata, Error>
Updates the hmac key. https://cloud.google.com/storage/docs/json_api/v1/projects/hmacKeys/update
use google_cloud_storage::client::Client;
use google_cloud_storage::http::hmac_keys::HmacKeyMetadata;
use google_cloud_storage::http::hmac_keys::update::UpdateHmacKeyRequest;
#[tokio::main]
async fn main() {
let client = Client::new().await.unwrap();
let result = client.update_hmac_key(&UpdateHmacKeyRequest{
access_id: "access_id".to_string(),
project_id: client.project_id().to_string(),
metadata: HmacKeyMetadata {
state: "INACTIVE".to_string(),
..Default::default()
},
}, None).await;
}sourcepub async fn delete_hmac_key(
&self,
req: &DeleteHmacKeyRequest,
cancel: Option<CancellationToken>
) -> Result<(), Error>
pub async fn delete_hmac_key(
&self,
req: &DeleteHmacKeyRequest,
cancel: Option<CancellationToken>
) -> Result<(), Error>
Deletes the hmac key. https://cloud.google.com/storage/docs/json_api/v1/projects/hmacKeys/delete
use google_cloud_storage::client::Client;
use google_cloud_storage::http::hmac_keys::delete::DeleteHmacKeyRequest;
#[tokio::main]
async fn main() {
let client = Client::new().await.unwrap();
let result = client.delete_hmac_key(&DeleteHmacKeyRequest{
access_id: "access_id".to_string(),
project_id: client.project_id().to_string(),
}, None).await;
}sourcepub async fn list_objects(
&self,
req: &ListObjectsRequest,
cancel: Option<CancellationToken>
) -> Result<ListObjectsResponse, Error>
pub async fn list_objects(
&self,
req: &ListObjectsRequest,
cancel: Option<CancellationToken>
) -> Result<ListObjectsResponse, Error>
Lists the objects. https://cloud.google.com/storage/docs/json_api/v1/projects/hmacKeys/delete
use google_cloud_storage::client::Client;
use google_cloud_storage::http::objects::list::ListObjectsRequest;
#[tokio::main]
async fn main() {
let client = Client::new().await.unwrap();
let result = client.list_objects(&ListObjectsRequest{
bucket: "bucket".to_string(),
..Default::default()
}, None).await;
}sourcepub async fn get_object(
&self,
req: &GetObjectRequest,
cancel: Option<CancellationToken>
) -> Result<Object, Error>
pub async fn get_object(
&self,
req: &GetObjectRequest,
cancel: Option<CancellationToken>
) -> Result<Object, Error>
Gets the object. https://cloud.google.com/storage/docs/json_api/v1/objects/get
use google_cloud_storage::client::Client;
use google_cloud_storage::http::objects::get::GetObjectRequest;
#[tokio::main]
async fn main() {
let client = Client::new().await.unwrap();
let result = client.get_object(&GetObjectRequest{
bucket: "bucket".to_string(),
object: "object".to_string(),
..Default::default()
}, None).await;
}sourcepub async fn download_object(
&self,
req: &GetObjectRequest,
cancel: Option<CancellationToken>
) -> Result<Vec<u8>, Error>
pub async fn download_object(
&self,
req: &GetObjectRequest,
cancel: Option<CancellationToken>
) -> Result<Vec<u8>, Error>
Download the object. https://cloud.google.com/storage/docs/json_api/v1/objects/get alt is always media
use google_cloud_storage::client::Client;
use google_cloud_storage::http::objects::get::GetObjectRequest;
#[tokio::main]
async fn main() {
let client = Client::new().await.unwrap();
let result = client.download_object(&GetObjectRequest{
bucket: "bucket".to_string(),
object: "object".to_string(),
..Default::default()
}, None).await;
}sourcepub async fn download_streamed_object(
&self,
req: &GetObjectRequest,
cancel: Option<CancellationToken>
) -> Result<impl Stream<Item = Result<Bytes>>, Error>
pub async fn download_streamed_object(
&self,
req: &GetObjectRequest,
cancel: Option<CancellationToken>
) -> Result<impl Stream<Item = Result<Bytes>>, Error>
Download the object. https://cloud.google.com/storage/docs/json_api/v1/objects/get alt is always media
use google_cloud_storage::client::Client;
use google_cloud_storage::http::objects::get::GetObjectRequest;
#[tokio::main]
async fn main() {
let client = Client::new().await.unwrap();
let result = client.download_streamed_object(&GetObjectRequest{
bucket: "bucket".to_string(),
object: "object".to_string(),
..Default::default()
}, None).await;
// while let Some(v) = downloaded.next().await? {
// let d: bytes::Bytes = v.unwrap();
// }
}sourcepub async fn upload_object(
&self,
req: &UploadObjectRequest,
data: &[u8],
content_type: &str,
cancel: Option<CancellationToken>
) -> Result<Object, Error>
pub async fn upload_object(
&self,
req: &UploadObjectRequest,
data: &[u8],
content_type: &str,
cancel: Option<CancellationToken>
) -> Result<Object, Error>
Uploads the object. https://cloud.google.com/storage/docs/json_api/v1/objects/insert ‘uploadType’ is always media - Data-only upload. Upload the object data only, without any metadata.
use google_cloud_storage::client::Client;
use google_cloud_storage::http::objects::upload::UploadObjectRequest;
#[tokio::main]
async fn main() {
let client = Client::new().await.unwrap();
let result = client.upload_object(&UploadObjectRequest{
bucket: "bucket".to_string(),
name: "filename".to_string(),
..Default::default()
}, "hello world".as_bytes(), "application/octet-stream", None).await;
}sourcepub async fn upload_streamed_object<S>(
&self,
req: &UploadObjectRequest,
data: S,
content_type: &str,
content_length: Option<usize>,
cancel: Option<CancellationToken>
) -> Result<Object, Error> where
S: TryStream + Send + Sync + 'static,
S::Error: Into<Box<dyn Error + Send + Sync>>,
Bytes: From<S::Ok>,
pub async fn upload_streamed_object<S>(
&self,
req: &UploadObjectRequest,
data: S,
content_type: &str,
content_length: Option<usize>,
cancel: Option<CancellationToken>
) -> Result<Object, Error> where
S: TryStream + Send + Sync + 'static,
S::Error: Into<Box<dyn Error + Send + Sync>>,
Bytes: From<S::Ok>,
Uploads the streamed object. https://cloud.google.com/storage/docs/json_api/v1/objects/insert ‘uploadType’ is always media - Data-only upload. Upload the object data only, without any metadata.
use google_cloud_storage::client::Client;
use google_cloud_storage::http::objects::upload::UploadObjectRequest;
#[tokio::main]
async fn main() {
let client = Client::new().await.unwrap();
let source = vec!["hello", " ", "world"];
let size = source.iter().map(|x| x.len()).sum();
let chunks: Vec<Result<_, ::std::io::Error>> = source.clone().into_iter().map(|x| Ok(x)).collect();
let stream = futures_util::stream::iter(chunks);
let result = client.upload_streamed_object(&UploadObjectRequest{
bucket: "bucket".to_string(),
name: "filename".to_string(),
..Default::default()
}, stream, "application/octet-stream", Some(size), None).await;
}sourcepub async fn patch_object(
&self,
req: &PatchObjectRequest,
cancel: Option<CancellationToken>
) -> Result<Object, Error>
pub async fn patch_object(
&self,
req: &PatchObjectRequest,
cancel: Option<CancellationToken>
) -> Result<Object, Error>
Patches the object. https://cloud.google.com/storage/docs/json_api/v1/objects/patch
use google_cloud_storage::client::Client;
use google_cloud_storage::http::objects::patch::PatchObjectRequest;
#[tokio::main]
async fn main() {
let client = Client::new().await.unwrap();
let result = client.patch_object(&PatchObjectRequest{
bucket: "bucket".to_string(),
object: "object".to_string(),
..Default::default()
}, None).await;
}sourcepub async fn delete_object(
&self,
req: &DeleteObjectRequest,
cancel: Option<CancellationToken>
) -> Result<(), Error>
pub async fn delete_object(
&self,
req: &DeleteObjectRequest,
cancel: Option<CancellationToken>
) -> Result<(), Error>
Deletes the object. https://cloud.google.com/storage/docs/json_api/v1/objects/delete
use google_cloud_storage::client::Client;
use google_cloud_storage::http::objects::delete::DeleteObjectRequest;
#[tokio::main]
async fn main() {
let client = Client::new().await.unwrap();
let result = client.delete_object(&DeleteObjectRequest{
bucket: "bucket".to_string(),
object: "object".to_string(),
..Default::default()
}, None).await;
}sourcepub async fn rewrite_object(
&self,
req: &RewriteObjectRequest,
cancel: Option<CancellationToken>
) -> Result<RewriteObjectResponse, Error>
pub async fn rewrite_object(
&self,
req: &RewriteObjectRequest,
cancel: Option<CancellationToken>
) -> Result<RewriteObjectResponse, Error>
Rewrites the object. https://cloud.google.com/storage/docs/json_api/v1/objects/rewrite
use google_cloud_storage::client::Client;
use google_cloud_storage::http::objects::rewrite::RewriteObjectRequest;
#[tokio::main]
async fn main() {
let client = Client::new().await.unwrap();
let result = client.rewrite_object(&RewriteObjectRequest{
source_bucket: "bucket1".to_string(),
source_object: "object".to_string(),
destination_bucket: "bucket2".to_string(),
destination_object: "object1".to_string(),
..Default::default()
}, None).await;
}sourcepub async fn compose_object(
&self,
req: &ComposeObjectRequest,
cancel: Option<CancellationToken>
) -> Result<Object, Error>
pub async fn compose_object(
&self,
req: &ComposeObjectRequest,
cancel: Option<CancellationToken>
) -> Result<Object, Error>
Composes the object. https://cloud.google.com/storage/docs/json_api/v1/objects/compose
use google_cloud_storage::client::Client;
use google_cloud_storage::http::objects::compose::{ComposeObjectRequest, ComposingTargets};
use google_cloud_storage::http::objects::rewrite::RewriteObjectRequest;
use google_cloud_storage::http::objects::SourceObjects;
#[tokio::main]
async fn main() {
let client = Client::new().await.unwrap();
let result = client.compose_object(&ComposeObjectRequest{
bucket: "bucket1".to_string(),
destination_object: "object1".to_string(),
composing_targets: ComposingTargets {
source_objects: vec![SourceObjects {
name: "src".to_string(),
..Default::default()
}],
..Default::default()
},
..Default::default()
}, None).await;
}Trait Implementations
sourceimpl Clone for StorageClient
impl Clone for StorageClient
sourcefn clone(&self) -> StorageClient
fn clone(&self) -> StorageClient
Returns a copy of the value. Read more
1.0.0 · sourcefn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from source. Read more
Auto Trait Implementations
impl !RefUnwindSafe for StorageClient
impl Send for StorageClient
impl Sync for StorageClient
impl Unpin for StorageClient
impl !UnwindSafe for StorageClient
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<T> Instrument for T
impl<T> Instrument for T
sourcefn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
sourcefn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
fn vzip(self) -> V
sourceimpl<T> WithSubscriber for T
impl<T> WithSubscriber for T
sourcefn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> where
S: Into<Dispatch>,
fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> where
S: Into<Dispatch>,
Attaches the provided Subscriber to this type, returning a
WithDispatch wrapper. Read more
sourcefn with_current_subscriber(self) -> WithDispatch<Self>
fn with_current_subscriber(self) -> WithDispatch<Self>
Attaches the current default Subscriber to this type, returning a
WithDispatch wrapper. Read more