class RequestValidator (construct)
Language | Type name |
---|---|
![]() | Amazon.CDK.AWS.APIGateway.RequestValidator |
![]() | github.com/aws/aws-cdk-go/awscdk/v2/awsapigateway#RequestValidator |
![]() | software.amazon.awscdk.services.apigateway.RequestValidator |
![]() | aws_cdk.aws_apigateway.RequestValidator |
![]() | aws-cdk-lib » aws_apigateway » RequestValidator |
Implements
IConstruct
, IDependable
, IResource
, IRequest
Example
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import { aws_apigateway as apigateway } from 'aws-cdk-lib';
declare const restApi: apigateway.RestApi;
const requestValidator = new apigateway.RequestValidator(this, 'MyRequestValidator', {
restApi: restApi,
// the properties below are optional
requestValidatorName: 'requestValidatorName',
validateRequestBody: false,
validateRequestParameters: false,
});
Initializer
new RequestValidator(scope: Construct, id: string, props: RequestValidatorProps)
Parameters
- scope
Construct
- id
string
- props
Request
Validator Props
Construct Props
Name | Type | Description |
---|---|---|
rest | IRest | The rest API that this model is part of. |
request | string | The name of this request validator. |
validate | boolean | Indicates whether to validate the request body according to the configured schema for the targeted API and method. |
validate | boolean | Indicates whether to validate request parameters. |
restApi
Type:
IRest
The rest API that this model is part of.
The reason we need the RestApi object itself and not just the ID is because the model is being tracked by the top-level RestApi object for the purpose of calculating it's hash to determine the ID of the deployment. This allows us to automatically update the deployment when the model of the REST API changes.
requestValidatorName?
Type:
string
(optional, default: None)
The name of this request validator.
validateRequestBody?
Type:
boolean
(optional, default: false)
Indicates whether to validate the request body according to the configured schema for the targeted API and method.
validateRequestParameters?
Type:
boolean
(optional, default: false)
Indicates whether to validate request parameters.
Properties
Name | Type | Description |
---|---|---|
env | Resource | The environment this resource belongs to. |
node | Node | The tree node. |
request | string | ID of the request validator, such as abc123. |
stack | Stack | The stack in which this resource is defined. |
env
Type:
Resource
The environment this resource belongs to.
For resources that are created and managed by the CDK (generally, those created by creating new class instances like Role, Bucket, etc.), this is always the same as the environment of the stack they belong to; however, for imported resources (those obtained from static methods like fromRoleArn, fromBucketName, etc.), that might be different than the stack they were imported into.
node
Type:
Node
The tree node.
requestValidatorId
Type:
string
ID of the request validator, such as abc123.
stack
Type:
Stack
The stack in which this resource is defined.
Methods
Name | Description |
---|---|
apply | Apply the given removal policy to this resource. |
to | Returns a string representation of this construct. |
static from |
applyRemovalPolicy(policy)
public applyRemovalPolicy(policy: RemovalPolicy): void
Parameters
- policy
Removal
Policy
Apply the given removal policy to this resource.
The Removal Policy controls what happens to this resource when it stops being managed by CloudFormation, either because you've removed it from the CDK application or because you've made a change that requires the resource to be replaced.
The resource can be deleted (RemovalPolicy.DESTROY
), or left in your AWS
account for data recovery and cleanup later (RemovalPolicy.RETAIN
).
toString()
public toString(): string
Returns
string
Returns a string representation of this construct.
static fromRequestValidatorId(scope, id, requestValidatorId)
public static fromRequestValidatorId(scope: Construct, id: string, requestValidatorId: string): IRequestValidator
Parameters
- scope
Construct
- id
string
- requestValidatorId
string
Returns