[ 
https://issues.apache.org/jira/browse/HADOOP-19802?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=18060289#comment-18060289
 ] 

ASF GitHub Bot commented on HADOOP-19802:
-----------------------------------------

anmolanmol1234 commented on code in PR #8229:
URL: https://github.com/apache/hadoop/pull/8229#discussion_r2840011417


##########
hadoop-tools/hadoop-azure/src/main/java/org/apache/hadoop/fs/azurebfs/services/AbfsBlobClient.java:
##########
@@ -2359,4 +2362,110 @@ private void findParentPathsForMarkerCreation(Path 
path, TracingContext tracingC
       }
     } while (current != null && !current.isRoot());
   }
+
+  /**
+   * Lists containers in the storage account using the Blob service endpoint.
+   *
+   * @param prefix optional prefix to filter container names
+   * @param continuation optional continuation token for paginated results
+   * @param tracingContext tracing context for the REST call
+   * @return response containing listed containers and continuation token
+   * @throws IOException if the operation fails or the response cannot be 
parsed
+   */
+  public ContainerListResponseData listContainers(
+      final String prefix,
+      final String continuation,
+      final TracingContext tracingContext) throws IOException {
+    final List<AbfsHttpHeader> requestHeaders = createDefaultHeaders();
+    final AbfsUriQueryBuilder queryBuilder = createDefaultUriQueryBuilder();
+    queryBuilder.addQuery(QUERY_PARAM_COMP, LIST);
+    if (prefix != null && !prefix.isEmpty()) {
+      queryBuilder.addQuery(QUERY_PARAM_PREFIX, prefix);
+    }
+    queryBuilder.addQuery(HttpQueryParams.QUERY_PARAM_MARKER, continuation);
+    appendSASTokenToQuery(EMPTY_STRING, 
SASTokenProvider.LIST_CONTAINERS_OPERATION, queryBuilder);
+    URL accountUrl = new URL(getBaseUrl().getProtocol(), 
getBaseUrl().getHost(), ROOT_PATH);
+    final URL url = createRequestUrl(accountUrl, EMPTY_STRING, 
queryBuilder.toString());
+    final AbfsRestOperation op = getAbfsRestOperation(
+        AbfsRestOperationType.ListContainers,
+        HTTP_METHOD_GET,
+        url,
+        requestHeaders);
+    op.execute(tracingContext);
+    return parseListContainersResponse(op.getResult());
+  }
+
+  /**
+   * Parses the List Containers response returned by the Blob service.
+   *
+   * @param result HTTP operation containing the list containers response
+   * @return parsed container listing with continuation token
+   * @throws AzureBlobFileSystemException if response parsing fails
+   */
+  private ContainerListResponseData parseListContainersResponse(
+      final AbfsHttpOperation result)
+      throws AzureBlobFileSystemException {
+    try (InputStream stream = result.getListResultStream()) {
+      try {

Review Comment:
   taken





> ABFS: Remove SDK dependency in hadoop-azure
> -------------------------------------------
>
>                 Key: HADOOP-19802
>                 URL: https://issues.apache.org/jira/browse/HADOOP-19802
>             Project: Hadoop Common
>          Issue Type: Sub-task
>    Affects Versions: 3.4.2
>            Reporter: Anmol Asrani
>            Assignee: Anmol Asrani
>            Priority: Major
>              Labels: pull-request-available
>
> Remove use of SDK from hadoop-azure



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

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

Reply via email to