slack

package
v0.1.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 29, 2022 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

type Client struct {
	// contains filtered or unexported fields
}

Client wraps slack with simpler more specific calls suited for this lambda

func New

func New(slackAPIToken string, opts ...ClientOptions) (*Client, error)

New returns a newly initialized slack client

func (*Client) CWAlarmHeaderBlock

func (c *Client) CWAlarmHeaderBlock(evt *cw.EventDetails, prefix string) *slackapi.SectionBlock

CWAlarmHeaderBlock produces a slack block for the alarm details - regardless of state

func (c *Client) CWAlarmLink(evt *cw.EventDetails) *slackapi.SectionBlock

CWAlarmLink adds a link to the cloudwatch console to the slack message

func (*Client) CWAlarmSummary

func (c *Client) CWAlarmSummary(evt *cw.EventDetails) *slackapi.SectionBlock

CWAlarmSummary returns a slack block with the cloudwatch alarm summary (ie: metrics, reason, etc)

func (c *Client) ImageLink(url string) *slackapi.ImageBlock

ImageLink adds an image ref to the given url

func (*Client) SendEventResolved

func (c *Client) SendEventResolved(slackChannel string, evt *cw.EventDetails, imageLink string) (string, string, error)

SendEventResolved will send a resolved message given the event details

func (*Client) SendEventTriggered

func (c *Client) SendEventTriggered(slackChannel string, evt *cw.EventDetails, imageLink string) (string, string, error)

SendEventTriggered will send a triggered message given the event details

func (*Client) SendMessage

func (c *Client) SendMessage(channel string, opts ...slackapi.MsgOption) (string, string, error)

SendMessage sends a message to a slack channel

func (*Client) SendSimpleTextMessage

func (c *Client) SendSimpleTextMessage(channel string, message string) (string, string, error)

SendSimpleTextMessage sends a message to a slack channel

type ClientOptions

type ClientOptions func(*Client)

ClientOptions provides the function opts pattern for overriding

func OptionDebug

func OptionDebug(d bool) ClientOptions

OptionDebug allows enabling/disabling debug

func WithAlternativeURL

func WithAlternativeURL(url string) ClientOptions

WithAlternativeURL supplies an alternative URL to make slack api calls

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL