84 lines
1.9 KiB
C++
84 lines
1.9 KiB
C++
|
|
/**
|
|||
|
|
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|||
|
|
* SPDX-License-Identifier: Apache-2.0.
|
|||
|
|
*/
|
|||
|
|
|
|||
|
|
#include <aws/pinpoint/model/Condition.h>
|
|||
|
|
#include <aws/core/utils/json/JsonSerializer.h>
|
|||
|
|
|
|||
|
|
#include <utility>
|
|||
|
|
|
|||
|
|
using namespace Aws::Utils::Json;
|
|||
|
|
using namespace Aws::Utils;
|
|||
|
|
|
|||
|
|
namespace Aws
|
|||
|
|
{
|
|||
|
|
namespace Pinpoint
|
|||
|
|
{
|
|||
|
|
namespace Model
|
|||
|
|
{
|
|||
|
|
|
|||
|
|
Condition::Condition() :
|
|||
|
|
m_conditionsHasBeenSet(false),
|
|||
|
|
m_operator(Operator::NOT_SET),
|
|||
|
|
m_operatorHasBeenSet(false)
|
|||
|
|
{
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
Condition::Condition(JsonView jsonValue) :
|
|||
|
|
m_conditionsHasBeenSet(false),
|
|||
|
|
m_operator(Operator::NOT_SET),
|
|||
|
|
m_operatorHasBeenSet(false)
|
|||
|
|
{
|
|||
|
|
*this = jsonValue;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
Condition& Condition::operator =(JsonView jsonValue)
|
|||
|
|
{
|
|||
|
|
if(jsonValue.ValueExists("Conditions"))
|
|||
|
|
{
|
|||
|
|
Array<JsonView> conditionsJsonList = jsonValue.GetArray("Conditions");
|
|||
|
|
for(unsigned conditionsIndex = 0; conditionsIndex < conditionsJsonList.GetLength(); ++conditionsIndex)
|
|||
|
|
{
|
|||
|
|
m_conditions.push_back(conditionsJsonList[conditionsIndex].AsObject());
|
|||
|
|
}
|
|||
|
|
m_conditionsHasBeenSet = true;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
if(jsonValue.ValueExists("Operator"))
|
|||
|
|
{
|
|||
|
|
m_operator = OperatorMapper::GetOperatorForName(jsonValue.GetString("Operator"));
|
|||
|
|
|
|||
|
|
m_operatorHasBeenSet = true;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
return *this;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
JsonValue Condition::Jsonize() const
|
|||
|
|
{
|
|||
|
|
JsonValue payload;
|
|||
|
|
|
|||
|
|
if(m_conditionsHasBeenSet)
|
|||
|
|
{
|
|||
|
|
Array<JsonValue> conditionsJsonList(m_conditions.size());
|
|||
|
|
for(unsigned conditionsIndex = 0; conditionsIndex < conditionsJsonList.GetLength(); ++conditionsIndex)
|
|||
|
|
{
|
|||
|
|
conditionsJsonList[conditionsIndex].AsObject(m_conditions[conditionsIndex].Jsonize());
|
|||
|
|
}
|
|||
|
|
payload.WithArray("Conditions", std::move(conditionsJsonList));
|
|||
|
|
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
if(m_operatorHasBeenSet)
|
|||
|
|
{
|
|||
|
|
payload.WithString("Operator", OperatorMapper::GetNameForOperator(m_operator));
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
return payload;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
} // namespace Model
|
|||
|
|
} // namespace Pinpoint
|
|||
|
|
} // namespace Aws
|