@Generated(value="jsii-pacmak/1.67.0 (build 2c027f5)", date="2022-09-19T20:26:36.205Z") @Stability(value=Stable) public interface RequestValidatorOptions extends software.amazon.jsii.JsiiSerializable
LambdaIntegration integration;
Resource resource;
Model responseModel;
Model errorResponseModel;
resource.addMethod("GET", integration, MethodOptions.builder()
// We can mark the parameters as required
.requestParameters(Map.of(
"method.request.querystring.who", true))
// we can set request validator options like below
.requestValidatorOptions(RequestValidatorOptions.builder()
.requestValidatorName("test-validator")
.validateRequestBody(true)
.validateRequestParameters(false)
.build())
.methodResponses(List.of(MethodResponse.builder()
// Successful response from the integration
.statusCode("200")
// Define what parameters are allowed or not
.responseParameters(Map.of(
"method.response.header.Content-Type", true,
"method.response.header.Access-Control-Allow-Origin", true,
"method.response.header.Access-Control-Allow-Credentials", true))
// Validate the schema on the response
.responseModels(Map.of(
"application/json", responseModel))
.build(), MethodResponse.builder()
// Same thing for the error responses
.statusCode("400")
.responseParameters(Map.of(
"method.response.header.Content-Type", true,
"method.response.header.Access-Control-Allow-Origin", true,
"method.response.header.Access-Control-Allow-Credentials", true))
.responseModels(Map.of(
"application/json", errorResponseModel))
.build()))
.build());
| Modifier and Type | Interface and Description |
|---|---|
static class |
RequestValidatorOptions.Builder
A builder for
RequestValidatorOptions |
static class |
RequestValidatorOptions.Jsii$Proxy
An implementation for
RequestValidatorOptions |
| Modifier and Type | Method and Description |
|---|---|
static RequestValidatorOptions.Builder |
builder() |
default String |
getRequestValidatorName()
The name of this request validator.
|
default Boolean |
getValidateRequestBody()
Indicates whether to validate the request body according to the configured schema for the targeted API and method.
|
default Boolean |
getValidateRequestParameters()
Indicates whether to validate request parameters.
|
@Stability(value=Stable) @Nullable default String getRequestValidatorName()
Default: None
@Stability(value=Stable) @Nullable default Boolean getValidateRequestBody()
Default: false
@Stability(value=Stable) @Nullable default Boolean getValidateRequestParameters()
Default: false
@Stability(value=Stable) static RequestValidatorOptions.Builder builder()
RequestValidatorOptions.Builder of RequestValidatorOptionsCopyright © 2022. All rights reserved.