diff options
author | Ethem Cem Özkan <ethemcem.ozkan@gmail.com> | 2024-06-02 04:48:56 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-06-02 04:48:56 +0200 |
commit | 37ad690d097df2d467a6a93d890abe8887481587 (patch) | |
tree | b587f9f2cec1347a36412344ffdfb37b01b57486 /awxkit | |
parent | Modify the link to terraform_state inventory plugin (#15241) (diff) | |
download | awx-37ad690d097df2d467a6a93d890abe8887481587.tar.xz awx-37ad690d097df2d467a6a93d890abe8887481587.zip |
Add AWS SNS notification support for webhook (#15184)
Support for AWS SNS notifications. SNS is a widespread service that is used to integrate with other AWS services(EG lambdas). This support would unlock use cases like triggering lambda functions, especially when AWX is deployed on EKS.
Decisions:
Data Structure
- I preferred using the same structure as Webhook for message body data because it contains all job details. For now, I directly linked to Webhook to avoid duplication, but I am open to suggestions.
AWS authentication
- To support non-AWS native environments, I added configuration options for AWS secret key, ID, and session tokens. When entered, these values are supplied to the underlining boto3 SNS client. If not entered, it falls back to the default authentication chain to support the native AWS environment. Properly configured EKS pods are created with temporary credentials that the default authentication chain can pick automatically.
---------
Signed-off-by: Ethem Cem Ozkan <ethemcem.ozkan@gmail.com>
Diffstat (limited to 'awxkit')
-rw-r--r-- | awxkit/awxkit/api/pages/notification_templates.py | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/awxkit/awxkit/api/pages/notification_templates.py b/awxkit/awxkit/api/pages/notification_templates.py index 3d33300ce8..b12bbc8c97 100644 --- a/awxkit/awxkit/api/pages/notification_templates.py +++ b/awxkit/awxkit/api/pages/notification_templates.py @@ -11,7 +11,7 @@ from . import page job_results = ('any', 'error', 'success') -notification_types = ('email', 'irc', 'pagerduty', 'slack', 'twilio', 'webhook', 'mattermost', 'grafana', 'rocketchat') +notification_types = ('awssns', 'email', 'irc', 'pagerduty', 'slack', 'twilio', 'webhook', 'mattermost', 'grafana', 'rocketchat') class NotificationTemplate(HasCopy, HasCreate, base.Base): @@ -58,7 +58,10 @@ class NotificationTemplate(HasCopy, HasCreate, base.Base): if payload.notification_configuration == {}: services = config.credentials.notification_services - if notification_type == 'email': + if notification_type == 'awssns': + fields = ('aws_region', 'aws_access_key_id', 'aws_secret_access_key', 'aws_session_token', 'sns_topic_arn') + cred = services.awssns + elif notification_type == 'email': fields = ('host', 'username', 'password', 'port', 'use_ssl', 'use_tls', 'sender', 'recipients') cred = services.email elif notification_type == 'irc': |