Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: lambda update idp status #605

Merged
merged 5 commits into from
Jan 29, 2025
Merged

Conversation

BenitoVisone
Copy link
Contributor

This PR adds code for oneid-lambda-update-idp-status and the related Github Action to deploy it.

This lambda is needed to keep track of IDP status according to the CloudWatch Alarms on the IDP errors.

In particular, it is triggered when the alarm IDPErrorAlarm-{IDP} related to a specific IDP passes to the state IN_ALARM. This action will update the state to "KO" for the specified IDP.

To keep track of the come-back of the IDP, after this operation, the lambda enables actions (default disabled) for the IDPSuccessAlarm-{IDP} which is a trigger for the lambda when its status passes to IN_ALARM (meaning that we have had some successful logins in the last datapoint), in this case the lambda will be triggered and will update the status to "OK" and at the end will disable the IDPSuccessAlarm-{IDP} actions (meaning that the lambda will not be executed anymore for the IDPSuccessAlarm until it will be reactivated by a trigger of IDPErrorAlarm type).

The IDP Status informations are stored inside a DynamoDB table and the "latest" status of each idp is also saved inside a .json file of the assets bucket to enable a quick retrieval from the frontend.

@BenitoVisone BenitoVisone requested a review from a team as a code owner January 28, 2025 16:49
GiuMontesano
GiuMontesano previously approved these changes Jan 29, 2025
Copy link
Contributor

@GiuMontesano GiuMontesano left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

logger.error("Invalid alarm type: %s", alarm_type)
return {"statusCode": 400, "body": json.dumps("Invalid alarm type")}

# Update the S3 asset file with latest IDP status
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

style: this comment could be moved to line 201, over update_s3_asset_file function invocation

Copy link
Contributor

@giuseppe-gangemi giuseppe-gangemi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@BenitoVisone BenitoVisone merged commit b233129 into main Jan 29, 2025
7 checks passed
@BenitoVisone BenitoVisone deleted the feat/lambda-update-idp-status branch January 29, 2025 08:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants