use of com.cloudera.api.swagger.model.ApiClusterTemplateConfig in project cloudbreak by hortonworks.
the class CmHostGroupRoleConfigProviderProcessor method generateConfigs.
@VisibleForTesting
Map<String, Map<String, List<ApiClusterTemplateConfig>>> generateConfigs(CmTemplateProcessor templateProcessor, TemplatePreparationObject source) {
Map<String, Map<String, List<ApiClusterTemplateConfig>>> configsByRoleConfigGroup = new HashMap<>();
Map<String, HostgroupView> hostGroups = source.getHostgroupViews().stream().collect(toMap(HostgroupView::getName, Function.identity()));
List<ApiClusterTemplateHostTemplate> hostTemplates = getHostTemplates(templateProcessor);
Map<String, ServiceComponent> serviceComponents = templateProcessor.mapRoleRefsToServiceComponents();
for (ApiClusterTemplateHostTemplate hostTemplate : hostTemplates) {
String hostGroupName = hostTemplate.getRefName();
List<String> roleConfigGroups = ofNullable(hostTemplate.getRoleConfigGroupsRefNames()).orElseGet(List::of);
HostgroupView hostgroupView = hostGroups.get(hostGroupName);
groupByHostGroupName(source, configsByRoleConfigGroup, serviceComponents, hostGroupName, roleConfigGroups, hostgroupView);
}
return configsByRoleConfigGroup;
}
use of com.cloudera.api.swagger.model.ApiClusterTemplateConfig in project cloudbreak by hortonworks.
the class KnoxGatewayConfigProvider method getDefaultsIfRequired.
private Set<ApiClusterTemplateConfig> getDefaultsIfRequired(TemplatePreparationObject source) {
Set<ApiClusterTemplateConfig> apiClusterTemplateConfigs = new HashSet<>();
Optional<ClouderaManagerProduct> cdhProduct = getCdhProduct(source);
if (cdhProduct.isPresent() && source.getProductDetailsView() != null) {
String cdhVersion = cdhProduct.get().getVersion().split("-")[0];
ClouderaManagerRepo clouderaManagerRepoDetails = source.getProductDetailsView().getCm();
if (tokenServiceSupported(cdhVersion, clouderaManagerRepoDetails)) {
Optional<String> accountId = source.getGeneralClusterConfigs().getAccountId();
if (accountId.isPresent() && !entitlementService.isOjdbcTokenDhOneHour(accountId.get())) {
apiClusterTemplateConfigs.add(config(GATEWAY_TOKEN_GENERATION_KNOX_TOKEN_TTL, GATEWAY_TOKEN_GENERATION_KNOX_TOKEN_TTL_ONE_DAY));
apiClusterTemplateConfigs.add(config(GATEWAY_TOKEN_GENERATION_ENABLE_LIFESPAN_INPUT, GATEWAY_TOKEN_GENERATION_ENABLE_LIFESPAN_INPUT_TRUE));
}
}
}
return apiClusterTemplateConfigs;
}
use of com.cloudera.api.swagger.model.ApiClusterTemplateConfig in project cloudbreak by hortonworks.
the class KnoxIdBrokerConfigProvider method getRoleConfigs.
@Override
protected List<ApiClusterTemplateConfig> getRoleConfigs(String roleType, TemplatePreparationObject source) {
switch(roleType) {
case IDBROKER:
List<ApiClusterTemplateConfig> config;
AccountMappingView accountMappingView = source.getAccountMappingView() == null ? AccountMappingView.EMPTY_MAPPING : source.getAccountMappingView();
String userMappings = getAccountMappingSetting(accountMappingView.getUserMappings());
String groupMappings = getAccountMappingSetting(accountMappingView.getGroupMappings());
switch(getCloudPlatform(source)) {
case AWS:
config = List.of(config("idbroker_aws_user_mapping", userMappings), config("idbroker_aws_group_mapping", groupMappings));
break;
case AZURE:
config = new ArrayList<>(List.of(config("idbroker_azure_user_mapping", userMappings), config("idbroker_azure_group_mapping", groupMappings)));
ClouderaManagerRepo cmRepo = source.getProductDetailsView().getCm();
if (CMRepositoryVersionUtil.isIdBrokerManagedIdentitySupported(cmRepo)) {
String idBrokerManagedIdentity = getIdBrokerManagedIdentity(source.getFileSystemConfigurationView());
if (Objects.nonNull(idBrokerManagedIdentity)) {
config.add(config("idbroker_azure_vm_assumer_identity", idBrokerManagedIdentity));
}
}
break;
case GCP:
config = List.of(config("idbroker_gcp_user_mapping", userMappings), config("idbroker_gcp_group_mapping", groupMappings));
break;
default:
config = List.of();
break;
}
return config;
default:
return List.of();
}
}
use of com.cloudera.api.swagger.model.ApiClusterTemplateConfig in project cloudbreak by hortonworks.
the class KnoxServiceConfigProvider method getServiceConfigs.
@Override
public List<ApiClusterTemplateConfig> getServiceConfigs(CmTemplateProcessor templateProcessor, TemplatePreparationObject source) {
List<ApiClusterTemplateConfig> configList = new ArrayList<>();
if (source.getProductDetailsView() != null && isKnoxDatabaseSupported(source.getProductDetailsView().getCm(), getCdhProduct(source), getCdhPatchVersion(source))) {
RdsView knoxGatewayRdsView = getRdsView(source);
configList.add(config(DATABASE_TYPE, knoxGatewayRdsView.getSubprotocol()));
configList.add(config(DATABASE_NAME, knoxGatewayRdsView.getDatabaseName()));
configList.add(config(DATABASE_HOST, knoxGatewayRdsView.getHost()));
configList.add(config(DATABASE_PORT, knoxGatewayRdsView.getPort()));
configList.add(config(DATABASE_USER, knoxGatewayRdsView.getConnectionUserName()));
configList.add(config(DATABASE_PASSWORD, knoxGatewayRdsView.getConnectionPassword()));
}
configList.add(config(KNOX_AUTORESTART_ON_STOP, Boolean.TRUE.toString()));
return configList;
}
use of com.cloudera.api.swagger.model.ApiClusterTemplateConfig in project cloudbreak by hortonworks.
the class NifiConfigProvider method getServiceConfigs.
@Override
public List<ApiClusterTemplateConfig> getServiceConfigs(CmTemplateProcessor templateProcessor, TemplatePreparationObject source) {
List<ApiClusterTemplateConfig> configList = new ArrayList<>();
String cdhVersion = source.getBlueprintView().getProcessor().getStackVersion() == null ? "" : source.getBlueprintView().getProcessor().getStackVersion();
if (isVersionNewerOrEqualThanLimited(cdhVersion, CLOUDERAMANAGER_VERSION_7_1_0)) {
VirtualGroupRequest virtualGroupRequest = source.getVirtualGroupRequest();
String adminGroup = virtualGroupService.createOrGetVirtualGroup(virtualGroupRequest, UmsVirtualGroupRight.NIFI_ADMIN);
configList.add(config("nifi.initial.admin.groups", adminGroup));
rangerAutoCompleteConfigProvider.extendServiceConfigs(source, configList);
}
return configList;
}
Aggregations