schedule

package
v1.3.1 Latest Latest
Warning

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

Go to latest
Published: Oct 23, 2023 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrScheduleNotFound is returned when crontinuos answers with 404 status.
	ErrScheduleNotFound = errors.New("ScheduleNotFound")
	// ErrInvalidSchedulePeriod is returned when the schedule period is less than the minimum allowed.
	ErrInvalidSchedulePeriod = errors.New("Schedule program period less than the minimun allowed")
	// ErrInvalidCronExpr is returned when the given cron expression is not valid.
	ErrInvalidCronExpr = errors.New("Invalid Cron Expression")
)

Functions

This section is empty.

Types

type Client

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

Client provides functionalities for calling vulcan-scheduler.

func NewClient

func NewClient(cfg Config) *Client

NewClient creates a new vulcan-cron client.

func (*Client) BulkCreateReportSchedules

func (c *Client) BulkCreateReportSchedules(schedules []ReportBulkSchedule) error

BulkCreateReportSchedules creates report schedules in bulk. It only creates a schedule for a program if no schedule for thar program already exist.

func (*Client) BulkCreateScanSchedules

func (c *Client) BulkCreateScanSchedules(schedules []ScanBulkSchedule) error

BulkCreateScanSchedules creates scan schedules in bulk. It only creates a schedule for a program if no schedule for thar program already exist.

func (*Client) CreateReportSchedule

func (c *Client) CreateReportSchedule(teamID, cronExpr string) error

CreateReportSchedule creates a new report schedule for executing a program.

func (*Client) CreateScanSchedule

func (c *Client) CreateScanSchedule(programID, teamID, cronExpr string) error

CreateScanSchedule creates a new scan schedule for executing a program.

func (*Client) DeleteReportSchedule

func (c *Client) DeleteReportSchedule(teamID string) error

DeleteReportSchedule executes a request against the scheduler component for deleting a report schedule.

func (*Client) DeleteScanSchedule

func (c *Client) DeleteScanSchedule(programID string) error

DeleteScanSchedule executes a request against the scheduler component for deleting a scan schedule.

func (*Client) GetReportScheduleByID

func (c *Client) GetReportScheduleByID(teamID string) (string, error)

GetReportScheduleByID gets the cron string defining the report schedule for a given id. If the scheduler doesn't have a schedule defined for the given id the func will return empty cron string.

func (*Client) GetScanScheduleByID

func (c *Client) GetScanScheduleByID(programID string) (string, error)

GetScanScheduleByID gets the cron string defining the scan schedule for a given id. If the scheduler doesn't have a schedule defined for the given id the func will return empty cron string.

type Config

type Config struct {
	URL             string  `mapstructure:"url"`
	MinimumInterval float64 `mapstructure:"minimum_interval"`
}

Config holds the configuration needed by the schuduler client.

type ReportBulkSchedule

type ReportBulkSchedule struct {
	Str       string `json:"str"`
	TeamID    string `json:"team_id"`
	Overwrite bool   `json:"overwrite"`
}

ReportBulkSchedule defines the information needed to create a report schedule in a bulk create operation.

type ReportScheduler

type ReportScheduler interface {
	CreateReportSchedule(teamID, cronExpr string) error
	GetReportScheduleByID(teamID string) (string, error)
	DeleteReportSchedule(teamID string) error
	BulkCreateReportSchedules(schedules []ReportBulkSchedule) error
}

type ScanBulkSchedule

type ScanBulkSchedule struct {
	Str       string `json:"str"`
	ProgramID string `json:"program_id"`
	TeamID    string `json:"team_id"`
	Overwrite bool   `json:"overwrite"`
}

ScanBulkSchedule defines the information needed to create a schedule in a bulk create operation.

type ScanScheduler

type ScanScheduler interface {
	CreateScanSchedule(programID, teamID, cronExpr string) error
	GetScanScheduleByID(programID string) (string, error)
	DeleteScanSchedule(programID string) error
	BulkCreateScanSchedules(schedules []ScanBulkSchedule) error
}

Jump to

Keyboard shortcuts

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