s3_pricing/lib.rs
1//! # S3 Pricing Library
2//!
3//! A Rust library to calculate AWS S3 operation pricing dynamically using the AWS Pricing API.
4//!
5//! ## Features
6//!
7//! - **Storage pricing**: Fetch storage costs per GB/month for any S3 storage class
8//! - **Request pricing**: Get Class A (PUT, COPY, POST, LIST) and Class B (GET, etc.) request prices
9//! - **Data transfer**: Calculate data transfer costs (to internet or cross-region)
10//! - **China regions**: Support for AWS China regions (cn-north-1, cn-northwest-1) with CNY pricing
11//!
12//! ## Usage
13//!
14//! ```ignore
15//! use s3_pricing::S3PricingClient;
16//!
17//! #[tokio::main]
18//! async fn main() -> anyhow::Result<()> {
19//! // For global AWS regions (USD pricing)
20//! let client = S3PricingClient::new(None).await?;
21//! let storage_price = client.get_storage_price("us-east-1", "STANDARD").await?;
22//! println!("Storage: ${} per GB-Mo", storage_price);
23//!
24//! // For AWS China regions (CNY pricing)
25//! let china_client = S3PricingClient::new_china(None).await?;
26//! let cn_storage = china_client.get_storage_price("cn-north-1", "STANDARD").await?;
27//! println!("Storage: ¥{} per GB-Mo", cn_storage);
28//!
29//! Ok(())
30//! }
31//! ```
32//!
33//! ## Supported Storage Classes
34//!
35//! - `STANDARD` - S3 Standard
36//! - `STANDARD_IA` - S3 Standard-Infrequent Access
37//! - `ONEZONE_IA` - S3 One Zone-Infrequent Access
38//! - `INTELLIGENT_TIERING` - S3 Intelligent-Tiering
39//! - `GLACIER` / `GLACIER_FLEXIBLE_RETRIEVAL` - Amazon Glacier
40//! - `DEEP_ARCHIVE` - Glacier Deep Archive
41//! - `GLACIER_IR` / `GLACIER_INSTANT_RETRIEVAL` - Glacier Instant Retrieval
42//! - `EXPRESS_ONEZONE` - S3 Express One Zone
43//! - `REDUCED_REDUNDANCY` - S3 Reduced Redundancy
44//!
45//! ## Supported Regions
46//!
47//! - **Global regions**: All standard AWS regions (us-east-1, eu-west-1, etc.) - pricing in USD
48//! - **China regions**: cn-north-1 (Beijing), cn-northwest-1 (Ningxia) - pricing in CNY
49//!
50//! ## Notes
51//!
52//! - The global Pricing API is available in `us-east-1` endpoint
53//! - The China Pricing API is available in `cn-northwest-1` endpoint (api.pricing.cn-northwest-1.amazonaws.com.cn)
54//! - Credentials are resolved from the environment, shared config, or SSO profile
55//! - Use `S3PricingClient::new()` for global regions, `S3PricingClient::new_china()` for China regions
56
57pub mod s3_pricing_client;