snapshot: AnsibleManager拆分前快照
This commit is contained in:
1 parent
16205fdb2b
commit
e6d9f364e5
13 files changed
+660
-103
No files matched your search
@@ -251,6 +251,48 @@ func (h *AlertHandler) DeleteRule(c *gin.Context) {
|
||||
})
|
||||
}
|
||||
|
||||
// BatchDeleteRules 批量删除告警规则 // Logan.Li
|
||||
// @Summary 批量删除告警规则
|
||||
// @Description 批量删除指定告警规则
|
||||
// @Tags 告警
|
||||
// @Accept json
|
||||
// @Produce json
|
||||
// @Security Bearer
|
||||
// @Param request body models.IDsRequest true "删除请求"
|
||||
// @Success 200 {object} models.Response
|
||||
// @Router /alerts/rules/batch-delete [delete]
|
||||
func (h *AlertHandler) BatchDeleteRules(c *gin.Context) {
|
||||
var req models.IDsRequest
|
||||
if err := c.ShouldBindJSON(&req); err != nil {
|
||||
c.JSON(http.StatusBadRequest, models.Response{
|
||||
Code: 400,
|
||||
Message: "请求参数错误",
|
||||
})
|
||||
return
|
||||
}
|
||||
|
||||
if len(req.IDs) == 0 {
|
||||
c.JSON(http.StatusBadRequest, models.Response{
|
||||
Code: 400,
|
||||
Message: "请选择要删除的规则",
|
||||
})
|
||||
return
|
||||
}
|
||||
|
||||
if err := h.db.Delete(&models.AlertRule{}, req.IDs).Error; err != nil {
|
||||
c.JSON(http.StatusInternalServerError, models.Response{
|
||||
Code: 500,
|
||||
Message: "删除失败",
|
||||
})
|
||||
return
|
||||
}
|
||||
|
||||
c.JSON(http.StatusOK, models.Response{
|
||||
Code: 200,
|
||||
Message: "删除成功",
|
||||
})
|
||||
}
|
||||
|
||||
// ToggleRule 切换告警规则状态
|
||||
// @Summary 切换告警规则状态
|
||||
// @Description 启用或禁用告警规则
|
||||
|
||||
Reference in new issue
Block a user