garage-sdk 0.1.1

Async Rust SDK for Garage S3-compatible storage with uploads and public URL generation
Documentation
//! # Garage SDK
//!
//! An async SDK for Garage (S3-compatible) that uploads files from paths, URLs,
//! or bytes and returns a stable public URL for CDN or proxy-fronted access.
//!
//! ## Features
//!
//! - Upload files from local paths, URLs, or raw bytes
//! - Automatic content-type detection
//! - Configurable key prefixes and file naming
//! - Proper error handling with detailed error types
//! - Builder pattern for flexible configuration
//!
//! ## Example
//!
//! ```rust,no_run
//! use garage_sdk::{GarageUploader, UploaderConfig};
//!
//! #[tokio::main]
//! async fn main() -> Result<(), garage_sdk::Error> {
//!     let config = UploaderConfig::builder()
//!         .endpoint("https://s3.example.com")
//!         .bucket("my-bucket")
//!         .public_base_url("https://cdn.example.com")
//!         .credentials("access_key", "secret_key")
//!         .build()?;
//!
//!     let uploader = GarageUploader::new(config)?;
//!
//!     let result = uploader.upload_from_path("./image.png").await?;
//!     println!("Uploaded to: {}", result.public_url);
//!
//!     Ok(())
//! }
//! ```
//!
//! ## Download Buffering vs Streaming
//!
//! `upload_from_url` buffers small downloads in memory and streams larger or
//! unknown-size responses to avoid unbounded memory usage.
//!
//! - Default buffer threshold: 8 MB (`max_buffered_bytes`)
//! - Hard size limit: 100 MB (`max_file_size`)
//!
//! If `Content-Length` is present and below the threshold, the response is
//! buffered. Otherwise, the response is streamed and the size cap is enforced
//! during the read.
//!
//! ## Configuration Sources
//!
//! - Environment variables: `UploaderConfig::from_env()`
//! - Secret files directory: `UploaderConfig::from_secret_dir(...)`
//! - Env with file fallback: `UploaderConfig::from_env_or_secret_dir(...)`
//!
//! For Kubernetes env injection, set:
//! `GARAGE_ENDPOINT`, `GARAGE_BUCKET`, `GARAGE_PUBLIC_URL`,
//! `AWS_ACCESS_KEY_ID`, and `AWS_SECRET_ACCESS_KEY`.

mod config;
mod download;
mod error;
mod keygen;
mod storage;
mod types;
mod uploader;

pub use aws_sdk_s3;
pub use config::{SecretFileNames, SecretFileNamesBuilder, UploaderConfig, UploaderConfigBuilder};
pub use download::{DownloadBody, DownloadResult, Downloader, ReqwestDownloader};
pub use error::{Error, Result};
pub use keygen::{KeyGenerator, UuidKeyGenerator};
pub use storage::{S3Storage, StorageClient, StorageInput, StorageResult};
pub use types::UploadResult;
pub use uploader::GarageUploader;