use of com.epam.pipeline.entity.datastorage.AbstractDataStorage in project cloud-pipeline by epam.
the class FolderTemplateManager method createFolderFromTemplate.
void createFolderFromTemplate(Folder folder, FolderTemplate template) {
folder.setName(template.getName());
Folder savedFolder = crudManager.create(folder);
if (CollectionUtils.isNotEmpty(template.getDatastorages())) {
template.getDatastorages().forEach(storage -> {
storage.setParentFolderId(savedFolder.getId());
AbstractDataStorage created = dataStorageManager.create(storage, true, true, false);
if (!MapUtils.isEmpty(storage.getMetadata())) {
updateMetadata(storage.getMetadata(), new EntityVO(created.getId(), AclClass.DATA_STORAGE));
}
});
}
if (!MapUtils.isEmpty(template.getMetadata())) {
updateMetadata(template.getMetadata(), new EntityVO(savedFolder.getId(), AclClass.FOLDER));
}
if (CollectionUtils.isNotEmpty(template.getChildren())) {
template.getChildren().forEach(child -> {
Folder childFolder = new Folder();
childFolder.setParentId(folder.getId());
createFolderFromTemplate(childFolder, child);
});
}
if (CollectionUtils.isNotEmpty(template.getPermissions())) {
template.getPermissions().forEach(permission -> {
PermissionGrantVO permissionGrantVO = permissionGrantVOMapper.toPermissionGrantVO(permission);
permissionGrantVO.setId(savedFolder.getId());
permissionGrantVO.setAclClass(AclClass.FOLDER);
permissionManager.setPermissions(permissionGrantVO);
});
}
}
use of com.epam.pipeline.entity.datastorage.AbstractDataStorage in project cloud-pipeline by epam.
the class PipelineConfigurationManager method getPipelineConfiguration.
public PipelineConfiguration getPipelineConfiguration(final PipelineStart runVO, final Tool tool) {
PipelineConfiguration configuration;
PipelineConfiguration defaultConfiguration = new PipelineConfiguration();
boolean toolRun = tool != null;
boolean pipelineRun = runVO.getPipelineId() != null;
if (toolRun || pipelineRun) {
defaultConfiguration = getConfigurationForToolRunOrPipelineRun(runVO, tool, toolRun);
}
configuration = mergeParameters(runVO, defaultConfiguration);
if (pipelineRun) {
configuration.setGitCredentials(gitManager.getGitCredentials(runVO.getPipelineId()));
}
if (toolRun) {
mergeParametersFromTool(configuration, tool);
}
List<AbstractDataStorage> dataStorages = dataStorageApiService.getWritableStorages();
configuration.setBuckets(zipToString(dataStorages, AbstractDataStorage::getPathMask));
configuration.setNfsMountOptions(zipToString(dataStorages, mountOptionsSupplier));
configuration.setMountPoints(zipToString(dataStorages, AbstractDataStorage::getMountPoint));
// client always sends actual node count value
configuration.setNodeCount(Optional.ofNullable(runVO.getNodeCount()).orElse(0));
configuration.setAwsRegionId(runVO.getAwsRegionId());
setEndpointsErasure(configuration);
return configuration;
}
use of com.epam.pipeline.entity.datastorage.AbstractDataStorage in project cloud-pipeline by epam.
the class DataStorageDaoTest method shouldLoadExistingS3StorageByName.
@Test
public void shouldLoadExistingS3StorageByName() {
dataStorageDao.createDataStorage(s3Bucket);
AbstractDataStorage loaded = dataStorageDao.loadDataStorageByNameOrPath(TEST_STORAGE_NAME, null);
validateS3Storage(loaded, s3Bucket);
}
use of com.epam.pipeline.entity.datastorage.AbstractDataStorage in project cloud-pipeline by epam.
the class DataStorageDaoTest method shouldLoadStorageWithFolders.
@Test
public void shouldLoadStorageWithFolders() {
Folder root = buildFolder(null);
root.setParentId(0L);
Folder folder = buildFolder(root.getId());
folder.setParent(root);
Folder parent = buildFolder(folder.getId());
parent.setParent(folder);
s3Bucket.setParentFolderId(parent.getId());
dataStorageDao.createDataStorage(s3Bucket);
AbstractDataStorage loaded = dataStorageDao.loadStorageWithParents(s3Bucket.getId());
validateCommonStorage(loaded, s3Bucket);
verifyFolderTree(parent, loaded.getParent());
}
use of com.epam.pipeline.entity.datastorage.AbstractDataStorage in project cloud-pipeline by epam.
the class DataStorageDaoTest method shouldLoadExistingS3StorageById.
@Test
public void shouldLoadExistingS3StorageById() {
dataStorageDao.createDataStorage(s3Bucket);
AbstractDataStorage loaded = dataStorageDao.loadDataStorage(s3Bucket.getId());
validateS3Storage(loaded, s3Bucket);
}
Aggregations