notifier

package
v0.15.1 Latest Latest
Warning

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

Go to latest
Published: Aug 5, 2021 License: Apache-2.0 Imports: 30 Imported by: 0

Documentation

Index

Constants

View Source
const NotificationHeader = "gotk-component"

NotificationHeader is a header sent to identify requests from the notification controller.

Variables

This section is empty.

Functions

This section is empty.

Types

type AzureDevOps added in v0.4.0

type AzureDevOps struct {
	Project string
	Repo    string
	Client  git.Client
}

AzureDevOps is a Azure DevOps notifier.

func NewAzureDevOps added in v0.4.0

func NewAzureDevOps(addr string, token string, certPool *x509.CertPool) (*AzureDevOps, error)

NewAzureDevOps creates and returns a new AzureDevOps notifier.

func (AzureDevOps) Post added in v0.4.0

func (a AzureDevOps) Post(event events.Event) error

Post Azure DevOps commit status

type AzureEventHub added in v0.14.0

type AzureEventHub struct {
	Hub *eventhub.Hub
}

AzureEventHub holds the eventhub client

func NewAzureEventHub added in v0.14.0

func NewAzureEventHub(endpointURL, token, eventHubNamespace string) (*AzureEventHub, error)

NewAzureEventHub creates a eventhub client

func (*AzureEventHub) Post added in v0.14.0

func (e *AzureEventHub) Post(event events.Event) error

Post all notification-controller messages to EventHub

type Bitbucket added in v0.2.1

type Bitbucket struct {
	Owner  string
	Repo   string
	Client *bitbucket.Client
}

Bitbucket is a Bitbucket Server notifier.

func NewBitbucket added in v0.2.1

func NewBitbucket(addr string, token string, certPool *x509.CertPool) (*Bitbucket, error)

NewBitbucket creates and returns a new Bitbucket notifier.

func (Bitbucket) Post added in v0.2.1

func (b Bitbucket) Post(event events.Event) error

Post Bitbucket commit status

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(event events.Event) error

Post Discord message

type Factory

type Factory struct {
	URL      string
	ProxyURL string
	Username string
	Channel  string
	Token    string
	CertPool *x509.CertPool
}

func NewFactory

func NewFactory(url string, proxy string, username string, channel string, token string, certPool *x509.CertPool) *Factory

func (Factory) Notifier

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

type Forwarder

type Forwarder struct {
	URL      string
	ProxyURL string
	CertPool *x509.CertPool
}

Forwarder is an implementation of the notification Interface that posts the body as an HTTP request using an optional proxy.

func NewForwarder

func NewForwarder(hookURL string, proxyURL string, certPool *x509.CertPool) (*Forwarder, error)

func (*Forwarder) Post

func (f *Forwarder) Post(event events.Event) error

type GitHub added in v0.0.8

type GitHub struct {
	Owner  string
	Repo   string
	Client *github.Client
}

func NewGitHub added in v0.0.8

func NewGitHub(addr string, token string, certPool *x509.CertPool) (*GitHub, error)

func (*GitHub) Post added in v0.0.8

func (g *GitHub) Post(event events.Event) error

Post Github commit status

type GitLab added in v0.0.11

type GitLab struct {
	Id     string
	Client *gitlab.Client
}

func NewGitLab added in v0.0.11

func NewGitLab(addr string, token string, certPool *x509.CertPool) (*GitLab, error)

func (*GitLab) Post added in v0.0.11

func (g *GitLab) Post(event events.Event) error

Post GitLab commit status

type GoogleChat added in v0.10.0

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

Slack holds the hook URL

func NewGoogleChat added in v0.10.0

func NewGoogleChat(hookURL string, proxyURL string) (*GoogleChat, error)

NewGoogleChat validates the Google Chat URL and returns a GoogleChat object

func (*GoogleChat) Post added in v0.10.0

func (s *GoogleChat) Post(event events.Event) error

Post Google Chat message

type GoogleChatCard added in v0.10.0

type GoogleChatCard struct {
	Header   GoogleChatCardHeader    `json:"header"`
	Sections []GoogleChatCardSection `json:"sections"`
}

type GoogleChatCardHeader added in v0.10.0

type GoogleChatCardHeader struct {
	Title      string  `json:"title"`
	SubTitle   string  `json:"subtitle"`
	ImageUrl   *string `json:"imageUrl"`
	ImageStyle *string `json:"imageStyle"`
}

type GoogleChatCardSection added in v0.10.0

type GoogleChatCardSection struct {
	Header  string                 `json:"header"`
	Widgets []GoogleChatCardWidget `json:"widgets"`
}

type GoogleChatCardWidget added in v0.10.0

type GoogleChatCardWidget struct {
	TextParagraph *GoogleChatCardWidgetTextParagraph `json:"textParagraph"`
	KeyValue      *GoogleChatCardWidgetKeyValue      `json:"keyValue"`
}

type GoogleChatCardWidgetKeyValue added in v0.10.0

type GoogleChatCardWidgetKeyValue struct {
	TopLabel         string  `json:"topLabel"`
	Content          string  `json:"content"`
	ContentMultiLine bool    `json:"contentMultiline"`
	BottomLabel      *string `json:"bottomLabel"`
	Icon             *string `json:"icon"`
}

type GoogleChatCardWidgetTextParagraph added in v0.10.0

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

type GoogleChatPayload added in v0.10.0

type GoogleChatPayload struct {
	Cards []GoogleChatCard `json:"cards"`
}

GoogleChatPayload holds the channel and attachments

type Interface

type Interface interface {
	Post(event events.Event) 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(event events.Event) 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(event events.Event) error

type PureJWT added in v0.14.0

type PureJWT struct {
	// contains filtered or unexported fields
}

PureJWT just contains the jwt

func NewJWTProvider added in v0.14.0

func NewJWTProvider(jwt string) *PureJWT

NewJWTProvider create a pureJWT method

func (*PureJWT) GetToken added in v0.14.0

func (j *PureJWT) GetToken(uri string) (*auth.Token, error)

GetToken uses a JWT token, we assume that we will get new tokens when needed, thus no Expiry defined

type Rocket

type Rocket struct {
	URL      string
	ProxyURL string
	Username string
	Channel  string
	CertPool *x509.CertPool
}

Rocket holds the hook URL

func NewRocket

func NewRocket(hookURL string, proxyURL string, certPool *x509.CertPool, username string, channel string) (*Rocket, error)

NewRocket validates the Rocket URL and returns a Rocket object

func (*Rocket) Post

func (s *Rocket) Post(event events.Event) error

Post Rocket message

type Sentry added in v0.12.0

type Sentry struct {
	Client *sentry.Client
}

Sentry holds the client instance

func NewSentry added in v0.12.0

func NewSentry(certPool *x509.CertPool, dsn string, environment string) (*Sentry, error)

NewSentry creates a Sentry client from the provided Data Source Name (DSN)

func (*Sentry) Post added in v0.12.0

func (s *Sentry) Post(event events.Event) error

Post event to Sentry

type Slack

type Slack struct {
	URL      string
	ProxyURL string
	Username string
	Channel  string
	CertPool *x509.CertPool
}

Slack holds the hook URL

func NewSlack

func NewSlack(hookURL string, proxyURL string, certPool *x509.CertPool, username string, channel string) (*Slack, error)

NewSlack validates the Slack URL and returns a Slack object

func (*Slack) Post

func (s *Slack) Post(event events.Event) 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

type Webex added in v0.11.0

type Webex struct {
	URL      string
	ProxyURL string
	CertPool *x509.CertPool
}

Webex holds the hook URL

func NewWebex added in v0.11.0

func NewWebex(hookURL, proxyURL string, certPool *x509.CertPool) (*Webex, error)

NewWebex validates the Webex URL and returns a Webex object

func (*Webex) Post added in v0.11.0

func (s *Webex) Post(event events.Event) error

Post Webex message

type WebexPayload added in v0.11.0

type WebexPayload struct {
	Text     string `json:"text,omitempty"`
	Markdown string `json:"markdown,omitempty"`
}

WebexPayload holds the message text

Jump to

Keyboard shortcuts

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