1 /** 2 * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. 3 * SPDX-License-Identifier: Apache-2.0. 4 */ 5 6 #pragma once 7 #include <aws/apigateway/APIGateway_EXPORTS.h> 8 #include <aws/apigateway/model/GatewayResponseType.h> 9 #include <aws/core/utils/memory/stl/AWSString.h> 10 #include <aws/core/utils/memory/stl/AWSMap.h> 11 #include <utility> 12 13 namespace Aws 14 { 15 template<typename RESULT_TYPE> 16 class AmazonWebServiceResult; 17 18 namespace Utils 19 { 20 namespace Json 21 { 22 class JsonValue; 23 } // namespace Json 24 } // namespace Utils 25 namespace APIGateway 26 { 27 namespace Model 28 { 29 /** 30 * <p>A gateway response of a given response type and status code, with optional 31 * response parameters and mapping templates.</p> <div class="remarks"> For more 32 * information about valid gateway response types, see <a 33 * href="https://docs.aws.amazon.com/apigateway/latest/developerguide/supported-gateway-response-types.html">Gateway 34 * Response Types Supported by API Gateway</a> <div class="example"> <h4>Example: 35 * Get a Gateway Response of a given response type</h4> <h5>Request</h5> <p>This 36 * example shows how to get a gateway response of the 37 * <code>MISSING_AUTHENTICATION_TOKEN</code> type.</p> <pre><code>GET 38 * /restapis/o81lxisefl/gatewayresponses/MISSING_AUTHENTICATION_TOKEN HTTP/1.1 39 * Host: beta-apigateway.us-east-1.amazonaws.com Content-Type: application/json 40 * X-Amz-Date: 20170503T202516Z Authorization: AWS4-HMAC-SHA256 41 * Credential={access-key-id}/20170503/us-east-1/apigateway/aws4_request, 42 * SignedHeaders=content-type;host;x-amz-date, 43 * Signature=1b52460e3159c1a26cff29093855d50ea141c1c5b937528fecaf60f51129697a 44 * Cache-Control: no-cache Postman-Token: 3b2a1ce9-c848-2e26-2e2f-9c2caefbed45 45 * </code></pre> <p>The response type is specified as a URL path.</p> 46 * <h5>Response</h5> <p>The successful operation returns the <code>200 OK</code> 47 * status code and a payload similar to the following:</p> <pre><code>{ "_links": { 48 * "curies": { "href": 49 * "http://docs.aws.amazon.com/apigateway/latest/developerguide/restapi-gatewayresponse-{rel}.html", 50 * "name": "gatewayresponse", "templated": true }, "self": { "href": 51 * "/restapis/o81lxisefl/gatewayresponses/MISSING_AUTHENTICATION_TOKEN" }, 52 * "gatewayresponse:delete": { "href": 53 * "/restapis/o81lxisefl/gatewayresponses/MISSING_AUTHENTICATION_TOKEN" }, 54 * "gatewayresponse:put": { "href": 55 * "/restapis/o81lxisefl/gatewayresponses/{response_type}", "templated": true }, 56 * "gatewayresponse:update": { "href": 57 * "/restapis/o81lxisefl/gatewayresponses/MISSING_AUTHENTICATION_TOKEN" } }, 58 * "defaultResponse": false, "responseParameters": { 59 * "gatewayresponse.header.x-request-path": "method.request.path.petId", 60 * "gatewayresponse.header.Access-Control-Allow-Origin": "'a.b.c'", 61 * "gatewayresponse.header.x-request-query": "method.request.querystring.q", 62 * "gatewayresponse.header.x-request-header": "method.request.header.Accept" }, 63 * "responseTemplates": { "application/json": "{\n \"message\": 64 * $context.error.messageString,\n \"type\": \"$context.error.responseType\",\n 65 * \"stage\": \"$context.stage\",\n \"resourcePath\": \"$context.resourcePath\",\n 66 * \"stageVariables.a\": \"$stageVariables.a\",\n \"statusCode\": 67 * \"'404'\"\n}" }, "responseType": "MISSING_AUTHENTICATION_TOKEN", 68 * "statusCode": "404" }</code></pre> <p/> </div> </div> <div class="seeAlso"> <a 69 * href="https://docs.aws.amazon.com/apigateway/latest/developerguide/customize-gateway-responses.html">Customize 70 * Gateway Responses</a> </div><p><h3>See Also:</h3> <a 71 * href="http://docs.aws.amazon.com/goto/WebAPI/apigateway-2015-07-09/GatewayResponse">AWS 72 * API Reference</a></p> 73 */ 74 class AWS_APIGATEWAY_API UpdateGatewayResponseResult 75 { 76 public: 77 UpdateGatewayResponseResult(); 78 UpdateGatewayResponseResult(const Aws::AmazonWebServiceResult<Aws::Utils::Json::JsonValue>& result); 79 UpdateGatewayResponseResult& operator=(const Aws::AmazonWebServiceResult<Aws::Utils::Json::JsonValue>& result); 80 81 82 /** 83 * <p>The response type of the associated <a>GatewayResponse</a>.</p> 84 */ GetResponseType()85 inline const GatewayResponseType& GetResponseType() const{ return m_responseType; } 86 87 /** 88 * <p>The response type of the associated <a>GatewayResponse</a>.</p> 89 */ SetResponseType(const GatewayResponseType & value)90 inline void SetResponseType(const GatewayResponseType& value) { m_responseType = value; } 91 92 /** 93 * <p>The response type of the associated <a>GatewayResponse</a>.</p> 94 */ SetResponseType(GatewayResponseType && value)95 inline void SetResponseType(GatewayResponseType&& value) { m_responseType = std::move(value); } 96 97 /** 98 * <p>The response type of the associated <a>GatewayResponse</a>.</p> 99 */ WithResponseType(const GatewayResponseType & value)100 inline UpdateGatewayResponseResult& WithResponseType(const GatewayResponseType& value) { SetResponseType(value); return *this;} 101 102 /** 103 * <p>The response type of the associated <a>GatewayResponse</a>.</p> 104 */ WithResponseType(GatewayResponseType && value)105 inline UpdateGatewayResponseResult& WithResponseType(GatewayResponseType&& value) { SetResponseType(std::move(value)); return *this;} 106 107 108 /** 109 * <p>The HTTP status code for this <a>GatewayResponse</a>.</p> 110 */ GetStatusCode()111 inline const Aws::String& GetStatusCode() const{ return m_statusCode; } 112 113 /** 114 * <p>The HTTP status code for this <a>GatewayResponse</a>.</p> 115 */ SetStatusCode(const Aws::String & value)116 inline void SetStatusCode(const Aws::String& value) { m_statusCode = value; } 117 118 /** 119 * <p>The HTTP status code for this <a>GatewayResponse</a>.</p> 120 */ SetStatusCode(Aws::String && value)121 inline void SetStatusCode(Aws::String&& value) { m_statusCode = std::move(value); } 122 123 /** 124 * <p>The HTTP status code for this <a>GatewayResponse</a>.</p> 125 */ SetStatusCode(const char * value)126 inline void SetStatusCode(const char* value) { m_statusCode.assign(value); } 127 128 /** 129 * <p>The HTTP status code for this <a>GatewayResponse</a>.</p> 130 */ WithStatusCode(const Aws::String & value)131 inline UpdateGatewayResponseResult& WithStatusCode(const Aws::String& value) { SetStatusCode(value); return *this;} 132 133 /** 134 * <p>The HTTP status code for this <a>GatewayResponse</a>.</p> 135 */ WithStatusCode(Aws::String && value)136 inline UpdateGatewayResponseResult& WithStatusCode(Aws::String&& value) { SetStatusCode(std::move(value)); return *this;} 137 138 /** 139 * <p>The HTTP status code for this <a>GatewayResponse</a>.</p> 140 */ WithStatusCode(const char * value)141 inline UpdateGatewayResponseResult& WithStatusCode(const char* value) { SetStatusCode(value); return *this;} 142 143 144 /** 145 * <p>Response parameters (paths, query strings and headers) of the 146 * <a>GatewayResponse</a> as a string-to-string map of key-value pairs.</p> 147 */ GetResponseParameters()148 inline const Aws::Map<Aws::String, Aws::String>& GetResponseParameters() const{ return m_responseParameters; } 149 150 /** 151 * <p>Response parameters (paths, query strings and headers) of the 152 * <a>GatewayResponse</a> as a string-to-string map of key-value pairs.</p> 153 */ SetResponseParameters(const Aws::Map<Aws::String,Aws::String> & value)154 inline void SetResponseParameters(const Aws::Map<Aws::String, Aws::String>& value) { m_responseParameters = value; } 155 156 /** 157 * <p>Response parameters (paths, query strings and headers) of the 158 * <a>GatewayResponse</a> as a string-to-string map of key-value pairs.</p> 159 */ SetResponseParameters(Aws::Map<Aws::String,Aws::String> && value)160 inline void SetResponseParameters(Aws::Map<Aws::String, Aws::String>&& value) { m_responseParameters = std::move(value); } 161 162 /** 163 * <p>Response parameters (paths, query strings and headers) of the 164 * <a>GatewayResponse</a> as a string-to-string map of key-value pairs.</p> 165 */ WithResponseParameters(const Aws::Map<Aws::String,Aws::String> & value)166 inline UpdateGatewayResponseResult& WithResponseParameters(const Aws::Map<Aws::String, Aws::String>& value) { SetResponseParameters(value); return *this;} 167 168 /** 169 * <p>Response parameters (paths, query strings and headers) of the 170 * <a>GatewayResponse</a> as a string-to-string map of key-value pairs.</p> 171 */ WithResponseParameters(Aws::Map<Aws::String,Aws::String> && value)172 inline UpdateGatewayResponseResult& WithResponseParameters(Aws::Map<Aws::String, Aws::String>&& value) { SetResponseParameters(std::move(value)); return *this;} 173 174 /** 175 * <p>Response parameters (paths, query strings and headers) of the 176 * <a>GatewayResponse</a> as a string-to-string map of key-value pairs.</p> 177 */ AddResponseParameters(const Aws::String & key,const Aws::String & value)178 inline UpdateGatewayResponseResult& AddResponseParameters(const Aws::String& key, const Aws::String& value) { m_responseParameters.emplace(key, value); return *this; } 179 180 /** 181 * <p>Response parameters (paths, query strings and headers) of the 182 * <a>GatewayResponse</a> as a string-to-string map of key-value pairs.</p> 183 */ AddResponseParameters(Aws::String && key,const Aws::String & value)184 inline UpdateGatewayResponseResult& AddResponseParameters(Aws::String&& key, const Aws::String& value) { m_responseParameters.emplace(std::move(key), value); return *this; } 185 186 /** 187 * <p>Response parameters (paths, query strings and headers) of the 188 * <a>GatewayResponse</a> as a string-to-string map of key-value pairs.</p> 189 */ AddResponseParameters(const Aws::String & key,Aws::String && value)190 inline UpdateGatewayResponseResult& AddResponseParameters(const Aws::String& key, Aws::String&& value) { m_responseParameters.emplace(key, std::move(value)); return *this; } 191 192 /** 193 * <p>Response parameters (paths, query strings and headers) of the 194 * <a>GatewayResponse</a> as a string-to-string map of key-value pairs.</p> 195 */ AddResponseParameters(Aws::String && key,Aws::String && value)196 inline UpdateGatewayResponseResult& AddResponseParameters(Aws::String&& key, Aws::String&& value) { m_responseParameters.emplace(std::move(key), std::move(value)); return *this; } 197 198 /** 199 * <p>Response parameters (paths, query strings and headers) of the 200 * <a>GatewayResponse</a> as a string-to-string map of key-value pairs.</p> 201 */ AddResponseParameters(const char * key,Aws::String && value)202 inline UpdateGatewayResponseResult& AddResponseParameters(const char* key, Aws::String&& value) { m_responseParameters.emplace(key, std::move(value)); return *this; } 203 204 /** 205 * <p>Response parameters (paths, query strings and headers) of the 206 * <a>GatewayResponse</a> as a string-to-string map of key-value pairs.</p> 207 */ AddResponseParameters(Aws::String && key,const char * value)208 inline UpdateGatewayResponseResult& AddResponseParameters(Aws::String&& key, const char* value) { m_responseParameters.emplace(std::move(key), value); return *this; } 209 210 /** 211 * <p>Response parameters (paths, query strings and headers) of the 212 * <a>GatewayResponse</a> as a string-to-string map of key-value pairs.</p> 213 */ AddResponseParameters(const char * key,const char * value)214 inline UpdateGatewayResponseResult& AddResponseParameters(const char* key, const char* value) { m_responseParameters.emplace(key, value); return *this; } 215 216 217 /** 218 * <p>Response templates of the <a>GatewayResponse</a> as a string-to-string map of 219 * key-value pairs.</p> 220 */ GetResponseTemplates()221 inline const Aws::Map<Aws::String, Aws::String>& GetResponseTemplates() const{ return m_responseTemplates; } 222 223 /** 224 * <p>Response templates of the <a>GatewayResponse</a> as a string-to-string map of 225 * key-value pairs.</p> 226 */ SetResponseTemplates(const Aws::Map<Aws::String,Aws::String> & value)227 inline void SetResponseTemplates(const Aws::Map<Aws::String, Aws::String>& value) { m_responseTemplates = value; } 228 229 /** 230 * <p>Response templates of the <a>GatewayResponse</a> as a string-to-string map of 231 * key-value pairs.</p> 232 */ SetResponseTemplates(Aws::Map<Aws::String,Aws::String> && value)233 inline void SetResponseTemplates(Aws::Map<Aws::String, Aws::String>&& value) { m_responseTemplates = std::move(value); } 234 235 /** 236 * <p>Response templates of the <a>GatewayResponse</a> as a string-to-string map of 237 * key-value pairs.</p> 238 */ WithResponseTemplates(const Aws::Map<Aws::String,Aws::String> & value)239 inline UpdateGatewayResponseResult& WithResponseTemplates(const Aws::Map<Aws::String, Aws::String>& value) { SetResponseTemplates(value); return *this;} 240 241 /** 242 * <p>Response templates of the <a>GatewayResponse</a> as a string-to-string map of 243 * key-value pairs.</p> 244 */ WithResponseTemplates(Aws::Map<Aws::String,Aws::String> && value)245 inline UpdateGatewayResponseResult& WithResponseTemplates(Aws::Map<Aws::String, Aws::String>&& value) { SetResponseTemplates(std::move(value)); return *this;} 246 247 /** 248 * <p>Response templates of the <a>GatewayResponse</a> as a string-to-string map of 249 * key-value pairs.</p> 250 */ AddResponseTemplates(const Aws::String & key,const Aws::String & value)251 inline UpdateGatewayResponseResult& AddResponseTemplates(const Aws::String& key, const Aws::String& value) { m_responseTemplates.emplace(key, value); return *this; } 252 253 /** 254 * <p>Response templates of the <a>GatewayResponse</a> as a string-to-string map of 255 * key-value pairs.</p> 256 */ AddResponseTemplates(Aws::String && key,const Aws::String & value)257 inline UpdateGatewayResponseResult& AddResponseTemplates(Aws::String&& key, const Aws::String& value) { m_responseTemplates.emplace(std::move(key), value); return *this; } 258 259 /** 260 * <p>Response templates of the <a>GatewayResponse</a> as a string-to-string map of 261 * key-value pairs.</p> 262 */ AddResponseTemplates(const Aws::String & key,Aws::String && value)263 inline UpdateGatewayResponseResult& AddResponseTemplates(const Aws::String& key, Aws::String&& value) { m_responseTemplates.emplace(key, std::move(value)); return *this; } 264 265 /** 266 * <p>Response templates of the <a>GatewayResponse</a> as a string-to-string map of 267 * key-value pairs.</p> 268 */ AddResponseTemplates(Aws::String && key,Aws::String && value)269 inline UpdateGatewayResponseResult& AddResponseTemplates(Aws::String&& key, Aws::String&& value) { m_responseTemplates.emplace(std::move(key), std::move(value)); return *this; } 270 271 /** 272 * <p>Response templates of the <a>GatewayResponse</a> as a string-to-string map of 273 * key-value pairs.</p> 274 */ AddResponseTemplates(const char * key,Aws::String && value)275 inline UpdateGatewayResponseResult& AddResponseTemplates(const char* key, Aws::String&& value) { m_responseTemplates.emplace(key, std::move(value)); return *this; } 276 277 /** 278 * <p>Response templates of the <a>GatewayResponse</a> as a string-to-string map of 279 * key-value pairs.</p> 280 */ AddResponseTemplates(Aws::String && key,const char * value)281 inline UpdateGatewayResponseResult& AddResponseTemplates(Aws::String&& key, const char* value) { m_responseTemplates.emplace(std::move(key), value); return *this; } 282 283 /** 284 * <p>Response templates of the <a>GatewayResponse</a> as a string-to-string map of 285 * key-value pairs.</p> 286 */ AddResponseTemplates(const char * key,const char * value)287 inline UpdateGatewayResponseResult& AddResponseTemplates(const char* key, const char* value) { m_responseTemplates.emplace(key, value); return *this; } 288 289 290 /** 291 * <p>A Boolean flag to indicate whether this <a>GatewayResponse</a> is the default 292 * gateway response (<code>true</code>) or not (<code>false</code>). A default 293 * gateway response is one generated by API Gateway without any customization by an 294 * API developer. </p> 295 */ GetDefaultResponse()296 inline bool GetDefaultResponse() const{ return m_defaultResponse; } 297 298 /** 299 * <p>A Boolean flag to indicate whether this <a>GatewayResponse</a> is the default 300 * gateway response (<code>true</code>) or not (<code>false</code>). A default 301 * gateway response is one generated by API Gateway without any customization by an 302 * API developer. </p> 303 */ SetDefaultResponse(bool value)304 inline void SetDefaultResponse(bool value) { m_defaultResponse = value; } 305 306 /** 307 * <p>A Boolean flag to indicate whether this <a>GatewayResponse</a> is the default 308 * gateway response (<code>true</code>) or not (<code>false</code>). A default 309 * gateway response is one generated by API Gateway without any customization by an 310 * API developer. </p> 311 */ WithDefaultResponse(bool value)312 inline UpdateGatewayResponseResult& WithDefaultResponse(bool value) { SetDefaultResponse(value); return *this;} 313 314 private: 315 316 GatewayResponseType m_responseType; 317 318 Aws::String m_statusCode; 319 320 Aws::Map<Aws::String, Aws::String> m_responseParameters; 321 322 Aws::Map<Aws::String, Aws::String> m_responseTemplates; 323 324 bool m_defaultResponse; 325 }; 326 327 } // namespace Model 328 } // namespace APIGateway 329 } // namespace Aws 330