/** * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. * SPDX-License-Identifier: Apache-2.0. */ #include #include #include #include #include using namespace Aws::Client; using namespace Aws::Utils; using namespace Aws::LicenseManager; using namespace Aws::LicenseManager::Model; namespace Aws { namespace LicenseManager { template<> AWS_LICENSEMANAGER_API RedirectException LicenseManagerError::GetModeledError() { assert(this->GetErrorType() == LicenseManagerErrors::REDIRECT); return RedirectException(this->GetJsonPayload().View()); } template<> AWS_LICENSEMANAGER_API FailedDependencyException LicenseManagerError::GetModeledError() { assert(this->GetErrorType() == LicenseManagerErrors::FAILED_DEPENDENCY); return FailedDependencyException(this->GetJsonPayload().View()); } namespace LicenseManagerErrorMapper { static const int CONFLICT_HASH = HashingUtils::HashString("ConflictException"); static const int AUTHORIZATION_HASH = HashingUtils::HashString("AuthorizationException"); static const int REDIRECT_HASH = HashingUtils::HashString("RedirectException"); static const int FAILED_DEPENDENCY_HASH = HashingUtils::HashString("FailedDependencyException"); static const int NO_ENTITLEMENTS_ALLOWED_HASH = HashingUtils::HashString("NoEntitlementsAllowedException"); static const int UNSUPPORTED_DIGITAL_SIGNATURE_METHOD_HASH = HashingUtils::HashString("UnsupportedDigitalSignatureMethodException"); static const int INVALID_RESOURCE_STATE_HASH = HashingUtils::HashString("InvalidResourceStateException"); static const int SERVER_INTERNAL_HASH = HashingUtils::HashString("ServerInternalException"); static const int ENTITLEMENT_NOT_ALLOWED_HASH = HashingUtils::HashString("EntitlementNotAllowedException"); static const int LICENSE_USAGE_HASH = HashingUtils::HashString("LicenseUsageException"); static const int RESOURCE_LIMIT_EXCEEDED_HASH = HashingUtils::HashString("ResourceLimitExceededException"); static const int RATE_LIMIT_EXCEEDED_HASH = HashingUtils::HashString("RateLimitExceededException"); static const int FILTER_LIMIT_EXCEEDED_HASH = HashingUtils::HashString("FilterLimitExceededException"); AWSError GetErrorForName(const char* errorName) { int hashCode = HashingUtils::HashString(errorName); if (hashCode == CONFLICT_HASH) { return AWSError(static_cast(LicenseManagerErrors::CONFLICT), false); } else if (hashCode == AUTHORIZATION_HASH) { return AWSError(static_cast(LicenseManagerErrors::AUTHORIZATION), false); } else if (hashCode == REDIRECT_HASH) { return AWSError(static_cast(LicenseManagerErrors::REDIRECT), false); } else if (hashCode == FAILED_DEPENDENCY_HASH) { return AWSError(static_cast(LicenseManagerErrors::FAILED_DEPENDENCY), false); } else if (hashCode == NO_ENTITLEMENTS_ALLOWED_HASH) { return AWSError(static_cast(LicenseManagerErrors::NO_ENTITLEMENTS_ALLOWED), false); } else if (hashCode == UNSUPPORTED_DIGITAL_SIGNATURE_METHOD_HASH) { return AWSError(static_cast(LicenseManagerErrors::UNSUPPORTED_DIGITAL_SIGNATURE_METHOD), false); } else if (hashCode == INVALID_RESOURCE_STATE_HASH) { return AWSError(static_cast(LicenseManagerErrors::INVALID_RESOURCE_STATE), false); } else if (hashCode == SERVER_INTERNAL_HASH) { return AWSError(static_cast(LicenseManagerErrors::SERVER_INTERNAL), false); } else if (hashCode == ENTITLEMENT_NOT_ALLOWED_HASH) { return AWSError(static_cast(LicenseManagerErrors::ENTITLEMENT_NOT_ALLOWED), false); } else if (hashCode == LICENSE_USAGE_HASH) { return AWSError(static_cast(LicenseManagerErrors::LICENSE_USAGE), false); } else if (hashCode == RESOURCE_LIMIT_EXCEEDED_HASH) { return AWSError(static_cast(LicenseManagerErrors::RESOURCE_LIMIT_EXCEEDED), false); } else if (hashCode == RATE_LIMIT_EXCEEDED_HASH) { return AWSError(static_cast(LicenseManagerErrors::RATE_LIMIT_EXCEEDED), false); } else if (hashCode == FILTER_LIMIT_EXCEEDED_HASH) { return AWSError(static_cast(LicenseManagerErrors::FILTER_LIMIT_EXCEEDED), false); } return AWSError(CoreErrors::UNKNOWN, false); } } // namespace LicenseManagerErrorMapper } // namespace LicenseManager } // namespace Aws