106 lines
2.6 KiB
C++
106 lines
2.6 KiB
C++
/**
|
|
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
* SPDX-License-Identifier: Apache-2.0.
|
|
*/
|
|
|
|
#include <aws/elasticmapreduce/model/Configuration.h>
|
|
#include <aws/core/utils/json/JsonSerializer.h>
|
|
|
|
#include <utility>
|
|
|
|
using namespace Aws::Utils::Json;
|
|
using namespace Aws::Utils;
|
|
|
|
namespace Aws
|
|
{
|
|
namespace EMR
|
|
{
|
|
namespace Model
|
|
{
|
|
|
|
Configuration::Configuration() :
|
|
m_classificationHasBeenSet(false),
|
|
m_configurationsHasBeenSet(false),
|
|
m_propertiesHasBeenSet(false)
|
|
{
|
|
}
|
|
|
|
Configuration::Configuration(JsonView jsonValue) :
|
|
m_classificationHasBeenSet(false),
|
|
m_configurationsHasBeenSet(false),
|
|
m_propertiesHasBeenSet(false)
|
|
{
|
|
*this = jsonValue;
|
|
}
|
|
|
|
Configuration& Configuration::operator =(JsonView jsonValue)
|
|
{
|
|
if(jsonValue.ValueExists("Classification"))
|
|
{
|
|
m_classification = jsonValue.GetString("Classification");
|
|
|
|
m_classificationHasBeenSet = true;
|
|
}
|
|
|
|
if(jsonValue.ValueExists("Configurations"))
|
|
{
|
|
Array<JsonView> configurationsJsonList = jsonValue.GetArray("Configurations");
|
|
for(unsigned configurationsIndex = 0; configurationsIndex < configurationsJsonList.GetLength(); ++configurationsIndex)
|
|
{
|
|
m_configurations.push_back(configurationsJsonList[configurationsIndex].AsObject());
|
|
}
|
|
m_configurationsHasBeenSet = true;
|
|
}
|
|
|
|
if(jsonValue.ValueExists("Properties"))
|
|
{
|
|
Aws::Map<Aws::String, JsonView> propertiesJsonMap = jsonValue.GetObject("Properties").GetAllObjects();
|
|
for(auto& propertiesItem : propertiesJsonMap)
|
|
{
|
|
m_properties[propertiesItem.first] = propertiesItem.second.AsString();
|
|
}
|
|
m_propertiesHasBeenSet = true;
|
|
}
|
|
|
|
return *this;
|
|
}
|
|
|
|
JsonValue Configuration::Jsonize() const
|
|
{
|
|
JsonValue payload;
|
|
|
|
if(m_classificationHasBeenSet)
|
|
{
|
|
payload.WithString("Classification", m_classification);
|
|
|
|
}
|
|
|
|
if(m_configurationsHasBeenSet)
|
|
{
|
|
Array<JsonValue> configurationsJsonList(m_configurations.size());
|
|
for(unsigned configurationsIndex = 0; configurationsIndex < configurationsJsonList.GetLength(); ++configurationsIndex)
|
|
{
|
|
configurationsJsonList[configurationsIndex].AsObject(m_configurations[configurationsIndex].Jsonize());
|
|
}
|
|
payload.WithArray("Configurations", std::move(configurationsJsonList));
|
|
|
|
}
|
|
|
|
if(m_propertiesHasBeenSet)
|
|
{
|
|
JsonValue propertiesJsonMap;
|
|
for(auto& propertiesItem : m_properties)
|
|
{
|
|
propertiesJsonMap.WithString(propertiesItem.first, propertiesItem.second);
|
|
}
|
|
payload.WithObject("Properties", std::move(propertiesJsonMap));
|
|
|
|
}
|
|
|
|
return payload;
|
|
}
|
|
|
|
} // namespace Model
|
|
} // namespace EMR
|
|
} // namespace Aws
|