Search in sources :

Example 1 with SslException

use of com.vmware.vim.vmomi.client.exception.SslException in project flowgate by vmware.

the class ServerValidationService method validateVROServer.

public void validateVROServer(SDDCSoftwareConfig server) {
    try {
        VRopsAuth ss = createVRopsAuth(server);
        ss.getClient().apiVersionsClient().getCurrentVersion();
    } catch (AuthException authException) {
        throw new WormholeRequestException(HttpStatus.BAD_REQUEST, "Invalid user name or password.", authException.getCause());
    } catch (Exception exception) {
        if (exception.getCause() instanceof ConnectException) {
            throw new WormholeRequestException(HttpStatus.BAD_REQUEST, "Failed to connect to server: " + server.getServerURL(), exception.getCause());
        } else if (exception.getCause() instanceof SSLException) {
            throw new WormholeRequestException(HttpStatus.BAD_REQUEST, "Certificate verification error", exception.getCause());
        }
        throw new WormholeRequestException("Internal error", exception.getCause());
    }
}
Also used : WormholeRequestException(com.vmware.flowgate.exception.WormholeRequestException) AuthException(com.vmware.ops.api.client.exceptions.AuthException) VRopsAuth(com.vmware.flowgate.verifycert.VRopsAuth) SSLException(javax.net.ssl.SSLException) URISyntaxException(java.net.URISyntaxException) KeyStoreException(java.security.KeyStoreException) ConnectException(java.net.ConnectException) WormholeRequestException(com.vmware.flowgate.exception.WormholeRequestException) ConnectionException(com.vmware.vim.vmomi.client.exception.ConnectionException) SslException(com.vmware.vim.vmomi.client.exception.SslException) ResourceAccessException(org.springframework.web.client.ResourceAccessException) KeyManagementException(java.security.KeyManagementException) CertificateException(java.security.cert.CertificateException) AuthException(com.vmware.ops.api.client.exceptions.AuthException) UnknownHostException(java.net.UnknownHostException) HttpClientErrorException(org.springframework.web.client.HttpClientErrorException) SSLException(javax.net.ssl.SSLException) NoSuchAlgorithmException(java.security.NoSuchAlgorithmException) ConnectException(java.net.ConnectException)

Aggregations

WormholeRequestException (com.vmware.flowgate.exception.WormholeRequestException)1 VRopsAuth (com.vmware.flowgate.verifycert.VRopsAuth)1 AuthException (com.vmware.ops.api.client.exceptions.AuthException)1 ConnectionException (com.vmware.vim.vmomi.client.exception.ConnectionException)1 SslException (com.vmware.vim.vmomi.client.exception.SslException)1 ConnectException (java.net.ConnectException)1 URISyntaxException (java.net.URISyntaxException)1 UnknownHostException (java.net.UnknownHostException)1 KeyManagementException (java.security.KeyManagementException)1 KeyStoreException (java.security.KeyStoreException)1 NoSuchAlgorithmException (java.security.NoSuchAlgorithmException)1 CertificateException (java.security.cert.CertificateException)1 SSLException (javax.net.ssl.SSLException)1 HttpClientErrorException (org.springframework.web.client.HttpClientErrorException)1 ResourceAccessException (org.springframework.web.client.ResourceAccessException)1