Documentation ¶
Index ¶
- type ChatNotifierConfig
- type Config
- type EmailNotifierConfig
- type Filter
- type Message
- type MonorailNotifierConfig
- type Notifier
- func ChatNotifier(roomId string, configReader chatbot.ConfigReader) (Notifier, error)
- func EmailNotifier(emails []string, emailer emailclient.Client, markup string) (Notifier, error)
- func MonorailNotifier(c *http.Client, project, owner string, cc, components, labels []string) (Notifier, error)
- func PubSubNotifier(ctx context.Context, topic string) (Notifier, error)
- type PubSubNotifierConfig
- type Router
- func (r *Router) Add(n Notifier, f Filter, includeMsgTypes []string, singleThreadSubject string)
- func (r *Router) AddFromConfig(ctx context.Context, c *Config) error
- func (r *Router) AddFromConfigs(ctx context.Context, cfgs []*Config) error
- func (r *Router) Send(ctx context.Context, msg *Message) error
- type Severity
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ChatNotifierConfig ¶
type ChatNotifierConfig struct {
RoomID string `json:"room"`
}
Configuration for ChatNotifier.
func (*ChatNotifierConfig) Validate ¶
func (c *ChatNotifierConfig) Validate() error
Validate the ChatNotifierConfig.
type Config ¶
type Config struct { // Configuration for filtering out messages. Exactly one of these should // be specified. Filter string `json:"filter,omitempty"` IncludeMsgTypes []string `json:"includeMsgTypes,omitempty"` // Exactly one of these should be specified. Email *EmailNotifierConfig `json:"email,omitempty"` Chat *ChatNotifierConfig `json:"chat,omitempty"` Monorail *MonorailNotifierConfig `json:"monorail,omitempty"` PubSub *PubSubNotifierConfig `json:"pubsub,omitempty"` // If present, all messages inherit this subject line. Subject string `json:"subject,omitempty"` }
Config provides configuration for a Notifier.
type EmailNotifierConfig ¶
type EmailNotifierConfig struct { // List of email addresses to notify. Required. Emails []string `json:"emails"` }
Configuration for EmailNotifier.
func (*EmailNotifierConfig) Validate ¶
func (c *EmailNotifierConfig) Validate() error
Validate the EmailNotifierConfig.
type Message ¶
type Message struct { // Subject line of the message (required). This is ignored in favor of // the default in single-thread mode. Subject string // Body of the message (required). Body string // Severity of the message. May cause the message not to be sent, // depending on filter settings. Severity Severity // Type of message. This is used with the optional IncludeMsgTypes to // send only specific types of messages. Type string // ExtraRecipients who should also be sent this Message. Not supported for // all types of notification. ExtraRecipients []string }
Message represents a message to be sent through one or more Notifiers.
type MonorailNotifierConfig ¶
type MonorailNotifierConfig struct { // Project name under which to file bugs. Required. Project string `json:"project"` // Owner of bugs filed in Monorail. Required. Owner string `json:"owner"` // List of people to CC on bugs filed in Monorail. Optional. CC []string `json:"cc,omitempty"` // List of components to apply to the bugs. Optional. Components []string `json:"components,omitempty"` // List of labels to apply to bugs filed in Monorail. Optional. Labels []string `json:"labels,omitempty"` }
Configuration for a MonorailNotifier.
func (*MonorailNotifierConfig) Validate ¶
func (c *MonorailNotifierConfig) Validate() error
Validate the MonorailNotifierConfig.
type Notifier ¶
type Notifier interface { // Send the given message to the given thread. This should be safe to // run in a goroutine. Send(ctx context.Context, thread string, msg *Message) error }
Notifier is an interface used for sending notifications from an AutoRoller.
func ChatNotifier ¶
func ChatNotifier(roomId string, configReader chatbot.ConfigReader) (Notifier, error)
ChatNotifier returns a Notifier which sends email to interested parties.
func EmailNotifier ¶
EmailNotifier returns a Notifier which sends email to interested parties. Sends the same ViewAction markup with each message.
type PubSubNotifierConfig ¶
type PubSubNotifierConfig struct {
Topic string `json:"topic"`
}
Configuration for a PubSubNotifier.
func (*PubSubNotifierConfig) Validate ¶
func (c *PubSubNotifierConfig) Validate() error
Validate the PubSubNotifierConfig.
type Router ¶
type Router struct {
// contains filtered or unexported fields
}
Router is a struct used for sending notification through zero or more Notifiers.
func NewRouter ¶
func NewRouter(client *http.Client, emailer emailclient.Client, chatBotConfigReader chatbot.ConfigReader) *Router
Return a Router instance.
func (*Router) Add ¶
Add a new Notifier, which filters according to the given Filter. If singleThreadSubject is provided, that will be used as the subject for all Messages, ignoring their Subject field.
func (*Router) AddFromConfig ¶
Add a new Notifier based on the given Config.
func (*Router) AddFromConfigs ¶
Add all of the Notifiers specified by the given Configs.