From 1f2cb708c44233b1022a2c69b597a38fde1106ff Mon Sep 17 00:00:00 2001 From: De Ville Weppenaar Date: Thu, 26 Nov 2020 11:08:32 -0800 Subject: [PATCH] make AlertSettings pointer types; fixes #13 --- checkly_test.go | 18 +++++++++--------- types.go | 12 ++++++------ 2 files changed, 15 insertions(+), 15 deletions(-) diff --git a/checkly_test.go b/checkly_test.go index 1ee3b70..7236db8 100644 --- a/checkly_test.go +++ b/checkly_test.go @@ -71,18 +71,18 @@ var wantCheck = checkly.Check{ }, LocalSetupScript: "setitup", LocalTearDownScript: "tearitdown", - AlertSettings: checkly.AlertSettings{ + AlertSettings: &checkly.AlertSettings{ EscalationType: checkly.RunBased, - RunBasedEscalation: checkly.RunBasedEscalation{ + RunBasedEscalation: &checkly.RunBasedEscalation{ FailedRunThreshold: 1, }, - TimeBasedEscalation: checkly.TimeBasedEscalation{ + TimeBasedEscalation: &checkly.TimeBasedEscalation{ MinutesFailingThreshold: 5, }, - Reminders: checkly.Reminders{ + Reminders: &checkly.Reminders{ Interval: 5, }, - SSLCertificates: checkly.SSLCertificates{ + SSLCertificates: &checkly.SSLCertificates{ Enabled: false, AlertThreshold: 30, }, @@ -291,17 +291,17 @@ var wantGroup = checkly.Group{ UseGlobalAlertSettings: false, AlertSettings: checkly.AlertSettings{ EscalationType: checkly.RunBased, - RunBasedEscalation: checkly.RunBasedEscalation{ + RunBasedEscalation: &checkly.RunBasedEscalation{ FailedRunThreshold: 1, }, - TimeBasedEscalation: checkly.TimeBasedEscalation{ + TimeBasedEscalation: &checkly.TimeBasedEscalation{ MinutesFailingThreshold: 5, }, - Reminders: checkly.Reminders{ + Reminders: &checkly.Reminders{ Amount: 0, Interval: 5, }, - SSLCertificates: checkly.SSLCertificates{ + SSLCertificates: &checkly.SSLCertificates{ Enabled: true, AlertThreshold: 30, }, diff --git a/types.go b/types.go index 53b02be..19b8021 100644 --- a/types.go +++ b/types.go @@ -100,7 +100,7 @@ type Check struct { TearDownSnippetID int64 `json:"tearDownSnippetId,omitempty"` LocalSetupScript string `json:"localSetupScript,omitempty"` LocalTearDownScript string `json:"localTearDownScript,omitempty"` - AlertSettings AlertSettings `json:"alertSettings,omitempty"` + AlertSettings *AlertSettings `json:"alertSettings,omitempty"` UseGlobalAlertSettings bool `json:"useGlobalAlertSettings"` Request Request `json:"request"` GroupID int64 `json:"groupId,omitempty"` @@ -157,11 +157,11 @@ type EnvironmentVariable struct { // AlertSettings represents an alert configuration. type AlertSettings struct { - EscalationType string `json:"escalationType,omitempty"` - RunBasedEscalation RunBasedEscalation `json:"runBasedEscalation,omitempty"` - TimeBasedEscalation TimeBasedEscalation `json:"timeBasedEscalation,omitempty"` - Reminders Reminders `json:"reminders,omitempty"` - SSLCertificates SSLCertificates `json:"sslCertificates,omitempty"` + EscalationType string `json:"escalationType,omitempty"` + RunBasedEscalation *RunBasedEscalation `json:"runBasedEscalation,omitempty"` + TimeBasedEscalation *TimeBasedEscalation `json:"timeBasedEscalation,omitempty"` + Reminders *Reminders `json:"reminders,omitempty"` + SSLCertificates *SSLCertificates `json:"sslCertificates,omitempty"` } // RunBasedEscalation represents an alert escalation based on a number of failed