/** * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. * SPDX-License-Identifier: Apache-2.0. */ #include #include #include #include using namespace Aws::Client; using namespace Aws::Utils; using namespace Aws::IoTJobsDataPlane; using namespace Aws::IoTJobsDataPlane::Model; namespace Aws { namespace IoTJobsDataPlane { template<> AWS_IOTJOBSDATAPLANE_API ThrottlingException IoTJobsDataPlaneError::GetModeledError() { assert(this->GetErrorType() == IoTJobsDataPlaneErrors::THROTTLING); return ThrottlingException(this->GetJsonPayload().View()); } namespace IoTJobsDataPlaneErrorMapper { static const int TERMINAL_STATE_HASH = HashingUtils::HashString("TerminalStateException"); static const int INVALID_REQUEST_HASH = HashingUtils::HashString("InvalidRequestException"); static const int CERTIFICATE_VALIDATION_HASH = HashingUtils::HashString("CertificateValidationException"); static const int INVALID_STATE_TRANSITION_HASH = HashingUtils::HashString("InvalidStateTransitionException"); AWSError GetErrorForName(const char* errorName) { int hashCode = HashingUtils::HashString(errorName); if (hashCode == TERMINAL_STATE_HASH) { return AWSError(static_cast(IoTJobsDataPlaneErrors::TERMINAL_STATE), false); } else if (hashCode == INVALID_REQUEST_HASH) { return AWSError(static_cast(IoTJobsDataPlaneErrors::INVALID_REQUEST), false); } else if (hashCode == CERTIFICATE_VALIDATION_HASH) { return AWSError(static_cast(IoTJobsDataPlaneErrors::CERTIFICATE_VALIDATION), false); } else if (hashCode == INVALID_STATE_TRANSITION_HASH) { return AWSError(static_cast(IoTJobsDataPlaneErrors::INVALID_STATE_TRANSITION), false); } return AWSError(CoreErrors::UNKNOWN, false); } } // namespace IoTJobsDataPlaneErrorMapper } // namespace IoTJobsDataPlane } // namespace Aws