Create and delete apis for instance event type filters
What does this MR do and why?
Added create and delete graphql apis for creating and deleting event type filters to an instance 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 GitLab instance with
Ultimate
license and its admin access. - Open graphql-explorer and run following graphql queries and mutations.
- Create an instance level external audit event destination by running following mutation.
mutation instanceAuditEventStreamingDestinationsCreate {
instanceAuditEventStreamingDestinationsCreate(input: {
name: "testdest7",
category: "http",
secretToken: "random_secret_token",
config: {
url: "https://www.example.com"
}
}) {
errors
externalAuditEventDestination {
id
name
config
category
}
}
}
- Now add an event type filter to the destination created in step 3 by running following mutation:
mutation auditEventsInstanceDestinationEventsAdd {
auditEventsInstanceDestinationEventsAdd(input: {
destinationId: "gid://gitlab/AuditEvents::Instance::ExternalStreamingDestination/3",
eventTypeFilters: ["event_type_filters_created", "event_type_filters_deleted"]}){
errors
eventTypeFilters
}
}
- You can list down all information of the destinations belonging to the group by, it should list the filter added:
query auditEventsInstanceStreamingDestinations {
auditEventsInstanceStreamingDestinations {
nodes {
id
name
category
config
eventTypeFilters
}
}
}
- For deleting the filter, run following mutation:
mutation auditEventsInstanceDestinationEventsDelete {
auditEventsInstanceDestinationEventsDelete(input: {
destinationId: "gid://gitlab/AuditEvents::Instance::ExternalStreamingDestination/3",
eventTypeFilters: ["event_type_filters_created"]
}){
errors
}
}
- Check if the filter is removed by running query in step 5.
Related to #436614 (closed)
Edited by Hitesh Raghuvanshi