mqtt

package
v0.0.0-...-8f8949c Latest Latest
Warning

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

Go to latest
Published: Feb 11, 2025 License: AGPL-3.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

View Source
const (
	MessageFormatJSON string = "json"
	MessageFormatText string = "text"
)
View Source
const FullValidConfigForTesting = `` /* 412-byte string literal not displayed */

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

View Source
const FullValidSecretsForTesting = `{
	"password": "test-password"
}`

FullValidSecretsForTesting is a string representation of JSON object that contains all fields that can be overridden from secrets

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	BrokerURL     string                   `json:"brokerUrl,omitempty" yaml:"brokerUrl,omitempty"`
	ClientID      string                   `json:"clientId,omitempty" yaml:"clientId,omitempty"`
	Topic         string                   `json:"topic,omitempty" yaml:"topic,omitempty"`
	Message       string                   `json:"message,omitempty" yaml:"message,omitempty"`
	MessageFormat string                   `json:"messageFormat,omitempty" yaml:"messageFormat,omitempty"`
	Username      string                   `json:"username,omitempty" yaml:"username,omitempty"`
	Password      string                   `json:"password,omitempty" yaml:"password,omitempty"`
	QoS           receivers.OptionalNumber `json:"qos,omitempty" yaml:"qos,omitempty"`
	Retain        bool                     `json:"retain,omitempty" yaml:"retain,omitempty"`
	TLSConfig     *receivers.TLSConfig     `json:"tlsConfig,omitempty" yaml:"tlsConfig,omitempty"`
}

func NewConfig

func NewConfig(jsonData json.RawMessage, decryptFn receivers.DecryptFunc) (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, logger logging.Logger, cli client) *Notifier

func (*Notifier) Notify

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

func (*Notifier) SendResolved

func (n *Notifier) SendResolved() bool

Jump to

Keyboard shortcuts

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