cluster health is working

This commit is contained in:
Quentin 2023-11-28 15:25:08 +01:00
parent 0a681b740c
commit 9bdd615b33
Signed by: quentin
GPG Key ID: E9602264D639FF68
3 changed files with 17 additions and 1 deletions

View File

@ -3,7 +3,7 @@ module garage-admin-example
go 1.18
require (
git.deuxfleurs.fr/garage-sdk/garage-admin-sdk-golang v0.0.0-20231123092113-ffd9578e975e // indirect
git.deuxfleurs.fr/garage-sdk/garage-admin-sdk-golang v0.0.0-20231128142223-9dd59cf12c08 // indirect
github.com/golang/protobuf v1.4.2 // indirect
golang.org/x/net v0.0.0-20200822124328-c89045814202 // indirect
golang.org/x/oauth2 v0.0.0-20210323180902-22b0adad7558 // indirect

View File

@ -41,6 +41,10 @@ git.deuxfleurs.fr/garage-sdk/garage-admin-sdk-golang v0.0.0-20231123090411-96f08
git.deuxfleurs.fr/garage-sdk/garage-admin-sdk-golang v0.0.0-20231123090411-96f080c89ec4/go.mod h1:TlSL6QVxozmdRaSgP6Akspi0HCJv4HAkkq3Dldru4GM=
git.deuxfleurs.fr/garage-sdk/garage-admin-sdk-golang v0.0.0-20231123092113-ffd9578e975e h1:C/D3P1+mWBTHiO3MeiNWB2S1AJ3A/m7OYGX4iS8nbtA=
git.deuxfleurs.fr/garage-sdk/garage-admin-sdk-golang v0.0.0-20231123092113-ffd9578e975e/go.mod h1:TlSL6QVxozmdRaSgP6Akspi0HCJv4HAkkq3Dldru4GM=
git.deuxfleurs.fr/garage-sdk/garage-admin-sdk-golang v0.0.0-20231128133246-d1fd35809073 h1:2i4BlF34l5ZuCe9rDQbSnvigGxHMtc99qxP55oUuPt4=
git.deuxfleurs.fr/garage-sdk/garage-admin-sdk-golang v0.0.0-20231128133246-d1fd35809073/go.mod h1:TlSL6QVxozmdRaSgP6Akspi0HCJv4HAkkq3Dldru4GM=
git.deuxfleurs.fr/garage-sdk/garage-admin-sdk-golang v0.0.0-20231128142223-9dd59cf12c08 h1:pPjSXww/2ebfJ4iHt2NI8/cs/eBV+VC9YLQIW0N3E54=
git.deuxfleurs.fr/garage-sdk/garage-admin-sdk-golang v0.0.0-20231128142223-9dd59cf12c08/go.mod h1:TlSL6QVxozmdRaSgP6Akspi0HCJv4HAkkq3Dldru4GM=
github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU=
github.com/BurntSushi/xgb v0.0.0-20160522181843-27f122750802/go.mod h1:IVnqGOEym/WlBOVXweHU+Q+/VP0lqqI8lqeDx9IjBqo=
github.com/census-instrumentation/opencensus-proto v0.2.1/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU=

View File

@ -56,6 +56,17 @@ func main() {
fmt.Printf(strings.Join(msg.Message, "\n"))
// Check health
health, r, err := client.NodesApi.GetHealth(ctx).Execute()
if err != nil {
fmt.Fprintf(os.Stderr, "Error when calling `NodesApi.GetHealth`\n")
fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r)
panic(err)
}
fmt.Printf("Status: %s\n", health.Status)
fmt.Printf("All nodes: %v/%v healthy\n", health.ConnectedNodes, health.KnownNodes)
fmt.Printf("Storage nodes: %v/%v healthy\n", health.StorageNodesOk, health.StorageNodes)
fmt.Printf("Partitions: %v/%v healthy\n", health.PartitionsAllOk, health.Partitions)
// Key
// -- create
@ -69,6 +80,7 @@ func main() {
fmt.Printf("AWS_ACCESS_KEY_ID=%s\nAWS_SECRET_ACCESS_KEY=%s\n", *keyInfo.AccessKeyId, *keyInfo.SecretAccessKey.Get())
// -- update
//update, r, err := apiClient.KeyApi.UpdateKey(context.Background()).Id(id).UpdateKeyRequest(updateKeyRequest).Execute()
// -- delete
defer func() {