Alerting: Get grafana-managed alert rule by UID (#86845)

* Add auth checks and test

* Check user is authorized to view rule and add tests

* Change naming

* Update Swagger params

* Update auth test and swagger gen

* Update swagger gen

* Change response to GettableExtendedRuleNode

* openapi3-gen

* Update tests with refactors models pkg
This commit is contained in:
Fayzal Ghantiwala
2024-05-02 15:24:59 +01:00
committed by GitHub
parent 9e6de035c0
commit df25e9197e
12 changed files with 227 additions and 13 deletions
@@ -8,6 +8,18 @@ import (
"github.com/prometheus/common/model"
)
// swagger:route Get /ruler/grafana/api/v1/rule/{RuleUID} ruler RouteGetRuleByUID
//
// Get rule by UID
//
// Produces:
// - application/json
//
// Responses:
// 202: GettableExtendedRuleNode
// 403: ForbiddenError
// 404: description: Not found.
// swagger:route Get /ruler/grafana/api/v1/rules ruler RouteGetGrafanaRulesConfig
//
// List rule groups
@@ -206,6 +218,12 @@ type PathGetRulesParams struct {
PanelID int64
}
// swagger:parameters RouteGetRuleByUID
type PathGetRuleByUIDParams struct {
// in: path
RuleUID string
}
// swagger:model
type RuleGroupConfigResponse struct {
GettableRuleGroupConfig