notify

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Oct 27, 2023 License: MIT Imports: 11 Imported by: 0

Documentation

Overview

Package notify providers error delivery via email

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Params added in v1.0.0

type Params struct {
	EnabledError       bool
	EnabledCompletion  bool
	ErrorTemplate      string
	CompletionTemplate string
}

Params which are used in all notify destinations

type SendersParams added in v1.0.0

type SendersParams struct {
	notify.SMTPParams
	FromEmail string
	ToEmails  []string

	SlackToken    string
	SlackChannels []string

	TelegramToken        string
	TelegramDestinations []string

	WebhookURLs []string
}

SendersParams contains params specific for notify destinations like email, slack, telegram or webhook

type Service added in v0.2.0

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

Service warps email client and template management

func NewService added in v0.2.0

func NewService(notifyParams Params, sendersParams SendersParams) *Service

NewService makes notification service with optional template files

func (*Service) IsOnCompletion added in v1.0.0

func (s *Service) IsOnCompletion() bool

IsOnCompletion status enabling on-passed notification

func (*Service) IsOnError added in v1.0.0

func (s *Service) IsOnError() bool

IsOnError status enabling on-error notification

func (*Service) MakeCompletionHTML added in v0.2.0

func (s *Service) MakeCompletionHTML(spec, command string) (string, error)

MakeCompletionHTML creates error html body from completionTemplate

func (*Service) MakeErrorHTML added in v0.2.0

func (s *Service) MakeErrorHTML(spec, command, errorLog string) (string, error)

MakeErrorHTML creates error html body from errorTemplate

func (*Service) Send added in v1.0.0

func (s *Service) Send(ctx context.Context, subj, text string) error

Send notification to all set up notification destinations

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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