/
clientset.go
41 lines (33 loc) · 989 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
32
33
34
35
36
37
38
39
40
41
package application
import (
"k8s.io/client-go/kubernetes/scheme"
"k8s.io/client-go/rest"
"sigs.k8s.io/application/api/v1beta1"
)
type ApplicationV1Beta1Interface interface {
Applications(namespace string) ApplicationInterface
}
type ApplicationV1Beta1Client struct {
restClient rest.Interface
}
func NewForConfig(c *rest.Config) (*ApplicationV1Beta1Client, error) {
if err := AddToScheme(scheme.Scheme); err != nil {
return nil, err
}
config := *c
config.ContentConfig.GroupVersion = &v1beta1.GroupVersion
config.APIPath = "/apis"
config.NegotiatedSerializer = scheme.Codecs.WithoutConversion()
config.UserAgent = rest.DefaultKubernetesUserAgent()
client, err := rest.RESTClientFor(&config)
if err != nil {
return nil, err
}
return &ApplicationV1Beta1Client{restClient: client}, nil
}
func (c *ApplicationV1Beta1Client) Applications(namespace string) ApplicationInterface {
return &applicationClient{
restClient: c.restClient,
ns: namespace,
}
}