/** * 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::ElasticsearchService; namespace Aws { namespace ElasticsearchService { namespace ElasticsearchServiceErrorMapper { static const int DISABLED_OPERATION_HASH = HashingUtils::HashString("DisabledOperationException"); static const int INTERNAL_HASH = HashingUtils::HashString("InternalException"); static const int CONFLICT_HASH = HashingUtils::HashString("ConflictException"); static const int RESOURCE_ALREADY_EXISTS_HASH = HashingUtils::HashString("ResourceAlreadyExistsException"); static const int BASE_HASH = HashingUtils::HashString("BaseException"); static const int LIMIT_EXCEEDED_HASH = HashingUtils::HashString("LimitExceededException"); static const int INVALID_TYPE_HASH = HashingUtils::HashString("InvalidTypeException"); static const int INVALID_PAGINATION_TOKEN_HASH = HashingUtils::HashString("InvalidPaginationTokenException"); AWSError GetErrorForName(const char* errorName) { int hashCode = HashingUtils::HashString(errorName); if (hashCode == DISABLED_OPERATION_HASH) { return AWSError(static_cast(ElasticsearchServiceErrors::DISABLED_OPERATION), false); } else if (hashCode == INTERNAL_HASH) { return AWSError(static_cast(ElasticsearchServiceErrors::INTERNAL), false); } else if (hashCode == CONFLICT_HASH) { return AWSError(static_cast(ElasticsearchServiceErrors::CONFLICT), false); } else if (hashCode == RESOURCE_ALREADY_EXISTS_HASH) { return AWSError(static_cast(ElasticsearchServiceErrors::RESOURCE_ALREADY_EXISTS), false); } else if (hashCode == BASE_HASH) { return AWSError(static_cast(ElasticsearchServiceErrors::BASE), false); } else if (hashCode == LIMIT_EXCEEDED_HASH) { return AWSError(static_cast(ElasticsearchServiceErrors::LIMIT_EXCEEDED), true); } else if (hashCode == INVALID_TYPE_HASH) { return AWSError(static_cast(ElasticsearchServiceErrors::INVALID_TYPE), false); } else if (hashCode == INVALID_PAGINATION_TOKEN_HASH) { return AWSError(static_cast(ElasticsearchServiceErrors::INVALID_PAGINATION_TOKEN), false); } return AWSError(CoreErrors::UNKNOWN, false); } } // namespace ElasticsearchServiceErrorMapper } // namespace ElasticsearchService } // namespace Aws