27 lines
615 B
Go
27 lines
615 B
Go
package tools
|
|
|
|
import (
|
|
"errors"
|
|
"io"
|
|
"sync"
|
|
)
|
|
|
|
type Tool interface {
|
|
CreateArgoWorkflow(path string) error
|
|
CreateAccessSecret(ns string, login string, password string) (string, error)
|
|
LogWorkflow(namespace string, workflowName string, argoFilePath string, stepMax int,
|
|
logFunc func(argoFilePath string, stepMax int, pipe io.ReadCloser, wg *sync.WaitGroup)) error
|
|
}
|
|
|
|
var _service = map[string]func() (Tool, error){
|
|
"kubernetes": NewKubernetesTool,
|
|
}
|
|
|
|
func NewService(name string) (Tool, error) {
|
|
service, ok := _service[name]
|
|
if !ok {
|
|
return nil, errors.New("service not found")
|
|
}
|
|
return service()
|
|
}
|