-
Notifications
You must be signed in to change notification settings - Fork 251
/
factory.go
47 lines (38 loc) · 1.7 KB
/
factory.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
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
package tc
import (
tcclient "github.com/taskcluster/taskcluster/v50/clients/client-go"
"github.com/taskcluster/taskcluster/v50/clients/client-go/tcauth"
"github.com/taskcluster/taskcluster/v50/clients/client-go/tcobject"
"github.com/taskcluster/taskcluster/v50/clients/client-go/tcpurgecache"
"github.com/taskcluster/taskcluster/v50/clients/client-go/tcqueue"
"github.com/taskcluster/taskcluster/v50/clients/client-go/tcsecrets"
"github.com/taskcluster/taskcluster/v50/clients/client-go/tcworkermanager"
)
type ServiceFactory interface {
Auth(creds *tcclient.Credentials, rootURL string) Auth
Queue(creds *tcclient.Credentials, rootURL string) Queue
Object(creds *tcclient.Credentials, rootURL string) Object
PurgeCache(creds *tcclient.Credentials, rootURL string) PurgeCache
Secrets(creds *tcclient.Credentials, rootURL string) Secrets
WorkerManager(creds *tcclient.Credentials, rootURL string) WorkerManager
}
type ClientFactory struct {
}
func (cf *ClientFactory) Auth(creds *tcclient.Credentials, rootURL string) Auth {
return tcauth.New(creds, rootURL)
}
func (cf *ClientFactory) PurgeCache(creds *tcclient.Credentials, rootURL string) PurgeCache {
return tcpurgecache.New(creds, rootURL)
}
func (cf *ClientFactory) Queue(creds *tcclient.Credentials, rootURL string) Queue {
return tcqueue.New(creds, rootURL)
}
func (cf *ClientFactory) Object(creds *tcclient.Credentials, rootURL string) Object {
return tcobject.New(creds, rootURL)
}
func (cf *ClientFactory) Secrets(creds *tcclient.Credentials, rootURL string) Secrets {
return tcsecrets.New(creds, rootURL)
}
func (cf *ClientFactory) WorkerManager(creds *tcclient.Credentials, rootURL string) WorkerManager {
return tcworkermanager.New(creds, rootURL)
}