Skip to content
Snippets Groups Projects

Adding create and delete apis for instance namespace filters

Merged Hitesh Raghuvanshi requested to merge 436613-instance-namespace-apis into master
All threads resolved!

What does this MR do and why?

As part of consolidation of external audit event streaming destinations in &12339, this MR introduces APIs for creating and deleting namespace_filters for instance level external audit event destinations.

How to set up and validate locally

  1. Make sure you have a GitLab instance with Ultimate license. Also have some groups and projects in the instance.
  2. First create an external audit event destination for the instance by running following mutation in http://gitlab.localdev:3000/-/graphql-explorer.
mutation instanceAuditEventStreamingDestinationsCreate {
  instanceAuditEventStreamingDestinationsCreate(input: {
    name: "testdest7",
    category: "http",
    secretToken: "random_secret_token",
    config: {
      url: "https://www.example.com"
    }
  }) {
    errors
    externalAuditEventDestination {
      id
      name
      config
      category
    }
  }
}
  1. Now create a namespace filter for the destination by running following mutation, here you can pass any group or project that exists in the instance:
mutation auditEventsInstanceDestinationNamespaceFilterCreate {
  auditEventsInstanceDestinationNamespaceFilterCreate(input: {
    destinationId: "gid://gitlab/AuditEvents::Instance::ExternalStreamingDestination/1",
    namespacePath: "<group or project full_path, for example flightjs/Flight>"
  }) {
    errors
    namespaceFilter {
      id
      namespace {
        id
        name
        fullName
      }
    }
  }
}
  1. For deleting the namespace filter you can run following mutation:
mutation auditEventsInstanceDestinationNamespaceFilterDelete {
  auditEventsInstanceDestinationNamespaceFilterDelete(input: {
    namespaceFilterId: "gid://gitlab/AuditEvents::Instance::NamespaceFilter/1"
  }) {
    errors
  }
}
  1. You should not get errors in any of the above mutations.
  2. You can also list down all the streaming destination with their namespace filters by running
query auditEventsInstanceStreamingDestinations {
  auditEventsInstanceStreamingDestinations {
    nodes {
      id
      name
      category
      config
      namespaceFilters {
        id
      }
    }
  }
}

Related to #436613 (closed)

Edited by Hitesh Raghuvanshi

Merge request reports

Loading
Loading

Activity

Filter activity
  • Approvals
  • Assignees & reviewers
  • Comments (from bots)
  • Comments (from users)
  • Commits & branches
  • Edits
  • Labels
  • Lock status
  • Mentions
  • Merge request status
  • Tracking
  • Jarka Košanová
  • Hitesh Raghuvanshi added 1628 commits

    added 1628 commits

    Compare with previous version

  • Ghost User
  • added 2 commits

    Compare with previous version

  • Hitesh Raghuvanshi reset approvals from @harsimarsandhu by pushing to the branch

    reset approvals from @harsimarsandhu by pushing to the branch

  • added 1 commit

    Compare with previous version

  • added pipelinetier-1 label and removed pipelinetier-2 label

  • Hitesh Raghuvanshi requested review from @eread

    requested review from @eread

  • Evan Read
  • Evan Read removed review request for @eread

    removed review request for @eread

  • Evan Read requested changes

    requested changes

  • Hitesh Raghuvanshi requested review from @eread

    requested review from @eread

  • added 1 commit

    • 382b830a - Adding suggestion from reviewer

    Compare with previous version

  • Hitesh Raghuvanshi requested review from @jarka

    requested review from @jarka

  • Hitesh Raghuvanshi added 300 commits

    added 300 commits

    Compare with previous version

  • added 1 commit

    • 3762fb34 - Adding auto generated graphql docs

    Compare with previous version

  • added 1 commit

    Compare with previous version

  • Evan Read approved this merge request

    approved this merge request

  • Evan Read removed review request for @eread

    removed review request for @eread

  • added pipelinetier-2 label and removed pipelinetier-1 label

    • Resolved by Jarka Košanová

      Before you set this MR to auto-merge

      This merge request will progress on pipeline tiers until it reaches the last tier: pipelinetier-3. We will trigger a new pipeline for each transition to a higher tier.

      Before you resolve this discussion, please check the following:

      • You are the last maintainer of this merge request
      • The latest pipeline for this merge request is pipelinetier-3 (You can find which tier it is in the pipeline name)
      • This pipeline is recent enough (created in the last 8 hours)

      If all the criteria above apply, please resolve this discussion and the set auto-merge for this merge request.

      See pipeline tiers and merging a merge request for more details.

  • added 1 commit

    Compare with previous version

  • Hitesh Raghuvanshi reset approvals from @eread by pushing to the branch

    reset approvals from @eread by pushing to the branch

  • Hitesh Raghuvanshi added 164 commits

    added 164 commits

    Compare with previous version

  • added pipelinetier-1 label and removed pipelinetier-2 label

  • Evan Read approved this merge request

    approved this merge request

  • added pipelinetier-2 label and removed pipelinetier-1 label

  • Evan Read changed milestone to %17.2

    changed milestone to %17.2

  • Jarka Košanová approved this merge request

    approved this merge request

  • added pipelinetier-3 label and removed pipelinetier-2 label

  • Jarka Košanová resolved all threads

    resolved all threads

  • Jarka Košanová enabled automatic add to merge train when the pipeline for 52321432 succeeds

    enabled automatic add to merge train when the pipeline for 52321432 succeeds

  • Thanks @hraghuvanshi , looks great! MWPS set :rocket:

  • Jarka Košanová aborted automatic add to merge train because this merge request cannot be added to the merge train

    aborted automatic add to merge train because this merge request cannot be added to the merge train

  • Jarka Košanová enabled automatic add to merge train when the pipeline for e7269bac succeeds

    enabled automatic add to merge train when the pipeline for e7269bac succeeds

  • Jarka Košanová started a merge train

    started a merge train

  • mentioned in commit 7045aff7

  • added workflowstaging label and removed workflowcanary label

  • mentioned in issue #436613 (closed)

  • Please register or sign in to reply
    Loading