Skip to main content

Crate s3_wire

Crate s3_wire 

Source
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

§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

Re-exports§

pub use client::S3Client;
pub use config::AddressingStyle;
pub use config::S3Config;
pub use config::S3ConfigBuilder;
pub use credentials::CachedCredentialsProvider;
pub use credentials::Credentials;
pub use credentials::CredentialsProvider;
pub use credentials::EnvironmentCredentialsProvider;
pub use credentials::StaticCredentialsProvider;
pub use endpoint::Endpoint;
pub use endpoint::EndpointUrl;
pub use error::ErrorCategory;
pub use error::RetryClassification;
pub use error::S3Error;
pub use error::TimeoutPhase;
pub use retry::RetryPolicy;
pub use stream::ByteStream;
pub use stream::ResponseStream;
pub use operation::*;

Modules§

client
S3 client implementation.
config
Typed client configuration.
credentials
Credential values and providers.
endpoint
Endpoint validation and exact request-target construction.
error
Structured client errors.
operation
Typed requests, responses, and values for S3 operations.
retry
Retry policy and classification.
stream
Replay-aware upload bodies and bounded download streams.