Untitled
unknown
plain_text
4 years ago
819 B
4
Indexable
private static URL generatePresignedUrl(String bucketName, String objectKey) { // TODO 6: Replace the solution with your own code // return Solution.generatePresignedUrl(s3ClientForStudentBuckets, bucketName, objectKey); // Set the presigned URL to expire after one hour. java.util.Date expiration = new java.util.Date(); long expTimeMillis = Instant.now().toEpochMilli(); expTimeMillis += 1000 * 60 * 15; expiration.setTime(expTimeMillis); GeneratePresignedUrlRequest generatePresignedUrlRequest = new GeneratePresignedUrlRequest(bucketName, objectKey) .withMethod(HttpMethod.GET) .withExpiration(expiration); return s3ClientForStudentBuckets.generatePresignedUrl(generatePresignedUrlRequest); }
Editor is loading...