The AWS::ApiGateway::DocumentationPart
resource creates a documentation part for an API. For more information, see Representation of API Documentation in API Gateway in the API Gateway Developer Guide.
Syntax
To declare this entity in your AWS CloudFormation template, use the following syntax:
JSON
{
"Type" : "AWS::ApiGateway::DocumentationPart",
"Properties" : {
"Location" : Location
,
"Properties" : String
,
"RestApiId" : String
}
}
YAML
Type: AWS::ApiGateway::DocumentationPart
Properties:
Location:
Location
Properties: String
RestApiId: String
Properties
Location
-
The location of the targeted API entity of the to-be-created documentation part.
Required: Yes
Type: Location
Update requires: Replacement
Properties
-
The new documentation content map of the targeted API entity. Enclosed key-value pairs are API-specific, but only OpenAPI-compliant key-value pairs can be exported and, hence, published.
Required: Yes
Type: String
Update requires: No interruption
RestApiId
-
The string identifier of the associated RestApi.
Required: Yes
Type: String
Update requires: Replacement
Return values
Ref
When you pass the logical ID of this resource to the intrinsic Ref
function, Ref
returns the ID of the documentation part, such as abc123
.
For more information about using the Ref
function, see Ref
.
Fn::GetAtt
DocumentationPartId
-
The ID for the documentation part.
Examples
Associate documentation part with documentation version
The following example associates a documentation part for an API entity with a documentation version.
JSON
{
"Parameters": {
"apiName": {
"Type": "String"
},
"description": {
"Type": "String"
},
"version": {
"Type": "String"
},
"type": {
"Type": "String"
},
"property": {
"Type": "String"
}
},
"Resources": {
"RestApi": {
"Type": "AWS::ApiGateway::RestApi",
"Properties": {
"Name": {
"Ref": "apiName"
}
}
},
"DocumentationPart": {
"Type": "AWS::ApiGateway::DocumentationPart",
"Properties": {
"Location": {
"Type": {
"Ref": "type"
}
},
"RestApiId": {
"Ref": "RestApi"
},
"Properties": {
"Ref": "property"
}
}
},
"DocumentationVersion": {
"Type": "AWS::ApiGateway::DocumentationVersion",
"Properties": {
"Description": {
"Ref": "description"
},
"DocumentationVersion": {
"Ref": "version"
},
"RestApiId": {
"Ref": "RestApi"
}
},
"DependsOn": "DocumentationPart"
}
}
}
YAML
Parameters:
apiName:
Type: String
description:
Type: String
version:
Type: String
type:
Type: String
property:
Type: String
Resources:
RestApi:
Type: AWS::ApiGateway::RestApi
Properties:
Name: !Ref apiName
DocumentationPart:
Type: AWS::ApiGateway::DocumentationPart
Properties:
Location:
Type: !Ref type
RestApiId: !Ref RestApi
Properties: !Ref property
DocumentationVersion:
Type: AWS::ApiGateway::DocumentationVersion
Properties:
Description: !Ref description
DocumentationVersion: !Ref version
RestApiId: !Ref RestApi
DependsOn: DocumentationPart
See also
-
documentationpart:create in the Amazon API Gateway REST API Reference