GraphQL API for listing instance level gcp destinations
What does this MR do and why?
- Adding GraphQL API for listing instance level google cloud logging configurations for streaming audit events.
- Refactored some code and moved it to an interface for reuse.
Changes in this MR are quite similar to listing instance level custom http destinations for streaming audit events as can be referenced in !119602 (merged).
GraphQL query
query instanceGoogleCloudLoggingConfigurations {
instanceGoogleCloudLoggingConfigurations {
nodes {
id
logIdName
googleProjectIdName
clientEmail
name
}
}
}
Query plan
Query
SELECT
"audit_events_instance_google_cloud_logging_configurations".*
FROM
"audit_events_instance_google_cloud_logging_configurations"
ORDER BY
"audit_events_instance_google_cloud_logging_configurations"."id" DESC
LIMIT
101
https://console.postgres.ai/gitlab/gitlab-production-tunnel-pg12/sessions/21991/commands/71158
Note: Currently there are no rows for the table but there is a limit of 5 rows currently for this.
How to set up and validate locally
- Create some instance level GCP destinations by running following command in the rails console, if creating more than one then keep chaning the google_project_id_name and name.
AuditEvents::Instance::GoogleCloudLoggingConfiguration.create!(google_project_id_name: "project-name-1", client_email: "abcd1@example.com", log_id_name: "some_log_name", name: "First destination", private_key: "random_private_key")
- Run following query in graphql-explorer(https://gitlab.localdev:3000/-/graphql-explorer) to list down all the destinations
query instanceGoogleCloudLoggingConfigurations {
instanceGoogleCloudLoggingConfigurations {
nodes {
id
logIdName
googleProjectIdName
clientEmail
name
}
}
}
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 #423038 (closed)
Edited by Hitesh Raghuvanshi