targets

package
v0.22.2 Latest Latest
Warning

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

Go to latest
Published: Jan 30, 2026 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type EmailMessage

type EmailMessage struct {
	From    string
	To      []string
	Cc      []string
	Bcc     []string
	Subject string
	Body    string
	IsHTML  bool
}

EmailMessage represents a single email payload.

type EmailTarget

type EmailTarget struct {
	Host               string
	Port               int
	User               string
	Pass               string
	From               string
	To                 []string
	StartTLS           bool
	SSL                bool
	InsecureSkipVerify bool
	Template           *templates.StringTemplate
	TitleTmpl          *templates.StringTemplate
	Receiver           string
	Vars               map[string]any
}

EmailTarget delivers notifications via SMTP.

func NewEmailTarget

func NewEmailTarget(cfg EmailTarget) *EmailTarget

NewEmailTarget constructs an email target.

func (*EmailTarget) Send

func (e *EmailTarget) Send(n types.Payload) error

Send renders and sends an email notification.

func (*EmailTarget) Type

func (e *EmailTarget) Type() string

Type returns the target type name.

type WebhookTarget

type WebhookTarget struct {
	URL       string
	Headers   map[string]string
	Template  *templates.Template
	TitleTmpl *templates.StringTemplate
	Client    *http.Client
	Logger    *slog.Logger
	Receiver  string
	Vars      map[string]any
}

WebhookTarget delivers notifications to a webhook endpoint.

func NewWebhookTarget

func NewWebhookTarget(
	receiver string,
	url string,
	headers map[string]string,
	tmpl *templates.Template,
	titleTmpl *templates.StringTemplate,
	vars map[string]any,
	logger *slog.Logger,
) *WebhookTarget

NewWebhookTarget constructs a webhook target.

func (*WebhookTarget) Send

func (w *WebhookTarget) Send(n types.Payload) error

Send renders and posts a webhook notification.

func (*WebhookTarget) SendResult

func (w *WebhookTarget) SendResult(n types.Payload) (types.DeliveryResult, error)

SendResult renders and posts a webhook notification and returns response details.

func (*WebhookTarget) Type

func (w *WebhookTarget) Type() string

Type returns the target type name.

Jump to

Keyboard shortcuts

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