Skip to main content

S3Client

Struct S3Client 

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

An async S3-compatible client.

Implementations§

Source§

impl S3Client

Source

pub async fn create_multipart_upload( &self, request: CreateMultipartUploadRequest, ) -> Result<CreateMultipartUploadOutput, S3Error>

Initiates a multipart upload for an object.

§Errors

Returns an error for invalid headers, transport or service failures, or a malformed or oversized service response.

Source

pub async fn upload_part( &self, request: UploadPartRequest<ByteStream>, ) -> Result<UploadPartOutput, S3Error>

Uploads one part of an in-progress multipart upload.

§Errors

Returns an error for an invalid checksum, body preparation failure, transport or service failure, or malformed response headers.

Source

pub async fn complete_multipart_upload( &self, request: CompleteMultipartUploadRequest, ) -> Result<CompleteMultipartUploadOutput, S3Error>

Completes an in-progress multipart upload.

§Errors

Returns an error when the completion document cannot be serialized, the request fails, or S3 returns a malformed, oversized, or embedded error.

Source

pub async fn abort_multipart_upload( &self, request: AbortMultipartUploadRequest, ) -> Result<RequestIds, S3Error>

Aborts an in-progress multipart upload.

§Errors

Returns an error when target construction, signing, transport, or the S3 service rejects the abort request.

Source

pub async fn list_multipart_uploads( &self, request: ListMultipartUploadsRequest, ) -> Result<ListMultipartUploadsOutput, S3Error>

Retrieves one bounded page of in-progress multipart uploads.

§Errors

Returns an error for inconsistent pagination markers, a failed request, or a malformed or oversized listing response.

Source§

impl S3Client

Source

pub async fn multipart_upload( &self, request: ManagedMultipartUploadRequest, ) -> Result<CompleteMultipartUploadOutput, S3Error>

Uploads a replayable bytes or file source using bounded multipart requests.

Part size, concurrency, and total in-flight part bytes are taken from the client configuration. File input is snapshotted before an upload is created. Dropping this future cancels outstanding parts and leaves an owned cleanup task to abort the upload. A normal failure waits for abort; if abort also fails, S3Error::cleanup_failure exposes that error while preserving the original failure.

§Errors

Returns an error if the source cannot be prepared, exceeds S3’s 10,000 part limit, a part fails, cancellation occurs, completion fails, or abort cleanup fails after another error.

Source§

impl S3Client

Source

pub async fn list_objects_v2( &self, request: ListObjectsV2Request, ) -> Result<ListObjectsV2Output, S3Error>

Retrieves one page from S3’s version-two object listing API.

§Errors

Returns an error when signing, transport, or response parsing fails.

Source

pub async fn list_objects_v2_all( &self, request: ListObjectsV2Request, maximum_pages: usize, ) -> Result<Vec<ListObjectsV2Output>, S3Error>

Retrieves at most maximum_pages, rejecting missing or repeating page tokens.

§Errors

Returns an error for a zero page bound, a malformed pagination sequence, an exhausted page bound, or any page request failure.

Source§

impl S3Client

Source

pub async fn put_object( &self, request: PutObjectRequest<ByteStream>, ) -> Result<PutObjectOutput, S3Error>

Uploads one object to the configured bucket.

§Errors

Returns an error when request preparation, signing, transport, or response parsing fails.

Source

pub async fn get_object( &self, request: GetObjectRequest, ) -> Result<GetObjectOutput<ResponseStream>, S3Error>

Downloads one object as a bounded, cancellation-safe response stream.

§Errors

Returns an error when request validation, signing, transport, or header parsing fails.

Source

pub async fn head_object( &self, request: HeadObjectRequest, ) -> Result<HeadObjectOutput, S3Error>

Retrieves one object’s metadata without downloading its body.

§Errors

Returns an error when signing, transport, or response parsing fails.

Source

pub async fn delete_object( &self, request: DeleteObjectRequest, ) -> Result<DeleteObjectOutput, S3Error>

Deletes one object or object version.

§Errors

Returns an error when signing, transport, or response parsing fails.

Source

pub async fn delete_objects( &self, request: DeleteObjectsRequest, ) -> Result<DeleteObjectsOutput, S3Error>

Deletes a validated batch of objects in one request.

§Errors

Returns an error when XML serialization, signing, transport, or response parsing fails.

Source

pub async fn copy_object( &self, request: CopyObjectRequest, ) -> Result<CopyObjectOutput, S3Error>

Copies an object entirely within S3.

§Errors

Returns an error when request validation, signing, transport, or response parsing fails.

Source§

impl S3Client

Source

pub async fn presigned_get( &self, key: &ObjectKey, expires: Duration, ) -> Result<PresignedUrl, S3Error>

Generates a presigned GET URL whose standard formatting is redacted.

Source

pub async fn presigned_put( &self, key: &ObjectKey, expires: Duration, ) -> Result<PresignedUrl, S3Error>

Generates a presigned PUT URL whose standard formatting is redacted.

Source§

impl S3Client

Source

pub fn new(config: S3Config) -> Result<Self, S3Error>

Constructs a client from validated configuration.

Source

pub fn config(&self) -> &S3Config

Returns this client’s validated configuration.

Trait Implementations§

Source§

impl Clone for S3Client

Source§

fn clone(&self) -> S3Client

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

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

Performs copy-assignment from source. Read more
Source§

impl Debug for S3Client

Source§

fn fmt(&self, formatter: &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> 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> Same for T

Source§

type Output = T

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