middlewares

package
v0.2.3-0...-20df97a Latest Latest
Warning

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

Go to latest
Published: Mar 18, 2021 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func IsEmpty

func IsEmpty(i interface{}) bool

func NewMail

func NewMail(c *MailConfig) core.Middleware

NewMail returns a Mail middleware if the given configuration is not empty

func NewOverlap

func NewOverlap(c *OverlapConfig) core.Middleware

NewOverlap returns a Overlap middleware if the given configuration is not empty

func NewSave

func NewSave(c *SaveConfig) core.Middleware

NewSave returns a Save middleware if the given configuration is not empty

func NewSlack

func NewSlack(c *SlackConfig) core.Middleware

NewSlack returns a Slack middleware if the given configuration is not empty

Types

type Mail

type Mail struct {
	MailConfig
}

Mail middleware delivers a email just after an execution finishes

func (*Mail) ContinueOnStop

func (m *Mail) ContinueOnStop() bool

ContinueOnStop return allways true, we want always report the final status

func (*Mail) Run

func (m *Mail) Run(ctx *core.Context) error

Run sents a email with the result of the execution

type MailConfig

type MailConfig struct {
	SMTPHost        string `gcfg:"smtp-host" mapstructure:"smtp-host"`
	SMTPPort        int    `gcfg:"smtp-port" mapstructure:"smtp-port"`
	SMTPUser        string `gcfg:"smtp-user" mapstructure:"smtp-user"`
	SMTPPassword    string `gcfg:"smtp-password" mapstructure:"smtp-password"`
	EmailTo         string `gcfg:"email-to" mapstructure:"email-to"`
	EmailFrom       string `gcfg:"email-from" mapstructure:"email-from"`
	MailOnlyOnError bool   `gcfg:"mail-only-on-error" mapstructure:"mail-only-on-error"`
}

MailConfig configuration for the Mail middleware

type Overlap

type Overlap struct {
	OverlapConfig
}

Overlap when this middleware is enabled avoid to overlap executions from a specific job

func (*Overlap) ContinueOnStop

func (m *Overlap) ContinueOnStop() bool

ContinueOnStop Overlap is only called if the process is still running

func (*Overlap) Run

func (m *Overlap) Run(ctx *core.Context) error

Run stops the execution if the another execution is already running

type OverlapConfig

type OverlapConfig struct {
	NoOverlap bool `gcfg:"no-overlap" mapstructure:"no-overlap"`
}

OverlapConfig configuration for the Overlap middleware

type Save

type Save struct {
	SaveConfig
}

Save the save middleware saves to disk a dump of the stdout and stderr after every execution of the process

func (*Save) ContinueOnStop

func (m *Save) ContinueOnStop() bool

ContinueOnStop return allways true, we want always report the final status

func (*Save) Run

func (m *Save) Run(ctx *core.Context) error

Run save the result of the execution to disk

type SaveConfig

type SaveConfig struct {
	SaveFolder      string `gcfg:"save-folder" mapstructure:"save-folder"`
	SaveOnlyOnError bool   `gcfg:"save-only-on-error" mapstructure:"save-only-on-error"`
}

SaveConfig configuration for the Save middleware

type Slack

type Slack struct {
	SlackConfig
}

Slack middleware calls to a Slack input-hook after every execution of a job

func (*Slack) ContinueOnStop

func (m *Slack) ContinueOnStop() bool

ContinueOnStop return allways true, we want alloways report the final status

func (*Slack) Run

func (m *Slack) Run(ctx *core.Context) error

Run sends a message to the slack channel, its close stop the exection to collect the metrics

type SlackConfig

type SlackConfig struct {
	SlackWebhook     string `gcfg:"slack-webhook" mapstructure:"slack-webhook"`
	SlackOnlyOnError bool   `gcfg:"slack-only-on-error" mapstructure:"slack-only-on-error"`
}

SlackConfig configuration for the Slack middleware

Jump to

Keyboard shortcuts

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