notifier

package
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: Nov 26, 2020 License: Apache-2.0 Imports: 23 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
	Connection *azuredevops.Connection
}

AzureDevOps is a Azure DevOps notifier.

func NewAzureDevOps added in v0.4.0

func NewAzureDevOps(addr string, token string) (*AzureDevOps, error)

NewAzureDevOps creates and returns a new AzureDevOps notifier.

func (AzureDevOps) Post added in v0.4.0

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

Post Azure DevOps commit status

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) (*Bitbucket, error)

NewBitbucket creates and returns a new Bitbucket notifier.

func (Bitbucket) Post added in v0.2.1

func (b Bitbucket) Post(event recorder.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 recorder.Event) error

Post Discord message

type Factory

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

func NewFactory

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

func (Factory) Notifier

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

type Forwarder

type Forwarder struct {
	URL      string
	ProxyURL string
}

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) (*Forwarder, error)

func (*Forwarder) Post

func (f *Forwarder) Post(event recorder.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) (*GitHub, error)

func (*GitHub) Post added in v0.0.8

func (g *GitHub) Post(event recorder.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) (*GitLab, error)

func (*GitLab) Post added in v0.0.11

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

Post GitLab commit status

type Interface

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

Jump to

Keyboard shortcuts

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