Search in sources :

Example 61 with IdentityUser

use of com.sequenceiq.cloudbreak.common.model.user.IdentityUser in project cloudbreak by hortonworks.

the class StackToBlueprintPreparationObjectConverter method convert.

@Override
public BlueprintPreparationObject convert(Stack source) {
    try {
        Optional<SmartSenseSubscription> aDefault = smartSenseSubscriptionService.getDefault();
        Cluster cluster = clusterService.getById(source.getCluster().getId());
        FileSystem fileSystem = cluster.getFileSystem();
        LdapConfig ldapConfig = cluster.getLdapConfig();
        StackRepoDetails hdpRepo = clusterComponentConfigProvider.getHDPRepo(cluster.getId());
        String stackRepoDetailsHdpVersion = hdpRepo != null ? hdpRepo.getHdpVersion() : null;
        Map<String, List<InstanceMetaData>> groupInstances = instanceGroupMetadataCollector.collectMetadata(source);
        HdfConfigs hdfConfigs = hdfConfigProvider.createHdfConfig(cluster.getHostGroups(), groupInstances, cluster.getBlueprint().getBlueprintText());
        BlueprintStackInfo blueprintStackInfo = stackInfoService.blueprintStackInfo(cluster.getBlueprint().getBlueprintText());
        FileSystemConfigurationView fileSystemConfigurationView = null;
        if (source.getCluster().getFileSystem() != null) {
            fileSystemConfigurationView = new FileSystemConfigurationView(fileSystemConfigurationProvider.fileSystemConfiguration(fileSystem, source), fileSystem == null ? false : fileSystem.isDefaultFs());
        }
        IdentityUser identityUser = userDetailsService.getDetails(cluster.getOwner(), UserFilterField.USERID);
        return BlueprintPreparationObject.Builder.builder().withFlexSubscription(source.getFlexSubscription()).withRdsConfigs(postgresConfigService.createRdsConfigIfNeeded(source, cluster)).withHostgroups(hostGroupService.getByCluster(cluster.getId())).withGateway(cluster.getGateway()).withBlueprintView(new BlueprintView(cluster, blueprintStackInfo)).withStackRepoDetailsHdpVersion(stackRepoDetailsHdpVersion).withFileSystemConfigurationView(fileSystemConfigurationView).withGeneralClusterConfigs(generalClusterConfigsProvider.generalClusterConfigs(source, cluster, identityUser)).withSmartSenseSubscriptionId(aDefault.isPresent() ? aDefault.get().getSubscriptionId() : null).withLdapConfig(ldapConfig).withHdfConfigs(hdfConfigs).withKerberosConfig(cluster.isSecure() ? cluster.getKerberosConfig() : null).build();
    } catch (BlueprintProcessingException e) {
        throw new CloudbreakServiceException(e.getMessage(), e);
    } catch (IOException e) {
        throw new CloudbreakServiceException(e.getMessage(), e);
    }
}
Also used : BlueprintProcessingException(com.sequenceiq.cloudbreak.blueprint.BlueprintProcessingException) StackRepoDetails(com.sequenceiq.cloudbreak.cloud.model.component.StackRepoDetails) HdfConfigs(com.sequenceiq.cloudbreak.blueprint.nifi.HdfConfigs) SmartSenseSubscription(com.sequenceiq.cloudbreak.domain.SmartSenseSubscription) BlueprintView(com.sequenceiq.cloudbreak.blueprint.template.views.BlueprintView) CloudbreakServiceException(com.sequenceiq.cloudbreak.service.CloudbreakServiceException) Cluster(com.sequenceiq.cloudbreak.domain.Cluster) IOException(java.io.IOException) LdapConfig(com.sequenceiq.cloudbreak.domain.LdapConfig) IdentityUser(com.sequenceiq.cloudbreak.common.model.user.IdentityUser) BlueprintStackInfo(com.sequenceiq.cloudbreak.blueprint.templates.BlueprintStackInfo) FileSystem(com.sequenceiq.cloudbreak.domain.FileSystem) FileSystemConfigurationView(com.sequenceiq.cloudbreak.blueprint.template.views.FileSystemConfigurationView) List(java.util.List)

Example 62 with IdentityUser

use of com.sequenceiq.cloudbreak.common.model.user.IdentityUser in project cloudbreak by hortonworks.

the class PlatformParameterV1Controller method createRecommendation.

@Override
public RecommendationResponse createRecommendation(RecommendationRequestJson recommendationRequestJson) {
    IdentityUser cbUser = authenticatedUserService.getCbUser();
    PlatformResourceRequest resourceRequest = conversionService.convert(recommendationRequestJson, PlatformResourceRequest.class);
    if (recommendationRequestJson.getBlueprintId() == null && Strings.isNullOrEmpty(recommendationRequestJson.getBlueprintName())) {
        fieldIsNotEmpty(recommendationRequestJson.getBlueprintId(), "blueprintId");
    }
    fieldIsNotEmpty(resourceRequest.getRegion(), "region");
    fieldIsNotEmpty(resourceRequest.getAvailabilityZone(), "availabilityZone");
    PlatformRecommendation recommendedVms = cloudResourceAdvisor.createForBlueprint(recommendationRequestJson.getBlueprintName(), recommendationRequestJson.getBlueprintId(), resourceRequest, cbUser);
    return conversionService.convert(recommendedVms, RecommendationResponse.class);
}
Also used : IdentityUser(com.sequenceiq.cloudbreak.common.model.user.IdentityUser) PlatformRecommendation(com.sequenceiq.cloudbreak.cloud.model.PlatformRecommendation) PlatformResourceRequest(com.sequenceiq.cloudbreak.domain.PlatformResourceRequest)

Example 63 with IdentityUser

use of com.sequenceiq.cloudbreak.common.model.user.IdentityUser in project cloudbreak by hortonworks.

the class ProxyConfigController method getPrivate.

@Override
public ProxyConfigResponse getPrivate(String name) {
    IdentityUser user = authenticatedUserService.getCbUser();
    ProxyConfig proxyConfig = proxyConfigService.getPrivateProxyConfig(name, user);
    return proxyConfigMapper.mapEntityToResponse(proxyConfig);
}
Also used : IdentityUser(com.sequenceiq.cloudbreak.common.model.user.IdentityUser) ProxyConfig(com.sequenceiq.cloudbreak.domain.ProxyConfig)

Example 64 with IdentityUser

use of com.sequenceiq.cloudbreak.common.model.user.IdentityUser in project cloudbreak by hortonworks.

the class RdsConfigController method getPrivates.

@Override
public Set<RDSConfigResponse> getPrivates() {
    IdentityUser user = authenticatedUserService.getCbUser();
    Set<RDSConfig> rdsConfigs = rdsConfigService.retrievePrivateRdsConfigs(user);
    return toJsonList(rdsConfigs);
}
Also used : IdentityUser(com.sequenceiq.cloudbreak.common.model.user.IdentityUser) RDSConfig(com.sequenceiq.cloudbreak.domain.RDSConfig)

Example 65 with IdentityUser

use of com.sequenceiq.cloudbreak.common.model.user.IdentityUser in project cloudbreak by hortonworks.

the class RecipeController method getRequestfromName.

@Override
public RecipeRequest getRequestfromName(String name) {
    IdentityUser user = authenticatedUserService.getCbUser();
    Recipe recipe = recipeService.getPublicRecipe(name, user);
    return conversionService.convert(recipe, RecipeRequest.class);
}
Also used : IdentityUser(com.sequenceiq.cloudbreak.common.model.user.IdentityUser) Recipe(com.sequenceiq.cloudbreak.domain.Recipe)

Aggregations

IdentityUser (com.sequenceiq.cloudbreak.common.model.user.IdentityUser)133 Test (org.junit.Test)14 Stack (com.sequenceiq.cloudbreak.domain.Stack)13 UserFilterField (com.sequenceiq.cloudbreak.common.service.user.UserFilterField)9 Async (org.springframework.scheduling.annotation.Async)9 Blueprint (com.sequenceiq.cloudbreak.domain.Blueprint)8 Credential (com.sequenceiq.cloudbreak.domain.Credential)8 FlexSubscription (com.sequenceiq.cloudbreak.domain.FlexSubscription)8 Cluster (com.sequenceiq.cloudbreak.domain.Cluster)7 LdapConfig (com.sequenceiq.cloudbreak.domain.LdapConfig)7 ProxyConfig (com.sequenceiq.cloudbreak.domain.ProxyConfig)7 ImageCatalog (com.sequenceiq.cloudbreak.domain.ImageCatalog)6 RDSConfig (com.sequenceiq.cloudbreak.domain.RDSConfig)6 Before (org.junit.Before)6 TestingAuthenticationToken (org.springframework.security.authentication.TestingAuthenticationToken)6 UpdateStackJson (com.sequenceiq.cloudbreak.api.model.UpdateStackJson)5 Template (com.sequenceiq.cloudbreak.domain.Template)5 ConstraintTemplate (com.sequenceiq.cloudbreak.domain.ConstraintTemplate)4 Network (com.sequenceiq.cloudbreak.domain.Network)4 Recipe (com.sequenceiq.cloudbreak.domain.Recipe)4