/* * Copyright 2010-2017 Amazon.com, Inc. or its affiliates. All Rights Reserved. * * Licensed under the Apache License, Version 2.0 (the "License"). * You may not use this file except in compliance with the License. * A copy of the License is located at * * http://aws.amazon.com/apache2.0 * * or in the "license" file accompanying this file. This file is distributed * on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either * express or implied. See the License for the specific language governing * permissions and limitations under the License. */ #include #include #include using namespace Aws::Client; using namespace Aws::CDIMonitoring; using namespace Aws::Utils; namespace Aws { namespace CDIMonitoring { namespace CDIMonitoringErrorMapper { static const int FORBIDDEN_HASH = HashingUtils::HashString("ForbiddenException"); 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"); AWSError GetErrorForName(const char* errorName) { int hashCode = HashingUtils::HashString(errorName); if (hashCode == FORBIDDEN_HASH) { return AWSError(static_cast(CDIMonitoringErrors::FORBIDDEN), false); } else if (hashCode == TOO_MANY_REQUESTS_HASH) { return AWSError(static_cast(CDIMonitoringErrors::TOO_MANY_REQUESTS), false); } else if (hashCode == BAD_REQUEST_HASH) { return AWSError(static_cast(CDIMonitoringErrors::BAD_REQUEST), false); } else if (hashCode == INTERNAL_SERVER_ERROR_HASH) { return AWSError(static_cast(CDIMonitoringErrors::INTERNAL_SERVER_ERROR), false); } return AWSError(CoreErrors::UNKNOWN, false); } } // namespace CDIMonitoringErrorMapper } // namespace CDIMonitoring } // namespace Aws