本文属于机器翻译版本。若本译文内容与英语原文存在差异,则一律以英文原文为准。
RouteConfiguration
语法
要在 AWS Serverless Application Model (AWS SAM) 模板中声明此实体,请使用以下语法。
YAML
ApiKeyRequired:BooleanFunctionArn:StringIntegrationTimeout:IntegerModelSelectionExpression:StringOperationName:StringRequestModels:JsonRequestParameters:JsonRouteResponseSelectionExpression:String
Properties
-
ApiKeyRequired -
指定此路线是否需要 API 密钥。
类型:布尔值
必需:否
CloudFormation 兼容性:此属性直接传递给
AWS::ApiGatewayV2::Route资源的ApiKeyRequired属性。 -
FunctionArn -
处理此路由的 Lambda 函数的 ARN。 AWS SAM 创建集成和 API Gateway 调用该函数所需的权限。
类型:字符串
是否必需:是
CloudFormation 兼容性:此属性是独有的 AWS SAM ,没有 CloudFormation 等效属性。
-
IntegrationTimeout -
集成的超时时间,以毫秒为单位。最大值为 29,000 毫秒(29 秒)。
类型:整数
必需:否
CloudFormation 兼容性:此属性直接传递给
AWS::ApiGatewayV2::Integration资源的TimeoutInMillis属性。 -
ModelSelectionExpression -
路由的模型选择表达式。
类型:字符串
必需:否
CloudFormation 兼容性:此属性直接传递给
AWS::ApiGatewayV2::Route资源的ModelSelectionExpression属性。 -
OperationName -
路由的操作名称。
类型:字符串
必需:否
CloudFormation 兼容性:此属性直接传递给
AWS::ApiGatewayV2::Route资源的OperationName属性。 -
RequestModels -
路由的请求模型。
类型:Json
必需:否
CloudFormation 兼容性:此属性直接传递给
AWS::ApiGatewayV2::Route资源的RequestModels属性。 -
RequestParameters -
路由的请求参数。
类型:Json
必需:否
CloudFormation 兼容性:此属性直接传递给
AWS::ApiGatewayV2::Route资源的RequestParameters属性。 -
RouteResponseSelectionExpression -
路由的路由响应选择表达式。
类型:字符串
必需:否
CloudFormation 兼容性:此属性直接传递给
AWS::ApiGatewayV2::Route资源的RouteResponseSelectionExpression属性。
示例
简单路线
以下示例配置了一条简单路由。
Routes: $connect: FunctionArn: !GetAtt ConnectFunction.Arn sendMessage: FunctionArn: !GetAtt SendMessageFunction.Arn OperationName: SendMessage