controller

package
v0.0.3 Latest Latest
Warning

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

Go to latest
Published: Jan 23, 2024 License: Apache-2.0 Imports: 20 Imported by: 0

Documentation

Index

Constants

View Source
const ErrMissingCamundaProcessInstance = "missing camunda process instance"

Variables

This section is empty.

Functions

func FMap3

func FMap3[I1 any, I2 any, I3 any, ResultType any, NewResultType any](f func(in1 I1, in2 I2, in3 I3) (ResultType, error), c func(ResultType) NewResultType) func(in1 I1, in2 I2, in3 I3) (NewResultType, error)

func ListContains

func ListContains[T any](list []T, check func(a T) bool) bool

func ListFilter

func ListFilter[T any](in []T, filter func(T) bool) (out []T)

func ListMap

func ListMap[From any, To any](from []From, converter func(From) To) (to []To)

func ValidateDesign

func ValidateDesign(xml string) (err error)

Types

type Camunda

type Camunda interface {
	DeployRelease(owner string, release model.SmartServiceReleaseExtended) (err error, isInvalidCamundaDeployment bool)
	RemoveRelease(id string) error
	Start(result model.SmartServiceInstance) error
	CheckInstanceReady(smartServiceInstanceId string) (finished bool, missing bool, err error)
	StopInstance(smartServiceInstanceId string) error
	DeleteInstance(instance model.HistoricProcessInstance) (err error)
	GetProcessInstanceBusinessKey(processInstanceId string) (string, error, int)
	GetProcessInstanceList() (result []model.HistoricProcessInstance, err error)
	StartMaintenance(releaseId string, procedure model.MaintenanceProcedure, id string, parameter []model.SmartServiceParameter) error
}

type Consumer

type Consumer = func(ctx context.Context, config configuration.Config, topic string, listener func(delivery []byte) error) error

type Controller

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

func New

func New(ctx context.Context, config configuration.Config, db Database, permissions Permissions, camunda Camunda, selectables Selectables, consumer Consumer, producer ProducerFactory, userTokenProvider UserTokenProvider) (ctrl *Controller, err error)

func (*Controller) AddModule

func (this *Controller) AddModule(token auth.Token, instanceId string, module model.SmartServiceModuleInit) (result model.SmartServiceModule, err error, code int)

func (*Controller) AddModuleForProcessInstance

func (this *Controller) AddModuleForProcessInstance(processInstanceId string, module model.SmartServiceModuleInit) (result model.SmartServiceModule, err error, code int)

func (*Controller) AddModules

func (this *Controller) AddModules(token auth.Token, instanceId string, modules []model.SmartServiceModuleInit) (result []model.SmartServiceModule, err error, code int)

func (*Controller) AddModulesForProcessInstance

func (this *Controller) AddModulesForProcessInstance(processInstanceId string, modules []model.SmartServiceModuleInit) (result []model.SmartServiceModule, err error, code int)

func (*Controller) Cleanup

func (this *Controller) Cleanup(ignoreModuleDeleteError bool) (result []error)

func (*Controller) CreateInstance

func (this *Controller) CreateInstance(token auth.Token, releaseId string, instanceInfo model.SmartServiceInstanceInit) (result model.SmartServiceInstance, err error, code int)

func (*Controller) CreateRelease

func (this *Controller) CreateRelease(token auth.Token, element model.SmartServiceRelease) (result model.SmartServiceRelease, err error, code int)

func (*Controller) DeleteDesign

func (this *Controller) DeleteDesign(token auth.Token, id string) (error, int)

func (*Controller) DeleteInstance

func (this *Controller) DeleteInstance(token auth.Token, id string, ignoreModuleDeleteError bool) (error, int)

func (*Controller) DeleteModule

func (this *Controller) DeleteModule(token auth.Token, id string, ignoreModuleDeleteError bool) (error, int)

func (*Controller) DeleteRelease

func (this *Controller) DeleteRelease(token auth.Token, releaseId string) (error, int)

func (*Controller) DeleteVariable

func (this *Controller) DeleteVariable(token auth.Token, instanceId string, name string) (error, int)

func (*Controller) GetCharacteristic

func (this *Controller) GetCharacteristic(token string, id string) (characteristic *model.Characteristic, err error)

func (*Controller) GetDesign

func (this *Controller) GetDesign(token auth.Token, id string) (result model.SmartServiceDesign, err error, code int)

func (*Controller) GetExtendedRelease

func (this *Controller) GetExtendedRelease(token auth.Token, id string) (result model.SmartServiceReleaseExtended, err error, code int)

func (*Controller) GetInstance

func (this *Controller) GetInstance(token auth.Token, id string) (result model.SmartServiceInstance, err error, code int)

func (*Controller) GetInstanceByProcessInstanceId

func (this *Controller) GetInstanceByProcessInstanceId(processInstanceId string) (result model.SmartServiceInstance, err error, code int)

func (*Controller) GetInstanceUserIdByProcessInstanceId

func (this *Controller) GetInstanceUserIdByProcessInstanceId(processInstanceId string) (string, error, int)

func (*Controller) GetMaintenanceProcedureOfInstance

func (this *Controller) GetMaintenanceProcedureOfInstance(token auth.Token, instanceId string, publicEventId string) (maintenanceProcedure model.MaintenanceProcedure, instance model.SmartServiceInstance, release model.SmartServiceReleaseExtended, err error, code int)

func (*Controller) GetMaintenanceProcedureParametersOfInstance

func (this *Controller) GetMaintenanceProcedureParametersOfInstance(token auth.Token, instanceId string, publicEventId string) ([]model.SmartServiceExtendedParameter, error, int)

func (*Controller) GetMaintenanceProceduresOfInstance

func (this *Controller) GetMaintenanceProceduresOfInstance(token auth.Token, instanceId string) (maintenanceProcedure []model.MaintenanceProcedure, instance model.SmartServiceInstance, release model.SmartServiceReleaseExtended, err error, code int)

func (*Controller) GetModule

func (this *Controller) GetModule(token auth.Token, id string) (model.SmartServiceModule, error, int)

func (*Controller) GetNewId

func (this *Controller) GetNewId() string

func (*Controller) GetRelease

func (this *Controller) GetRelease(token auth.Token, id string) (result model.SmartServiceRelease, err error, code int)

func (*Controller) GetReleaseParameter

func (this *Controller) GetReleaseParameter(token auth.Token, id string) (result []model.SmartServiceExtendedParameter, err error, code int)

func (*Controller) GetReleaseParameterWithoutAuthCheck

func (this *Controller) GetReleaseParameterWithoutAuthCheck(token auth.Token, id string) (result []model.SmartServiceExtendedParameter, err error, code int)

func (*Controller) GetVariable

func (this *Controller) GetVariable(token auth.Token, instanceId string, name string) (model.SmartServiceInstanceVariable, error, int)

func (*Controller) GetVariablesMap

func (this *Controller) GetVariablesMap(token auth.Token, instanceId string, query model.VariableQueryOptions) (map[string]interface{}, error, int)

func (*Controller) GetVariablesMapOfProcessInstance

func (this *Controller) GetVariablesMapOfProcessInstance(processInstanceId string) (map[string]interface{}, error, int)

func (*Controller) HandleRelease

func (this *Controller) HandleRelease(cmd ReleaseCommand) (err error)

func (*Controller) HandleReleaseDelete

func (this *Controller) HandleReleaseDelete(userId string, id string) error

func (*Controller) HandleReleaseMessage

func (this *Controller) HandleReleaseMessage(delivery []byte) error

func (*Controller) HandleReleaseSave

func (this *Controller) HandleReleaseSave(owner string, release model.SmartServiceReleaseExtended) (err error)

func (*Controller) ListDesigns

func (this *Controller) ListDesigns(token auth.Token, query model.DesignQueryOptions) ([]model.SmartServiceDesign, error, int)

func (*Controller) ListExtendedReleases

func (this *Controller) ListExtendedReleases(token auth.Token, query model.ReleaseQueryOptions) (result []model.SmartServiceReleaseExtended, err error, code int)

func (*Controller) ListInstances

func (this *Controller) ListInstances(token auth.Token, query model.InstanceQueryOptions) (result []model.SmartServiceInstance, err error, code int)

func (*Controller) ListModules

func (this *Controller) ListModules(token auth.Token, query model.ModuleQueryOptions) ([]model.SmartServiceModule, error, int)

func (*Controller) ListModulesOfProcessInstance

func (this *Controller) ListModulesOfProcessInstance(processInstanceId string, query model.ModuleQueryOptions) (result []model.SmartServiceModule, err error, code int)

func (*Controller) ListReleases

func (this *Controller) ListReleases(token auth.Token, query model.ReleaseQueryOptions) (result []model.SmartServiceRelease, err error, code int)

func (*Controller) ListVariables

func (this *Controller) ListVariables(token auth.Token, instanceId string, query model.VariableQueryOptions) ([]model.SmartServiceInstanceVariable, error, int)

func (*Controller) ListVariablesOfProcessInstance

func (this *Controller) ListVariablesOfProcessInstance(processInstanceId string, query model.VariableQueryOptions) (result []model.SmartServiceInstanceVariable, err error, code int)

func (*Controller) RedeployInstance

func (this *Controller) RedeployInstance(token auth.Token, id string, parameters []model.SmartServiceParameter, releaseId string) (result model.SmartServiceInstance, err error, code int)

func (*Controller) SetDesign

func (this *Controller) SetDesign(token auth.Token, element model.SmartServiceDesign) (result model.SmartServiceDesign, err error, code int)

func (*Controller) SetInstanceError

func (this *Controller) SetInstanceError(token auth.Token, instanceId string, errMsg string) (error, int)

func (*Controller) SetInstanceErrorByProcessInstanceId

func (this *Controller) SetInstanceErrorByProcessInstanceId(processInstanceId string, errMsg string) (error, int)

func (*Controller) SetModuleForProcessInstance

func (this *Controller) SetModuleForProcessInstance(processInstanceId string, module model.SmartServiceModuleInit, moduleId string) (result model.SmartServiceModule, err error, code int)

func (*Controller) SetVariable

func (this *Controller) SetVariable(token auth.Token, variable model.SmartServiceInstanceVariable) (result model.SmartServiceInstanceVariable, err error, code int)

func (*Controller) SetVariableForProcessInstance

func (this *Controller) SetVariableForProcessInstance(processInstanceId string, element model.SmartServiceInstanceVariable) (result model.SmartServiceInstanceVariable, err error, code int)

func (*Controller) SetVariablesMapOfProcessInstance

func (this *Controller) SetVariablesMapOfProcessInstance(processInstanceId string, mappedVariableValues map[string]interface{}) (err error, code int)

func (*Controller) StartMaintenanceProcedure

func (this *Controller) StartMaintenanceProcedure(token auth.Token, instanceId string, publicEventId string, parameters model.SmartServiceParameters) (error, int)

func (*Controller) UpdateInstanceInfo

func (this *Controller) UpdateInstanceInfo(token auth.Token, id string, element model.SmartServiceInstanceInfo) (result model.SmartServiceInstance, err error, code int)

func (*Controller) ValidateDesign

func (this *Controller) ValidateDesign(token auth.Token, element model.SmartServiceDesign) (err error, code int)

func (*Controller) ValidateModule

func (this *Controller) ValidateModule(userId string, element model.SmartServiceModule) (error, int)

func (*Controller) ValidateVariable

func (this *Controller) ValidateVariable(element model.SmartServiceInstanceVariable) (error, int)

type DesignsInterface

type DesignsInterface interface {
	GetDesign(id string, userId string) (model.SmartServiceDesign, error, int)
	SetDesign(element model.SmartServiceDesign) (error, int)
	DeleteDesign(id string, userId string) (error, int)
	ListDesigns(userId string, query model.DesignQueryOptions) ([]model.SmartServiceDesign, error, int)
}

type GenericProducerFactory

type GenericProducerFactory[T Producer] func(ctx context.Context, config configuration.Config, topic string) (T, error)

type InstanceInterface

type InstanceInterface interface {
	GetInstance(id string, userId string) (model.SmartServiceInstance, error, int)
	DeleteInstance(id string, userId string) (error, int)
	SetInstance(element model.SmartServiceInstance) (error, int)
	ListInstances(userId string, query model.InstanceQueryOptions) (result []model.SmartServiceInstance, err error, code int)
}

type MaintenanceInterface

type MaintenanceInterface interface {
	RemoveFromRunningMaintenanceIds(instanceId string, removeMaintenanceIds []string) error
	AddToRunningMaintenanceIds(instanceId string, maintenanceId string) error
}

type ModuleInterface

type ModuleInterface interface {
	SetModule(element model.SmartServiceModule) (error, int)
	SetModules(element []model.SmartServiceModule) (error, int)
	GetModule(id string, userId string) (model.SmartServiceModule, error, int)
	DeleteModule(id string, userId string) (error, int)
	ListModules(userId string, query model.ModuleQueryOptions) ([]model.SmartServiceModule, error, int)
	ListAllModules(query model.ModuleQueryOptions) (result []model.SmartServiceModule, err error, code int)
	SetInstanceError(id string, userId string, errMsg string) error
}

type PermSearchCharacteristicsWrapper

type PermSearchCharacteristicsWrapper struct {
	Raw model.Characteristic `json:"raw"`
}

type Permissions

type Permissions interface {
	CheckAccess(token auth.Token, topic string, id string, right string) (bool, error)
	Query(token string, query permissions.QueryMessage, result interface{}) (err error, code int)
	GetResourceRights(token string, topic string, id string) (rights permissions.ResourceRights, err error)
	SetResourceRights(token string, topic string, id string, rights permissions.ResourceRights, kafkaKey string) error
}

type Producer

type Producer interface {
	Produce(key string, message []byte) error
}

type ProducerFactory

type ProducerFactory = GenericProducerFactory[Producer]

func NewProducerFactory

func NewProducerFactory[T Producer](f GenericProducerFactory[T]) (result ProducerFactory)

type ReleaseCommand

type ReleaseCommand struct {
	Command string                             `json:"command"`
	Id      string                             `json:"id"`
	Owner   string                             `json:"owner"`
	Release *model.SmartServiceReleaseExtended `json:"release"`
}

type ReleaseInterface

type ReleaseInterface interface {
	SetRelease(element model.SmartServiceReleaseExtended) (error, int)
	SetReleaseError(id string, errMsg string) error
	GetRelease(id string) (model.SmartServiceReleaseExtended, error, int)
	GetReleaseListByIds(ids []string, sort string) ([]model.SmartServiceReleaseExtended, error)
	DeleteRelease(id string) (error, int)
	GetReleasesByDesignId(designId string) ([]model.SmartServiceReleaseExtended, error)
}

type ReleasePermissionsWrapper

type ReleasePermissionsWrapper struct {
	Id          string          `json:"id"`
	Shared      bool            `json:"shared"`
	Permissions map[string]bool `json:"permissions"`
	DesignId    string          `json:"design_id"`
}

type Selectables

type Selectables interface {
	Get(token auth.Token, searchedEntities []string, criteria []model.Criteria) (result []model.Selectable, err error, code int)
}

type UserTokenProvider

type UserTokenProvider = func(userid string) (token auth.Token, err error)

type VariableInterface

type VariableInterface interface {
	GetVariable(instanceId string, userId string, variableName string) (result model.SmartServiceInstanceVariable, err error, code int)
	SetVariable(element model.SmartServiceInstanceVariable) (model.SmartServiceInstanceVariable, error, int)
	DeleteVariable(instanceId string, userId string, variableName string) (error, int)
	ListVariables(instanceId string, userId string, query model.VariableQueryOptions) (result []model.SmartServiceInstanceVariable, err error, code int)
	ListAllVariables(query model.VariableQueryOptions) (result []model.SmartServiceInstanceVariable, err error, code int)
}

Jump to

Keyboard shortcuts

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