executor

package
v0.0.0-...-3341807 Latest Latest
Warning

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

Go to latest
Published: Jul 2, 2024 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ChangeSetExecutor

type ChangeSetExecutor interface {
	Run() *ExecutionResult
	Execute(actionType git.ActionType, files []string, execFunc OperationExecFunc) *OperationResult
	Create(creates []string) *OperationResult
	Update(updates []string) *OperationResult
	Delete(deletes []string) *OperationResult
}

func NewExecutor

func NewExecutor(
	logger *logging.Logger,
	options *ExecutorOptions,
	changeSet *git.ChangeSet,
	service ServiceExecutor) ChangeSetExecutor

Creates a new executor instance. The executor is responsble for running the create, update, and delete operations for a service using the CLI defined parameters for parallel and exit-on-error.

type ExecutionResult

type ExecutionResult struct {
	ServiceName   string           `yaml:"service" json:"service"`
	HasErrors     bool             `yaml:"errors" json:"errors"`
	CreateResults *OperationResult `yaml:"create" json:"create"`
	UpdateResults *OperationResult `yaml:"update" json:"update"`
	DeleteResults *OperationResult `yaml:"delete" json:"delete"`
}

type Executor

type Executor struct {
	ChangeSetExecutor
	// contains filtered or unexported fields
}

func (*Executor) Create

func (executor *Executor) Create(creates []string) *OperationResult

Perform a create operation for each file in the changeset

func (*Executor) Delete

func (executor *Executor) Delete(deletes []string) *OperationResult

Perform a delete operation for each deleted file in the changeset

func (*Executor) Execute

func (executor *Executor) Execute(actionType git.ActionType, files []string,
	execFunc OperationExecFunc) *OperationResult

Execute the desired action (create, update, delete) using the passed options for parallelism and exit behavior.

func (*Executor) Run

func (e *Executor) Run() *ExecutionResult

Executes create, update, and delete operations for each file in the changeset.

func (*Executor) Update

func (executor *Executor) Update(updates []string) *OperationResult

Perform an update operation for each deleted file in the changeset

type ExecutorOptions

type ExecutorOptions struct {
	Parallel    bool
	ExitOnError bool
}

type OperationExecFunc

type OperationExecFunc func(serviceParams *ServiceParams)

type OperationResult

type OperationResult struct {
	Responses map[string]string `yaml:"responses" json:"responses" mapstructure:"responses"`
	Errors    map[string]error  `yaml:"errors" json:"errors" mapstructure:"errors"`
}

func NewOperationResult

func NewOperationResult(responses map[string]string, errors map[string]error) *OperationResult

type ServiceExecutor

type ServiceExecutor interface {
	Name() string
	Create(serviceParams *ServiceParams)
	Update(serviceParams *ServiceParams)
	Delete(serviceParams *ServiceParams)
}

type ServiceParams

type ServiceParams struct {
	FilePath     string
	ResponseChan chan map[string]string
	ErrorChan    chan map[string]error
	WaitGroup    *sync.WaitGroup
}

Jump to

Keyboard shortcuts

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