/** * 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 using namespace Aws::Client; using namespace Aws::Utils; using namespace Aws::SecurityHub; using namespace Aws::SecurityHub::Model; namespace Aws { namespace SecurityHub { template<> AWS_SECURITYHUB_API InternalException SecurityHubError::GetModeledError() { assert(this->GetErrorType() == SecurityHubErrors::INTERNAL); return InternalException(this->GetJsonPayload().View()); } template<> AWS_SECURITYHUB_API InvalidAccessException SecurityHubError::GetModeledError() { assert(this->GetErrorType() == SecurityHubErrors::INVALID_ACCESS); return InvalidAccessException(this->GetJsonPayload().View()); } template<> AWS_SECURITYHUB_API ResourceNotFoundException SecurityHubError::GetModeledError() { assert(this->GetErrorType() == SecurityHubErrors::RESOURCE_NOT_FOUND); return ResourceNotFoundException(this->GetJsonPayload().View()); } template<> AWS_SECURITYHUB_API LimitExceededException SecurityHubError::GetModeledError() { assert(this->GetErrorType() == SecurityHubErrors::LIMIT_EXCEEDED); return LimitExceededException(this->GetJsonPayload().View()); } template<> AWS_SECURITYHUB_API ResourceConflictException SecurityHubError::GetModeledError() { assert(this->GetErrorType() == SecurityHubErrors::RESOURCE_CONFLICT); return ResourceConflictException(this->GetJsonPayload().View()); } template<> AWS_SECURITYHUB_API AccessDeniedException SecurityHubError::GetModeledError() { assert(this->GetErrorType() == SecurityHubErrors::ACCESS_DENIED); return AccessDeniedException(this->GetJsonPayload().View()); } template<> AWS_SECURITYHUB_API InvalidInputException SecurityHubError::GetModeledError() { assert(this->GetErrorType() == SecurityHubErrors::INVALID_INPUT); return InvalidInputException(this->GetJsonPayload().View()); } namespace SecurityHubErrorMapper { static const int INTERNAL_HASH = HashingUtils::HashString("InternalException"); static const int INVALID_ACCESS_HASH = HashingUtils::HashString("InvalidAccessException"); static const int LIMIT_EXCEEDED_HASH = HashingUtils::HashString("LimitExceededException"); static const int RESOURCE_CONFLICT_HASH = HashingUtils::HashString("ResourceConflictException"); static const int INVALID_INPUT_HASH = HashingUtils::HashString("InvalidInputException"); AWSError GetErrorForName(const char* errorName) { int hashCode = HashingUtils::HashString(errorName); if (hashCode == INTERNAL_HASH) { return AWSError(static_cast(SecurityHubErrors::INTERNAL), false); } else if (hashCode == INVALID_ACCESS_HASH) { return AWSError(static_cast(SecurityHubErrors::INVALID_ACCESS), false); } else if (hashCode == LIMIT_EXCEEDED_HASH) { return AWSError(static_cast(SecurityHubErrors::LIMIT_EXCEEDED), true); } else if (hashCode == RESOURCE_CONFLICT_HASH) { return AWSError(static_cast(SecurityHubErrors::RESOURCE_CONFLICT), false); } else if (hashCode == INVALID_INPUT_HASH) { return AWSError(static_cast(SecurityHubErrors::INVALID_INPUT), false); } return AWSError(CoreErrors::UNKNOWN, false); } } // namespace SecurityHubErrorMapper } // namespace SecurityHub } // namespace Aws