oc-monitord/tools/interface.go

30 lines
742 B
Go
Raw Normal View History

2025-02-14 12:00:29 +01:00
package tools
import (
"errors"
"io"
v1 "k8s.io/api/core/v1"
"k8s.io/apimachinery/pkg/watch"
2025-02-14 12:00:29 +01:00
)
type Tool interface {
2025-02-17 16:54:25 +01:00
CreateArgoWorkflow(path string, ns string) (string, error)
CreateAccessSecret(user string, password string, storageId string, namespace string) (string, error)
GetArgoWatch(executionId string, wfName string) (watch.Interface, error)
GetPodLogger(ns string, wfName string, podName string) (io.ReadCloser, error)
GetS3Secret(storageId string, namespace string) *v1.Secret
2025-02-14 12:00:29 +01:00
}
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()
}