use of com.cloudera.api.swagger.model.ApiClusterTemplateService in project cloudbreak by hortonworks.
the class RangerRazDatalakeConfigProvider method getAdditionalServices.
@Override
public Map<String, ApiClusterTemplateService> getAdditionalServices(CmTemplateProcessor cmTemplateProcessor, TemplatePreparationObject source) {
if (isConfigurationNeeded(cmTemplateProcessor, source)) {
ApiClusterTemplateService coreSettings = createTemplate();
Set<HostgroupView> hostgroupViews = source.getHostgroupViews();
return hostgroupViews.stream().filter(hg -> hg.getName().toLowerCase().equals("master")).collect(Collectors.toMap(HostgroupView::getName, v -> coreSettings));
}
return Map.of();
}
use of com.cloudera.api.swagger.model.ApiClusterTemplateService in project cloudbreak by hortonworks.
the class CmTemplateConfigInjectorProcessor method process.
public void process(CmTemplateProcessor processor, TemplatePreparationObject source) {
List<ApiClusterTemplateService> services = ofNullable(processor.getTemplate().getServices()).orElse(List.of());
for (CmTemplateConfigInjector injector : injectors) {
for (ApiClusterTemplateService service : services) {
injector.addServiceConfigs(service, processor, source);
Iterable<ApiClusterTemplateRoleConfigGroup> roleConfigGroups = ofNullable(service.getRoleConfigGroups()).orElse(List.of());
for (ApiClusterTemplateRoleConfigGroup roleConfigGroup : roleConfigGroups) {
injector.addRoleConfigs(roleConfigGroup, service, processor, source);
}
}
}
}
use of com.cloudera.api.swagger.model.ApiClusterTemplateService in project cloudbreak by hortonworks.
the class CmTemplateProcessor method extendTemplateWithAdditionalServices.
public void extendTemplateWithAdditionalServices(Map<String, ApiClusterTemplateService> hostGroupServices) {
for (Entry<String, ApiClusterTemplateService> hostGroupService : hostGroupServices.entrySet()) {
ApiClusterTemplateService service = hostGroupService.getValue();
List<String> serviceRefNames = service.getRoleConfigGroups().stream().map(ApiClusterTemplateRoleConfigGroup::getRefName).collect(Collectors.toList());
if (getServiceByType(service.getServiceType()).isEmpty()) {
cmTemplate.addServicesItem(service);
}
cmTemplate.getHostTemplates().stream().filter(hostTemplate -> hostTemplate.getRefName().equals(hostGroupService.getKey())).forEach(ht -> ht.getRoleConfigGroupsRefNames().addAll(serviceRefNames));
}
}
use of com.cloudera.api.swagger.model.ApiClusterTemplateService in project cloudbreak by hortonworks.
the class CmTemplateProcessor method addRoleConfigs.
public void addRoleConfigs(String serviceType, Map<String, List<ApiClusterTemplateConfig>> newConfigMap) {
Optional<ApiClusterTemplateService> serviceOpt = getServiceByType(serviceType);
if (serviceOpt.isPresent()) {
ApiClusterTemplateService service = serviceOpt.get();
newConfigMap.forEach((configRef, newConfigs) -> service.getRoleConfigGroups().stream().filter(rcg -> rcg.getRefName().equals(configRef)).findFirst().ifPresent(group -> mergeRoleConfigs(group, newConfigs)));
}
}
use of com.cloudera.api.swagger.model.ApiClusterTemplateService 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);
}
Aggregations