notifiers

package
v0.7.0 Latest Latest
Warning

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

Go to latest
Published: May 11, 2020 License: Apache-2.0 Imports: 19 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetAll

func GetAll(config Config) map[string]Notifier

Types

type BasicAuth added in v0.6.0

type BasicAuth struct {
	Username string `json:"username"`
	Password string `json:"password"`
}

type Config

type Config struct {
	Email    *EmailOptions    `json:"email"`
	Slack    *SlackOptions    `json:"slack"`
	Opsgenie *OpsgenieOptions `json:"opsgenie"`
	Grafana  *GrafanaOptions  `json:"grafana"`
	Webhook  *WebhookOptions  `json:"webhook"`
}

type EmailOptions

type EmailOptions struct {
	Host               string `json:"host"`
	Port               int    `json:"port"`
	InsecureSkipVerify bool   `json:"insecure_skip_verify"`
	Username           string `json:"username"`
	Password           string `json:"password"`
	From               string `json:"from"`
}

type GrafanaAnnotation added in v0.6.0

type GrafanaAnnotation struct {
	Time     int64    `json:"time"` // unix ts in ms
	IsRegion bool     `json:"isRegion"`
	Tags     []string `json:"tags"`
	Text     string   `json:"text"`
}

type GrafanaOptions added in v0.6.0

type GrafanaOptions struct {
	ApiUrl             string `json:"apiUrl"`
	ApiKey             string `json:"apiKey"`
	InsecureSkipVerify bool   `json:"insecureSkipVerify"`
}
type Header struct {
	Name  string `json:"name"`
	Value string `json:"value"`
}

type Notification added in v0.4.0

type Notification struct {
	Title   string                         `json:"title,omitempty"`
	Body    string                         `json:"body,omitempty"`
	Slack   *SlackNotification             `json:"slack,omitempty"`
	Webhook map[string]WebhookNotification `json:"webhook,omitempty" patchStrategy:"replace"`
}

type Notifier

type Notifier interface {
	Send(notification Notification, recipient string) error
}

func NewEmailNotifier

func NewEmailNotifier(opts EmailOptions) Notifier

func NewGrafanaNotifier added in v0.6.0

func NewGrafanaNotifier(opts GrafanaOptions) Notifier

func NewOpsgenieNotifier added in v0.4.0

func NewOpsgenieNotifier(opts OpsgenieOptions) Notifier

func NewSlackNotifier

func NewSlackNotifier(opts SlackOptions) Notifier

func NewWebhookNotifier added in v0.6.0

func NewWebhookNotifier(opts WebhookOptions) Notifier

type OpsgenieOptions added in v0.4.0

type OpsgenieOptions struct {
	ApiUrl  string            `json:"apiUrl"`
	ApiKeys map[string]string `json:"apiKeys"`
}

type SlackNotification added in v0.6.0

type SlackNotification struct {
	Attachments string `json:"attachments,omitempty"`
	Blocks      string `json:"blocks,omitempty"`
}

type SlackOptions

type SlackOptions struct {
	Username           string   `json:"username"`
	Icon               string   `json:"icon"`
	Token              string   `json:"token"`
	SigningSecret      string   `json:"signingSecret"`
	Channels           []string `json:"channels"`
	InsecureSkipVerify bool     `json:"insecureSkipVerify"`
}

type SlackSpecific added in v0.4.0

type SlackSpecific struct {
	Attachments string `json:"attachments,omitempty"`
	Blocks      string `json:"blocks,omitempty"`
}

type WebhookNotification added in v0.6.0

type WebhookNotification struct {
	Method string `json:"method"`
	Body   string `json:"body"`
	Path   string `json:"path"`
}

type WebhookOptions added in v0.6.0

type WebhookOptions []WebhookSettings

WebhookOptions holds list of configured webhooks settings

type WebhookSettings added in v0.6.0

type WebhookSettings struct {
	Name      string     `json:"name"`
	URL       string     `json:"url"`
	Headers   []Header   `json:"headers"`
	BasicAuth *BasicAuth `json:"basicAuth"`
}

Directories

Path Synopsis
Package mocks is a generated GoMock package.
Package mocks is a generated GoMock package.

Jump to

Keyboard shortcuts

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