/** * 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::AppConfig::Model; using namespace Aws::Utils::Json; using namespace Aws::Utils; using namespace Aws; GetExtensionResult::GetExtensionResult() : m_versionNumber(0) { } GetExtensionResult::GetExtensionResult(const Aws::AmazonWebServiceResult& result) : m_versionNumber(0) { *this = result; } GetExtensionResult& GetExtensionResult::operator =(const Aws::AmazonWebServiceResult& result) { JsonView jsonValue = result.GetPayload().View(); if(jsonValue.ValueExists("Id")) { m_id = jsonValue.GetString("Id"); } if(jsonValue.ValueExists("Name")) { m_name = jsonValue.GetString("Name"); } if(jsonValue.ValueExists("VersionNumber")) { m_versionNumber = jsonValue.GetInteger("VersionNumber"); } if(jsonValue.ValueExists("Arn")) { m_arn = jsonValue.GetString("Arn"); } if(jsonValue.ValueExists("Description")) { m_description = jsonValue.GetString("Description"); } if(jsonValue.ValueExists("Actions")) { Aws::Map actionsJsonMap = jsonValue.GetObject("Actions").GetAllObjects(); for(auto& actionsItem : actionsJsonMap) { Aws::Utils::Array actionListJsonList = actionsItem.second.AsArray(); Aws::Vector actionListList; actionListList.reserve((size_t)actionListJsonList.GetLength()); for(unsigned actionListIndex = 0; actionListIndex < actionListJsonList.GetLength(); ++actionListIndex) { actionListList.push_back(actionListJsonList[actionListIndex].AsObject()); } m_actions[ActionPointMapper::GetActionPointForName(actionsItem.first)] = std::move(actionListList); } } if(jsonValue.ValueExists("Parameters")) { Aws::Map parametersJsonMap = jsonValue.GetObject("Parameters").GetAllObjects(); for(auto& parametersItem : parametersJsonMap) { m_parameters[parametersItem.first] = parametersItem.second.AsObject(); } } const auto& headers = result.GetHeaderValueCollection(); const auto& requestIdIter = headers.find("x-amzn-requestid"); if(requestIdIter != headers.end()) { m_requestId = requestIdIter->second; } return *this; }