/** * 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::SecurityLake; using namespace Aws::SecurityLake::Model; namespace Aws { namespace SecurityLake { template<> AWS_SECURITYLAKE_API ConflictException SecurityLakeError::GetModeledError() { assert(this->GetErrorType() == SecurityLakeErrors::CONFLICT); return ConflictException(this->GetJsonPayload().View()); } template<> AWS_SECURITYLAKE_API ThrottlingException SecurityLakeError::GetModeledError() { assert(this->GetErrorType() == SecurityLakeErrors::THROTTLING); return ThrottlingException(this->GetJsonPayload().View()); } template<> AWS_SECURITYLAKE_API ResourceNotFoundException SecurityLakeError::GetModeledError() { assert(this->GetErrorType() == SecurityLakeErrors::RESOURCE_NOT_FOUND); return ResourceNotFoundException(this->GetJsonPayload().View()); } template<> AWS_SECURITYLAKE_API AccessDeniedException SecurityLakeError::GetModeledError() { assert(this->GetErrorType() == SecurityLakeErrors::ACCESS_DENIED); return AccessDeniedException(this->GetJsonPayload().View()); } namespace SecurityLakeErrorMapper { static const int CONFLICT_HASH = HashingUtils::HashString("ConflictException"); static const int INTERNAL_SERVER_HASH = HashingUtils::HashString("InternalServerException"); static const int BAD_REQUEST_HASH = HashingUtils::HashString("BadRequestException"); AWSError GetErrorForName(const char* errorName) { int hashCode = HashingUtils::HashString(errorName); if (hashCode == CONFLICT_HASH) { return AWSError(static_cast(SecurityLakeErrors::CONFLICT), false); } else if (hashCode == INTERNAL_SERVER_HASH) { return AWSError(static_cast(SecurityLakeErrors::INTERNAL_SERVER), false); } else if (hashCode == BAD_REQUEST_HASH) { return AWSError(static_cast(SecurityLakeErrors::BAD_REQUEST), false); } return AWSError(CoreErrors::UNKNOWN, false); } } // namespace SecurityLakeErrorMapper } // namespace SecurityLake } // namespace Aws