cortexa-aws-errors 0.1.0

Compact, redacted AWS SDK error contracts and retryability types for cortexa-rust-aws.
Documentation
# `cortexa-rust-aws`

[![Crates.io](https://img.shields.io/crates/v/cortexa-rust-aws.svg)](https://crates.io/crates/cortexa-rust-aws)
[![Docs.rs](https://docs.rs/cortexa-rust-aws/badge.svg)](https://docs.rs/cortexa-rust-aws)
[![MSRV](https://img.shields.io/badge/MSRV-1.91-blue.svg)](https://www.rust-lang.org)
[![License](https://img.shields.io/crates/l/cortexa-rust-aws.svg)](https://gitlab.com/cortexa/rust-crates/cortexa-rust-aws/-/blob/main/LICENSE-MIT)

**Languages:** English | [Français](https://gitlab.com/cortexa/rust-crates/cortexa-rust-aws/-/blob/main/docs/i18n/README.fr.md) | [Deutsch](https://gitlab.com/cortexa/rust-crates/cortexa-rust-aws/-/blob/main/docs/i18n/README.de.md) | [Español](https://gitlab.com/cortexa/rust-crates/cortexa-rust-aws/-/blob/main/docs/i18n/README.es.md) | [Italiano](https://gitlab.com/cortexa/rust-crates/cortexa-rust-aws/-/blob/main/docs/i18n/README.it.md) | [简体中文](https://gitlab.com/cortexa/rust-crates/cortexa-rust-aws/-/blob/main/docs/i18n/README.zh-CN.md) | [हिन्दी](https://gitlab.com/cortexa/rust-crates/cortexa-rust-aws/-/blob/main/docs/i18n/README.hi.md)

A **resource-oriented**, high-performance AWS SDK for Rust built **100% from scratch** on top of official AWS Smithy 2.0 specifications — with **zero runtime dependency on `aws-sdk-*` or `smithy`**.

- **Edition 2024**, MSRV **1.91**, `#![forbid(unsafe_code)]`, `missing_docs = "deny"`, `missing_debug_implementations = "deny"`.
- **2.55× faster client initialization**, **2.23× lower OS Peak RSS**, **9.19× lower peak live heap**, and **2.1×–3.2× lower p50 latency** compared to `aws-sdk-rust` in isolated CI benchmarks.

---

## Key Features

- **Unified Resource & Typestate Model (`prelude`, `AwsClientExt`)**:
  - Fluent resource builders (`client.s3().bucket(...)`, `client.dynamodb().table(...)`, `client.ec2().instance(...)`, `client.sns().topic(...)`, etc.) alongside full Smithy 2.0 generated operation clients (`client.<service>_ops()`).
- **Zero-Allocation Hot Paths (`cortexa-aws-core` & `cortexa-aws-protocols`)**:
  - Lock-free `OnceLock<Url>` endpoint resolution cache across all **446 AWS services** (`O(log N)` binary search, zero `RwLock` or `Url::clone()` on hot paths).
  - Stack-allocated relative path normalization (`[u8; 256]`) in `REST-XML` / `REST-JSON` codecs.
  - Static `HeaderName::from_static` fast paths in the `reqwest` transport.
- **Security by Default**:
  - **SSRF / IMDS Guard** (`block_metadata_ips = true` by default): blocks cloud metadata endpoints (`169.254.169.254`, `169.254.170.2`, `100.100.100.200`, `fd00:ec2::254`, `metadata.google.internal`, link-local IPv4) while allowing `127.0.0.1` / `localhost` for local emulators.
  - **Hardened TLS 1.3 profile** (`HttpTransportConfig::hardened_tls13()`).
  - Pure-Rust **SigV4** signing with `SigningKey` caching, end-to-end `x-amz-checksum-sha256`, `SecretString` zeroized on `Drop`, and SSE-C sensitive header redaction.
- **Centralized Resilience**:
  - Exponential backoff + Full Jitter + `Retry-After`, automatic clock-skew correction (`AtomicI64`), automatic `ExpiredToken` refresh, bounded streaming pagination (`collect_bounded()`), windowed `BatchExecutor`, and non-blocking `WaitCondition` / `BackgroundWaiter`.

---

## Quick Start

Add `cortexa-rust-aws` to your `Cargo.toml`:

```toml
[dependencies]
cortexa-rust-aws = { version = "0.1", features = ["s3", "dynamodb", "sts"] }
tokio = { version = "1", features = ["rt-multi-thread", "macros"] }
```

```rust,no_run
use cortexa_rust_aws::prelude::*;

#[tokio::main]
async fn main() -> Result<(), AwsError> {
    let config = AwsConfig::builder(Region::try_new("eu-west-3")?)
        .with_auth(auth_auto())
        .build();
    let client = AwsClient::try_new(config)?;

    let identity = get_caller_identity(&client).await?;
    println!("Authenticated AWS Account: {}", identity.account);

    let mut bucket = client
        .s3()
        .bucket("my-cortexa-bucket")?
        .with_location_constraint("eu-west-3");
    bucket.create().await?;
    bucket.wait_until_exists(WaiterConfig::default()).wait().await?;
    bucket.delete().await?;

    Ok(())
}
```

---

## Crate Features & `crates.io` Wave 1 Services

- `default = ["s3", "dynamodb", "ec2"]`
- **Wave 1 published services (20 core AWS services)**:
  `acm`, `cloudformation`, `cloudwatch`, `dynamodb`, `ec2`, `ecr`, `ecs`, `eventbridge`, `iam`, `kms`, `lambda`, `logs`, `route53`, `s3`, `secretsmanager`, `sfn`, `sns`, `sqs`, `ssm`, `sts`
- **Workspace / GitLab**: all **446 AWS services** are available via individual feature flags or `batch-01` .. `batch-15` / `all-services`.
- **Optional runtime features**: `tracing`, `hickory-dns`, `test-utils`.

---

## Documentation & Contributing

- API Documentation: [docs.rs/cortexa-rust-aws](https://docs.rs/cortexa-rust-aws)
- Naming & API References: [naming-conventions.md](https://gitlab.com/cortexa/rust-crates/cortexa-rust-aws/-/blob/main/docs/naming-conventions.md) · [aws-api-references.md](https://gitlab.com/cortexa/rust-crates/cortexa-rust-aws/-/blob/main/docs/aws-api-references.md)
- Contributing: [CONTRIBUTING.md](https://gitlab.com/cortexa/rust-crates/cortexa-rust-aws/-/blob/main/CONTRIBUTING.md)

## License

Dual-licensed under either of:
- [MIT License](https://gitlab.com/cortexa/rust-crates/cortexa-rust-aws/-/blob/main/LICENSE-MIT)
- [Apache License, Version 2.0](https://gitlab.com/cortexa/rust-crates/cortexa-rust-aws/-/blob/main/LICENSE-APACHE)

at your option.