chibenwa commented on code in PR #2404:
URL: https://github.com/apache/james-project/pull/2404#discussion_r1754038087


##########
server/protocols/webadmin/webadmin-core/src/main/java/org/apache/james/webadmin/routes/HealthCheckRoutes.java:
##########
@@ -58,6 +58,38 @@
 import spark.Service;
 
 public class HealthCheckRoutes implements PublicRoutes {
+    public enum StatusCodeConvertMode {
+        STRICT(resultStatus -> {
+            switch (resultStatus) {
+                case HEALTHY:
+                    return HttpStatus.OK_200;
+                case DEGRADED, UNHEALTHY:
+                    return HttpStatus.SERVICE_UNAVAILABLE_503;
+                default:
+                    throw new NotImplementedException(resultStatus + " is not 
supported");
+            }
+        }),
+        RELAXED(resultStatus -> {
+            switch (resultStatus) {
+                case HEALTHY, DEGRADED:
+                    return HttpStatus.OK_200;
+                case UNHEALTHY:
+                    return HttpStatus.SERVICE_UNAVAILABLE_503;
+                default:
+                    throw new NotImplementedException(resultStatus + " is not 
supported");
+            }
+        });
+
+        private Function<ResultStatus, Integer> converter;
+
+        StatusCodeConvertMode(Function<ResultStatus, Integer> converter) {
+            this.converter = converter;
+        }
+
+        public Function<ResultStatus, Integer> getConverter() {
+            return converter;
+        }

Review Comment:
   ```suggestion
           public int getCorrespondingSatus(ResultStatus result) {
               return converter.apply(result);
           }
   ```



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscr...@james.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscr...@james.apache.org
For additional commands, e-mail: notifications-h...@james.apache.org

Reply via email to