The AlertSettings field of the Check struct is currently a struct. The result is that when this field is omitted, the resulting JSON still contains the value. This is not what the API expects or what is documented in the API docs.
This can be see here: https://play.golang.org/p/cupZglCunSx
Which prints:
{"alertSettings":{"runBasedEscalation":{},"timeBasedEscalation":{},"reminders":{},"sslCertificates":{"enabled":false,"alertThreshold":0}}}
If you were to change the AlertSettings field to a pointer type, the resulting JSON will be what's expected.
This can be seen here: https://play.golang.org/p/YbWYjwaW3RU
Which prints:
This is also true for the subfields of AlertSettings:
RunBasedEscalation
TimeBasedEscalation
Reminders
SSLCertificates
The
AlertSettingsfield of theCheckstruct is currently a struct. The result is that when this field is omitted, the resulting JSON still contains the value. This is not what the API expects or what is documented in the API docs.This can be see here: https://play.golang.org/p/cupZglCunSx
Which prints:
{"alertSettings":{"runBasedEscalation":{},"timeBasedEscalation":{},"reminders":{},"sslCertificates":{"enabled":false,"alertThreshold":0}}}If you were to change the
AlertSettingsfield to a pointer type, the resulting JSON will be what's expected.This can be seen here: https://play.golang.org/p/YbWYjwaW3RU
Which prints:
{}This is also true for the subfields of
AlertSettings:RunBasedEscalationTimeBasedEscalationRemindersSSLCertificates