Versions in this module Expand all Collapse all v0 v0.2.0 Dec 1, 2020 Changes in this version + const FormatMarkdown + const FormatText + const NoticeLevelError + const NoticeLevelInfo + const NoticeLevelNone + const NoticeLevelSuccess + const NoticeLevelWarning + const NoticeMediaTypeAliyunSms + const NoticeMediaTypeDingTalk + const NoticeMediaTypeEmail + const NoticeMediaTypeQyWeixin + const NoticeMediaTypeQyWeixinRobot + const NoticeMediaTypeScript + const NoticeMediaTypeTeaSms + const NoticeMediaTypeTelegram + const NoticeMediaTypeWebhook + func AllNoticeLevels() []maps.Map + func AllNoticeMediaTypes() []maps.Map + func FindNoticeLevel(level NoticeLevel) maps.Map + func FindNoticeLevelName(level NoticeLevel) string + func FindNoticeMediaType(mediaType string) maps.Map + func FindNoticeMediaTypeName(mediaType string) string + func IsFailureLevel(level NoticeLevel) bool + type AgentCond struct + AgentId string + AppId string + ItemId string + Level uint8 + TaskId string + Threshold string + type Item struct + Body string + Level NoticeLevel + On bool + Receivers []*NoticeReceiver + Subject string + func NewItem(level NoticeLevel) *Item + func NewItemFromRequest(req *http.Request, name string) *Item + func (this *Item) FormatBody(vars maps.Map) string + func (this *Item) FormatSubject(vars maps.Map) string + type Notice struct + Agent AgentCond + Id shared.ObjectId + IsNotified bool + IsRead bool + Message string + MessageHash string + Proxy ProxyCond + Receivers []string + Timestamp int64 + func NewNotice() *Notice + func (this *Notice) DBColumns() maps.Map + func (this *Notice) Hash() + func (this *Notice) SetDBColumns(v maps.Map) + func (this *Notice) SetTime(t time.Time) + type NoticeAliyunSmsMedia struct + AccessKeyId string + AccessKeySecret string + Sign string + TemplateCode string + Variables []*shared.Variable + func NewNoticeAliyunSmsMedia() *NoticeAliyunSmsMedia + func (this *NoticeAliyunSmsMedia) RequireUser() bool + func (this *NoticeAliyunSmsMedia) Send(user string, subject string, body string) (resp []byte, err error) + type NoticeDingTalkMedia struct + WebhookURL string + func NewNoticeDingTalkMedia() *NoticeDingTalkMedia + func (this *NoticeDingTalkMedia) RequireUser() bool + func (this *NoticeDingTalkMedia) Send(user string, subject string, body string) (resp []byte, err error) + type NoticeEmailMedia struct + From string + Password string + SMTP string + Username string + func NewNoticeEmailMedia() *NoticeEmailMedia + func (this *NoticeEmailMedia) RequireUser() bool + func (this *NoticeEmailMedia) Send(user string, subject string, body string) (resp []byte, err error) + func (this *NoticeEmailMedia) SendMail(from string, to []string, message []byte) error + type NoticeLevel = uint8 + type NoticeLevelConfig struct + Receivers []*NoticeReceiver + ShouldNotify bool + func (this *NoticeLevelConfig) AddReceiver(receiver *NoticeReceiver) + func (this *NoticeLevelConfig) FindReceiver(receiverId string) *NoticeReceiver + func (this *NoticeLevelConfig) RemoveMediaReceivers(mediaId string) + func (this *NoticeLevelConfig) RemoveReceiver(receiverId string) + type NoticeMediaConfig struct + Id string + Name string + On bool + Options map[string]interface{} + RateCount int + RateMinutes int + TimeFrom string + TimeTo string + Type NoticeMediaType + func NewNoticeMediaConfig() *NoticeMediaConfig + func (this *NoticeMediaConfig) Raw() (NoticeMediaInterface, error) + func (this *NoticeMediaConfig) ShouldNotify(countSent int) bool + func (this *NoticeMediaConfig) Validate() error + type NoticeMediaInterface interface + RequireUser func() bool + Send func(user string, subject string, body string) (resp []byte, err error) + type NoticeMediaType = string + type NoticeQyWeixinMedia struct + AgentId string + AppSecret string + CorporateId string + TextFormat TextFormat + func NewNoticeQyWeixinMedia() *NoticeQyWeixinMedia + func (this *NoticeQyWeixinMedia) RequireUser() bool + func (this *NoticeQyWeixinMedia) Send(user string, subject string, body string) (respData []byte, err error) + type NoticeQyWeixinRobotMedia struct + TextFormat TextFormat + WebhookURL string + func NewNoticeQyWeixinRobotMedia() *NoticeQyWeixinRobotMedia + func (this *NoticeQyWeixinRobotMedia) RequireUser() bool + func (this *NoticeQyWeixinRobotMedia) Send(user string, subject string, body string) (resp []byte, err error) + type NoticeReceiver struct + Id string + MediaId string + Name string + On bool + User string + func NewNoticeReceiver() *NoticeReceiver + func (this *NoticeReceiver) Key() string + type NoticeScriptMedia struct + Cwd string + Env []*shared.Variable + Path string + Script string + ScriptLang string + ScriptType string + func NewNoticeScriptMedia() *NoticeScriptMedia + func (this *NoticeScriptMedia) AddEnv(name, value string) + func (this *NoticeScriptMedia) FormattedScript() string + func (this *NoticeScriptMedia) Generate(id string) (path string, err error) + func (this *NoticeScriptMedia) RequireUser() bool + func (this *NoticeScriptMedia) Send(user string, subject string, body string) (resp []byte, err error) + type NoticeSetting struct + Levels map[NoticeLevel]*NoticeLevelConfig + Medias []*NoticeMediaConfig + SoundOn bool + func SharedNoticeSetting() *NoticeSetting + func (this *NoticeSetting) AddMedia(mediaConfig *NoticeMediaConfig) + func (this *NoticeSetting) FindAllNoticeReceivers(level ...NoticeLevel) []*NoticeReceiver + func (this *NoticeSetting) FindMedia(mediaId string) *NoticeMediaConfig + func (this *NoticeSetting) FindReceiver(receiverId string) (level NoticeLevel, receiver *NoticeReceiver) + func (this *NoticeSetting) LevelConfig(level NoticeLevel) *NoticeLevelConfig + func (this *NoticeSetting) Notify(level NoticeLevel, subject string, message string, ...) (receiverIds []string) + func (this *NoticeSetting) NotifyReceivers(level NoticeLevel, receivers []*NoticeReceiver, subject string, message string, ...) (receiverIds []string) + func (this *NoticeSetting) RemoveMedia(mediaId string) + func (this *NoticeSetting) Save() error + type NoticeTeaSmsMedia struct + AccessId string + AccessSecret string + Sign string + func NewNoticeTeaSmsMedia() *NoticeTeaSmsMedia + func (this *NoticeTeaSmsMedia) RequireUser() bool + func (this *NoticeTeaSmsMedia) Send(user string, subject string, body string) (respBytes []byte, err error) + type NoticeTelegramMedia struct + Token string + func NewNoticeTelegramMedia() *NoticeTelegramMedia + func (this *NoticeTelegramMedia) RequireUser() bool + func (this *NoticeTelegramMedia) Send(user string, subject string, body string) (respBytes []byte, err error) + type NoticeWebhookMedia struct + Body string + ContentType string + Headers []*shared.Variable + Method string + Params []*shared.Variable + URL string + func NewNoticeWebhookMedia() *NoticeWebhookMedia + func (this *NoticeWebhookMedia) AddHeader(name string, value string) + func (this *NoticeWebhookMedia) AddParam(name string, value string) + func (this *NoticeWebhookMedia) RequireUser() bool + func (this *NoticeWebhookMedia) Send(user string, subject string, body string) (resp []byte, err error) + type ProxyCond struct + BackendId string + FastcgiId string + Level uint8 + LocationId string + RewriteId string + ServerId string + Websocket bool + type TextFormat = string