Old S3 conversion
unknown
plain_text
2 years ago
1.2 kB
9
Indexable
// private static String getPublicAccessibleS3Url() {
//
//// <dependency>
//// <groupId>com.amazonaws</groupId>
//// <artifactId>aws-java-sdk-s3</artifactId>
//// <version>1.12.120</version> <!-- Use the latest version -->
//// </dependency>
//
//// TODO : Add above dependency
//// TODO : Agar constants zyada ho jaaye in MultiGet API to create a constant class as well.
// final AmazonS3 s3Client = new AmazonS3Client(yourAwsCredentials);
// final String bucketName = "your-bucket-name";
// final String objectKey = "your-object-key";
//
// final long expirationMillis = System.currentTimeMillis() + 60 * 60 * 1000; // 1 hour
//
// // Create a request to generate the pre-signed URL
// final GeneratePresignedUrlRequest generatePresignedUrlRequest =
// new GeneratePresignedUrlRequest(bucketName, objectKey)
// .withMethod(HttpMethod.GET)
// .withExpiration(new Date(expirationMillis));
//
// // Generate the pre-signed URL
// final URL preSignedUrl = s3Client.generatePresignedUrl(generatePresignedUrlRequest);
// return preSignedUrl.toString();
// }Editor is loading...
Leave a Comment