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;
}
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;
}
Aggregations