teams

package
v1.7.3 Latest Latest
Warning

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

Go to latest
Published: Mar 22, 2024 License: MIT Imports: 11 Imported by: 5

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Card

type Card struct {
	CardType   string `json:"@type"`
	Context    string `json:"@context"`
	Title      string `json:"title"`
	Text       string `json:"text"`
	Summary    string `json:"summary"`
	ThemeColor string `json:"themeColor"`
}

Card is a Microsoft MessageCard structure. See https://docs.microsoft.com/en-us/outlook/actionable-messages/message-card-reference#card-fields.

type Config

type Config struct {
	// Whether Teams integration is enabled.
	Enabled bool `toml:"enabled" override:"enabled"`
	// The incoming (to Teams) channel webhook URL.
	ChannelURL string `toml:"channel-url" override:"channel-url"`
	// Whether all alerts should automatically post to Teams.
	Global bool `toml:"global" override:"global"`
	// Whether all alerts should automatically use stateChangesOnly mode.
	// Only applies if global is also set.
	StateChangesOnly bool `toml:"state-changes-only" override:"state-changes-only"`
}

func NewConfig

func NewConfig() Config

func (Config) Validate

func (c Config) Validate() error

type Diagnostic

type Diagnostic interface {
	WithContext(ctx ...keyvalue.T) Diagnostic
	Error(msg string, err error)
}

type HandlerConfig

type HandlerConfig struct {
	// Teams channel webhook URL used to post messages.
	// If empty uses the channel URL from the configuration.
	ChannelURL string `mapstructure:"channel-url"`
}

type Service

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

func NewService

func NewService(c Config, d Diagnostic) *Service

func (*Service) Alert

func (s *Service) Alert(channelURL, alertTopic, alertID, message string, level alert.Level) error

func (*Service) Close

func (s *Service) Close() error

func (*Service) Global

func (s *Service) Global() bool

func (*Service) Handler

func (s *Service) Handler(c HandlerConfig, ctx ...keyvalue.T) alert.Handler

func (*Service) Open

func (s *Service) Open() error

func (*Service) StateChangesOnly

func (s *Service) StateChangesOnly() bool

func (*Service) Test

func (s *Service) Test(options interface{}) error

func (*Service) TestOptions

func (s *Service) TestOptions() interface{}

func (*Service) Update

func (s *Service) Update(newConfig []interface{}) error

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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