Documentation
¶
Overview ¶
Package notifiers formats and sends Slack notifications.
Index ¶
- func Escape(s string) string
- type Options
- type SlackChannels
- type SlackMessages
- type SlackNotifier
- func (s *SlackNotifier) NotifyOktaSync(ctx context.Context, reports []*domain.SyncReport, githubOrg string) error
- func (s *SlackNotifier) NotifyOrphanedUsers(ctx context.Context, report *domain.OrphanedUsersReport) error
- func (s *SlackNotifier) NotifyPRBypass(ctx context.Context, result *domain.PRComplianceResult, repoFullName string) error
- func (s *SlackNotifier) NotifySecurityAlerts(ctx context.Context, report *domain.SecurityAlertsReport, githubOrg string) error
- func (s *SlackNotifier) ReplyToCommand(ctx context.Context, responseURL, text string) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Options ¶ added in v1.0.0
type Options struct {
Token string
Channels SlackChannels
Messages SlackMessages
// APIURL overrides the Slack API URL, for tests.
APIURL string
// GitHubWebURL is the web URL of GitHub links, such as
// https://github.com or a GitHub Enterprise Server URL.
GitHubWebURL string
HTTPClient *http.Client
}
Options configures a SlackNotifier.
type SlackChannels ¶ added in v0.16.0
type SlackChannels struct {
Default string
PRBypass string
OktaSync string
OrphanedUsers string
SecurityAlerts string
}
SlackChannels holds channel IDs for different notification types. Empty values fall back to the default channel.
type SlackMessages ¶ added in v0.19.0
type SlackMessages struct {
// sent as is.
PRBypassFooterNote string
}
SlackMessages holds optional custom text for notifications. Empty values are left out.
type SlackNotifier ¶
type SlackNotifier struct {
// contains filtered or unexported fields
}
SlackNotifier sends formatted messages to Slack channels.
func (*SlackNotifier) NotifyOktaSync ¶
func (s *SlackNotifier) NotifyOktaSync(ctx context.Context, reports []*domain.SyncReport, githubOrg string) error
NotifyOktaSync sends a Slack notification with Okta sync results.
func (*SlackNotifier) NotifyOrphanedUsers ¶
func (s *SlackNotifier) NotifyOrphanedUsers(ctx context.Context, report *domain.OrphanedUsersReport) error
NotifyOrphanedUsers sends a Slack notification about organization members not in any synced teams.
func (*SlackNotifier) NotifyPRBypass ¶
func (s *SlackNotifier) NotifyPRBypass(ctx context.Context, result *domain.PRComplianceResult, repoFullName string) error
NotifyPRBypass sends a Slack notification when a PR was merged without meeting its branch's requirements.
func (*SlackNotifier) NotifySecurityAlerts ¶ added in v0.22.0
func (s *SlackNotifier) NotifySecurityAlerts(ctx context.Context, report *domain.SecurityAlertsReport, githubOrg string) error
NotifySecurityAlerts sends a Slack notification summarizing stale open security alerts across the organization.
func (*SlackNotifier) ReplyToCommand ¶ added in v1.1.0
func (s *SlackNotifier) ReplyToCommand(ctx context.Context, responseURL, text string) error
ReplyToCommand answers a slash command through its response URL, which must be a Slack URL, so a forged job cannot make the app send requests elsewhere.