Skip to content

Added create API for group level external audit event destination

What does this MR do and why?

This MR does following:

  1. Adds create API for newly added consolidated external audit event streaming destinations for top-level groups, as part of &12339.
  2. Lists the new consolidated audit event destinations associated with a group.

Please note that the config param is just expected to be a json for now, but there are separate issues #436607, #436608 and #436609 for adding handling of validations for various different types of destinations.

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

  1. For testing this, you need to have a group with Ultimate license.
  2. Visit graphql explorer, for example http://gitlab.localdev:3000/-/graphql-explorer on your local setup.
  3. Add following mutation for creating a new external destination, I am creating one for a group named twitter but you can pass any path for a top-level group.
mutation groupAuditEventStreamingDestinationsCreate {
  groupAuditEventStreamingDestinationsCreate(input: {
    name: "testdest4",
    category: "http",
    groupPath: "twitter",
    secretToken: "asfergrbtr",
    config: {
      url: "https://www.example.com"
    }
  }) {
    errors
    externalAuditEventDestination {
      id
      name
      config
      category
      group {
        id
        name
      }
    }
  }
}
  1. You should receive a destination object in response, something like.
{
  "data": {
    "groupAuditEventStreamingDestinationsCreate": {
      "errors": [],
      "externalAuditEventDestination": {
        "id": "gid://gitlab/AuditEvents::Group::ExternalStreamingDestination/7",
        "name": "testdest4",
        "config": {
          "url": "https://www.example.com"
        },
        "category": "http",
        "group": {
          "id": "gid://gitlab/Group/35",
          "name": "Twitter"
        }
      }
    }
  }
}
  1. You can also try by giving config as a string, or not passing required parameters, or by providing path to a subgroup, all of these should return errors.
  2. For fetching list of all external destinations belonging to a group, run the following query:
query groupDestinations {
  group(fullPath: "twitter") {
    id
    name
    externalAuditEventStreamingDestinations {
      nodes {
        id
        name
        category
      }
    }
  }
}

Related to #436610 (closed)

Edited by Hitesh Raghuvanshi

Merge request reports