@@ -108,9 +108,57 @@ func (provider *AlertProvider) buildHTTPRequest(cfg *Config, ep *endpoint.Endpoi
108108 url = strings .ReplaceAll (url , "[ENDPOINT_GROUP]" , ep .Group )
109109 body = strings .ReplaceAll (body , "[ENDPOINT_URL]" , ep .URL )
110110 url = strings .ReplaceAll (url , "[ENDPOINT_URL]" , ep .URL )
111+ << << << < HEAD
111112 resultErrors := strings .ReplaceAll (strings .Join (result .Errors , "," ), "\" " , "\\ \" " )
112113 body = strings .ReplaceAll (body , "[RESULT_ERRORS]" , resultErrors )
113114 url = strings .ReplaceAll (url , "[RESULT_ERRORS]" , resultErrors )
115+
116+ var formattedConditionResults string
117+ if len (result .ConditionResults ) > 0 {
118+ for index , conditionResult := range result .ConditionResults {
119+ var prefix string
120+ if conditionResult .Success {
121+ prefix = "✅"
122+ } else {
123+ prefix = "❌"
124+ }
125+ formattedConditionResults += fmt .Sprintf ("%s - `%s`" , prefix , conditionResult .Condition )
126+ if index < len (result .ConditionResults )- 1 {
127+ formattedConditionResults += ", "
128+ }
129+ }
130+ }
131+
132+ body = strings .ReplaceAll (body , "[RESULT_CONDITIONS]" , formattedConditionResults )
133+ url = strings .ReplaceAll (url , "[RESULT_CONDITIONS]" , formattedConditionResults )
134+
135+ || || || | b388cc87
136+ body = strings .ReplaceAll (body , "[RESULT_ERRORS]" , strings .Join (result .Errors , "," ))
137+ url = strings .ReplaceAll (url , "[RESULT_ERRORS]" , strings .Join (result .Errors , "," ))
138+ == == == =
139+ body = strings .ReplaceAll (body , "[RESULT_ERRORS]" , strings .Join (result .Errors , "," ))
140+ url = strings .ReplaceAll (url , "[RESULT_ERRORS]" , strings .Join (result .Errors , "," ))
141+
142+ var formattedConditionResults string
143+ if len (result .ConditionResults ) > 0 {
144+ for index , conditionResult := range result .ConditionResults {
145+ var prefix string
146+ if conditionResult .Success {
147+ prefix = "✅"
148+ } else {
149+ prefix = "❌"
150+ }
151+ formattedConditionResults += fmt .Sprintf ("%s - `%s`" , prefix , conditionResult .Condition )
152+ if index < len (result .ConditionResults )- 1 {
153+ formattedConditionResults += ", "
154+ }
155+ }
156+ }
157+
158+ body = strings .ReplaceAll (body , "[RESULT_CONDITIONS]" , formattedConditionResults )
159+ url = strings .ReplaceAll (url , "[RESULT_CONDITIONS]" , formattedConditionResults )
160+
161+ >> >> >> > c230f982a4ea73cd3d17b8a2553db240776a498f
114162 if resolved {
115163 body = strings .ReplaceAll (body , "[ALERT_TRIGGERED_OR_RESOLVED]" , provider .GetAlertStatePlaceholderValue (cfg , true ))
116164 url = strings .ReplaceAll (url , "[ALERT_TRIGGERED_OR_RESOLVED]" , provider .GetAlertStatePlaceholderValue (cfg , true ))
0 commit comments