libZSservicesZSamazonka-apigatewayZSamazonka-apigateway
Copyright(c) 2013-2021 Brendan Hay
LicenseMozilla Public License, v. 2.0.
MaintainerBrendan Hay <brendan.g.hay+amazonka@gmail.com>
Stabilityauto-generated
Portabilitynon-portable (GHC extensions)
Safe HaskellNone

Amazonka.APIGateway.PutGatewayResponse

Description

Creates a customization of a GatewayResponse of a specified response type and status code on the given RestApi.

Synopsis

Creating a Request

data PutGatewayResponse Source #

Creates a customization of a GatewayResponse of a specified response type and status code on the given RestApi.

See: newPutGatewayResponse smart constructor.

Constructors

PutGatewayResponse' 

Fields

Instances

Instances details
Eq PutGatewayResponse Source # 
Instance details

Defined in Amazonka.APIGateway.PutGatewayResponse

Read PutGatewayResponse Source # 
Instance details

Defined in Amazonka.APIGateway.PutGatewayResponse

Show PutGatewayResponse Source # 
Instance details

Defined in Amazonka.APIGateway.PutGatewayResponse

Generic PutGatewayResponse Source # 
Instance details

Defined in Amazonka.APIGateway.PutGatewayResponse

Associated Types

type Rep PutGatewayResponse :: Type -> Type #

NFData PutGatewayResponse Source # 
Instance details

Defined in Amazonka.APIGateway.PutGatewayResponse

Methods

rnf :: PutGatewayResponse -> () #

Hashable PutGatewayResponse Source # 
Instance details

Defined in Amazonka.APIGateway.PutGatewayResponse

ToJSON PutGatewayResponse Source # 
Instance details

Defined in Amazonka.APIGateway.PutGatewayResponse

AWSRequest PutGatewayResponse Source # 
Instance details

Defined in Amazonka.APIGateway.PutGatewayResponse

Associated Types

type AWSResponse PutGatewayResponse #

ToHeaders PutGatewayResponse Source # 
Instance details

Defined in Amazonka.APIGateway.PutGatewayResponse

ToPath PutGatewayResponse Source # 
Instance details

Defined in Amazonka.APIGateway.PutGatewayResponse

ToQuery PutGatewayResponse Source # 
Instance details

Defined in Amazonka.APIGateway.PutGatewayResponse

type Rep PutGatewayResponse Source # 
Instance details

Defined in Amazonka.APIGateway.PutGatewayResponse

type Rep PutGatewayResponse = D1 ('MetaData "PutGatewayResponse" "Amazonka.APIGateway.PutGatewayResponse" "libZSservicesZSamazonka-apigatewayZSamazonka-apigateway" 'False) (C1 ('MetaCons "PutGatewayResponse'" 'PrefixI 'True) ((S1 ('MetaSel ('Just "responseTemplates") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 (Maybe (HashMap Text Text))) :*: S1 ('MetaSel ('Just "statusCode") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 (Maybe Text))) :*: (S1 ('MetaSel ('Just "responseParameters") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 (Maybe (HashMap Text Text))) :*: (S1 ('MetaSel ('Just "restApiId") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 Text) :*: S1 ('MetaSel ('Just "responseType") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 GatewayResponseType)))))
type AWSResponse PutGatewayResponse Source # 
Instance details

Defined in Amazonka.APIGateway.PutGatewayResponse

newPutGatewayResponse Source #

Create a value of PutGatewayResponse with all optional fields omitted.

Use generic-lens or optics to modify other optional fields.

The following record fields are available, with the corresponding lenses provided for backwards compatibility:

$sel:responseTemplates:PutGatewayResponse', putGatewayResponse_responseTemplates - Response templates of the GatewayResponse as a string-to-string map of key-value pairs.

$sel:statusCode:PutGatewayResponse', putGatewayResponse_statusCode - The HTTP status code of the GatewayResponse.

$sel:responseParameters:PutGatewayResponse', putGatewayResponse_responseParameters - Response parameters (paths, query strings and headers) of the GatewayResponse as a string-to-string map of key-value pairs.

$sel:restApiId:PutGatewayResponse', putGatewayResponse_restApiId - [Required] The string identifier of the associated RestApi.

$sel:responseType:PutGatewayResponse', putGatewayResponse_responseType - [Required]

The response type of the associated GatewayResponse.

Request Lenses

putGatewayResponse_responseTemplates :: Lens' PutGatewayResponse (Maybe (HashMap Text Text)) Source #

Response templates of the GatewayResponse as a string-to-string map of key-value pairs.

putGatewayResponse_statusCode :: Lens' PutGatewayResponse (Maybe Text) Source #

The HTTP status code of the GatewayResponse.

putGatewayResponse_responseParameters :: Lens' PutGatewayResponse (Maybe (HashMap Text Text)) Source #

Response parameters (paths, query strings and headers) of the GatewayResponse as a string-to-string map of key-value pairs.

putGatewayResponse_restApiId :: Lens' PutGatewayResponse Text Source #

Required
The string identifier of the associated RestApi.

putGatewayResponse_responseType :: Lens' PutGatewayResponse GatewayResponseType Source #

Required

The response type of the associated GatewayResponse.

Destructuring the Response

data GatewayResponse Source #

A gateway response of a given response type and status code, with optional response parameters and mapping templates.

For more information about valid gateway response types, see Gateway Response Types Supported by API Gateway

Example: Get a Gateway Response of a given response type

Request

This example shows how to get a gateway response of the MISSING_AUTHENTICATION_TOKEN type.

GET /restapis/o81lxisefl/gatewayresponses/MISSING_AUTHENTICATION_TOKEN HTTP/1.1 Host: beta-apigateway.us-east-1.amazonaws.com Content-Type: application/json X-Amz-Date: 20170503T202516Z Authorization: AWS4-HMAC-SHA256 Credential={access-key-id}/20170503/us-east-1/apigateway/aws4_request, SignedHeaders=content-type;host;x-amz-date, Signature=1b52460e3159c1a26cff29093855d50ea141c1c5b937528fecaf60f51129697a Cache-Control: no-cache Postman-Token: 3b2a1ce9-c848-2e26-2e2f-9c2caefbed45

The response type is specified as a URL path.

Response

The successful operation returns the 200 OK status code and a payload similar to the following:

{ "_links": { "curies": { "href": "http://docs.aws.amazon.com/apigateway/latest/developerguide/restapi-gatewayresponse-{rel}.html", "name": "gatewayresponse", "templated": true }, "self": { "href": "/restapis/o81lxisefl/gatewayresponses/MISSING_AUTHENTICATION_TOKEN" }, "gatewayresponse:delete": { "href": "/restapis/o81lxisefl/gatewayresponses/MISSING_AUTHENTICATION_TOKEN" }, "gatewayresponse:put": { "href": "/restapis/o81lxisefl/gatewayresponses/{response_type}", "templated": true }, "gatewayresponse:update": { "href": "/restapis/o81lxisefl/gatewayresponses/MISSING_AUTHENTICATION_TOKEN" } }, "defaultResponse": false, "responseParameters": { "gatewayresponse.header.x-request-path": "method.request.path.petId", "gatewayresponse.header.Access-Control-Allow-Origin": "'a.b.c'", "gatewayresponse.header.x-request-query": "method.request.querystring.q", "gatewayresponse.header.x-request-header": "method.request.header.Accept" }, "responseTemplates": { "application/json": "{\n \"message\": $context.error.messageString,\n \"type\": \"$context.error.responseType\",\n \"stage\": \"$context.stage\",\n \"resourcePath\": \"$context.resourcePath\",\n \"stageVariables.a\": \"$stageVariables.a\",\n \"statusCode\": \"'404'\"\n}" }, "responseType": "MISSING_AUTHENTICATION_TOKEN", "statusCode": "404" }

Customize Gateway Responses

See: newGatewayResponse smart constructor.

Constructors

GatewayResponse' 

Fields

Instances

Instances details
Eq GatewayResponse Source # 
Instance details

Defined in Amazonka.APIGateway.Types.GatewayResponse

Read GatewayResponse Source # 
Instance details

Defined in Amazonka.APIGateway.Types.GatewayResponse

Show GatewayResponse Source # 
Instance details

Defined in Amazonka.APIGateway.Types.GatewayResponse

Generic GatewayResponse Source # 
Instance details

Defined in Amazonka.APIGateway.Types.GatewayResponse

Associated Types

type Rep GatewayResponse :: Type -> Type #

NFData GatewayResponse Source # 
Instance details

Defined in Amazonka.APIGateway.Types.GatewayResponse

Methods

rnf :: GatewayResponse -> () #

Hashable GatewayResponse Source # 
Instance details

Defined in Amazonka.APIGateway.Types.GatewayResponse

FromJSON GatewayResponse Source # 
Instance details

Defined in Amazonka.APIGateway.Types.GatewayResponse

type Rep GatewayResponse Source # 
Instance details

Defined in Amazonka.APIGateway.Types.GatewayResponse

type Rep GatewayResponse = D1 ('MetaData "GatewayResponse" "Amazonka.APIGateway.Types.GatewayResponse" "libZSservicesZSamazonka-apigatewayZSamazonka-apigateway" 'False) (C1 ('MetaCons "GatewayResponse'" 'PrefixI 'True) ((S1 ('MetaSel ('Just "defaultResponse") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 (Maybe Bool)) :*: S1 ('MetaSel ('Just "responseTemplates") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 (Maybe (HashMap Text Text)))) :*: (S1 ('MetaSel ('Just "responseType") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 (Maybe GatewayResponseType)) :*: (S1 ('MetaSel ('Just "statusCode") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 (Maybe Text)) :*: S1 ('MetaSel ('Just "responseParameters") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 (Maybe (HashMap Text Text)))))))

newGatewayResponse :: GatewayResponse Source #

Create a value of GatewayResponse with all optional fields omitted.

Use generic-lens or optics to modify other optional fields.

The following record fields are available, with the corresponding lenses provided for backwards compatibility:

$sel:defaultResponse:GatewayResponse', gatewayResponse_defaultResponse - A Boolean flag to indicate whether this GatewayResponse is the default gateway response (true) or not (false). A default gateway response is one generated by API Gateway without any customization by an API developer.

$sel:responseTemplates:GatewayResponse', gatewayResponse_responseTemplates - Response templates of the GatewayResponse as a string-to-string map of key-value pairs.

$sel:responseType:GatewayResponse', gatewayResponse_responseType - The response type of the associated GatewayResponse.

$sel:statusCode:GatewayResponse', gatewayResponse_statusCode - The HTTP status code for this GatewayResponse.

$sel:responseParameters:GatewayResponse', gatewayResponse_responseParameters - Response parameters (paths, query strings and headers) of the GatewayResponse as a string-to-string map of key-value pairs.

Response Lenses

gatewayResponse_defaultResponse :: Lens' GatewayResponse (Maybe Bool) Source #

A Boolean flag to indicate whether this GatewayResponse is the default gateway response (true) or not (false). A default gateway response is one generated by API Gateway without any customization by an API developer.

gatewayResponse_responseTemplates :: Lens' GatewayResponse (Maybe (HashMap Text Text)) Source #

Response templates of the GatewayResponse as a string-to-string map of key-value pairs.

gatewayResponse_responseType :: Lens' GatewayResponse (Maybe GatewayResponseType) Source #

The response type of the associated GatewayResponse.

gatewayResponse_statusCode :: Lens' GatewayResponse (Maybe Text) Source #

The HTTP status code for this GatewayResponse.

gatewayResponse_responseParameters :: Lens' GatewayResponse (Maybe (HashMap Text Text)) Source #

Response parameters (paths, query strings and headers) of the GatewayResponse as a string-to-string map of key-value pairs.