forked from argoproj/argo-workflows
-
Notifications
You must be signed in to change notification settings - Fork 0
/
apiclient.go
25 lines (20 loc) · 817 Bytes
/
apiclient.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
package apiclient
import (
"context"
"k8s.io/client-go/tools/clientcmd"
cronworkflowpkg "github.com/argoproj/argo/pkg/apiclient/cronworkflow"
workflowpkg "github.com/argoproj/argo/pkg/apiclient/workflow"
workflowarchivepkg "github.com/argoproj/argo/pkg/apiclient/workflowarchive"
)
type Client interface {
NewArchivedWorkflowServiceClient() (workflowarchivepkg.ArchivedWorkflowServiceClient, error)
NewWorkflowServiceClient() workflowpkg.WorkflowServiceClient
NewCronWorkflowServiceClient() cronworkflowpkg.CronWorkflowServiceClient
}
func NewClient(argoServer string, authSupplier func() string, clientConfig clientcmd.ClientConfig) (context.Context, Client, error) {
if argoServer != "" {
return newArgoServerClient(argoServer, authSupplier())
} else {
return newClassicClient(clientConfig)
}
}