pub enum CloudStorageConfig {
S3 {
bucket: String,
region: Option<String>,
endpoint: Option<String>,
access_key_id: Option<String>,
secret_access_key: Option<String>,
session_token: Option<String>,
virtual_hosted_style: bool,
},
Gcs {
bucket: String,
service_account_path: Option<String>,
service_account_key: Option<String>,
},
Azure {
container: String,
account: String,
access_key: Option<String>,
sas_token: Option<String>,
},
}Expand description
Cloud storage backend configuration.
Supports Amazon S3, Google Cloud Storage, and Azure Blob Storage. Each variant contains the credentials and connection parameters for its respective cloud provider.
§Examples
ⓘ
// Create S3 configuration from environment variables
let config = CloudStorageConfig::s3_from_env("my-bucket");
// Create explicit S3 configuration for LocalStack testing
let config = CloudStorageConfig::S3 {
bucket: "test-bucket".to_string(),
region: Some("us-east-1".to_string()),
endpoint: Some("http://localhost:4566".to_string()),
access_key_id: Some("test".to_string()),
secret_access_key: Some("test".to_string()),
session_token: None,
virtual_hosted_style: false,
};Variants§
S3
Amazon S3 storage configuration.
Fields
Gcs
Google Cloud Storage configuration.
Fields
Azure
Azure Blob Storage configuration.
Implementations§
Source§impl CloudStorageConfig
impl CloudStorageConfig
Sourcepub fn s3_from_env(bucket: &str) -> Self
pub fn s3_from_env(bucket: &str) -> Self
Creates an S3 configuration using environment variables.
Reads credentials from standard AWS environment variables:
AWS_ACCESS_KEY_IDAWS_SECRET_ACCESS_KEYAWS_SESSION_TOKEN(optional)AWS_REGIONorAWS_DEFAULT_REGIONAWS_ENDPOINT_URL(optional, for S3-compatible services)
Sourcepub fn gcs_from_env(bucket: &str) -> Self
pub fn gcs_from_env(bucket: &str) -> Self
Creates a GCS configuration using environment variables.
Reads service account path from GOOGLE_APPLICATION_CREDENTIALS.
Sourcepub fn azure_from_env(container: &str) -> Self
pub fn azure_from_env(container: &str) -> Self
Creates an Azure configuration using environment variables.
Reads credentials from Azure environment variables:
AZURE_STORAGE_ACCOUNTAZURE_STORAGE_ACCESS_KEY(optional)AZURE_STORAGE_SAS_TOKEN(optional)
§Panics
Panics if AZURE_STORAGE_ACCOUNT is not set.
Sourcepub fn bucket_name(&self) -> &str
pub fn bucket_name(&self) -> &str
Returns the bucket/container name for this configuration.
Trait Implementations§
Source§impl Clone for CloudStorageConfig
impl Clone for CloudStorageConfig
Source§fn clone(&self) -> CloudStorageConfig
fn clone(&self) -> CloudStorageConfig
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl Freeze for CloudStorageConfig
impl RefUnwindSafe for CloudStorageConfig
impl Send for CloudStorageConfig
impl Sync for CloudStorageConfig
impl Unpin for CloudStorageConfig
impl UnsafeUnpin for CloudStorageConfig
impl UnwindSafe for CloudStorageConfig
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more