Search in sources :

Example 1 with DataStorageDownloadFileUrl

use of com.epam.pipeline.entity.datastorage.DataStorageDownloadFileUrl in project cloud-pipeline by epam.

the class DataStorageManager method generateDataStorageItemUploadUrl.

public List<DataStorageDownloadFileUrl> generateDataStorageItemUploadUrl(Long id, List<String> paths) {
    AbstractDataStorage dataStorage = load(id);
    List<DataStorageDownloadFileUrl> urls = new ArrayList<>();
    if (paths == null) {
        return urls;
    }
    paths.forEach(path -> urls.add(storageProviderManager.generateDataStorageItemUploadUrl(dataStorage, path)));
    return urls;
}
Also used : AbstractDataStorage(com.epam.pipeline.entity.datastorage.AbstractDataStorage) ArrayList(java.util.ArrayList) DataStorageDownloadFileUrl(com.epam.pipeline.entity.datastorage.DataStorageDownloadFileUrl)

Example 2 with DataStorageDownloadFileUrl

use of com.epam.pipeline.entity.datastorage.DataStorageDownloadFileUrl in project cloud-pipeline by epam.

the class DataStorageManager method generateDataStorageItemUrl.

public List<DataStorageDownloadFileUrl> generateDataStorageItemUrl(final Long dataStorageId, final List<String> paths) {
    AbstractDataStorage dataStorage = load(dataStorageId);
    List<DataStorageDownloadFileUrl> urls = new ArrayList<>();
    if (paths == null) {
        return urls;
    }
    paths.forEach(path -> urls.add(storageProviderManager.generateDownloadURL(dataStorage, path, null)));
    return urls;
}
Also used : AbstractDataStorage(com.epam.pipeline.entity.datastorage.AbstractDataStorage) ArrayList(java.util.ArrayList) DataStorageDownloadFileUrl(com.epam.pipeline.entity.datastorage.DataStorageDownloadFileUrl)

Example 3 with DataStorageDownloadFileUrl

use of com.epam.pipeline.entity.datastorage.DataStorageDownloadFileUrl in project cloud-pipeline by epam.

the class NFSStorageProvider method generateDownloadURL.

@Override
public DataStorageDownloadFileUrl generateDownloadURL(NFSDataStorage dataStorage, String path, String version) {
    String baseApiHostExternal = preferenceManager.getPreference(SystemPreferences.BASE_API_HOST_EXTERNAL);
    String baseApiHost = StringUtils.isNotBlank(baseApiHostExternal) ? baseApiHostExternal : preferenceManager.getPreference(SystemPreferences.BASE_API_HOST);
    if (StringUtils.isBlank(baseApiHost)) {
        throw new IllegalArgumentException(String.format("Cannot generate URL: preference %s or %s is not set", SystemPreferences.BASE_API_HOST.getKey(), SystemPreferences.BASE_API_HOST_EXTERNAL.getKey()));
    }
    DataStorageDownloadFileUrl url = new DataStorageDownloadFileUrl();
    url.setUrl(baseApiHost + "datastorage/" + dataStorage.getId() + "/download?path=" + path);
    return url;
}
Also used : DataStorageDownloadFileUrl(com.epam.pipeline.entity.datastorage.DataStorageDownloadFileUrl)

Example 4 with DataStorageDownloadFileUrl

use of com.epam.pipeline.entity.datastorage.DataStorageDownloadFileUrl in project cloud-pipeline by epam.

the class S3Helper method generatePresignedUrl.

private DataStorageDownloadFileUrl generatePresignedUrl(AmazonS3 client, Date expires, String tagValue, GeneratePresignedUrlRequest request) {
    URL url = client.generatePresignedUrl(request);
    DataStorageDownloadFileUrl dataStorageDownloadFileUrl = new DataStorageDownloadFileUrl();
    dataStorageDownloadFileUrl.setUrl(url.toExternalForm());
    dataStorageDownloadFileUrl.setExpires(expires);
    dataStorageDownloadFileUrl.setTagValue(tagValue);
    return dataStorageDownloadFileUrl;
}
Also used : DataStorageDownloadFileUrl(com.epam.pipeline.entity.datastorage.DataStorageDownloadFileUrl) URL(java.net.URL)

Aggregations

DataStorageDownloadFileUrl (com.epam.pipeline.entity.datastorage.DataStorageDownloadFileUrl)4 AbstractDataStorage (com.epam.pipeline.entity.datastorage.AbstractDataStorage)2 ArrayList (java.util.ArrayList)2 URL (java.net.URL)1