bucketwarden-server 0.1.0

BucketWarden storage server runtime.
Documentation
use super::*;
use bucketwarden_errors::{error_response_is_retryable, s3_service_specific_error_catalog};

impl BucketWarden {
    pub fn s3_service_specific_error_response(
        &mut self,
        feature_id: &str,
    ) -> Option<S3HttpResponse> {
        let error = s3_service_specific_error_catalog()
            .iter()
            .find(|error| error.feature_id == feature_id)?;
        let request_id = self.next_request_id();
        let extended_request_id = extended_request_id(&request_id);
        let response = enrich_error_response_body(
            error_response_code(error.status, error.code, error.message)
                .with_header("x-bucketwarden-error-family", error.family)
                .with_header(
                    "x-bucketwarden-error-retryable",
                    error_response_is_retryable(error.status).to_string(),
                ),
            &request_id,
            &extended_request_id,
        );
        Some(finalize_s3_response(
            response,
            &request_id,
            &extended_request_id,
        ))
    }
}