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

 ##########
 File path: 
hadoop-tools/hadoop-azure/src/main/java/org/apache/hadoop/fs/azurebfs/services/AbfsClient.java
 ##########
 @@ -266,17 +299,29 @@ public AbfsRestOperation createPath(final String path, 
final boolean isFile, fin
     return op;
   }
 
-  public AbfsRestOperation renamePath(final String source, final String 
destination, final String continuation)
+  public AbfsRestOperation renamePath(String source, final String destination, 
final String continuation)
           throws AzureBlobFileSystemException {
     final List<AbfsHttpHeader> requestHeaders = createDefaultHeaders();
+    String sasToken = "";
+
+    if (authType == AuthType.SAS) {
+      final AbfsUriQueryBuilder queryBuilder = new AbfsUriQueryBuilder();
+      appendSASTokenToQuery(source, SASTokenProvider.RENAME_SOURCE_OPERATION, 
queryBuilder);
+      sasToken = queryBuilder.toString();
+    }
 
-    final String encodedRenameSource = urlEncode(FORWARD_SLASH + 
this.getFileSystem() + source);
+    final String encodedRenameSource =
+        urlEncode(FORWARD_SLASH + this.getFileSystem() + source) + sasToken;
     requestHeaders.add(new AbfsHttpHeader(X_MS_RENAME_SOURCE, 
encodedRenameSource));
     requestHeaders.add(new AbfsHttpHeader(IF_NONE_MATCH, STAR));
 
     final AbfsUriQueryBuilder abfsUriQueryBuilder = 
createDefaultUriQueryBuilder();
     abfsUriQueryBuilder.addQuery(QUERY_PARAM_CONTINUATION, continuation);
 
+    if (authType == AuthType.SAS) {
 
 Review comment:
   this is replicated enough it should be its own method, e.g
   
   ```
   maybeAppendSASToken(path, operation, querybuilder)
    if (authType=SAS) {
      appendSASTokenToQuery(path, SASTokenProvider.RENAME_SOURCE_OPERATION, 
queryBuilder);
    }
   ```
   
   and use wherever needed

----------------------------------------------------------------
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]


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to