Search in sources :

Example 26 with Blueprint

use of com.sequenceiq.cloudbreak.domain.Blueprint in project cloudbreak by hortonworks.

the class BlueprintController method getPrivates.

@Override
public Set<BlueprintResponse> getPrivates() {
    IdentityUser user = authenticatedUserService.getCbUser();
    Set<Blueprint> blueprints = blueprintService.retrievePrivateBlueprints(user);
    return getBlueprintResponses(user, blueprints);
}
Also used : IdentityUser(com.sequenceiq.cloudbreak.common.model.user.IdentityUser) Blueprint(com.sequenceiq.cloudbreak.domain.Blueprint)

Example 27 with Blueprint

use of com.sequenceiq.cloudbreak.domain.Blueprint in project cloudbreak by hortonworks.

the class BlueprintController method createBlueprint.

private BlueprintResponse createBlueprint(IdentityUser user, BlueprintRequest blueprintRequest, boolean publicInAccount) {
    Blueprint blueprint = conversionService.convert(blueprintRequest, Blueprint.class);
    blueprint.setPublicInAccount(publicInAccount);
    blueprint = blueprintService.create(user, blueprint, blueprintRequest.getProperties());
    notify(user, ResourceEvent.BLUEPRINT_CREATED);
    return conversionService.convert(blueprint, BlueprintResponse.class);
}
Also used : Blueprint(com.sequenceiq.cloudbreak.domain.Blueprint)

Example 28 with Blueprint

use of com.sequenceiq.cloudbreak.domain.Blueprint in project cloudbreak by hortonworks.

the class BlueprintController method getPublic.

@Override
public BlueprintResponse getPublic(String name) {
    IdentityUser user = authenticatedUserService.getCbUser();
    Blueprint blueprint = blueprintService.getPublicBlueprint(name, user);
    return conversionService.convert(blueprint, BlueprintResponse.class);
}
Also used : IdentityUser(com.sequenceiq.cloudbreak.common.model.user.IdentityUser) Blueprint(com.sequenceiq.cloudbreak.domain.Blueprint)

Example 29 with Blueprint

use of com.sequenceiq.cloudbreak.domain.Blueprint in project cloudbreak by hortonworks.

the class BlueprintController method getPrivate.

@Override
public BlueprintResponse getPrivate(String name) {
    IdentityUser user = authenticatedUserService.getCbUser();
    Blueprint blueprint = blueprintService.getPrivateBlueprint(name, user);
    return conversionService.convert(blueprint, BlueprintResponse.class);
}
Also used : IdentityUser(com.sequenceiq.cloudbreak.common.model.user.IdentityUser) Blueprint(com.sequenceiq.cloudbreak.domain.Blueprint)

Example 30 with Blueprint

use of com.sequenceiq.cloudbreak.domain.Blueprint 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;
}
Also used : ComponentType(com.sequenceiq.cloudbreak.common.type.ComponentType) AmbariRepo(com.sequenceiq.cloudbreak.cloud.model.AmbariRepo) Component(com.sequenceiq.cloudbreak.domain.Component) IdentityUser(com.sequenceiq.cloudbreak.common.model.user.IdentityUser) LoggerFactory(org.slf4j.LoggerFactory) FileSystemValidator(com.sequenceiq.cloudbreak.controller.validation.filesystem.FileSystemValidator) ClusterService(com.sequenceiq.cloudbreak.service.cluster.ClusterService) StringUtils(org.apache.commons.lang3.StringUtils) CUSTOM_VDF_REPO_KEY(com.sequenceiq.cloudbreak.cloud.model.component.StackRepoDetails.CUSTOM_VDF_REPO_KEY) JsonNode(com.fasterxml.jackson.databind.JsonNode) Blueprint(com.sequenceiq.cloudbreak.domain.Blueprint) DefaultHDPInfo(com.sequenceiq.cloudbreak.cloud.model.component.DefaultHDPInfo) VDF_REPO_KEY_PREFIX(com.sequenceiq.cloudbreak.cloud.model.component.StackRepoDetails.VDF_REPO_KEY_PREFIX) Set(java.util.Set) AMBARI_VERSION_2_6_0_0(com.sequenceiq.cloudbreak.service.cluster.ambari.AmbariRepositoryVersionService.AMBARI_VERSION_2_6_0_0) Sets(com.google.common.collect.Sets) List(java.util.List) AmbariRepoDetailsJson(com.sequenceiq.cloudbreak.api.model.AmbariRepoDetailsJson) DefaultHDFInfo(com.sequenceiq.cloudbreak.cloud.model.component.DefaultHDFInfo) Entry(java.util.Map.Entry) ComponentConfigProvider(com.sequenceiq.cloudbreak.service.ComponentConfigProvider) Optional(java.util.Optional) AmbariStackDetailsJson(com.sequenceiq.cloudbreak.api.model.AmbariStackDetailsJson) MDCBuilder(com.sequenceiq.cloudbreak.logger.MDCBuilder) SerializationUtils(org.apache.commons.lang3.SerializationUtils) Image(com.sequenceiq.cloudbreak.cloud.model.Image) ArrayList(java.util.ArrayList) Inject(javax.inject.Inject) StackRepoDetails(com.sequenceiq.cloudbreak.cloud.model.component.StackRepoDetails) ClusterComponent(com.sequenceiq.cloudbreak.domain.ClusterComponent) Named(javax.inject.Named) Json(com.sequenceiq.cloudbreak.domain.json.Json) StackInfo(com.sequenceiq.cloudbreak.cloud.model.component.StackInfo) CredentialToCloudCredentialConverter(com.sequenceiq.cloudbreak.converter.spi.CredentialToCloudCredentialConverter) Stack(com.sequenceiq.cloudbreak.domain.Stack) ConversionService(org.springframework.core.convert.ConversionService) ClusterDecorator(com.sequenceiq.cloudbreak.service.decorator.ClusterDecorator) AmbariRepositoryVersionService(com.sequenceiq.cloudbreak.service.cluster.ambari.AmbariRepositoryVersionService) Logger(org.slf4j.Logger) ClusterRequest(com.sequenceiq.cloudbreak.api.model.ClusterRequest) DefaultHDFEntries(com.sequenceiq.cloudbreak.cloud.model.component.DefaultHDFEntries) IOException(java.io.IOException) JsonProcessingException(com.fasterxml.jackson.core.JsonProcessingException) CloudCredential(com.sequenceiq.cloudbreak.cloud.model.CloudCredential) Cluster(com.sequenceiq.cloudbreak.domain.Cluster) CloudbreakImageNotFoundException(com.sequenceiq.cloudbreak.core.CloudbreakImageNotFoundException) DefaultHDPEntries(com.sequenceiq.cloudbreak.cloud.model.component.DefaultHDPEntries) BlueprintService(com.sequenceiq.cloudbreak.service.blueprint.BlueprintService) BlueprintUtils(com.sequenceiq.cloudbreak.blueprint.utils.BlueprintUtils) DefaultAmbariRepoService(com.sequenceiq.cloudbreak.service.DefaultAmbariRepoService) JsonUtil(com.sequenceiq.cloudbreak.util.JsonUtil) ClusterComponent(com.sequenceiq.cloudbreak.domain.ClusterComponent) ArrayList(java.util.ArrayList) Cluster(com.sequenceiq.cloudbreak.domain.Cluster) Component(com.sequenceiq.cloudbreak.domain.Component) ClusterComponent(com.sequenceiq.cloudbreak.domain.ClusterComponent)

Aggregations

Blueprint (com.sequenceiq.cloudbreak.domain.Blueprint)71 Test (org.junit.Test)29 HostGroup (com.sequenceiq.cloudbreak.domain.HostGroup)27 JsonNode (com.fasterxml.jackson.databind.JsonNode)25 Cluster (com.sequenceiq.cloudbreak.domain.Cluster)22 InstanceGroup (com.sequenceiq.cloudbreak.domain.InstanceGroup)22 Stack (com.sequenceiq.cloudbreak.domain.Stack)16 IdentityUser (com.sequenceiq.cloudbreak.common.model.user.IdentityUser)8 IOException (java.io.IOException)8 HashMap (java.util.HashMap)8 HashSet (java.util.HashSet)8 BadRequestException (com.sequenceiq.cloudbreak.controller.BadRequestException)7 NotFoundException (com.sequenceiq.cloudbreak.controller.NotFoundException)6 List (java.util.List)5 ArrayNode (com.fasterxml.jackson.databind.node.ArrayNode)4 JsonNodeFactory (com.fasterxml.jackson.databind.node.JsonNodeFactory)4 ObjectNode (com.fasterxml.jackson.databind.node.ObjectNode)4 AmbariClient (com.sequenceiq.ambari.client.AmbariClient)4 BlueprintPreparationObject (com.sequenceiq.cloudbreak.blueprint.BlueprintPreparationObject)4 BlueprintTextProcessor (com.sequenceiq.cloudbreak.blueprint.BlueprintTextProcessor)4