rws_server/storage/mod.rs
1//! The part of `storage` the server layer needs: [`StorageError`] and the
2//! AWS (SigV4, credential chain) and Azure (Managed Identity) credential
3//! helpers `secrets` shares with the S3 and Azure Blob backends, which are
4//! rust-web-server's `storage`.
5
6// Also compiled under `secrets` (not just `storage-s3`) — `secrets::aws_secrets_manager`
7// reuses this exact SigV4 signer and IRSA/ECS/IMDSv2 credential chain rather than
8// duplicating AWS's auth story a second time.
9#[cfg(any(feature = "storage-s3", feature = "secrets"))]
10#[doc(hidden)]
11pub mod aws_credentials;
12#[cfg(any(feature = "storage-s3", feature = "secrets"))]
13#[doc(hidden)]
14pub mod aws_sigv4;
15// Also compiled under `secrets` — `secrets::azure_key_vault` reuses the Managed
16// Identity token fetch (parameterized by `resource`) rather than duplicating it.
17#[cfg(any(feature = "storage-azure", feature = "secrets"))]
18#[doc(hidden)]
19pub mod azure_credentials;
20
21// ── StorageError ─────────────────────────────────────────────────────────────
22
23/// Error returned by all `Storage` operations.
24#[derive(Debug)]
25pub struct StorageError(pub String);
26
27impl StorageError {
28 pub fn new(msg: impl Into<String>) -> Self {
29 StorageError(msg.into())
30 }
31}
32
33impl std::fmt::Display for StorageError {
34 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
35 f.write_str(&self.0)
36 }
37}
38
39impl std::error::Error for StorageError {}