Skip to content

Commit 4abf666

Browse files
committed
fixing action_type connection_type compatibility
1 parent 151065c commit 4abf666

File tree

2 files changed

+13
-3
lines changed

2 files changed

+13
-3
lines changed

sumologic/resource_sumologic_monitors_library_monitor.go

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -308,7 +308,9 @@ func resourceSumologicMonitorsLibraryMonitorRead(d *schema.ResourceData, meta in
308308
if internalNotificationDict["connectionType"] != nil {
309309
internalNotification["connection_type"] = internalNotificationDict["connectionType"].(string)
310310
}
311-
internalNotification["action_type"] = internalNotificationDict["actionType"].(string)
311+
if internalNotificationDict["actionType"] != nil {
312+
internalNotification["action_type"] = internalNotificationDict["actionType"].(string)
313+
}
312314
if internalNotification["action_type"].(string) == "EmailAction" ||
313315
internalNotification["action_type"].(string) == "Email" ||
314316
internalNotification["connection_type"].(string) == "EmailAction" ||
@@ -398,15 +400,17 @@ func getNotifications(d *schema.ResourceData) []MonitorNotification {
398400
notificationActionDict["connection_type"].(string) == "EmailAction" ||
399401
notificationActionDict["connection_type"].(string) == "Email" {
400402
notificationAction := EmailNotification{}
401-
notificationAction.ActionType = notificationActionDict["action_type"].(string)
403+
// notificationAction.ActionType = notificationActionDict["action_type"].(string)
404+
notificationAction.ConnectionType = notificationActionDict["connection_type"].(string)
402405
notificationAction.Subject = notificationActionDict["subject"].(string)
403406
notificationAction.Recipients = notificationActionDict["recipients"].([]interface{})
404407
notificationAction.MessageBody = notificationActionDict["message_body"].(string)
405408
notificationAction.TimeZone = notificationActionDict["time_zone"].(string)
406409
n.Notification = notificationAction
407410
} else {
408411
notificationAction := WebhookNotificiation{}
409-
notificationAction.ActionType = notificationActionDict["action_type"].(string)
412+
// notificationAction.ActionType = notificationActionDict["action_type"].(string)
413+
notificationAction.ConnectionType = notificationActionDict["connection_type"].(string)
410414
notificationAction.ConnectionID = notificationActionDict["connection_id"].(string)
411415
notificationAction.PayloadOverride = notificationActionDict["payload_override"].(string)
412416
n.Notification = notificationAction

sumologic/sumologic_monitors_library_monitor.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -141,6 +141,12 @@ type MonitorNotification struct {
141141
RunForTriggerTypes []interface{} `json:"runForTriggerTypes"`
142142
}
143143

144+
type Notification struct {
145+
ActionType string `json:"actionType,omitempty"`
146+
ConnectionType string `json:"connectionType,omitempty"`
147+
ConnectionID string `json:"connectionId"`
148+
}
149+
144150
type EmailNotification struct {
145151
ActionType string `json:"actionType,omitempty"`
146152
ConnectionType string `json:"connectionType,omitempty"`

0 commit comments

Comments
 (0)