/** * 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::CostExplorer::Model; using namespace Aws::Utils::Json; using namespace Aws::Utils; using namespace Aws; GetCostAndUsageResult::GetCostAndUsageResult() { } GetCostAndUsageResult::GetCostAndUsageResult(const Aws::AmazonWebServiceResult& result) { *this = result; } GetCostAndUsageResult& GetCostAndUsageResult::operator =(const Aws::AmazonWebServiceResult& result) { JsonView jsonValue = result.GetPayload().View(); if(jsonValue.ValueExists("NextPageToken")) { m_nextPageToken = jsonValue.GetString("NextPageToken"); } if(jsonValue.ValueExists("GroupDefinitions")) { Aws::Utils::Array groupDefinitionsJsonList = jsonValue.GetArray("GroupDefinitions"); for(unsigned groupDefinitionsIndex = 0; groupDefinitionsIndex < groupDefinitionsJsonList.GetLength(); ++groupDefinitionsIndex) { m_groupDefinitions.push_back(groupDefinitionsJsonList[groupDefinitionsIndex].AsObject()); } } if(jsonValue.ValueExists("ResultsByTime")) { Aws::Utils::Array resultsByTimeJsonList = jsonValue.GetArray("ResultsByTime"); for(unsigned resultsByTimeIndex = 0; resultsByTimeIndex < resultsByTimeJsonList.GetLength(); ++resultsByTimeIndex) { m_resultsByTime.push_back(resultsByTimeJsonList[resultsByTimeIndex].AsObject()); } } if(jsonValue.ValueExists("DimensionValueAttributes")) { Aws::Utils::Array dimensionValueAttributesJsonList = jsonValue.GetArray("DimensionValueAttributes"); for(unsigned dimensionValueAttributesIndex = 0; dimensionValueAttributesIndex < dimensionValueAttributesJsonList.GetLength(); ++dimensionValueAttributesIndex) { m_dimensionValueAttributes.push_back(dimensionValueAttributesJsonList[dimensionValueAttributesIndex].AsObject()); } } const auto& headers = result.GetHeaderValueCollection(); const auto& requestIdIter = headers.find("x-amzn-requestid"); if(requestIdIter != headers.end()) { m_requestId = requestIdIter->second; } return *this; }