/** * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. * SPDX-License-Identifier: Apache-2.0. */ #include #include #include using namespace Aws::Utils::Json; using namespace Aws::Utils; namespace Aws { namespace IoT { namespace Model { ThingAttribute::ThingAttribute() : m_thingNameHasBeenSet(false), m_thingTypeNameHasBeenSet(false), m_thingArnHasBeenSet(false), m_attributesHasBeenSet(false), m_version(0), m_versionHasBeenSet(false) { } ThingAttribute::ThingAttribute(JsonView jsonValue) : m_thingNameHasBeenSet(false), m_thingTypeNameHasBeenSet(false), m_thingArnHasBeenSet(false), m_attributesHasBeenSet(false), m_version(0), m_versionHasBeenSet(false) { *this = jsonValue; } ThingAttribute& ThingAttribute::operator =(JsonView jsonValue) { if(jsonValue.ValueExists("thingName")) { m_thingName = jsonValue.GetString("thingName"); m_thingNameHasBeenSet = true; } if(jsonValue.ValueExists("thingTypeName")) { m_thingTypeName = jsonValue.GetString("thingTypeName"); m_thingTypeNameHasBeenSet = true; } if(jsonValue.ValueExists("thingArn")) { m_thingArn = jsonValue.GetString("thingArn"); m_thingArnHasBeenSet = true; } if(jsonValue.ValueExists("attributes")) { Aws::Map attributesJsonMap = jsonValue.GetObject("attributes").GetAllObjects(); for(auto& attributesItem : attributesJsonMap) { m_attributes[attributesItem.first] = attributesItem.second.AsString(); } m_attributesHasBeenSet = true; } if(jsonValue.ValueExists("version")) { m_version = jsonValue.GetInt64("version"); m_versionHasBeenSet = true; } return *this; } JsonValue ThingAttribute::Jsonize() const { JsonValue payload; if(m_thingNameHasBeenSet) { payload.WithString("thingName", m_thingName); } if(m_thingTypeNameHasBeenSet) { payload.WithString("thingTypeName", m_thingTypeName); } if(m_thingArnHasBeenSet) { payload.WithString("thingArn", m_thingArn); } if(m_attributesHasBeenSet) { JsonValue attributesJsonMap; for(auto& attributesItem : m_attributes) { attributesJsonMap.WithString(attributesItem.first, attributesItem.second); } payload.WithObject("attributes", std::move(attributesJsonMap)); } if(m_versionHasBeenSet) { payload.WithInt64("version", m_version); } return payload; } } // namespace Model } // namespace IoT } // namespace Aws