Skip to content

Commit 6f612f8

Browse files
author
Anna Spysz
committed
API name
1 parent 46978b3 commit 6f612f8

File tree

1 file changed

+34
-34
lines changed

1 file changed

+34
-34
lines changed

template.yaml

Lines changed: 34 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -1,36 +1,6 @@
11
AWSTemplateFormatVersion: 2010-09-09
22
Transform: AWS::Serverless-2016-10-31
33
Resources:
4-
QuickstartAPI:
5-
Type: AWS::Serverless::Api
6-
Properties:
7-
Name: !Sub
8-
- ${ResourceName} From Stack ${StackTagName} Environment ${EnvironmentTagName}
9-
- ResourceName: QuickstartAPI
10-
StageName: !Ref EnvironmentAPIGatewayStageName
11-
DefinitionBody:
12-
swagger: '2.0'
13-
info: {}
14-
paths:
15-
/items:
16-
get:
17-
x-amazon-apigateway-integration:
18-
httpMethod: POST
19-
type: aws_proxy
20-
uri: !Sub arn:${AWS::Partition}:apigateway:${AWS::Region}:lambda:path/2015-03-31/functions/${getItems.Arn}/invocations
21-
responses: {}
22-
/newItem:
23-
post:
24-
x-amazon-apigateway-integration:
25-
httpMethod: POST
26-
type: aws_proxy
27-
uri: !Sub arn:${AWS::Partition}:apigateway:${AWS::Region}:lambda:path/2015-03-31/functions/${newItem.Arn}/invocations
28-
responses: {}
29-
EndpointConfiguration: REGIONAL
30-
TracingEnabled: true
31-
Cors:
32-
AllowHeaders: '''Authorization,Content-Type'''
33-
AllowOrigin: '''*'''
344
getItems:
355
Type: AWS::Serverless::Function
366
Properties:
@@ -49,12 +19,12 @@ Resources:
4919
- DynamoDBCrudPolicy:
5020
TableName: !Ref Items
5121
Events:
52-
QuickstartAPIGETitems:
22+
QuickstartApiGETitems:
5323
Type: Api
5424
Properties:
5525
Path: /items
5626
Method: GET
57-
RestApiId: !Ref QuickstartAPI
27+
RestApiId: !Ref QuickstartApi
5828
Environment:
5929
Variables:
6030
TABLE_NAME: !Ref Items
@@ -77,12 +47,12 @@ Resources:
7747
- DynamoDBCrudPolicy:
7848
TableName: !Ref Items
7949
Events:
80-
QuickstartAPIPOSTnewItem:
50+
QuickstartApiPOSTnewItem:
8151
Type: Api
8252
Properties:
8353
Path: /newItem
8454
Method: POST
85-
RestApiId: !Ref QuickstartAPI
55+
RestApiId: !Ref QuickstartApi
8656
Environment:
8757
Variables:
8858
TABLE_NAME: !Ref Items
@@ -132,6 +102,36 @@ Resources:
132102
BucketName: !Sub ${AWS::StackName}-frontend-${AWS::AccountId}
133103
WebsiteConfiguration:
134104
IndexDocument: index.html
105+
QuickstartApi:
106+
Type: AWS::Serverless::Api
107+
Properties:
108+
Name: !Sub
109+
- ${ResourceName} From Stack ${StackTagName} Environment ${EnvironmentTagName}
110+
- ResourceName: QuickstartApi
111+
StageName: !Ref EnvironmentAPIGatewayStageName
112+
DefinitionBody:
113+
swagger: '2.0'
114+
info: {}
115+
paths:
116+
/items:
117+
get:
118+
x-amazon-apigateway-integration:
119+
httpMethod: POST
120+
type: aws_proxy
121+
uri: !Sub arn:${AWS::Partition}:apigateway:${AWS::Region}:lambda:path/2015-03-31/functions/${getItems.Arn}/invocations
122+
responses: {}
123+
/newItem:
124+
post:
125+
x-amazon-apigateway-integration:
126+
httpMethod: POST
127+
type: aws_proxy
128+
uri: !Sub arn:${AWS::Partition}:apigateway:${AWS::Region}:lambda:path/2015-03-31/functions/${newItem.Arn}/invocations
129+
responses: {}
130+
EndpointConfiguration: REGIONAL
131+
TracingEnabled: true
132+
Cors:
133+
AllowHeaders: '''Authorization,Content-Type'''
134+
AllowOrigin: '''*'''
135135
Parameters:
136136
StackTagName:
137137
Type: String

0 commit comments

Comments
 (0)