Documentation
¶
Index ¶
Constants ¶
View Source
const DefaultHTTPTimeout = 10 * time.Second
DefaultHTTPTimeout is the timeout for webhook and Slack HTTP requests.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ConsoleNotifier ¶
type ConsoleNotifier struct {
Filter string
}
ConsoleNotifier prints events to stdout.
func (*ConsoleNotifier) Notify ¶
func (c *ConsoleNotifier) Notify(event Event) error
type Dispatcher ¶
type Dispatcher struct {
// contains filtered or unexported fields
}
Dispatcher fans out events to multiple notifiers.
func NewDispatcher ¶
func NewDispatcher(cfg policy.NotificationCfg) *Dispatcher
NewDispatcher builds a dispatcher from the policy notification config.
func (*Dispatcher) Send ¶
func (d *Dispatcher) Send(event Event)
Send dispatches an event to all matching notifiers. Errors are logged but do not stop delivery to other notifiers.
type Event ¶
type Event struct {
Type string `json:"type"` // "approval_required", "denied", "allowed"
Timestamp time.Time `json:"timestamp"`
Request policy.ActionRequest `json:"request"`
Result policy.CheckResult `json:"result"`
// ApprovalURL is set when Type == "approval_required".
ApprovalURL string `json:"approval_url,omitempty"`
}
Event describes something that happened in the system.
type LogNotifier ¶
LogNotifier logs events via the standard logger.
func (*LogNotifier) Notify ¶
func (l *LogNotifier) Notify(event Event) error
type SlackNotifier ¶
type SlackNotifier struct {
WebhookURL string
Filter string
// contains filtered or unexported fields
}
SlackNotifier posts a formatted message to a Slack incoming webhook.
func (*SlackNotifier) Notify ¶
func (s *SlackNotifier) Notify(event Event) error
type WebhookNotifier ¶
type WebhookNotifier struct {
URL string
Filter string // only fire for this event type ("" = all)
// contains filtered or unexported fields
}
WebhookNotifier posts JSON to an arbitrary URL.
func (*WebhookNotifier) Notify ¶
func (w *WebhookNotifier) Notify(event Event) error
Click to show internal directories.
Click to hide internal directories.