-
Notifications
You must be signed in to change notification settings - Fork 0
/
serverless.yml
191 lines (185 loc) · 4.58 KB
/
serverless.yml
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
org: zacharysteudel
app: rafnel-api-app
# NOTE: update this with your service name
service: rafnel-api
# Create an optimized package for our functions
package:
individually: true
plugins:
- serverless-bundle # Package our functions with Webpack
- serverless-offline
provider:
name: aws
runtime: nodejs8.10
stage: prod
region: us-east-1
# 'iamRoleStatements' defines the permission policy for the Lambda function.
# In this case Lambda functions are granted with permissions to access DynamoDB.
iamRoleStatements:
- Effect: Allow
Action:
- dynamodb:DescribeTable
- dynamodb:Query
- dynamodb:Scan
- dynamodb:GetItem
- dynamodb:PutItem
- dynamodb:UpdateItem
- dynamodb:DeleteItem
Resource: "arn:aws:dynamodb:us-east-1:*:*"
functions:
createSwimComponent:
handler: createSwimComponent.main
events:
- http:
path: components
method: post
cors: true
authorizer: aws_iam
createSwimWorkout:
handler: createSwimWorkout.main
events:
- http:
path: workouts
method: post
cors: true
authorizer: aws_iam
createSwimWorkoutFolder:
handler: createSwimWorkoutFolder.main
events:
- http:
path: folders
method: post
cors: true
authorizer: aws_iam
deleteSwimWorkoutFolder:
handler: deleteSwimWorkoutFolder.main
events:
- http:
path: folders/delete
method: post
cors: true
authorizer: aws_iam
addNewUser:
handler: addNewUser.main
events:
- http:
path: users
method: post
cors: true
authorizer: aws_iam
updateSwimComponentLikes:
handler: updateSwimComponentLikes.main
events:
- http:
path: components/update/likes
method: post
cors: true
authorizer: aws_iam
updateSwimWorkoutFolder:
handler: updateSwimWorkoutFolder.main
events:
- http:
path: folders/update
method: post
cors: true
authorizer: aws_iam
updateWorkoutUsedDate:
handler: updateWorkoutUsedDate.main
events:
- http:
path: workout/update/date
method: post
cors: true
authorizer: aws_iam
updateUser:
handler: updateUser.main
events:
- http:
path: users/update
method: post
cors: true
authorizer: aws_iam
getSwimComponentByKey:
handler: getComponentByKey.main
events:
- http:
path: components/{username}/{component_id}
method: get
cors: true
authorizer: aws_iam
getWorkoutByKey:
handler: getWorkoutByKey.main
events:
- http:
path: workouts/{username}/{workout_id}
method: get
cors: true
authorizer: aws_iam
getSortedSwimComponentsBySet:
handler: getSortedSwimComponentsBySet.main
events:
- http:
path: components/set
method: post
cors: true
authorizer: aws_iam
getAllSwimWorkoutsFromUser:
handler: getAllSwimWorkoutsFromUser.main
events:
- http:
path: workouts/user
method: post
cors: true
authorizer: aws_iam
getSwimFoldersOfUser:
handler: getSwimFoldersOfUser.main
events:
- http:
path: folders/user
method: post
cors: true
authorizer: aws_iam
getChildSwimFolders:
handler: getChildSwimFolders.main
events:
- http:
path: folders/get-parent
method: post
cors: true
authorizer: aws_iam
getSwimWorkoutsInFolder:
handler: getSwimWorkoutsInFolder.main
events:
- http:
path: folders/get-workouts
method: post
cors: true
authorizer: aws_iam
getAllSwimComponentsFromUser:
handler: getAllSwimComponentsFromUser.main
events:
- http:
path: components/user
method: post
cors: true
authorizer: aws_iam
getRandomSwimComponent:
handler: getRandomSwimComponent.main
events:
- http:
path: components/random
method: get
cors: true
authorizer: aws_iam
getUser:
handler: getUser.main
events:
- http:
path: user/{username}
method: get
cors: true
authorizer: aws_iam
# Create our resources with separate CloudFormation templates
resources:
# API Gateway Errors
- ${file(resources/api-gateway-errors.yml)}