dingtalk

package
v1.0.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 13, 2019 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DINGTALK_SINK         = "DingTalkSink"
	WARNING           int = 2
	NORMAL            int = 1
	DEFAULT_MSG_TYPE      = "text"
	CONTENT_TYPE_JSON     = "application/json"
	LABE_TEMPLATE         = "%s\n"
)

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 DingTalkMsg

type DingTalkMsg struct {
	MsgType string       `json:"msgtype"`
	Text    DingTalkText `json:"text"`
}

* dingtalk msg struct

type DingTalkSink

type DingTalkSink struct {
	Endpoint   string
	Namespaces []string
	Kinds      []string
	Token      string
	Level      int
	Labels     []string
}

* dingtalk sink usage --sink:dingtalk:https://oapi.dingtalk.com/robot/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 NewDingTalkSink

func NewDingTalkSink(uri *url.URL) (*DingTalkSink, error)

func (*DingTalkSink) Ding

func (d *DingTalkSink) Ding(event *v1.Event)

func (*DingTalkSink) ExportEvents

func (d *DingTalkSink) ExportEvents(batch *core.EventBatch)

func (*DingTalkSink) Name

func (d *DingTalkSink) Name() string

func (*DingTalkSink) Stop

func (d *DingTalkSink) Stop()

type DingTalkText

type DingTalkText struct {
	Content string `json:"content"`
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL