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:
@@ -454,16 +454,9 @@ func (srv *ProvisioningSrv) RouteGetAlertRuleExport(c *contextmodel.ReqContext,
|
||||
return ErrResp(http.StatusInternalServerError, err, "")
|
||||
}
|
||||
|
||||
e, err := AlertingFileExportFromAlertRuleGroupWithFolderTitle([]alerting_models.AlertRuleGroupWithFolderTitle{{
|
||||
AlertRuleGroup: &alerting_models.AlertRuleGroup{
|
||||
Title: rule.AlertRule.RuleGroup,
|
||||
FolderUID: rule.AlertRule.NamespaceUID,
|
||||
Interval: rule.AlertRule.IntervalSeconds,
|
||||
Rules: []alerting_models.AlertRule{rule.AlertRule},
|
||||
},
|
||||
OrgID: c.OrgID,
|
||||
FolderTitle: rule.FolderTitle,
|
||||
}})
|
||||
e, err := AlertingFileExportFromAlertRuleGroupWithFolderTitle([]alerting_models.AlertRuleGroupWithFolderTitle{
|
||||
alerting_models.NewAlertRuleGroupWithFolderTitleFromRulesGroup(rule.AlertRule.GetGroupKey(), alerting_models.RulesGroup{&rule.AlertRule}, rule.FolderTitle),
|
||||
})
|
||||
if err != nil {
|
||||
return ErrResp(http.StatusInternalServerError, err, "failed to create alerting file export")
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user