The PagerDuty API is happy when only Type is set to omitempty, but I think it makes sense to do the same for AlertGroupParamsConfig as well as change it to be a pointer so that it gets a nil value instead of the zero value for all the config values in case the api checks those values in the future.
func main() {
client := pagerduty.NewClient(authToken)
svc, err := client.GetServiceWithContext(context.TODO(), serviceId, nil)
if err != nil {
panic(err)
}
// Whether there's no value from GetService or if it's set
svc.AlertGroupingParameters.Type = ""
_, err := client.UpdateServiceWithContext(context.TODO(), *svc)
if err != nil {
// Results in panic: HTTP response failed with status code 400,
// message: Invalid Input Provided (code: 2001): Alert grouping parameters is invalid.
panic(err)
}
}
The PagerDuty API is happy when only
Type
is set toomitempty
, but I think it makes sense to do the same forAlertGroupParamsConfig
as well as change it to be a pointer so that it gets a nil value instead of the zero value for all the config values in case the api checks those values in the future.Fixes #438