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/ce/model/DimensionValuesWithAttributes.h>
|
|
#include <aws/core/utils/json/JsonSerializer.h>
|
|
|
|
#include <utility>
|
|
|
|
using namespace Aws::Utils::Json;
|
|
using namespace Aws::Utils;
|
|
|
|
namespace Aws
|
|
{
|
|
namespace CostExplorer
|
|
{
|
|
namespace Model
|
|
{
|
|
|
|
DimensionValuesWithAttributes::DimensionValuesWithAttributes() :
|
|
m_valueHasBeenSet(false),
|
|
m_attributesHasBeenSet(false)
|
|
{
|
|
}
|
|
|
|
DimensionValuesWithAttributes::DimensionValuesWithAttributes(JsonView jsonValue) :
|
|
m_valueHasBeenSet(false),
|
|
m_attributesHasBeenSet(false)
|
|
{
|
|
*this = jsonValue;
|
|
}
|
|
|
|
DimensionValuesWithAttributes& DimensionValuesWithAttributes::operator =(JsonView jsonValue)
|
|
{
|
|
if(jsonValue.ValueExists("Value"))
|
|
{
|
|
m_value = jsonValue.GetString("Value");
|
|
|
|
m_valueHasBeenSet = true;
|
|
}
|
|
|
|
if(jsonValue.ValueExists("Attributes"))
|
|
{
|
|
Aws::Map<Aws::String, JsonView> attributesJsonMap = jsonValue.GetObject("Attributes").GetAllObjects();
|
|
for(auto& attributesItem : attributesJsonMap)
|
|
{
|
|
m_attributes[attributesItem.first] = attributesItem.second.AsString();
|
|
}
|
|
m_attributesHasBeenSet = true;
|
|
}
|
|
|
|
return *this;
|
|
}
|
|
|
|
JsonValue DimensionValuesWithAttributes::Jsonize() const
|
|
{
|
|
JsonValue payload;
|
|
|
|
if(m_valueHasBeenSet)
|
|
{
|
|
payload.WithString("Value", m_value);
|
|
|
|
}
|
|
|
|
if(m_attributesHasBeenSet)
|
|
{
|
|
JsonValue attributesJsonMap;
|
|
for(auto& attributesItem : m_attributes)
|
|
{
|
|
attributesJsonMap.WithString(attributesItem.first, attributesItem.second);
|
|
}
|
|
payload.WithObject("Attributes", std::move(attributesJsonMap));
|
|
|
|
}
|
|
|
|
return payload;
|
|
}
|
|
|
|
} // namespace Model
|
|
} // namespace CostExplorer
|
|
} // namespace Aws
|