grafana/pkg/services/ngalert/api/tooling
Joe Blubaugh b905777ba9
Alerting: Support deleting rule groups in the provisioning API (#83514)
* Alerting: feat: support deleting rule groups in the provisioning API

Adds support for DELETE to the provisioning API's alert rule groups route, which allows deleting the rule group with a
single API call. Previously, groups were deleted by deleting rules one-by-one.

Fixes #81860

This change doesn't add any new paths to the API, only new methods.

---------

Co-authored-by: Yuri Tseretyan <yuriy.tseretyan@grafana.com>
2024-02-28 10:19:02 -05:00
..
cmd/clean-swagger Chore: use any rather than interface{} (#74066) 2023-08-30 18:46:47 +03:00
definitions Alerting: Support deleting rule groups in the provisioning API (#83514) 2024-02-28 10:19:02 -05:00
swagger-codegen/templates ngalert openapi: Use same basePath as rest of Grafana (#79025) 2024-01-17 11:53:16 -05:00
.gitignore Alerting: Add support for documenting which alerting APIs are stable (#49018) 2022-05-23 14:08:27 -05:00
api.json Alerting: Support deleting rule groups in the provisioning API (#83514) 2024-02-28 10:19:02 -05:00
index.html Swagger: Add integrity attributes (#48396) 2022-05-02 09:49:49 +02:00
Makefile ngalert make: Support GNU install on Darwin (#78482) 2023-12-04 10:11:39 -05:00
post.json Alerting: Support deleting rule groups in the provisioning API (#83514) 2024-02-28 10:19:02 -05:00
README.md fix typos (#83414) 2024-02-26 10:52:44 -07:00
spec.json Alerting: Support deleting rule groups in the provisioning API (#83514) 2024-02-28 10:19:02 -05:00

What

This aims to define the unified alerting API as code. It generates OpenAPI definitions from go structs. It also generates server/route stubs based on our documentation.

Running

make - regenerate everything - documentation and server stubs. make serve - regenerate the Swagger document, and host rendered docs on port 80. view api

Requires

Why

The current state of Swagger extraction from golang is relatively limited. It's easier to generate server stubs from an existing Swagger doc, as there are limitations with producing a Swagger doc from a hand-written API stub. The current extractor instead relies on comments describing the routes, but the comments and actual implementation may drift, which we don't want to allow.

Instead, we use a hybrid approach - we define the types in Golang, with comments describing the routes, in a standalone package with minimal dependencies. From this, we produce a Swagger doc, and then turn the Swagger doc back into a full-blown server stub.

Stability

We have some endpoints that we document publicly as being stable, and others that we consider unstable. The stable endpoints are documented in api.json, where all endpoints are available in post.json.

To stabilize an endpoint, add the stable tag to its route comment:

// swagger:route GET /provisioning/contact-points provisioning stable RouteGetContactpoints