notifier

package
v1.8.0 Latest Latest
Warning

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

Go to latest
Published: Apr 29, 2021 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Discord

type Discord struct {
	URL      string
	ProxyURL string
	Username string
	Channel  string
}

Discord holds the hook URL

func NewDiscord

func NewDiscord(hookURL string, proxyURL string, username string, channel string) (*Discord, error)

NewDiscord validates the URL and returns a Discord object

func (*Discord) Post

func (s *Discord) Post(workload string, namespace string, message string, fields []Field, severity string) error

Post Discord message

type Factory

type Factory struct {
	URL      string
	ProxyURL string
	Username string
	Channel  string
}

func NewFactory

func NewFactory(url string, proxy string, username string, channel string) *Factory

func (Factory) Notifier

func (f Factory) Notifier(provider string) (Interface, error)

type Field

type Field struct {
	Name  string
	Value string
}

type Interface

type Interface interface {
	Post(workload string, namespace string, message string, fields []Field, severity string) error
}

type MSTeams

type MSTeams struct {
	URL      string
	ProxyURL string
}

MS Teams holds the incoming webhook URL

func NewMSTeams

func NewMSTeams(hookURL string, proxyURL string) (*MSTeams, error)

NewMSTeams validates the MS Teams URL and returns a MSTeams object

func (*MSTeams) Post

func (s *MSTeams) Post(workload string, namespace string, message string, fields []Field, severity string) error

Post MS Teams message

type MSTeamsField

type MSTeamsField struct {
	Name  string `json:"name"`
	Value string `json:"value"`
}

type MSTeamsPayload

type MSTeamsPayload struct {
	Type       string           `json:"@type"`
	Context    string           `json:"@context"`
	ThemeColor string           `json:"themeColor"`
	Summary    string           `json:"summary"`
	Sections   []MSTeamsSection `json:"sections"`
}

MSTeamsPayload holds the message card data

type MSTeamsSection

type MSTeamsSection struct {
	ActivityTitle    string         `json:"activityTitle"`
	ActivitySubtitle string         `json:"activitySubtitle"`
	Facts            []MSTeamsField `json:"facts"`
}

MSTeamsSection holds the canary analysis result

type NopNotifier

type NopNotifier struct{}

func (*NopNotifier) Post

func (n *NopNotifier) Post(string, string, string, []Field, string) error

type Rocket

type Rocket struct {
	URL      string
	ProxyURL string
	Username string
	Channel  string
}

Rocket holds the hook URL

func NewRocket

func NewRocket(hookURL string, proxyUrl string, username string, channel string) (*Rocket, error)

NewRocket validates the Rocket URL and returns a Rocket object

func (*Rocket) Post

func (s *Rocket) Post(workload string, namespace string, message string, fields []Field, severity string) error

Post Rocket message

type Slack

type Slack struct {
	URL      string
	ProxyURL string
	Username string
	Channel  string
}

Slack holds the hook URL

func NewSlack

func NewSlack(hookURL string, proxyURL string, username string, channel string) (*Slack, error)

NewSlack validates the Slack URL and returns a Slack object

func (*Slack) Post

func (s *Slack) Post(workload string, namespace string, message string, fields []Field, severity string) error

Post Slack message

type SlackAttachment

type SlackAttachment struct {
	Color      string       `json:"color"`
	AuthorName string       `json:"author_name"`
	Text       string       `json:"text"`
	MrkdwnIn   []string     `json:"mrkdwn_in"`
	Fields     []SlackField `json:"fields"`
}

SlackAttachment holds the markdown message body

type SlackField

type SlackField struct {
	Title string `json:"title"`
	Value string `json:"value"`
	Short bool   `json:"short"`
}

type SlackPayload

type SlackPayload struct {
	Channel     string            `json:"channel"`
	Username    string            `json:"username"`
	IconUrl     string            `json:"icon_url"`
	IconEmoji   string            `json:"icon_emoji"`
	Text        string            `json:"text,omitempty"`
	Attachments []SlackAttachment `json:"attachments,omitempty"`
}

SlackPayload holds the channel and attachments

Jump to

Keyboard shortcuts

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