notifier

package
v1.18.0 Latest Latest
Warning

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

Go to latest
Published: Feb 14, 2022 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 GChat added in v1.13.0

type GChat struct {
	URL      string
	ProxyURL string
}

Google Chat holds the incoming webhook URL

func NewGChat added in v1.13.0

func NewGChat(hookURL string, proxyURL string) (*GChat, error)

NewGChat validates the GChat URL and returns a GChat object

func (*GChat) Post added in v1.13.0

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

Post Google Chat message

type GChatCards added in v1.13.0

type GChatCards struct {
	Header   GChatHeader      `json:"header"`
	Sections []*GChatSections `json:"sections"`
}

Start - GChatCards holds the canary analysis result

type GChatField added in v1.13.0

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

type GChatHeader added in v1.13.0

type GChatHeader struct {
	Title    string `json:"title"`
	SubTitle string `json:"subtitle"`
	ImageUrl string `json:"imageUrl"`
}

type GChatPayload added in v1.13.0

type GChatPayload struct {
	Cards []GChatCards `json:"cards"`
}

GChatPayload holds the message

type GChatSections added in v1.13.0

type GChatSections struct {
	Widgets []GChatWidgets `json:"widgets"`
}

type GChatText added in v1.13.0

type GChatText struct {
	Text string `json:"text"`
}

type GChatWidgets added in v1.13.0

type GChatWidgets struct {
	TextParagraph GChatText `json:"textParagraph"`
}

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