-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathserverless.yml
More file actions
217 lines (210 loc) · 5.3 KB
/
serverless.yml
File metadata and controls
217 lines (210 loc) · 5.3 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
service: offer-service
frameworkVersion: '2'
provider:
name: aws
apiGateway:
apiKeys:
- name: api-key
value: v3IPj3dPvT62rJYm3Ho7d2owPMxyYQ7x5kJNWcsH
runtime: nodejs12.x
lambdaHashingVersion: 20201221
stage: dev
region: us-east-1
environment:
DEFAULT_UUID: "3693ac7e-3e2b-432c-8c60-2b786453ca9b"
BRAND_TABLE: "brand-dev"
LOCATION_TABLE: "location-dev"
OFFER_TABLE: "offer-dev"
iamRoleStatements:
- Effect: Allow
Action:
- dynamodb:Query
- dynamodb:Scan
- dynamodb:GetItem
- dynamodb:PutItem
- dynamodb:UpdateItem
Resource: "*"
functions:
# Brands (Create, Index, Show)
createBrands:
handler: api/brand.create
memorySize: 128
description: Create Brands
events:
- http:
path: brand
method: post
private: true
getAllBrands:
handler: api/brand.index
memorySize: 128
description: Get all Brands
events:
- http:
path: brand
method: get
private: true
showBrand:
handler: api/brand.show
memorySize: 128
description: Get Brand by id
events:
- http:
path: brand/{brandId}
method: get
private: true
# Offers (Create, Index, Show)
createOffers:
handler: api/offer.create
memorySize: 128
description: Create offers for Brands
events:
- http:
path: offer
method: post
private: true
getAllOffers:
handler: api/offer.index
memorySize: 128
description: Get all Offers
events:
- http:
path: offer
method: get
private: true
showOffer:
handler: api/offer.show
memorySize: 128
description: Get Offer by id
events:
- http:
path: offer/{offerId}
method: get
private: true
# Location (Create, Index, Show)
createLocations:
handler: api/location.create
memorySize: 128
description: Create Locations
events:
- http:
path: location
method: post
private: true
getAllLocations:
handler: api/location.index
memorySize: 128
description: Get all Locations
events:
- http:
path: location
method: get
private: true
showLocation:
handler: api/location.show
memorySize: 128
description: Get Location by id
events:
- http:
path: location/{locationId}
method: get
private: true
# Logical Endpoints - Part 2 and Bonus
offersLocationAssigner:
handler: api/offer.linkToLocation
memorySize: 128
description: Link location to a Offer
events:
- http:
path: offer/{offerId}/link-location/{locationId}
method: post
private: true
brandsOffersLocationAssigner:
handler: api/offer.linkAllBrandsLocationToAnOffer
memorySize: 128
description: Link all locations from a Brand to an Offer
events:
- http:
path: offer/{offerId}/link-all-brands-location/{brandId}
method: post
private: true
resources:
Resources:
OffersDynamoDbTable:
Type: 'AWS::DynamoDB::Table'
DeletionPolicy: Retain
Properties:
TableName: ${self:provider.environment.OFFER_TABLE}
AttributeDefinitions:
-
AttributeName: "id"
AttributeType: "S"
-
AttributeName: "brandId"
AttributeType: "S"
KeySchema:
-
AttributeName: "id"
KeyType: "HASH"
GlobalSecondaryIndexes:
-
IndexName: "brandIdIndex"
KeySchema:
-
AttributeName: "brandId"
KeyType: "HASH"
Projection:
ProjectionType: "ALL"
ProvisionedThroughput:
ReadCapacityUnits: 1
WriteCapacityUnits: 1
ProvisionedThroughput:
ReadCapacityUnits: 1
WriteCapacityUnits: 1
LocationsDynamoDbTable:
Type: 'AWS::DynamoDB::Table'
DeletionPolicy: Retain
Properties:
TableName: ${self:provider.environment.LOCATION_TABLE}
AttributeDefinitions:
-
AttributeName: "id"
AttributeType: "S"
-
AttributeName: "brandId"
AttributeType: "S"
KeySchema:
-
AttributeName: "id"
KeyType: "HASH"
GlobalSecondaryIndexes:
-
IndexName: "brandIdIndex"
KeySchema:
-
AttributeName: "brandId"
KeyType: "HASH"
Projection:
ProjectionType: "ALL"
ProvisionedThroughput:
ReadCapacityUnits: 1
WriteCapacityUnits: 1
ProvisionedThroughput:
ReadCapacityUnits: 1
WriteCapacityUnits: 1
BrandsDynamoDbTable:
Type: 'AWS::DynamoDB::Table'
DeletionPolicy: Retain
Properties:
TableName: ${self:provider.environment.BRAND_TABLE}
AttributeDefinitions:
-
AttributeName: "id"
AttributeType: "S"
KeySchema:
-
AttributeName: "id"
KeyType: "HASH"
ProvisionedThroughput:
ReadCapacityUnits: 1
WriteCapacityUnits: 1