notifications

package
v94.0.0+incompatible Latest Latest
Warning

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

Go to latest
Published: Sep 29, 2017 License: Apache-2.0 Imports: 20 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(ctx context.Context, logger lager.Logger, isPrivate bool, 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 HTTPClient

type HTTPClient interface {
	Do(r *http.Request) (*http.Response, error)
}

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(context.Context, lager.Logger, Envelope) error
}

func NewSlackNotifier

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

type RolodexClient

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

type Router

type Router interface {
	Deliver(ctx context.Context, 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, defaultPublicChannel, defaultPrivateChannel string, mapping map[string]string) TeamURLs

func (TeamURLs) Default

func (t TeamURLs) Default(isPrivate bool) Address

TODO add isPrivate

func (TeamURLs) Lookup

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

type Whitelist

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

Directories

Path Synopsis
Code generated by counterfeiter.
Code generated by counterfeiter.

Jump to

Keyboard shortcuts

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