bosun.org: bosun.org/cmd/bosun/sched/slack Index | Files

package slack

import "bosun.org/cmd/bosun/sched/slack"

Package slack is for creating slack notifications inside of Bosun templates

Index

Package Files

slack.go

func StatusColor Uses

func StatusColor(status models.Status) string

StatusColor returns a color string that corresponds to Slack's colors based on the Status.

type Action Uses

type Action struct {
    Type  string `json:"type"`
    Text  string `json:"text"`
    URL   string `json:"url"`
    Style string `json:"style,omitempty"`
}

Action is a struture for what slack expects as an item in the Actions slice of an Attachment.

type Attachment Uses

type Attachment struct {
    Color    string `json:"color,omitempty"`
    Fallback string `json:"fallback"`

    AuthorID      string `json:"author_id,omitempty"`
    AuthorName    string `json:"author_name,omitempty"`
    AuthorSubname string `json:"author_subname,omitempty"`
    AuthorLink    string `json:"author_link,omitempty"`
    AuthorIcon    string `json:"author_icon,omitempty"`

    Title     string `json:"title,omitempty"`
    TitleLink string `json:"title_link,omitempty"`
    Pretext   string `json:"pretext,omitempty"`
    Text      string `json:"text"`

    ImageURL string `json:"image_url,omitempty"`
    ThumbURL string `json:"thumb_url,omitempty"`

    Fields  []interface{} `json:"fields,omitempty"`
    Actions []interface{} `json:"actions,omitempty"`

    Footer     string `json:"footer,omitempty"`
    FooterIcon string `json:"footer_icon,omitempty"`

    Ts  int64 `json:"ts,omitempty"`
}

Attachment contains all the information for a slack message attachment and has methods to Set/Append fields.

func NewAttachment Uses

func NewAttachment(m *models.IncidentState) *Attachment

NewAttachment returns a Attachment structure with the color and Timestamp set from the IncidentState.

func (*Attachment) AddActions Uses

func (a *Attachment) AddActions(action ...interface{}) interface{}

AddActions appends an Action to the Actions field of the Attachment.

func (*Attachment) AddFields Uses

func (a *Attachment) AddFields(field ...interface{}) interface{}

AddFields appends a Field to the Fields field of the Attachment.

func (*Attachment) SetAuthorID Uses

func (a *Attachment) SetAuthorID(authorID string) interface{}

SetAuthorID sets the AuthorID field of the Attachment.

func (*Attachment) SetAuthorIcon Uses

func (a *Attachment) SetAuthorIcon(authorIcon string) interface{}

SetAuthorIcon sets the AuthorIcon field of the Attachment.

func (a *Attachment) SetAuthorLink(authorLink string) interface{}

SetAuthorLink sets the AuthorLink field of the Attachment.

func (*Attachment) SetAuthorName Uses

func (a *Attachment) SetAuthorName(authorName string) interface{}

SetAuthorName sets the AuthorName field of the Attachment.

func (*Attachment) SetAuthorSubname Uses

func (a *Attachment) SetAuthorSubname(authorSubname string) interface{}

SetAuthorSubname sets the AuthorSubname field of the Attachment.

func (*Attachment) SetColor Uses

func (a *Attachment) SetColor(color string) interface{}

SetColor appends an Action to the Actions field of the Attachment.

func (*Attachment) SetFallback Uses

func (a *Attachment) SetFallback(fallback string) interface{}

SetFallback sets the FallBack field of the Attachment.

func (*Attachment) SetFooter Uses

func (a *Attachment) SetFooter(footer string) interface{}

SetFooter sets the Footer field of the Attachment.

func (*Attachment) SetFooterIcon Uses

func (a *Attachment) SetFooterIcon(footerIcon string) interface{}

SetFooterIcon sets the FooterIcon field of the Attachment.

func (*Attachment) SetImageURL Uses

func (a *Attachment) SetImageURL(url string) interface{}

SetImageURL sets the ImageURL field of the Attachment.

func (*Attachment) SetPretext Uses

func (a *Attachment) SetPretext(pretext string) interface{}

SetPretext sets the Pretext field of the Attachment.

func (*Attachment) SetText Uses

func (a *Attachment) SetText(text string) interface{}

SetText sets the Text field of the Attachment.

func (*Attachment) SetThumbURL Uses

func (a *Attachment) SetThumbURL(url string) interface{}

SetThumbURL sets the ThumbURL field of the Attachment.

func (*Attachment) SetTitle Uses

func (a *Attachment) SetTitle(title string) interface{}

SetTitle sets the Title field of the Attachment.

func (a *Attachment) SetTitleLink(titleLink string) interface{}

SetTitleLink sets the TitleLink field of the Attachment.

func (*Attachment) SetTs Uses

func (a *Attachment) SetTs(ts int64) interface{}

SetTs sets the Ts field of the Attachment.

type Field Uses

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

Field is a structure for what slack expects as an item in the Fields slice of an Attachment.

Package slack imports 1 packages (graph) and is imported by 2 packages. Updated 2019-06-07. Refresh now. Tools for package owners.