triggers

package
v0.7.2 Latest Latest
Warning

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

Go to latest
Published: May 27, 2024 License: MIT Imports: 34 Imported by: 0

Documentation

Overview

Pcakage triggers provides a simple interface to setup all sub-module triggers. Adding a new trigger here should be two new lines of code and a new import.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Actions

type Actions struct {
	Timers *common.Config
	// Order is important here.
	PlexCron   *plexcron.Action
	Backups    *backups.Action
	CFSync     *cfsync.Action
	CronTimer  *crontimer.Action
	Dashboard  *dashboard.Action
	FileWatch  *filewatch.Action
	Gaps       *gaps.Action
	SnapCron   *snapcron.Action
	StarrQueue *starrqueue.Action
	Commands   *commands.Action
	EmptyTrash *emptytrash.Action
	MDbList    *mdblist.Action
	FileUpload *fileupload.Action
}

Actions defines all our triggers and timers. Any action here will automatically have its interface methods called.

func New

func New(config *Config) *Actions

New turns a populated Config into a pile of Actions.

func (*Actions) APIHandler added in v0.4.1

func (a *Actions) APIHandler(req *http.Request) (int, interface{})

APIHandler is passed into the webserver so triggers can be executed from the API.

func (*Actions) HandleGetTriggers added in v0.5.0

func (a *Actions) HandleGetTriggers(_ *http.Request) (int, interface{})

@Description Returns a list of triggers and website timers with their intervals, if configured. @Summary Get trigger list @Tags Triggers @Produce json @Success 200 {object} apps.Respond.apiResponse{message=triggers.triggerOutput} "lists of triggers and timers" @Failure 404 {object} string "bad token or api key" @Router /api/triggers [get] @Security ApiKeyAuth

func (*Actions) Handler added in v0.4.1

func (a *Actions) Handler(response http.ResponseWriter, req *http.Request)

Handler handles GUI (non-API) trigger requests.

func (*Actions) Start

func (a *Actions) Start(ctx context.Context, reloadCh chan os.Signal)

Start creates all the triggers and runs the timers.

func (*Actions) Stop

func (a *Actions) Stop(event website.EventType)

Stop all internal cron timers and Triggers.

type Config

type Config struct {
	Apps       *apps.Apps
	Website    *website.Server
	Snapshot   *snapshot.Config
	WatchFiles []*filewatch.WatchFile
	LogFiles   []string
	Commands   []*commands.Command
	CIC        *clientinfo.Config
	common.Services
	*logs.Logger
}

Config is the required input data. Everything is mandatory.

Directories

Path Synopsis
package commands provides the interfaces and structures to trigger and run shell commands.
package commands provides the interfaces and structures to trigger and run shell commands.
cmdconfig
cmdconfig contains the input config for commands.
cmdconfig contains the input config for commands.

Jump to

Keyboard shortcuts

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