teams

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Nov 10, 2023 License: AGPL-3.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ImageSizeSmall  = "small"
	ImageSizeMedium = "medium"
	ImageSizeLarge  = "large"

	TextColorDark      = "dark"
	TextColorLight     = "light"
	TextColorAccent    = "accent"
	TextColorGood      = "good"
	TextColorWarning   = "warning"
	TextColorAttention = "attention"

	TextSizeSmall      = "small"
	TextSizeMedium     = "medium"
	TextSizeLarge      = "large"
	TextSizeExtraLarge = "extraLarge"
	TextSizeDefault    = "default"

	TextWeightLighter = "lighter"
	TextWeightBolder  = "bolder"
	TextWeightDefault = "default"
)
View Source
const FullValidConfigForTesting = `{
	"url": "http://localhost",  
	"message" : "test-message",
	"title" : "test-title",
	"sectiontitle" : "test-second-title"
}`

FullValidConfigForTesting is a string representation of a JSON object that contains all fields supported by the notifier Config. It can be used without secrets.

Variables

This section is empty.

Functions

This section is empty.

Types

type AdaptiveCard

type AdaptiveCard struct {
	Body    []AdaptiveCardItem
	Schema  string
	Type    string
	Version string
}

AdaptiveCard repesents an Adaptive Card. https://adaptivecards.io/explorer/AdaptiveCard.html

func NewAdaptiveCard

func NewAdaptiveCard() AdaptiveCard

NewAdaptiveCard returns a prepared Adaptive Card.

func (*AdaptiveCard) AppendItem

func (c *AdaptiveCard) AppendItem(i AdaptiveCardItem)

AppendItem appends an item, such as text or an image, to the Adaptive Card.

func (*AdaptiveCard) MarshalJSON

func (c *AdaptiveCard) MarshalJSON() ([]byte, error)

type AdaptiveCardActionItem

type AdaptiveCardActionItem interface {
	MarshalJSON() ([]byte, error)
}

type AdaptiveCardActionSetItem

type AdaptiveCardActionSetItem struct {
	Actions []AdaptiveCardActionItem
}

AdaptiveCardActionSetItem is an ActionSet.

func (AdaptiveCardActionSetItem) MarshalJSON

func (i AdaptiveCardActionSetItem) MarshalJSON() ([]byte, error)

type AdaptiveCardImageItem

type AdaptiveCardImageItem struct {
	AltText string
	Size    string
	URL     string
}

AdaptiveCardImageItem is an Image.

func (AdaptiveCardImageItem) MarshalJSON

func (i AdaptiveCardImageItem) MarshalJSON() ([]byte, error)

type AdaptiveCardImageSetItem

type AdaptiveCardImageSetItem struct {
	Images []AdaptiveCardImageItem
	Size   string
}

AdaptiveCardImageSetItem is an ImageSet.

func (*AdaptiveCardImageSetItem) AppendImage

func (i *AdaptiveCardImageSetItem) AppendImage(image AdaptiveCardImageItem)

AppendImage appends an image to image set.

func (AdaptiveCardImageSetItem) MarshalJSON

func (i AdaptiveCardImageSetItem) MarshalJSON() ([]byte, error)

type AdaptiveCardItem

type AdaptiveCardItem interface {
	MarshalJSON() ([]byte, error)
}

AdaptiveCardItem is an interface for adaptive card items such as containers, elements and inputs.

type AdaptiveCardOpenURLActionItem

type AdaptiveCardOpenURLActionItem struct {
	IconURL string
	Title   string
	URL     string
}

AdaptiveCardOpenURLActionItem is an Action.OpenUrl action.

func (AdaptiveCardOpenURLActionItem) MarshalJSON

func (i AdaptiveCardOpenURLActionItem) MarshalJSON() ([]byte, error)

type AdaptiveCardTextBlockItem

type AdaptiveCardTextBlockItem struct {
	Color  string
	Size   string
	Text   string
	Weight string
	Wrap   bool
}

AdaptiveCardTextBlockItem is a TextBlock.

func (AdaptiveCardTextBlockItem) MarshalJSON

func (i AdaptiveCardTextBlockItem) MarshalJSON() ([]byte, error)

type AdaptiveCardsAttachment

type AdaptiveCardsAttachment struct {
	Content     AdaptiveCard `json:"content"`
	ContentType string       `json:"contentType"`
	ContentURL  string       `json:"contentUrl,omitempty"`
}

AdaptiveCardsAttachment contains an adaptive card.

type AdaptiveCardsMessage

type AdaptiveCardsMessage struct {
	Attachments []AdaptiveCardsAttachment `json:"attachments"`
	Summary     string                    `json:"summary,omitempty"` // Summary is the text shown in notifications
	Type        string                    `json:"type"`
}

AdaptiveCardsMessage represents a message for adaptive cards.

type Config

type Config struct {
	URL          string `json:"url,omitempty" yaml:"url,omitempty"`
	Message      string `json:"message,omitempty" yaml:"message,omitempty"`
	Title        string `json:"title,omitempty" yaml:"title,omitempty"`
	SectionTitle string `json:"sectiontitle,omitempty" yaml:"sectiontitle,omitempty"`
}

func NewConfig

func NewConfig(jsonData json.RawMessage) (Config, error)

type Notifier

type Notifier struct {
	*receivers.Base
	// contains filtered or unexported fields
}

func New

func New(cfg Config, meta receivers.Metadata, template *templates.Template, sender receivers.WebhookSender, images images.Provider, logger logging.Logger) *Notifier

func (*Notifier) Notify

func (tn *Notifier) Notify(ctx context.Context, as ...*types.Alert) (bool, error)

func (*Notifier) SendResolved

func (tn *Notifier) SendResolved() bool

Jump to

Keyboard shortcuts

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