This repository has been archived on 2025-09-14. You can view files and clone it, but cannot push or open issues or pull requests.
Files
pxz-hos-client-cpp-module/support/aws-sdk-cpp-master/aws-cpp-sdk-application-insights/source/ApplicationInsightsErrors.cpp

66 lines
2.3 KiB
C++
Raw Normal View History

/**
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
* SPDX-License-Identifier: Apache-2.0.
*/
#include <aws/core/client/AWSError.h>
#include <aws/core/utils/HashingUtils.h>
#include <aws/application-insights/ApplicationInsightsErrors.h>
#include <aws/application-insights/model/TooManyTagsException.h>
using namespace Aws::Client;
using namespace Aws::Utils;
using namespace Aws::ApplicationInsights;
using namespace Aws::ApplicationInsights::Model;
namespace Aws
{
namespace ApplicationInsights
{
template<> AWS_APPLICATIONINSIGHTS_API TooManyTagsException ApplicationInsightsError::GetModeledError()
{
assert(this->GetErrorType() == ApplicationInsightsErrors::TOO_MANY_TAGS);
return TooManyTagsException(this->GetJsonPayload().View());
}
namespace ApplicationInsightsErrorMapper
{
static const int INTERNAL_SERVER_HASH = HashingUtils::HashString("InternalServerException");
static const int TAGS_ALREADY_EXIST_HASH = HashingUtils::HashString("TagsAlreadyExistException");
static const int TOO_MANY_TAGS_HASH = HashingUtils::HashString("TooManyTagsException");
static const int RESOURCE_IN_USE_HASH = HashingUtils::HashString("ResourceInUseException");
static const int BAD_REQUEST_HASH = HashingUtils::HashString("BadRequestException");
AWSError<CoreErrors> GetErrorForName(const char* errorName)
{
int hashCode = HashingUtils::HashString(errorName);
if (hashCode == INTERNAL_SERVER_HASH)
{
return AWSError<CoreErrors>(static_cast<CoreErrors>(ApplicationInsightsErrors::INTERNAL_SERVER), false);
}
else if (hashCode == TAGS_ALREADY_EXIST_HASH)
{
return AWSError<CoreErrors>(static_cast<CoreErrors>(ApplicationInsightsErrors::TAGS_ALREADY_EXIST), false);
}
else if (hashCode == TOO_MANY_TAGS_HASH)
{
return AWSError<CoreErrors>(static_cast<CoreErrors>(ApplicationInsightsErrors::TOO_MANY_TAGS), false);
}
else if (hashCode == RESOURCE_IN_USE_HASH)
{
return AWSError<CoreErrors>(static_cast<CoreErrors>(ApplicationInsightsErrors::RESOURCE_IN_USE), false);
}
else if (hashCode == BAD_REQUEST_HASH)
{
return AWSError<CoreErrors>(static_cast<CoreErrors>(ApplicationInsightsErrors::BAD_REQUEST), false);
}
return AWSError<CoreErrors>(CoreErrors::UNKNOWN, false);
}
} // namespace ApplicationInsightsErrorMapper
} // namespace ApplicationInsights
} // namespace Aws