Alerting: extend rules export API to filter by folder and group (#74423)

update endpoint `GET /api/v1/provisioning/alert-rules/export` to accept query parameters `folderUid` and `group`
This commit is contained in:
Yuri Tseretyan
2023-09-07 17:34:32 -04:00
committed by GitHub
parent 5cc737bb24
commit 0df3647367
8 changed files with 117 additions and 18 deletions
@@ -9,7 +9,7 @@ type AlertingFileExport struct {
Policies []NotificationPolicyExport `json:"policies,omitempty" yaml:"policies,omitempty"`
}
// swagger:parameters RouteGetAlertRuleGroupExport RouteGetAlertRuleExport RouteGetAlertRulesExport RouteGetContactpointsExport RouteGetContactpointExport
// swagger:parameters RouteGetAlertRuleGroupExport RouteGetAlertRuleExport RouteGetContactpointsExport RouteGetContactpointExport
type ExportQueryParams struct {
// Whether to initiate a download of the file or not.
// in: query
@@ -71,6 +71,20 @@ import (
// Responses:
// 204: description: The alert rule was deleted successfully.
// swagger:parameters RouteGetAlertRulesExport
type AlertRulesExportParameters struct {
ExportQueryParams
// UID of folder from which export rules
// in:query
// required:false
FolderUID string `json:"folderUid"`
// Name of group of rules to export. Must be specified only together with folder UID
// in:query
// required: false
GroupName string `json:"group"`
}
// swagger:parameters RouteGetAlertRule RoutePutAlertRule RouteDeleteAlertRule RouteGetAlertRuleExport
type AlertRuleUIDReference struct {
// Alert rule UID