/** * 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::ResourceGroups; namespace Aws { namespace ResourceGroups { namespace ResourceGroupsErrorMapper { static const int NOT_FOUND_HASH = HashingUtils::HashString("NotFoundException"); static const int FORBIDDEN_HASH = HashingUtils::HashString("ForbiddenException"); static const int UNAUTHORIZED_HASH = HashingUtils::HashString("UnauthorizedException"); static const int TOO_MANY_REQUESTS_HASH = HashingUtils::HashString("TooManyRequestsException"); static const int BAD_REQUEST_HASH = HashingUtils::HashString("BadRequestException"); static const int INTERNAL_SERVER_ERROR_HASH = HashingUtils::HashString("InternalServerErrorException"); static const int METHOD_NOT_ALLOWED_HASH = HashingUtils::HashString("MethodNotAllowedException"); AWSError GetErrorForName(const char* errorName) { int hashCode = HashingUtils::HashString(errorName); if (hashCode == NOT_FOUND_HASH) { return AWSError(static_cast(ResourceGroupsErrors::NOT_FOUND), false); } else if (hashCode == FORBIDDEN_HASH) { return AWSError(static_cast(ResourceGroupsErrors::FORBIDDEN), false); } else if (hashCode == UNAUTHORIZED_HASH) { return AWSError(static_cast(ResourceGroupsErrors::UNAUTHORIZED), false); } else if (hashCode == TOO_MANY_REQUESTS_HASH) { return AWSError(static_cast(ResourceGroupsErrors::TOO_MANY_REQUESTS), true); } else if (hashCode == BAD_REQUEST_HASH) { return AWSError(static_cast(ResourceGroupsErrors::BAD_REQUEST), false); } else if (hashCode == INTERNAL_SERVER_ERROR_HASH) { return AWSError(static_cast(ResourceGroupsErrors::INTERNAL_SERVER_ERROR), false); } else if (hashCode == METHOD_NOT_ALLOWED_HASH) { return AWSError(static_cast(ResourceGroupsErrors::METHOD_NOT_ALLOWED), false); } return AWSError(CoreErrors::UNKNOWN, false); } } // namespace ResourceGroupsErrorMapper } // namespace ResourceGroups } // namespace Aws