services

package
v1.1.0 Latest Latest
Warning

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

Go to latest
Published: Apr 5, 2021 License: Apache-2.0 Imports: 29 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 EmailNotification

type EmailNotification struct {
	Subject string `json:"subject,omitempty"`
	Body    string `json:"body,omitempty"`
}

func (*EmailNotification) GetTemplater

func (n *EmailNotification) GetTemplater(name string, f texttemplate.FuncMap) (Templater, error)

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 GitHubNotification added in v1.1.0

type GitHubNotification struct {
	Status *GitHubStatus `json:"status,omitempty"`
	// contains filtered or unexported fields
}

func (*GitHubNotification) GetTemplater added in v1.1.0

func (g *GitHubNotification) GetTemplater(name string, f texttemplate.FuncMap) (Templater, error)

type GitHubOptions added in v1.1.0

type GitHubOptions struct {
	AppID             int64  `json:"appID"`
	InstallationID    int64  `json:"installationID"`
	PrivateKey        string `json:"privateKey"`
	EnterpriseBaseURL string `json:"enterpriseBaseURL"`
}

type GitHubStatus added in v1.1.0

type GitHubStatus struct {
	State     string `json:"state,omitempty"`
	Label     string `json:"label,omitempty"`
	TargetURL string `json:"targetURL,omitempty"`
}

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 MattermostNotification added in v1.1.0

type MattermostNotification struct {
	Attachments string `json:"attachments,omitempty"`
}

func (*MattermostNotification) GetTemplater added in v1.1.0

func (n *MattermostNotification) GetTemplater(name string, f texttemplate.FuncMap) (Templater, error)

type MattermostOptions added in v1.1.0

type MattermostOptions struct {
	ApiURL             string `json:"apiURL"`
	Token              string `json:"token"`
	InsecureSkipVerify bool   `json:"insecureSkipVerify"`
}

type Notification

type Notification struct {
	Message    string                  `json:"message,omitempty"`
	Email      *EmailNotification      `json:"email,omitempty"`
	Slack      *SlackNotification      `json:"slack,omitempty"`
	Mattermost *MattermostNotification `json:"mattermost,omitempty"`
	Teams      *TeamsNotification      `json:"teams,omitempty"`
	Webhook    WebhookNotifications    `json:"webhook,omitempty"`
	Opsgenie   *OpsgenieNotification   `json:"opsgenie,omitempty"`
	GitHub     *GitHubNotification     `json:"github,omitempty"`
}

func (*Notification) GetTemplater

func (n *Notification) GetTemplater(name string, f texttemplate.FuncMap) (Templater, error)

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 NewGitHubService added in v1.1.0

func NewGitHubService(opts GitHubOptions) (NotificationService, error)

func NewGrafanaService

func NewGrafanaService(opts GrafanaOptions) NotificationService

func NewMattermostService added in v1.1.0

func NewMattermostService(opts MattermostOptions) 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 NewTeamsService added in v1.1.0

func NewTeamsService(opts TeamsOptions) NotificationService

func NewTelegramService

func NewTelegramService(opts TelegramOptions) NotificationService

func NewWebhookService

func NewWebhookService(opts WebhookOptions) NotificationService

type OpsgenieNotification

type OpsgenieNotification struct {
	Description string `json:"description"`
}

func (*OpsgenieNotification) GetTemplater

func (n *OpsgenieNotification) GetTemplater(name string, f texttemplate.FuncMap) (Templater, error)

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

func (*SlackNotification) GetTemplater

func (n *SlackNotification) GetTemplater(name string, f texttemplate.FuncMap) (Templater, error)

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 TeamsNotification added in v1.1.0

type TeamsNotification struct {
	Template        string `json:"template,omitempty"`
	Title           string `json:"title,omitempty"`
	Text            string `json:"text,omitempty"`
	Facts           string `json:"facts,omitempty"`
	Sections        string `json:"sections,omitempty"`
	PotentialAction string `json:"potentialAction,omitempty"`
}

func (*TeamsNotification) GetTemplater added in v1.1.0

func (n *TeamsNotification) GetTemplater(name string, f texttemplate.FuncMap) (Templater, error)

type TeamsOptions added in v1.1.0

type TeamsOptions struct {
	RecipientUrls map[string]string `json:"recipientUrls"`
}

type TelegramOptions

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

type Templater

type Templater func(notification *Notification, vars map[string]interface{}) error

type TemplaterSource

type TemplaterSource interface {
	GetTemplater(name string, f texttemplate.FuncMap) (Templater, error)
}

type WebhookNotification

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

type WebhookNotifications

type WebhookNotifications map[string]WebhookNotification

func (WebhookNotifications) GetTemplater

func (n WebhookNotifications) GetTemplater(name string, f texttemplate.FuncMap) (Templater, error)

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