/** * 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::MigrationHubRefactorSpaces::Model; using namespace Aws::Utils::Json; using namespace Aws::Utils; using namespace Aws; GetEnvironmentResult::GetEnvironmentResult() : m_networkFabricType(NetworkFabricType::NOT_SET), m_state(EnvironmentState::NOT_SET) { } GetEnvironmentResult::GetEnvironmentResult(const Aws::AmazonWebServiceResult& result) : m_networkFabricType(NetworkFabricType::NOT_SET), m_state(EnvironmentState::NOT_SET) { *this = result; } GetEnvironmentResult& GetEnvironmentResult::operator =(const Aws::AmazonWebServiceResult& result) { JsonView jsonValue = result.GetPayload().View(); if(jsonValue.ValueExists("Arn")) { m_arn = jsonValue.GetString("Arn"); } if(jsonValue.ValueExists("CreatedTime")) { m_createdTime = jsonValue.GetDouble("CreatedTime"); } if(jsonValue.ValueExists("Description")) { m_description = jsonValue.GetString("Description"); } if(jsonValue.ValueExists("EnvironmentId")) { m_environmentId = jsonValue.GetString("EnvironmentId"); } if(jsonValue.ValueExists("Error")) { m_error = jsonValue.GetObject("Error"); } if(jsonValue.ValueExists("LastUpdatedTime")) { m_lastUpdatedTime = jsonValue.GetDouble("LastUpdatedTime"); } if(jsonValue.ValueExists("Name")) { m_name = jsonValue.GetString("Name"); } if(jsonValue.ValueExists("NetworkFabricType")) { m_networkFabricType = NetworkFabricTypeMapper::GetNetworkFabricTypeForName(jsonValue.GetString("NetworkFabricType")); } if(jsonValue.ValueExists("OwnerAccountId")) { m_ownerAccountId = jsonValue.GetString("OwnerAccountId"); } if(jsonValue.ValueExists("State")) { m_state = EnvironmentStateMapper::GetEnvironmentStateForName(jsonValue.GetString("State")); } if(jsonValue.ValueExists("Tags")) { Aws::Map tagsJsonMap = jsonValue.GetObject("Tags").GetAllObjects(); for(auto& tagsItem : tagsJsonMap) { m_tags[tagsItem.first] = tagsItem.second.AsString(); } } if(jsonValue.ValueExists("TransitGatewayId")) { m_transitGatewayId = jsonValue.GetString("TransitGatewayId"); } const auto& headers = result.GetHeaderValueCollection(); const auto& requestIdIter = headers.find("x-amzn-requestid"); if(requestIdIter != headers.end()) { m_requestId = requestIdIter->second; } return *this; }