Skip to content

Commit 78e9568

Browse files
authored
Merge pull request #745 from SumoLogic/SUMO-256375_fix_webhook_search_notification_empty_payload
SUMO-256375: Update webhook_search_notification logic to send null payload instead of empty string when missing
2 parents b46f4e8 + a782c23 commit 78e9568

File tree

3 files changed

+15
-6
lines changed

3 files changed

+15
-6
lines changed

CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
## X.Y.Z (Unreleased)
22
* Add new change notes here
33

4+
BUG FIXES:
5+
* Properly send optional webhook notification payload value
6+
47
MAINTENANCE:
58
* Bump version of golang.org/x/net to v0.35.0
69
* Bump version of google.golang.org/grpc to v1.67.0

sumologic/resource_sumologic_log_search.go

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -775,10 +775,16 @@ func getServiceNowSearchNotification(tfServiceNowSearchNotification map[string]i
775775
}
776776

777777
func getWebhookSearchNotification(tfWebhookSearchNotification map[string]interface{}) interface{} {
778+
var payload *string
779+
if p, ok := tfWebhookSearchNotification["payload"].(string); ok && p != "" {
780+
payload = &p
781+
} else {
782+
payload = nil
783+
}
778784
return WebhookSearchNotification{
779785
TaskType: "WebhookSearchNotificationSyncDefinition",
780786
WebhookId: tfWebhookSearchNotification["webhook_id"].(string),
781-
Payload: tfWebhookSearchNotification["payload"].(string),
787+
Payload: payload,
782788
ItemizeAlerts: tfWebhookSearchNotification["itemize_alerts"].(bool),
783789
MaxItemizedAlerts: tfWebhookSearchNotification["max_itemized_alerts"].(int),
784790
}

sumologic/sumologic_log_search.go

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -157,11 +157,11 @@ type ServiceNowSearchNotification struct {
157157
}
158158

159159
type WebhookSearchNotification struct {
160-
TaskType string `json:"taskType"`
161-
WebhookId string `json:"webhookId"`
162-
Payload string `json:"payload"`
163-
ItemizeAlerts bool `json:"itemizeAlerts"`
164-
MaxItemizedAlerts int `json:"maxItemizedAlerts"`
160+
TaskType string `json:"taskType"`
161+
WebhookId string `json:"webhookId"`
162+
Payload *string `json:"payload"`
163+
ItemizeAlerts bool `json:"itemizeAlerts"`
164+
MaxItemizedAlerts int `json:"maxItemizedAlerts"`
165165
}
166166

167167
type ServiceNowFields struct {

0 commit comments

Comments
 (0)