116 lines
2.9 KiB
C++
116 lines
2.9 KiB
C++
/**
|
|
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
* SPDX-License-Identifier: Apache-2.0.
|
|
*/
|
|
|
|
#include <aws/wafv2/model/SizeConstraintStatement.h>
|
|
#include <aws/core/utils/json/JsonSerializer.h>
|
|
|
|
#include <utility>
|
|
|
|
using namespace Aws::Utils::Json;
|
|
using namespace Aws::Utils;
|
|
|
|
namespace Aws
|
|
{
|
|
namespace WAFV2
|
|
{
|
|
namespace Model
|
|
{
|
|
|
|
SizeConstraintStatement::SizeConstraintStatement() :
|
|
m_fieldToMatchHasBeenSet(false),
|
|
m_comparisonOperator(ComparisonOperator::NOT_SET),
|
|
m_comparisonOperatorHasBeenSet(false),
|
|
m_size(0),
|
|
m_sizeHasBeenSet(false),
|
|
m_textTransformationsHasBeenSet(false)
|
|
{
|
|
}
|
|
|
|
SizeConstraintStatement::SizeConstraintStatement(JsonView jsonValue) :
|
|
m_fieldToMatchHasBeenSet(false),
|
|
m_comparisonOperator(ComparisonOperator::NOT_SET),
|
|
m_comparisonOperatorHasBeenSet(false),
|
|
m_size(0),
|
|
m_sizeHasBeenSet(false),
|
|
m_textTransformationsHasBeenSet(false)
|
|
{
|
|
*this = jsonValue;
|
|
}
|
|
|
|
SizeConstraintStatement& SizeConstraintStatement::operator =(JsonView jsonValue)
|
|
{
|
|
if(jsonValue.ValueExists("FieldToMatch"))
|
|
{
|
|
m_fieldToMatch = jsonValue.GetObject("FieldToMatch");
|
|
|
|
m_fieldToMatchHasBeenSet = true;
|
|
}
|
|
|
|
if(jsonValue.ValueExists("ComparisonOperator"))
|
|
{
|
|
m_comparisonOperator = ComparisonOperatorMapper::GetComparisonOperatorForName(jsonValue.GetString("ComparisonOperator"));
|
|
|
|
m_comparisonOperatorHasBeenSet = true;
|
|
}
|
|
|
|
if(jsonValue.ValueExists("Size"))
|
|
{
|
|
m_size = jsonValue.GetInt64("Size");
|
|
|
|
m_sizeHasBeenSet = true;
|
|
}
|
|
|
|
if(jsonValue.ValueExists("TextTransformations"))
|
|
{
|
|
Array<JsonView> textTransformationsJsonList = jsonValue.GetArray("TextTransformations");
|
|
for(unsigned textTransformationsIndex = 0; textTransformationsIndex < textTransformationsJsonList.GetLength(); ++textTransformationsIndex)
|
|
{
|
|
m_textTransformations.push_back(textTransformationsJsonList[textTransformationsIndex].AsObject());
|
|
}
|
|
m_textTransformationsHasBeenSet = true;
|
|
}
|
|
|
|
return *this;
|
|
}
|
|
|
|
JsonValue SizeConstraintStatement::Jsonize() const
|
|
{
|
|
JsonValue payload;
|
|
|
|
if(m_fieldToMatchHasBeenSet)
|
|
{
|
|
payload.WithObject("FieldToMatch", m_fieldToMatch.Jsonize());
|
|
|
|
}
|
|
|
|
if(m_comparisonOperatorHasBeenSet)
|
|
{
|
|
payload.WithString("ComparisonOperator", ComparisonOperatorMapper::GetNameForComparisonOperator(m_comparisonOperator));
|
|
}
|
|
|
|
if(m_sizeHasBeenSet)
|
|
{
|
|
payload.WithInt64("Size", m_size);
|
|
|
|
}
|
|
|
|
if(m_textTransformationsHasBeenSet)
|
|
{
|
|
Array<JsonValue> textTransformationsJsonList(m_textTransformations.size());
|
|
for(unsigned textTransformationsIndex = 0; textTransformationsIndex < textTransformationsJsonList.GetLength(); ++textTransformationsIndex)
|
|
{
|
|
textTransformationsJsonList[textTransformationsIndex].AsObject(m_textTransformations[textTransformationsIndex].Jsonize());
|
|
}
|
|
payload.WithArray("TextTransformations", std::move(textTransformationsJsonList));
|
|
|
|
}
|
|
|
|
return payload;
|
|
}
|
|
|
|
} // namespace Model
|
|
} // namespace WAFV2
|
|
} // namespace Aws
|