executor

package
v0.0.0-...-c092c37 Latest Latest
Warning

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

Go to latest
Published: Sep 12, 2021 License: MIT Imports: 4 Imported by: 8

Documentation

Overview

Package executor is a generated GoMock package.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func TaskDetails

func TaskDetails(task Task) map[string]interface{}

TaskDetails returns task details as a map. It used for logging.

Types

type MockTask

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

MockTask is a mock of Task interface

func NewMockTask

func NewMockTask(ctrl *gomock.Controller) *MockTask

NewMockTask creates a new mock instance

func (*MockTask) Alert

func (m *MockTask) Alert() string

Alert mocks base method

func (*MockTask) BlockTTL

func (m *MockTask) BlockTTL() time.Duration

BlockTTL mocks base method

func (*MockTask) EXPECT

func (m *MockTask) EXPECT() *MockTaskMockRecorder

EXPECT returns an object that allows the caller to indicate expected use

func (*MockTask) EventID

func (m *MockTask) EventID() string

EventID mocks base method

func (*MockTask) Exec

func (m *MockTask) Exec(logger *logrus.Logger) error

Exec mocks base method

func (*MockTask) ExecutorDetails

func (m *MockTask) ExecutorDetails() interface{}

ExecutorDetails mocks base method

func (*MockTask) ExecutorName

func (m *MockTask) ExecutorName() string

ExecutorName mocks base method

func (*MockTask) Fingerprint

func (m *MockTask) Fingerprint() string

Fingerprint mocks base method

func (*MockTask) Rule

func (m *MockTask) Rule() string

Rule mocks base method

type MockTaskExecutor

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

MockTaskExecutor is a mock of TaskExecutor interface

func NewMockTaskExecutor

func NewMockTaskExecutor(ctrl *gomock.Controller) *MockTaskExecutor

NewMockTaskExecutor creates a new mock instance

func (*MockTaskExecutor) EXPECT

EXPECT returns an object that allows the caller to indicate expected use

func (*MockTaskExecutor) NewTask

func (m *MockTaskExecutor) NewTask(eventID, rule, alert string, blockTTL time.Duration, preparedParameters map[string]interface{}) Task

NewTask mocks base method

func (*MockTaskExecutor) ValidateParameters

func (m *MockTaskExecutor) ValidateParameters(parameters map[string]interface{}) error

ValidateParameters mocks base method

type MockTaskExecutorMockRecorder

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

MockTaskExecutorMockRecorder is the mock recorder for MockTaskExecutor

func (*MockTaskExecutorMockRecorder) NewTask

func (mr *MockTaskExecutorMockRecorder) NewTask(eventID, rule, alert, blockTTL, preparedParameters interface{}) *gomock.Call

NewTask indicates an expected call of NewTask

func (*MockTaskExecutorMockRecorder) ValidateParameters

func (mr *MockTaskExecutorMockRecorder) ValidateParameters(parameters interface{}) *gomock.Call

ValidateParameters indicates an expected call of ValidateParameters

type MockTaskMockRecorder

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

MockTaskMockRecorder is the mock recorder for MockTask

func (*MockTaskMockRecorder) Alert

func (mr *MockTaskMockRecorder) Alert() *gomock.Call

Alert indicates an expected call of Alert

func (*MockTaskMockRecorder) BlockTTL

func (mr *MockTaskMockRecorder) BlockTTL() *gomock.Call

BlockTTL indicates an expected call of BlockTTL

func (*MockTaskMockRecorder) EventID

func (mr *MockTaskMockRecorder) EventID() *gomock.Call

EventID indicates an expected call of EventID

func (*MockTaskMockRecorder) Exec

func (mr *MockTaskMockRecorder) Exec(logger interface{}) *gomock.Call

Exec indicates an expected call of Exec

func (*MockTaskMockRecorder) ExecutorDetails

func (mr *MockTaskMockRecorder) ExecutorDetails() *gomock.Call

ExecutorDetails indicates an expected call of ExecutorDetails

func (*MockTaskMockRecorder) ExecutorName

func (mr *MockTaskMockRecorder) ExecutorName() *gomock.Call

ExecutorName indicates an expected call of ExecutorName

func (*MockTaskMockRecorder) Fingerprint

func (mr *MockTaskMockRecorder) Fingerprint() *gomock.Call

Fingerprint indicates an expected call of Fingerprint

func (*MockTaskMockRecorder) Rule

func (mr *MockTaskMockRecorder) Rule() *gomock.Call

Rule indicates an expected call of Rule

type Task

type Task interface {
	// EventID returns event ID.
	EventID() string

	// Rule returns rule name.
	Rule() string

	// Alert returns alert name.
	Alert() string

	// BlockTTL returns TTL for blocking task after execute.
	// If return 0, task not blocked.
	BlockTTL() time.Duration

	ExecutorName() string

	// ExecutorDetails returns structured information about task (for example, parameters)
	// It used for TaskDetails function.
	ExecutorDetails() interface{}

	// Fingerprint returns uniq string represents task fingerprint.
	// It used for blocking task.
	Fingerprint() string

	// Exec executes task.
	Exec(logger *logrus.Logger) error
}

Task is the interface implemented by executor used for execute tasks and get task information.

type TaskBase

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

TaskBase implements basic Task methods.

func (*TaskBase) Alert

func (task *TaskBase) Alert() string

Alert implements basic Task methods, returns private field.

func (*TaskBase) BlockTTL

func (task *TaskBase) BlockTTL() time.Duration

BlockTTL implements basic Task methods, returns private field.

func (*TaskBase) EventID

func (task *TaskBase) EventID() string

EventID implements basic Task methods, returns private field.

func (*TaskBase) Rule

func (task *TaskBase) Rule() string

Rule implements basic Task methods, returns private field.

func (*TaskBase) SetBase

func (task *TaskBase) SetBase(eventID, rule, alert string, blockTTL time.Duration)

SetBase sets basic private fields.

type TaskExecutor

type TaskExecutor interface {
	NewTask(eventID, rule, alert string, blockTTL time.Duration, preparedParameters map[string]interface{}) Task
	ValidateParameters(parameters map[string]interface{}) error
}

TaskExecutor is the interface implemented by executor used for validate task parameters and create tasks.

Directories

Path Synopsis
Package httpe is a generated GoMock package.
Package httpe is a generated GoMock package.
Package jenkins is a generated GoMock package.
Package jenkins is a generated GoMock package.
Package telegram is a generated GoMock package.
Package telegram is a generated GoMock package.

Jump to

Keyboard shortcuts

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