/** * 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; GetGatewayResponseResult::GetGatewayResponseResult() : m_responseType(GatewayResponseType::NOT_SET), m_defaultResponse(false) { } GetGatewayResponseResult::GetGatewayResponseResult(const Aws::AmazonWebServiceResult& result) : m_responseType(GatewayResponseType::NOT_SET), m_defaultResponse(false) { *this = result; } GetGatewayResponseResult& GetGatewayResponseResult::operator =(const Aws::AmazonWebServiceResult& result) { JsonView jsonValue = result.GetPayload().View(); if(jsonValue.ValueExists("responseType")) { m_responseType = GatewayResponseTypeMapper::GetGatewayResponseTypeForName(jsonValue.GetString("responseType")); } if(jsonValue.ValueExists("statusCode")) { m_statusCode = jsonValue.GetString("statusCode"); } 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("defaultResponse")) { m_defaultResponse = jsonValue.GetBool("defaultResponse"); } const auto& headers = result.GetHeaderValueCollection(); const auto& requestIdIter = headers.find("x-amzn-requestid"); if(requestIdIter != headers.end()) { m_requestId = requestIdIter->second; } return *this; }