Alerting: Rule Modify Export APIs (#75322)
* extend RuleStore interface to get namespace by UID * add new export API endpoints * implement request handlers * update authorization and wire handlers to paths * add folder error matchers to errorToResponse * add tests for export methods
This commit is contained in:
@@ -19,6 +19,18 @@ import (
|
||||
// 202: NamespaceConfigResponse
|
||||
//
|
||||
|
||||
// swagger:route Get /api/ruler/grafana/api/v1/export/rules ruler RouteGetRulesForExport
|
||||
//
|
||||
// List rules in provisioning format
|
||||
//
|
||||
// Consumes:
|
||||
// - application/json
|
||||
// - application/yaml
|
||||
//
|
||||
// Responses:
|
||||
// 200: AlertingFileExport
|
||||
// 404: description: Not found.
|
||||
|
||||
// swagger:route Get /api/ruler/{DatasourceUID}/api/v1/rules ruler RouteGetRulesConfig
|
||||
//
|
||||
// List rule groups
|
||||
@@ -42,6 +54,18 @@ import (
|
||||
// 202: Ack
|
||||
//
|
||||
|
||||
// swagger:route POST /api/ruler/grafana/api/v1/rules/{Namespace}/export ruler RoutePostRulesGroupForExport
|
||||
//
|
||||
// Converts submitted rule group to provisioning format
|
||||
//
|
||||
// Consumes:
|
||||
// - application/json
|
||||
// - application/yaml
|
||||
//
|
||||
// Responses:
|
||||
// 200: AlertingFileExport
|
||||
// 404: description: Not found.
|
||||
|
||||
// swagger:route POST /api/ruler/{DatasourceUID}/api/v1/rules/{Namespace} ruler RoutePostNameRulesConfig
|
||||
//
|
||||
// Creates or updates a rule group
|
||||
@@ -126,7 +150,7 @@ import (
|
||||
// 202: Ack
|
||||
// 404: NotFound
|
||||
|
||||
// swagger:parameters RoutePostNameRulesConfig RoutePostNameGrafanaRulesConfig
|
||||
// swagger:parameters RoutePostNameRulesConfig RoutePostNameGrafanaRulesConfig RoutePostRulesGroupForExport
|
||||
type NamespaceConfig struct {
|
||||
// in:path
|
||||
Namespace string
|
||||
|
||||
@@ -9,7 +9,7 @@ type AlertingFileExport struct {
|
||||
Policies []NotificationPolicyExport `json:"policies,omitempty" yaml:"policies,omitempty"`
|
||||
}
|
||||
|
||||
// swagger:parameters RouteGetAlertRuleGroupExport RouteGetAlertRuleExport RouteGetContactpointsExport RouteGetContactpointExport
|
||||
// swagger:parameters RouteGetAlertRuleGroupExport RouteGetAlertRuleExport RouteGetContactpointsExport RouteGetContactpointExport RoutePostRulesGroupForExport
|
||||
type ExportQueryParams struct {
|
||||
// Whether to initiate a download of the file or not.
|
||||
// in: query
|
||||
|
||||
@@ -71,7 +71,7 @@ import (
|
||||
// Responses:
|
||||
// 204: description: The alert rule was deleted successfully.
|
||||
|
||||
// swagger:parameters RouteGetAlertRulesExport
|
||||
// swagger:parameters RouteGetAlertRulesExport RouteGetRulesForExport
|
||||
type AlertRulesExportParameters struct {
|
||||
ExportQueryParams
|
||||
// UIDs of folders from which to export rules
|
||||
|
||||
Reference in New Issue
Block a user