channels

package
v1.24.5 Latest Latest
Warning

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

Go to latest
Published: Apr 28, 2024 License: Apache-2.0 Imports: 21 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	EmailSecretName       = "gemscloud-email-password"
	EmailSecretLabelKey   = "gemcloud"
	EmailSecretLabelValue = "email-secret"
)
View Source
var (
	KubegemsWebhookURL = fmt.Sprintf("https://kubegems-local-agent.%s:8041/alert", gems.NamespaceLocal)
)

Functions

func EmailSecretKey

func EmailSecretKey(receverName, from string) string

Types

type AliyunMsg added in v1.23.0

type AliyunMsg struct {
	BaseChannel     `json:",inline"`
	AccessKeyId     string `json:"accessKeyId" binding:"required"`
	AccessKeySecret string `json:"accessKeySecret" binding:"required"`
	PhoneNumbers    string `json:"phoneNumbers" binding:"required"` // 电话号码,多个中间以","隔开
	SignName        string `json:"signName" binding:"required"`     // 签名
	TemplateCode    string `json:"templateCode" binding:"required"` // 模板
}

AliyunMsg 阿里云短信

func (*AliyunMsg) Check added in v1.23.0

func (m *AliyunMsg) Check() error

func (*AliyunMsg) String added in v1.23.0

func (m *AliyunMsg) String() string

func (*AliyunMsg) Test added in v1.23.0

func (m *AliyunMsg) Test(alert prometheus.WebhookAlert) error

func (*AliyunMsg) ToReceiver added in v1.23.0

func (m *AliyunMsg) ToReceiver(name string) v1alpha1.Receiver

type AliyunVoice added in v1.23.0

type AliyunVoice struct {
	BaseChannel     `json:",inline"`
	AccessKeyId     string `json:"accessKeyId" binding:"required"`
	AccessKeySecret string `json:"accessKeySecret" binding:"required"`
	CallNumber      string `json:"callNumber" binding:"required"` // 电话号码,只支持单个
	TtsCode         string `json:"ttsCode" binding:"required"`    // 模板
}

AliyunVoice 阿里云语音

func (*AliyunVoice) Check added in v1.23.0

func (v *AliyunVoice) Check() error

func (*AliyunVoice) String added in v1.23.0

func (v *AliyunVoice) String() string

func (*AliyunVoice) Test added in v1.23.0

func (v *AliyunVoice) Test(alert prometheus.WebhookAlert) error

func (*AliyunVoice) ToReceiver added in v1.23.0

func (v *AliyunVoice) ToReceiver(name string) v1alpha1.Receiver

type BaseChannel added in v1.22.2

type BaseChannel struct {
	ChannelType  ChannelType `json:"channelType"`
	SendResolved bool        `json:"sendResolved"`
}

type ChannelConfig

type ChannelConfig struct {
	ChannelIf
}

func (ChannelConfig) GormDBDataType

func (ChannelConfig) GormDBDataType(db *gorm.DB, field *schema.Field) string

GormDBDataType gorm db data type

func (ChannelConfig) GormDataType

func (m ChannelConfig) GormDataType() string

GormDataType gorm common data type

func (ChannelConfig) MarshalJSON

func (m ChannelConfig) MarshalJSON() ([]byte, error)

MarshalJSON to output non base64 encoded []byte

func (*ChannelConfig) Scan

func (m *ChannelConfig) Scan(val interface{}) error

Scan scan value into Jsonb, implements sql.Scanner interface

func (*ChannelConfig) UnmarshalJSON

func (m *ChannelConfig) UnmarshalJSON(b []byte) error

UnmarshalJSON to deserialize []byte

func (ChannelConfig) Value

func (m ChannelConfig) Value() (driver.Value, error)

Value return json value, implement driver.Valuer interface

type ChannelGetter

type ChannelGetter func(id uint) (ChannelIf, error)

type ChannelIf

type ChannelIf interface {
	ToReceiver(name string) v1alpha1.Receiver
	Check() error
	Test(alert prometheus.WebhookAlert) error
	String() string
}

type ChannelMapper

type ChannelMapper struct {
	M   map[uint]ChannelIf
	Err error
}

func (*ChannelMapper) FindChannel

func (m *ChannelMapper) FindChannel(id uint) (ChannelIf, error)

type ChannelType

type ChannelType string
const (
	TypeWebhook     ChannelType = "webhook"
	TypeEmail       ChannelType = "email"
	TypeFeishu      ChannelType = "feishu"
	TypeDingding    ChannelType = "dingding"
	TypeAliyunMsg   ChannelType = "aliyunMsg"
	TypeAliyunVoice ChannelType = "aliyunVoice"
)

type Dingding added in v1.23.0

type Dingding struct {
	BaseChannel `json:",inline"`
	URL         string `json:"url" binding:"required"` // Dingding robot webhook url
	AtMobiles   string `json:"atMobiles"`              // 要@的用户手机号
	SignSecret  string `json:"signSecret"`             // 签名校验key
}

func (*Dingding) Check added in v1.23.0

func (f *Dingding) Check() error

func (*Dingding) String added in v1.23.0

func (f *Dingding) String() string

func (*Dingding) Test added in v1.23.0

func (f *Dingding) Test(alert prometheus.WebhookAlert) error

func (*Dingding) ToReceiver added in v1.23.0

func (f *Dingding) ToReceiver(name string) v1alpha1.Receiver

type Email

type Email struct {
	BaseChannel  `json:",inline"`
	SMTPServer   string `json:"smtpServer" binding:"required"`
	RequireTLS   bool   `json:"requireTLS"`
	From         string `json:"from" binding:"required"`
	To           string `json:"to" binding:"required"`
	AuthPassword string `json:"authPassword" binding:"required"`
}

func (*Email) Check

func (e *Email) Check() error

func (*Email) String added in v1.22.1

func (e *Email) String() string

func (*Email) Test

func (e *Email) Test(alert prometheus.WebhookAlert) error

func (*Email) ToReceiver

func (e *Email) ToReceiver(name string) v1alpha1.Receiver

type Feishu

type Feishu struct {
	BaseChannel `json:",inline"`
	URL         string `json:"url" binding:"required"` // feishu robot webhook url
	At          string `json:"at"`                     // 要@的用户id,所有人则是 all
	SignSecret  string `json:"signSecret"`             // 签名校验key
}

func (*Feishu) Check

func (f *Feishu) Check() error

func (*Feishu) String added in v1.22.1

func (f *Feishu) String() string

func (*Feishu) Test

func (f *Feishu) Test(alert prometheus.WebhookAlert) error

func (*Feishu) ToReceiver

func (f *Feishu) ToReceiver(name string) v1alpha1.Receiver

type Webhook

type Webhook struct {
	BaseChannel        `json:",inline"`
	URL                string `json:"url" binding:"required"`
	InsecureSkipVerify bool   `json:"insecureSkipVerify"`
}

func (*Webhook) Check

func (w *Webhook) Check() error

func (*Webhook) String added in v1.22.1

func (w *Webhook) String() string

func (*Webhook) Test

func (w *Webhook) Test(alert prometheus.WebhookAlert) error

func (*Webhook) ToReceiver

func (w *Webhook) ToReceiver(name string) v1alpha1.Receiver

Jump to

Keyboard shortcuts

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