/** * 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::AppConfig; using namespace Aws::AppConfig::Model; namespace Aws { namespace AppConfig { template<> AWS_APPCONFIG_API ResourceNotFoundException AppConfigError::GetModeledError() { assert(this->GetErrorType() == AppConfigErrors::RESOURCE_NOT_FOUND); return ResourceNotFoundException(this->GetJsonPayload().View()); } template<> AWS_APPCONFIG_API PayloadTooLargeException AppConfigError::GetModeledError() { assert(this->GetErrorType() == AppConfigErrors::PAYLOAD_TOO_LARGE); return PayloadTooLargeException(this->GetJsonPayload().View()); } template<> AWS_APPCONFIG_API BadRequestException AppConfigError::GetModeledError() { assert(this->GetErrorType() == AppConfigErrors::BAD_REQUEST); return BadRequestException(this->GetJsonPayload().View()); } namespace AppConfigErrorMapper { static const int CONFLICT_HASH = HashingUtils::HashString("ConflictException"); static const int SERVICE_QUOTA_EXCEEDED_HASH = HashingUtils::HashString("ServiceQuotaExceededException"); static const int INTERNAL_SERVER_HASH = HashingUtils::HashString("InternalServerException"); static const int PAYLOAD_TOO_LARGE_HASH = HashingUtils::HashString("PayloadTooLargeException"); 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(AppConfigErrors::CONFLICT), false); } else if (hashCode == SERVICE_QUOTA_EXCEEDED_HASH) { return AWSError(static_cast(AppConfigErrors::SERVICE_QUOTA_EXCEEDED), false); } else if (hashCode == INTERNAL_SERVER_HASH) { return AWSError(static_cast(AppConfigErrors::INTERNAL_SERVER), false); } else if (hashCode == PAYLOAD_TOO_LARGE_HASH) { return AWSError(static_cast(AppConfigErrors::PAYLOAD_TOO_LARGE), false); } else if (hashCode == BAD_REQUEST_HASH) { return AWSError(static_cast(AppConfigErrors::BAD_REQUEST), false); } return AWSError(CoreErrors::UNKNOWN, false); } } // namespace AppConfigErrorMapper } // namespace AppConfig } // namespace Aws