forked from jenkins-x/jx
-
Notifications
You must be signed in to change notification settings - Fork 0
/
interface.go
68 lines (41 loc) · 2.09 KB
/
interface.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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
package cmd
import (
"io"
"github.com/heptio/sonobuoy/pkg/client"
"github.com/jenkins-x/jx/pkg/table"
"github.com/jenkins-x/golang-jenkins"
"github.com/jenkins-x/jx/pkg/auth"
"github.com/jenkins-x/jx/pkg/client/clientset/versioned"
corev1 "k8s.io/api/core/v1"
"k8s.io/client-go/kubernetes"
"k8s.io/client-go/rest"
apiextensionsclientset "k8s.io/apiextensions-apiserver/pkg/client/clientset/clientset"
metricsclient "k8s.io/metrics/pkg/client/clientset_generated/clientset"
// this is so that we load the auth plugins so we can connect to, say, GCP
_ "k8s.io/client-go/plugin/pkg/client/auth"
)
// Factory is the interface defined for jx interactions via the cli
//go:generate pegomock generate github.com/jenkins-x/jx/pkg/jx/cmd Factory -o mocks/factory.go
type Factory interface {
WithBearerToken(token string) Factory
ImpersonateUser(user string) Factory
CreateJenkinsClient(kubeClient kubernetes.Interface, ns string) (*gojenkins.Jenkins, error)
GetJenkinsURL(kubeClient kubernetes.Interface, ns string) (string, error)
CreateAuthConfigService(fileName string) (auth.AuthConfigService, error)
CreateJenkinsAuthConfigService(kubernetes.Interface, string) (auth.AuthConfigService, error)
CreateChartmuseumAuthConfigService() (auth.AuthConfigService, error)
CreateIssueTrackerAuthConfigService(secrets *corev1.SecretList) (auth.AuthConfigService, error)
CreateChatAuthConfigService(secrets *corev1.SecretList) (auth.AuthConfigService, error)
CreateAddonAuthConfigService(secrets *corev1.SecretList) (auth.AuthConfigService, error)
CreateClient() (kubernetes.Interface, string, error)
CreateKubeConfig() (*rest.Config, error)
CreateJXClient() (versioned.Interface, string, error)
CreateApiExtensionsClient() (apiextensionsclientset.Interface, error)
CreateMetricsClient() (*metricsclient.Clientset, error)
CreateComplianceClient() (*client.SonobuoyClient, error)
CreateTable(out io.Writer) table.Table
SetBatch(batch bool)
IsInCluster() bool
IsInCDPIpeline() bool
AuthMergePipelineSecrets(config *auth.AuthConfig, secrets *corev1.SecretList, kind string, isCDPipeline bool) error
}