notifydrivers

package
v0.3.10-0-alpha.1 Latest Latest
Warning

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

Go to latest
Published: Oct 28, 2022 License: Apache-2.0 Imports: 6 Imported by: 3

Documentation

Index

Constants

View Source
const (
	ErrUnsupportedNotificationType = errors.Error("Unsupported notification type")
)

Variables

This section is empty.

Functions

func RegisterNotifier

func RegisterNotifier(plugin *NotifierPlugin)

Types

type NotificationConfig

type NotificationConfig struct {
	Ctx                   context.Context
	Id                    string
	Name                  string
	Type                  string
	SendReminder          bool
	DisableResolveMessage bool
	Frequency             time.Duration
	Settings              jsonutils.JSONObject
}

type Notifier

type Notifier interface {
	GetType() string

	GetNotifierId() string
	// GetIsDefault() bool
	GetSendReminder() bool
	GetDisableResolveMessage() bool
	GetFrequency() time.Duration
}

Notifier is responsible for sending alert notifications.

func InitNotifier

func InitNotifier(config NotificationConfig) (Notifier, error)

InitNotifier instantiate a new notifier based on the model

type NotifierFactory

type NotifierFactory func(notification NotificationConfig) (Notifier, error)

type NotifierPlugin

type NotifierPlugin struct {
	Type               string
	Factory            NotifierFactory
	ValidateCreateData func(cred mcclient.IIdentityProvider, input monitor.NotificationCreateInput) (monitor.NotificationCreateInput, error)
}

func GetNotifiers

func GetNotifiers() []*NotifierPlugin

func GetPlugin

func GetPlugin(typ string) (*NotifierPlugin, error)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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