Build an object_store S3 client from config.
(config: &AuditArchiveConfig)
| 30 | |
| 31 | /// Build an object_store S3 client from config. |
| 32 | fn build_store(config: &AuditArchiveConfig) -> crate::Result<object_store::aws::AmazonS3> { |
| 33 | let mut builder = AmazonS3Builder::new() |
| 34 | .with_bucket_name(&config.bucket) |
| 35 | .with_region(&config.region); |
| 36 | |
| 37 | if let Some(ref endpoint) = config.endpoint { |
| 38 | builder = builder |
| 39 | .with_endpoint(endpoint) |
| 40 | .with_virtual_hosted_style_request(false); |
| 41 | } |
| 42 | |
| 43 | // Credentials from environment (AWS_ACCESS_KEY_ID / AWS_SECRET_ACCESS_KEY) |
| 44 | // or IAM role (EC2/ECS). |
| 45 | builder.build().map_err(|e| crate::Error::Storage { |
| 46 | engine: "audit_archive".into(), |
| 47 | detail: format!("failed to build S3 client: {e}"), |
| 48 | }) |
| 49 | } |
| 50 | |
| 51 | /// Archive all sealed audit WAL segments to S3. |
| 52 | /// |
no test coverage detected