-
Notifications
You must be signed in to change notification settings - Fork 0
/
serverless.yml
231 lines (216 loc) · 5.57 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
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
218
219
220
221
222
223
224
225
226
227
228
229
230
231
service: qa-service
provider:
name: aws
runtime: nodejs6.10
stage: prod
region: eu-west-1
environment:
DYNAMODB_THREAD_TABLE: Thread
DYNAMODB_REPLY_TABLE: Reply
iamRoleStatements:
- Effect: Allow
Action:
- dynamodb:DescribeTable
- dynamodb:Query
- dynamodb:Scan
- dynamodb:GetItem
- dynamodb:PutItem
- dynamodb:UpdateItem
- dynamodb:DeleteItem
Resource: "*"
functions:
threadCreate:
handler: api/threads/threadCreate.threadCreate
memorySize: 128
description: Submit thread.
events:
- http:
path: threads
method: post
cors: true
threadList:
handler: api/threads/threadList.threadList
memorySize: 128
description: Retrieve a paginated list of threads.
events:
- http:
path: threads
method: get
cors: true
threadUpdate:
handler: api/threads/threadUpdate.threadUpdate
events:
- http:
path: threads/{id}
method: put
cors: true
threadGet:
handler: api/threads/threadGet.threadGet
events:
- http:
path: threads/{id}
method: get
cors: true
threadDelete:
handler: api/threads/threadDelete.threadDelete
events:
- http:
path: threads/{id}
method: delete
cors: true
replyCreate:
handler: api/replies/replyCreate.replyCreate
memorySize: 128
description: Submit post information.
events:
- http:
path: replies
method: post
cors: true
replyList:
handler: api/replies/replyList.replyList
memorySize: 128
description: Retrieve a paginated list of replies by the value of Id
events:
- http:
path: replies
method: get
cors: true
replyUpdate:
handler: api/replies/replyUpdate.replyUpdate
events:
- http:
path: replies/{id}
method: put
cors: true
replyGet:
handler: api/replies/replyGet.replyGet
events:
- http:
path: replies/{id}
method: get
cors: true
replyDelete:
handler: api/replies/replyDelete.replyDelete
events:
- http:
path: replies/{id}
method: delete
cors: true
resources:
Resources:
ThreadDynamoDbTable:
Type: 'AWS::DynamoDB::Table'
DeletionPolicy: Retain
Properties:
AttributeDefinitions:
-
AttributeName: "Id"
AttributeType: "S"
-
AttributeName: "ForumId"
AttributeType: "S"
-
AttributeName: "UserId"
AttributeType: "S"
-
AttributeName: "CreatedDateTime"
AttributeType: "S"
-
AttributeName: "UpdatedDateTime"
AttributeType: "S"
KeySchema:
-
AttributeName: "Id"
KeyType: "HASH"
GlobalSecondaryIndexes:
-
IndexName: ForumIndex
KeySchema:
-
AttributeName: "ForumId"
KeyType: HASH
-
AttributeName: "UpdatedDateTime"
KeyType: RANGE
Projection:
ProjectionType: ALL
ProvisionedThroughput:
ReadCapacityUnits: 1
WriteCapacityUnits: 1
-
IndexName: UserIndex
KeySchema:
-
AttributeName: "UserId"
KeyType: HASH
-
AttributeName: "CreatedDateTime"
KeyType: RANGE
Projection:
ProjectionType: ALL
ProvisionedThroughput:
ReadCapacityUnits: 1
WriteCapacityUnits: 1
ProvisionedThroughput:
ReadCapacityUnits: 1
WriteCapacityUnits: 1
StreamSpecification:
StreamViewType: "NEW_AND_OLD_IMAGES"
TableName: Thread
ReplyDynamoDbTable:
Type: 'AWS::DynamoDB::Table'
DeletionPolicy: Retain
Properties:
AttributeDefinitions:
-
AttributeName: "Id"
AttributeType: "S"
-
AttributeName: "ThreadId"
AttributeType: "S"
-
AttributeName: "UserId"
AttributeType: "S"
-
AttributeName: "CreatedDateTime"
AttributeType: "S"
KeySchema:
-
AttributeName: "Id"
KeyType: "HASH"
GlobalSecondaryIndexes:
-
IndexName: ThreadIndex
KeySchema:
-
AttributeName: "ThreadId"
KeyType: HASH
-
AttributeName: "CreatedDateTime"
KeyType: RANGE
Projection:
ProjectionType: ALL
ProvisionedThroughput:
ReadCapacityUnits: 1
WriteCapacityUnits: 1
-
IndexName: UserIndex
KeySchema:
-
AttributeName: "UserId"
KeyType: HASH
-
AttributeName: "CreatedDateTime"
KeyType: RANGE
Projection:
ProjectionType: ALL
ProvisionedThroughput:
ReadCapacityUnits: 1
WriteCapacityUnits: 1
ProvisionedThroughput:
ReadCapacityUnits: 1
WriteCapacityUnits: 1
StreamSpecification:
StreamViewType: "NEW_AND_OLD_IMAGES"
TableName: Reply