Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Channels ¶
type Channels struct {
InfoChannel string `envconfig:"SLACK_INFO_CHANNEL"`
WarningChannel string `envconfig:"SLACK_WARNING_CHANNEL"`
AlarmChannel string `envconfig:"SLACK_ALARM_CHANNEL"`
}
Channels holds the Slack channel names for different notification levels
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client is a wrapper around the go-slack client that provides structured notification sending capabilities
func (*Client) SendAlarm ¶
func (c *Client) SendAlarm(ctx context.Context, summary string, err error, details SlackDetails) error
SendAlarm sends an error notification to the configured Slack alarm channel. The error will be included in the message fields if provided.
func (*Client) SendWarning ¶
SendWarning sends a warning notification to the configured Slack warning channel.
type Clienter ¶
type Clienter interface {
// SendAlarm sends a critical error notification to the alarm channel
SendAlarm(ctx context.Context, summary string, err error, details SlackDetails) error
// SendWarning sends a warning notification to the warning channel
SendWarning(ctx context.Context, summary string, details SlackDetails) error
// SendInfo sends an informational notification to the info channel
SendInfo(ctx context.Context, summary string, details SlackDetails) error
}
Clienter represents an interface for sending Slack notifications across different severity levels.
type Colour ¶
type Colour string
Colour represents a Slack attachment colour
Predefined colour constants matching Slack's attachment colour scheme
type Config ¶
type Config struct {
// Enabled determines whether Slack notifications are active
Enabled bool `envconfig:"SLACK_ENABLED" default:"false"`
// APIToken is the Slack bot token for authentication
APIToken string `envconfig:"SLACK_API_TOKEN"`
// Channels holds the Slack channel names for different notification levels
Channels Channels
}
Config holds configuration for sending Slack notifications
type Emoji ¶
type Emoji string
Emoji represents a Slack emoji code
type NoopClient ¶
type NoopClient struct{}
NoopClient is a Client that performs no operations. It is used when Slack notifications are disabled to avoid runtime overhead and maintain clean code paths without nil checks.
func (*NoopClient) SendAlarm ¶
func (n *NoopClient) SendAlarm(ctx context.Context, summary string, err error, details SlackDetails) error
SendAlarm is a no-op implementation
func (*NoopClient) SendInfo ¶
func (n *NoopClient) SendInfo(ctx context.Context, summary string, details SlackDetails) error
SendInfo is a no-op implementation
func (*NoopClient) SendWarning ¶
func (n *NoopClient) SendWarning(ctx context.Context, summary string, details SlackDetails) error
SendWarning is a no-op implementation
type SlackDetails ¶
type SlackDetails map[string]interface{}
SlackDetails is a map of key-value pairs containing details to include in Slack notifications.