/** * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. * SPDX-License-Identifier: Apache-2.0. */ #include #include #include #include #include #include #include using namespace Aws::IoTTwinMaker::Model; using namespace Aws::Utils::Json; using namespace Aws::Utils; using namespace Aws; GetEntityResult::GetEntityResult() : m_hasChildEntities(false) { } GetEntityResult::GetEntityResult(const Aws::AmazonWebServiceResult& result) : m_hasChildEntities(false) { *this = result; } GetEntityResult& GetEntityResult::operator =(const Aws::AmazonWebServiceResult& result) { JsonView jsonValue = result.GetPayload().View(); if(jsonValue.ValueExists("entityId")) { m_entityId = jsonValue.GetString("entityId"); } if(jsonValue.ValueExists("entityName")) { m_entityName = jsonValue.GetString("entityName"); } if(jsonValue.ValueExists("arn")) { m_arn = jsonValue.GetString("arn"); } if(jsonValue.ValueExists("status")) { m_status = jsonValue.GetObject("status"); } if(jsonValue.ValueExists("workspaceId")) { m_workspaceId = jsonValue.GetString("workspaceId"); } if(jsonValue.ValueExists("description")) { m_description = jsonValue.GetString("description"); } if(jsonValue.ValueExists("components")) { Aws::Map componentsJsonMap = jsonValue.GetObject("components").GetAllObjects(); for(auto& componentsItem : componentsJsonMap) { m_components[componentsItem.first] = componentsItem.second.AsObject(); } } if(jsonValue.ValueExists("parentEntityId")) { m_parentEntityId = jsonValue.GetString("parentEntityId"); } if(jsonValue.ValueExists("hasChildEntities")) { m_hasChildEntities = jsonValue.GetBool("hasChildEntities"); } if(jsonValue.ValueExists("creationDateTime")) { m_creationDateTime = jsonValue.GetDouble("creationDateTime"); } if(jsonValue.ValueExists("updateDateTime")) { m_updateDateTime = jsonValue.GetDouble("updateDateTime"); } if(jsonValue.ValueExists("syncSource")) { m_syncSource = jsonValue.GetString("syncSource"); } const auto& headers = result.GetHeaderValueCollection(); const auto& requestIdIter = headers.find("x-amzn-requestid"); if(requestIdIter != headers.end()) { m_requestId = requestIdIter->second; } return *this; }