-
Notifications
You must be signed in to change notification settings - Fork 22
Add the API to get compliance events #161
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 the API to get compliance events #161
Conversation
/cc @JustinKuli |
@@ -92,6 +181,357 @@ func (s *complianceAPIServer) Stop() error { | |||
return nil | |||
} | |||
|
|||
// splitQueryValue will parse a string and split on unescaped commas. Empty values are discarded. | |||
func splitQueryValue(value string) []string { |
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.
Note that a normal string split would work just fine in this case because no sort options have a comma in them but I plan to reuse this in my next PR for filter query arguments.
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.
Looking good overall! One extra question that sparked in my mind during this: will there automatically be a metric (either in our container, or through something in kubernetes) that says how many requests have succeeded/errored? In particular, I'm thinking that it will be necessary to monitor when there is an unusual number of internal errors or something like that.
|
||
Expect(resp.StatusCode).To(Equal(http.StatusBadRequest)) | ||
|
||
body, err := io.ReadAll(resp.Body) |
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.
It doesn't really matter but I found https://daryl-ng.medium.com/why-you-should-avoid-ioutil-readall-in-go-e6be4de180f8
This adds a list API endpoint at /api/v1/compliance-events and allows an individual compliance event to be retrieved with /api/v1/compliance-events/<id>. The list API endpoint supports sorting, pagination, and the flag of `includeSpec` which is disabled by default. Relates: https://issues.redhat.com/browse/ACM-6857 Signed-off-by: mprahl <[email protected]>
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: mprahl, yiraeChristineKim The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
This adds a list API endpoint at /api/v1/compliance-events and allows an individual compliance event to be retrieved with
/api/v1/compliance-events/.
The list API endpoint supports sorting, pagination, and the flag of
includeSpec
which is disabled by default.Relates:
https://issues.redhat.com/browse/ACM-6857