-
Notifications
You must be signed in to change notification settings - Fork 0
/
serverless.yml
274 lines (250 loc) · 7.67 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
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
service: serverless-bank-integration-api
frameworkVersion: "3"
plugins:
- serverless-plugin-scripts
- serverless-offline
- serverless-dynamodb-local
package:
individually: true # Enables individual packaging for each function. If true you must provide package for each function. Defaults to false
excludeDevDependencies: true # Config if Serverless should automatically exclude dev dependencies in the deployment package. Defaults to true
patterns: # Specify the directories and files which should be included in the deployment package
- "!./**"
- node_modules/**
- "!node_modules/aws-sdk/**"
- "!node_modules/**/node_modules/aws-sdk/**"
custom:
# scripts:
# hooks:
# "before:package:createDeploymentArtifacts": npm run build
projectName: BankIntegrationApi
stage: ${opt:stage, "dev"}
region: ${opt:region, "eu-west-1"}
cfTags:
- Key: CreatedBy
Value: "[email protected]"
- Key: Project
Value: ${self:custom.projectName}
- Key: ProjectEnvironment
Value: ${self:custom.stage}
slsTags:
CreatedBy: "[email protected]"
Project: ${self:custom.projectName}
ProjectEnvironment: ${self:custom.stage}
dynamodb:
stages:
- local
serverless-offline:
httpPort: 4000
accountRequestTable: ServerlessBankIntegrationApi-Account-${self:custom.stage}
apiGatewayId:
local: 0liimcbux3
dev: 0liimcbux3
stg2: uqmrk1g21l
apiGatewayRootResourceId:
local: xfjxzmtzyh
dev: xfjxzmtzyh
stg2: e9npn4ivnd
mockBankApi:
local:
customerBackendServer:
local: http://localhost:3001/api/v2
dev:
stg2:
provider:
name: aws
runtime: nodejs16.x
stage: ${self:custom.stage}
# profile: bd-stg # profile is only used for local testing
region: ${self:custom.region}
timeout: 60
memorySize: 256
versionFunctions: false
apiGateway:
restApiId: ${self:custom.apiGatewayId.${self:custom.stage}}
restApiRootResourceId: ${self:custom.apiGatewayRootResourceId.${self:custom.stage}}
stackTags: ${self:custom.slsTags}
iam:
role:
statements:
- Effect: Allow
Action:
- dynamodb:DescribeTable
- dynamodb:Query
- dynamodb:Scan
- dynamodb:GetItem
- dynamodb:PutItem
- dynamodb:UpdateItem
- dynamodb:DeleteItem
Resource:
- "Fn::GetAtt": [AccountRequestTable, Arn]
environment:
ACCOUNT_REQUEST_TABLE_NAME: ${self:custom.accountRequestTable}
MOCK_BANK_API: ${self:custom.mockBankApi.${self:custom.stage}}
CUSTOMER_BACKEND_SERVER: ${self:custom.customerBackendServer.${self:custom.stage}}
functions:
health:
name: ${self:custom.projectName}-Health-${self:custom.stage} # Deployed Lambda name
description: Get Account Detail
handler: build/function/APIs/health/index.handler
tags: ${self:custom.slsTags}
timeout: 30
memorySize: 512
package:
patterns:
- "build/config/**"
- "build/lib/**"
- "build/function/APIs/health/**"
events:
- http:
method: Get
path: /bank-integration/
private: false
cors: true
- http:
method: Get
path: /bank-integration/{proxy+}
private: false
cors: true
get-account-detail:
name: ${self:custom.projectName}-GetAccountDetail-${self:custom.stage} # Deployed Lambda name
description: Get Account Detail
handler: build/function/APIs/get-account-detail/index.handler
tags: ${self:custom.slsTags}
timeout: 30
memorySize: 512
package:
patterns:
- "build/config/**"
- "build/lib/**"
- "build/function/APIs/get-account-detail/**"
events:
- http:
method: Get
path: /bank-integration/account
private: false
cors: true
- http:
method: Get
path: /bank-integration/account/{proxy+}
private: false
cors: true
create-account:
name: ${self:custom.projectName}-CreateAccount-${self:custom.stage} # Deployed Lambda name
description: Create Account
handler: build/function/APIs/create-account/index.handler
tags: ${self:custom.slsTags}
timeout: 30
memorySize: 512
package:
patterns:
- "build/config/**"
- "build/lib/**"
- "build/function/APIs/create-account/**"
events:
- http:
method: POST
path: /bank-integration/account
private: false
cors: true
- http:
method: POST
path: /bank-integration/account/{proxy+}
private: false
cors: true
send-out-transaction:
name: ${self:custom.projectName}-SendOutTransaction-${self:custom.stage} # Deployed Lambda name
description: Send Out Transaction
handler: build/function/APIs/send-out-transaction/index.handler
tags: ${self:custom.slsTags}
timeout: 30
memorySize: 512
package:
patterns:
- "build/config/**"
- "build/lib/**"
- "build/function/APIs/send-out-transaction/**"
events:
- http:
method: POST
path: /bank-integration/account/send
private: false
cors: true
- http:
method: POST
path: /bank-integration/account/send/{proxy+}
private: false
cors: true
create-account-webhook:
name: ${self:custom.projectName}-CreateAccountWebhook-${self:custom.stage} # Deployed Lambda name
description: Create Account Webhook
handler: build/function/Webhooks/create-account/index.handler
tags: ${self:custom.slsTags}
timeout: 30
memorySize: 512
package:
patterns:
- "build/config/**"
- "build/lib/**"
- "build/function/Webhooks/create-account/**"
events:
- http:
method: POST
path: /bank-integration/webhook/create-account
private: false
cors: true
- http:
method: POST
path: /bank-integration/webhook/create-account/{proxy+}
private: false
cors: true
send-out-transaction-webhook:
name: ${self:custom.projectName}-SendOutTransactionWebhook-${self:custom.stage} # Deployed Lambda name
description: Send Out Transaction Webhook.
handler: build/function/Webhooks/send-out-transaction/index.handler
tags: ${self:custom.slsTags}
timeout: 30
memorySize: 512
package:
patterns:
- "build/config/**"
- "build/lib/**"
- "build/function/Webhooks/send-out-transaction/**"
events:
- http:
method: POST
path: /bank-integration/webhook/send-out-transaction
private: false
cors: true
- http:
method: POST
path: /bank-integration/webhook/send-out-transaction/{proxy+}
private: false
cors: true
receive-transaction-webhook:
name: ${self:custom.projectName}-ReceiveTransaction-${self:custom.stage} # Deployed Lambda name
description: Receive Transaction Webhook.
handler: build/function/Webhooks/receive-transaction/index.handler
tags: ${self:custom.slsTags}
timeout: 30
memorySize: 512
package:
patterns:
- "build/config/**"
- "build/lib/**"
- "build/function/Webhooks/receive-transaction/**"
events:
- http:
method: POST
path: /bank-integration/webhook/receive-transaction
private: false
cors: true
- http:
method: POST
path: /bank-integration/webhook/receive-transaction/{proxy+}
private: false
cors: true
resources:
- ${file(./resources/dynamodb.yml)}
# Commands
# sls dynamodb start --migrate --stage=local
# sls offline --stage=local