package de.jeha.s3srv.common.errors;

/**
 * @author jenshadlich@googlemail.com
 */
public enum ErrorCodes {

    BAD_DIGEST(
            "BadDigest",
            "The Content-MD5 you specified did not match what we received.",
            400
    ),
    BUCKET_ALREADY_EXISTS(
            "BucketAlreadyExists",
            "The requested bucket name is not available. The bucket namespace is shared by all users of the system. Please select a different name and try again.",
            409
    ),
    BUCKET_NOT_EMPTY(
            "BucketNotEmpty",
            "The bucket you tried to delete is not empty.",
            409
    ),
    INVALID_ACCESS_KEY_ID(
            "InvalidAccessKeyId",
            "The access key Id you provided does not exist in our records.",
            403
    ),
    INVALID_BUCKET_NAME(
            "InvalidBucketName",
            "The specified bucket is not valid.",
            400
    ),
    INTERNAL_ERROR(
            "InternalError",
            "We encountered an internal error. Please try again.",
            500
    ),
    SERVICE_UNAVAILABLE(
            "ServiceUnavailable",
            "Reduce your request rate.",
            503
    ),
    SIGNATURE_DOES_NOT_MATCH(
            "SignatureDoesNotMatch",
            "The request signature we calculated does not match the signature you provided. Check your secret access key and signing method.",
            403
    );

    private final String code;
    private final String description;
    private final int statusCode;

    ErrorCodes(String code, String description, int statusCode) {
        this.code = code;
        this.description = description;
        this.statusCode = statusCode;
    }

    public String getCode() {
        return code;
    }

    public String getDescription() {
        return description;
    }

    public int getStatusCode() {
        return statusCode;
    }

}

@@ -103,16 +103,115 @@
 odes %7B%0A%0A
+    ACCESS_DENIED(%0A            %22AccessDenied%22,%0A            %22Access Denied%22,%0A            403%0A    ),%0A
     BAD_
@@ -1154,24 +1154,147 @@
  500%0A    ),%0A
+    NO_SUCH_BUCKET(%0A            %22NoSuchBucket%22,%0A            %22The specified bucket does not exist.%22,%0A            404%0A    ),%0A
     SERVICE_

add error codes