/** * 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::DataExchange; using namespace Aws::DataExchange::Model; namespace Aws { namespace DataExchange { template<> AWS_DATAEXCHANGE_API ConflictException DataExchangeError::GetModeledError() { assert(this->GetErrorType() == DataExchangeErrors::CONFLICT); return ConflictException(this->GetJsonPayload().View()); } template<> AWS_DATAEXCHANGE_API ResourceNotFoundException DataExchangeError::GetModeledError() { assert(this->GetErrorType() == DataExchangeErrors::RESOURCE_NOT_FOUND); return ResourceNotFoundException(this->GetJsonPayload().View()); } template<> AWS_DATAEXCHANGE_API ValidationException DataExchangeError::GetModeledError() { assert(this->GetErrorType() == DataExchangeErrors::VALIDATION); return ValidationException(this->GetJsonPayload().View()); } template<> AWS_DATAEXCHANGE_API ServiceLimitExceededException DataExchangeError::GetModeledError() { assert(this->GetErrorType() == DataExchangeErrors::SERVICE_LIMIT_EXCEEDED); return ServiceLimitExceededException(this->GetJsonPayload().View()); } namespace DataExchangeErrorMapper { static const int CONFLICT_HASH = HashingUtils::HashString("ConflictException"); static const int INTERNAL_SERVER_HASH = HashingUtils::HashString("InternalServerException"); static const int SERVICE_LIMIT_EXCEEDED_HASH = HashingUtils::HashString("ServiceLimitExceededException"); AWSError GetErrorForName(const char* errorName) { int hashCode = HashingUtils::HashString(errorName); if (hashCode == CONFLICT_HASH) { return AWSError(static_cast(DataExchangeErrors::CONFLICT), false); } else if (hashCode == INTERNAL_SERVER_HASH) { return AWSError(static_cast(DataExchangeErrors::INTERNAL_SERVER), false); } else if (hashCode == SERVICE_LIMIT_EXCEEDED_HASH) { return AWSError(static_cast(DataExchangeErrors::SERVICE_LIMIT_EXCEEDED), false); } return AWSError(CoreErrors::UNKNOWN, false); } } // namespace DataExchangeErrorMapper } // namespace DataExchange } // namespace Aws