/** * 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 #include #include #include using namespace Aws::Client; using namespace Aws::Utils; using namespace Aws::ChimeSDKIdentity; using namespace Aws::ChimeSDKIdentity::Model; namespace Aws { namespace ChimeSDKIdentity { template<> AWS_CHIMESDKIDENTITY_API ConflictException ChimeSDKIdentityError::GetModeledError() { assert(this->GetErrorType() == ChimeSDKIdentityErrors::CONFLICT); return ConflictException(this->GetJsonPayload().View()); } template<> AWS_CHIMESDKIDENTITY_API ServiceUnavailableException ChimeSDKIdentityError::GetModeledError() { assert(this->GetErrorType() == ChimeSDKIdentityErrors::SERVICE_UNAVAILABLE); return ServiceUnavailableException(this->GetJsonPayload().View()); } template<> AWS_CHIMESDKIDENTITY_API NotFoundException ChimeSDKIdentityError::GetModeledError() { assert(this->GetErrorType() == ChimeSDKIdentityErrors::NOT_FOUND); return NotFoundException(this->GetJsonPayload().View()); } template<> AWS_CHIMESDKIDENTITY_API ServiceFailureException ChimeSDKIdentityError::GetModeledError() { assert(this->GetErrorType() == ChimeSDKIdentityErrors::SERVICE_FAILURE); return ServiceFailureException(this->GetJsonPayload().View()); } template<> AWS_CHIMESDKIDENTITY_API ForbiddenException ChimeSDKIdentityError::GetModeledError() { assert(this->GetErrorType() == ChimeSDKIdentityErrors::FORBIDDEN); return ForbiddenException(this->GetJsonPayload().View()); } template<> AWS_CHIMESDKIDENTITY_API ResourceLimitExceededException ChimeSDKIdentityError::GetModeledError() { assert(this->GetErrorType() == ChimeSDKIdentityErrors::RESOURCE_LIMIT_EXCEEDED); return ResourceLimitExceededException(this->GetJsonPayload().View()); } template<> AWS_CHIMESDKIDENTITY_API ThrottledClientException ChimeSDKIdentityError::GetModeledError() { assert(this->GetErrorType() == ChimeSDKIdentityErrors::THROTTLED_CLIENT); return ThrottledClientException(this->GetJsonPayload().View()); } template<> AWS_CHIMESDKIDENTITY_API BadRequestException ChimeSDKIdentityError::GetModeledError() { assert(this->GetErrorType() == ChimeSDKIdentityErrors::BAD_REQUEST); return BadRequestException(this->GetJsonPayload().View()); } template<> AWS_CHIMESDKIDENTITY_API UnauthorizedClientException ChimeSDKIdentityError::GetModeledError() { assert(this->GetErrorType() == ChimeSDKIdentityErrors::UNAUTHORIZED_CLIENT); return UnauthorizedClientException(this->GetJsonPayload().View()); } namespace ChimeSDKIdentityErrorMapper { static const int CONFLICT_HASH = HashingUtils::HashString("ConflictException"); static const int NOT_FOUND_HASH = HashingUtils::HashString("NotFoundException"); static const int SERVICE_FAILURE_HASH = HashingUtils::HashString("ServiceFailureException"); static const int FORBIDDEN_HASH = HashingUtils::HashString("ForbiddenException"); static const int RESOURCE_LIMIT_EXCEEDED_HASH = HashingUtils::HashString("ResourceLimitExceededException"); static const int THROTTLED_CLIENT_HASH = HashingUtils::HashString("ThrottledClientException"); static const int BAD_REQUEST_HASH = HashingUtils::HashString("BadRequestException"); static const int UNAUTHORIZED_CLIENT_HASH = HashingUtils::HashString("UnauthorizedClientException"); AWSError GetErrorForName(const char* errorName) { int hashCode = HashingUtils::HashString(errorName); if (hashCode == CONFLICT_HASH) { return AWSError(static_cast(ChimeSDKIdentityErrors::CONFLICT), false); } else if (hashCode == NOT_FOUND_HASH) { return AWSError(static_cast(ChimeSDKIdentityErrors::NOT_FOUND), false); } else if (hashCode == SERVICE_FAILURE_HASH) { return AWSError(static_cast(ChimeSDKIdentityErrors::SERVICE_FAILURE), false); } else if (hashCode == FORBIDDEN_HASH) { return AWSError(static_cast(ChimeSDKIdentityErrors::FORBIDDEN), false); } else if (hashCode == RESOURCE_LIMIT_EXCEEDED_HASH) { return AWSError(static_cast(ChimeSDKIdentityErrors::RESOURCE_LIMIT_EXCEEDED), false); } else if (hashCode == THROTTLED_CLIENT_HASH) { return AWSError(static_cast(ChimeSDKIdentityErrors::THROTTLED_CLIENT), false); } else if (hashCode == BAD_REQUEST_HASH) { return AWSError(static_cast(ChimeSDKIdentityErrors::BAD_REQUEST), false); } else if (hashCode == UNAUTHORIZED_CLIENT_HASH) { return AWSError(static_cast(ChimeSDKIdentityErrors::UNAUTHORIZED_CLIENT), false); } return AWSError(CoreErrors::UNKNOWN, false); } } // namespace ChimeSDKIdentityErrorMapper } // namespace ChimeSDKIdentity } // namespace Aws