-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add ability to subscribe to DDoS detected alarms (#386)
* add alarm_notification_email field to CDNDedicatedWAFServiceInstance model * add migration to create alarm_notification_email column * update documentation URL * add logic to set alarm_notification_email on instance from params for provision and update requests * update logic for parsing alarm notification email * add test for setting alarm_notification_email on API provision request * update provision logic to raise error if CDN with dedicatd WAF instance does not specify alarm notification email * update CDN provision tests * refactor tests * add tests for setting alarm notification email on API update request for CDN instances * update migration for alarm_notification_email field to set field as non-nullable * make alarm_notification_email field non-nullable * add condition to return error if alarm_notification_email is unset when going from CDN to CDN dedicated WAF plan * revert change to make alarm_notification_email non-nullable * revert change to make alarm_notification_email non-nullable * refactor logic for updating CDN to CDN dedicated WAF instance * update API tests for plan update from CDN to CDN dedicated WAF instance * update CDN to CDN dedicated WAF pipeline tests to properly set alarm_notification_email * update tests for CDN dedicated WAF provisin pipeline to set alarm_notification_email * refactor update logic * add sns client * add sns_notification_topic_arn field * stub out logic for task to creatE a DDosDetected alarm * add field for ddos_detected_cloudwatch_alarm_arn * combine config fields into single field * update test helper to set alarm_notification_email on CDN plan update * refactor logic for create cloudwatch alarms * change ddos_detected_cloudwatch_alarm_arn to ddos_detected_cloudwatch_alarm_name * add test stubber for SNS * create basic test for create_ddos_detected_alarm * add test for creating ddos detection alarm * add test for creating ddos alarm with tags * create separate task for create_notification_topic * add tests for create_notification_topic * raise error if there is no SNS topic ARN when creating DDoS detected alarm & add test * add delete_ddos_detected_alarm task and tests * refactor cloudwatch health check alarms to use user provided notification email * remove NOTIFICATIONS_SNS_TOPIC_ARN config * remove test for NOTIFICATIONS_SNS_TOPIC_ARN * add more tests for case of no topic provided * add delete_notification_topic task and tests * add tasks to pipelines * update CDN dedicated WAF provision pipeline tests for creating new DDoS alarms * update CDN dedicated WAF deprovision pipeline happy path * update delete_notification_topic task to handle missing topic * update tests for CDN dedicated WAF deprovision pipeline when resources are missing * update pipeline tests for updating CDN to CDN dedicated WAF instance * update pipeline tests for CDN dedicated WAF to specify alarm notification email * update pipeline test alarm notification email * fix provision common checks test * fix update logic & update integration tests * remove success notifications from pipeline
- Loading branch information
Showing
35 changed files
with
1,595 additions
and
210 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,14 @@ | ||
from broker.models import ServiceInstanceTypes | ||
|
||
|
||
def is_cdn_instance(service_instance): | ||
def is_cdn_instance(service_instance) -> bool: | ||
return service_instance.instance_type in [ | ||
ServiceInstanceTypes.CDN.value, | ||
ServiceInstanceTypes.CDN_DEDICATED_WAF.value, | ||
] | ||
|
||
|
||
def is_cdn_dedicated_waf_instance(service_instance) -> bool: | ||
return ( | ||
service_instance.instance_type == ServiceInstanceTypes.CDN_DEDICATED_WAF.value | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.