/** * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. * SPDX-License-Identifier: Apache-2.0. */ #include #include #include using namespace Aws::Client; using namespace Aws::Utils; using namespace Aws::SNS; namespace Aws { namespace SNS { namespace SNSErrorMapper { static const int CONCURRENT_ACCESS_HASH = HashingUtils::HashString("ConcurrentAccess"); static const int K_M_S_INVALID_STATE_HASH = HashingUtils::HashString("KMSInvalidState"); static const int SUBSCRIPTION_LIMIT_EXCEEDED_HASH = HashingUtils::HashString("SubscriptionLimitExceeded"); static const int TOPIC_LIMIT_EXCEEDED_HASH = HashingUtils::HashString("TopicLimitExceeded"); static const int K_M_S_THROTTLING_HASH = HashingUtils::HashString("KMSThrottling"); static const int TAG_POLICY_HASH = HashingUtils::HashString("TagPolicy"); static const int AUTHORIZATION_ERROR_HASH = HashingUtils::HashString("AuthorizationError"); static const int PLATFORM_APPLICATION_DISABLED_HASH = HashingUtils::HashString("PlatformApplicationDisabled"); static const int INTERNAL_ERROR_HASH = HashingUtils::HashString("InternalError"); static const int ENDPOINT_DISABLED_HASH = HashingUtils::HashString("EndpointDisabled"); static const int K_M_S_OPT_IN_REQUIRED_HASH = HashingUtils::HashString("KMSOptInRequired"); static const int NOT_FOUND_HASH = HashingUtils::HashString("NotFound"); static const int INVALID_PARAMETER_HASH = HashingUtils::HashString("InvalidParameter"); static const int K_M_S_DISABLED_HASH = HashingUtils::HashString("KMSDisabled"); static const int K_M_S_NOT_FOUND_HASH = HashingUtils::HashString("KMSNotFound"); static const int K_M_S_ACCESS_DENIED_HASH = HashingUtils::HashString("KMSAccessDenied"); static const int FILTER_POLICY_LIMIT_EXCEEDED_HASH = HashingUtils::HashString("FilterPolicyLimitExceeded"); static const int INVALID_SECURITY_HASH = HashingUtils::HashString("InvalidSecurity"); static const int TAG_LIMIT_EXCEEDED_HASH = HashingUtils::HashString("TagLimitExceeded"); static const int STALE_TAG_HASH = HashingUtils::HashString("StaleTag"); AWSError GetErrorForName(const char* errorName) { int hashCode = HashingUtils::HashString(errorName); if (hashCode == CONCURRENT_ACCESS_HASH) { return AWSError(static_cast(SNSErrors::CONCURRENT_ACCESS), false); } else if (hashCode == K_M_S_INVALID_STATE_HASH) { return AWSError(static_cast(SNSErrors::K_M_S_INVALID_STATE), false); } else if (hashCode == SUBSCRIPTION_LIMIT_EXCEEDED_HASH) { return AWSError(static_cast(SNSErrors::SUBSCRIPTION_LIMIT_EXCEEDED), false); } else if (hashCode == TOPIC_LIMIT_EXCEEDED_HASH) { return AWSError(static_cast(SNSErrors::TOPIC_LIMIT_EXCEEDED), false); } else if (hashCode == K_M_S_THROTTLING_HASH) { return AWSError(static_cast(SNSErrors::K_M_S_THROTTLING), false); } else if (hashCode == TAG_POLICY_HASH) { return AWSError(static_cast(SNSErrors::TAG_POLICY), false); } else if (hashCode == AUTHORIZATION_ERROR_HASH) { return AWSError(static_cast(SNSErrors::AUTHORIZATION_ERROR), false); } else if (hashCode == PLATFORM_APPLICATION_DISABLED_HASH) { return AWSError(static_cast(SNSErrors::PLATFORM_APPLICATION_DISABLED), false); } else if (hashCode == INTERNAL_ERROR_HASH) { return AWSError(static_cast(SNSErrors::INTERNAL_ERROR), true); } else if (hashCode == ENDPOINT_DISABLED_HASH) { return AWSError(static_cast(SNSErrors::ENDPOINT_DISABLED), false); } else if (hashCode == K_M_S_OPT_IN_REQUIRED_HASH) { return AWSError(static_cast(SNSErrors::K_M_S_OPT_IN_REQUIRED), false); } else if (hashCode == NOT_FOUND_HASH) { return AWSError(static_cast(SNSErrors::NOT_FOUND), false); } else if (hashCode == INVALID_PARAMETER_HASH) { return AWSError(static_cast(SNSErrors::INVALID_PARAMETER), false); } else if (hashCode == K_M_S_DISABLED_HASH) { return AWSError(static_cast(SNSErrors::K_M_S_DISABLED), false); } else if (hashCode == K_M_S_NOT_FOUND_HASH) { return AWSError(static_cast(SNSErrors::K_M_S_NOT_FOUND), false); } else if (hashCode == K_M_S_ACCESS_DENIED_HASH) { return AWSError(static_cast(SNSErrors::K_M_S_ACCESS_DENIED), false); } else if (hashCode == FILTER_POLICY_LIMIT_EXCEEDED_HASH) { return AWSError(static_cast(SNSErrors::FILTER_POLICY_LIMIT_EXCEEDED), false); } else if (hashCode == INVALID_SECURITY_HASH) { return AWSError(static_cast(SNSErrors::INVALID_SECURITY), false); } else if (hashCode == TAG_LIMIT_EXCEEDED_HASH) { return AWSError(static_cast(SNSErrors::TAG_LIMIT_EXCEEDED), false); } else if (hashCode == STALE_TAG_HASH) { return AWSError(static_cast(SNSErrors::STALE_TAG), false); } return AWSError(CoreErrors::UNKNOWN, false); } } // namespace SNSErrorMapper } // namespace SNS } // namespace Aws