Interface RequestValidatorOptions
- All Superinterfaces:
software.amazon.jsii.JsiiSerializable
- All Known Subinterfaces:
RequestValidatorProps
- All Known Implementing Classes:
RequestValidatorOptions.Jsii$Proxy,RequestValidatorProps.Jsii$Proxy
@Generated(value="jsii-pacmak/1.84.0 (build 5404dcf)",
date="2023-06-19T16:30:45.059Z")
@Stability(Stable)
public interface RequestValidatorOptions
extends software.amazon.jsii.JsiiSerializable
Example:
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());
-
Nested Class Summary
Nested ClassesModifier and TypeInterfaceDescriptionstatic final classA builder forRequestValidatorOptionsstatic final classAn implementation forRequestValidatorOptions -
Method Summary
Methods inherited from interface software.amazon.jsii.JsiiSerializable
$jsii$toJson
-
Method Details
-
getRequestValidatorName
The name of this request validator.Default: None
-
getValidateRequestBody
Indicates whether to validate the request body according to the configured schema for the targeted API and method.Default: false
-
getValidateRequestParameters
Indicates whether to validate request parameters.Default: false
-
builder
- Returns:
- a
RequestValidatorOptions.BuilderofRequestValidatorOptions
-