/** * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. * SPDX-License-Identifier: Apache-2.0. */ #include #include #include #include #include #include #include using namespace Aws::Client; using namespace Aws::Utils; using namespace Aws::RecycleBin; using namespace Aws::RecycleBin::Model; namespace Aws { namespace RecycleBin { template<> AWS_RECYCLEBIN_API ConflictException RecycleBinError::GetModeledError() { assert(this->GetErrorType() == RecycleBinErrors::CONFLICT); return ConflictException(this->GetJsonPayload().View()); } template<> AWS_RECYCLEBIN_API ServiceQuotaExceededException RecycleBinError::GetModeledError() { assert(this->GetErrorType() == RecycleBinErrors::SERVICE_QUOTA_EXCEEDED); return ServiceQuotaExceededException(this->GetJsonPayload().View()); } template<> AWS_RECYCLEBIN_API ResourceNotFoundException RecycleBinError::GetModeledError() { assert(this->GetErrorType() == RecycleBinErrors::RESOURCE_NOT_FOUND); return ResourceNotFoundException(this->GetJsonPayload().View()); } template<> AWS_RECYCLEBIN_API ValidationException RecycleBinError::GetModeledError() { assert(this->GetErrorType() == RecycleBinErrors::VALIDATION); return ValidationException(this->GetJsonPayload().View()); } namespace RecycleBinErrorMapper { static const int CONFLICT_HASH = HashingUtils::HashString("ConflictException"); static const int SERVICE_QUOTA_EXCEEDED_HASH = HashingUtils::HashString("ServiceQuotaExceededException"); static const int INTERNAL_SERVER_HASH = HashingUtils::HashString("InternalServerException"); AWSError GetErrorForName(const char* errorName) { int hashCode = HashingUtils::HashString(errorName); if (hashCode == CONFLICT_HASH) { return AWSError(static_cast(RecycleBinErrors::CONFLICT), false); } else if (hashCode == SERVICE_QUOTA_EXCEEDED_HASH) { return AWSError(static_cast(RecycleBinErrors::SERVICE_QUOTA_EXCEEDED), false); } else if (hashCode == INTERNAL_SERVER_HASH) { return AWSError(static_cast(RecycleBinErrors::INTERNAL_SERVER), false); } return AWSError(CoreErrors::UNKNOWN, false); } } // namespace RecycleBinErrorMapper } // namespace RecycleBin } // namespace Aws