/** * 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::CloudWatchLogs::Model; using namespace Aws::Utils::Json; using namespace Aws::Utils; using namespace Aws; GetQueryResultsResult::GetQueryResultsResult() : m_status(QueryStatus::NOT_SET) { } GetQueryResultsResult::GetQueryResultsResult(const Aws::AmazonWebServiceResult& result) : m_status(QueryStatus::NOT_SET) { *this = result; } GetQueryResultsResult& GetQueryResultsResult::operator =(const Aws::AmazonWebServiceResult& result) { JsonView jsonValue = result.GetPayload().View(); if(jsonValue.ValueExists("results")) { Aws::Utils::Array resultsJsonList = jsonValue.GetArray("results"); for(unsigned resultsIndex = 0; resultsIndex < resultsJsonList.GetLength(); ++resultsIndex) { Aws::Utils::Array resultRowsJsonList = resultsJsonList[resultsIndex].AsArray(); Aws::Vector resultRowsList; resultRowsList.reserve((size_t)resultRowsJsonList.GetLength()); for(unsigned resultRowsIndex = 0; resultRowsIndex < resultRowsJsonList.GetLength(); ++resultRowsIndex) { resultRowsList.push_back(resultRowsJsonList[resultRowsIndex].AsObject()); } m_results.push_back(std::move(resultRowsList)); } } if(jsonValue.ValueExists("statistics")) { m_statistics = jsonValue.GetObject("statistics"); } if(jsonValue.ValueExists("status")) { m_status = QueryStatusMapper::GetQueryStatusForName(jsonValue.GetString("status")); } if(jsonValue.ValueExists("encryptionKey")) { m_encryptionKey = jsonValue.GetString("encryptionKey"); } const auto& headers = result.GetHeaderValueCollection(); const auto& requestIdIter = headers.find("x-amzn-requestid"); if(requestIdIter != headers.end()) { m_requestId = requestIdIter->second; } return *this; }