ivandika3 commented on code in PR #6756:
URL: https://github.com/apache/ozone/pull/6756#discussion_r1836284210
##########
hadoop-ozone/s3gateway/src/main/java/org/apache/hadoop/ozone/s3/endpoint/ObjectEndpoint.java:
##########
@@ -1381,6 +1412,75 @@ public static boolean checkCopySourceModificationTime(
(lastModificationTime <= copySourceIfUnmodifiedSince);
}
+ private Response putObjectTagging(OzoneVolume volume, String bucketName,
String keyName, InputStream body)
+ throws IOException, OS3Exception {
+ long startNanos = Time.monotonicNowNanos();
+ S3Tagging tagging = null;
+ try {
+ tagging = new PutTaggingUnmarshaller().readFrom(body);
+ tagging.validate();
+ } catch (WebApplicationException ex) {
+ OS3Exception exception =
S3ErrorTable.newError(S3ErrorTable.MALFORMED_XML, keyName);
+ exception.setErrorMessage(exception.getErrorMessage() + ". " +
ex.getMessage());
+ throw exception;
+ }
+
+ Map<String, String> tags = validateAndGetTagging(
+ tagging.getTagSet().getTags(), // Nullity check was done in previous
parsing step
+ Tag::getKey,
+ Tag::getValue
+ );
+
+ try {
+ volume.getBucket(bucketName).putObjectTagging(keyName, tags);
+ } catch (OMException ex) {
+ if (ex.getResult() == ResultCodes.INVALID_REQUEST) {
+ throw S3ErrorTable.newError(S3ErrorTable.INVALID_REQUEST, bucketName);
+ } else if (ex.getResult() == ResultCodes.PERMISSION_DENIED) {
+ throw S3ErrorTable.newError(S3ErrorTable.ACCESS_DENIED, bucketName);
+ } else if (ex.getResult() == ResultCodes.KEY_NOT_FOUND) {
+ throw S3ErrorTable.newError(S3ErrorTable.NO_SUCH_KEY, keyName);
+ } else if (ex.getResult() == ResultCodes.NOT_SUPPORTED_OPERATION) {
+ // When putObjectTagging operation is applied on FSO directory
+ throw S3ErrorTable.newError(S3ErrorTable.NOT_IMPLEMENTED, keyName);
+ }
Review Comment:
Thanks for catching it. Updated.
--
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]