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;
}
Aggregations