-
Notifications
You must be signed in to change notification settings - Fork 35
/
service.go
46 lines (38 loc) · 970 Bytes
/
service.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
package storage
import (
"github.com/viant/endly"
"github.com/viant/endly/system/kubernetes/shared"
"k8s.io/client-go/kubernetes/fake"
"log"
)
const (
//ServiceID Kubernetes storage service ID.
ServiceID = "kubernetes/storage"
)
//no operation service
type service struct {
*endly.AbstractService
}
func (s *service) registerRoutes() {
clientSet := fake.NewSimpleClientset()
s.registerClientRoutes(clientSet.StorageV1(), "Storage")
}
func (s *service) registerClientRoutes(client interface{}, clientPrefix string) {
routes, err := shared.BuildRoutes(client, clientPrefix)
if err != nil {
log.Printf("unable register service %v actions: %v\n", ServiceID, err)
return
}
for _, route := range routes {
s.Register(route)
}
}
//New creates a new service
func New() endly.Service {
var result = &service{
AbstractService: endly.NewAbstractService(ServiceID),
}
result.AbstractService.Service = result
result.registerRoutes()
return result
}