Search in sources :

Example 31 with RDSConfig

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;
}
Also used : RDSConfig(com.sequenceiq.cloudbreak.domain.RDSConfig) RDSConfigRequest(com.sequenceiq.cloudbreak.api.model.rds.RDSConfigRequest) RdsTestResult(com.sequenceiq.cloudbreak.api.model.rds.RdsTestResult)

Example 32 with RDSConfig

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());
}
Also used : RDSConfig(com.sequenceiq.cloudbreak.domain.RDSConfig) Cluster(com.sequenceiq.cloudbreak.domain.Cluster) Stack(com.sequenceiq.cloudbreak.domain.Stack) Test(org.junit.Test)

Example 33 with RDSConfig

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());
}
Also used : RDSConfig(com.sequenceiq.cloudbreak.domain.RDSConfig) Cluster(com.sequenceiq.cloudbreak.domain.Cluster) Test(org.junit.Test)

Example 34 with RDSConfig

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;
}
Also used : RDSConfig(com.sequenceiq.cloudbreak.domain.RDSConfig) HashSet(java.util.HashSet)

Example 35 with RDSConfig

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))));
}
Also used : CloudbreakOrchestratorFailedException(com.sequenceiq.cloudbreak.orchestrator.exception.CloudbreakOrchestratorFailedException) RDSConfig(com.sequenceiq.cloudbreak.domain.RDSConfig) RdsView(com.sequenceiq.cloudbreak.blueprint.template.views.RdsView) SaltPillarProperties(com.sequenceiq.cloudbreak.orchestrator.model.SaltPillarProperties)

Aggregations

RDSConfig (com.sequenceiq.cloudbreak.domain.RDSConfig)47 Test (org.junit.Test)16 Cluster (com.sequenceiq.cloudbreak.domain.Cluster)7 IdentityUser (com.sequenceiq.cloudbreak.common.model.user.IdentityUser)6 RDSConfigRequest (com.sequenceiq.cloudbreak.api.model.rds.RDSConfigRequest)5 Date (java.util.Date)5 HashSet (java.util.HashSet)5 NotFoundException (com.sequenceiq.cloudbreak.controller.NotFoundException)4 Json (com.sequenceiq.cloudbreak.domain.json.Json)4 IOException (java.io.IOException)4 APIResourceType (com.sequenceiq.cloudbreak.common.type.APIResourceType)3 BadRequestException (com.sequenceiq.cloudbreak.controller.BadRequestException)3 Blueprint (com.sequenceiq.cloudbreak.domain.Blueprint)3 Stack (com.sequenceiq.cloudbreak.domain.Stack)3 JsonProcessingException (com.fasterxml.jackson.core.JsonProcessingException)2 BlueprintInputJson (com.sequenceiq.cloudbreak.api.model.BlueprintInputJson)2 BlueprintParameterJson (com.sequenceiq.cloudbreak.api.model.BlueprintParameterJson)2 ConfigsResponse (com.sequenceiq.cloudbreak.api.model.ConfigsResponse)2 RdsView (com.sequenceiq.cloudbreak.blueprint.template.views.RdsView)2 StackRepoDetails (com.sequenceiq.cloudbreak.cloud.model.component.StackRepoDetails)2