HealthCheckApi.java 2.91 KiB
package org.gitlab4j.api;
import org.gitlab4j.api.models.HealthCheckInfo;
import javax.ws.rs.core.Response;
import java.io.IOException;
import java.net.URL;
public class HealthCheckApi extends AbstractApi {
    public HealthCheckApi(GitLabApi gitLabApi) {
        super(gitLabApi);
    /**
     * Get Health Checks from the liveness endpoint.
     * Requires ip_whitelist, see the following link for more info:
     * See <a href="https://docs.gitlab.com/ee/administration/monitoring/ip_whitelist.html">https://docs.gitlab.com/ee/administration/monitoring/ip_whitelist.html</a>
     * GET /-/liveness
     * @return HealthCheckInfo instance
     * @throws GitLabApiException if any exception occurs
    public HealthCheckInfo getLiveness() throws GitLabApiException {
        return (getLiveness(null));
    /**
     * Get Health Checks from the liveness endpoint.
     * GET /-/liveness
     * @param token Health Status token
     * @return HealthCheckInfo instance
     * @throws GitLabApiException if any exception occurs
     * @deprecated
    public HealthCheckInfo getLiveness(String token) throws GitLabApiException {
        try {
            URL livenessUrl = getApiClient().getUrlWithBase("-", "liveness");
            GitLabApiForm formData = new GitLabApiForm().withParam("token", token, false);
            Response response = get(Response.Status.OK, formData.asMap(), livenessUrl);
            return (response.readEntity(HealthCheckInfo.class));
        } catch (IOException ioe) {
            throw (new GitLabApiException(ioe));
    /**
     * Get Health Checks from the readiness endpoint.
     * Requires ip_whitelist, see the following link for more info:
     * See <a href="https://docs.gitlab.com/ee/administration/monitoring/ip_whitelist.html">https://docs.gitlab.com/ee/administration/monitoring/ip_whitelist.html</a>
     * GET /-/readiness
     * @return HealthCheckInfo instance
     * @throws GitLabApiException if any exception occurs
    public HealthCheckInfo getReadiness() throws GitLabApiException {
        return (getReadiness(null));
    /**
     * Get Health Checks from the readiness endpoint.
     * GET /-/readiness
7172737475767778798081828384858687
* @param token Health Status token * @return HealthCheckInfo instance * @throws GitLabApiException if any exception occurs * @deprecated */ public HealthCheckInfo getReadiness(String token) throws GitLabApiException { try { URL readinessUrl = getApiClient().getUrlWithBase("-", "readiness"); GitLabApiForm formData = new GitLabApiForm().withParam("token", token, false); Response response = get(Response.Status.OK, formData.asMap(), readinessUrl); return (response.readEntity(HealthCheckInfo.class)); } catch (IOException ioe) { throw (new GitLabApiException(ioe)); } } }