You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
feat: update slack notification by adding block functionality to template (#370)
* Enhance slack notifications to be able to use markdown formatting by adding message block functionality.
Co-authored-by: sushmith <[email protected]>
Copy file name to clipboardExpand all lines: domain/notifier.go
+6-6
Original file line number
Diff line number
Diff line change
@@ -1,12 +1,12 @@
1
1
package domain
2
2
3
3
typeNotificationMessagesstruct {
4
-
ExpirationReminderstring`mapstructure:"expiration_reminder" default:"Your access {{.account_id}} to {{.resource_name}} with role {{.role}} will expire at {{.expiration_date}}. Extend the access if it's still needed"`
5
-
AppealApprovedstring`mapstructure:"appeal_approved" default:"Your appeal to {{.resource_name}} with role {{.role}} has been approved"`
6
-
AppealRejectedstring`mapstructure:"appeal_rejected" default:"Your appeal to {{.resource_name}} with role {{.role}} has been rejected"`
7
-
AccessRevokedstring`mapstructure:"access_revoked" default:"Your access to {{.resource_name}}} with role {{.role}} has been revoked"`
8
-
ApproverNotificationstring`mapstructure:"approver_notification" default:"You have an appeal created by {{.requestor}} requesting access to {{.resource_name}} with role {{.role}}. Appeal ID: {{.appeal_id}}"`
9
-
OthersAppealApprovedstring`mapstructure:"others_appeal_approved" default:"Your appeal to {{.resource_name}} with role {{.role}} created by {{.requestor}} has been approved"`
AppealRejected: "[{\"type\":\"section\",\"text\":{\"type\":\"mrkdwn\",\"text\":\"Your appeal to {{.resource_name}} with role {{.role}} has been rejected\"}}]",
30
+
}
31
+
s.slackIDCache=map[string]string{}
32
+
s.notifier=notifier{
33
+
accessToken: s.accessToken,
34
+
slackIDCache: s.slackIDCache,
35
+
Messages: s.messages,
36
+
httpClient: s.mockHttpClient,
37
+
defaultMessageFiles: defaultTemplates,
38
+
}
39
+
}
40
+
41
+
funcTestClient(t*testing.T) {
42
+
suite.Run(t, new(ClientTestSuite))
43
+
}
44
+
45
+
func (s*ClientTestSuite) TestNotify() {
46
+
s.Run("should return error if slack id not found", func() {
0 commit comments