/** * 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::GuardDuty; using namespace Aws::GuardDuty::Model; namespace Aws { namespace GuardDuty { template<> AWS_GUARDDUTY_API ConflictException GuardDutyError::GetModeledError() { assert(this->GetErrorType() == GuardDutyErrors::CONFLICT); return ConflictException(this->GetJsonPayload().View()); } template<> AWS_GUARDDUTY_API AccessDeniedException GuardDutyError::GetModeledError() { assert(this->GetErrorType() == GuardDutyErrors::ACCESS_DENIED); return AccessDeniedException(this->GetJsonPayload().View()); } template<> AWS_GUARDDUTY_API BadRequestException GuardDutyError::GetModeledError() { assert(this->GetErrorType() == GuardDutyErrors::BAD_REQUEST); return BadRequestException(this->GetJsonPayload().View()); } template<> AWS_GUARDDUTY_API InternalServerErrorException GuardDutyError::GetModeledError() { assert(this->GetErrorType() == GuardDutyErrors::INTERNAL_SERVER_ERROR); return InternalServerErrorException(this->GetJsonPayload().View()); } namespace GuardDutyErrorMapper { static const int CONFLICT_HASH = HashingUtils::HashString("ConflictException"); static const int BAD_REQUEST_HASH = HashingUtils::HashString("BadRequestException"); static const int INTERNAL_SERVER_ERROR_HASH = HashingUtils::HashString("InternalServerErrorException"); AWSError GetErrorForName(const char* errorName) { int hashCode = HashingUtils::HashString(errorName); if (hashCode == CONFLICT_HASH) { return AWSError(static_cast(GuardDutyErrors::CONFLICT), false); } else if (hashCode == BAD_REQUEST_HASH) { return AWSError(static_cast(GuardDutyErrors::BAD_REQUEST), false); } else if (hashCode == INTERNAL_SERVER_ERROR_HASH) { return AWSError(static_cast(GuardDutyErrors::INTERNAL_SERVER_ERROR), false); } return AWSError(CoreErrors::UNKNOWN, false); } } // namespace GuardDutyErrorMapper } // namespace GuardDuty } // namespace Aws