Create and delete apis for group event type filters
What does this MR do and why?
Added create and delete graphql apis for creating and deleting event type filters to a group level external audit event streaming destination.
This is part of our refactoring epic &12339, so we have reused some of the existing classes for creation and deletion.
MR acceptance checklist
Please evaluate this MR against the MR acceptance checklist. It helps you analyze changes to reduce risks in quality, performance, reliability, security, and maintainability.
How to set up and validate locally
- You need to have a group with
Ultimate
license. - Open graphql-explorer and run following graphql queries and mutations.
- Create a group level external audit event destination by running following mutation. Here I am using a group named
twitter
but you can change that.
mutation groupAuditEventStreamingDestinationsCreate {
groupAuditEventStreamingDestinationsCreate(input: {
name: "testdest4",
category: "http",
groupPath: "twitter",
secretToken: "asfergrbtr",
config: {
url: "https://www.example.com"
}
}) {
errors
externalAuditEventDestination {
id
name
config
category
eventTypeFilters
}
}
}
- Now add an event type filter to the destination created in step 3 by running following mutation:
mutation auditEventsGroupDestinationEventsAdd {
auditEventsGroupDestinationEventsAdd(input: {
destinationId: "gid://gitlab/AuditEvents::Group::ExternalStreamingDestination/2",
eventTypeFilters: ["event_type_filters_created"]}){
errors
eventTypeFilters
}
}
- You can list down all information of the destinations belonging to the group by, it should list the filter added:
query groupDestinations {
group(fullPath: "twitter") {
id
name
externalAuditEventStreamingDestinations {
nodes {
id
name
category
config
eventTypeFilters
}
}
}
}
- For deleting the filter, run following mutation:
mutation auditEventsGroupDestinationEventsDelete {
auditEventsGroupDestinationEventsDelete(input: {
destinationId: "gid://gitlab/AuditEvents::Group::ExternalStreamingDestination/2",
eventTypeFilters: ["event_type_filters_created"]
}){
errors
}
}
- Check if the filter is removed by running query in step 5.
Related to #436611