/** * 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::CodeGuruProfiler::Model; using namespace Aws::Utils::Json; using namespace Aws::Utils; using namespace Aws; BatchGetFrameMetricDataResult::BatchGetFrameMetricDataResult() : m_resolution(AggregationPeriod::NOT_SET) { } BatchGetFrameMetricDataResult::BatchGetFrameMetricDataResult(const Aws::AmazonWebServiceResult& result) : m_resolution(AggregationPeriod::NOT_SET) { *this = result; } BatchGetFrameMetricDataResult& BatchGetFrameMetricDataResult::operator =(const Aws::AmazonWebServiceResult& result) { JsonView jsonValue = result.GetPayload().View(); if(jsonValue.ValueExists("endTime")) { m_endTime = jsonValue.GetString("endTime"); } if(jsonValue.ValueExists("endTimes")) { Aws::Utils::Array endTimesJsonList = jsonValue.GetArray("endTimes"); for(unsigned endTimesIndex = 0; endTimesIndex < endTimesJsonList.GetLength(); ++endTimesIndex) { m_endTimes.push_back(endTimesJsonList[endTimesIndex].AsObject()); } } if(jsonValue.ValueExists("frameMetricData")) { Aws::Utils::Array frameMetricDataJsonList = jsonValue.GetArray("frameMetricData"); for(unsigned frameMetricDataIndex = 0; frameMetricDataIndex < frameMetricDataJsonList.GetLength(); ++frameMetricDataIndex) { m_frameMetricData.push_back(frameMetricDataJsonList[frameMetricDataIndex].AsObject()); } } if(jsonValue.ValueExists("resolution")) { m_resolution = AggregationPeriodMapper::GetAggregationPeriodForName(jsonValue.GetString("resolution")); } if(jsonValue.ValueExists("startTime")) { m_startTime = jsonValue.GetString("startTime"); } if(jsonValue.ValueExists("unprocessedEndTimes")) { Aws::Map unprocessedEndTimesJsonMap = jsonValue.GetObject("unprocessedEndTimes").GetAllObjects(); for(auto& unprocessedEndTimesItem : unprocessedEndTimesJsonMap) { Aws::Utils::Array listOfTimestampsJsonList = unprocessedEndTimesItem.second.AsArray(); Aws::Vector listOfTimestampsList; listOfTimestampsList.reserve((size_t)listOfTimestampsJsonList.GetLength()); for(unsigned listOfTimestampsIndex = 0; listOfTimestampsIndex < listOfTimestampsJsonList.GetLength(); ++listOfTimestampsIndex) { listOfTimestampsList.push_back(listOfTimestampsJsonList[listOfTimestampsIndex].AsObject()); } m_unprocessedEndTimes[unprocessedEndTimesItem.first] = std::move(listOfTimestampsList); } } const auto& headers = result.GetHeaderValueCollection(); const auto& requestIdIter = headers.find("x-amzn-requestid"); if(requestIdIter != headers.end()) { m_requestId = requestIdIter->second; } return *this; }