

本文属于机器翻译版本。若本译文内容与英语原文存在差异，则一律以英文原文为准。

# 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
```