Check Remote API
This commit is contained in:
parent
01bbb9be2c
commit
f64563c9ff
11
tools/api.go
11
tools/api.go
@ -46,14 +46,11 @@ func (a *API) GetState() (State, int, error) {
|
||||
return ALIVE, 200, nil
|
||||
}
|
||||
|
||||
func (a *API) CheckRemoteAPIs(urls map[string]map[METHOD]string) (State, int, error) {
|
||||
func (a *API) CheckRemoteAPIs(urls []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], "")
|
||||
caller := NewHTTPCaller(map[string]map[METHOD]string{})
|
||||
for _, url := range urls {
|
||||
_, err := caller.CallGet(url, "/version/status")
|
||||
if err != nil {
|
||||
return REDUCED_SERVICE, 200, err
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user