notify

package
v0.12.4 Latest Latest
Warning

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

Go to latest
Published: Dec 13, 2021 License: MIT Imports: 22 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func FormatShortMessage added in v0.11.0

func FormatShortMessage(event events.Event) (msg string)

FormatShortMessage prepares message in short event format

Types

type Discord added in v0.12.0

type Discord struct {
	Token     string
	ChannelID string
	NotifType config.NotifType
}

Discord contains URL and ClusterName

func (*Discord) SendEvent added in v0.12.0

func (d *Discord) SendEvent(event events.Event) (err error)

SendEvent sends event notification to Discord Channel

func (*Discord) SendMessage added in v0.12.0

func (d *Discord) SendMessage(msg string) error

SendMessage sends message to Discord Channel

type ElasticSearch added in v0.7.0

type ElasticSearch struct {
	ELSClient     *elastic.Client
	Server        string
	SkipTLSVerify bool
	Index         string
	Shards        int
	Replicas      int
	Type          string
}

ElasticSearch contains auth cred and index setting

func (*ElasticSearch) SendEvent added in v0.7.0

func (e *ElasticSearch) SendEvent(event events.Event) (err error)

SendEvent sends event notification to slack

func (*ElasticSearch) SendMessage added in v0.7.0

func (e *ElasticSearch) SendMessage(msg string) error

SendMessage sends message to slack channel

type EventMeta added in v0.9.0

type EventMeta struct {
	Kind      string `json:"kind"`
	Name      string `json:"name"`
	Namespace string `json:"namespace"`
	Cluster   string `json:"cluster,omitempty"`
}

EventMeta contains the meta data about the event occurred

type EventStatus added in v0.9.0

type EventStatus struct {
	Type     config.EventType `json:"type"`
	Level    config.Level     `json:"level"`
	Reason   string           `json:"reason,omitempty"`
	Error    string           `json:"error,omitempty"`
	Messages []string         `json:"messages,omitempty"`
}

EventStatus contains the status about the event occurred

type Mattermost added in v0.7.0

type Mattermost struct {
	Client    *model.Client4
	Channel   string
	NotifType config.NotifType
}

Mattermost contains server URL and token

func (*Mattermost) SendEvent added in v0.7.0

func (m *Mattermost) SendEvent(event events.Event) error

SendEvent sends event notification to Mattermost

func (*Mattermost) SendMessage added in v0.7.0

func (m *Mattermost) SendMessage(msg string) error

SendMessage sends message to Mattermost channel

type Notifier

type Notifier interface {
	SendEvent(events.Event) error
	SendMessage(string) error
}

Notifier to send event notification on the communication channels

func ListNotifiers added in v0.11.0

func ListNotifiers(conf config.CommunicationsConfig) []Notifier

ListNotifiers returns list of configured notifiers

func NewDiscord added in v0.12.0

func NewDiscord(c config.Discord) Notifier

NewDiscord returns new Discord object

func NewElasticSearch added in v0.7.0

func NewElasticSearch(c config.ElasticSearch) (Notifier, error)

NewElasticSearch returns new ElasticSearch object

func NewMattermost added in v0.7.0

func NewMattermost(c config.Mattermost) (Notifier, error)

NewMattermost returns new Mattermost object

func NewSlack

func NewSlack(c config.Slack) Notifier

NewSlack returns new Slack object

func NewWebhook added in v0.9.0

func NewWebhook(c config.CommunicationsConfig) Notifier

NewWebhook returns new Webhook object

type Slack

type Slack struct {
	Channel   string
	NotifType config.NotifType
	Client    *slack.Client
}

Slack contains Token for authentication with slack and Channel name to send notification to

func (*Slack) SendEvent

func (s *Slack) SendEvent(event events.Event) error

SendEvent sends event notification to slack

func (*Slack) SendMessage

func (s *Slack) SendMessage(msg string) error

SendMessage sends message to slack channel

type Webhook added in v0.9.0

type Webhook struct {
	URL string
}

Webhook contains URL

func (*Webhook) PostWebhook added in v0.9.0

func (w *Webhook) PostWebhook(jsonPayload *WebhookPayload) error

PostWebhook posts webhook to listener

func (*Webhook) SendEvent added in v0.9.0

func (w *Webhook) SendEvent(event events.Event) (err error)

SendEvent sends event notification to Webhook url

func (*Webhook) SendMessage added in v0.9.0

func (w *Webhook) SendMessage(msg string) error

SendMessage sends message to Webhook url

type WebhookPayload added in v0.9.0

type WebhookPayload struct {
	EventMeta       EventMeta   `json:"meta"`
	EventStatus     EventStatus `json:"status"`
	EventSummary    string      `json:"summary"`
	TimeStamp       time.Time   `json:"timestamp"`
	Recommendations []string    `json:"recommendations,omitempty"`
	Warnings        []string    `json:"warnings,omitempty"`
}

WebhookPayload contains json payload to be sent to webhook url

Jump to

Keyboard shortcuts

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