-
Notifications
You must be signed in to change notification settings - Fork 0
/
client.go
48 lines (35 loc) · 827 Bytes
/
client.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
package sdk
import (
"github.com/changaolee/skeleton/internal/pkg/rest"
apiv1 "github.com/changaolee/skeleton/pkg/sdk/apiserver/v1"
)
type SKTInterface interface {
APIV1() apiv1.APIV1Interface
}
type SKTClient struct {
apiV1 *apiv1.APIV1Client
}
var _ SKTInterface = (*SKTClient)(nil)
func (s *SKTClient) APIV1() apiv1.APIV1Interface {
return s.apiV1
}
func NewForConfig(c *rest.Config) (*SKTClient, error) {
configShallowCopy := *c
var skt SKTClient
var err error
skt.apiV1, err = apiv1.NewForConfig(&configShallowCopy)
if err != nil {
return nil, err
}
return &skt, nil
}
func NewForConfigOrDie(c *rest.Config) *SKTClient {
var skt SKTClient
skt.apiV1 = apiv1.NewForConfigOrDie(c)
return &skt
}
func New(c rest.Interface) *SKTClient {
var skt SKTClient
skt.apiV1 = apiv1.New(c)
return &skt
}