appoptics / appoptics-api-go

The official Go client for the AppOptics metrics API
https://docs.appoptics.com/api/
Apache License 2.0
4 stars 7 forks source link

Change Alert.Active and AlertRequest.Active to pointer #85

Closed poleszcz closed 2 years ago

poleszcz commented 2 years ago

In the terraform-provider-appoptics project we require possibility to send "active" as false to the AppOptics API. As we all know in the current implementation the "false" is treated as empty ... and omitempty drops it from the API request.

One option was to remove omitempty like it was done long time ago with condition threshold: https://github.com/appoptics/appoptics-api-go/commit/0f5829744b34a2ac831cb8452fee58a84201b24b

It would be also ok for our needs. But to give other users possibility to really omit "active" field the proposed change replaces bool with *bool. API user can still provide nil and it won't go to the request. At the same time SRE team can provide "false" ... and alert will be disabled as required.