-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
SNS notification for GitOps certificate issued
- Loading branch information
1 parent
288dd75
commit bc33e90
Showing
6 changed files
with
98 additions
and
4 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 |
---|---|---|
@@ -0,0 +1,21 @@ | ||
import boto3 | ||
import json | ||
|
||
|
||
def publish_to_sns(json_data, subject, sns_topic_arn, keys_to_publish="All"): | ||
# Filter out unwanted keys | ||
if keys_to_publish == "All": | ||
keys_to_publish = json_data.keys() | ||
|
||
filtered_json_data = {key: json_data[key] for key in keys_to_publish if key in json_data} | ||
|
||
client = boto3.client("sns") | ||
|
||
response = client.publish( | ||
TargetArn=sns_topic_arn, | ||
Subject=subject, | ||
Message=json.dumps({"default": json.dumps(filtered_json_data)}), | ||
MessageStructure="json", | ||
) | ||
|
||
return response |
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