use of com.sequenceiq.cloudbreak.domain.LdapConfig in project cloudbreak by hortonworks.
the class StackRequestToBlueprintPreparationObjectConverter method convert.
@Override
public BlueprintPreparationObject convert(StackV2Request source) {
try {
IdentityUser identityUser = userDetailsService.getDetails(source.getOwner(), UserFilterField.USERID);
FlexSubscription flexSubscription = getFlexSubscription(source);
String smartsenseSubscriptionId = getSmartsenseSubscriptionId(source, flexSubscription);
KerberosConfig kerberosConfig = getKerberosConfig(source);
LdapConfig ldapConfig = getLdapConfig(source, identityUser);
FileSystemConfigurationView fileSystemConfigurationView = getFileSystemConfigurationView(source);
Set<RDSConfig> rdsConfigs = getRdsConfigs(source, identityUser);
Blueprint blueprint = getBlueprint(source, identityUser);
BlueprintStackInfo blueprintStackInfo = stackInfoService.blueprintStackInfo(blueprint.getBlueprintText());
Set<HostgroupView> hostgroupViews = getHostgroupViews(source);
BlueprintView blueprintView = new BlueprintView(blueprint.getBlueprintText(), blueprintStackInfo.getVersion(), blueprintStackInfo.getType());
GeneralClusterConfigs generalClusterConfigs = generalClusterConfigsProvider.generalClusterConfigs(source, identityUser);
return BlueprintPreparationObject.Builder.builder().withFlexSubscription(flexSubscription).withRdsConfigs(rdsConfigs).withHostgroupViews(hostgroupViews).withBlueprintView(blueprintView).withStackRepoDetailsHdpVersion(blueprintStackInfo.getVersion()).withFileSystemConfigurationView(fileSystemConfigurationView).withGeneralClusterConfigs(generalClusterConfigs).withSmartSenseSubscriptionId(smartsenseSubscriptionId).withLdapConfig(ldapConfig).withKerberosConfig(kerberosConfig).build();
} catch (BlueprintProcessingException e) {
throw new CloudbreakServiceException(e.getMessage(), e);
} catch (IOException e) {
throw new CloudbreakServiceException(e.getMessage(), e);
}
}
use of com.sequenceiq.cloudbreak.domain.LdapConfig in project cloudbreak by hortonworks.
the class StackToBlueprintPreparationObjectConverter method convert.
@Override
public BlueprintPreparationObject convert(Stack source) {
try {
Optional<SmartSenseSubscription> aDefault = smartSenseSubscriptionService.getDefault();
Cluster cluster = clusterService.getById(source.getCluster().getId());
FileSystem fileSystem = cluster.getFileSystem();
LdapConfig ldapConfig = cluster.getLdapConfig();
StackRepoDetails hdpRepo = clusterComponentConfigProvider.getHDPRepo(cluster.getId());
String stackRepoDetailsHdpVersion = hdpRepo != null ? hdpRepo.getHdpVersion() : null;
Map<String, List<InstanceMetaData>> groupInstances = instanceGroupMetadataCollector.collectMetadata(source);
HdfConfigs hdfConfigs = hdfConfigProvider.createHdfConfig(cluster.getHostGroups(), groupInstances, cluster.getBlueprint().getBlueprintText());
BlueprintStackInfo blueprintStackInfo = stackInfoService.blueprintStackInfo(cluster.getBlueprint().getBlueprintText());
FileSystemConfigurationView fileSystemConfigurationView = null;
if (source.getCluster().getFileSystem() != null) {
fileSystemConfigurationView = new FileSystemConfigurationView(fileSystemConfigurationProvider.fileSystemConfiguration(fileSystem, source), fileSystem == null ? false : fileSystem.isDefaultFs());
}
IdentityUser identityUser = userDetailsService.getDetails(cluster.getOwner(), UserFilterField.USERID);
return BlueprintPreparationObject.Builder.builder().withFlexSubscription(source.getFlexSubscription()).withRdsConfigs(postgresConfigService.createRdsConfigIfNeeded(source, cluster)).withHostgroups(hostGroupService.getByCluster(cluster.getId())).withGateway(cluster.getGateway()).withBlueprintView(new BlueprintView(cluster, blueprintStackInfo)).withStackRepoDetailsHdpVersion(stackRepoDetailsHdpVersion).withFileSystemConfigurationView(fileSystemConfigurationView).withGeneralClusterConfigs(generalClusterConfigsProvider.generalClusterConfigs(source, cluster, identityUser)).withSmartSenseSubscriptionId(aDefault.isPresent() ? aDefault.get().getSubscriptionId() : null).withLdapConfig(ldapConfig).withHdfConfigs(hdfConfigs).withKerberosConfig(cluster.isSecure() ? cluster.getKerberosConfig() : null).build();
} catch (BlueprintProcessingException e) {
throw new CloudbreakServiceException(e.getMessage(), e);
} catch (IOException e) {
throw new CloudbreakServiceException(e.getMessage(), e);
}
}
use of com.sequenceiq.cloudbreak.domain.LdapConfig in project cloudbreak by hortonworks.
the class ClusterDecorator method prepareLdap.
private void prepareLdap(Cluster subject, IdentityUser user, Long ldapConfigId, LdapConfigRequest ldapConfigRequest, String ldapName, Stack stack) {
if (ldapConfigId != null) {
LdapConfig ldapConfig = ldapConfigService.get(ldapConfigId);
subject.setLdapConfig(ldapConfig);
} else if (ldapName != null) {
LdapConfig ldapConfig = ldapConfigService.getPublicConfig(ldapName, user);
subject.setLdapConfig(ldapConfig);
} else if (ldapConfigRequest != null) {
LdapConfig ldapConfig = conversionService.convert(ldapConfigRequest, LdapConfig.class);
ldapConfig.setPublicInAccount(stack.isPublicInAccount());
ldapConfigValidator.validateLdapConnection(ldapConfig);
ldapConfig = ldapConfigService.create(user, ldapConfig);
subject.setLdapConfig(ldapConfig);
}
}
use of com.sequenceiq.cloudbreak.domain.LdapConfig in project cloudbreak by hortonworks.
the class LdapConfigService method get.
public LdapConfig get(Long id) {
LdapConfig ldapConfig = ldapConfigRepository.findOne(id);
if (ldapConfig == null) {
throw new NotFoundException(String.format("LdapConfig '%s' not found", id));
}
authorizationService.hasReadPermission(ldapConfig);
return ldapConfig;
}
use of com.sequenceiq.cloudbreak.domain.LdapConfig in project cloudbreak by hortonworks.
the class LdapConfigService method delete.
public void delete(String name, IdentityUser user) {
LdapConfig ldapConfig = ldapConfigRepository.findByNameInAccount(name, user.getAccount());
if (ldapConfig == null) {
throw new NotFoundException(String.format("LdapConfig '%s' not found.", name));
}
delete(ldapConfig);
}
Aggregations