services

package
v1.0.0-rc1 Latest Latest
Warning

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

Go to latest
Published: Jan 9, 2021 License: Apache-2.0 Imports: 22 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewConsoleService

func NewConsoleService(stdout io.Writer) *consoleService

Types

type BasicAuth

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

type Destination

type Destination struct {
	Service   string `json:"service"`
	Recipient string `json:"recipient"`
}

Destination holds notification destination details

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

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

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

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"`
}

func (*Notification) Preview

func (n *Notification) Preview() string

type NotificationService

type NotificationService interface {
	Send(notification Notification, dest Destination) error
}

NotificationService defines notification service interface

func NewEmailService

func NewEmailService(opts EmailOptions) NotificationService

func NewGrafanaService

func NewGrafanaService(opts GrafanaOptions) NotificationService

func NewOpsgenieService

func NewOpsgenieService(opts OpsgenieOptions) NotificationService

func NewService

func NewService(serviceType string, optsData []byte) (NotificationService, error)

func NewSlackService

func NewSlackService(opts SlackOptions) NotificationService

func NewTelegramService

func NewTelegramService(opts TelegramOptions) NotificationService

func NewWebhookService

func NewWebhookService(opts WebhookOptions) NotificationService

type OpsgenieOptions

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

type SlackNotification

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"`
	ApiURL             string   `json:"apiURL"`
}

type TelegramOptions

type TelegramOptions struct {
	Token string `json:"token"`
}

type WebhookNotification

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

type WebhookOptions

type WebhookOptions struct {
	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