forked from argoproj/argo-workflows
-
Notifications
You must be signed in to change notification settings - Fork 0
/
clientset.go
31 lines (26 loc) · 915 Bytes
/
clientset.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
26
27
28
29
30
31
package reposerver
import (
"github.com/argoproj/argo-cd/reposerver/repository"
"github.com/argoproj/argo-cd/util"
log "github.com/sirupsen/logrus"
"google.golang.org/grpc"
)
// Clientset represets repository server api clients
type Clientset interface {
NewRepositoryClient() (util.Closer, repository.RepositoryServiceClient, error)
}
type clientSet struct {
address string
}
func (c *clientSet) NewRepositoryClient() (util.Closer, repository.RepositoryServiceClient, error) {
conn, err := grpc.Dial(c.address, grpc.WithInsecure())
if err != nil {
log.Errorf("Unable to connect to repository service with address %s", c.address)
return nil, nil, err
}
return conn, repository.NewRepositoryServiceClient(conn), nil
}
// NewRepositoryServerClientset creates new instance of repo server Clientset
func NewRepositoryServerClientset(address string) Clientset {
return &clientSet{address: address}
}