xiaoyuyao commented on a change in pull request #1701:
URL: https://github.com/apache/ozone/pull/1701#discussion_r552910908
##########
File path:
hadoop-ozone/client/src/main/java/org/apache/hadoop/ozone/client/OzoneVolume.java
##########
@@ -261,7 +270,37 @@ public Instant getModificationTime() {
* @return aclMap
*/
public List<OzoneAcl> getAcls() {
- return acls;
+ return (ArrayList)((ArrayList)acls).clone();
+ }
+
+ /**
+ * Adds ACLs to the volume.
+ * @param addAcl ACL to be added
+ * @return true - if acl is successfully added, false if acl already exists
+ * for the bucket.
+ * @throws IOException
+ */
+ public boolean addAcl(OzoneAcl addAcl) throws IOException {
Review comment:
Do we need volume acl APIs for s3g?
##########
File path:
hadoop-ozone/s3gateway/src/main/java/org/apache/hadoop/ozone/s3/endpoint/BucketEndpoint.java
##########
@@ -75,7 +87,7 @@
@GET
@SuppressFBWarnings
@SuppressWarnings("parameternumber")
- public Response list(
+ public Response get(
Review comment:
Does this change the semantics of the get/list for bucket endpoint?
##########
File path:
hadoop-ozone/s3gateway/src/main/java/org/apache/hadoop/ozone/s3/endpoint/BucketEndpoint.java
##########
@@ -353,6 +375,215 @@ public MultiDeleteResponse
multiDelete(@PathParam("bucket") String bucketName,
return result;
}
+ /**
+ * Implement acl get.
+ * <p>
+ * see: https://docs.aws.amazon.com/AmazonS3/latest/API/API_GetBucketAcl.html
+ */
+ public S3BucketAcl getAcl(String bucketName)
+ throws OS3Exception, IOException {
+ S3BucketAcl result = new S3BucketAcl();
+ try {
+ OzoneBucket bucket = getBucket(bucketName);
+ OzoneVolume volume = getVolume();
+ S3Owner owner = new S3Owner(volume.getOwner(), volume.getOwner());
Review comment:
Can you add a TODO to support bucket owner here?
##########
File path:
hadoop-ozone/client/src/main/java/org/apache/hadoop/ozone/client/OzoneVolume.java
##########
@@ -261,7 +270,37 @@ public Instant getModificationTime() {
* @return aclMap
*/
public List<OzoneAcl> getAcls() {
- return acls;
+ return (ArrayList)((ArrayList)acls).clone();
Review comment:
NIT: can we use apache common ListUtils.unmodifiableList here?
##########
File path:
hadoop-ozone/s3gateway/src/main/java/org/apache/hadoop/ozone/s3/endpoint/BucketEndpoint.java
##########
@@ -353,6 +375,215 @@ public MultiDeleteResponse
multiDelete(@PathParam("bucket") String bucketName,
return result;
}
+ /**
+ * Implement acl get.
+ * <p>
+ * see: https://docs.aws.amazon.com/AmazonS3/latest/API/API_GetBucketAcl.html
+ */
+ public S3BucketAcl getAcl(String bucketName)
+ throws OS3Exception, IOException {
+ S3BucketAcl result = new S3BucketAcl();
+ try {
+ OzoneBucket bucket = getBucket(bucketName);
+ OzoneVolume volume = getVolume();
+ S3Owner owner = new S3Owner(volume.getOwner(), volume.getOwner());
+ result.setOwner(owner);
+ // Use set to remove ACLs with different scopes(ACCESS and DEFAULT)
+ Set<Grant> grantSet = new HashSet<>();
+ // Return ACL list
+ for (OzoneAcl acl : bucket.getAcls()) {
+ List<Grant> grants = S3Acl.ozoneNativeAclToS3Acl(acl);
Review comment:
The Ozone Bucket acl should not have duplicate entries. Can we use the
list directly with the the list->set->list conversion?
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]