/** * 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::BackupGateway; using namespace Aws::BackupGateway::Model; namespace Aws { namespace BackupGateway { template<> AWS_BACKUPGATEWAY_API ConflictException BackupGatewayError::GetModeledError() { assert(this->GetErrorType() == BackupGatewayErrors::CONFLICT); return ConflictException(this->GetJsonPayload().View()); } template<> AWS_BACKUPGATEWAY_API ThrottlingException BackupGatewayError::GetModeledError() { assert(this->GetErrorType() == BackupGatewayErrors::THROTTLING); return ThrottlingException(this->GetJsonPayload().View()); } template<> AWS_BACKUPGATEWAY_API InternalServerException BackupGatewayError::GetModeledError() { assert(this->GetErrorType() == BackupGatewayErrors::INTERNAL_SERVER); return InternalServerException(this->GetJsonPayload().View()); } template<> AWS_BACKUPGATEWAY_API ResourceNotFoundException BackupGatewayError::GetModeledError() { assert(this->GetErrorType() == BackupGatewayErrors::RESOURCE_NOT_FOUND); return ResourceNotFoundException(this->GetJsonPayload().View()); } template<> AWS_BACKUPGATEWAY_API ValidationException BackupGatewayError::GetModeledError() { assert(this->GetErrorType() == BackupGatewayErrors::VALIDATION); return ValidationException(this->GetJsonPayload().View()); } template<> AWS_BACKUPGATEWAY_API AccessDeniedException BackupGatewayError::GetModeledError() { assert(this->GetErrorType() == BackupGatewayErrors::ACCESS_DENIED); return AccessDeniedException(this->GetJsonPayload().View()); } namespace BackupGatewayErrorMapper { static const int CONFLICT_HASH = HashingUtils::HashString("ConflictException"); 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(BackupGatewayErrors::CONFLICT), false); } else if (hashCode == INTERNAL_SERVER_HASH) { return AWSError(static_cast(BackupGatewayErrors::INTERNAL_SERVER), false); } return AWSError(CoreErrors::UNKNOWN, false); } } // namespace BackupGatewayErrorMapper } // namespace BackupGateway } // namespace Aws