Skip to main content

S3Client

Struct S3Client 

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

S3 client wrapper

Implementations§

Source§

impl S3Client

Source

pub async fn new(alias: Alias) -> Result<Self>

Create a new S3 client from an alias configuration

Source

pub fn inner(&self) -> &Client

Get the underlying aws-sdk-s3 client

Source

pub async fn list_object_versions_page( &self, path: &RemotePath, max_keys: Option<i32>, ) -> Result<ObjectVersionListResult>

List a single page of object versions and return pagination metadata.

Source

pub async fn get_object_with_progress( &self, path: &RemotePath, on_progress: impl FnMut(u64, Option<u64>) + Send, ) -> Result<Vec<u8>>

Download object content and report downloaded bytes after each received chunk.

Source

pub async fn delete_object_with_options( &self, path: &RemotePath, options: DeleteRequestOptions, ) -> Result<()>

Delete an object with RustFS-specific request options.

Source

pub async fn delete_objects_with_options( &self, bucket: &str, keys: Vec<String>, options: DeleteRequestOptions, ) -> Result<Vec<String>>

Delete multiple objects with RustFS-specific request options.

Source

pub async fn put_object_from_path( &self, path: &RemotePath, file_path: &Path, content_type: Option<&str>, on_progress: impl Fn(u64) + Send, ) -> Result<ObjectInfo>

Upload a local file path to S3.

Uses multipart upload for large files to avoid loading the entire file into memory. Calls on_progress after each uploaded part with total bytes sent so far.

Trait Implementations§

Source§

impl ObjectStore for S3Client

Source§

fn list_buckets<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Result<Vec<ObjectInfo>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

List buckets
Source§

fn list_objects<'life0, 'life1, 'async_trait>( &'life0 self, path: &'life1 RemotePath, options: ListOptions, ) -> Pin<Box<dyn Future<Output = Result<ListResult>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

List objects in a bucket or prefix
Source§

fn head_object<'life0, 'life1, 'async_trait>( &'life0 self, path: &'life1 RemotePath, ) -> Pin<Box<dyn Future<Output = Result<ObjectInfo>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Get object metadata
Source§

fn bucket_exists<'life0, 'life1, 'async_trait>( &'life0 self, bucket: &'life1 str, ) -> Pin<Box<dyn Future<Output = Result<bool>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Check if a bucket exists
Source§

fn create_bucket<'life0, 'life1, 'async_trait>( &'life0 self, bucket: &'life1 str, ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Create a bucket
Source§

fn delete_bucket<'life0, 'life1, 'async_trait>( &'life0 self, bucket: &'life1 str, ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Delete a bucket
Source§

fn capabilities<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Result<Capabilities>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Get backend capabilities
Source§

fn get_object<'life0, 'life1, 'async_trait>( &'life0 self, path: &'life1 RemotePath, ) -> Pin<Box<dyn Future<Output = Result<Vec<u8>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Get object content as bytes
Source§

fn put_object<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, path: &'life1 RemotePath, data: Vec<u8>, content_type: Option<&'life2 str>, ) -> Pin<Box<dyn Future<Output = Result<ObjectInfo>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

Upload object from bytes
Source§

fn delete_object<'life0, 'life1, 'async_trait>( &'life0 self, path: &'life1 RemotePath, ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Delete an object
Source§

fn delete_objects<'life0, 'life1, 'async_trait>( &'life0 self, bucket: &'life1 str, keys: Vec<String>, ) -> Pin<Box<dyn Future<Output = Result<Vec<String>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Delete multiple objects (batch delete)
Source§

fn copy_object<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, src: &'life1 RemotePath, dst: &'life2 RemotePath, ) -> Pin<Box<dyn Future<Output = Result<ObjectInfo>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

Copy object within S3 (server-side copy)
Source§

fn presign_get<'life0, 'life1, 'async_trait>( &'life0 self, path: &'life1 RemotePath, expires_secs: u64, ) -> Pin<Box<dyn Future<Output = Result<String>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Generate a presigned URL for an object
Source§

fn presign_put<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, path: &'life1 RemotePath, expires_secs: u64, content_type: Option<&'life2 str>, ) -> Pin<Box<dyn Future<Output = Result<String>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

Generate a presigned URL for uploading an object
Source§

fn get_versioning<'life0, 'life1, 'async_trait>( &'life0 self, bucket: &'life1 str, ) -> Pin<Box<dyn Future<Output = Result<Option<bool>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Get bucket versioning status
Source§

fn set_versioning<'life0, 'life1, 'async_trait>( &'life0 self, bucket: &'life1 str, enabled: bool, ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Set bucket versioning status
Source§

fn list_object_versions<'life0, 'life1, 'async_trait>( &'life0 self, path: &'life1 RemotePath, max_keys: Option<i32>, ) -> Pin<Box<dyn Future<Output = Result<Vec<ObjectVersion>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

List object versions
Source§

fn get_object_tags<'life0, 'life1, 'async_trait>( &'life0 self, path: &'life1 RemotePath, ) -> Pin<Box<dyn Future<Output = Result<HashMap<String, String>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Get object tags
Source§

fn get_bucket_tags<'life0, 'life1, 'async_trait>( &'life0 self, bucket: &'life1 str, ) -> Pin<Box<dyn Future<Output = Result<HashMap<String, String>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Get bucket tags
Source§

fn set_object_tags<'life0, 'life1, 'async_trait>( &'life0 self, path: &'life1 RemotePath, tags: HashMap<String, String>, ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Set object tags
Source§

fn set_bucket_tags<'life0, 'life1, 'async_trait>( &'life0 self, bucket: &'life1 str, tags: HashMap<String, String>, ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Set bucket tags
Source§

fn delete_object_tags<'life0, 'life1, 'async_trait>( &'life0 self, path: &'life1 RemotePath, ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Delete object tags
Source§

fn delete_bucket_tags<'life0, 'life1, 'async_trait>( &'life0 self, bucket: &'life1 str, ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Delete bucket tags
Source§

fn get_bucket_policy<'life0, 'life1, 'async_trait>( &'life0 self, bucket: &'life1 str, ) -> Pin<Box<dyn Future<Output = Result<Option<String>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Get bucket policy as raw JSON string. Returns None when no policy exists.
Source§

fn set_bucket_policy<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, bucket: &'life1 str, policy: &'life2 str, ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

Replace bucket policy using raw JSON string.
Source§

fn delete_bucket_policy<'life0, 'life1, 'async_trait>( &'life0 self, bucket: &'life1 str, ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Remove bucket policy (set anonymous access to private).
Source§

fn get_bucket_cors<'life0, 'life1, 'async_trait>( &'life0 self, bucket: &'life1 str, ) -> Pin<Box<dyn Future<Output = Result<Vec<CorsRule>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Get bucket CORS rules. Returns empty vec if no CORS config exists.
Source§

fn set_bucket_cors<'life0, 'life1, 'async_trait>( &'life0 self, bucket: &'life1 str, rules: Vec<CorsRule>, ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Set bucket CORS configuration (replaces all rules).
Source§

fn delete_bucket_cors<'life0, 'life1, 'async_trait>( &'life0 self, bucket: &'life1 str, ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Delete bucket CORS configuration.
Source§

fn get_bucket_notifications<'life0, 'life1, 'async_trait>( &'life0 self, bucket: &'life1 str, ) -> Pin<Box<dyn Future<Output = Result<Vec<BucketNotification>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Get bucket notification configuration as flat rules.
Source§

fn set_bucket_notifications<'life0, 'life1, 'async_trait>( &'life0 self, bucket: &'life1 str, notifications: Vec<BucketNotification>, ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Replace bucket notification configuration with flat rules.
Source§

fn get_bucket_lifecycle<'life0, 'life1, 'async_trait>( &'life0 self, bucket: &'life1 str, ) -> Pin<Box<dyn Future<Output = Result<Vec<LifecycleRule>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Get bucket lifecycle rules. Returns empty vec if no lifecycle config exists.
Source§

fn set_bucket_lifecycle<'life0, 'life1, 'async_trait>( &'life0 self, bucket: &'life1 str, rules: Vec<LifecycleRule>, ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Set bucket lifecycle configuration (replaces all rules).
Source§

fn delete_bucket_lifecycle<'life0, 'life1, 'async_trait>( &'life0 self, bucket: &'life1 str, ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Delete bucket lifecycle configuration.
Source§

fn restore_object<'life0, 'life1, 'async_trait>( &'life0 self, path: &'life1 RemotePath, days: i32, ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Restore a transitioned (archived) object.
Source§

fn get_bucket_replication<'life0, 'life1, 'async_trait>( &'life0 self, bucket: &'life1 str, ) -> Pin<Box<dyn Future<Output = Result<Option<ReplicationConfiguration>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Get bucket replication configuration. Returns None if not configured.
Source§

fn set_bucket_replication<'life0, 'life1, 'async_trait>( &'life0 self, bucket: &'life1 str, config: ReplicationConfiguration, ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Set bucket replication configuration.
Source§

fn delete_bucket_replication<'life0, 'life1, 'async_trait>( &'life0 self, bucket: &'life1 str, ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Delete bucket replication configuration.
Source§

fn select_object_content<'life0, 'life1, 'life2, 'life3, 'async_trait>( &'life0 self, path: &'life1 RemotePath, options: &'life2 SelectOptions, writer: &'life3 mut (dyn AsyncWrite + Send + Unpin), ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait, 'life3: 'async_trait,

Run S3 Select on an object and stream result payloads to writer.

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> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
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> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

impl<Unshared, Shared> IntoShared<Shared> for Unshared
where Shared: FromUnshared<Unshared>,

Source§

fn into_shared(self) -> Shared

Creates a shared type from an unshared type.
Source§

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

Source§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow only if self and other return Action::Follow. Read more
Source§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow if either self or other returns Action::Follow. Read more
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
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.
Source§

impl<T> WithSubscriber for T

Source§

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
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more