From b64bb097a8e68985acfb05e18a355f5ae987d556 Mon Sep 17 00:00:00 2001 From: Carlos Gajardo Date: Fri, 14 Feb 2025 16:00:37 -0300 Subject: [PATCH] Allow null and omitted service.alert_grouping by double indirection BREAKING CHANGE: Service.AlertGrouping is now a **string --- pagerduty/service.go | 2 +- pagerduty/service_fixtures_test.go | 8 +++++--- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/pagerduty/service.go b/pagerduty/service.go index 2dbca2e..ce70429 100644 --- a/pagerduty/service.go +++ b/pagerduty/service.go @@ -133,7 +133,7 @@ type Service struct { AcknowledgementTimeout *int `json:"acknowledgement_timeout"` Addons []*AddonReference `json:"addons,omitempty"` AlertCreation string `json:"alert_creation,omitempty"` - AlertGrouping *string `json:"alert_grouping"` + AlertGrouping **string `json:"alert_grouping,omitempty"` AlertGroupingTimeout *int `json:"alert_grouping_timeout,omitempty"` AlertGroupingParameters *AlertGroupingParameters `json:"alert_grouping_parameters,omitempty"` AutoPauseNotificationsParameters *AutoPauseNotificationsParameters `json:"auto_pause_notifications_parameters,omitempty"` diff --git a/pagerduty/service_fixtures_test.go b/pagerduty/service_fixtures_test.go index d9486fd..651cc48 100644 --- a/pagerduty/service_fixtures_test.go +++ b/pagerduty/service_fixtures_test.go @@ -146,14 +146,16 @@ var ( defaultAutoResolveTimeout = 14400 defaultPosition = 0 - ag = "intelligent" + ag = "intelligent" + agPtr = &ag + validListServicesResponse = &ListServicesResponse{ Services: []*Service{ - &Service{ + { AcknowledgementTimeout: &defaultTestServiceAcknowledgementTimeout, Addons: nil, AlertCreation: "create_alerts_and_incidents", - AlertGrouping: &ag, + AlertGrouping: &agPtr, AlertGroupingTimeout: nil, AutoResolveTimeout: &defaultAutoResolveTimeout, CreatedAt: "2015-11-06T11:12:51-05:00",