79161004

Date: 2024-11-05 23:50:47
Score: 1
Natty:
Report link

how would you replicate what the Java code above is doing but in an S3 context

Essentially all you need to do is this:

AmazonS3Client client = ...;
String bucketName = "...";
ObjectMetadata meta = client.getObjectMetadata(bucketName, path);

The getObjectMetadata call will fail if the path does not exist (throwing an Exception)

Ref: https://docs.aws.amazon.com/AWSJavaSDK/latest/javadoc/com/amazonaws/services/s3/AmazonS3Client.html#getObjectMetadata-java.lang.String-java.lang.String-

Reasons:
  • Blacklisted phrase (1): how would you
  • Probably link only (1):
  • Has code block (-0.5):
  • Starts with a question (0.5): how would you
  • High reputation (-1):
Posted by: AndrewL