-
Notifications
You must be signed in to change notification settings - Fork 4.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add Health() method to Sys client (#2805)
- Loading branch information
1 parent
1c19375
commit 57ba312
Showing
1 changed file
with
24 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
package api | ||
|
||
func (c *Sys) Health() (*HealthResponse, error) { | ||
r := c.c.NewRequest("GET", "/v1/sys/health") | ||
resp, err := c.c.RawRequest(r) | ||
if err != nil { | ||
return nil, err | ||
} | ||
defer resp.Body.Close() | ||
|
||
var result HealthResponse | ||
err = resp.DecodeJSON(&result) | ||
return &result, err | ||
} | ||
|
||
type HealthResponse struct { | ||
Initialized bool `json:"initialized"` | ||
Sealed bool `json:"sealed"` | ||
Standby bool `json:"standby"` | ||
ServerTimeUTC int64 `json:"server_time_utc"` | ||
Version string `json:"version"` | ||
ClusterName string `json:"cluster_name,omitempty"` | ||
ClusterID string `json:"cluster_id,omitempty"` | ||
} |