/** * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. * SPDX-License-Identifier: Apache-2.0. */ #include #include #include #include #include #include #include #include #include #include #include #include using namespace Aws::Client; using namespace Aws::Utils; using namespace Aws::ConnectCampaigns; using namespace Aws::ConnectCampaigns::Model; namespace Aws { namespace ConnectCampaigns { template<> AWS_CONNECTCAMPAIGNS_API ConflictException ConnectCampaignsError::GetModeledError() { assert(this->GetErrorType() == ConnectCampaignsErrors::CONFLICT); return ConflictException(this->GetJsonPayload().View()); } template<> AWS_CONNECTCAMPAIGNS_API ServiceQuotaExceededException ConnectCampaignsError::GetModeledError() { assert(this->GetErrorType() == ConnectCampaignsErrors::SERVICE_QUOTA_EXCEEDED); return ServiceQuotaExceededException(this->GetJsonPayload().View()); } template<> AWS_CONNECTCAMPAIGNS_API ThrottlingException ConnectCampaignsError::GetModeledError() { assert(this->GetErrorType() == ConnectCampaignsErrors::THROTTLING); return ThrottlingException(this->GetJsonPayload().View()); } template<> AWS_CONNECTCAMPAIGNS_API InternalServerException ConnectCampaignsError::GetModeledError() { assert(this->GetErrorType() == ConnectCampaignsErrors::INTERNAL_SERVER); return InternalServerException(this->GetJsonPayload().View()); } template<> AWS_CONNECTCAMPAIGNS_API ResourceNotFoundException ConnectCampaignsError::GetModeledError() { assert(this->GetErrorType() == ConnectCampaignsErrors::RESOURCE_NOT_FOUND); return ResourceNotFoundException(this->GetJsonPayload().View()); } template<> AWS_CONNECTCAMPAIGNS_API ValidationException ConnectCampaignsError::GetModeledError() { assert(this->GetErrorType() == ConnectCampaignsErrors::VALIDATION); return ValidationException(this->GetJsonPayload().View()); } template<> AWS_CONNECTCAMPAIGNS_API AccessDeniedException ConnectCampaignsError::GetModeledError() { assert(this->GetErrorType() == ConnectCampaignsErrors::ACCESS_DENIED); return AccessDeniedException(this->GetJsonPayload().View()); } template<> AWS_CONNECTCAMPAIGNS_API InvalidCampaignStateException ConnectCampaignsError::GetModeledError() { assert(this->GetErrorType() == ConnectCampaignsErrors::INVALID_CAMPAIGN_STATE); return InvalidCampaignStateException(this->GetJsonPayload().View()); } template<> AWS_CONNECTCAMPAIGNS_API InvalidStateException ConnectCampaignsError::GetModeledError() { assert(this->GetErrorType() == ConnectCampaignsErrors::INVALID_STATE); return InvalidStateException(this->GetJsonPayload().View()); } namespace ConnectCampaignsErrorMapper { static const int CONFLICT_HASH = HashingUtils::HashString("ConflictException"); static const int SERVICE_QUOTA_EXCEEDED_HASH = HashingUtils::HashString("ServiceQuotaExceededException"); static const int INTERNAL_SERVER_HASH = HashingUtils::HashString("InternalServerException"); static const int INVALID_CAMPAIGN_STATE_HASH = HashingUtils::HashString("InvalidCampaignStateException"); static const int INVALID_STATE_HASH = HashingUtils::HashString("InvalidStateException"); AWSError GetErrorForName(const char* errorName) { int hashCode = HashingUtils::HashString(errorName); if (hashCode == CONFLICT_HASH) { return AWSError(static_cast(ConnectCampaignsErrors::CONFLICT), false); } else if (hashCode == SERVICE_QUOTA_EXCEEDED_HASH) { return AWSError(static_cast(ConnectCampaignsErrors::SERVICE_QUOTA_EXCEEDED), false); } else if (hashCode == INTERNAL_SERVER_HASH) { return AWSError(static_cast(ConnectCampaignsErrors::INTERNAL_SERVER), false); } else if (hashCode == INVALID_CAMPAIGN_STATE_HASH) { return AWSError(static_cast(ConnectCampaignsErrors::INVALID_CAMPAIGN_STATE), false); } else if (hashCode == INVALID_STATE_HASH) { return AWSError(static_cast(ConnectCampaignsErrors::INVALID_STATE), false); } return AWSError(CoreErrors::UNKNOWN, false); } } // namespace ConnectCampaignsErrorMapper } // namespace ConnectCampaigns } // namespace Aws