amogh-jahagirdar commented on code in PR #8365:
URL: https://github.com/apache/iceberg/pull/8365#discussion_r1303576568
##########
aws/src/main/java/org/apache/iceberg/aws/s3/signer/S3V4RestSignerClient.java:
##########
@@ -328,6 +334,27 @@ public SdkHttpFullRequest sign(
return mutableRequest.build();
}
+ /**
+ * Only add body for DeleteObjectsRequest. Refer to
+ *
https://docs.aws.amazon.com/AmazonS3/latest/API/API_DeleteObjects.html#API_DeleteObjects_RequestSyntax
+ */
+ private String body(SdkHttpFullRequest request) {
+ if (isDeleteObjectsRequest(request) &&
request.contentStreamProvider().isPresent()) {
+ try (InputStream is = request.contentStreamProvider().get().newStream())
{
+ return IoUtils.toUtf8String(is);
+ } catch (IOException e) {
+ throw new UncheckedIOException("Failed to set body for S3 sign
request", e);
+ }
+ }
+
+ return null;
+ }
+
+ private boolean isDeleteObjectsRequest(SdkHttpFullRequest request) {
+ return request.method() == SdkHttpMethod.POST
+ && request.rawQueryParameters().containsKey("delete");
Review Comment:
I did a double pass to make sure there wasn't any other request that could
possibly match this criteria.
As far as getting even more unique, we could actually perform an extraction
of the DeleteObjectsRequest contents from the body (because we know no other
request at the moment would send that). But this is probably too complex for
what it brings considering what we have now looks to be unique already (we
would need to add the jackson XML dependency to the signer client, etc).
Lmk if you have any concerns @danielcweeks @nastra
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]