pub struct S3Client { /* private fields */ }Expand description
An async S3-compatible client.
Implementations§
Source§impl S3Client
impl S3Client
Sourcepub async fn download_to_path(
&self,
request: GetObjectRequest,
destination: impl AsRef<Path>,
) -> Result<DownloadToPathOutput, S3Error>
pub async fn download_to_path( &self, request: GetObjectRequest, destination: impl AsRef<Path>, ) -> Result<DownloadToPathOutput, S3Error>
Downloads an object into a private temporary file and atomically persists
it at destination only after the response body is fully verified.
The temporary file is created in the destination directory, so the final rename cannot cross filesystems. An existing destination is atomically replaced where the platform supports replacement renames. Failed, cancelled, truncated, or checksum-invalid downloads leave the previous destination untouched and remove the temporary file on drop.
§Errors
Returns an error when the object request, destination I/O, integrity verification, or atomic persist operation fails.
Source§impl S3Client
impl S3Client
Sourcepub async fn upload_part_copy(
&self,
request: UploadPartCopyRequest,
) -> Result<UploadPartCopyOutput, S3Error>
pub async fn upload_part_copy( &self, request: UploadPartCopyRequest, ) -> Result<UploadPartCopyOutput, S3Error>
Uploads one multipart part by copying an existing S3 object or range.
§Errors
Returns an error for invalid headers, transport or service failures, malformed bounded XML, embedded S3 errors, or a missing part ETag.
Source§impl S3Client
impl S3Client
Sourcepub async fn list_parts(
&self,
request: ListPartsRequest,
) -> Result<ListPartsOutput, S3Error>
pub async fn list_parts( &self, request: ListPartsRequest, ) -> Result<ListPartsOutput, S3Error>
Lists one bounded page of parts belonging to an in-progress upload.
§Errors
Returns an error when signing, transport, or bounded XML parsing fails.
Sourcepub async fn list_parts_all(
&self,
request: ListPartsRequest,
maximum_pages: usize,
) -> Result<Vec<ListPartsOutput>, S3Error>
pub async fn list_parts_all( &self, request: ListPartsRequest, maximum_pages: usize, ) -> Result<Vec<ListPartsOutput>, S3Error>
Retrieves at most maximum_pages of parts under one operation deadline.
Missing, non-advancing, or repeated markers are rejected rather than risking an unbounded pagination loop.
§Errors
Returns an error for a zero page bound, invalid pagination, exhaustion of the page bound, or any page request failure.
Sourcepub async fn list_multipart_uploads_all(
&self,
request: ListMultipartUploadsRequest,
maximum_pages: usize,
) -> Result<Vec<ListMultipartUploadsOutput>, S3Error>
pub async fn list_multipart_uploads_all( &self, request: ListMultipartUploadsRequest, maximum_pages: usize, ) -> Result<Vec<ListMultipartUploadsOutput>, S3Error>
Retrieves at most maximum_pages of in-progress uploads under one deadline.
§Errors
Returns an error for a zero page bound, invalid pagination, exhaustion of the page bound, or any page request failure.
Source§impl S3Client
impl S3Client
Sourcepub async fn create_multipart_upload(
&self,
request: CreateMultipartUploadRequest,
) -> Result<CreateMultipartUploadOutput, S3Error>
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.
Sourcepub async fn upload_part(
&self,
request: UploadPartRequest,
) -> Result<UploadPartOutput, S3Error>
pub async fn upload_part( &self, request: UploadPartRequest, ) -> 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.
Sourcepub async fn complete_multipart_upload(
&self,
request: CompleteMultipartUploadRequest,
) -> Result<CompleteMultipartUploadOutput, S3Error>
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.
Sourcepub async fn abort_multipart_upload(
&self,
request: AbortMultipartUploadRequest,
) -> Result<RequestIds, S3Error>
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.
Sourcepub async fn list_multipart_uploads(
&self,
request: ListMultipartUploadsRequest,
) -> Result<ListMultipartUploadsOutput, S3Error>
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
impl S3Client
Sourcepub async fn multipart_upload(
&self,
request: ManagedMultipartUploadRequest,
) -> Result<CompleteMultipartUploadOutput, S3Error>
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, total in-flight part bytes, and deadlines are
derived from the request’s crate::MultipartOptions. File input is
snapshotted before an upload is created. Dropping this future cancels
outstanding parts and leaves an owned cleanup task to quiesce transmitted
requests before aborting the upload. A normal failure waits for cleanup;
if cleanup cannot be confirmed,
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
impl S3Client
Sourcepub async fn list_objects_v2(
&self,
request: ListObjectsV2Request,
) -> Result<ListObjectsV2Output, S3Error>
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.
Sourcepub async fn list_objects_v2_all(
&self,
request: ListObjectsV2Request,
maximum_pages: usize,
) -> Result<Vec<ListObjectsV2Output>, S3Error>
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
impl S3Client
Sourcepub async fn put_object(
&self,
request: PutObjectRequest,
) -> Result<PutObjectOutput, S3Error>
pub async fn put_object( &self, request: PutObjectRequest, ) -> Result<PutObjectOutput, S3Error>
Uploads one object to the configured bucket.
§Errors
Returns an error when request preparation, signing, transport, or response parsing fails.
Sourcepub async fn get_object(
&self,
request: GetObjectRequest,
) -> Result<GetObjectOutput, S3Error>
pub async fn get_object( &self, request: GetObjectRequest, ) -> Result<GetObjectOutput, S3Error>
Downloads one object as a bounded, cancellation-safe response stream.
§Errors
Returns an error when request validation, signing, transport, or header parsing fails.
Sourcepub async fn head_object(
&self,
request: HeadObjectRequest,
) -> Result<HeadObjectOutput, S3Error>
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.
Sourcepub async fn delete_object(
&self,
request: DeleteObjectRequest,
) -> Result<DeleteObjectOutput, S3Error>
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.
Sourcepub async fn delete_objects(
&self,
request: DeleteObjectsRequest,
) -> Result<DeleteObjectsOutput, S3Error>
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.
Sourcepub async fn copy_object(
&self,
request: CopyObjectRequest,
) -> Result<CopyObjectOutput, S3Error>
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
impl S3Client
Sourcepub async fn presigned_get(
&self,
key: &ObjectKey,
expires: Duration,
) -> Result<PresignedUrl, S3Error>
pub async fn presigned_get( &self, key: &ObjectKey, expires: Duration, ) -> Result<PresignedUrl, S3Error>
Generates a presigned GET URL whose standard formatting is redacted.
Sourcepub async fn presigned_put(
&self,
key: &ObjectKey,
expires: Duration,
) -> Result<PresignedUrl, S3Error>
pub async fn presigned_put( &self, key: &ObjectKey, expires: Duration, ) -> Result<PresignedUrl, S3Error>
Generates a presigned PUT URL whose standard formatting is redacted.
Sourcepub async fn presigned_head(
&self,
key: &ObjectKey,
expires: Duration,
) -> Result<PresignedUrl, S3Error>
pub async fn presigned_head( &self, key: &ObjectKey, expires: Duration, ) -> Result<PresignedUrl, S3Error>
Generates a presigned HEAD URL whose standard formatting is redacted.
Sourcepub async fn presigned_delete(
&self,
key: &ObjectKey,
expires: Duration,
) -> Result<PresignedUrl, S3Error>
pub async fn presigned_delete( &self, key: &ObjectKey, expires: Duration, ) -> Result<PresignedUrl, S3Error>
Generates a presigned DELETE URL whose standard formatting is redacted.
Sourcepub async fn presigned_create_multipart_upload(
&self,
key: &ObjectKey,
expires: Duration,
) -> Result<PresignedUrl, S3Error>
pub async fn presigned_create_multipart_upload( &self, key: &ObjectKey, expires: Duration, ) -> Result<PresignedUrl, S3Error>
Generates a presigned request that initiates a multipart upload.
Sourcepub async fn presigned_upload_part(
&self,
key: &ObjectKey,
upload_id: &UploadId,
part_number: PartNumber,
expires: Duration,
) -> Result<PresignedUrl, S3Error>
pub async fn presigned_upload_part( &self, key: &ObjectKey, upload_id: &UploadId, part_number: PartNumber, expires: Duration, ) -> Result<PresignedUrl, S3Error>
Generates a presigned multipart part-upload URL.
Sourcepub async fn presigned_abort_multipart_upload(
&self,
key: &ObjectKey,
upload_id: &UploadId,
expires: Duration,
) -> Result<PresignedUrl, S3Error>
pub async fn presigned_abort_multipart_upload( &self, key: &ObjectKey, upload_id: &UploadId, expires: Duration, ) -> Result<PresignedUrl, S3Error>
Generates a presigned multipart abort URL.
Trait Implementations§
Auto Trait Implementations§
impl !RefUnwindSafe for S3Client
impl !UnwindSafe for S3Client
impl Freeze for S3Client
impl Send for S3Client
impl Sync for S3Client
impl Unpin for S3Client
impl UnsafeUnpin for S3Client
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
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 moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
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