Seleccione sus preferencias de cookies

Usamos cookies esenciales y herramientas similares que son necesarias para proporcionar nuestro sitio y nuestros servicios. Usamos cookies de rendimiento para recopilar estadísticas anónimas para que podamos entender cómo los clientes usan nuestro sitio y hacer mejoras. Las cookies esenciales no se pueden desactivar, pero puede hacer clic en “Personalizar” o “Rechazar” para rechazar las cookies de rendimiento.

Si está de acuerdo, AWS y los terceros aprobados también utilizarán cookies para proporcionar características útiles del sitio, recordar sus preferencias y mostrar contenido relevante, incluida publicidad relevante. Para aceptar o rechazar todas las cookies no esenciales, haga clic en “Aceptar” o “Rechazar”. Para elegir opciones más detalladas, haga clic en “Personalizar”.

AWS::ApiGateway::RequestValidator

Modo de enfoque
AWS::ApiGateway::RequestValidator - AWS CloudFormation
Esta página no se ha traducido a su idioma. Solicitar traducción
Filtrar vista

The AWS::ApiGateway::RequestValidator resource sets up basic validation rules for incoming requests to your API. For more information, see Enable Basic Request Validation for an API in API Gateway in the API Gateway Developer Guide.

Syntax

To declare this entity in your AWS CloudFormation template, use the following syntax:

JSON

{ "Type" : "AWS::ApiGateway::RequestValidator", "Properties" : { "Name" : String, "RestApiId" : String, "ValidateRequestBody" : Boolean, "ValidateRequestParameters" : Boolean } }

YAML

Type: AWS::ApiGateway::RequestValidator Properties: Name: String RestApiId: String ValidateRequestBody: Boolean ValidateRequestParameters: Boolean

Properties

Name

The name of this RequestValidator

Required: No

Type: String

Update requires: Replacement

RestApiId

The string identifier of the associated RestApi.

Required: Yes

Type: String

Update requires: Replacement

ValidateRequestBody

A Boolean flag to indicate whether to validate a request body according to the configured Model schema.

Required: No

Type: Boolean

Update requires: No interruption

ValidateRequestParameters

A Boolean flag to indicate whether to validate request parameters (true) or not (false).

Required: No

Type: Boolean

Update requires: No interruption

Return values

Ref

When you pass the logical ID of this resource to the intrinsic Ref function, Ref returns the ID of the request validator, such as abc123.

For more information about using the Ref function, see Ref.

Fn::GetAtt

The Fn::GetAtt intrinsic function returns a value for a specified attribute of this type. The following are the available attributes and sample return values.

For more information about using the Fn::GetAtt intrinsic function, see Fn::GetAtt.

RequestValidatorId

The ID for the request validator. For example: abc123.

Examples

Create request validator

The following example creates an API Gateway API with an associated request validator, based on the supplied parameters.

JSON

{ "Parameters": { "apiName": { "Type": "String" }, "validatorName": { "Type": "String" }, "validateRequestBody": { "Type": "String" }, "validateRequestParameters": { "Type": "String" } }, "Resources": { "RestApi": { "Type": "AWS::ApiGateway::RestApi", "Properties": { "Name": { "Ref": "apiName" } } }, "RequestValidator": { "Type": "AWS::ApiGateway::RequestValidator", "Properties": { "Name": { "Ref": "validatorName" }, "RestApiId": { "Ref": "RestApi" }, "ValidateRequestBody": { "Ref": "validateRequestBody" }, "ValidateRequestParameters": { "Ref": "validateRequestParameters" } } } } }

YAML

Parameters: apiName: Type: String validatorName: Type: String validateRequestBody: Type: String validateRequestParameters: Type: String Resources: RestApi: Type: AWS::ApiGateway::RestApi Properties: Name: !Ref apiName RequestValidator: Type: AWS::ApiGateway::RequestValidator Properties: Name: !Ref validatorName RestApiId: !Ref RestApi ValidateRequestBody: !Ref validateRequestBody ValidateRequestParameters: !Ref validateRequestParameters

See also

En esta página

PrivacidadTérminos del sitioPreferencias de cookies
© 2025, Amazon Web Services, Inc o sus afiliados. Todos los derechos reservados.