Skip to content

Update APIs for activate headers

Hitesh Raghuvanshi requested to merge 367509-activate-update-apis into master

What does this MR do and why?

This MR adds a new boolean attribute active in the update APIs for streaming headers for group and instance level audit event external destinations.

How to set up and validate locally

  1. Please note that you need to have an ULTIMATE license for your instance or group and admin/owner access for the same.
  2. Create a new external audit event destination with at least one streaming header by following steps mentioned in https://docs.gitlab.com/ee/administration/audit_event_streaming/#add-a-new-http-destination-1.
  3. Visit graphql explorer https://gitlab.localdev:3000/-/graphql-explorer.
  4. Run following query for listing down all the destinations
query instanceExternalAuditEventDestinations {
  instanceExternalAuditEventDestinations {
    nodes {
      id
      name
      destinationUrl
      verificationToken
      headers {
        nodes {
          id
          key
          value
          active
        }
      }
      eventTypeFilters
    }
  }
}
  1. Run following mutation for updating the active attribute for the header by using the id obtained in response of query in step 4.
mutation auditEventsStreamingInstanceHeadersUpdate {
  auditEventsStreamingInstanceHeadersUpdate(input: { headerId: "gid://gitlab/AuditEvents::Streaming::InstanceHeader/<id>", active: false }) {
    errors
    header {
      id
      key
      value
      active
    }
  }
}
  1. You can run the query in step 4 again to check if the header got deactivated or not.
  2. Similar steps can be performed for group level destinations by following https://docs.gitlab.com/ee/administration/audit_event_streaming/#http-destinations and https://docs.gitlab.com/ee/administration/audit_event_streaming/graphql_api.html#update-streaming-destinations.

MR acceptance checklist

This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.

Related to #367509 (closed)

Edited by Hitesh Raghuvanshi

Merge request reports