Check Remote API
This commit is contained in:
parent
4693b96130
commit
01bbb9be2c
15
tools/api.go
15
tools/api.go
@ -45,3 +45,18 @@ func (a *API) GetState() (State, int, error) {
|
||||
}
|
||||
return ALIVE, 200, nil
|
||||
}
|
||||
|
||||
func (a *API) CheckRemoteAPIs(urls map[string]map[METHOD]string) (State, int, error) {
|
||||
// Check if the database is up
|
||||
caller := NewHTTPCaller(urls)
|
||||
for _, methods := range urls {
|
||||
if k, ok := methods[GET]; !ok {
|
||||
return REDUCED_SERVICE, 200, errors.New("no get method found for " + k + " API")
|
||||
}
|
||||
_, err := caller.CallGet(methods[GET], "")
|
||||
if err != nil {
|
||||
return REDUCED_SERVICE, 200, err
|
||||
}
|
||||
}
|
||||
return ALIVE, 200, nil
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user