Skip to content
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

Merged
merged 4 commits into from
Dec 13, 2024
Merged

Conversation

hhellyer
Copy link
Contributor

This PR adds support for the alerts api.

  • Adds code to call the new alerts api.
  • Adds testcases.
  • Adds example.

- Add code to call api.
- Add testcases.
- Add example.
@@ -0,0 +1,46 @@
package alerting
Copy link
Contributor

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

Copy link
Contributor

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() {
Copy link
Contributor

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?

Copy link
Contributor Author

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.
@hhellyer hhellyer changed the title Add support for the v1beta1 alerts api. Add support for the v1 alerts api. Dec 9, 2024

defaultBase = "http://localhost:80"
defaultBase = "https://api.nsone.net"
Copy link
Contributor

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?

Copy link
Contributor

@shane-ns1 shane-ns1 left a 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.

Copy link
Contributor

@shane-ns1 shane-ns1 left a 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. 👍

@hhellyer hhellyer merged commit 2e92b07 into v2 Dec 13, 2024
3 checks passed
@hhellyer hhellyer deleted the PENG-5494/add_alerts_api_support branch December 13, 2024 09:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants