pub struct StorageClient { /* private fields */ }Expand description
AVL Storage client
Implementations§
Source§impl StorageClient
impl StorageClient
Sourcepub async fn create_bucket(&self, bucket: &str) -> Result<()>
pub async fn create_bucket(&self, bucket: &str) -> Result<()>
Create a bucket
Sourcepub async fn list_buckets(&self) -> Result<Vec<String>>
pub async fn list_buckets(&self) -> Result<Vec<String>>
List buckets
Sourcepub async fn delete_bucket(&self, bucket: &str) -> Result<()>
pub async fn delete_bucket(&self, bucket: &str) -> Result<()>
Delete a bucket
Sourcepub async fn put_object(
&self,
req: PutObjectRequest,
) -> Result<PutObjectResponse>
pub async fn put_object( &self, req: PutObjectRequest, ) -> Result<PutObjectResponse>
Upload an object
§Example
client.put_object(PutObjectRequest {
bucket: "my-bucket".to_string(),
key: "file.txt".to_string(),
body: b"Hello!".to_vec(),
content_type: Some("text/plain".to_string()),
..Default::default()
}).await?;Sourcepub async fn get_object(
&self,
bucket: &str,
key: &str,
) -> Result<GetObjectResponse>
pub async fn get_object( &self, bucket: &str, key: &str, ) -> Result<GetObjectResponse>
Download an object
Sourcepub async fn list_objects(
&self,
bucket: &str,
prefix: Option<&str>,
) -> Result<Vec<ObjectInfo>>
pub async fn list_objects( &self, bucket: &str, prefix: Option<&str>, ) -> Result<Vec<ObjectInfo>>
List objects in a bucket
Source§impl StorageClient
impl StorageClient
Sourcepub async fn create_multipart_upload(
&self,
bucket: &str,
key: &str,
) -> Result<MultipartUpload>
pub async fn create_multipart_upload( &self, bucket: &str, key: &str, ) -> Result<MultipartUpload>
Initiate multipart upload
Sourcepub async fn upload_part(
&self,
bucket: &str,
key: &str,
upload_id: &str,
part_number: i32,
body: Vec<u8>,
) -> Result<String>
pub async fn upload_part( &self, bucket: &str, key: &str, upload_id: &str, part_number: i32, body: Vec<u8>, ) -> Result<String>
Upload a part
Trait Implementations§
Source§impl Clone for StorageClient
impl Clone for StorageClient
Source§fn clone(&self) -> StorageClient
fn clone(&self) -> StorageClient
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl Freeze for StorageClient
impl RefUnwindSafe for StorageClient
impl Send for StorageClient
impl Sync for StorageClient
impl Unpin for StorageClient
impl UnwindSafe for StorageClient
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more