Search in sources :

Example 1 with DataStorageItemType

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

the class S3Helper method getItems.

public DataStorageListing getItems(String bucket, String path, Boolean showVersion, Integer pageSize, String marker) {
    String requestPath = path;
    if (requestPath == null) {
        requestPath = "";
    }
    AmazonS3 client = getDefaultS3Client();
    if (!StringUtils.isNullOrEmpty(requestPath)) {
        DataStorageItemType type = checkItemType(client, bucket, requestPath, showVersion);
        if (type == DataStorageItemType.Folder && !requestPath.endsWith(S3Constants.DELIMITER)) {
            requestPath += S3Constants.DELIMITER;
        }
    }
    DataStorageListing result = showVersion ? listVersions(client, bucket, requestPath, pageSize, marker) : listFiles(client, bucket, requestPath, pageSize, marker);
    result.getResults().sort(AbstractDataStorageItem.getStorageItemComparator());
    return result;
}
Also used : DataStorageListing(com.epam.pipeline.entity.datastorage.DataStorageListing) AmazonS3(com.amazonaws.services.s3.AmazonS3) DataStorageItemType(com.epam.pipeline.entity.datastorage.DataStorageItemType)

Aggregations

AmazonS3 (com.amazonaws.services.s3.AmazonS3)1 DataStorageItemType (com.epam.pipeline.entity.datastorage.DataStorageItemType)1 DataStorageListing (com.epam.pipeline.entity.datastorage.DataStorageListing)1