-
Notifications
You must be signed in to change notification settings - Fork 4
/
cluster.go
39 lines (33 loc) · 882 Bytes
/
cluster.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
package kong
import (
"net/http"
"github.com/dghubble/sling"
)
type ClusterStatus struct {
Data []struct {
Address string `json:"address"`
Name string `json:"name"`
Status string `json:"status"`
} `json:"data"`
Total int `json:"total"`
}
type ClusterService struct {
sling *sling.Sling
}
// NewIssueService returns a new IssueService.
func NewClusterService(httpClient *http.Client, baseUrl string) *ClusterService {
return &ClusterService{
sling: sling.New().Client(httpClient).Base(baseUrl),
}
}
func (s *ClusterService) Status() (*ClusterStatus, *http.Response, error) {
status := new(ClusterStatus)
resp, err := s.sling.New().Path("/cluster").ReceiveSuccess(status)
return status, resp, err
}
/*
func (s *ClusterService) Remove() (*http.Response, error) {
req, _ := s.sling.New().Delete("/cluster").Request()
return s.sling.Do(req, nil, nil)
}
*/