@Generated(value="software.amazon.awssdk:codegen") public final class GatewayResponse extends Object implements SdkPojo, Serializable, ToCopyableBuilder<GatewayResponse.Builder,GatewayResponse>
A gateway response of a given response type and status code, with optional response parameters and mapping templates.
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.
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" }
Modifier and Type | Class and Description |
---|---|
static interface |
GatewayResponse.Builder |
Modifier and Type | Method and Description |
---|---|
static GatewayResponse.Builder |
builder() |
Boolean |
defaultResponse()
A Boolean flag to indicate whether this GatewayResponse is the default gateway response (
true
) or not (false ). |
boolean |
equals(Object obj) |
boolean |
equalsBySdkFields(Object obj)
Indicates whether some other object is "equal to" this one by SDK fields.
|
<T> Optional<T> |
getValueForField(String fieldName,
Class<T> clazz) |
int |
hashCode() |
boolean |
hasResponseParameters()
Returns true if the ResponseParameters property was specified by the sender (it may be empty), or false if the
sender did not specify the value (it will be empty).
|
boolean |
hasResponseTemplates()
Returns true if the ResponseTemplates property was specified by the sender (it may be empty), or false if the
sender did not specify the value (it will be empty).
|
Map<String,String> |
responseParameters()
Response parameters (paths, query strings and headers) of the GatewayResponse as a string-to-string map of
key-value pairs.
|
Map<String,String> |
responseTemplates()
Response templates of the GatewayResponse as a string-to-string map of key-value pairs.
|
GatewayResponseType |
responseType()
The response type of the associated GatewayResponse.
|
String |
responseTypeAsString()
The response type of the associated GatewayResponse.
|
List<SdkField<?>> |
sdkFields() |
static Class<? extends GatewayResponse.Builder> |
serializableBuilderClass() |
String |
statusCode()
The HTTP status code for this GatewayResponse.
|
GatewayResponse.Builder |
toBuilder()
Take this object and create a builder that contains all of the current property values of this object.
|
String |
toString()
Returns a string representation of this object.
|
copy
public final GatewayResponseType responseType()
The response type of the associated GatewayResponse. Valid values are
If the service returns an enum value that is not available in the current SDK version, responseType
will
return GatewayResponseType.UNKNOWN_TO_SDK_VERSION
. The raw value returned by the service is available
from responseTypeAsString()
.
GatewayResponseType
public final String responseTypeAsString()
The response type of the associated GatewayResponse. Valid values are
If the service returns an enum value that is not available in the current SDK version, responseType
will
return GatewayResponseType.UNKNOWN_TO_SDK_VERSION
. The raw value returned by the service is available
from responseTypeAsString()
.
GatewayResponseType
public final String statusCode()
The HTTP status code for this GatewayResponse.
public final boolean hasResponseParameters()
public final Map<String,String> responseParameters()
Response parameters (paths, query strings and headers) of the GatewayResponse as a string-to-string map of key-value pairs.
Attempts to modify the collection returned by this method will result in an UnsupportedOperationException.
You can use hasResponseParameters()
to see if a value was sent in this field.
public final boolean hasResponseTemplates()
public final Map<String,String> responseTemplates()
Response templates of the GatewayResponse as a string-to-string map of key-value pairs.
Attempts to modify the collection returned by this method will result in an UnsupportedOperationException.
You can use hasResponseTemplates()
to see if a value was sent in this field.
public final Boolean 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.
true
) or not (false
). A default gateway response is one generated by API
Gateway without any customization by an API developer.public GatewayResponse.Builder toBuilder()
ToCopyableBuilder
toBuilder
in interface ToCopyableBuilder<GatewayResponse.Builder,GatewayResponse>
public static GatewayResponse.Builder builder()
public static Class<? extends GatewayResponse.Builder> serializableBuilderClass()
public final boolean equalsBySdkFields(Object obj)
SdkPojo
SdkPojo
class,
and is generated based on a service model.
If an SdkPojo
class does not have any inherited fields, equalsBySdkFields
and equals
are essentially the same.
equalsBySdkFields
in interface SdkPojo
obj
- the object to be compared withpublic final String toString()