

本文為英文版的機器翻譯版本，如內容有任何歧義或不一致之處，概以英文版為準。

# RouteConfiguration
<a name="sam-property-websocketapi-routeconfiguration"></a>

## 語法
<a name="sam-property-websocketapi-routeconfiguration-syntax"></a>

若要在 AWS Serverless Application Model (AWS SAM) 範本中宣告此實體，請使用下列語法。

### YAML
<a name="sam-property-websocketapi-routeconfiguration-syntax.yaml"></a>

```
[ApiKeyRequired](#sam-routeconfiguration-apikeyrequired): {{Boolean}}
[FunctionArn](#sam-routeconfiguration-functionarn): {{String}}
[IntegrationTimeout](#sam-routeconfiguration-integrationtimeout): {{Integer}}
[ModelSelectionExpression](#sam-routeconfiguration-modelselectionexpression): {{String}}
[OperationName](#sam-routeconfiguration-operationname): {{String}}
[RequestModels](#sam-routeconfiguration-requestmodels): {{Json}}
[RequestParameters](#sam-routeconfiguration-requestparameters): {{Json}}
[RouteResponseSelectionExpression](#sam-routeconfiguration-routeresponseselectionexpression): {{String}}
```

## Properties
<a name="sam-property-websocketapi-routeconfiguration-properties"></a>

 `ApiKeyRequired`   <a name="sam-routeconfiguration-apikeyrequired"></a>
指定此路由是否需要 API 金鑰。  
*類型*：布林值  
*必要*：否  
*CloudFormation 相容性*：此屬性會直接傳遞至 `AWS::ApiGatewayV2::Route` 資源的 `[ApiKeyRequired](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-apigatewayv2-route.html#cfn-apigatewayv2-route-apikeyrequired)` 屬性。

 `FunctionArn`   <a name="sam-routeconfiguration-functionarn"></a>
處理此路由的 Lambda 函數 ARN。 會 AWS SAM 建立整合和 API Gateway 叫用函數的必要許可。  
*類型：*字串  
*必要*：是  
*CloudFormation 相容性*：此屬性對 是唯一的 AWS SAM ，並且沒有 CloudFormation 同等屬性。

 `IntegrationTimeout`   <a name="sam-routeconfiguration-integrationtimeout"></a>
整合的逾時，以毫秒為單位。最大值為 29，000 毫秒 (29 秒）。  
*類型*：整數  
*必要*：否  
*CloudFormation 相容性*：此屬性會直接傳遞至 `AWS::ApiGatewayV2::Integration` 資源的 `[TimeoutInMillis](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-apigatewayv2-integration.html#cfn-apigatewayv2-integration-timeoutinmillis)` 屬性。

 `ModelSelectionExpression`   <a name="sam-routeconfiguration-modelselectionexpression"></a>
路由的模型選擇表達式。  
*類型：*字串  
*必要*：否  
*CloudFormation 相容性*：此屬性會直接傳遞至 `AWS::ApiGatewayV2::Route` 資源的 `[ModelSelectionExpression](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-apigatewayv2-route.html#cfn-apigatewayv2-route-modelselectionexpression)` 屬性。

 `OperationName`   <a name="sam-routeconfiguration-operationname"></a>
路由的操作名稱。  
*類型：*字串  
*必要*：否  
*CloudFormation 相容性*：此屬性會直接傳遞至 `AWS::ApiGatewayV2::Route` 資源的 `[OperationName](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-apigatewayv2-route.html#cfn-apigatewayv2-route-operationname)` 屬性。

 `RequestModels`   <a name="sam-routeconfiguration-requestmodels"></a>
路由的請求模型。  
*類型*：Json  
*必要*：否  
*CloudFormation 相容性*：此屬性會直接傳遞至 `AWS::ApiGatewayV2::Route` 資源的 `[RequestModels](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-apigatewayv2-route.html#cfn-apigatewayv2-route-requestmodels)` 屬性。

 `RequestParameters`   <a name="sam-routeconfiguration-requestparameters"></a>
路由的請求參數。  
*類型*：Json  
*必要*：否  
*CloudFormation 相容性*：此屬性會直接傳遞至 `AWS::ApiGatewayV2::Route` 資源的 `[RequestParameters](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-apigatewayv2-route.html#cfn-apigatewayv2-route-requestparameters)` 屬性。

 `RouteResponseSelectionExpression`   <a name="sam-routeconfiguration-routeresponseselectionexpression"></a>
路由的路由回應選擇表達式。  
*類型：*字串  
*必要*：否  
*CloudFormation 相容性*：此屬性會直接傳遞至 `AWS::ApiGatewayV2::Route` 資源的 `[RouteResponseSelectionExpression](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-apigatewayv2-route.html#cfn-apigatewayv2-route-routeresponseselectionexpression)` 屬性。

## 範例
<a name="sam-property-websocketapi-routeconfiguration-examples"></a>

### 簡易路由
<a name="sam-property-websocketapi-routeconfiguration-examples-simple"></a>

下列範例會設定簡單的路由。

```
Routes:
  $connect:
    FunctionArn: !GetAtt ConnectFunction.Arn
  sendMessage:
    FunctionArn: !GetAtt SendMessageFunction.Arn
    OperationName: SendMessage
```