/** * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. * SPDX-License-Identifier: Apache-2.0. */ #include #include #include using namespace Aws::Client; using namespace Aws::Utils; using namespace Aws::ACMPCA; namespace Aws { namespace ACMPCA { namespace ACMPCAErrorMapper { static const int REQUEST_ALREADY_PROCESSED_HASH = HashingUtils::HashString("RequestAlreadyProcessedException"); static const int PERMISSION_ALREADY_EXISTS_HASH = HashingUtils::HashString("PermissionAlreadyExistsException"); static const int REQUEST_IN_PROGRESS_HASH = HashingUtils::HashString("RequestInProgressException"); static const int LIMIT_EXCEEDED_HASH = HashingUtils::HashString("LimitExceededException"); static const int REQUEST_FAILED_HASH = HashingUtils::HashString("RequestFailedException"); static const int CONCURRENT_MODIFICATION_HASH = HashingUtils::HashString("ConcurrentModificationException"); static const int INVALID_TAG_HASH = HashingUtils::HashString("InvalidTagException"); static const int CERTIFICATE_MISMATCH_HASH = HashingUtils::HashString("CertificateMismatchException"); static const int INVALID_STATE_HASH = HashingUtils::HashString("InvalidStateException"); static const int LOCKOUT_PREVENTED_HASH = HashingUtils::HashString("LockoutPreventedException"); static const int INVALID_NEXT_TOKEN_HASH = HashingUtils::HashString("InvalidNextTokenException"); static const int INVALID_ARGS_HASH = HashingUtils::HashString("InvalidArgsException"); static const int MALFORMED_CERTIFICATE_HASH = HashingUtils::HashString("MalformedCertificateException"); static const int INVALID_ARN_HASH = HashingUtils::HashString("InvalidArnException"); static const int TOO_MANY_TAGS_HASH = HashingUtils::HashString("TooManyTagsException"); static const int MALFORMED_C_S_R_HASH = HashingUtils::HashString("MalformedCSRException"); static const int INVALID_POLICY_HASH = HashingUtils::HashString("InvalidPolicyException"); static const int INVALID_REQUEST_HASH = HashingUtils::HashString("InvalidRequestException"); AWSError GetErrorForName(const char* errorName) { int hashCode = HashingUtils::HashString(errorName); if (hashCode == REQUEST_ALREADY_PROCESSED_HASH) { return AWSError(static_cast(ACMPCAErrors::REQUEST_ALREADY_PROCESSED), false); } else if (hashCode == PERMISSION_ALREADY_EXISTS_HASH) { return AWSError(static_cast(ACMPCAErrors::PERMISSION_ALREADY_EXISTS), false); } else if (hashCode == REQUEST_IN_PROGRESS_HASH) { return AWSError(static_cast(ACMPCAErrors::REQUEST_IN_PROGRESS), false); } else if (hashCode == LIMIT_EXCEEDED_HASH) { return AWSError(static_cast(ACMPCAErrors::LIMIT_EXCEEDED), true); } else if (hashCode == REQUEST_FAILED_HASH) { return AWSError(static_cast(ACMPCAErrors::REQUEST_FAILED), false); } else if (hashCode == CONCURRENT_MODIFICATION_HASH) { return AWSError(static_cast(ACMPCAErrors::CONCURRENT_MODIFICATION), false); } else if (hashCode == INVALID_TAG_HASH) { return AWSError(static_cast(ACMPCAErrors::INVALID_TAG), false); } else if (hashCode == CERTIFICATE_MISMATCH_HASH) { return AWSError(static_cast(ACMPCAErrors::CERTIFICATE_MISMATCH), false); } else if (hashCode == INVALID_STATE_HASH) { return AWSError(static_cast(ACMPCAErrors::INVALID_STATE), false); } else if (hashCode == LOCKOUT_PREVENTED_HASH) { return AWSError(static_cast(ACMPCAErrors::LOCKOUT_PREVENTED), false); } else if (hashCode == INVALID_NEXT_TOKEN_HASH) { return AWSError(static_cast(ACMPCAErrors::INVALID_NEXT_TOKEN), false); } else if (hashCode == INVALID_ARGS_HASH) { return AWSError(static_cast(ACMPCAErrors::INVALID_ARGS), false); } else if (hashCode == MALFORMED_CERTIFICATE_HASH) { return AWSError(static_cast(ACMPCAErrors::MALFORMED_CERTIFICATE), false); } else if (hashCode == INVALID_ARN_HASH) { return AWSError(static_cast(ACMPCAErrors::INVALID_ARN), false); } else if (hashCode == TOO_MANY_TAGS_HASH) { return AWSError(static_cast(ACMPCAErrors::TOO_MANY_TAGS), false); } else if (hashCode == MALFORMED_C_S_R_HASH) { return AWSError(static_cast(ACMPCAErrors::MALFORMED_C_S_R), false); } else if (hashCode == INVALID_POLICY_HASH) { return AWSError(static_cast(ACMPCAErrors::INVALID_POLICY), false); } else if (hashCode == INVALID_REQUEST_HASH) { return AWSError(static_cast(ACMPCAErrors::INVALID_REQUEST), false); } return AWSError(CoreErrors::UNKNOWN, false); } } // namespace ACMPCAErrorMapper } // namespace ACMPCA } // namespace Aws