add send cert reporting

This commit is contained in:
2025-10-12 01:09:40 -03:00
parent c9438d49fb
commit 8d10f55ad2
20 changed files with 435 additions and 55 deletions

View File

@@ -26,7 +26,7 @@ Globals:
Architectures:
- x86_64
Layers:
- !Sub arn:aws:lambda:sa-east-1:336641857101:layer:layercake:97
- !Sub arn:aws:lambda:sa-east-1:336641857101:layer:layercake:98
Environment:
Variables:
TZ: America/Sao_Paulo
@@ -140,7 +140,7 @@ Resources:
Type: EventBridgeRule
Properties:
Pattern:
resources: [betaeducacao-prod-orders]
resources: [!Ref OrderTable]
detail-type: [INSERT]
detail:
new_image:
@@ -331,3 +331,64 @@ Resources:
status: [COMPLETED]
old_image:
status: [IN_PROGRESS]
EventCertReportingAppendIssuedCertFunction:
Type: AWS::Serverless::Function
Properties:
Handler: events.cert_reporting.append_issued_cert.lambda_handler
LoggingConfig:
LogGroup: !Ref EventLog
Policies:
- DynamoDBCrudPolicy:
TableName: !Ref EnrollmentTable
Events:
DynamoDBEvent:
Type: EventBridgeRule
Properties:
Pattern:
resources: [!Ref EnrollmentTable]
detail:
keys:
sk: ["0"]
new_image:
status: [COMPLETED]
cert:
exists: true
org_id:
exists: true
old_image:
cert:
exists: false
EventCertReportingSendReportEmailFunction:
Type: AWS::Serverless::Function
Properties:
Handler: events.cert_reporting.send_report_email.lambda_handler
LoggingConfig:
LogGroup: !Ref EventLog
Policies:
- DynamoDBReadPolicy:
TableName: !Ref EnrollmentTable
- DynamoDBReadPolicy:
TableName: !Ref UserTable
- Version: 2012-10-17
Statement:
- Effect: Allow
Action:
- ses:SendRawEmail
Resource:
- !Sub arn:aws:ses:${AWS::Region}:${AWS::AccountId}:identity/eduseg.com.br
- !Sub arn:aws:ses:${AWS::Region}:${AWS::AccountId}:configuration-set/tracking
Events:
DynamoDBEvent:
Type: EventBridgeRule
Properties:
Pattern:
resources: [!Ref EnrollmentTable]
detail-type: [EXPIRE]
detail:
keys:
id:
- prefix: CERT#REPORTING#ORG
sk:
- suffix: SCHEDULE#SEND_REPORT_EMAIL