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-compute-optimizer/source/model/UtilizationMetric.cpp

94 lines
1.9 KiB
C++

/**
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
* SPDX-License-Identifier: Apache-2.0.
*/
#include <aws/compute-optimizer/model/UtilizationMetric.h>
#include <aws/core/utils/json/JsonSerializer.h>
#include <utility>
using namespace Aws::Utils::Json;
using namespace Aws::Utils;
namespace Aws
{
namespace ComputeOptimizer
{
namespace Model
{
UtilizationMetric::UtilizationMetric() :
m_name(MetricName::NOT_SET),
m_nameHasBeenSet(false),
m_statistic(MetricStatistic::NOT_SET),
m_statisticHasBeenSet(false),
m_value(0.0),
m_valueHasBeenSet(false)
{
}
UtilizationMetric::UtilizationMetric(JsonView jsonValue) :
m_name(MetricName::NOT_SET),
m_nameHasBeenSet(false),
m_statistic(MetricStatistic::NOT_SET),
m_statisticHasBeenSet(false),
m_value(0.0),
m_valueHasBeenSet(false)
{
*this = jsonValue;
}
UtilizationMetric& UtilizationMetric::operator =(JsonView jsonValue)
{
if(jsonValue.ValueExists("name"))
{
m_name = MetricNameMapper::GetMetricNameForName(jsonValue.GetString("name"));
m_nameHasBeenSet = true;
}
if(jsonValue.ValueExists("statistic"))
{
m_statistic = MetricStatisticMapper::GetMetricStatisticForName(jsonValue.GetString("statistic"));
m_statisticHasBeenSet = true;
}
if(jsonValue.ValueExists("value"))
{
m_value = jsonValue.GetDouble("value");
m_valueHasBeenSet = true;
}
return *this;
}
JsonValue UtilizationMetric::Jsonize() const
{
JsonValue payload;
if(m_nameHasBeenSet)
{
payload.WithString("name", MetricNameMapper::GetNameForMetricName(m_name));
}
if(m_statisticHasBeenSet)
{
payload.WithString("statistic", MetricStatisticMapper::GetNameForMetricStatistic(m_statistic));
}
if(m_valueHasBeenSet)
{
payload.WithDouble("value", m_value);
}
return payload;
}
} // namespace Model
} // namespace ComputeOptimizer
} // namespace Aws