use of com.epam.pipeline.exception.docker.DockerCredentialsException in project cloud-pipeline by epam.
the class DockerClient method checkAvailability.
public void checkAvailability() {
HttpEntity entity = getAuthHeaders();
String uri = String.format(HEALTH_ENTRY_POINT, hostName);
try {
getRestTemplate().exchange(uri, HttpMethod.GET, entity, String.class);
} catch (HTTPException | ResourceAccessException e) {
if (e.getCause() instanceof SSLHandshakeException) {
throw new DockerCertificateException(hostName, e.getCause());
} else {
throw new DockerConnectionException(hostName, e.getMessage(), e);
}
} catch (HttpClientErrorException e) {
if (e.getStatusCode() == HttpStatus.UNAUTHORIZED) {
throw new DockerCredentialsException(hostName, userName, password, e);
} else {
throw new DockerConnectionException(hostName, e.getMessage(), e);
}
}
}
Aggregations