76 lines
1.3 KiB
C++
76 lines
1.3 KiB
C++
/**
|
|
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
* SPDX-License-Identifier: Apache-2.0.
|
|
*/
|
|
|
|
#include <aws/autoscaling-plans/model/Datapoint.h>
|
|
#include <aws/core/utils/json/JsonSerializer.h>
|
|
|
|
#include <utility>
|
|
|
|
using namespace Aws::Utils::Json;
|
|
using namespace Aws::Utils;
|
|
|
|
namespace Aws
|
|
{
|
|
namespace AutoScalingPlans
|
|
{
|
|
namespace Model
|
|
{
|
|
|
|
Datapoint::Datapoint() :
|
|
m_timestampHasBeenSet(false),
|
|
m_value(0.0),
|
|
m_valueHasBeenSet(false)
|
|
{
|
|
}
|
|
|
|
Datapoint::Datapoint(JsonView jsonValue) :
|
|
m_timestampHasBeenSet(false),
|
|
m_value(0.0),
|
|
m_valueHasBeenSet(false)
|
|
{
|
|
*this = jsonValue;
|
|
}
|
|
|
|
Datapoint& Datapoint::operator =(JsonView jsonValue)
|
|
{
|
|
if(jsonValue.ValueExists("Timestamp"))
|
|
{
|
|
m_timestamp = jsonValue.GetDouble("Timestamp");
|
|
|
|
m_timestampHasBeenSet = true;
|
|
}
|
|
|
|
if(jsonValue.ValueExists("Value"))
|
|
{
|
|
m_value = jsonValue.GetDouble("Value");
|
|
|
|
m_valueHasBeenSet = true;
|
|
}
|
|
|
|
return *this;
|
|
}
|
|
|
|
JsonValue Datapoint::Jsonize() const
|
|
{
|
|
JsonValue payload;
|
|
|
|
if(m_timestampHasBeenSet)
|
|
{
|
|
payload.WithDouble("Timestamp", m_timestamp.SecondsWithMSPrecision());
|
|
}
|
|
|
|
if(m_valueHasBeenSet)
|
|
{
|
|
payload.WithDouble("Value", m_value);
|
|
|
|
}
|
|
|
|
return payload;
|
|
}
|
|
|
|
} // namespace Model
|
|
} // namespace AutoScalingPlans
|
|
} // namespace Aws
|