Documentation
¶
Index ¶
- type Channels
- type Client
- func (c *Client) GetTimeout() time.Duration
- func (c *Client) SendAlarm(ctx context.Context, title string, err error, details []Detail, links []Link) (*MessageRef, error)
- func (c *Client) SendInfo(ctx context.Context, title string, details []Detail, links []Link) (*MessageRef, error)
- func (c *Client) SendPublishLog(ctx context.Context, title string, details []Detail, links []Link) (*MessageRef, error)
- func (c *Client) SendWarning(ctx context.Context, title string, details []Detail, links []Link) (*MessageRef, error)
- func (c *Client) UpdateMessage(ctx context.Context, ref *MessageRef, title string, err error, ...) (*MessageRef, error)
- type Clienter
- type Colour
- type Detail
- type Emoji
- type Link
- type MessageRef
- type NoopClient
- func (n *NoopClient) GetTimeout() time.Duration
- func (n *NoopClient) SendAlarm(ctx context.Context, title string, err error, details []Detail, links []Link) (*MessageRef, error)
- func (n *NoopClient) SendInfo(ctx context.Context, title string, details []Detail, links []Link) (*MessageRef, error)
- func (n *NoopClient) SendPublishLog(ctx context.Context, title string, details []Detail, links []Link) (*MessageRef, error)
- func (n *NoopClient) SendWarning(ctx context.Context, title string, details []Detail, links []Link) (*MessageRef, error)
- func (n *NoopClient) UpdateMessage(ctx context.Context, ref *MessageRef, title string, err error, ...) (*MessageRef, error)
- type SlackConfig
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Channels ¶ added in v1.12.0
type Channels struct {
InfoChannel string `envconfig:"SLACK_INFO_CHANNEL"`
WarningChannel string `envconfig:"SLACK_WARNING_CHANNEL"`
AlarmChannel string `envconfig:"SLACK_ALARM_CHANNEL"`
PublishLogChannel string `envconfig:"SLACK_PUBLISH_LOG_CHANNEL"`
}
Channels holds the Slack channel names for different notification levels
type Client ¶ added in v1.12.0
type Client struct {
// contains filtered or unexported fields
}
Client is a wrapper around the go-slack client
func (*Client) GetTimeout ¶ added in v1.26.0
GetTimeout returns the timeout duration for Slack API requests.
func (*Client) SendAlarm ¶ added in v1.12.0
func (c *Client) SendAlarm(ctx context.Context, title string, err error, details []Detail, links []Link) (*MessageRef, error)
SendAlarm sends an error notification to the configured Slack alarm channel.
func (*Client) SendInfo ¶ added in v1.12.0
func (c *Client) SendInfo(ctx context.Context, title string, details []Detail, links []Link) (*MessageRef, error)
SendInfo sends an info notification to the configured Slack info channel.
func (*Client) SendPublishLog ¶ added in v1.20.0
func (c *Client) SendPublishLog(ctx context.Context, title string, details []Detail, links []Link) (*MessageRef, error)
SendPublishLog sends a publish log notification to the configured Slack publish log channel.
func (*Client) SendWarning ¶ added in v1.12.0
func (c *Client) SendWarning(ctx context.Context, title string, details []Detail, links []Link) (*MessageRef, error)
SendWarning sends a warning notification to the configured Slack warning channel.
func (*Client) UpdateMessage ¶ added in v1.27.0
func (c *Client) UpdateMessage(ctx context.Context, ref *MessageRef, title string, err error, details []Detail, links []Link, color Colour, emoji Emoji) (*MessageRef, error)
UpdateMessage updates a previously sent Slack message with the given title, error, details, links, color, and emoji.
type Clienter ¶ added in v1.12.0
type Clienter interface {
SendAlarm(ctx context.Context, title string, err error, details []Detail, links []Link) (*MessageRef, error)
SendWarning(ctx context.Context, title string, details []Detail, links []Link) (*MessageRef, error)
SendInfo(ctx context.Context, title string, details []Detail, links []Link) (*MessageRef, error)
SendPublishLog(ctx context.Context, title string, details []Detail, links []Link) (*MessageRef, error)
UpdateMessage(ctx context.Context, ref *MessageRef, title string, err error, details []Detail, links []Link, color Colour, emoji Emoji) (*MessageRef, error)
GetTimeout() time.Duration
}
Clienter represents an interface for a generic Client
type Detail ¶ added in v1.27.0
Detail represents a key-value pair to be included in the Slack message attachments.
type Emoji ¶ added in v1.12.0
type Emoji string
type Link ¶ added in v1.27.0
Link represents a hyperlink to be included in the Slack message attachments.
type MessageRef ¶ added in v1.20.0
MessageRef represents a reference to a Slack message. It contains the channel ID and timestamp of the message, which can be used for updating the message later.
type NoopClient ¶ added in v1.12.0
type NoopClient struct{}
NoopClient is a Client that does nothing, used when Slack notifications are disabled
func (*NoopClient) GetTimeout ¶ added in v1.26.0
func (n *NoopClient) GetTimeout() time.Duration
func (*NoopClient) SendAlarm ¶ added in v1.12.0
func (n *NoopClient) SendAlarm(ctx context.Context, title string, err error, details []Detail, links []Link) (*MessageRef, error)
func (*NoopClient) SendInfo ¶ added in v1.12.0
func (n *NoopClient) SendInfo(ctx context.Context, title string, details []Detail, links []Link) (*MessageRef, error)
func (*NoopClient) SendPublishLog ¶ added in v1.20.0
func (n *NoopClient) SendPublishLog(ctx context.Context, title string, details []Detail, links []Link) (*MessageRef, error)
func (*NoopClient) SendWarning ¶ added in v1.12.0
func (n *NoopClient) SendWarning(ctx context.Context, title string, details []Detail, links []Link) (*MessageRef, error)
func (*NoopClient) UpdateMessage ¶ added in v1.27.0
func (n *NoopClient) UpdateMessage(ctx context.Context, ref *MessageRef, title string, err error, details []Detail, links []Link, color Colour, emoji Emoji) (*MessageRef, error)
type SlackConfig ¶
SlackConfig holds configuration for sending Slack notifications