/** * 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::APIGateway::Model; using namespace Aws::Utils::Json; using namespace Aws::Utils; using namespace Aws; PutIntegrationResponseResult::PutIntegrationResponseResult() : m_contentHandling(ContentHandlingStrategy::NOT_SET) { } PutIntegrationResponseResult::PutIntegrationResponseResult(const Aws::AmazonWebServiceResult& result) : m_contentHandling(ContentHandlingStrategy::NOT_SET) { *this = result; } PutIntegrationResponseResult& PutIntegrationResponseResult::operator =(const Aws::AmazonWebServiceResult& result) { JsonView jsonValue = result.GetPayload().View(); if(jsonValue.ValueExists("statusCode")) { m_statusCode = jsonValue.GetString("statusCode"); } if(jsonValue.ValueExists("selectionPattern")) { m_selectionPattern = jsonValue.GetString("selectionPattern"); } if(jsonValue.ValueExists("responseParameters")) { Aws::Map responseParametersJsonMap = jsonValue.GetObject("responseParameters").GetAllObjects(); for(auto& responseParametersItem : responseParametersJsonMap) { m_responseParameters[responseParametersItem.first] = responseParametersItem.second.AsString(); } } if(jsonValue.ValueExists("responseTemplates")) { Aws::Map responseTemplatesJsonMap = jsonValue.GetObject("responseTemplates").GetAllObjects(); for(auto& responseTemplatesItem : responseTemplatesJsonMap) { m_responseTemplates[responseTemplatesItem.first] = responseTemplatesItem.second.AsString(); } } if(jsonValue.ValueExists("contentHandling")) { m_contentHandling = ContentHandlingStrategyMapper::GetContentHandlingStrategyForName(jsonValue.GetString("contentHandling")); } const auto& headers = result.GetHeaderValueCollection(); const auto& requestIdIter = headers.find("x-amzn-requestid"); if(requestIdIter != headers.end()) { m_requestId = requestIdIter->second; } return *this; }