/** * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. * SPDX-License-Identifier: Apache-2.0. */ #include #include #include #include #include #include #include #include #include using namespace Aws::Client; using namespace Aws::Utils; using namespace Aws::MQ; using namespace Aws::MQ::Model; namespace Aws { namespace MQ { template<> AWS_MQ_API ConflictException MQError::GetModeledError() { assert(this->GetErrorType() == MQErrors::CONFLICT); return ConflictException(this->GetJsonPayload().View()); } template<> AWS_MQ_API NotFoundException MQError::GetModeledError() { assert(this->GetErrorType() == MQErrors::NOT_FOUND); return NotFoundException(this->GetJsonPayload().View()); } template<> AWS_MQ_API UnauthorizedException MQError::GetModeledError() { assert(this->GetErrorType() == MQErrors::UNAUTHORIZED); return UnauthorizedException(this->GetJsonPayload().View()); } template<> AWS_MQ_API ForbiddenException MQError::GetModeledError() { assert(this->GetErrorType() == MQErrors::FORBIDDEN); return ForbiddenException(this->GetJsonPayload().View()); } template<> AWS_MQ_API BadRequestException MQError::GetModeledError() { assert(this->GetErrorType() == MQErrors::BAD_REQUEST); return BadRequestException(this->GetJsonPayload().View()); } template<> AWS_MQ_API InternalServerErrorException MQError::GetModeledError() { assert(this->GetErrorType() == MQErrors::INTERNAL_SERVER_ERROR); return InternalServerErrorException(this->GetJsonPayload().View()); } namespace MQErrorMapper { static const int CONFLICT_HASH = HashingUtils::HashString("ConflictException"); static const int NOT_FOUND_HASH = HashingUtils::HashString("NotFoundException"); static const int UNAUTHORIZED_HASH = HashingUtils::HashString("UnauthorizedException"); static const int FORBIDDEN_HASH = HashingUtils::HashString("ForbiddenException"); static const int BAD_REQUEST_HASH = HashingUtils::HashString("BadRequestException"); static const int INTERNAL_SERVER_ERROR_HASH = HashingUtils::HashString("InternalServerErrorException"); AWSError GetErrorForName(const char* errorName) { int hashCode = HashingUtils::HashString(errorName); if (hashCode == CONFLICT_HASH) { return AWSError(static_cast(MQErrors::CONFLICT), false); } else if (hashCode == NOT_FOUND_HASH) { return AWSError(static_cast(MQErrors::NOT_FOUND), false); } else if (hashCode == UNAUTHORIZED_HASH) { return AWSError(static_cast(MQErrors::UNAUTHORIZED), false); } else if (hashCode == FORBIDDEN_HASH) { return AWSError(static_cast(MQErrors::FORBIDDEN), false); } else if (hashCode == BAD_REQUEST_HASH) { return AWSError(static_cast(MQErrors::BAD_REQUEST), false); } else if (hashCode == INTERNAL_SERVER_ERROR_HASH) { return AWSError(static_cast(MQErrors::INTERNAL_SERVER_ERROR), false); } return AWSError(CoreErrors::UNKNOWN, false); } } // namespace MQErrorMapper } // namespace MQ } // namespace Aws