use of com.sequenceiq.cloudbreak.domain.RDSConfig 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;
}
use of com.sequenceiq.cloudbreak.domain.RDSConfig in project cloudbreak by hortonworks.
the class AmbariConfigurationServiceTest method testCreateRdsConfig.
@Test
public void testCreateRdsConfig() {
Cluster cluster = new Cluster();
Stack stack = new Stack();
when(rdsConfigService.create(any(RDSConfig.class))).thenAnswer(invocation -> invocation.getArgumentAt(0, RDSConfig.class));
Optional<RDSConfig> rdsConfig = ambariConfigurationService.createDefaultRdsConfigIfNeeded(stack, cluster);
assertTrue(rdsConfig.isPresent());
}
use of com.sequenceiq.cloudbreak.domain.RDSConfig in project cloudbreak by hortonworks.
the class AmbariConfigurationServiceTest method testRdsConfigNotNeeded.
@Test
public void testRdsConfigNotNeeded() {
Cluster cluster = new Cluster();
cluster.setRdsConfigs(new HashSet<>());
RDSConfig config = new RDSConfig();
config.setType(RdsType.AMBARI.name());
cluster.getRdsConfigs().add(config);
Optional<RDSConfig> rdsConfig = ambariConfigurationService.createDefaultRdsConfigIfNeeded(null, cluster);
assertFalse(rdsConfig.isPresent());
}
use of com.sequenceiq.cloudbreak.domain.RDSConfig in project cloudbreak by hortonworks.
the class StackRequestToBlueprintPreparationObjectConverter method getRdsConfigs.
private Set<RDSConfig> getRdsConfigs(StackV2Request source, IdentityUser identityUser) {
Set<RDSConfig> rdsConfigs = new HashSet<>();
for (String rdsConfigRequest : source.getCluster().getRdsConfigNames()) {
RDSConfig rdsConfig = rdsConfigService.getPrivateRdsConfig(rdsConfigRequest, identityUser);
rdsConfigs.add(rdsConfig);
}
return rdsConfigs;
}
use of com.sequenceiq.cloudbreak.domain.RDSConfig in project cloudbreak by hortonworks.
the class ClusterHostServiceRunner method decoratePillarWithAmbariDatabase.
private void decoratePillarWithAmbariDatabase(Cluster cluster, Map<String, SaltPillarProperties> servicePillar) throws CloudbreakOrchestratorFailedException {
RDSConfig ambariRdsConfig = rdsConfigService.findByClusterIdAndType(cluster.getOwner(), cluster.getAccount(), cluster.getId(), RdsType.AMBARI);
if (ambariRdsConfig == null) {
throw new CloudbreakOrchestratorFailedException("Ambari RDSConfig is missing for stack");
}
RdsView ambariRdsView = new RdsView(ambariRdsConfig);
servicePillar.put("ambari-database", new SaltPillarProperties("/ambari/database.sls", singletonMap("ambari", singletonMap("database", ambariRdsView))));
}
Aggregations