class ResponseType
Language | Type name |
---|---|
.NET | Amazon.CDK.AWS.APIGateway.ResponseType |
Java | software.amazon.awscdk.services.apigateway.ResponseType |
Python | aws_cdk.aws_apigateway.ResponseType |
TypeScript (source) | @aws-cdk/aws-apigateway » ResponseType |
Supported types of gateway responses.
Example
const api = new apigateway.RestApi(this, 'books-api');
api.addGatewayResponse('test-response', {
type: apigateway.ResponseType.ACCESS_DENIED,
statusCode: '500',
responseHeaders: {
'Access-Control-Allow-Origin': "test.com",
'test-key': 'test-value'
},
templates: {
'application/json': '{ "message": $context.error.messageString, "statusCode": "488", "type": "$context.error.responseType" }'
}
});
Properties
Name | Type | Description |
---|---|---|
response | string | Valid value of response type. |
static ACCESS_DENIED | Response | The gateway response for authorization failure. |
static API_CONFIGURATION_ERROR | Response | The gateway response for an invalid API configuration. |
static AUTHORIZER_CONFIGURATION_ERROR | Response | The gateway response for failing to connect to a custom or Amazon Cognito authorizer. |
static AUTHORIZER_FAILURE | Response | The gateway response when a custom or Amazon Cognito authorizer failed to authenticate the caller. |
static BAD_REQUEST_BODY | Response | The gateway response when the request body cannot be validated according to an enabled request validator. |
static BAD_REQUEST_PARAMETERS | Response | The gateway response when the request parameter cannot be validated according to an enabled request validator. |
static DEFAULT_4 | Response | The default gateway response for an unspecified response type with the status code of 4XX. |
static DEFAULT_5 | Response | The default gateway response for an unspecified response type with a status code of 5XX. |
static EXPIRED_TOKEN | Response | The gateway response for an AWS authentication token expired error. |
static INTEGRATION_FAILURE | Response | The gateway response for an integration failed error. |
static INTEGRATION_TIMEOUT | Response | The gateway response for an integration timed out error. |
static INVALID_API_KEY | Response | The gateway response for an invalid API key submitted for a method requiring an API key. |
static INVALID_SIGNATURE | Response | The gateway response for an invalid AWS signature error. |
static MISSING_AUTHENTICATION_TOKEN | Response | The gateway response for a missing authentication token error, including the cases when the client attempts to invoke an unsupported API method or resource. |
static QUOTA_EXCEEDED | Response | The gateway response for the usage plan quota exceeded error. |
static REQUEST_TOO_LARGE | Response | The gateway response for the request too large error. |
static RESOURCE_NOT_FOUND | Response | The gateway response when API Gateway cannot find the specified resource after an API request passes authentication and authorization. |
static THROTTLED | Response | The gateway response when usage plan, method, stage, or account level throttling limits exceeded. |
static UNAUTHORIZED | Response | The gateway response when the custom or Amazon Cognito authorizer failed to authenticate the caller. |
static UNSUPPORTED_MEDIA_TYPE | Response | The gateway response when a payload is of an unsupported media type, if strict passthrough behavior is enabled. |
static WAF_FILTERED | Response | The gateway response when a request is blocked by AWS WAF. |
responseType
Type:
string
Valid value of response type.
static ACCESS_DENIED
Type:
Response
The gateway response for authorization failure.
static API_CONFIGURATION_ERROR
Type:
Response
The gateway response for an invalid API configuration.
static AUTHORIZER_CONFIGURATION_ERROR
Type:
Response
The gateway response for failing to connect to a custom or Amazon Cognito authorizer.
static AUTHORIZER_FAILURE
Type:
Response
The gateway response when a custom or Amazon Cognito authorizer failed to authenticate the caller.
static BAD_REQUEST_BODY
Type:
Response
The gateway response when the request body cannot be validated according to an enabled request validator.
static BAD_REQUEST_PARAMETERS
Type:
Response
The gateway response when the request parameter cannot be validated according to an enabled request validator.
static DEFAULT_4XX
Type:
Response
The default gateway response for an unspecified response type with the status code of 4XX.
static DEFAULT_5XX
Type:
Response
The default gateway response for an unspecified response type with a status code of 5XX.
static EXPIRED_TOKEN
Type:
Response
The gateway response for an AWS authentication token expired error.
static INTEGRATION_FAILURE
Type:
Response
The gateway response for an integration failed error.
static INTEGRATION_TIMEOUT
Type:
Response
The gateway response for an integration timed out error.
static INVALID_API_KEY
Type:
Response
The gateway response for an invalid API key submitted for a method requiring an API key.
static INVALID_SIGNATURE
Type:
Response
The gateway response for an invalid AWS signature error.
static MISSING_AUTHENTICATION_TOKEN
Type:
Response
The gateway response for a missing authentication token error, including the cases when the client attempts to invoke an unsupported API method or resource.
static QUOTA_EXCEEDED
Type:
Response
The gateway response for the usage plan quota exceeded error.
static REQUEST_TOO_LARGE
Type:
Response
The gateway response for the request too large error.
static RESOURCE_NOT_FOUND
Type:
Response
The gateway response when API Gateway cannot find the specified resource after an API request passes authentication and authorization.
static THROTTLED
Type:
Response
The gateway response when usage plan, method, stage, or account level throttling limits exceeded.
static UNAUTHORIZED
Type:
Response
The gateway response when the custom or Amazon Cognito authorizer failed to authenticate the caller.
static UNSUPPORTED_MEDIA_TYPE
Type:
Response
The gateway response when a payload is of an unsupported media type, if strict passthrough behavior is enabled.
static WAF_FILTERED
Type:
Response
The gateway response when a request is blocked by AWS WAF.
Methods
Name | Description |
---|---|
static of(type) | A custom response type to support future cases. |
static of(type)
public static of(type: string): ResponseType
Parameters
- type
string
Returns
A custom response type to support future cases.