channels

package
v1.22.1 Latest Latest
Warning

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

Go to latest
Published: Nov 17, 2022 License: Apache-2.0 Imports: 20 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	EmailSecretName                    = "gemscloud-email-password"
	EmailSecretLabel map[string]string = map[string]string{
		"gemcloud": "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 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"
)

type Email

type Email struct {
	ChannelType  `json:"channelType"`
	SMTPServer   string `json:"smtpServer"`
	RequireTLS   bool   `json:"requireTLS"`
	From         string `json:"from"`
	To           string `json:"to"`
	AuthPassword string `json:"authPassword"`
}

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 {
	ChannelType `json:"channelType"`
	URL         string `json:"url"`        // 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 {
	ChannelType        `json:"channelType"`
	URL                string `json:"url"`
	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