StorageClient

Struct StorageClient 

Source
pub struct StorageClient { /* private fields */ }
Expand description

AVL Storage client

Implementations§

Source§

impl StorageClient

Source

pub async fn connect(endpoint: &str) -> Result<Self>

Connect to AVL Storage

Source

pub async fn create_bucket(&self, bucket: &str) -> Result<()>

Create a bucket

Source

pub async fn list_buckets(&self) -> Result<Vec<String>>

List buckets

Source

pub async fn delete_bucket(&self, bucket: &str) -> Result<()>

Delete a bucket

Source

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?;
Source

pub async fn get_object( &self, bucket: &str, key: &str, ) -> Result<GetObjectResponse>

Download an object

Source

pub async fn list_objects( &self, bucket: &str, prefix: Option<&str>, ) -> Result<Vec<ObjectInfo>>

List objects in a bucket

Source

pub async fn delete_object(&self, bucket: &str, key: &str) -> Result<()>

Delete an object

Source

pub async fn copy_object( &self, source_bucket: &str, source_key: &str, dest_bucket: &str, dest_key: &str, ) -> Result<()>

Copy an object

Source§

impl StorageClient

Source

pub async fn create_multipart_upload( &self, bucket: &str, key: &str, ) -> Result<MultipartUpload>

Initiate multipart upload

Source

pub async fn upload_part( &self, bucket: &str, key: &str, upload_id: &str, part_number: i32, body: Vec<u8>, ) -> Result<String>

Upload a part

Source

pub async fn complete_multipart_upload( &self, bucket: &str, key: &str, upload_id: &str, parts: Vec<(i32, String)>, ) -> Result<()>

Complete multipart upload

Source

pub async fn abort_multipart_upload( &self, bucket: &str, key: &str, upload_id: &str, ) -> Result<()>

Abort multipart upload

Trait Implementations§

Source§

impl Clone for StorageClient

Source§

fn clone(&self) -> StorageClient

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for StorageClient

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.