snvijaya commented on a change in pull request #1842: HADOOP-16730 : ABFS: Add 
Authorizer Interface
URL: https://github.com/apache/hadoop/pull/1842#discussion_r379374836
 
 

 ##########
 File path: 
hadoop-tools/hadoop-azure/src/main/java/org/apache/hadoop/fs/azurebfs/constants/AbfsAuthorizerConstants.java
 ##########
 @@ -0,0 +1,90 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.hadoop.fs.azurebfs.constants;
+
+import 
org.apache.hadoop.fs.azurebfs.contracts.exceptions.InvalidAbfsRestOperationException;
+import org.apache.hadoop.fs.azurebfs.services.AbfsRestOperationType;
+
+/**
+ * Defines the string literals that need to be set to authorizer as action
+ */
+public class AbfsAuthorizerConstants {
+
+  public static final String RENAME_SOURCE_ACTION = "rename-source";
+  public static final String RENAME_DESTINATION_ACTION = "rename-destination";
+
+  public static final String CONCAT_SOURCE_ACTION = "concat-source";
+  public static final String CONCAT_TARGET_ACTION = "concat-target";
+
+  public static final String CHECKACCESS_ACTION_PREFIX_ACTION = "access-";
+
+  public static final String LISTSTATUS_ACTION = "liststatus";
+  public static final String DELETE_ACTION = "delete";
+  public static final String CREATEFILE_ACTION = "create";
+  public static final String MKDIR_ACTION = "mkdir";
+  public static final String GETACL_ACTION = "getaclstatus";
+  public static final String GETFILESTATUS_ACTION = "getfilestatus";
+  public static final String SETACL_ACTION = "setacl"; // Modify, removeacl,
+  // setacl
+  public static final String SETOWNER_ACTION = "setowner";
+  public static final String SETPERMISSION_ACTION = "setpermission";
+  public static final String APPEND_ACTION = "write";
+  public static final String READ_ACTION = "read";
+  public static final String EXECUTE_ACTION = "execute";
+
+  /**
+   * Converts AbfsRestOperation to Authorizer action
+   * @param opType
+   * @return
+   */
+  public static String getAction(AbfsRestOperationType opType)
+      throws InvalidAbfsRestOperationException {
+    switch (opType) {
+    case ListPaths:
+      return LISTSTATUS_ACTION;
+    case RenamePath:
+      return RENAME_DESTINATION_ACTION;
+    case GetAcl:
+      return GETACL_ACTION;
+    case GetPathStatus:
+      return GETFILESTATUS_ACTION;
+    case SetAcl:
+      return SETACL_ACTION;
+    case SetOwner:
+      return SETOWNER_ACTION;
+    case SetPermissions:
+      return SETPERMISSION_ACTION;
+    case Append:
+    case Flush:
+      return APPEND_ACTION;
+    case ReadFile:
+      return READ_ACTION;
+    case DeletePath:
+      return DELETE_ACTION;
+    case CreatePath:
+      return CREATEFILE_ACTION;
+    case Mkdir:
+      return MKDIR_ACTION;
+    default:
+      throw new InvalidAbfsRestOperationException(
 
 Review comment:
   Seems like the right place to check for invalid operation type. Retaining it.

----------------------------------------------------------------
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:
us...@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: common-issues-unsubscr...@hadoop.apache.org
For additional commands, e-mail: common-issues-h...@hadoop.apache.org

Reply via email to