AWS::ApiGateway::Resource
The AWS::ApiGateway::Resource resource creates a resource in an API.
Syntax
To declare this entity in your Amazon CloudFormation template, use the following syntax:
JSON
{ "Type" : "AWS::ApiGateway::Resource", "Properties" : { "ParentId" :String, "PathPart" :String, "RestApiId" :String} }
Properties
ParentId-
The parent resource's identifier.
Required: Yes
Type: String
Update requires: Replacement
PathPart-
The last path segment for this resource.
Required: Yes
Type: String
Update requires: Replacement
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 Reffunction, Refreturns the resource ID, such as abc123.
For more information about using the Reffunction, see Ref.
Fn::GetAtt
The Fn::GetAttintrinsic function returns a value for a specified attribute of this type. The following are the available attributes and sample return values.
For more information about using the Fn::GetAttintrinsic function, see Fn::GetAtt.
Examples
Create resource
The following example creates a stack resource for the MyApi API.
JSON
{ "Stack": { "Type": "AWS::ApiGateway::Resource", "Properties": { "RestApiId": { "Ref": "MyApi" }, "ParentId": { "Fn::GetAtt": [ "MyApi", "RootResourceId" ] }, "PathPart": "stack" } } }
YAML
Stack: Type: 'AWS::ApiGateway::Resource' Properties: RestApiId: !Ref MyApi ParentId: !GetAtt - MyApi - RootResourceId PathPart: stack
See also
-
resource:create in the Amazon API Gateway REST API Reference