use of com.cloudera.api.swagger.model.ApiClusterTemplateRoleConfigGroup 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.ApiClusterTemplateRoleConfigGroup 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);
}
use of com.cloudera.api.swagger.model.ApiClusterTemplateRoleConfigGroup in project cloudbreak by hortonworks.
the class KnoxGatewayConfigProvider method createBaseKnoxService.
private ApiClusterTemplateService createBaseKnoxService() {
ApiClusterTemplateService knox = new ApiClusterTemplateService().serviceType(KnoxRoles.KNOX).refName(KNOX_SERVICE_REF_NAME);
ApiClusterTemplateRoleConfigGroup knoxGateway = new ApiClusterTemplateRoleConfigGroup().roleType(KnoxRoles.KNOX_GATEWAY).base(true).refName(KNOX_GATEWAY_REF_NAME);
knox.roleConfigGroups(List.of(knoxGateway));
return knox;
}
use of com.cloudera.api.swagger.model.ApiClusterTemplateRoleConfigGroup in project cloudbreak by hortonworks.
the class AbstractRoleConfigProvider method getRoleConfigs.
@Override
public Map<String, List<ApiClusterTemplateConfig>> getRoleConfigs(CmTemplateProcessor cmTemplate, TemplatePreparationObject source) {
Optional<ApiClusterTemplateService> service = cmTemplate.getServiceByType(getServiceType());
if (service.isEmpty()) {
return Map.of();
}
Map<String, List<ApiClusterTemplateConfig>> configs = new HashMap<>();
for (ApiClusterTemplateRoleConfigGroup rcg : ofNullable(service.get().getRoleConfigGroups()).orElse(new ArrayList<>())) {
String roleType = rcg.getRoleType();
if (roleType != null && getRoleTypes().contains(roleType)) {
configs.put(rcg.getRefName(), getRoleConfigs(roleType, source));
}
}
return configs;
}
use of com.cloudera.api.swagger.model.ApiClusterTemplateRoleConfigGroup in project cloudbreak by hortonworks.
the class CoreConfigProvider method createBaseCoreSettingsService.
private ApiClusterTemplateService createBaseCoreSettingsService() {
ApiClusterTemplateService coreSettings = new ApiClusterTemplateService().serviceType(CORE_SETTINGS).refName(CORE_SETTINGS_SERVICE_REF_NAME);
ApiClusterTemplateRoleConfigGroup coreSettingsRole = new ApiClusterTemplateRoleConfigGroup().roleType(STORAGEOPERATIONS).base(true).refName(CORE_SETTINGS_REF_NAME);
coreSettings.roleConfigGroups(List.of(coreSettingsRole));
return coreSettings;
}
Aggregations