Documentation ¶
Index ¶
- type Config
- type Configs
- type Diagnostic
- type HandlerConfig
- type Service
- func (s *Service) Alert(workspace, message, username, avatarURL, embedTitle string, time time.Time, ...) error
- func (s *Service) Close() error
- func (s *Service) Global() bool
- func (s *Service) Handler(c HandlerConfig, ctx ...keyvalue.T) (alert.Handler, error)
- func (s *Service) Open() error
- func (s *Service) StateChangesOnly() bool
- func (s *Service) Test(options interface{}) error
- func (s *Service) TestOptions() interface{}
- func (s *Service) Update(newConfigs []interface{}) error
- type Workspace
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Config ¶
type Config struct { // Whether Discord integration is enabled Enabled bool `toml:"enabled" override:"enabled"` // Whether this is the default discord config. Default bool `toml:"default" override:"default"` // ID assigned if multiple discord configs are given Workspace string `toml:"workspace" override:"workspace"` // Discord channel webhook URL URL string `toml:"url" override:"url"` // Whether the timestamp is included in the embed Timestamp bool `toml:"timestamp" override:"timestamp"` // Username of webhook Username string `toml:"username" override:"username"` // Avatar URL AvatarURL string `toml:"avatar-url" override:"avatar-url"` // Embed Title EmbedTitle string `toml:"embed-title" override:"embed-title"` // Whether all alerts should automatically post to discord 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"` // Path to CA file SSLCA string `toml:"ssl-ca" override:"ssl-ca"` // Path to host cert file SSLCert string `toml:"ssl-cert" override:"ssl-cert"` // Path to cert key file SSLKey string `toml:"ssl-key" override:"ssl-key"` // Use SSL but skip chain & host verification InsecureSkipVerify bool `toml:"insecure-skip-verify" override:"insecure-skip-verify"` }
Config object for Discord alert handler
func NewDefaultConfig ¶
func NewDefaultConfig() Config
type Diagnostic ¶
type HandlerConfig ¶
type HandlerConfig struct { // Discord workspace ID to use when posting to webhook // If empty uses the default config Workspace string `mapstructure:"workspace"` // Username of webhook // If empty uses the default config Username string `mapstructure:"username"` // URL of webhook's avatar // If empty uses the default config AvatarURL string `mapstructure:"avatar-url"` // Embed title // If empty uses the default config EmbedTitle string `mapstructure:"embed-title"` }
type Service ¶
type Service struct {
// contains filtered or unexported fields
}
func NewService ¶
func NewService(confs []Config, d Diagnostic) (*Service, error)
func (*Service) Alert ¶
func (s *Service) Alert(workspace, message, username, avatarURL, embedTitle string, time time.Time, level alert.Level) error
Alert sends a message to the specified room.
func (*Service) StateChangesOnly ¶
func (*Service) TestOptions ¶
func (s *Service) TestOptions() interface{}
type Workspace ¶
type Workspace struct {
// contains filtered or unexported fields
}
func NewWorkspace ¶
Click to show internal directories.
Click to hide internal directories.