-
Notifications
You must be signed in to change notification settings - Fork 59
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add support for the v1 alerts api. #244
Conversation
- Add code to call api. - Add testcases. - Add example.
@@ -0,0 +1,46 @@ | |||
package alerting |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
oh nice, more models! its not like that we did not have enough already :D
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
not a jab at the PR but rather than the fact that we have a 1000 models!
var client *api.Client | ||
|
||
// Helper that initializes rest api client from environment variable. | ||
func init() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this called in the example somewhere?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If I'm 100% honest this is here because I started by copying one of the other examples and wanted it to follow our existing pattern.
It will always be called as go ensures the init()
function for a file is always run:
https://go.dev/doc/effective_go#init
(The internet seems rather divided on whether it's a bad thing to use which in general but it's probably ok for samples like this.)
- Use alerting/v1 in REST calls. - Update changelog and client version. - Minor fix to example to create secondary zone correctly.
|
||
defaultBase = "http://localhost:80" | ||
defaultBase = "https://api.nsone.net" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why did you change this?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have a few questions, nothing very critical.
I am concerned about possibly changing the API without bumping the major version number, but I maybe this concern is misplaced.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good. Thanks for the attention to detail. 👍
This PR adds support for the alerts api.