Alerting: Rule version history API (#99041)

* implement store method to read rule versions

* implement request handler

* declare a new endpoint

* fix fake to return correct response

* add tests

* add integration tests

* rename history to versions

* apply diff from swagger CI step

Signed-off-by: Yuri Tseretyan <yuriy.tseretyan@grafana.com>

---------

Signed-off-by: Yuri Tseretyan <yuriy.tseretyan@grafana.com>
This commit is contained in:
Yuri Tseretyan
2025-02-03 13:26:18 -05:00
committed by GitHub
parent 8a259ecafa
commit ac41c19350
20 changed files with 772 additions and 16 deletions
@@ -20,6 +20,18 @@ import (
// 403: ForbiddenError
// 404: description: Not found.
// swagger:route Get /ruler/grafana/api/v1/rule/{RuleUID}/versions ruler RouteGetRuleVersionsByUID
//
// Get rule versions by UID
//
// Produces:
// - application/json
//
// Responses:
// 202: GettableRuleVersions
// 403: ForbiddenError
// 404: description: Not found.
// swagger:route Get /ruler/grafana/api/v1/rules ruler RouteGetGrafanaRulesConfig
//
// List rule groups
@@ -218,7 +230,7 @@ type PathGetRulesParams struct {
PanelID int64
}
// swagger:parameters RouteGetRuleByUID
// swagger:parameters RouteGetRuleByUID RouteGetRuleVersionsByUID
type PathGetRuleByUIDParams struct {
// in: path
RuleUID string
@@ -290,6 +302,9 @@ func (c *PostableRuleGroupConfig) validate() error {
return nil
}
// swagger:model
type GettableRuleVersions []GettableExtendedRuleNode
// swagger:model
type GettableRuleGroupConfig struct {
Name string `yaml:"name" json:"name"`