Add support for RDS snapshot events

This commit is contained in:
Stefan Reimer 2023-06-18 09:35:46 +00:00
parent 3831ee7774
commit 3b0fffef1a

11
app.py
View File

@ -260,18 +260,19 @@ def handler(event, context):
title = "ElastiCache fail over complete" title = "ElastiCache fail over complete"
body = "for node {}".format(msg["ElastiCache:FailoverComplete"]) body = "for node {}".format(msg["ElastiCache:FailoverComplete"])
# RDS events # known RDS events
elif "Event Source" in msg and msg['Event Source'] == "db-instance": elif "Event Source" in msg and msg['Event Source'] in ["db-instance", "db-cluster-snapshot", "db-snapshot"]:
try: try:
title = msg["Event Message"] title = msg["Event Message"]
try: try:
name = " ({}).".format( name = " ({}).".format(
msg["Tags"]["aws:cloudformation:stack-name"]) msg["Tags"]["Name"])
except (KeyError, IndexError): except (KeyError, IndexError):
name = "" name = ""
body = "RDS Instance: <{}|{}>{}\n<{}|Event docs>".format( body = "RDS {}: <{}|{}>{}\n<{}|Event docs>".format(msg["Event Source"].replace("db-", ""),
msg["Identifier Link"], msg["Source ID"], name, msg["Event ID"]) msg["Identifier Link"], msg["Source ID"], name, msg["Event ID"])
except KeyError: except KeyError:
msg_type = apprise.NotifyType.WARNING msg_type = apprise.NotifyType.WARNING
body = sns["Message"] body = sns["Message"]