Commit 42a00af3 authored by Nugine's avatar Nugine
Browse files

feat(codegen/error): add `ReplicationConfigurationNotFoundError`

parent 09fae30c
Loading
Loading
Loading
Loading
+20 −0
Original line number Diff line number Diff line
@@ -117,9 +117,29 @@ fn collect_errors(model: &smithy::Model) -> Errors {
        err.status.push(status);
    }

    patch_extra_errors(&mut errors);

    errors
}

// https://github.com/Nugine/s3s/issues/224
fn patch_extra_errors(errors: &mut Errors) {
    // https://docs.aws.amazon.com/AmazonS3/latest/API/ErrorResponses.html#ReplicationErrorCodeList
    {
        let code = "ReplicationConfigurationNotFoundError";
        let desc = "There is no replication configuration for this bucket.";
        let status = "404 Not Found";
        errors.insert(
            code.to_owned(),
            Error {
                code: code.to_owned(),
                description: vec![Some(desc.to_owned())],
                status: vec![Some(status.to_owned())],
            },
        );
    }
}

#[allow(clippy::too_many_lines)]
pub fn codegen(model: &smithy::Model) {
    let errors = collect_errors(model);
+25 −15
Original line number Diff line number Diff line
//! Auto generated by `codegen/src/v1/error.rs:127`
//! Auto generated by `codegen/src/v1/error.rs:147`

#![allow(clippy::doc_markdown)]

@@ -407,6 +407,12 @@ pub enum S3ErrorCode {
    ///
    Redirect,

    /// There is no replication configuration for this bucket.
    ///
    /// HTTP Status Code: 404 Not Found
    ///
    ReplicationConfigurationNotFoundError,

    /// Bucket POST must be of the enclosure-type multipart/form-data.
    ///
    /// HTTP Status Code: 400 Bad Request
@@ -562,6 +568,7 @@ impl S3ErrorCode {
        "PermanentRedirect",
        "PreconditionFailed",
        "Redirect",
        "ReplicationConfigurationNotFoundError",
        "RequestIsNotMultiPartContent",
        "RequestTimeTooSkewed",
        "RequestTimeout",
@@ -647,20 +654,21 @@ impl S3ErrorCode {
            Self::PermanentRedirect => 63,
            Self::PreconditionFailed => 64,
            Self::Redirect => 65,
            Self::RequestIsNotMultiPartContent => 66,
            Self::RequestTimeTooSkewed => 67,
            Self::RequestTimeout => 68,
            Self::RequestTorrentOfBucketError => 69,
            Self::RestoreAlreadyInProgress => 70,
            Self::ServiceUnavailable => 71,
            Self::SignatureDoesNotMatch => 72,
            Self::SlowDown => 73,
            Self::TemporaryRedirect => 74,
            Self::TokenRefreshRequired => 75,
            Self::TooManyBuckets => 76,
            Self::UnexpectedContent => 77,
            Self::UnresolvableGrantByEmailAddress => 78,
            Self::UserKeyMustBeSpecified => 79,
            Self::ReplicationConfigurationNotFoundError => 66,
            Self::RequestIsNotMultiPartContent => 67,
            Self::RequestTimeTooSkewed => 68,
            Self::RequestTimeout => 69,
            Self::RequestTorrentOfBucketError => 70,
            Self::RestoreAlreadyInProgress => 71,
            Self::ServiceUnavailable => 72,
            Self::SignatureDoesNotMatch => 73,
            Self::SlowDown => 74,
            Self::TemporaryRedirect => 75,
            Self::TokenRefreshRequired => 76,
            Self::TooManyBuckets => 77,
            Self::UnexpectedContent => 78,
            Self::UnresolvableGrantByEmailAddress => 79,
            Self::UserKeyMustBeSpecified => 80,
            Self::Custom(_) => usize::MAX,
        }
    }
@@ -738,6 +746,7 @@ impl S3ErrorCode {
            b"PermanentRedirect" => Some(Self::PermanentRedirect),
            b"PreconditionFailed" => Some(Self::PreconditionFailed),
            b"Redirect" => Some(Self::Redirect),
            b"ReplicationConfigurationNotFoundError" => Some(Self::ReplicationConfigurationNotFoundError),
            b"RequestIsNotMultiPartContent" => Some(Self::RequestIsNotMultiPartContent),
            b"RequestTimeTooSkewed" => Some(Self::RequestTimeTooSkewed),
            b"RequestTimeout" => Some(Self::RequestTimeout),
@@ -826,6 +835,7 @@ impl S3ErrorCode {
            Self::PermanentRedirect => Some(StatusCode::MOVED_PERMANENTLY),
            Self::PreconditionFailed => Some(StatusCode::PRECONDITION_FAILED),
            Self::Redirect => Some(StatusCode::TEMPORARY_REDIRECT),
            Self::ReplicationConfigurationNotFoundError => Some(StatusCode::NOT_FOUND),
            Self::RequestIsNotMultiPartContent => Some(StatusCode::BAD_REQUEST),
            Self::RequestTimeTooSkewed => Some(StatusCode::FORBIDDEN),
            Self::RequestTimeout => Some(StatusCode::BAD_REQUEST),