sinks

package
v0.0.0-...-a5e5aeb Latest Latest
Warning

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

Go to latest
Published: Jun 15, 2023 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const (
	SinkTypeSlack      = SinkType("slack")
	SinkTypeMattermost = SinkType("mattermost")
	SinkTypeTeams      = SinkType("microsoft_teams")
)

Variables

This section is empty.

Functions

func ForwardEvent

func ForwardEvent(ctx context.Context, namespacedName string, sinkType SinkType, config interface{}, payload *Payload) error

Types

type Cache

type Cache struct {
	// contains filtered or unexported fields
}

func NewCache

func NewCache() *Cache

func (*Cache) Add

func (c *Cache) Add(namespacedName string, sink Sink, expireIn time.Duration) error

func (*Cache) Contains

func (c *Cache) Contains(namespacedName string) bool

func (*Cache) Get

func (c *Cache) Get(namespacedName string) (Sink, error)

func (*Cache) Remove

func (c *Cache) Remove(namespacedName string)

type Mattermost

type Mattermost struct {
	// contains filtered or unexported fields
}

func NewMattermostSink

func NewMattermostSink(ctx context.Context, config MattermostConfig) (*Mattermost, error)

func (*Mattermost) ForwardEvent

func (m *Mattermost) ForwardEvent(payload *Payload) error

type MattermostConfig

type MattermostConfig struct {
}

type Payload

type Payload struct {
	Level        string
	Note         string
	CommonLabels map[string]string
	ExtraLabels  map[string]string
	FirstSeen    time.Time
	LastSeen     time.Time
	Logs         string
}

func NewPayload

func NewPayload(level string, note string, commonLabels map[string]string, extraLabels map[string]string, firstSeen time.Time, lastSeen time.Time, logs string) *Payload

type Sink

type Sink interface {
	ForwardEvent(payload *Payload) error
	// contains filtered or unexported methods
}

func NewSink

func NewSink(ctx context.Context, namespacedName string, sinkType SinkType, config interface{}) (Sink, error)

type SinkType

type SinkType string

type Slack

type Slack struct {
	SinkType SinkType
	// contains filtered or unexported fields
}

func NewSlackSink

func NewSlackSink(ctx context.Context, config SlackConfig) (*Slack, error)

func (*Slack) ForwardEvent

func (s *Slack) ForwardEvent(payload *Payload) error

type SlackConfig

type SlackConfig struct {
	BotToken      string `json:"botToken"`
	ChannelID     string `json:"channelID"`
	AppLevelToken string `json:"appLevelToken"`
	Debug         bool   `json:"debug,omitempty"`
}

Jump to

Keyboard shortcuts

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