slack

package
v0.0.0-...-6e30feb Latest Latest
Warning

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

Go to latest
Published: Jun 8, 2024 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const BatchSize = 5

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	WebhookURL string `json:"webhook_url" validate:"required,url" required:"true"`
	Channel    string `json:"channel" validate:"required,min=1" required:"true"`
}

type Payload

type Payload struct {
	Parse       string `json:"parse,omitempty"`
	Username    string `json:"username,omitempty"`
	IconURL     string `json:"icon_url,omitempty"`
	IconEmoji   string `json:"icon_emoji,omitempty"`
	Channel     string `json:"channel,omitempty"`
	Text        string `json:"text,omitempty"`
	LinkNames   string `json:"link_names,omitempty"`
	UnfurlLinks bool   `json:"unfurl_links,omitempty"`
	UnfurlMedia bool   `json:"unfurl_media,omitempty"`
	Markdown    bool   `json:"mrkdwn,omitempty"`
}

type Slack

type Slack struct {
	Config           Config                  `json:"config"`
	IntegrationType  string                  `json:"integration_type"`
	NotificationType string                  `json:"notification_type"`
	Filters          reporters.FieldsFilters `json:"filters"`
	Message          string                  `json:"message"`
	Resource         string                  `json:"resource"`
}

func New

func New(ctx context.Context, b []byte) (*Slack, error)

func (Slack) FormatMessage

func (s Slack) FormatMessage(message []map[string]interface{}, index int) []map[string]interface{}

func (Slack) IsValidCredential

func (s Slack) IsValidCredential(ctx context.Context) (bool, error)

func (Slack) SendNotification

func (s Slack) SendNotification(ctx context.Context, message string, extras map[string]interface{}) error

func (Slack) ValidateConfig

func (s Slack) ValidateConfig(validate *validator.Validate) error

Jump to

Keyboard shortcuts

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