113 lines
2.3 KiB
C++
113 lines
2.3 KiB
C++
/**
|
|
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
* SPDX-License-Identifier: Apache-2.0.
|
|
*/
|
|
|
|
#include <aws/ssm/model/InventoryItemSchema.h>
|
|
#include <aws/core/utils/json/JsonSerializer.h>
|
|
|
|
#include <utility>
|
|
|
|
using namespace Aws::Utils::Json;
|
|
using namespace Aws::Utils;
|
|
|
|
namespace Aws
|
|
{
|
|
namespace SSM
|
|
{
|
|
namespace Model
|
|
{
|
|
|
|
InventoryItemSchema::InventoryItemSchema() :
|
|
m_typeNameHasBeenSet(false),
|
|
m_versionHasBeenSet(false),
|
|
m_attributesHasBeenSet(false),
|
|
m_displayNameHasBeenSet(false)
|
|
{
|
|
}
|
|
|
|
InventoryItemSchema::InventoryItemSchema(JsonView jsonValue) :
|
|
m_typeNameHasBeenSet(false),
|
|
m_versionHasBeenSet(false),
|
|
m_attributesHasBeenSet(false),
|
|
m_displayNameHasBeenSet(false)
|
|
{
|
|
*this = jsonValue;
|
|
}
|
|
|
|
InventoryItemSchema& InventoryItemSchema::operator =(JsonView jsonValue)
|
|
{
|
|
if(jsonValue.ValueExists("TypeName"))
|
|
{
|
|
m_typeName = jsonValue.GetString("TypeName");
|
|
|
|
m_typeNameHasBeenSet = true;
|
|
}
|
|
|
|
if(jsonValue.ValueExists("Version"))
|
|
{
|
|
m_version = jsonValue.GetString("Version");
|
|
|
|
m_versionHasBeenSet = true;
|
|
}
|
|
|
|
if(jsonValue.ValueExists("Attributes"))
|
|
{
|
|
Array<JsonView> attributesJsonList = jsonValue.GetArray("Attributes");
|
|
for(unsigned attributesIndex = 0; attributesIndex < attributesJsonList.GetLength(); ++attributesIndex)
|
|
{
|
|
m_attributes.push_back(attributesJsonList[attributesIndex].AsObject());
|
|
}
|
|
m_attributesHasBeenSet = true;
|
|
}
|
|
|
|
if(jsonValue.ValueExists("DisplayName"))
|
|
{
|
|
m_displayName = jsonValue.GetString("DisplayName");
|
|
|
|
m_displayNameHasBeenSet = true;
|
|
}
|
|
|
|
return *this;
|
|
}
|
|
|
|
JsonValue InventoryItemSchema::Jsonize() const
|
|
{
|
|
JsonValue payload;
|
|
|
|
if(m_typeNameHasBeenSet)
|
|
{
|
|
payload.WithString("TypeName", m_typeName);
|
|
|
|
}
|
|
|
|
if(m_versionHasBeenSet)
|
|
{
|
|
payload.WithString("Version", m_version);
|
|
|
|
}
|
|
|
|
if(m_attributesHasBeenSet)
|
|
{
|
|
Array<JsonValue> attributesJsonList(m_attributes.size());
|
|
for(unsigned attributesIndex = 0; attributesIndex < attributesJsonList.GetLength(); ++attributesIndex)
|
|
{
|
|
attributesJsonList[attributesIndex].AsObject(m_attributes[attributesIndex].Jsonize());
|
|
}
|
|
payload.WithArray("Attributes", std::move(attributesJsonList));
|
|
|
|
}
|
|
|
|
if(m_displayNameHasBeenSet)
|
|
{
|
|
payload.WithString("DisplayName", m_displayName);
|
|
|
|
}
|
|
|
|
return payload;
|
|
}
|
|
|
|
} // namespace Model
|
|
} // namespace SSM
|
|
} // namespace Aws
|