Documentation ¶
Index ¶
Constants ¶
View Source
const ( WECHAT_SINK = "WechatSink" WARNING int = 2 NORMAL int = 1 DEFAULT_MSG_TYPE = "text" CONTENT_TYPE_JSON = "application/json" LABEL_TEMPLATE = "%s\n" //发送消息使用的url SEND_MSG_URL = `https://qyapi.weixin.qq.com/cgi-bin/message/send?access_token=` //获取token使用的url GET_TOKEN_URL = `https://qyapi.weixin.qq.com/cgi-bin/gettoken?corpid=` )
Variables ¶
View Source
var ( MSG_TEMPLATE = "Level:%s \nKind:%s \nNamespace:%s \nName:%s \nReason:%s \nTimestamp:%s \nMessage:%s" MSG_TEMPLATE_ARR = [][]string{ {"Level"}, {"Kind"}, {"Namespace"}, {"Name"}, {"Reason"}, {"Timestamp"}, {"Message"}, } )
Functions ¶
This section is empty.
Types ¶
type WechatMsg ¶
type WechatMsg struct { ToUser string `json:"touser"` ToParty string `json:"toparty"` ToTag string `json:"totag"` MsgType string `json:"msgtype"` AgentID int `json:"agentid"` Text WechatText `json:"text"` Safe int `json:"safe"` }
* wechat msg struct
type WechatSink ¶
type WechatSink struct { Namespaces []string Kinds []string CorpID string CorpSecret string AgentID int ToUser []string Level int Labels []string }
* wechat sink usage --sink:wechat:https://qyapi.weixin.qq.com/cgi-bin/message/send?access_token=[access_token]&level=Warning&label=[label]
level: Normal or Warning. The event level greater than global level will emit. label: some thing unique when you want to distinguish different k8s clusters.
func NewWechatSink ¶
func NewWechatSink(uri *url.URL) (*WechatSink, error)
func (*WechatSink) ExportEvents ¶
func (d *WechatSink) ExportEvents(batch *core.EventBatch)
func (*WechatSink) Name ¶
func (d *WechatSink) Name() string
func (*WechatSink) Send ¶
func (d *WechatSink) Send(event *v1.Event)
func (*WechatSink) Stop ¶
func (d *WechatSink) Stop()
type WechatText ¶
type WechatText struct {
Content string `json:"content"`
}
Click to show internal directories.
Click to hide internal directories.