Use legacy destination helper in legacy destination create APIs
What does this MR do and why?
Uses the helper created in this MR !175628 (merged)
References
Please include cross links to any resources that are relevant to this MR. This will give reviewers and future readers helpful context to give an efficient review of the changes introduced.
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.
Screenshots or screen recordings
Screenshots are required for UI changes, and strongly recommended for all other merge requests.
Before | After |
---|---|
How to set up and validate locally
To test:
-
Checkout this branch locally, update migrations, and open
gdk
-- Ensure you have an Ultimate/EE license -
Enable the feature flag
audit_events_external_destination_streamer_consolidation_refactor
-
For legacy -> stream destination: you can use the UI following the documentation here to do so:
- https://docs.gitlab.com/ee/user/compliance/audit_event_streaming.html
- https://docs.gitlab.com/ee/administration/audit_event_streaming/index.html
- When you create it through the UI, open
gdk rails console
and look for the new models:AuditEvents::Group::ExternalStreamingDestination
orAuditEvents::Instance::ExternalStreamingDestination
depending on which you've created
-
To test the reverse flow, open
http://localhost:3000/-/graphql-explorer
on your gdk instance.
EX:
mutation CreateInstanceAuditEventStreamingDestination {
instanceAuditEventStreamingDestinationsCreate(
input: {
config: {
googleProjectIdName: "google-project-id-name",
clientEmail: "clientEmail@example.com",
logIdName: "gcp-log-id-name"
},
category: "gcp",
name: "Test Local Destination API GCP 12345"
secretToken:"SecretToken12345!" # required
}
) {
externalAuditEventDestination {
id
name
category
config
secretToken
}
errors
}
}
mutation CreateGroupAuditEventStreamingDestination {
groupAuditEventStreamingDestinationsCreate(
input: {
groupPath:"twitter",
config: {
googleProjectIdName: "google-project-id-name",
clientEmail: "clientEmail@example.com",
logIdName: "gcp-log-id-name"
},
category: "gcp",
name: "Test Local Destination API GCP 12345"
secretToken:"SecretToken12345!" # required
}
) {
externalAuditEventDestination {
id
name
group {
fullName
fullPath
}
category
config
secretToken
}
errors
}
}
Configs are different for each category, and they can be found from their json schemas here:
- HTTP: https://gitlab.com/gitlab-org/gitlab/-/blob/master/ee/app/validators/json_schemas/audit_events_http_external_streaming_destination_config.json
- GCP: https://gitlab.com/gitlab-org/gitlab/-/blob/master/ee/app/validators/json_schemas/audit_events_gcp_external_streaming_destination_config.json
- AWS: https://gitlab.com/gitlab-org/gitlab/-/blob/master/ee/app/validators/json_schemas/audit_events_aws_external_streaming_destination_config.json
Example demo where I create a new streaming model through API -> it shows up as a legacy destination as well: Screen_Recording_2024-12-04_at_2.00.12_PM
Example demo where I create a legacy instance destination for HTTP and it shows up as a stream destination via API: Screen_Recording_2024-12-04_at_2.05.40_PM