Search in sources :

Example 6 with DatabaseType

use of com.sequenceiq.cloudbreak.api.endpoint.v4.database.base.DatabaseType in project cloudbreak by hortonworks.

the class ClusterStartHandler method updateDatabaseConfiguration.

private void updateDatabaseConfiguration(Optional<Stack> datalakeStack, Stack dataHubStack, String service, DatabaseType databaseType) {
    Cluster cluster = clusterService.getById(datalakeStack.get().getCluster().getId());
    Optional<RDSConfig> rdsConfig = postgresConfigService.createRdsConfigIfNeeded(datalakeStack.get(), cluster, databaseType).stream().filter(config -> config.getType().toLowerCase().equals(databaseType.toString().toLowerCase())).findFirst();
    try {
        if (rdsConfig.isPresent()) {
            apiConnectors.getConnector(dataHubStack).updateServiceConfig(service, getRdsConfigMap(rdsConfig.get()));
        } else {
            LOGGER.error("Could not find RDS configuration for Hive");
        }
    } catch (CloudbreakException e) {
        LOGGER.info("Exception while updating the Data-Hub configuration", e);
    }
}
Also used : Stack(com.sequenceiq.cloudbreak.domain.stack.Stack) Cluster(com.sequenceiq.cloudbreak.domain.stack.cluster.Cluster) CloudbreakException(com.sequenceiq.cloudbreak.service.CloudbreakException) EntitlementService(com.sequenceiq.cloudbreak.auth.altus.EntitlementService) ClusterStartRequest(com.sequenceiq.cloudbreak.reactor.api.event.cluster.ClusterStartRequest) LoggerFactory(org.slf4j.LoggerFactory) DatalakeService(com.sequenceiq.cloudbreak.service.sharedservice.DatalakeService) EventSelectorUtil(com.sequenceiq.flow.event.EventSelectorUtil) HashMap(java.util.HashMap) ClusterService(com.sequenceiq.cloudbreak.service.cluster.ClusterService) CmTemplateProcessorFactory(com.sequenceiq.cloudbreak.cmtemplate.CmTemplateProcessorFactory) ClusterStartResult(com.sequenceiq.cloudbreak.reactor.api.event.cluster.ClusterStartResult) ArrayList(java.util.ArrayList) HashSet(java.util.HashSet) Inject(javax.inject.Inject) ThreadBasedUserCrnProvider(com.sequenceiq.cloudbreak.auth.ThreadBasedUserCrnProvider) Event(reactor.bus.Event) Map(java.util.Map) EventHandler(com.sequenceiq.flow.reactor.api.handler.EventHandler) RDSConfig(com.sequenceiq.cloudbreak.domain.RDSConfig) ClusterBuilderService(com.sequenceiq.cloudbreak.core.cluster.ClusterBuilderService) Logger(org.slf4j.Logger) DatabaseType(com.sequenceiq.cloudbreak.api.endpoint.v4.database.base.DatabaseType) Versioned(com.sequenceiq.cloudbreak.common.type.Versioned) Set(java.util.Set) PostgresConfigService(com.sequenceiq.cloudbreak.core.bootstrap.service.container.postgres.PostgresConfigService) EventBus(reactor.bus.EventBus) List(java.util.List) Component(org.springframework.stereotype.Component) StackUtil(com.sequenceiq.cloudbreak.util.StackUtil) RdsView(com.sequenceiq.cloudbreak.template.views.RdsView) ClusterApiConnectors(com.sequenceiq.cloudbreak.service.cluster.ClusterApiConnectors) Optional(java.util.Optional) StackType(com.sequenceiq.cloudbreak.api.endpoint.v4.common.StackType) VisibleForTesting(com.google.common.annotations.VisibleForTesting) CmTemplateProcessor(com.sequenceiq.cloudbreak.cmtemplate.CmTemplateProcessor) StackService(com.sequenceiq.cloudbreak.service.stack.StackService) RedbeamsDbCertificateProvider(com.sequenceiq.cloudbreak.service.rdsconfig.RedbeamsDbCertificateProvider) RDSConfig(com.sequenceiq.cloudbreak.domain.RDSConfig) Cluster(com.sequenceiq.cloudbreak.domain.stack.cluster.Cluster) CloudbreakException(com.sequenceiq.cloudbreak.service.CloudbreakException)

Aggregations

DatabaseType (com.sequenceiq.cloudbreak.api.endpoint.v4.database.base.DatabaseType)4 ThreadBasedUserCrnProvider (com.sequenceiq.cloudbreak.auth.ThreadBasedUserCrnProvider)4 RDSConfig (com.sequenceiq.cloudbreak.domain.RDSConfig)4 EntitlementService (com.sequenceiq.cloudbreak.auth.altus.EntitlementService)3 PostgresConfigService (com.sequenceiq.cloudbreak.core.bootstrap.service.container.postgres.PostgresConfigService)3 Optional (java.util.Optional)3 StackType (com.sequenceiq.cloudbreak.api.endpoint.v4.common.StackType)2 Crn (com.sequenceiq.cloudbreak.auth.crn.Crn)2 CmTemplateProcessor (com.sequenceiq.cloudbreak.cmtemplate.CmTemplateProcessor)2 ClusterBuilderService (com.sequenceiq.cloudbreak.core.cluster.ClusterBuilderService)2 Stack (com.sequenceiq.cloudbreak.domain.stack.Stack)2 Cluster (com.sequenceiq.cloudbreak.domain.stack.cluster.Cluster)2 ClusterApiConnectors (com.sequenceiq.cloudbreak.service.cluster.ClusterApiConnectors)2 ClusterService (com.sequenceiq.cloudbreak.service.cluster.ClusterService)2 RedbeamsDbCertificateProvider (com.sequenceiq.cloudbreak.service.rdsconfig.RedbeamsDbCertificateProvider)2 RdsView (com.sequenceiq.cloudbreak.template.views.RdsView)2 ArrayList (java.util.ArrayList)2 HashMap (java.util.HashMap)2 HashSet (java.util.HashSet)2 List (java.util.List)2