Search in sources :

Example 1 with RdsTestResult

use of com.sequenceiq.cloudbreak.api.model.rds.RdsTestResult in project cloudbreak by hortonworks.

the class RdsConfigController method testRDSConnectivity.

private RdsTestResult testRDSConnectivity(String connectionURL, String connectionUserName, String connectionPassword) {
    RdsTestResult rdsTestResult = new RdsTestResult();
    try {
        rdsConnectionValidator.validateRdsConnection(connectionURL, connectionUserName, connectionPassword);
        rdsTestResult.setConnectionResult("connected");
    } catch (RuntimeException e) {
        rdsTestResult.setConnectionResult(e.getMessage());
    }
    return rdsTestResult;
}
Also used : RdsTestResult(com.sequenceiq.cloudbreak.api.model.rds.RdsTestResult)

Example 2 with RdsTestResult

use of com.sequenceiq.cloudbreak.api.model.rds.RdsTestResult in project cloudbreak by hortonworks.

the class RdsConfigController method testRdsConnection.

@Override
public RdsTestResult testRdsConnection(RDSTestRequest rdsTestRequest) {
    String existingRDSConfigName = rdsTestRequest.getName();
    RDSConfigRequest configRequest = rdsTestRequest.getRdsConfig();
    if (existingRDSConfigName == null && configRequest == null) {
        throw new BadRequestException("Either an RDSConfig id, name or an RDSConfig request needs to be specified in the request. ");
    }
    RdsTestResult rdsTestResult = new RdsTestResult();
    if (existingRDSConfigName != null) {
        try {
            RDSConfig config = rdsConfigService.getByName(existingRDSConfigName, authenticatedUserService.getCbUser());
            rdsTestResult = testRDSConnectivity(config.getConnectionURL(), config.getConnectionUserName(), config.getConnectionPassword());
        } catch (NotFoundException e) {
            rdsTestResult.setConnectionResult("not found");
        }
    } else {
        rdsTestResult = testRDSConnectivity(configRequest.getConnectionURL(), configRequest.getConnectionUserName(), configRequest.getConnectionPassword());
    }
    return rdsTestResult;
}
Also used : RDSConfig(com.sequenceiq.cloudbreak.domain.RDSConfig) RDSConfigRequest(com.sequenceiq.cloudbreak.api.model.rds.RDSConfigRequest) RdsTestResult(com.sequenceiq.cloudbreak.api.model.rds.RdsTestResult)

Aggregations

RdsTestResult (com.sequenceiq.cloudbreak.api.model.rds.RdsTestResult)2 RDSConfigRequest (com.sequenceiq.cloudbreak.api.model.rds.RDSConfigRequest)1 RDSConfig (com.sequenceiq.cloudbreak.domain.RDSConfig)1