use of com.sequenceiq.cloudbreak.domain.RDSConfig in project cloudbreak by hortonworks.
the class RdsConfigService method get.
public RDSConfig get(Long id) {
RDSConfig rdsConfig = rdsConfigRepository.findById(id);
if (rdsConfig == null) {
throw new NotFoundException(String.format("RDS configuration '%s' not found.", id));
}
authorizationService.hasReadPermission(rdsConfig);
return rdsConfig;
}
use of com.sequenceiq.cloudbreak.domain.RDSConfig in project cloudbreak by hortonworks.
the class RdsConfigService method getByName.
public RDSConfig getByName(String name, IdentityUser user) {
RDSConfig rdsConfig = rdsConfigRepository.findOneByName(name, user.getAccount());
if (rdsConfig == null) {
throw new NotFoundException(String.format("RDS configuration '%s' not found.", name));
}
authorizationService.hasReadPermission(rdsConfig);
return rdsConfig;
}
use of com.sequenceiq.cloudbreak.domain.RDSConfig in project cloudbreak by hortonworks.
the class AbstractRdsConfigProvider method createServicePillarConfigMapIfNeeded.
public Map<String, Object> createServicePillarConfigMapIfNeeded(Stack stack, Cluster cluster) {
if (isRdsConfigNeeded(cluster.getBlueprint())) {
Set<RDSConfig> rdsConfigs = createPostgresRdsConfigIfNeeded(stack, cluster);
RDSConfig rdsConfig = rdsConfigs.stream().filter(rdsConfig1 -> rdsConfig1.getType().equalsIgnoreCase(getRdsType().name())).findFirst().get();
Map<String, Object> postgres = new HashMap<>();
postgres.put("database", getDb());
postgres.put("user", getDbUser());
postgres.put("password", rdsConfig.getConnectionPassword());
return Collections.singletonMap(getPillarKey(), postgres);
}
return Collections.emptyMap();
}
use of com.sequenceiq.cloudbreak.domain.RDSConfig in project cloudbreak by hortonworks.
the class RdsViewTest method testCreateRdsViewWhenRDSConfigContainsProperConnectionUrl.
@Test
public void testCreateRdsViewWhenRDSConfigContainsProperConnectionUrl() {
String connectionUrl = "jdbc:postgresql://some-rds.1d3nt1f13r.eu-west-1.rds.amazonaws.com:5432/ranger";
RDSConfig rdsConfig = createRdsConfig(connectionUrl);
RdsView underTest = new RdsView(rdsConfig);
Assert.assertEquals(ASSERT_ERROR_MSG, "some-rds.1d3nt1f13r.eu-west-1.rds.amazonaws.com:5432", underTest.getHostWithPort());
Assert.assertEquals("postgresql", underTest.getSubprotocol());
}
use of com.sequenceiq.cloudbreak.domain.RDSConfig in project cloudbreak by hortonworks.
the class RdsViewTest method testCreateRdsViewWhenRDSConfigContainsConnectionUrlWithoutDatabaseNameAndPortAndJDBCPrefix.
@Test
public void testCreateRdsViewWhenRDSConfigContainsConnectionUrlWithoutDatabaseNameAndPortAndJDBCPrefix() {
String connectionUrl = "some-rds.1d3nt1f13r.eu-west-1.rds.amazonaws.com";
RDSConfig rdsConfig = createRdsConfig(connectionUrl);
RdsView underTest = new RdsView(rdsConfig);
Assert.assertEquals(ASSERT_ERROR_MSG, "some-rds.1d3nt1f13r.eu-west-1.rds.amazonaws.com", underTest.getHostWithPort());
}
Aggregations