/** * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. * SPDX-License-Identifier: Apache-2.0. */ #include <aws/iotsitewise/model/AssetModelCompositeModelDefinition.h> #include <aws/core/utils/json/JsonSerializer.h> #include <utility> using namespace Aws::Utils::Json; using namespace Aws::Utils; namespace Aws { namespace IoTSiteWise { namespace Model { AssetModelCompositeModelDefinition::AssetModelCompositeModelDefinition() : m_nameHasBeenSet(false), m_descriptionHasBeenSet(false), m_typeHasBeenSet(false), m_propertiesHasBeenSet(false) { } AssetModelCompositeModelDefinition::AssetModelCompositeModelDefinition(JsonView jsonValue) : m_nameHasBeenSet(false), m_descriptionHasBeenSet(false), m_typeHasBeenSet(false), m_propertiesHasBeenSet(false) { *this = jsonValue; } AssetModelCompositeModelDefinition& AssetModelCompositeModelDefinition::operator =(JsonView jsonValue) { if(jsonValue.ValueExists("name")) { m_name = jsonValue.GetString("name"); m_nameHasBeenSet = true; } if(jsonValue.ValueExists("description")) { m_description = jsonValue.GetString("description"); m_descriptionHasBeenSet = true; } if(jsonValue.ValueExists("type")) { m_type = jsonValue.GetString("type"); m_typeHasBeenSet = true; } if(jsonValue.ValueExists("properties")) { Aws::Utils::Array<JsonView> propertiesJsonList = jsonValue.GetArray("properties"); for(unsigned propertiesIndex = 0; propertiesIndex < propertiesJsonList.GetLength(); ++propertiesIndex) { m_properties.push_back(propertiesJsonList[propertiesIndex].AsObject()); } m_propertiesHasBeenSet = true; } return *this; } JsonValue AssetModelCompositeModelDefinition::Jsonize() const { JsonValue payload; if(m_nameHasBeenSet) { payload.WithString("name", m_name); } if(m_descriptionHasBeenSet) { payload.WithString("description", m_description); } if(m_typeHasBeenSet) { payload.WithString("type", m_type); } if(m_propertiesHasBeenSet) { Aws::Utils::Array<JsonValue> propertiesJsonList(m_properties.size()); for(unsigned propertiesIndex = 0; propertiesIndex < propertiesJsonList.GetLength(); ++propertiesIndex) { propertiesJsonList[propertiesIndex].AsObject(m_properties[propertiesIndex].Jsonize()); } payload.WithArray("properties", std::move(propertiesJsonList)); } return payload; } } // namespace Model } // namespace IoTSiteWise } // namespace Aws