/** * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. * SPDX-License-Identifier: Apache-2.0. */ #include #include #include #include #include #include using namespace Aws::Client; using namespace Aws::Utils; using namespace Aws::PrivateNetworks; using namespace Aws::PrivateNetworks::Model; namespace Aws { namespace PrivateNetworks { template<> AWS_PRIVATENETWORKS_API ResourceNotFoundException PrivateNetworksError::GetModeledError() { assert(this->GetErrorType() == PrivateNetworksErrors::RESOURCE_NOT_FOUND); return ResourceNotFoundException(this->GetJsonPayload().View()); } template<> AWS_PRIVATENETWORKS_API InternalServerException PrivateNetworksError::GetModeledError() { assert(this->GetErrorType() == PrivateNetworksErrors::INTERNAL_SERVER); return InternalServerException(this->GetJsonPayload().View()); } template<> AWS_PRIVATENETWORKS_API ValidationException PrivateNetworksError::GetModeledError() { assert(this->GetErrorType() == PrivateNetworksErrors::VALIDATION); return ValidationException(this->GetJsonPayload().View()); } namespace PrivateNetworksErrorMapper { static const int INTERNAL_SERVER_HASH = HashingUtils::HashString("InternalServerException"); static const int LIMIT_EXCEEDED_HASH = HashingUtils::HashString("LimitExceededException"); AWSError GetErrorForName(const char* errorName) { int hashCode = HashingUtils::HashString(errorName); if (hashCode == INTERNAL_SERVER_HASH) { return AWSError(static_cast(PrivateNetworksErrors::INTERNAL_SERVER), false); } else if (hashCode == LIMIT_EXCEEDED_HASH) { return AWSError(static_cast(PrivateNetworksErrors::LIMIT_EXCEEDED), true); } return AWSError(CoreErrors::UNKNOWN, false); } } // namespace PrivateNetworksErrorMapper } // namespace PrivateNetworks } // namespace Aws