Skip to content

Commit f084fdb

Browse files
committed
added deprecation notice and updated tests with connection_type instead of action_type
1 parent b226537 commit f084fdb

File tree

3 files changed

+28
-33
lines changed

3 files changed

+28
-33
lines changed

sumologic/resource_sumologic_monitors_library_monitor.go

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -133,9 +133,10 @@ func resourceSumologicMonitorsLibraryMonitor() *schema.Resource {
133133
Elem: &schema.Resource{
134134
Schema: map[string]*schema.Schema{
135135
"action_type": {
136-
Type: schema.TypeString,
137-
Optional: true,
138-
Computed: true,
136+
Type: schema.TypeString,
137+
Optional: true,
138+
Computed: true,
139+
Deprecated: "The field `action_type` is deprecated and will be removed in a future release of the provider - please use `connection_type` instead.",
139140
},
140141
"connection_type": {
141142
Type: schema.TypeString,

sumologic/resource_sumologic_monitors_library_monitor_test.go

Lines changed: 24 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -74,17 +74,17 @@ func TestAccMonitorsLibraryMonitor_create(t *testing.T) {
7474
for i, v := range recipients {
7575
testRecipients[i] = v
7676
}
77-
triggerTypes := []string{"Critical"}
77+
triggerTypes := []string{"Critical", "ResolvedCritical"}
7878
testTriggerTypes := make([]interface{}, len(triggerTypes))
7979
for i, v := range triggerTypes {
8080
testTriggerTypes[i] = v
8181
}
8282
testNotificationAction := EmailNotification{
83-
ActionType: "EmailAction",
84-
Recipients: testRecipients,
85-
Subject: "test tf monitor",
86-
TimeZone: "PST",
87-
MessageBody: "test",
83+
ConnectionType: "Email",
84+
Recipients: testRecipients,
85+
Subject: "test tf monitor",
86+
TimeZone: "PST",
87+
MessageBody: "test",
8888
}
8989
testNotifications := []MonitorNotification{
9090
{
@@ -111,7 +111,7 @@ func TestAccMonitorsLibraryMonitor_create(t *testing.T) {
111111
resource.TestCheckResourceAttr("sumologic_monitor.test", "content_type", testContentType),
112112
resource.TestCheckResourceAttr("sumologic_monitor.test", "queries.0.row_id", testQueries[0].RowID),
113113
resource.TestCheckResourceAttr("sumologic_monitor.test", "triggers.0.trigger_type", testTriggers[0].TriggerType),
114-
resource.TestCheckResourceAttr("sumologic_monitor.test", "notifications.0.notification.0.action_type", testNotifications[0].Notification.(EmailNotification).ActionType),
114+
resource.TestCheckResourceAttr("sumologic_monitor.test", "notifications.0.notification.0.connection_type", testNotifications[0].Notification.(EmailNotification).ConnectionType),
115115
),
116116
},
117117
},
@@ -165,11 +165,11 @@ func TestAccMonitorsLibraryMonitor_update(t *testing.T) {
165165
testTriggerTypes[i] = v
166166
}
167167
testNotificationAction := EmailNotification{
168-
ActionType: "EmailAction",
169-
Recipients: testRecipients,
170-
Subject: "test tf monitor",
171-
TimeZone: "PST",
172-
MessageBody: "test",
168+
ConnectionType: "Email",
169+
Recipients: testRecipients,
170+
Subject: "test tf monitor",
171+
TimeZone: "PST",
172+
MessageBody: "test",
173173
}
174174
testNotifications := []MonitorNotification{
175175
{
@@ -216,17 +216,17 @@ func TestAccMonitorsLibraryMonitor_update(t *testing.T) {
216216
for i, v := range updatedRecipients {
217217
testUpdatedRecipients[i] = v
218218
}
219-
updatedTriggerTypes := []string{"Critical"}
219+
updatedTriggerTypes := []string{"Critical", "ResolvedCritical"}
220220
testUpdatedTriggerTypes := make([]interface{}, len(updatedTriggerTypes))
221221
for i, v := range updatedTriggerTypes {
222222
testUpdatedTriggerTypes[i] = v
223223
}
224224
testUpdatedNotificationAction := EmailNotification{
225-
ActionType: "EmailAction",
226-
Recipients: testUpdatedRecipients,
227-
Subject: "test tf monitor",
228-
TimeZone: "PST",
229-
MessageBody: "test",
225+
ConnectionType: "Email",
226+
Recipients: testUpdatedRecipients,
227+
Subject: "test tf monitor",
228+
TimeZone: "PST",
229+
MessageBody: "test",
230230
}
231231
testUpdatedNotifications := []MonitorNotification{
232232
{
@@ -253,7 +253,7 @@ func TestAccMonitorsLibraryMonitor_update(t *testing.T) {
253253
resource.TestCheckResourceAttr("sumologic_monitor.test", "content_type", testContentType),
254254
resource.TestCheckResourceAttr("sumologic_monitor.test", "queries.0.row_id", testQueries[0].RowID),
255255
resource.TestCheckResourceAttr("sumologic_monitor.test", "triggers.0.trigger_type", testTriggers[0].TriggerType),
256-
resource.TestCheckResourceAttr("sumologic_monitor.test", "notifications.0.notification.0.action_type", testNotifications[0].Notification.(EmailNotification).ActionType),
256+
resource.TestCheckResourceAttr("sumologic_monitor.test", "notifications.0.notification.0.connection_type", testNotifications[0].Notification.(EmailNotification).ConnectionType),
257257
),
258258
},
259259
{
@@ -267,7 +267,7 @@ func TestAccMonitorsLibraryMonitor_update(t *testing.T) {
267267
resource.TestCheckResourceAttr("sumologic_monitor.test", "content_type", testUpdatedContentType),
268268
resource.TestCheckResourceAttr("sumologic_monitor.test", "queries.0.row_id", testUpdatedQueries[0].RowID),
269269
resource.TestCheckResourceAttr("sumologic_monitor.test", "triggers.0.trigger_type", testUpdatedTriggers[0].TriggerType),
270-
resource.TestCheckResourceAttr("sumologic_monitor.test", "notifications.0.notification.0.action_type", testUpdatedNotifications[0].Notification.(EmailNotification).ActionType),
270+
resource.TestCheckResourceAttr("sumologic_monitor.test", "notifications.0.notification.0.connection_type", testUpdatedNotifications[0].Notification.(EmailNotification).ConnectionType),
271271
),
272272
},
273273
},
@@ -371,13 +371,13 @@ resource "sumologic_monitor" "test" {
371371
}
372372
notifications {
373373
notification {
374-
action_type = "EmailAction"
374+
connection_type = "Email"
375375
recipients = ["[email protected]"]
376376
subject = "test tf monitor"
377377
time_zone = "PST"
378378
message_body = "test"
379379
}
380-
run_for_trigger_types = ["Critical"]
380+
run_for_trigger_types = ["Critical", "ResolvedCritical"]
381381
}
382382
}`, testName)
383383
}
@@ -415,13 +415,13 @@ resource "sumologic_monitor" "test" {
415415
}
416416
notifications {
417417
notification {
418-
action_type = "EmailAction"
418+
connection_type = "Email"
419419
recipients = ["[email protected]"]
420420
subject = "test tf monitor"
421421
time_zone = "PST"
422422
message_body = "test"
423423
}
424-
run_for_trigger_types = ["Critical"]
424+
run_for_trigger_types = ["Critical", "ResolvedCritical"]
425425
}
426426
}`, testName)
427427
}

sumologic/sumologic_monitors_library_monitor.go

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -141,12 +141,6 @@ 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-
150144
type EmailNotification struct {
151145
ActionType string `json:"actionType,omitempty"`
152146
ConnectionType string `json:"connectionType,omitempty"`

0 commit comments

Comments
 (0)