add billing period

This commit is contained in:
2025-08-21 13:32:44 -03:00
parent 6c301d320b
commit c70a74b94a
14 changed files with 282 additions and 98 deletions

View File

@@ -23,7 +23,7 @@ Globals:
Architectures:
- x86_64
Layers:
- !Sub arn:aws:lambda:sa-east-1:336641857101:layer:layercake:86
- !Sub arn:aws:lambda:sa-east-1:336641857101:layer:layercake:94
Environment:
Variables:
TZ: America/Sao_Paulo
@@ -134,7 +134,7 @@ Resources:
detail:
new_image:
# Post-migration: uncomment the following lines
# sk: [slots]
# sk: [SLOT]
# mode: [STANDALONE]
sk: [generated_items]
scope: [SINGLE_USER]
@@ -163,12 +163,25 @@ Resources:
detail:
new_image:
# Post-migration: uncomment the following lines
# sk: [slots]
# sk: [SLOT]
# mode: [BATCH]
sk: [generated_items]
scope: [MULTI_USER]
status: [PENDING]
SesPolicy:
Type: AWS::IAM::ManagedPolicy
Properties:
PolicyDocument:
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
EventReminderNoAccessAfter3DaysFunction:
Type: AWS::Serverless::Function
Properties:
@@ -176,16 +189,9 @@ Resources:
LoggingConfig:
LogGroup: !Ref EventLog
Policies:
- !Ref SesPolicy
- DynamoDBCrudPolicy:
TableName: !Ref EnrollmentTable
- 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
@@ -196,11 +202,55 @@ Resources:
detail:
keys:
sk:
- SCHEDULES#REMINDER_NO_ACCESS_AFTER_3_DAYS
- SCHEDULE#REMINDER_NO_ACCESS_AFTER_3_DAYS
# Post-migration: remove the following lines
- SCHEDULES#REMINDER_NO_ACCESS_AFTER_3_DAYS
- schedules#does_not_access
- schedules#reminder_no_access_3_days
EventReminderNoActivityAfter7DaysFunction:
Type: AWS::Serverless::Function
Properties:
Handler: events.emails.reminder_no_activity_after_7_days.lambda_handler
LoggingConfig:
LogGroup: !Ref EventLog
Policies:
- !Ref SesPolicy
- DynamoDBCrudPolicy:
TableName: !Ref EnrollmentTable
Events:
DynamoDBEvent:
Type: EventBridgeRule
Properties:
Pattern:
resources: [!Ref EnrollmentTable]
detail-type: [EXPIRE]
detail:
keys:
sk:
- SCHEDULE#REMINDER_NO_ACTIVITY_AFTER_7_DAYS
EventScheduleRemindersFunction:
Type: AWS::Serverless::Function
Properties:
Handler: events.schedule_reminders.lambda_handler
LoggingConfig:
LogGroup: !Ref EventLog
Policies:
- DynamoDBCrudPolicy:
TableName: !Ref EnrollmentTable
Events:
DynamoDBEvent:
Type: EventBridgeRule
Properties:
Pattern:
resources: [!Ref EnrollmentTable]
detail-type: [INSERT]
detail:
new_image:
sk: ["0"]
status: [PENDING]
EventIssueCertFunction:
Type: AWS::Serverless::Function
Properties:
@@ -219,4 +269,4 @@ Resources:
new_image:
status: [COMPLETED]
old_image:
status: [PENDING]
status: [IN_PROGRESS]