generated from LBHackney-IT/lbh-base-api
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathserverless.yml
More file actions
931 lines (927 loc) · 35.1 KB
/
serverless.yml
File metadata and controls
931 lines (927 loc) · 35.1 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
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
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
service: housing-finance-interim-api
provider:
name: aws
timeout: 300
runtime: dotnet8
vpc: ${self:custom.vpc.${opt:stage}}
stage: ${opt:stage}
region: eu-west-2
apiKeys:
- secureAccess:
- api-key-${self:service}-${self:provider.stage}
usagePlan:
- secureAccess:
throttle:
burstLimit: 200
rateLimit: 100
environment:
CONNECTION_STRING: Data Source=${ssm:/housing-finance/${self:provider.stage}/db-host},${ssm:/housing-finance/${self:provider.stage}/db-port};Initial Catalog=${ssm:/housing-finance/${self:provider.stage}/db-database};Integrated Security=False;User Id=${ssm:/housing-finance/${self:provider.stage}/db-username};Password=${ssm:/housing-finance/${self:provider.stage}/db-password};Encrypt=False;TrustServerCertificate=False;MultipleActiveResultSets=True;
GOOGLE_API_KEY: ${ssm:/housing-finance/${self:provider.stage}/google-application-credentials-json}
WAIT_DURATION: ${ssm:/housing-finance/${self:provider.stage}/step-function-wait-duration}
BATCH_SIZE: ${ssm:/housing-finance/${self:provider.stage}/bulk-insert-batch-size}
CASH_FILE_REGEX: ${ssm:/housing-finance/${self:provider.stage}/cash-file-regex}
HOUSING_FILE_REGEX: ${ssm:/housing-finance/${self:provider.stage}/housing-benefit-file-regex}
ACCEPTED_ORIGINS: ${ssm:/housing-finance/${self:provider.stage}/cors-accepted-origins}
CHARGES_BATCH_YEARS: ${ssm:/housing-finance/${self:provider.stage}/charges-batch-years}
S3_BUCKET_NAME: ${ssm:/housing-finance/${self:provider.stage}/s3-bucket-name}
S3_OBJECT_PREFIX: ${ssm:/housing-finance/${self:provider.stage}/s3-object-prefix}
HOUSING_FINANCE_ALLOWED_GROUPS: ${ssm:/housing-finance/${self:provider.stage}/housing-finance-allowed-groups}
ENVIRONMENT_NAME: ${self:provider.stage}
package:
artifact: ./bin/release/net8.0/housing-finance-interim-api.zip
functions:
interimFinanceSystem:
name: ${self:service}-${self:provider.stage}
handler: HousingFinanceInterimApi::HousingFinanceInterimApi.LambdaEntryPoint::FunctionHandlerAsync
role: lambdaExecutionRole
events:
- http:
path: /{proxy+}
method: ANY
authorizer:
arn: ${self:custom.authorizerArns.${opt:stage}}
type: request
resultTtlInSeconds: 0
identitySource: method.request.header.Authorization
managedExternally: true
cors:
origin: '*'
headers:
- Content-Type
- If-Match
- X-Amz-Date
- Authorization
- X-Api-Key
- X-Amz-Security-Token
- X-Amz-User-Agent
- x-correlation-id
allowCredentials: false
- http:
path: /swagger/{proxy+}
method: GET
private: false
loadTenancyAgreement:
name: ${self:service}-${self:provider.stage}-load-tenagree
description: "The scheduler to update and add new tenancy agreements. Run at 12:00 AM"
timeout: 900
handler: HousingFinanceInterimApi::HousingFinanceInterimApi.Handler::LoadTenancyAgreement
role: lambdaExecutionRole
events:
- schedule: cron(0 0 * * ? *)
checkCashFiles:
name: ${self:service}-${self:provider.stage}-check-cash-files
description: "The scheduler to check if exists cash files. "
handler: HousingFinanceInterimApi::HousingFinanceInterimApi.Handler::CheckCashFiles
importCashFile:
name: ${self:service}-${self:provider.stage}-cash-file
description: "The scheduler to import cash files from Google drives."
timeout: 900
handler: HousingFinanceInterimApi::HousingFinanceInterimApi.Handler::ImportCashFile
role: lambdaExecutionRole
importCashFileTransactions:
name: ${self:service}-${self:provider.stage}-cash-file-trans
description: "The scheduler to import cash files transactions from Cash File table."
timeout: 600
handler: HousingFinanceInterimApi::HousingFinanceInterimApi.Handler::LoadCashFileTransactions
role: lambdaExecutionRole
checkHousingFiles:
name: ${self:service}-${self:provider.stage}-check-housing-files
description: "The scheduler to check if exists housing benefit files. "
handler: HousingFinanceInterimApi::HousingFinanceInterimApi.Handler::CheckHousingBenefitFiles
importHousingFile:
name: ${self:service}-${self:provider.stage}-housing-file
description: "The scheduler to import housing files from Google drives."
timeout: 900
handler: HousingFinanceInterimApi::HousingFinanceInterimApi.Handler::ImportHousingBenefitFile
role: lambdaExecutionRole
importHousingFileTransactions:
name: ${self:service}-${self:provider.stage}-housing-file-trans
description: "The scheduler to import housing files transactions from Housing File table."
timeout: 600
handler: HousingFinanceInterimApi::HousingFinanceInterimApi.Handler::LoadHousingBenefitFileTransactions
role: lambdaExecutionRole
refreshCurrentBalance:
name: ${self:service}-${self:provider.stage}-refresh-cur-bal
description: "The scheduler to refresh current balance table."
timeout: 900
handler: HousingFinanceInterimApi::HousingFinanceInterimApi.Handler::RefreshCurrentBalance
role: lambdaExecutionRole
refreshOperatingBalance:
name: ${self:service}-${self:provider.stage}-refresh-op-bal
description: "The scheduler to refresh operating balance table. Run at 06:45 AM"
timeout: 900
handler: HousingFinanceInterimApi::HousingFinanceInterimApi.Handler::RefreshOperatingBalance
role: lambdaExecutionRole
events:
- schedule: cron(45 6 * * ? *)
refreshManageArrearsTables:
name: ${self:service}-${self:provider.stage}-refresh-ma-cur-bal
description: "The scheduler to refresh manage arrears balance based on current balance table."
timeout: 900
handler: HousingFinanceInterimApi::HousingFinanceInterimApi.Handler::RefreshManageArrears
role: lambdaExecutionRole
importDirectDebit:
name: ${self:service}-${self:provider.stage}-direct-debit
description: "The scheduler to import direct debit from Google Spreadshet."
timeout: 600
handler: HousingFinanceInterimApi::HousingFinanceInterimApi.Handler::LoadDirectDebit
role: lambdaExecutionRole
importDirectDebitTransactions:
name: ${self:service}-${self:provider.stage}-direct-debit-trans
description: "The scheduler to import direct debit transactions from DirectDebit table."
timeout: 600
handler: HousingFinanceInterimApi::HousingFinanceInterimApi.Handler::LoadDirectDebitTransactions
role: lambdaExecutionRole
importDirectDebitTransactionsOnDemand:
name: ${self:service}-${self:provider.stage}-direct-debit-trans-dem
description: "The scheduler to import direct debit transactions on demand from Google Spreadshet."
timeout: 900
handler: HousingFinanceInterimApi::HousingFinanceInterimApi.Handler::LoadDirectDebitTransactionsOnDemand
role: lambdaExecutionRole
checkChargesBatchYears:
name: ${self:service}-${self:provider.stage}-check-years
description: "The scheduler to check pending year to process charges. "
handler: HousingFinanceInterimApi::HousingFinanceInterimApi.Handler::CheckChargesBatchYears
importCharges:
name: ${self:service}-${self:provider.stage}-charges
description: "The scheduler to import charges from Google Spreadshet."
timeout: 900
handler: HousingFinanceInterimApi::HousingFinanceInterimApi.Handler::LoadCharges
role: lambdaExecutionRole
importChargesHistory:
name: ${self:service}-${self:provider.stage}-charges-hist
description: "The scheduler to import charges history."
timeout: 900
handler: HousingFinanceInterimApi::HousingFinanceInterimApi.Handler::LoadChargesHistory
role: lambdaExecutionRole
importChargesTransactions:
name: ${self:service}-${self:provider.stage}-charges-trans
description: "The scheduler to import charges transactions from Charges table."
timeout: 900
handler: HousingFinanceInterimApi::HousingFinanceInterimApi.Handler::LoadChargesTransactions
role: lambdaExecutionRole
importChargesTransactionsOnDemand:
name: ${self:service}-${self:provider.stage}-charges-trans-dem
description: "The scheduler to import charges transactions on demand from Google Spreadshet."
timeout: 900
handler: HousingFinanceInterimApi::HousingFinanceInterimApi.Handler::LoadChargesTransactionsOnDemand
role: lambdaExecutionRole
loadActionDiary:
name: ${self:service}-${self:provider.stage}-action-diary
description: "The scheduler to load action diary spreadsheet. Run at 03:00 AM"
timeout: 900
handler: HousingFinanceInterimApi::HousingFinanceInterimApi.Handler::LoadActionDiary
role: lambdaExecutionRole
events:
- schedule: cron(0 3 * * ? *)
generateRentPosition:
name: ${self:service}-${self:provider.stage}-rent-position
description: "The scheduler to generate rent position csv file. Run at 05:00 AM"
timeout: 900
handler: HousingFinanceInterimApi::HousingFinanceInterimApi.Handler::GenerateRentPosition
role: lambdaExecutionRole
events:
- schedule: cron(0 5 * * ? *)
importAdjustmentsTransactions:
name: ${self:service}-${self:provider.stage}-adjustments-trans
description: "The scheduler to import adjustments transactions from spreadsheet. Runs at 2:45 AM."
timeout: 600
handler: HousingFinanceInterimApi::HousingFinanceInterimApi.Handler::LoadAdjustmentsTransactions
role: lambdaExecutionRole
events:
- schedule: cron(45 2 * * ? *)
suspenseCash:
name: ${self:service}-${self:provider.stage}-susp-cash
description: "The scheduler to load and reverse suspense cash files. Run at 03:05 AM"
timeout: 900
handler: HousingFinanceInterimApi::HousingFinanceInterimApi.Handler::LoadSuspenseCashTransactions
role: lambdaExecutionRole
events:
- schedule: cron(5 3 * * ? *)
suspenseHousingBenefit:
name: ${self:service}-${self:provider.stage}-susp-hb
description: "The scheduler to load and reverse suspense hb files. Run at 03:10 AM"
timeout: 900
handler: HousingFinanceInterimApi::HousingFinanceInterimApi.Handler::LoadSuspenseHousingBenefitTransactions
role: lambdaExecutionRole
events:
- schedule: cron(10 3 * * ? *)
generateReport:
name: ${self:service}-${self:provider.stage}-gen-report
description: "The scheduler to generate google drive reports."
timeout: 900
handler: HousingFinanceInterimApi::HousingFinanceInterimApi.Handler::GenerateReport
role: lambdaExecutionRole
parseNightlyProcessLogs:
name: ${self:service}-${self:provider.stage}-query-nightly-logs
description: "The scheduler to parse the nightly process logs for any errors. Run at 07:30 AM"
timeout: 900
handler: HousingFinanceInterimApi::HousingFinanceInterimApi.Handler::ParseNightlyProcessLogs
role: lambdaExecutionRole
events:
- schedule: cron(30 7 * * ? *)
stepFunctions:
stateMachines:
hfstepfunccashfile:
name: HFCashFileStateMachine
events:
- schedule: cron(0 2 * * ? *)
definition:
Comment: "Cash files process step function deployed via serverless. Run at 02:00 AM"
StartAt: ImportCashFile
States:
ImportCashFile:
Type: Task
Resource:
Fn::GetAtt: [ importCashFile, Arn ]
Retry:
- ErrorEquals:
- States.All
IntervalSeconds: 30
MaxAttempts: 3
BackoffRate: 2
Next: Wait_2
Wait_2:
Type: Wait
TimestampPath: $.NextStepTime
Next: ImportCashFileTransactions
ImportCashFileTransactions:
Type: Task
Resource:
Fn::GetAtt: [ importCashFileTransactions, Arn ]
Retry:
- ErrorEquals:
- States.All
IntervalSeconds: 30
MaxAttempts: 3
BackoffRate: 2
Next: EndStep
EndStep:
Type: Succeed
dependsOn: lambdaExecutionRole
tags:
Team: HousingFinance
hfstepfunchousingfile:
name: HFHousingFileStateMachine
events:
- schedule: cron(0 6 ? * MON *)
definition:
Comment: "Housing files process step function deployed via serverless. Run at 06:00 AM only Monday"
StartAt: CheckHousingFiles
States:
CheckHousingFiles:
Type: Task
Resource:
Fn::GetAtt: [ checkHousingFiles, Arn ]
Retry:
- ErrorEquals:
- States.All
IntervalSeconds: 30
MaxAttempts: 3
BackoffRate: 2
Next: Wait_1
Wait_1:
Type: Wait
TimestampPath: $.NextStepTime
Next: ImportHousingFile
ImportHousingFile:
Type: Task
Resource:
Fn::GetAtt: [ importHousingFile, Arn ]
Retry:
- ErrorEquals:
- States.All
IntervalSeconds: 30
MaxAttempts: 3
BackoffRate: 2
Next: Wait_2
Wait_2:
Type: Wait
TimestampPath: $.NextStepTime
Next: ImportHousingFileTransactions
ImportHousingFileTransactions:
Type: Task
Resource:
Fn::GetAtt: [ importHousingFileTransactions, Arn ]
Retry:
- ErrorEquals:
- States.All
IntervalSeconds: 30
MaxAttempts: 3
BackoffRate: 2
Next: EndStep
EndStep:
Type: Succeed
dependsOn: lambdaExecutionRole
tags:
Team: HousingFinance
hfstepfuncdirectdebit:
name: HFDirectDebitStateMachine
events:
- schedule: cron(30 2 * * ? *)
definition:
Comment: "Direct debit process step function deployed via serverless. Run at 02:30 AM"
StartAt: ImportDirectDebit
States:
ImportDirectDebit:
Type: Task
Resource:
Fn::GetAtt: [ importDirectDebit, Arn ]
Retry:
- ErrorEquals:
- States.All
IntervalSeconds: 30
MaxAttempts: 3
BackoffRate: 2
Next: Wait_1
Wait_1:
Type: Wait
TimestampPath: $.NextStepTime
Next: Choice_1
Choice_1:
Type: Choice
Choices:
- Variable: $.Continue
BooleanEquals: true
Next: ImportDirectDebitTransactions
- Variable: $.Continue
BooleanEquals: false
Next: EndStep
ImportDirectDebitTransactions:
Type: Task
Resource:
Fn::GetAtt: [ importDirectDebitTransactions, Arn ]
Retry:
- ErrorEquals:
- States.All
IntervalSeconds: 30
MaxAttempts: 3
BackoffRate: 2
Next: EndStep
EndStep:
Type: Succeed
dependsOn: lambdaExecutionRole
tags:
Team: HousingFinance
# hfstepfunccharges:
# name: HFChargesStateMachine
# events:
# - schedule: cron(30 0 * * ? *)
# definition:
# Comment: "Charges process step function deployed via serverless. Run at 12:30 AM"
# StartAt: CheckChargesBatchYears
# States:
# CheckChargesBatchYears:
# Type: Task
# Resource:
# Fn::GetAtt: [ checkChargesBatchYears, Arn ]
# Retry:
# - ErrorEquals:
# - States.All
# IntervalSeconds: 30
# MaxAttempts: 3
# BackoffRate: 2
# Next: Choice_ExistPendingYear
# Choice_ExistPendingYear:
# Type: Choice
# Choices:
# - Variable: $.Continue
# BooleanEquals: true
# Next: Wait_0
# - Variable: $.Continue
# BooleanEquals: false
# Next: EndStep
# Wait_0:
# Type: Wait
# TimestampPath: $.NextStepTime
# Next: ImportCharges
# ImportCharges:
# Type: Task
# Resource:
# Fn::GetAtt: [ importCharges, Arn ]
# Retry:
# - ErrorEquals:
# - States.All
# IntervalSeconds: 30
# MaxAttempts: 3
# BackoffRate: 2
# Next: Wait_1
# Wait_1:
# Type: Wait
# TimestampPath: $.NextStepTime
# Next: ImportChargesHistory
# ImportChargesHistory:
# Type: Task
# Resource:
# Fn::GetAtt: [ importChargesHistory, Arn ]
# Retry:
# - ErrorEquals:
# - States.All
# IntervalSeconds: 30
# MaxAttempts: 3
# BackoffRate: 2
# Next: Wait_2
# Wait_2:
# Type: Wait
# TimestampPath: $.NextStepTime
# Next: ImportChargesTransactions
# ImportChargesTransactions:
# Type: Task
# Resource:
# Fn::GetAtt: [ importChargesTransactions, Arn ]
# Retry:
# - ErrorEquals:
# - States.All
# IntervalSeconds: 30
# MaxAttempts: 3
# BackoffRate: 2
# Next: CheckChargesBatchYears
# EndStep:
# Type: Succeed
# dependsOn: lambdaExecutionRole
# tags:
# Team: HousingFinance
hfstepfunccurentbalance:
name: HFCurrentBalanceStateMachine
events:
- schedule: cron(10 6 * * ? *)
definition:
Comment: "Current balance process step function deployed via serverless. Run at 06:10 AM"
StartAt: RefreshCurrentBalance
States:
RefreshCurrentBalance:
Type: Task
Resource:
Fn::GetAtt: [ refreshCurrentBalance, Arn ]
Retry:
- ErrorEquals:
- States.All
IntervalSeconds: 30
MaxAttempts: 3
BackoffRate: 2
Next: Wait_1
Wait_1:
Type: Wait
TimestampPath: $.NextStepTime
Next: RefreshManageArrears
RefreshManageArrears:
Type: Task
Resource:
Fn::GetAtt: [ refreshManageArrearsTables, Arn ]
Retry:
- ErrorEquals:
- States.All
IntervalSeconds: 30
MaxAttempts: 3
BackoffRate: 2
Next: EndStep
EndStep:
Type: Succeed
dependsOn: lambdaExecutionRole
tags:
Team: HousingFinance
hfstepfuncreport:
name: HFReportsStateMachine
events:
- schedule: cron(0/30 * * * ? *)
definition:
Comment: "Reports step function deployed via serverless. Run every 30 min"
StartAt: GenerateReport
States:
GenerateReport:
Type: Task
Resource:
Fn::GetAtt: [ generateReport, Arn ]
Retry:
- ErrorEquals:
- States.All
IntervalSeconds: 30
MaxAttempts: 3
BackoffRate: 2
Next: Choice_ExistPendingReport
Choice_ExistPendingReport:
Type: Choice
Choices:
- Variable: $.Continue
BooleanEquals: true
Next: Wait_0
- Variable: $.Continue
BooleanEquals: false
Next: EndStep
Wait_0:
Type: Wait
TimestampPath: $.NextStepTime
Next: GenerateReport
EndStep:
Type: Succeed
dependsOn: lambdaExecutionRole
tags:
Team: HousingFinance
resources:
Resources:
lambdaExecutionRole:
Type: AWS::IAM::Role
Properties:
Path: /${self:service}/${self:provider.stage}/
RoleName: ${self:service}-lambdaExecutionRole
AssumeRolePolicyDocument:
Version: '2012-10-17'
Statement:
- Effect: Allow
Principal:
Service:
- lambda.amazonaws.com
Action: sts:AssumeRole
ManagedPolicyArns:
- arn:aws:iam::aws:policy/service-role/AWSLambdaVPCAccessExecutionRole
Policies:
- PolicyName: manageLogs
PolicyDocument:
Version: '2012-10-17'
Statement:
- Effect: Allow
Action:
- logs:CreateLogGroup
- logs:CreateLogStream
- logs:PutLogEvents
Resource:
- 'Fn::Join':
- ':'
- - 'arn:aws:logs'
- Ref: 'AWS::Region'
- Ref: 'AWS::AccountId'
- 'log-group:/aws/lambda/*:*:*'
- Effect: "Allow"
Action:
- "s3:PutObject"
- "s3:GetObject"
Resource:
Fn::Join:
- ""
- - "arn:aws:s3:::"
- "Ref": "ServerlessDeploymentBucket"
- PolicyName: lambdaInvocation
PolicyDocument:
Version: '2012-10-17'
Statement:
- Effect: Allow
Action:
- "lambda:InvokeFunction"
Resource: "*"
LoadTenancyAgreementLambdaAlarm:
Type: AWS::CloudWatch::Alarm
Properties:
AlarmName: "${self:provider.stage}-load-tenagree-lambda-alarm"
AlarmDescription: Errors detected in AWS Lambda for Load Tenancy Agreement (load-tenagree) function
Namespace: AWS/Lambda
MetricName: "Errors"
Statistic: Sum
Threshold: 0
ComparisonOperator: GreaterThanThreshold
EvaluationPeriods: 1
Period: 60
TreatMissingData: notBreaching
AlarmActions:
- 'Fn::Join':
- ':'
- - 'arn:aws:sns'
- Ref: 'AWS::Region'
- Ref: 'AWS::AccountId'
- 'housing-finance-alarms'
Dimensions:
- Name: FunctionName
Value: ${self:service}-${self:provider.stage}-load-tenagree
LoadSuspenseCashTransactionsLambdaAlarm:
Type: AWS::CloudWatch::Alarm
Properties:
AlarmName: "${self:provider.stage}-susp-cash-lambda-alarm"
AlarmDescription: Errors detected in AWS Lambda for Load Suspense Cash (susp-cash) function
Namespace: AWS/Lambda
MetricName: "Errors"
Statistic: Sum
Threshold: 0
ComparisonOperator: GreaterThanThreshold
EvaluationPeriods: 1
Period: 60
TreatMissingData: notBreaching
AlarmActions:
- 'Fn::Join':
- ':'
- - 'arn:aws:sns'
- Ref: 'AWS::Region'
- Ref: 'AWS::AccountId'
- 'housing-finance-alarms'
Dimensions:
- Name: FunctionName
Value: ${self:service}-${self:provider.stage}-susp-cash
CashFileLambdaAlarm:
Type: AWS::CloudWatch::Alarm
Properties:
AlarmName: "${self:provider.stage}-housing-finance-cash-file-lambda-alarm"
AlarmDescription: Errors detected in AWS Lambda for CashFile function
Namespace: AWS/Lambda
MetricName: "Errors"
Statistic: Sum
Threshold: 0
ComparisonOperator: GreaterThanThreshold
EvaluationPeriods: 1
Period: 60
TreatMissingData: notBreaching
AlarmActions:
- 'Fn::Join':
- ':'
- - 'arn:aws:sns'
- Ref: 'AWS::Region'
- Ref: 'AWS::AccountId'
- 'housing-finance-alarms'
Dimensions:
- Name: FunctionName
Value: ${self:service}-${self:provider.stage}-cash-file
RentPositionLambdaAlarm:
Type: AWS::CloudWatch::Alarm
Properties:
AlarmName: "${self:provider.stage}-housing-finance-rent-position-lambda-alarm"
AlarmDescription: Errors detected in AWS Lambda for Rent Position function
Namespace: AWS/Lambda
MetricName: "Errors"
Statistic: Sum
Threshold: 0
ComparisonOperator: GreaterThanThreshold
EvaluationPeriods: 1
Period: 60
TreatMissingData: notBreaching
AlarmActions:
- 'Fn::Join':
- ':'
- - 'arn:aws:sns'
- Ref: 'AWS::Region'
- Ref: 'AWS::AccountId'
- 'housing-finance-alarms'
Dimensions:
- Name: FunctionName
Value: ${self:service}-${self:provider.stage}-rent-position
LoadActionDiaryLambdaAlarm:
Type: AWS::CloudWatch::Alarm
Properties:
AlarmName: "${self:provider.stage}-housing-finance-action-diary-lambda-alarm"
AlarmDescription: Errors detected in AWS Lambda for Load Action Diary function
Namespace: AWS/Lambda
MetricName: "Errors"
Statistic: Sum
Threshold: 0
ComparisonOperator: GreaterThanThreshold
EvaluationPeriods: 1
Period: 60
TreatMissingData: notBreaching
AlarmActions:
- 'Fn::Join':
- ':'
- - 'arn:aws:sns'
- Ref: 'AWS::Region'
- Ref: 'AWS::AccountId'
- 'housing-finance-alarms'
Dimensions:
- Name: FunctionName
Value: ${self:service}-${self:provider.stage}-action-diary
HousingFileLambdaAlarm:
Type: AWS::CloudWatch::Alarm
Properties:
AlarmName: "${self:provider.stage}-housing-finance-check-housing-files-lambda-alarm"
AlarmDescription: Errors detected in AWS Lambda for Check Housing File function
Namespace: AWS/Lambda
MetricName: "Errors"
Statistic: Sum
Threshold: 0
ComparisonOperator: GreaterThanThreshold
EvaluationPeriods: 1
Period: 60
TreatMissingData: notBreaching
AlarmActions:
- 'Fn::Join':
- ':'
- - 'arn:aws:sns'
- Ref: 'AWS::Region'
- Ref: 'AWS::AccountId'
- 'housing-finance-alarms'
Dimensions:
- Name: FunctionName
Value: ${self:service}-${self:provider.stage}-check-housing-files
SuspenseHousingBenefitLambdaAlarm:
Type: AWS::CloudWatch::Alarm
Properties:
AlarmName: "${self:provider.stage}-susp-hb-lambda-alarm"
AlarmDescription: Errors detected in AWS Lambda for Suspense Housing Benefit (susp-hb) function
Namespace: AWS/Lambda
MetricName: "Errors"
Statistic: Sum
Threshold: 0
ComparisonOperator: GreaterThanThreshold
EvaluationPeriods: 1
Period: 60
TreatMissingData: notBreaching
AlarmActions:
- 'Fn::Join':
- ':'
- - 'arn:aws:sns'
- Ref: 'AWS::Region'
- Ref: 'AWS::AccountId'
- 'housing-finance-alarms'
Dimensions:
- Name: FunctionName
Value: ${self:service}-${self:provider.stage}-susp-hb
ImportCashFileTransactionsAlarm:
Type: AWS::CloudWatch::Alarm
Properties:
AlarmName: "${self:provider.stage}-cash-file-trans-alarm"
AlarmDescription: Errors detected in AWS Lambda for CashFileTransactions function
Namespace: AWS/Lambda
MetricName: "Errors"
Statistic: Sum
Threshold: 0
ComparisonOperator: GreaterThanThreshold
EvaluationPeriods: 1
Period: 60
TreatMissingData: notBreaching
AlarmActions:
- 'Fn::Join':
- ':'
- - 'arn:aws:sns'
- Ref: 'AWS::Region'
- Ref: 'AWS::AccountId'
- 'housing-finance-alarms'
Dimensions:
- Name: FunctionName
Value: ${self:service}-${self:provider.stage}-cash-file-trans
ImportDirectDebitAlarm:
Type: AWS::CloudWatch::Alarm
Properties:
AlarmName: "${self:provider.stage}-housing-finance-direct-debit-lambda-alarm"
AlarmDescription: Errors detected in AWS Lambda for Import Direct Debit function
Namespace: AWS/Lambda
MetricName: "Errors"
Statistic: Sum
Threshold: 0
ComparisonOperator: GreaterThanThreshold
EvaluationPeriods: 1
Period: 60
TreatMissingData: notBreaching
AlarmActions:
- 'Fn::Join':
- ':'
- - 'arn:aws:sns'
- Ref: 'AWS::Region'
- Ref: 'AWS::AccountId'
- 'housing-finance-alarms'
Dimensions:
- Name: FunctionName
Value: ${self:service}-${self:provider.stage}-direct-debit
OperatingBalanceLambdaAlarm:
Type: AWS::CloudWatch::Alarm
Properties:
AlarmName: "${self:provider.stage}-housing-finance-refresh-op-bal-lambda-alarm"
AlarmDescription: Errors detected in AWS Lambda for Refresh Operating Balance function
Namespace: AWS/Lambda
MetricName: "Errors"
Statistic: Sum
Threshold: 0
ComparisonOperator: GreaterThanThreshold
EvaluationPeriods: 1
Period: 60
TreatMissingData: notBreaching
AlarmActions:
- 'Fn::Join':
- ':'
- - 'arn:aws:sns'
- Ref: 'AWS::Region'
- Ref: 'AWS::AccountId'
- 'housing-finance-alarms'
Dimensions:
- Name: FunctionName
Value: ${self:service}-${self:provider.stage}-refresh-op-bal
HousingFileTransactionsLambdaAlarm:
Type: AWS::CloudWatch::Alarm
Properties:
AlarmName: "${self:provider.stage}-housing-file-trans-lambda-alarm"
AlarmDescription: Errors detected in AWS Lambda for Import Housing Files Transactions function
Namespace: AWS/Lambda
MetricName: "Errors"
Statistic: Sum
Threshold: 0
ComparisonOperator: GreaterThanThreshold
EvaluationPeriods: 1
Period: 60
TreatMissingData: notBreaching
AlarmActions:
- 'Fn::Join':
- ':'
- - 'arn:aws:sns'
- Ref: 'AWS::Region'
- Ref: 'AWS::AccountId'
- 'housing-finance-alarms'
Dimensions:
- Name: FunctionName
Value: ${self:service}-${self:provider.stage}-housing-file-trans
ImportDirectDebitTransactionsAlarm:
Type: AWS::CloudWatch::Alarm
Properties:
AlarmName: "${self:provider.stage}-housing-finance-direct-debit-trans-alarm"
AlarmDescription: Errors detected in AWS Lambda for Import Direct Debit Transactions function
Namespace: AWS/Lambda
MetricName: "Errors"
Statistic: Sum
Threshold: 0
ComparisonOperator: GreaterThanThreshold
EvaluationPeriods: 1
Period: 60
TreatMissingData: notBreaching
AlarmActions:
- 'Fn::Join':
- ':'
- - 'arn:aws:sns'
- Ref: 'AWS::Region'
- Ref: 'AWS::AccountId'
- 'housing-finance-alarms'
Dimensions:
- Name: FunctionName
Value: ${self:service}-${self:provider.stage}-direct-debit-trans
RefreshCurrentBalanceAlarm:
Type: AWS::CloudWatch::Alarm
Properties:
AlarmName: "${self:provider.stage}-housing-finance-refresh-cur-bal-alarm"
AlarmDescription: Errors detected in AWS Lambda for Refresh Current Balance function
Namespace: AWS/Lambda
MetricName: "Errors"
Statistic: Sum
Threshold: 0
ComparisonOperator: GreaterThanThreshold
EvaluationPeriods: 1
Period: 60
TreatMissingData: notBreaching
AlarmActions:
- 'Fn::Join':
- ':'
- - 'arn:aws:sns'
- Ref: 'AWS::Region'
- Ref: 'AWS::AccountId'
- 'housing-finance-alarms'
Dimensions:
- Name: FunctionName
Value: ${self:service}-${self:provider.stage}-refresh-cur-bal
RefreshManageArrearsTablesAlarm:
Type: AWS::CloudWatch::Alarm
Properties:
AlarmName: "${self:provider.stage}-housing-finance-refresh-ma-cur-bal-alarm"
AlarmDescription: Errors detected in AWS Lambda for Refresh Manage Arrears Tables function
Namespace: AWS/Lambda
MetricName: "Errors"
Statistic: Sum
Threshold: 0
ComparisonOperator: GreaterThanThreshold
EvaluationPeriods: 1
Period: 60
TreatMissingData: notBreaching
AlarmActions:
- 'Fn::Join':
- ':'
- - 'arn:aws:sns'
- Ref: 'AWS::Region'
- Ref: 'AWS::AccountId'
- 'housing-finance-alarms'
Dimensions:
- Name: FunctionName
Value: ${self:service}-${self:provider.stage}-refresh-ma-cur-bal
custom:
prune:
automatic: true
number: 10
includeLayers: true
authorizerArns:
development: arn:aws:lambda:eu-west-2:859159924354:function:api-gateway-lambda-authorizer
staging: arn:aws:lambda:eu-west-2:715003523189:function:api-auth-verify-token-new-staging-apiauthverifytokennew
production: arn:aws:lambda:eu-west-2:153306643385:function:api-auth-verify-token-new-production-apiauthverifytokennew
associateWaf:
name: Platform_APIs_Web_ACL
version: V2
vpc:
development:
securityGroupIds:
- sg-00d2e14f38245dd0b
subnetIds:
- subnet-0140d06fb84fdb547
- subnet-05ce390ba88c42bfd
staging:
securityGroupIds:
- sg-00c197e980177983d
subnetIds:
- subnet-0743d86e9b362fa38
- subnet-0ea0020a44b98a2ca
production:
securityGroupIds:
- sg-02a377899622e884c
subnetIds:
- subnet-0beb266003a56ca82
- subnet-06a697d86a9b6ed01
plugins:
- serverless-step-functions
- serverless-associate-waf
- serverless-prune-plugin