Skip to content
This repository was archived by the owner on Jan 15, 2024. It is now read-only.

Commit 9b46930

Browse files
committed
Add method for resetting notification policies
1 parent c7d9555 commit 9b46930

File tree

2 files changed

+15
-0
lines changed

2 files changed

+15
-0
lines changed

alerting_notification_policy.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -118,3 +118,7 @@ func (c *Client) SetNotificationPolicy(np *NotificationPolicy) error {
118118
}
119119
return c.request("PUT", "/api/v1/provisioning/policies", nil, bytes.NewBuffer(req), nil)
120120
}
121+
122+
func (c *Client) ResetNotificationPolicy() error {
123+
return c.request("DELETE", "/api/v1/provisioning/policies", nil, nil, nil)
124+
}

alerting_notification_policy_test.go

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,17 @@ func TestNotificationPolicies(t *testing.T) {
3636
t.Error(err)
3737
}
3838
})
39+
40+
t.Run("reset policy tree succeeds", func(t *testing.T) {
41+
server, client := gapiTestTools(t, 200, notificationPolicyJSON)
42+
defer server.Close()
43+
44+
err := client.ResetNotificationPolicy()
45+
46+
if err != nil {
47+
t.Error(err)
48+
}
49+
})
3950
}
4051

4152
func createNotificationPolicy() NotificationPolicy {

0 commit comments

Comments
 (0)