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);
}
}
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);
}
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);
}
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);
}
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);
}
Aggregations