71 lines
1.9 KiB
C++
71 lines
1.9 KiB
C++
/**
|
|
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
* SPDX-License-Identifier: Apache-2.0.
|
|
*/
|
|
|
|
#include <aws/waf/model/ChangeAction.h>
|
|
#include <aws/core/utils/HashingUtils.h>
|
|
#include <aws/core/Globals.h>
|
|
#include <aws/core/utils/EnumParseOverflowContainer.h>
|
|
|
|
using namespace Aws::Utils;
|
|
|
|
|
|
namespace Aws
|
|
{
|
|
namespace WAF
|
|
{
|
|
namespace Model
|
|
{
|
|
namespace ChangeActionMapper
|
|
{
|
|
|
|
static const int INSERT_HASH = HashingUtils::HashString("INSERT");
|
|
static const int DELETE__HASH = HashingUtils::HashString("DELETE");
|
|
|
|
|
|
ChangeAction GetChangeActionForName(const Aws::String& name)
|
|
{
|
|
int hashCode = HashingUtils::HashString(name.c_str());
|
|
if (hashCode == INSERT_HASH)
|
|
{
|
|
return ChangeAction::INSERT;
|
|
}
|
|
else if (hashCode == DELETE__HASH)
|
|
{
|
|
return ChangeAction::DELETE_;
|
|
}
|
|
EnumParseOverflowContainer* overflowContainer = Aws::GetEnumOverflowContainer();
|
|
if(overflowContainer)
|
|
{
|
|
overflowContainer->StoreOverflow(hashCode, name);
|
|
return static_cast<ChangeAction>(hashCode);
|
|
}
|
|
|
|
return ChangeAction::NOT_SET;
|
|
}
|
|
|
|
Aws::String GetNameForChangeAction(ChangeAction enumValue)
|
|
{
|
|
switch(enumValue)
|
|
{
|
|
case ChangeAction::INSERT:
|
|
return "INSERT";
|
|
case ChangeAction::DELETE_:
|
|
return "DELETE";
|
|
default:
|
|
EnumParseOverflowContainer* overflowContainer = Aws::GetEnumOverflowContainer();
|
|
if(overflowContainer)
|
|
{
|
|
return overflowContainer->RetrieveOverflow(static_cast<int>(enumValue));
|
|
}
|
|
|
|
return {};
|
|
}
|
|
}
|
|
|
|
} // namespace ChangeActionMapper
|
|
} // namespace Model
|
|
} // namespace WAF
|
|
} // namespace Aws
|