Search in sources :

Example 1 with ApiDataContextRef

use of com.cloudera.api.swagger.model.ApiDataContextRef in project cloudbreak by hortonworks.

the class CmTemplateProcessor method addInstantiator.

public void addInstantiator(ClouderaManagerRepo clouderaManagerRepoDetails, TemplatePreparationObject templatePreparationObject, String sdxContextName) {
    ApiClusterTemplateInstantiator instantiator = ofNullable(cmTemplate.getInstantiator()).orElseGet(ApiClusterTemplateInstantiator::new);
    if (instantiator.getClusterName() == null) {
        instantiator.setClusterName(templatePreparationObject.getGeneralClusterConfigs().getClusterName());
    }
    addCmVersionDependantConfigs(clouderaManagerRepoDetails, templatePreparationObject, instantiator);
    for (ApiClusterTemplateService service : ofNullable(cmTemplate.getServices()).orElse(List.of())) {
        List<String> nonBaseRefs = ofNullable(service.getRoleConfigGroups()).orElse(List.of()).stream().filter(rcg -> rcg.getBase() == null || !rcg.getBase()).map(ApiClusterTemplateRoleConfigGroup::getRefName).collect(Collectors.toList());
        for (String nonBaseRef : nonBaseRefs) {
            instantiator.addRoleConfigGroupsItem(new ApiClusterTemplateRoleConfigGroupInfo().rcgRefName(nonBaseRef));
        }
    }
    ofNullable(sdxContextName).map(name -> List.of(new ApiDataContextRef().name(name))).map(apiDataContextRefs -> new ApiClusterTemplateClusterSpec().dataContextRefs(apiDataContextRefs)).ifPresent(instantiator::clusterSpec);
    cmTemplate.setInstantiator(instantiator);
}
Also used : InstanceCount(com.sequenceiq.cloudbreak.cloud.model.InstanceCount) InstanceCount.atLeast(com.sequenceiq.cloudbreak.cloud.model.InstanceCount.atLeast) LoggerFactory(org.slf4j.LoggerFactory) JsonUtil(com.sequenceiq.cloudbreak.common.json.JsonUtil) BigDecimal(java.math.BigDecimal) Collectors.toMap(java.util.stream.Collectors.toMap) Pair(org.apache.commons.lang3.tuple.Pair) Map(java.util.Map) ApiClusterTemplateRoleConfigGroup(com.cloudera.api.swagger.model.ApiClusterTemplateRoleConfigGroup) ApiConfigureForKerberosArguments(com.cloudera.api.swagger.model.ApiConfigureForKerberosArguments) ApiClusterTemplateService(com.cloudera.api.swagger.model.ApiClusterTemplateService) NotFoundException(com.sequenceiq.cloudbreak.common.exception.NotFoundException) Collectors.toSet(java.util.stream.Collectors.toSet) ApiClusterTemplateRoleConfigGroupInfo(com.cloudera.api.swagger.model.ApiClusterTemplateRoleConfigGroupInfo) ApiClusterTemplate(com.cloudera.api.swagger.model.ApiClusterTemplate) ClusterHostAttributes(com.sequenceiq.cloudbreak.cluster.model.ClusterHostAttributes) Versioned(com.sequenceiq.cloudbreak.common.type.Versioned) Predicate(java.util.function.Predicate) Collection(java.util.Collection) Set(java.util.Set) ApiClusterTemplateHostTemplate(com.cloudera.api.swagger.model.ApiClusterTemplateHostTemplate) BlueprintTextProcessor(com.sequenceiq.cloudbreak.template.processor.BlueprintTextProcessor) Collectors(java.util.stream.Collectors) ClouderaManagerRepo(com.sequenceiq.cloudbreak.cloud.model.ClouderaManagerRepo) Objects(java.util.Objects) ServiceComponent(com.sequenceiq.cloudbreak.template.model.ServiceComponent) List(java.util.List) ApiEntityTag(com.cloudera.api.swagger.model.ApiEntityTag) YarnConstants(com.sequenceiq.cloudbreak.cmtemplate.configproviders.yarn.YarnConstants) ApiClusterTemplateHostInfo(com.cloudera.api.swagger.model.ApiClusterTemplateHostInfo) CollectionUtils(org.springframework.util.CollectionUtils) ApiProductVersion(com.cloudera.api.swagger.model.ApiProductVersion) ResizeRecommendation(com.sequenceiq.cloudbreak.cloud.model.ResizeRecommendation) Entry(java.util.Map.Entry) ApiClusterTemplateConfig(com.cloudera.api.swagger.model.ApiClusterTemplateConfig) Optional(java.util.Optional) ApiClusterTemplateClusterSpec(com.cloudera.api.swagger.model.ApiClusterTemplateClusterSpec) ApiClusterTemplateVariable(com.cloudera.api.swagger.model.ApiClusterTemplateVariable) CMRepositoryVersionUtil.isTagsResourceSupportedViaBlueprint(com.sequenceiq.cloudbreak.cmtemplate.CMRepositoryVersionUtil.isTagsResourceSupportedViaBlueprint) NotImplementedException(org.apache.commons.lang3.NotImplementedException) ApiDataContextRef(com.cloudera.api.swagger.model.ApiDataContextRef) SiteConfigurations(com.sequenceiq.cloudbreak.template.processor.configuration.SiteConfigurations) HashMap(java.util.HashMap) ServiceAttributes(com.sequenceiq.cloudbreak.template.model.ServiceAttributes) Function(java.util.function.Function) ArrayList(java.util.ArrayList) Enums(com.google.common.base.Enums) HashSet(java.util.HashSet) Strings(com.google.common.base.Strings) ClusterManagerType(com.sequenceiq.cloudbreak.common.type.ClusterManagerType) ApiClusterTemplateInstantiator(com.cloudera.api.swagger.model.ApiClusterTemplateInstantiator) CMRepositoryVersionUtil.isVersionNewerOrEqualThanLimited(com.sequenceiq.cloudbreak.cmtemplate.CMRepositoryVersionUtil.isVersionNewerOrEqualThanLimited) GatewayRecommendation(com.sequenceiq.cloudbreak.cloud.model.GatewayRecommendation) BlueprintProcessingException(com.sequenceiq.cloudbreak.template.BlueprintProcessingException) Entitlement(com.sequenceiq.cloudbreak.auth.altus.model.Entitlement) YarnRoles(com.sequenceiq.cloudbreak.cmtemplate.configproviders.yarn.YarnRoles) Nonnull(javax.annotation.Nonnull) InstanceCount.exactly(com.sequenceiq.cloudbreak.cloud.model.InstanceCount.exactly) CustomConfigurationPropertyView(com.sequenceiq.cloudbreak.template.views.CustomConfigurationPropertyView) Logger(org.slf4j.Logger) Iterator(java.util.Iterator) AutoscaleRecommendation(com.sequenceiq.cloudbreak.cloud.model.AutoscaleRecommendation) Optional.ofNullable(java.util.Optional.ofNullable) HostgroupConfigurations(com.sequenceiq.cloudbreak.template.processor.configuration.HostgroupConfigurations) IOException(java.io.IOException) TemplatePreparationObject(com.sequenceiq.cloudbreak.template.TemplatePreparationObject) TreeMap(java.util.TreeMap) StackType(com.sequenceiq.cloudbreak.api.endpoint.v4.common.StackType) VisibleForTesting(com.google.common.annotations.VisibleForTesting) Collections(java.util.Collections) ApiDataContextRef(com.cloudera.api.swagger.model.ApiDataContextRef) ApiClusterTemplateService(com.cloudera.api.swagger.model.ApiClusterTemplateService) ApiClusterTemplateInstantiator(com.cloudera.api.swagger.model.ApiClusterTemplateInstantiator) ApiClusterTemplateRoleConfigGroupInfo(com.cloudera.api.swagger.model.ApiClusterTemplateRoleConfigGroupInfo) ApiClusterTemplateClusterSpec(com.cloudera.api.swagger.model.ApiClusterTemplateClusterSpec)

Aggregations

ApiClusterTemplate (com.cloudera.api.swagger.model.ApiClusterTemplate)1 ApiClusterTemplateClusterSpec (com.cloudera.api.swagger.model.ApiClusterTemplateClusterSpec)1 ApiClusterTemplateConfig (com.cloudera.api.swagger.model.ApiClusterTemplateConfig)1 ApiClusterTemplateHostInfo (com.cloudera.api.swagger.model.ApiClusterTemplateHostInfo)1 ApiClusterTemplateHostTemplate (com.cloudera.api.swagger.model.ApiClusterTemplateHostTemplate)1 ApiClusterTemplateInstantiator (com.cloudera.api.swagger.model.ApiClusterTemplateInstantiator)1 ApiClusterTemplateRoleConfigGroup (com.cloudera.api.swagger.model.ApiClusterTemplateRoleConfigGroup)1 ApiClusterTemplateRoleConfigGroupInfo (com.cloudera.api.swagger.model.ApiClusterTemplateRoleConfigGroupInfo)1 ApiClusterTemplateService (com.cloudera.api.swagger.model.ApiClusterTemplateService)1 ApiClusterTemplateVariable (com.cloudera.api.swagger.model.ApiClusterTemplateVariable)1 ApiConfigureForKerberosArguments (com.cloudera.api.swagger.model.ApiConfigureForKerberosArguments)1 ApiDataContextRef (com.cloudera.api.swagger.model.ApiDataContextRef)1 ApiEntityTag (com.cloudera.api.swagger.model.ApiEntityTag)1 ApiProductVersion (com.cloudera.api.swagger.model.ApiProductVersion)1 VisibleForTesting (com.google.common.annotations.VisibleForTesting)1 Enums (com.google.common.base.Enums)1 Strings (com.google.common.base.Strings)1 StackType (com.sequenceiq.cloudbreak.api.endpoint.v4.common.StackType)1 Entitlement (com.sequenceiq.cloudbreak.auth.altus.model.Entitlement)1 AutoscaleRecommendation (com.sequenceiq.cloudbreak.cloud.model.AutoscaleRecommendation)1