83 lines
1.7 KiB
C++
83 lines
1.7 KiB
C++
/**
|
|
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
* SPDX-License-Identifier: Apache-2.0.
|
|
*/
|
|
|
|
#include <aws/pi/model/ResponseResourceMetricKey.h>
|
|
#include <aws/core/utils/json/JsonSerializer.h>
|
|
|
|
#include <utility>
|
|
|
|
using namespace Aws::Utils::Json;
|
|
using namespace Aws::Utils;
|
|
|
|
namespace Aws
|
|
{
|
|
namespace PI
|
|
{
|
|
namespace Model
|
|
{
|
|
|
|
ResponseResourceMetricKey::ResponseResourceMetricKey() :
|
|
m_metricHasBeenSet(false),
|
|
m_dimensionsHasBeenSet(false)
|
|
{
|
|
}
|
|
|
|
ResponseResourceMetricKey::ResponseResourceMetricKey(JsonView jsonValue) :
|
|
m_metricHasBeenSet(false),
|
|
m_dimensionsHasBeenSet(false)
|
|
{
|
|
*this = jsonValue;
|
|
}
|
|
|
|
ResponseResourceMetricKey& ResponseResourceMetricKey::operator =(JsonView jsonValue)
|
|
{
|
|
if(jsonValue.ValueExists("Metric"))
|
|
{
|
|
m_metric = jsonValue.GetString("Metric");
|
|
|
|
m_metricHasBeenSet = true;
|
|
}
|
|
|
|
if(jsonValue.ValueExists("Dimensions"))
|
|
{
|
|
Aws::Map<Aws::String, JsonView> dimensionsJsonMap = jsonValue.GetObject("Dimensions").GetAllObjects();
|
|
for(auto& dimensionsItem : dimensionsJsonMap)
|
|
{
|
|
m_dimensions[dimensionsItem.first] = dimensionsItem.second.AsString();
|
|
}
|
|
m_dimensionsHasBeenSet = true;
|
|
}
|
|
|
|
return *this;
|
|
}
|
|
|
|
JsonValue ResponseResourceMetricKey::Jsonize() const
|
|
{
|
|
JsonValue payload;
|
|
|
|
if(m_metricHasBeenSet)
|
|
{
|
|
payload.WithString("Metric", m_metric);
|
|
|
|
}
|
|
|
|
if(m_dimensionsHasBeenSet)
|
|
{
|
|
JsonValue dimensionsJsonMap;
|
|
for(auto& dimensionsItem : m_dimensions)
|
|
{
|
|
dimensionsJsonMap.WithString(dimensionsItem.first, dimensionsItem.second);
|
|
}
|
|
payload.WithObject("Dimensions", std::move(dimensionsJsonMap));
|
|
|
|
}
|
|
|
|
return payload;
|
|
}
|
|
|
|
} // namespace Model
|
|
} // namespace PI
|
|
} // namespace Aws
|