MCPcopy Create free account
hub / github.com/1Panel-dev/1Panel / DeleteAlertConfig

Method DeleteAlertConfig

agent/app/service/alert.go:656–669  ·  view source on GitHub ↗
(id uint)

Source from the content-addressed store, hash-verified

654}
655
656func (a AlertService) DeleteAlertConfig(id uint) error {
657 _, err := alertRepo.GetConfigById(id)
658 if err != nil {
659 return err
660 }
661 usedAlerts, err := alertRepo.List(alertRepo.WithByAlertMethodContainsConfigID(id))
662 if err != nil {
663 return err
664 }
665 if len(usedAlerts) > 0 {
666 return buserr.New("ErrAlertConfigInUse")
667 }
668 return alertRepo.DeleteAlertConfig(repo.WithByID(id))
669}
670
671func (a AlertService) TestAlertConfig(req dto.AlertConfigTest) (bool, error) {
672 username := req.UserName

Callers

nothing calls this directly

Calls 5

GetConfigByIdMethod · 0.65
ListMethod · 0.65
DeleteAlertConfigMethod · 0.65
WithByIDMethod · 0.65

Tested by

no test coverage detected