AWS CloudFormation
User Guide (API Version 2010-05-15)
AWS 服务或AWS文档中描述的功能,可能因地区/位置而异。请点击 Amazon AWS 入门,可查看中国地区的具体差异

AWS::ApiGateway::DocumentationVersion

AWS::ApiGateway::DocumentationVersion 资源可创建 Amazon API Gateway API 实体的文档快照。有关更多信息,请参阅 API 网关 开发人员指南 中的 API Gateway 中的 API 文档表示形式

语法

要在 AWS CloudFormation 模板中声明此实体,请使用以下语法:

JSON

{ "Type" : "AWS::ApiGateway::DocumentationVersion", "Properties" : { "Description" : String, "DocumentationVersion" : String, "RestApiId" : String } }

YAML

Type: "AWS::ApiGateway::DocumentationVersion" Properties: Description: String DocumentationVersion: String RestApiId: String

属性

注意

有关每个属性的更多信息,请参阅 Amazon API Gateway REST API 参考 中的 DocumentationVersion

Description

API 文档快照的描述。

必需:否

类型:字符串

更新要求无需中断

DocumentationVersion

API 文档快照的版本标识符。

必需:是

类型:字符串

更新要求替换

RestApiId

目标 API 实体的标识符。

必需:是

类型:字符串

更新要求替换

示例

以下示例将文档版本与 API 阶段相关联。

JSON

{ "Parameters": { "apiName": { "Type": "String" }, "description": { "Type": "String" }, "property": { "Type": "String" }, "stageName": { "Type": "String" }, "type": { "Type": "String" }, "version": { "Type": "String" } }, "Resources": { "Deployment": { "Type": "AWS::ApiGateway::Deployment", "Properties": { "RestApiId": { "Ref": "RestApi" } }, "DependsOn": [ "Method" ] }, "DocumentationPart": { "Type": "AWS::ApiGateway::DocumentationPart", "Properties": { "Location": { "Type": { "Ref": "type" } }, "RestApiId": { "Ref": "RestApi" }, "Property": { "Ref": "property" } } }, "DocumentationVersion": { "Type": "AWS::ApiGateway::DocumentationVersion", "Properties": { "Description": { "Ref": "description" }, "DocumentationVersion": { "Ref": "version" }, "RestApiId": { "Ref": "RestApi" } }, "DependsOn": "DocumentationPart" }, "Method": { "Type": "AWS::ApiGateway::Method", "Properties": { "AuthorizationType": "NONE", "HttpMethod": "POST", "ResourceId": { "Fn::GetAtt": [ "RestApi", "RootResourceId" ] }, "RestApiId": { "Ref": "RestApi" }, "Integration": { "Type": "MOCK" } } }, "RestApi": { "Type": "AWS::ApiGateway::RestApi", "Properties": { "Name": { "Ref": "apiName" } } }, "Stage": { "Type": "AWS::ApiGateway::Stage", "Properties": { "DeploymentId": { "Ref": "Deployment" }, "DocumentationVersion": { "Ref": "version" }, "RestApiId": { "Ref": "RestApi" }, "StageName": { "Ref": "stageName" } }, "DependsOn": "DocumentationVersion" } } }

YAML

Parameters: apiName: Type: String description: Type: String property: Type: String stageName: Type: String type: Type: String version: Type: String Resources: Deployment: Type: 'AWS::ApiGateway::Deployment' Properties: RestApiId: !Ref RestApi DependsOn: - Method DocumentationPart: Type: 'AWS::ApiGateway::DocumentationPart' Properties: Location: Type: !Ref type RestApiId: !Ref RestApi Property: !Ref property DocumentationVersion: Type: 'AWS::ApiGateway::DocumentationVersion' Properties: Description: !Ref description DocumentationVersion: !Ref version RestApiId: !Ref RestApi DependsOn: DocumentationPart Method: Type: 'AWS::ApiGateway::Method' Properties: AuthorizationType: NONE HttpMethod: POST ResourceId: !GetAtt - RestApi - RootResourceId RestApiId: !Ref RestApi Integration: Type: MOCK RestApi: Type: 'AWS::ApiGateway::RestApi' Properties: Name: !Ref apiName Stage: Type: 'AWS::ApiGateway::Stage' Properties: DeploymentId: !Ref Deployment DocumentationVersion: !Ref version RestApiId: !Ref RestApi StageName: !Ref stageName DependsOn: DocumentationVersion

本页内容: