-
Notifications
You must be signed in to change notification settings - Fork 15
/
health_check.go
54 lines (42 loc) · 955 Bytes
/
health_check.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
package parse
import (
"encoding/json"
"net/url"
)
const HealthCheckEndPoint = "/health"
type healthCheckT struct {
}
// To check if the server is up and running.
func ServerHealthCheck() (map[string]interface{}, error) {
body, err := defaultClient.doRequest(&healthCheckT{})
if err != nil {
return nil, err
}
resp := map[string]interface{}{}
if err := json.Unmarshal(body, &resp); err != nil {
return nil, err
}
return resp, nil
}
func (h *healthCheckT) method() string {
return "GET"
}
func (h *healthCheckT) endpoint() (string, error) {
u := url.URL{}
u.Scheme = ParseScheme
u.Host = parseHost
u.Path = ParsePath + HealthCheckEndPoint
return u.String(), nil
}
func (h *healthCheckT) body() (string, error) {
return "", nil
}
func (h *healthCheckT) useMasterKey() bool {
return false
}
func (h *healthCheckT) session() *sessionT {
return nil
}
func (h *healthCheckT) contentType() string {
return "application/json"
}