/** * 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::MediaConnect; namespace Aws { namespace MediaConnect { namespace MediaConnectErrorMapper { static const int CONFLICT_HASH = HashingUtils::HashString("ConflictException"); static const int CREATE_FLOW420_HASH = HashingUtils::HashString("CreateFlow420Exception"); static const int NOT_FOUND_HASH = HashingUtils::HashString("NotFoundException"); static const int FORBIDDEN_HASH = HashingUtils::HashString("ForbiddenException"); static const int CREATE_GATEWAY420_HASH = HashingUtils::HashString("CreateGateway420Exception"); static const int TOO_MANY_REQUESTS_HASH = HashingUtils::HashString("TooManyRequestsException"); static const int BAD_REQUEST_HASH = HashingUtils::HashString("BadRequestException"); static const int INTERNAL_SERVER_ERROR_HASH = HashingUtils::HashString("InternalServerErrorException"); static const int GRANT_FLOW_ENTITLEMENTS420_HASH = HashingUtils::HashString("GrantFlowEntitlements420Exception"); static const int CREATE_BRIDGE420_HASH = HashingUtils::HashString("CreateBridge420Exception"); static const int ADD_FLOW_OUTPUTS420_HASH = HashingUtils::HashString("AddFlowOutputs420Exception"); AWSError GetErrorForName(const char* errorName) { int hashCode = HashingUtils::HashString(errorName); if (hashCode == CONFLICT_HASH) { return AWSError(static_cast(MediaConnectErrors::CONFLICT), false); } else if (hashCode == CREATE_FLOW420_HASH) { return AWSError(static_cast(MediaConnectErrors::CREATE_FLOW420), false); } else if (hashCode == NOT_FOUND_HASH) { return AWSError(static_cast(MediaConnectErrors::NOT_FOUND), false); } else if (hashCode == FORBIDDEN_HASH) { return AWSError(static_cast(MediaConnectErrors::FORBIDDEN), false); } else if (hashCode == CREATE_GATEWAY420_HASH) { return AWSError(static_cast(MediaConnectErrors::CREATE_GATEWAY420), false); } else if (hashCode == TOO_MANY_REQUESTS_HASH) { return AWSError(static_cast(MediaConnectErrors::TOO_MANY_REQUESTS), true); } else if (hashCode == BAD_REQUEST_HASH) { return AWSError(static_cast(MediaConnectErrors::BAD_REQUEST), false); } else if (hashCode == INTERNAL_SERVER_ERROR_HASH) { return AWSError(static_cast(MediaConnectErrors::INTERNAL_SERVER_ERROR), false); } else if (hashCode == GRANT_FLOW_ENTITLEMENTS420_HASH) { return AWSError(static_cast(MediaConnectErrors::GRANT_FLOW_ENTITLEMENTS420), false); } else if (hashCode == CREATE_BRIDGE420_HASH) { return AWSError(static_cast(MediaConnectErrors::CREATE_BRIDGE420), false); } else if (hashCode == ADD_FLOW_OUTPUTS420_HASH) { return AWSError(static_cast(MediaConnectErrors::ADD_FLOW_OUTPUTS420), false); } return AWSError(CoreErrors::UNKNOWN, false); } } // namespace MediaConnectErrorMapper } // namespace MediaConnect } // namespace Aws