/** * 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 #include using namespace Aws::Client; using namespace Aws::Utils; using namespace Aws::Backup; using namespace Aws::Backup::Model; namespace Aws { namespace Backup { template<> AWS_BACKUP_API ServiceUnavailableException BackupError::GetModeledError() { assert(this->GetErrorType() == BackupErrors::SERVICE_UNAVAILABLE); return ServiceUnavailableException(this->GetJsonPayload().View()); } template<> AWS_BACKUP_API ConflictException BackupError::GetModeledError() { assert(this->GetErrorType() == BackupErrors::CONFLICT); return ConflictException(this->GetJsonPayload().View()); } template<> AWS_BACKUP_API DependencyFailureException BackupError::GetModeledError() { assert(this->GetErrorType() == BackupErrors::DEPENDENCY_FAILURE); return DependencyFailureException(this->GetJsonPayload().View()); } template<> AWS_BACKUP_API ResourceNotFoundException BackupError::GetModeledError() { assert(this->GetErrorType() == BackupErrors::RESOURCE_NOT_FOUND); return ResourceNotFoundException(this->GetJsonPayload().View()); } template<> AWS_BACKUP_API LimitExceededException BackupError::GetModeledError() { assert(this->GetErrorType() == BackupErrors::LIMIT_EXCEEDED); return LimitExceededException(this->GetJsonPayload().View()); } template<> AWS_BACKUP_API AlreadyExistsException BackupError::GetModeledError() { assert(this->GetErrorType() == BackupErrors::ALREADY_EXISTS); return AlreadyExistsException(this->GetJsonPayload().View()); } template<> AWS_BACKUP_API InvalidResourceStateException BackupError::GetModeledError() { assert(this->GetErrorType() == BackupErrors::INVALID_RESOURCE_STATE); return InvalidResourceStateException(this->GetJsonPayload().View()); } template<> AWS_BACKUP_API InvalidParameterValueException BackupError::GetModeledError() { assert(this->GetErrorType() == BackupErrors::INVALID_PARAMETER_VALUE); return InvalidParameterValueException(this->GetJsonPayload().View()); } template<> AWS_BACKUP_API MissingParameterValueException BackupError::GetModeledError() { assert(this->GetErrorType() == BackupErrors::MISSING_PARAMETER_VALUE); return MissingParameterValueException(this->GetJsonPayload().View()); } template<> AWS_BACKUP_API InvalidRequestException BackupError::GetModeledError() { assert(this->GetErrorType() == BackupErrors::INVALID_REQUEST); return InvalidRequestException(this->GetJsonPayload().View()); } namespace BackupErrorMapper { static const int CONFLICT_HASH = HashingUtils::HashString("ConflictException"); static const int DEPENDENCY_FAILURE_HASH = HashingUtils::HashString("DependencyFailureException"); static const int LIMIT_EXCEEDED_HASH = HashingUtils::HashString("LimitExceededException"); static const int ALREADY_EXISTS_HASH = HashingUtils::HashString("AlreadyExistsException"); static const int INVALID_RESOURCE_STATE_HASH = HashingUtils::HashString("InvalidResourceStateException"); static const int MISSING_PARAMETER_VALUE_HASH = HashingUtils::HashString("MissingParameterValueException"); static const int INVALID_REQUEST_HASH = HashingUtils::HashString("InvalidRequestException"); AWSError GetErrorForName(const char* errorName) { int hashCode = HashingUtils::HashString(errorName); if (hashCode == CONFLICT_HASH) { return AWSError(static_cast(BackupErrors::CONFLICT), false); } else if (hashCode == DEPENDENCY_FAILURE_HASH) { return AWSError(static_cast(BackupErrors::DEPENDENCY_FAILURE), false); } else if (hashCode == LIMIT_EXCEEDED_HASH) { return AWSError(static_cast(BackupErrors::LIMIT_EXCEEDED), true); } else if (hashCode == ALREADY_EXISTS_HASH) { return AWSError(static_cast(BackupErrors::ALREADY_EXISTS), false); } else if (hashCode == INVALID_RESOURCE_STATE_HASH) { return AWSError(static_cast(BackupErrors::INVALID_RESOURCE_STATE), false); } else if (hashCode == MISSING_PARAMETER_VALUE_HASH) { return AWSError(static_cast(BackupErrors::MISSING_PARAMETER_VALUE), false); } else if (hashCode == INVALID_REQUEST_HASH) { return AWSError(static_cast(BackupErrors::INVALID_REQUEST), false); } return AWSError(CoreErrors::UNKNOWN, false); } } // namespace BackupErrorMapper } // namespace Backup } // namespace Aws