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

Refactor/handle webhook #647

Merged
merged 15 commits into from
Sep 16, 2024
Merged

Refactor/handle webhook #647

merged 15 commits into from
Sep 16, 2024

Conversation

gcharest
Copy link
Contributor

Summary | Résumé

Breaking the handle_webhook function into a more manageable set of functions:

  • if the payload is a string, it will be sent to the handle_string_payload for further processing.
  • otherwise, the webhook payload is handled as usual

In the handle_string_payload, the string will be validated against known models (Webhook, AWS SNS, Access Request, Upptime)

  • If it matches the Webhook model, it simply returns a Webhook payload
  • if it matches an AwsSns model, it will be evaluated for validity.
    • once the payload is validated, the same handling of the type of AWS SNS payload is applied as before.
  • if it matches the Access Request model, we don't perform anything specific at this point, just return a Webhook payload wiht the payload in the content of "text"
  • if it matches the Upptime model, the downtime message will be parsed and returned for processing

@gcharest gcharest requested a review from a team September 16, 2024 18:56
@gcharest gcharest self-assigned this Sep 16, 2024
Copy link

github-actions bot commented Sep 16, 2024

GitHub Action status on df00773 generated by comment-failure-action

Lint, format and test code

job url
null https://github.com/cds-snc/sre-bot/actions/runs/10890240971/job/30218550016

Build containers CI

No jobs failed 👍

Copy link
Contributor

@sylviamclaughlin sylviamclaughlin left a comment

Choose a reason for hiding this comment

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

Good work! 🎉

@gcharest gcharest merged commit 76e4430 into main Sep 16, 2024
7 checks passed
@gcharest gcharest deleted the refactor/handle_webhook branch September 16, 2024 19:41
gcharest added a commit that referenced this pull request Sep 16, 2024
gcharest added a commit that referenced this pull request Sep 16, 2024
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.

2 participants