Skip to content

Add GraphQL support for removing alert integrations

Sarah Yasonik requested to merge sy-destroy-integrations-api into master

What does this MR do?

Issues: #255515 (closed), #245333 (closed)

This MR adds a new mutation for managing alerting integrations - a delete mutation for just HTTP integrations. There can only be one Prometheus integration, and project services don't currently support deletion. If we wanted to add that functionality specifically, we could certainly research & do it, but I think it's out of scope for this feature set.

Expected responses:

  • User doesn't have permissions: 200 OK, but errors includes 'The resource that you are attempting to access does not exist or you don't have permission to perform this action'
  • Failure to remove the integration: 200 OK, but errors includes message related to what might have gone wrong
Sample mutation info for httpIntegrationDestroy

Sample Mutation:

mutation destroy($input: HttpIntegrationDestroyInput!) {
  httpIntegrationDestroy(input: $input) {
    integration {
      active
      apiUrl
      url
      token
      id
      name
    }
    errors
  }
}

Sample Input:

{
  "input": {
    "id": "gid://gitlab/AlertManagement::HttpIntegration/120040"
  }
}

Sample Response:

{
  "data": {
    "httpIntegrationDestroy": {
      "integration": {
        "active": false,
        "apiUrl": null,
        "url": "http://192.168.1.152:3000/Commit451/lab-coat/alerts/notify/name-modified-via-api/d9b54ccf55d99506.json",
        "token": "d25ab41ddd9f1677a24fc806ae184e2d",
        "id": "gid://gitlab/AlertManagement::HttpIntegration/120040",
        "name": "Name modified via API"
      },
      "errors": []
    }
  }
}

Sibling MRs:

Screenshots (strongly suggested)

Does this MR meet the acceptance criteria?

Conformity

Availability and Testing

Security

If this MR contains changes to processing or storing of credentials or tokens, authorization and authentication methods and other items described in the security review guidelines:

  • Label as security and @ mention @gitlab-com/gl-security/appsec
  • The MR includes necessary changes to maintain consistency between UI, API, email, or other methods
  • Security reports checked/validated by a reviewer from the AppSec team
Edited by Sarah Yasonik

Merge request reports