Skip to content

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

Merged
merged 1 commit into from
Jan 12, 2024
Merged

Add the API to get compliance events #161

merged 1 commit into from
Jan 12, 2024

Conversation

mprahl
Copy link
Member

@mprahl mprahl commented Jan 5, 2024

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

@mprahl
Copy link
Member Author

mprahl commented Jan 5, 2024

/cc @JustinKuli

@openshift-ci openshift-ci bot requested a review from JustinKuli January 5, 2024 19:49
@@ -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 {
Copy link
Member Author

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.

Copy link
Member

@JustinKuli JustinKuli left a 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)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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]>
Copy link

openshift-ci bot commented Jan 12, 2024

[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:
  • OWNERS [mprahl,yiraeChristineKim]

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants