Expand description
Async, streaming S3-compatible client with explicit resource bounds.
s3-wire provides typed object operations, SigV4 signing, replay-aware
retries, streaming downloads, and primitive or managed multipart uploads.
A client is configured for one endpoint, region, and bucket.
§Quick start
The default credential provider reads AWS_ACCESS_KEY_ID,
AWS_SECRET_ACCESS_KEY, and optional AWS_SESSION_TOKEN.
use s3_wire::{
ByteStream, Endpoint, GetObjectRequest, ObjectKey, PutObjectRequest, S3Client, S3Config,
};
let region = "us-east-1";
let config = S3Config::builder()
.endpoint(Endpoint::for_aws_region(region)?)
.region(region)
.bucket("artifact-bucket")
.build()?;
let client = S3Client::new(config)?;
let key = ObjectKey::new("reports/latest.json")?;
client
.put_object(PutObjectRequest::new(
key.clone(),
ByteStream::from_bytes(br#"{"status":"complete"}"#.as_slice()),
))
.await?;
let download = client.get_object(GetObjectRequest::new(key)).await?;
let mut destination = tokio::io::sink();
download.body.write_to(&mut destination).await?;§Upload and download behavior
ByteStream::from_bytesandByteStream::from_pathare replayable.ByteStream::from_streamis one-shot and requires an exact length and SHA-256 digest.ResponseStreamapplies backpressure and validates declared length, configured deadlines, and supported checksums while the body is consumed.S3Client::multipart_uploadbounds concurrent part buffers and owns abort cleanup after S3 creates an upload.
§Errors
S3Error exposes a stable ErrorCategory, service status and code,
request identifiers, retry classification, timeout phase, and any multipart
cleanup failure. Formatting remains redacted by default.
§More documentation
Structs§
- Abort
Multipart Upload Request - Request to abort an in-progress multipart upload.
- Byte
Stream - An upload body with explicit length, integrity, and replay semantics.
- Cached
Credentials Provider - Expiration-aware provider that coalesces concurrent refresh requests.
- Checksum
- Base64-encoded checksums returned by S3.
- Complete
Multipart Upload Output - Result of completing a multipart upload.
- Complete
Multipart Upload Request - Request to complete a multipart upload.
- Completed
Part - A validated completed-part descriptor.
- Conditions
- Conditional headers shared by object operations.
- Copy
Object Output - Result of a server-side copy.
- Copy
Object Request - Request to copy an object within S3.
- Copy
Source - Source of a server-side object copy.
- Create
Multipart Upload Output - Result of initiating a multipart upload.
- Create
Multipart Upload Request - Request to initiate a multipart upload.
- Credentials
- AWS-compatible credentials and optional expiration.
- Delete
Error - Per-object failure returned from a multi-object delete.
- Delete
Object Output - Result of deleting one object.
- Delete
Object Request - Request to delete one object.
- Delete
Objects Output - Result of a multi-object delete request.
- Delete
Objects Request - A validated multi-object delete request.
- Deleted
Object - One successfully deleted object.
- Endpoint
- A validated S3 service endpoint.
- Environment
Credentials Provider - Provider for the conventional AWS credential environment variables.
- GetObject
Output - A streaming object download and its response metadata.
- GetObject
Request - Request to download one object.
- Head
Object Request - Request to inspect object metadata without retrieving the body.
- List
Multipart Uploads Output - One page of in-progress multipart uploads.
- List
Multipart Uploads Request - Request for one page of in-progress multipart uploads.
- List
Objects V2Output - One parsed
ListObjectsV2page. - List
Objects V2Request - Request for one
ListObjectsV2page. - Listed
Object - One object returned by
ListObjectsV2. - Managed
Multipart Upload Request - Request for a bounded, automatically cleaned-up multipart upload.
- Multipart
Options - Validated resource and time bounds for one managed multipart upload.
- Multipart
Upload - Explicit state needed to resume or clean up an in-progress multipart upload.
- Multipart
Upload Entry - One in-progress multipart upload returned by the service.
- Object
Key - A validated UTF-8 S3 object key.
- Object
Metadata - Metadata common to object retrieval and inspection responses.
- Page
Size - Validated S3 listing page size in the range 1 through 1,000.
- Part
Number - A validated multipart part number in the range 1 through 10,000.
- Presigned
Url - A presigned URL whose standard formatting is always redacted.
- PutObject
Output - Result of uploading one object.
- PutObject
Request - Request to upload one object.
- Range
Error - Invalid inclusive byte range.
- Request
Ids - Identifiers supplied by an S3-compatible service for diagnostics.
- Response
Stream - A download stream that enforces idle timeout, content length, and any supported full-object checksum returned by S3.
- Retry
Policy - Bounded exponential-backoff policy with full jitter.
- S3Client
- An async S3-compatible client.
- S3Config
- Validated configuration used to construct an S3 client.
- S3Config
Builder - Builder for
S3Config. - S3Error
- A structured S3 client error.
- Static
Credentials Provider - Provider backed by an immutable credential value.
- Upload
Id - An opaque, validated multipart upload identifier issued by an S3 service.
- Upload
Part Output - Result of uploading one multipart part.
- Upload
Part Request - Request to upload one multipart part.
Enums§
- Addressing
Style - How a bucket name is represented in request URLs.
- Byte
Range - A byte range for a GET request.
- Checksum
Algorithm - Checksum algorithm understood by S3 checksum headers.
- Delete
Objects Error - Invalid multi-object delete batch.
- Error
Category - Broad category suitable for programmatic error handling.
- Multipart
Error - Invalid multipart state or descriptor.
- Object
KeyError - Validation failure for an
ObjectKey. - Retry
Classification - Whether an operation may be retried after an error.
- Timeout
Phase - The phase in which a timeout occurred.
- Upload
IdError - Why a service-issued multipart upload identifier was rejected.
Traits§
- Credentials
Provider - Asynchronous source of AWS-compatible credentials.
Type Aliases§
- Head
Object Output - Result of inspecting an object.