

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

# ApiDefinition
<a name="sam-property-api-apidefinition"></a>

定義 API 的 OpenAPI 文件。

## 語法
<a name="sam-property-api-apidefinition-syntax"></a>

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

### YAML
<a name="sam-property-api-apidefinition-syntax.yaml"></a>

```
  [Bucket](#sam-api-apidefinition-bucket): String
  [Key](#sam-api-apidefinition-key): String
  [Version](#sam-api-apidefinition-version): String
```

## Properties
<a name="sam-property-api-apidefinition-properties"></a>

 `Bucket`   <a name="sam-api-apidefinition-bucket"></a>
存放 OpenAPI 檔案的 Amazon S3 儲存貯體名稱。  
*類型：*字串  
*必要*：是  
*CloudFormation 相容性*：此屬性會直接傳遞至 `AWS::ApiGateway::RestApi` `S3Location` 資料類型的 `[Bucket](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-apigateway-restapi-s3location.html#cfn-apigateway-restapi-s3location-bucket)` 屬性。

 `Key`   <a name="sam-api-apidefinition-key"></a>
OpenAPI 檔案的 Amazon S3 金鑰。  
*類型：*字串  
*必要*：是  
*CloudFormation 相容性*：此屬性會直接傳遞至 `AWS::ApiGateway::RestApi` `S3Location` 資料類型的 `[Key](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-apigateway-restapi-s3location.html#cfn-apigateway-restapi-s3location-key)` 屬性。

 `Version`   <a name="sam-api-apidefinition-version"></a>
對於版本控制的物件，則為 OpenAPI 檔案的版本。  
*類型：*字串  
*必要*：否  
*CloudFormation 相容性*：此屬性會直接傳遞至 `AWS::ApiGateway::RestApi` `S3Location` 資料類型的 `[Version](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-apigateway-restapi-s3location.html#cfn-apigateway-restapi-s3location-version)` 屬性。

## 範例
<a name="sam-property-api-apidefinition--examples"></a>

### 定義 Uri 範例
<a name="sam-property-api-apidefinition--examples--definition-uri-example"></a>

API 定義範例

#### YAML
<a name="sam-property-api-apidefinition--examples--definition-uri-example--yaml"></a>

```
DefinitionUri:
  Bucket: amzn-s3-demo-bucket-name
  Key: mykey-name
  Version: 121212
```