2026-04-23 17:00:50 +08:00
|
|
|
package providers
|
|
|
|
|
|
|
|
|
|
import (
|
2026-09-02 14:49:20 +08:00
|
|
|
"errors"
|
2026-04-23 17:00:50 +08:00
|
|
|
"net/http"
|
|
|
|
|
|
|
|
|
|
"github.com/1Panel-dev/1Panel/agent/app/dto"
|
2026-06-02 22:35:21 +08:00
|
|
|
"github.com/1Panel-dev/1Panel/agent/app/model"
|
2026-04-23 17:00:50 +08:00
|
|
|
)
|
|
|
|
|
|
2026-09-02 14:49:20 +08:00
|
|
|
var ErrCustomWebhookUnsupported = errors.New("custom webhook sender is unavailable")
|
|
|
|
|
|
2026-04-23 17:00:50 +08:00
|
|
|
type AlertProvider interface {
|
|
|
|
|
GetNodeErrorAlert() (uint, error)
|
|
|
|
|
GetLicenseErrorAlert() (uint, error)
|
|
|
|
|
|
2026-06-02 22:35:21 +08:00
|
|
|
CreateTaskScanSMSAlertLog(alert dto.AlertDTO, alertType string, create dto.AlertLogCreate, pushAlert dto.PushAlert, config model.AlertConfig, method string) error
|
|
|
|
|
CreateSMSAlertLog(alertType string, info dto.AlertDTO, create dto.AlertLogCreate, project string, params []dto.Param, config model.AlertConfig, method string) error
|
|
|
|
|
CreateTaskScanWebhookAlertLog(alert dto.AlertDTO, alertType string, create dto.AlertLogCreate, pushAlert dto.PushAlert, config model.AlertConfig, transport *http.Transport, agentInfo *dto.AgentInfo) error
|
|
|
|
|
CreateWebhookAlertLog(alertType string, info dto.AlertDTO, create dto.AlertLogCreate, project string, params []dto.Param, config model.AlertConfig, transport *http.Transport, agentInfo *dto.AgentInfo) error
|
2026-04-23 17:00:50 +08:00
|
|
|
}
|
2026-09-02 14:49:20 +08:00
|
|
|
|
|
|
|
|
type CustomWebhookTester interface {
|
2026-10-14 11:28:21 +08:00
|
|
|
TestCustomWebhook(config dto.AlertCustomWebhookResolvedConfig, lang string) (dto.AlertConfigTestResult, error)
|
2026-09-02 14:49:20 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
type DeliveryResult struct {
|
|
|
|
|
Queued bool
|
|
|
|
|
LogID uint
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
type CustomWebhookDeliveryProvider interface {
|
|
|
|
|
CreateCustomWebhookAlertLog(alertType string, info dto.AlertDTO, create dto.AlertLogCreate, project string, params []dto.Param, config model.AlertConfig, transport *http.Transport, agentInfo *dto.AgentInfo, task dto.AlertTaskMetadata) (DeliveryResult, error)
|
|
|
|
|
CreateTaskScanCustomWebhookAlertLog(alert dto.AlertDTO, alertType string, create dto.AlertLogCreate, pushAlert dto.PushAlert, config model.AlertConfig, transport *http.Transport, agentInfo *dto.AgentInfo, task dto.AlertTaskMetadata) (DeliveryResult, error)
|
|
|
|
|
}
|