Search in sources :

Example 1 with DRSAccessURL

use of bio.terra.model.DRSAccessURL in project jade-data-repo by DataBiosphere.

the class DrsService method drsObjectFromFSFile.

private DRSObject drsObjectFromFSFile(FSFile fsFile, String snapshotId, AuthenticatedUserRequest authUser) {
    DRSObject fileObject = makeCommonDrsObject(fsFile, snapshotId);
    GoogleBucketResource bucketResource = locationService.lookupBucketMetadata(fsFile.getBucketResourceId());
    DRSAccessURL gsAccessURL = new DRSAccessURL().url(fsFile.getGspath());
    DRSAccessMethod gsAccessMethod = new DRSAccessMethod().type(DRSAccessMethod.TypeEnum.GS).accessUrl(gsAccessURL).region(bucketResource.getRegion());
    DRSAccessURL httpsAccessURL = new DRSAccessURL().url(makeHttpsFromGs(fsFile.getGspath())).headers(makeAuthHeader(authUser));
    DRSAccessMethod httpsAccessMethod = new DRSAccessMethod().type(DRSAccessMethod.TypeEnum.HTTPS).accessUrl(httpsAccessURL).region(bucketResource.getRegion());
    List<DRSAccessMethod> accessMethods = new ArrayList<>();
    accessMethods.add(gsAccessMethod);
    accessMethods.add(httpsAccessMethod);
    fileObject.mimeType(fsFile.getMimeType()).checksums(fileService.makeChecksums(fsFile)).accessMethods(accessMethods);
    return fileObject;
}
Also used : GoogleBucketResource(bio.terra.service.resourcemanagement.google.GoogleBucketResource) DRSAccessMethod(bio.terra.model.DRSAccessMethod) DRSAccessURL(bio.terra.model.DRSAccessURL) ArrayList(java.util.ArrayList) DRSObject(bio.terra.model.DRSObject)

Aggregations

DRSAccessMethod (bio.terra.model.DRSAccessMethod)1 DRSAccessURL (bio.terra.model.DRSAccessURL)1 DRSObject (bio.terra.model.DRSObject)1 GoogleBucketResource (bio.terra.service.resourcemanagement.google.GoogleBucketResource)1 ArrayList (java.util.ArrayList)1