Skip to content

Commit edd37e0

Browse files
chandrasekhar1996craman
and
craman
authoredFeb 5, 2025··
add support for sending notifications using slack (#2867)
Signed-off-by: craman <[email protected]> address review comments Co-authored-by: craman <[email protected]>
1 parent 3335c49 commit edd37e0

File tree

67 files changed

+4010
-840
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

67 files changed

+4010
-840
lines changed
 

‎actions/scripts/publish.sh

+1
Original file line numberDiff line numberDiff line change
@@ -57,4 +57,5 @@ else
5757
deployProject "com.yahoo.athenz:athenz-syncer-common"
5858
deployProject "com.yahoo.athenz:athenz-instance-provider"
5959
deployProject "com.yahoo.athenz:athenz-server-msg-pulsar"
60+
deployProject "com.yahoo.athenz:athenz-server-notification-slack"
6061
fi

‎libs/java/server_aws_common/src/main/java/io/athenz/server/aws/common/notification/impl/AWSZTSHealthNotificationTask.java

+9-9
Original file line numberDiff line numberDiff line change
@@ -45,10 +45,10 @@ public AWSZTSHealthNotificationTask(ZTSClientNotification ztsClientNotification,
4545
RolesProvider rolesProvider,
4646
String userDomainPrefix,
4747
String serverName,
48-
NotificationToEmailConverterCommon notificationToEmailConverterCommon) {
48+
NotificationConverterCommon notificationConverterCommon) {
4949
DomainRoleMembersFetcher domainRoleMembersFetcher = new DomainRoleMembersFetcher(rolesProvider, USER_DOMAIN_PREFIX);
5050
this.notificationCommon = new NotificationCommon(domainRoleMembersFetcher, userDomainPrefix);
51-
this.awsZTSHealthNotificationToEmailConverter = new AWSZTSHealthNotificationToEmailConverter(notificationToEmailConverterCommon);
51+
this.awsZTSHealthNotificationToEmailConverter = new AWSZTSHealthNotificationToEmailConverter(notificationConverterCommon);
5252
this.awsztsHealthNotificationToMetricConverter = new AWSZTSHealthNotificationToMetricConverter();
5353
this.ztsClientNotification = ztsClientNotification;
5454
this.serverName = serverName;
@@ -98,20 +98,20 @@ public static class AWSZTSHealthNotificationToEmailConverter implements Notifica
9898
private static final String EMAIL_TEMPLATE_NOTIFICATION_AWS_ZTS_HEALTH = "messages/aws-zts-health.html";
9999
private static final String AWS_ZTS_HEALTH_SUBJECT = "athenz.notification.email.aws.zts.health.subject";
100100

101-
private final NotificationToEmailConverterCommon notificationToEmailConverterCommon;
101+
private final NotificationConverterCommon notificationConverterCommon;
102102
private final String emailAwsZtsHealthBody;
103103

104-
public AWSZTSHealthNotificationToEmailConverter(NotificationToEmailConverterCommon notificationToEmailConverterCommon) {
105-
this.notificationToEmailConverterCommon = notificationToEmailConverterCommon;
106-
emailAwsZtsHealthBody = notificationToEmailConverterCommon.readContentFromFile(getClass().getClassLoader(), EMAIL_TEMPLATE_NOTIFICATION_AWS_ZTS_HEALTH);
104+
public AWSZTSHealthNotificationToEmailConverter(NotificationConverterCommon notificationConverterCommon) {
105+
this.notificationConverterCommon = notificationConverterCommon;
106+
emailAwsZtsHealthBody = notificationConverterCommon.readContentFromFile(getClass().getClassLoader(), EMAIL_TEMPLATE_NOTIFICATION_AWS_ZTS_HEALTH);
107107
}
108108

109109
String getAwsZtsHealthBody(Map<String, String> metaDetails) {
110110
if (metaDetails == null) {
111111
return null;
112112
}
113113

114-
return notificationToEmailConverterCommon.generateBodyFromTemplate(
114+
return notificationConverterCommon.generateBodyFromTemplate(
115115
metaDetails,
116116
emailAwsZtsHealthBody,
117117
NOTIFICATION_DETAILS_AFFECTED_ZTS,
@@ -121,9 +121,9 @@ String getAwsZtsHealthBody(Map<String, String> metaDetails) {
121121

122122
@Override
123123
public NotificationEmail getNotificationAsEmail(Notification notification) {
124-
String subject = notificationToEmailConverterCommon.getSubject(AWS_ZTS_HEALTH_SUBJECT);
124+
String subject = notificationConverterCommon.getSubject(AWS_ZTS_HEALTH_SUBJECT);
125125
String body = getAwsZtsHealthBody(notification.getDetails());
126-
Set<String> fullyQualifiedEmailAddresses = notificationToEmailConverterCommon.getFullyQualifiedEmailAddresses(notification.getRecipients());
126+
Set<String> fullyQualifiedEmailAddresses = notificationConverterCommon.getFullyQualifiedEmailAddresses(notification.getRecipients());
127127
return new NotificationEmail(subject, body, fullyQualifiedEmailAddresses);
128128
}
129129
}

0 commit comments

Comments
 (0)
Please sign in to comment.