/** * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. * SPDX-License-Identifier: Apache-2.0. */ #include #include #include #include using namespace Aws::Client; using namespace Aws::Utils; using namespace Aws::BackupStorage; using namespace Aws::BackupStorage::Model; namespace Aws { namespace BackupStorage { template<> AWS_BACKUPSTORAGE_API DataAlreadyExistsException BackupStorageError::GetModeledError() { assert(this->GetErrorType() == BackupStorageErrors::DATA_ALREADY_EXISTS); return DataAlreadyExistsException(this->GetJsonPayload().View()); } namespace BackupStorageErrorMapper { static const int NOT_READABLE_INPUT_STREAM_HASH = HashingUtils::HashString("NotReadableInputStreamException"); static const int ILLEGAL_ARGUMENT_HASH = HashingUtils::HashString("IllegalArgumentException"); static const int RETRYABLE_HASH = HashingUtils::HashString("RetryableException"); static const int DATA_ALREADY_EXISTS_HASH = HashingUtils::HashString("DataAlreadyExistsException"); static const int SERVICE_INTERNAL_HASH = HashingUtils::HashString("ServiceInternalException"); static const int K_M_S_INVALID_KEY_USAGE_HASH = HashingUtils::HashString("KMSInvalidKeyUsageException"); AWSError GetErrorForName(const char* errorName) { int hashCode = HashingUtils::HashString(errorName); if (hashCode == NOT_READABLE_INPUT_STREAM_HASH) { return AWSError(static_cast(BackupStorageErrors::NOT_READABLE_INPUT_STREAM), false); } else if (hashCode == ILLEGAL_ARGUMENT_HASH) { return AWSError(static_cast(BackupStorageErrors::ILLEGAL_ARGUMENT), false); } else if (hashCode == RETRYABLE_HASH) { return AWSError(static_cast(BackupStorageErrors::RETRYABLE), false); } else if (hashCode == DATA_ALREADY_EXISTS_HASH) { return AWSError(static_cast(BackupStorageErrors::DATA_ALREADY_EXISTS), false); } else if (hashCode == SERVICE_INTERNAL_HASH) { return AWSError(static_cast(BackupStorageErrors::SERVICE_INTERNAL), false); } else if (hashCode == K_M_S_INVALID_KEY_USAGE_HASH) { return AWSError(static_cast(BackupStorageErrors::K_M_S_INVALID_KEY_USAGE), false); } return AWSError(CoreErrors::UNKNOWN, false); } } // namespace BackupStorageErrorMapper } // namespace BackupStorage } // namespace Aws