use of com.sequenceiq.cloudbreak.common.model.user.IdentityUser in project cloudbreak by hortonworks.
the class ClusterCreationSetupService method prepare.
public Cluster prepare(ClusterRequest request, Stack stack, Blueprint blueprint, IdentityUser user) throws Exception {
String stackName = stack.getName();
long start = System.currentTimeMillis();
Cluster cluster = conversionService.convert(request, Cluster.class);
cluster.setStack(stack);
LOGGER.info("Cluster conversion took {} ms for stack {}", System.currentTimeMillis() - start, stackName);
start = System.currentTimeMillis();
cluster = clusterDecorator.decorate(cluster, request, blueprint, user, stack);
LOGGER.info("Cluster object decorated in {} ms for stack {}", System.currentTimeMillis() - start, stackName);
start = System.currentTimeMillis();
List<ClusterComponent> components = new ArrayList<>();
Set<Component> allComponent = componentConfigProvider.getAllComponentsByStackIdAndType(stack.getId(), Sets.newHashSet(ComponentType.AMBARI_REPO_DETAILS, ComponentType.HDP_REPO_DETAILS, ComponentType.IMAGE));
Optional<Component> stackAmbariRepoConfig = allComponent.stream().filter(c -> c.getComponentType().equals(ComponentType.AMBARI_REPO_DETAILS) && c.getName().equalsIgnoreCase(ComponentType.AMBARI_REPO_DETAILS.name())).findAny();
Optional<Component> stackHdpRepoConfig = allComponent.stream().filter(c -> c.getComponentType().equals(ComponentType.HDP_REPO_DETAILS) && c.getName().equalsIgnoreCase(ComponentType.HDP_REPO_DETAILS.name())).findAny();
Optional<Component> stackImageComponent = allComponent.stream().filter(c -> c.getComponentType().equals(ComponentType.IMAGE) && c.getName().equalsIgnoreCase(ComponentType.IMAGE.name())).findAny();
ClusterComponent ambariRepoConfig = determineAmbariRepoConfig(stackAmbariRepoConfig, request.getAmbariRepoDetailsJson(), stackImageComponent, cluster);
components.add(ambariRepoConfig);
ClusterComponent hdpRepoConfig = determineHDPRepoConfig(blueprint, stack.getId(), stackHdpRepoConfig, request, cluster, user, stackImageComponent);
components.add(hdpRepoConfig);
checkVDFFile(ambariRepoConfig, hdpRepoConfig, stackName);
LOGGER.info("Cluster components saved in {} ms for stack {}", System.currentTimeMillis() - start, stackName);
start = System.currentTimeMillis();
Cluster savedCluster = clusterService.create(user, stack, cluster, components);
LOGGER.info("Cluster object creation took {} ms for stack {}", System.currentTimeMillis() - start, stackName);
return savedCluster;
}
use of com.sequenceiq.cloudbreak.common.model.user.IdentityUser in project cloudbreak by hortonworks.
the class ClusterTemplateController method getPublic.
@Override
public ClusterTemplateResponse getPublic(String name) {
IdentityUser user = authenticatedUserService.getCbUser();
ClusterTemplate clusterTemplate = clusterTemplateService.getPublicClusterTemplate(name, user);
return conversionService.convert(clusterTemplate, ClusterTemplateResponse.class);
}
use of com.sequenceiq.cloudbreak.common.model.user.IdentityUser in project cloudbreak by hortonworks.
the class ClusterTemplateController method getPublics.
@Override
public Set<ClusterTemplateResponse> getPublics() {
IdentityUser user = authenticatedUserService.getCbUser();
Set<ClusterTemplate> clusterTemplates = clusterTemplateService.retrieveAccountClusterTemplates(user);
return toJsonList(clusterTemplates);
}
use of com.sequenceiq.cloudbreak.common.model.user.IdentityUser in project cloudbreak by hortonworks.
the class ClusterTemplateController method getPrivates.
@Override
public Set<ClusterTemplateResponse> getPrivates() {
IdentityUser user = authenticatedUserService.getCbUser();
Set<ClusterTemplate> clusterTemplates = clusterTemplateService.retrievePrivateClusterTemplates(user);
return toJsonList(clusterTemplates);
}
use of com.sequenceiq.cloudbreak.common.model.user.IdentityUser in project cloudbreak by hortonworks.
the class ConstraintTemplateController method getPublic.
@Override
public ConstraintTemplateResponse getPublic(@PathVariable String name) {
IdentityUser user = authenticatedUserService.getCbUser();
ConstraintTemplate template = constraintTemplateService.getPublicTemplate(name, user);
return convert(template);
}
Aggregations