Check Remote API

This commit is contained in:
mr 2024-08-21 11:30:44 +02:00
parent 01bbb9be2c
commit f64563c9ff

View File

@ -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
}