use super::{S3ObjectStoreConfig, S3ObjectStoreError};
use crate::ObjectPrefix;
pub(crate) fn validate_s3_config(config: &S3ObjectStoreConfig) -> Result<(), S3ObjectStoreError> {
if config.bucket.trim().is_empty() {
return Err(S3ObjectStoreError::EmptyBucket);
}
if config.region.trim().is_empty() {
return Err(S3ObjectStoreError::EmptyRegion);
}
if let Some(ref prefix) = config.key_prefix {
ObjectPrefix::parse(prefix).map_err(S3ObjectStoreError::InvalidKeyPrefix)?;
}
Ok(())
}