mirror of
https://github.com/mickael-kerjean/filestash.git
synced 2026-10-20 00:15:40 +00:00
28 lines
778 B
Go
28 lines
778 B
Go
package workflow
|
|
|
|
import (
|
|
. "github.com/mickael-kerjean/filestash/server/pkg/kernel"
|
|
. "github.com/mickael-kerjean/filestash/server/pkg/core"
|
|
. "github.com/mickael-kerjean/filestash/server/pkg/utils"
|
|
|
|
_ "github.com/mickael-kerjean/filestash/server/pkg/workflow/actions"
|
|
. "github.com/mickael-kerjean/filestash/server/pkg/workflow/model"
|
|
)
|
|
|
|
func ExecuteAction(action Step, input map[string]string) (map[string]string, error) {
|
|
currAction, err := findAction(action.Name)
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
return currAction.Execute(action.Params, input)
|
|
}
|
|
|
|
func findAction(action string) (IAction, error) {
|
|
for _, currAction := range Hooks.Get.WorkflowActions() {
|
|
if currAction.Manifest().Name == action {
|
|
return currAction, nil
|
|
}
|
|
}
|
|
return nil, ErrNotFound
|
|
}
|