notifier

package
v0.0.0-...-662d0f3 Latest Latest
Warning

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

Go to latest
Published: Mar 25, 2019 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Slack

type Slack struct {
	URL       string
	Username  string
	Channel   string
	IconEmoji string
}

Slack holds the hook URL

func NewSlack

func NewSlack(hookURL string, username string, channel string) (*Slack, error)

NewSlack validates the Slack URL and returns a Slack object

func (*Slack) Post

func (s *Slack) Post(workload string, namespace string, message string, fields []SlackField, warn bool) error

Post Slack message

type SlackAttachment

type SlackAttachment struct {
	Color      string       `json:"color"`
	AuthorName string       `json:"author_name"`
	Text       string       `json:"text"`
	MrkdwnIn   []string     `json:"mrkdwn_in"`
	Fields     []SlackField `json:"fields"`
}

SlackAttachment holds the markdown message body

type SlackField

type SlackField struct {
	Title string `json:"title"`
	Value string `json:"value"`
	Short bool   `json:"short"`
}

type SlackPayload

type SlackPayload struct {
	Channel     string            `json:"channel"`
	Username    string            `json:"username"`
	IconUrl     string            `json:"icon_url"`
	IconEmoji   string            `json:"icon_emoji"`
	Text        string            `json:"text,omitempty"`
	Attachments []SlackAttachment `json:"attachments,omitempty"`
}

SlackPayload holds the channel and attachments

Jump to

Keyboard shortcuts

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