Model validation and listing of active attribute for streaming headers
What does this MR do and why?
This MR does following:
- Adds a model validation for streaming headers to ensure that the value of newly added
active
attribute is boolean only. - While streaming audit events to destinations, only active headers will be used.
- Now
active
attribute can also be listed while querying streaming headers.
In followup MRs, ability to update active
attribute will be added.
Note: By default the value of active
attribute is true
.
How to set up and validate locally
- For model validation, create a new streaming destination and a header for it by following steps in https://docs.gitlab.com/ee/administration/audit_event_streaming/#http-destinations.
- Open rails console, and try to update the
active
attribute for the created header with valuenil
, you will get an error. - For active headers being streamed, you can update the value of
active
attribute for a header from rails console to be false, and then try to trigger an event which will stream an event to this destination, you will observe inactive headers are not streamed. - For listing
active
attribute in graphql, while listing down the details of an external destination as mentioned in https://docs.gitlab.com/ee/administration/audit_event_streaming/graphql_api.html#list-streaming-destinations, you can run the graphql query as following to incorporateactive
attribute in headers
query {
group(fullPath: "my-group") {
id
externalAuditEventDestinations {
nodes {
destinationUrl
verificationToken
id
name
headers {
nodes {
key
value
id
active
}
}
eventTypeFilters
}
}
}
}
MR acceptance checklist
This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.
-
I have evaluated the MR acceptance checklist for this MR.
Related to #367509 (closed)
Edited by Hitesh Raghuvanshi