job

package
v0.0.0-...-6290bb2 Latest Latest
Warning

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

Go to latest
Published: Dec 20, 2023 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Contains

func Contains(x int, arr []int) bool

Types

type Doer

type Doer interface {
	Schedule()
	Execute() ExecutionResult
	OnSuccess()
	OnError()
	OnUnidentified()
	Log()
}

type ExecutionResult

type ExecutionResult struct {
	Status         int       `json:"status"`
	Message        string    `json:"message"`
	ResponseTime   time.Time `json:"responseTime"`
	SchedulerError string    `json:"schedulerError"`
}

type Handlers

type Handlers struct {
	ExecuteFn   func(*Job) ExecutionResult
	OnErrorFn   func(*Job)
	OnSuccessFn func(*Job)
}

type Job

type Job struct {
	Id              uuid.UUID                `json:"id"`
	Name            string                   `json:"name"`
	CronExp         cronParser.CronExpresion `json:"-"`
	CronExpString   string                   `json:"cronexp"`
	LastExecution   time.Time                `json:"lastExecution"`
	ShouldExecuteAt time.Time                `json:"shouldExecuteAt"`
	LastResponseAt  time.Time                `json:"lastResponseAt"`
	LastMessage     string                   `json:"lastMessage"`
	LastStatusCode  int                      `json:"lastStatusCode"`
	MaxRetries      int                      `json:"maxRetries"`
	Endpoint        string                   `json:"endpoint"`
	HttpMethod      string                   `json:"httpmethod"`
	Headers         map[string]string        `json:"headers"`
	SuccessStatuses []int                    `json:"successStatuses"`
	Succeeded       string                   `json:"succeeded"`
	Status          string                   `json:"status"`
	ClaimedBy       string                   `json:"claimedBy"`
	CreatedAt       int                      `json:"createdAt"`
	AlertStrategy   string                   `json:"alertStrategy"`
	AlertMethod     string                   `json:"alertMethod"`
	AlertEndpoint   string                   `json:"alertEndpoint"`
	AlertPayload    string                   `json:"alertPayload"`
	AlertHeaders    map[string]string        `json:"alertHeaders"`
	TLSClientCert   string                   `json:"-"`
	Scheduled       bool                     `json:"-"`
	AbortChannel    chan struct{}            `json:"-"`

	Doer     `json:"-"`
	Handlers Handlers `json:"-"`
}

func (*Job) AlertingInput

func (j *Job) AlertingInput() models.AlertInput

func (*Job) Execute

func (j *Job) Execute() ExecutionResult

func (*Job) InitExpression

func (j *Job) InitExpression(parseFn cronParser.ParseFn) error

func (*Job) IsSuccess

func (j *Job) IsSuccess(x int) bool

func (*Job) OnError

func (j *Job) OnError()

func (*Job) OnSuccess

func (j *Job) OnSuccess()

func (*Job) Schedule

func (j *Job) Schedule(notifier chan uuid.UUID) string

type JobExecution

type JobExecution struct {
	Id              uuid.UUID         `json:"id"`
	JobId           uuid.UUID         `json:"jobId"`
	Name            string            `json:"name"`
	CronExpString   string            `json:"cronexp"`
	LastExecution   time.Time         `json:"lastExecution"`
	ShouldExecuteAt time.Time         `json:"shouldExecuteAt"`
	LastResponseAt  time.Time         `json:"lastResponseAt"`
	LastMessage     string            `json:"lastMessage"`
	LastStatusCode  int               `json:"lastStatusCode"`
	Endpoint        string            `json:"endpoint"`
	HttpMethod      string            `json:"httpmethod"`
	Headers         map[string]string `json:"headers"`
	SuccessStatuses []int             `json:"successStatuses"`
	Succeeded       string            `json:"succeeded"`
	Status          string            `json:"status"`
	ClaimedBy       string            `json:"claimedBy"`
	CreatedAt       int               `json:"createdAt"`
	DeletedAt       int               `json:"deletedAt,omitempty"`
}

Jump to

Keyboard shortcuts

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