org.gitlab4j.api.HealthCheckApi Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of gitlab4j-api Show documentation
Show all versions of gitlab4j-api Show documentation
GitLab4J-API (gitlab4j-api) provides a full featured Java client library for working with GitLab repositories and servers via the GitLab REST API.
The newest version!
package org.gitlab4j.api;
import java.io.IOException;
import java.net.URL;
import jakarta.ws.rs.core.Response;
import org.gitlab4j.api.models.HealthCheckInfo;
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 https://docs.gitlab.com/ee/administration/monitoring/ip_whitelist.html
*
* GitLab Endpoint: 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.
*
* GitLab 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 https://docs.gitlab.com/ee/administration/monitoring/ip_whitelist.html
*
* GitLab Endpoint: 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.
*
* GitLab Endpoint: GET /-/readiness
*
* @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));
}
}
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy