Commit 37b39eae authored by Nugine's avatar Nugine
Browse files

refactor(s3s): use cfg-if

parent a179d23b
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -2744,6 +2744,7 @@ dependencies = [
 "base64-simd",
 "bytes",
 "bytestring",
 "cfg-if",
 "chrono",
 "const-str",
 "crc32c",
+1 −0
Original line number Diff line number Diff line
@@ -68,6 +68,7 @@ crc64fast-nvme = "1.2.0"
const-str = "0.7.0"
http = "1.3.1"
subtle = "2.6.1"
cfg-if = "1.0.3"

[dev-dependencies]
axum = "0.8.6"
+757 −691
Original line number Diff line number Diff line
@@ -10,7 +10,6 @@ use crate::protocol::S3Request;

#[async_trait::async_trait]
pub trait S3Access: Send + Sync + 'static {

    /// Checks whether the current request has accesses to the resources.
    ///
    /// This method is called before deserializing the operation input.
@@ -59,7 +58,10 @@ Ok(())
    /// Checks whether the CreateBucketMetadataTableConfiguration request has accesses to the resources.
    ///
    /// This method returns `Ok(())` by default.
async fn create_bucket_metadata_table_configuration(&self, _req: &mut S3Request<CreateBucketMetadataTableConfigurationInput>) -> S3Result<()> {
    async fn create_bucket_metadata_table_configuration(
        &self,
        _req: &mut S3Request<CreateBucketMetadataTableConfigurationInput>,
    ) -> S3Result<()> {
        Ok(())
    }

@@ -80,7 +82,10 @@ Ok(())
    /// Checks whether the DeleteBucketAnalyticsConfiguration request has accesses to the resources.
    ///
    /// This method returns `Ok(())` by default.
async fn delete_bucket_analytics_configuration(&self, _req: &mut S3Request<DeleteBucketAnalyticsConfigurationInput>) -> S3Result<()> {
    async fn delete_bucket_analytics_configuration(
        &self,
        _req: &mut S3Request<DeleteBucketAnalyticsConfigurationInput>,
    ) -> S3Result<()> {
        Ok(())
    }

@@ -101,14 +106,20 @@ Ok(())
    /// Checks whether the DeleteBucketIntelligentTieringConfiguration request has accesses to the resources.
    ///
    /// This method returns `Ok(())` by default.
async fn delete_bucket_intelligent_tiering_configuration(&self, _req: &mut S3Request<DeleteBucketIntelligentTieringConfigurationInput>) -> S3Result<()> {
    async fn delete_bucket_intelligent_tiering_configuration(
        &self,
        _req: &mut S3Request<DeleteBucketIntelligentTieringConfigurationInput>,
    ) -> S3Result<()> {
        Ok(())
    }

    /// Checks whether the DeleteBucketInventoryConfiguration request has accesses to the resources.
    ///
    /// This method returns `Ok(())` by default.
async fn delete_bucket_inventory_configuration(&self, _req: &mut S3Request<DeleteBucketInventoryConfigurationInput>) -> S3Result<()> {
    async fn delete_bucket_inventory_configuration(
        &self,
        _req: &mut S3Request<DeleteBucketInventoryConfigurationInput>,
    ) -> S3Result<()> {
        Ok(())
    }

@@ -122,14 +133,20 @@ Ok(())
    /// Checks whether the DeleteBucketMetadataTableConfiguration request has accesses to the resources.
    ///
    /// This method returns `Ok(())` by default.
async fn delete_bucket_metadata_table_configuration(&self, _req: &mut S3Request<DeleteBucketMetadataTableConfigurationInput>) -> S3Result<()> {
    async fn delete_bucket_metadata_table_configuration(
        &self,
        _req: &mut S3Request<DeleteBucketMetadataTableConfigurationInput>,
    ) -> S3Result<()> {
        Ok(())
    }

    /// Checks whether the DeleteBucketMetricsConfiguration request has accesses to the resources.
    ///
    /// This method returns `Ok(())` by default.
async fn delete_bucket_metrics_configuration(&self, _req: &mut S3Request<DeleteBucketMetricsConfigurationInput>) -> S3Result<()> {
    async fn delete_bucket_metrics_configuration(
        &self,
        _req: &mut S3Request<DeleteBucketMetricsConfigurationInput>,
    ) -> S3Result<()> {
        Ok(())
    }

@@ -199,7 +216,10 @@ Ok(())
    /// Checks whether the GetBucketAccelerateConfiguration request has accesses to the resources.
    ///
    /// This method returns `Ok(())` by default.
async fn get_bucket_accelerate_configuration(&self, _req: &mut S3Request<GetBucketAccelerateConfigurationInput>) -> S3Result<()> {
    async fn get_bucket_accelerate_configuration(
        &self,
        _req: &mut S3Request<GetBucketAccelerateConfigurationInput>,
    ) -> S3Result<()> {
        Ok(())
    }

@@ -213,7 +233,10 @@ Ok(())
    /// Checks whether the GetBucketAnalyticsConfiguration request has accesses to the resources.
    ///
    /// This method returns `Ok(())` by default.
async fn get_bucket_analytics_configuration(&self, _req: &mut S3Request<GetBucketAnalyticsConfigurationInput>) -> S3Result<()> {
    async fn get_bucket_analytics_configuration(
        &self,
        _req: &mut S3Request<GetBucketAnalyticsConfigurationInput>,
    ) -> S3Result<()> {
        Ok(())
    }

@@ -234,21 +257,30 @@ Ok(())
    /// Checks whether the GetBucketIntelligentTieringConfiguration request has accesses to the resources.
    ///
    /// This method returns `Ok(())` by default.
async fn get_bucket_intelligent_tiering_configuration(&self, _req: &mut S3Request<GetBucketIntelligentTieringConfigurationInput>) -> S3Result<()> {
    async fn get_bucket_intelligent_tiering_configuration(
        &self,
        _req: &mut S3Request<GetBucketIntelligentTieringConfigurationInput>,
    ) -> S3Result<()> {
        Ok(())
    }

    /// Checks whether the GetBucketInventoryConfiguration request has accesses to the resources.
    ///
    /// This method returns `Ok(())` by default.
async fn get_bucket_inventory_configuration(&self, _req: &mut S3Request<GetBucketInventoryConfigurationInput>) -> S3Result<()> {
    async fn get_bucket_inventory_configuration(
        &self,
        _req: &mut S3Request<GetBucketInventoryConfigurationInput>,
    ) -> S3Result<()> {
        Ok(())
    }

    /// Checks whether the GetBucketLifecycleConfiguration request has accesses to the resources.
    ///
    /// This method returns `Ok(())` by default.
async fn get_bucket_lifecycle_configuration(&self, _req: &mut S3Request<GetBucketLifecycleConfigurationInput>) -> S3Result<()> {
    async fn get_bucket_lifecycle_configuration(
        &self,
        _req: &mut S3Request<GetBucketLifecycleConfigurationInput>,
    ) -> S3Result<()> {
        Ok(())
    }

@@ -269,7 +301,10 @@ Ok(())
    /// Checks whether the GetBucketMetadataTableConfiguration request has accesses to the resources.
    ///
    /// This method returns `Ok(())` by default.
async fn get_bucket_metadata_table_configuration(&self, _req: &mut S3Request<GetBucketMetadataTableConfigurationInput>) -> S3Result<()> {
    async fn get_bucket_metadata_table_configuration(
        &self,
        _req: &mut S3Request<GetBucketMetadataTableConfigurationInput>,
    ) -> S3Result<()> {
        Ok(())
    }

@@ -283,7 +318,10 @@ Ok(())
    /// Checks whether the GetBucketNotificationConfiguration request has accesses to the resources.
    ///
    /// This method returns `Ok(())` by default.
async fn get_bucket_notification_configuration(&self, _req: &mut S3Request<GetBucketNotificationConfigurationInput>) -> S3Result<()> {
    async fn get_bucket_notification_configuration(
        &self,
        _req: &mut S3Request<GetBucketNotificationConfigurationInput>,
    ) -> S3Result<()> {
        Ok(())
    }

@@ -423,28 +461,40 @@ Ok(())
    /// Checks whether the ListBucketAnalyticsConfigurations request has accesses to the resources.
    ///
    /// This method returns `Ok(())` by default.
async fn list_bucket_analytics_configurations(&self, _req: &mut S3Request<ListBucketAnalyticsConfigurationsInput>) -> S3Result<()> {
    async fn list_bucket_analytics_configurations(
        &self,
        _req: &mut S3Request<ListBucketAnalyticsConfigurationsInput>,
    ) -> S3Result<()> {
        Ok(())
    }

    /// Checks whether the ListBucketIntelligentTieringConfigurations request has accesses to the resources.
    ///
    /// This method returns `Ok(())` by default.
async fn list_bucket_intelligent_tiering_configurations(&self, _req: &mut S3Request<ListBucketIntelligentTieringConfigurationsInput>) -> S3Result<()> {
    async fn list_bucket_intelligent_tiering_configurations(
        &self,
        _req: &mut S3Request<ListBucketIntelligentTieringConfigurationsInput>,
    ) -> S3Result<()> {
        Ok(())
    }

    /// Checks whether the ListBucketInventoryConfigurations request has accesses to the resources.
    ///
    /// This method returns `Ok(())` by default.
async fn list_bucket_inventory_configurations(&self, _req: &mut S3Request<ListBucketInventoryConfigurationsInput>) -> S3Result<()> {
    async fn list_bucket_inventory_configurations(
        &self,
        _req: &mut S3Request<ListBucketInventoryConfigurationsInput>,
    ) -> S3Result<()> {
        Ok(())
    }

    /// Checks whether the ListBucketMetricsConfigurations request has accesses to the resources.
    ///
    /// This method returns `Ok(())` by default.
async fn list_bucket_metrics_configurations(&self, _req: &mut S3Request<ListBucketMetricsConfigurationsInput>) -> S3Result<()> {
    async fn list_bucket_metrics_configurations(
        &self,
        _req: &mut S3Request<ListBucketMetricsConfigurationsInput>,
    ) -> S3Result<()> {
        Ok(())
    }

@@ -493,7 +543,10 @@ Ok(())
    /// Checks whether the PutBucketAccelerateConfiguration request has accesses to the resources.
    ///
    /// This method returns `Ok(())` by default.
async fn put_bucket_accelerate_configuration(&self, _req: &mut S3Request<PutBucketAccelerateConfigurationInput>) -> S3Result<()> {
    async fn put_bucket_accelerate_configuration(
        &self,
        _req: &mut S3Request<PutBucketAccelerateConfigurationInput>,
    ) -> S3Result<()> {
        Ok(())
    }

@@ -507,7 +560,10 @@ Ok(())
    /// Checks whether the PutBucketAnalyticsConfiguration request has accesses to the resources.
    ///
    /// This method returns `Ok(())` by default.
async fn put_bucket_analytics_configuration(&self, _req: &mut S3Request<PutBucketAnalyticsConfigurationInput>) -> S3Result<()> {
    async fn put_bucket_analytics_configuration(
        &self,
        _req: &mut S3Request<PutBucketAnalyticsConfigurationInput>,
    ) -> S3Result<()> {
        Ok(())
    }

@@ -528,21 +584,30 @@ Ok(())
    /// Checks whether the PutBucketIntelligentTieringConfiguration request has accesses to the resources.
    ///
    /// This method returns `Ok(())` by default.
async fn put_bucket_intelligent_tiering_configuration(&self, _req: &mut S3Request<PutBucketIntelligentTieringConfigurationInput>) -> S3Result<()> {
    async fn put_bucket_intelligent_tiering_configuration(
        &self,
        _req: &mut S3Request<PutBucketIntelligentTieringConfigurationInput>,
    ) -> S3Result<()> {
        Ok(())
    }

    /// Checks whether the PutBucketInventoryConfiguration request has accesses to the resources.
    ///
    /// This method returns `Ok(())` by default.
async fn put_bucket_inventory_configuration(&self, _req: &mut S3Request<PutBucketInventoryConfigurationInput>) -> S3Result<()> {
    async fn put_bucket_inventory_configuration(
        &self,
        _req: &mut S3Request<PutBucketInventoryConfigurationInput>,
    ) -> S3Result<()> {
        Ok(())
    }

    /// Checks whether the PutBucketLifecycleConfiguration request has accesses to the resources.
    ///
    /// This method returns `Ok(())` by default.
async fn put_bucket_lifecycle_configuration(&self, _req: &mut S3Request<PutBucketLifecycleConfigurationInput>) -> S3Result<()> {
    async fn put_bucket_lifecycle_configuration(
        &self,
        _req: &mut S3Request<PutBucketLifecycleConfigurationInput>,
    ) -> S3Result<()> {
        Ok(())
    }

@@ -563,7 +628,10 @@ Ok(())
    /// Checks whether the PutBucketNotificationConfiguration request has accesses to the resources.
    ///
    /// This method returns `Ok(())` by default.
async fn put_bucket_notification_configuration(&self, _req: &mut S3Request<PutBucketNotificationConfigurationInput>) -> S3Result<()> {
    async fn put_bucket_notification_configuration(
        &self,
        _req: &mut S3Request<PutBucketNotificationConfigurationInput>,
    ) -> S3Result<()> {
        Ok(())
    }

@@ -699,6 +767,4 @@ Ok(())
    async fn write_get_object_response(&self, _req: &mut S3Request<WriteGetObjectResponseInput>) -> S3Result<()> {
        Ok(())
    }

}
+7 −7
Original line number Diff line number Diff line
#[cfg(feature = "minio")]
stdx::cfg_group! {
cfg_if::cfg_if! {
    if #[cfg(feature = "minio")] {
        mod generated_minio;
        use self::generated_minio as generated;
}

#[cfg(not(feature = "minio"))]
    } else {
        mod generated;
    }
}

pub use self::generated::S3Access;

+30234 −30926

File changed.

Preview size limit exceeded, changes collapsed.

Loading