notifications

package
v51.0.0+incompatible Latest Latest
Warning

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

Go to latest
Published: Feb 22, 2017 License: Apache-2.0 Imports: 18 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BuildWhitelist

func BuildWhitelist(regexs ...string) *whitelist

Types

type Address

type Address struct {
	URL     string
	Channel string
}

type AddressBook

type AddressBook interface {
	AddressForRepo(logger lager.Logger, owner, name string) []Address
}

func NewRolodex

func NewRolodex(client RolodexClient, teamURLs TeamURLs) AddressBook

func NewSimpleAddressBook

func NewSimpleAddressBook(url, channel string) AddressBook

type Envelope

type Envelope struct {
	Address  Address
	Contents []Notification
}

func (Envelope) Size

func (e Envelope) Size() int

type Notification

type Notification struct {
	Owner      string
	Repository string
	Private    bool

	Branch string
	SHA    string

	Path       string
	LineNumber int
}

func (Notification) FullName

func (n Notification) FullName() string

func (Notification) ShortSHA

func (n Notification) ShortSHA() string

type Notifier

type Notifier interface {
	Send(lager.Logger, Envelope) error
}

func NewSlackNotifier

func NewSlackNotifier(clock clock.Clock, formatter SlackNotificationFormatter) Notifier

type RolodexClient

type RolodexClient interface {
	GetOwners(ctx context.Context, in *rolodexpb.GetOwnersRequest, opts ...grpc.CallOption) (*rolodexpb.GetOwnersResponse, error)
}

type Router

type Router interface {
	Deliver(logger lager.Logger, batch []Notification) error
}

func NewRouter

func NewRouter(notifier Notifier, addressBook AddressBook, whitelist Whitelist) Router

type SlackAttachment

type SlackAttachment struct {
	Fallback string `json:"fallback"`
	Color    string `json:"color"`
	Title    string `json:"title"`
	Text     string `json:"text"`
}

type SlackMessage

type SlackMessage struct {
	Channel     string            `json:"channel,omitempty"`
	Attachments []SlackAttachment `json:"attachments"`
}

type SlackNotificationFormatter

type SlackNotificationFormatter interface {
	FormatNotifications(batch []Notification) []SlackMessage
}

func NewSlackNotificationFormatter

func NewSlackNotificationFormatter() SlackNotificationFormatter

type TeamURLs

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

func NewTeamURLs

func NewTeamURLs(defaultURL string, defaultChannel string, mapping map[string]string) TeamURLs

func (TeamURLs) Default

func (t TeamURLs) Default() Address

func (TeamURLs) Lookup

func (t TeamURLs) Lookup(logger lager.Logger, teamName string, channelName string) Address

type Whitelist

type Whitelist interface {
	ShouldSkipNotification(bool, string) bool
}

Directories

Path Synopsis
This file was generated by counterfeiter This file was generated by counterfeiter This file was generated by counterfeiter This file was generated by counterfeiter This file was generated by counterfeiter This file was generated by counterfeiter
This file was generated by counterfeiter This file was generated by counterfeiter This file was generated by counterfeiter This file was generated by counterfeiter This file was generated by counterfeiter This file was generated by counterfeiter

Jump to

Keyboard shortcuts

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