I have created a java service to return the meta-data of the S3 objects but in my json response it's not returning the Server-side encryption and Object URL
Here is my code
@GetMapping(value = "/ListS3BucketsObjects")
public List<S3ObjectSummary> ListS3BucketsObjects(@RequestParam String bucketName) {
try {
BasicAWSCredentials creds = new BasicAWSCredentials("xxxx",
"xxxxxxx");
final AmazonS3 s3client = AmazonS3ClientBuilder.standard().withCredentials(new AWSStaticCredentialsProvider(creds))
.withRegion(Regions.US_EAST_1).build();
ObjectListing objectListing = s3client.listObjects(bucketName);
return objectListing.getObjectSummaries();
} catch (Exception Ex) {
throw Ex;
}
}
I'm getting result like this
[
{
"bucketName": "xxxx",
"key": "xx",
"size": 489583,
"lastModified": "2020-01-01T06:59:52.000+0000",
"storageClass": "STANDARD",
"owner": {
"displayName": "xxxxx",
"id": "xxx"
},
"etag": "xxxxx"
}]
how to get the Object URL and Server-side encryption?
Check this answer . Based S3ObjectSummary
you can retrieve metadata:
ObjectMetadata objectMetadata = s3client.getObjectMetadata(bucketName, objectSummary.getKey());
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.