Class DataLakeFileSystemAsyncClient

    • Field Detail

      • ROOT_FILESYSTEM_NAME

        public static final String ROOT_FILESYSTEM_NAME
        Special file system name for the root file system in the Storage account.
        See Also:
        Constant Field Values
    • Method Detail

      • getFileAsyncClient

        public DataLakeFileAsyncClient getFileAsyncClient​(String fileName)
        Initializes a new DataLakeFileAsyncClient object by concatenating fileName to the end of DataLakeFileSystemAsyncClient's URL. The new DataLakeFileAsyncClient uses the same request policy pipeline as the DataLakeFileSystemAsyncClient.

        Code Samples

         DataLakeFileAsyncClient dataLakeFileAsyncClient = client.getFileAsyncClient(fileName);
         
        Parameters:
        fileName - A String representing the name of the file. If the path name contains special characters, pass in the url encoded version of the path name.
        Returns:
        A new DataLakeFileAsyncClient object which references the file with the specified name in this file system.
      • getDirectoryAsyncClient

        public DataLakeDirectoryAsyncClient getDirectoryAsyncClient​(String directoryName)
        Initializes a new DataLakeDirectoryAsyncClient object by concatenating directoryName to the end of DataLakeFileSystemAsyncClient's URL. The new DataLakeDirectoryAsyncClient uses the same request policy pipeline as the DataLakeFileSystemAsyncClient.

        Code Samples

         DataLakeDirectoryAsyncClient dataLakeDirectoryAsyncClient = client.getDirectoryAsyncClient(directoryName);
         
        Parameters:
        directoryName - A String representing the name of the directory. If the path name contains special characters, pass in the url encoded version of the path name.
        Returns:
        A new DataLakeDirectoryAsyncClient object which references the directory with the specified name in this file system.
      • getAccountUrl

        public String getAccountUrl()
        Get the url of the storage account.
        Returns:
        the URL of the storage account
      • getFileSystemUrl

        public String getFileSystemUrl()
        Gets the URL of the file system represented by this client.
        Returns:
        the URL.
      • getFileSystemName

        public String getFileSystemName()
        Get the file system name.

        Code Samples

         String fileSystemName = client.getFileSystemName();
         System.out.println("The name of the file system is " + fileSystemName);
         
        Returns:
        The name of file system.
      • getAccountName

        public String getAccountName()
        Get associated account name.
        Returns:
        account name associated with this storage resource.
      • getServiceVersion

        public DataLakeServiceVersion getServiceVersion()
        Gets the service version the client is using.
        Returns:
        the service version the client is using.
      • getHttpPipeline

        public com.azure.core.http.HttpPipeline getHttpPipeline()
        Gets the HttpPipeline powering this client.
        Returns:
        The pipeline.
      • create

        public Mono<Void> create()
        Creates a new file system within a storage account. If a file system with the same name already exists, the operation fails. For more information, see the Azure Docs.

        Code Samples

         client.create().subscribe(
             response -> System.out.printf("Create completed%n"),
             error -> System.out.printf("Error while creating file system %s%n", error));
         
        Returns:
        A reactive response signalling completion.
      • createWithResponse

        public Mono<com.azure.core.http.rest.Response<Void>> createWithResponse​(Map<String,​String> metadata,
                                                                                PublicAccessType accessType)
        Creates a new file system within a storage account. If a file system with the same name already exists, the operation fails. For more information, see the Azure Docs.

        Code Samples

         Map<String, String> metadata = Collections.singletonMap("metadata", "value");
         client.createWithResponse(metadata, PublicAccessType.CONTAINER).subscribe(response ->
             System.out.printf("Create completed with status %d%n", response.getStatusCode()));
         
        Parameters:
        metadata - Metadata to associate with the file system. If there is leading or trailing whitespace in any metadata key or value, it must be removed or encoded.
        accessType - Specifies how the data in this file system is available to the public. See the x-ms-blob-public-access header in the Azure Docs for more information. Pass null for no public access.
        Returns:
        A reactive response signalling completion.
      • createIfNotExists

        public Mono<Boolean> createIfNotExists()
        Creates a new file system within a storage account if it does not exist. For more information, see the Azure Docs.

        Code Samples

         client.createIfNotExists().subscribe(created -> {
             if (created) {
                 System.out.println("Successfully created.");
             } else {
                 System.out.println("Already exists.");
             }
         });
         
        Returns:
        A reactive response signalling completion. true indicates that a new file system was created. false indicates that a file system already existed at this location.
      • createIfNotExistsWithResponse

        public Mono<com.azure.core.http.rest.Response<Void>> createIfNotExistsWithResponse​(Map<String,​String> metadata,
                                                                                           PublicAccessType accessType)
        Creates a new file system within a storage account if it does not exist. For more information, see the Azure Docs.

        Code Samples

         Map<String, String> metadata = Collections.singletonMap("metadata", "value");
         client.createIfNotExistsWithResponse(metadata, PublicAccessType.CONTAINER).subscribe(response -> {
             if (response.getStatusCode() == 409) {
                 System.out.println("Already exists.");
             } else {
                 System.out.println("successfully created.");
             }
         });
         
        Parameters:
        metadata - Metadata to associate with the file system. If there is leading or trailing whitespace in any metadata key or value, it must be removed or encoded.
        accessType - Specifies how the data in this file system is available to the public. See the x-ms-blob-public-access header in the Azure Docs for more information. Pass null for no public access.
        Returns:
        A reactive response signaling completion. If Response's status code is 201, a new file system was successfully created. If status code is 409, a file system already existed at this location.
      • delete

        public Mono<Void> delete()
        Marks the specified file system for deletion. The file system and any files/directories contained within it are later deleted during garbage collection. For more information, see the Azure Docs.

        Code Samples

         client.delete().subscribe(
             response -> System.out.printf("Delete completed%n"),
             error -> System.out.printf("Delete failed: %s%n", error));
         
        Returns:
        A reactive response signalling completion.
      • deleteWithResponse

        public Mono<com.azure.core.http.rest.Response<Void>> deleteWithResponse​(DataLakeRequestConditions requestConditions)
        Marks the specified file system for deletion. The file system and any files/directories contained within it are later deleted during garbage collection. For more information, see the Azure Docs.

        Code Samples

         DataLakeRequestConditions requestConditions = new DataLakeRequestConditions()
             .setLeaseId(leaseId)
             .setIfUnmodifiedSince(OffsetDateTime.now().minusDays(3));
        
         client.deleteWithResponse(requestConditions).subscribe(response ->
             System.out.printf("Delete completed with status %d%n", response.getStatusCode()));
         
        Parameters:
        requestConditions - DataLakeRequestConditions
        Returns:
        A reactive response signalling completion.
        Throws:
        UnsupportedOperationException - If either MatchConditions.getIfMatch() or MatchConditions.getIfNoneMatch() is set.
      • deleteIfExists

        public Mono<Boolean> deleteIfExists()
        Marks the specified file system for deletion if it exists. The file system and any files/directories contained within it are later deleted during garbage collection. For more information, see the Azure Docs.

        Code Samples

         client.deleteIfExists().subscribe(deleted -> {
             if (deleted) {
                 System.out.println("Successfully deleted.");
             } else {
                 System.out.println("Does not exist.");
             }
         });
         
        Returns:
        a reactive response signaling completion. true indicates that the file system was successfully deleted, false indicates that the file system did not exist.
      • deleteIfExistsWithResponse

        public Mono<com.azure.core.http.rest.Response<Void>> deleteIfExistsWithResponse​(DataLakePathDeleteOptions options)
        Marks the specified file system for deletion if it exists. The file system and any files/directories contained within it are later deleted during garbage collection. For more information, see the Azure Docs.

        Code Samples

         DataLakeRequestConditions requestConditions = new DataLakeRequestConditions()
             .setLeaseId(leaseId)
             .setIfUnmodifiedSince(OffsetDateTime.now().minusDays(3));
         DataLakePathDeleteOptions options = new DataLakePathDeleteOptions().setIsRecursive(false)
             .setRequestConditions(requestConditions);
        
         client.deleteIfExistsWithResponse(options).subscribe(response -> {
             if (response.getStatusCode() == 404) {
                 System.out.println("Does not exist.");
             } else {
                 System.out.println("successfully deleted.");
             }
         });
         
        Parameters:
        options - DataLakePathDeleteOptions
        Returns:
        A reactive response signaling completion. If Response's status code is 202, the file system was successfully deleted. If status code is 404, the file system does not exist.
        Throws:
        UnsupportedOperationException - If either MatchConditions.getIfMatch() or MatchConditions.getIfNoneMatch() is set.
      • getProperties

        public Mono<FileSystemProperties> getProperties()
        Returns the file system's metadata and system properties. For more information, see the Azure Docs.

        Code Samples

         client.getProperties().subscribe(response ->
             System.out.printf("Public Access Type: %s, Legal Hold? %b, Immutable? %b%n",
                 response.getDataLakePublicAccess(),
                 response.hasLegalHold(),
                 response.hasImmutabilityPolicy()));
         
        Returns:
        A Mono containing a Response whose value containing the file system properties.
      • getPropertiesWithResponse

        public Mono<com.azure.core.http.rest.Response<FileSystemProperties>> getPropertiesWithResponse​(String leaseId)
        Returns the file system's metadata and system properties. For more information, see the Azure Docs.

        Code Samples

        
         client.getPropertiesWithResponse(leaseId).subscribe(response ->
             System.out.printf("Public Access Type: %s, Legal Hold? %b, Immutable? %b%n",
                 response.getValue().getDataLakePublicAccess(),
                 response.getValue().hasLegalHold(),
                 response.getValue().hasImmutabilityPolicy()));
         
        Parameters:
        leaseId - The lease ID the active lease on the file system must match.
        Returns:
        A reactive response containing the file system properties.
      • setMetadata

        public Mono<Void> setMetadata​(Map<String,​String> metadata)
        Sets the file system's metadata. For more information, see the Azure Docs.

        Code Samples

         Map<String, String> metadata = Collections.singletonMap("metadata", "value");
         client.setMetadata(metadata).subscribe(
             response -> System.out.printf("Set metadata completed%n"),
             error -> System.out.printf("Set metadata failed: %s%n", error));
         
        Parameters:
        metadata - Metadata to associate with the file system. If there is leading or trailing whitespace in any metadata key or value, it must be removed or encoded.
        Returns:
        A reactive response signalling completion.
      • setMetadataWithResponse

        public Mono<com.azure.core.http.rest.Response<Void>> setMetadataWithResponse​(Map<String,​String> metadata,
                                                                                     DataLakeRequestConditions requestConditions)
        Sets the file system's metadata. For more information, see the Azure Docs.

        Code Samples

         Map<String, String> metadata = Collections.singletonMap("metadata", "value");
         DataLakeRequestConditions requestConditions = new DataLakeRequestConditions()
             .setLeaseId(leaseId)
             .setIfModifiedSince(OffsetDateTime.now().minusDays(3));
        
         client.setMetadataWithResponse(metadata, requestConditions).subscribe(response ->
             System.out.printf("Set metadata completed with status %d%n", response.getStatusCode()));
         
        Parameters:
        metadata - Metadata to associate with the file system. If there is leading or trailing whitespace in any metadata key or value, it must be removed or encoded.
        requestConditions - DataLakeRequestConditions
        Returns:
        A Mono containing a Response whose value contains signalling completion.
        Throws:
        UnsupportedOperationException - If one of MatchConditions.getIfMatch(), MatchConditions.getIfNoneMatch(), or RequestConditions.getIfUnmodifiedSince() is set.
      • listPaths

        public com.azure.core.http.rest.PagedFlux<PathItem> listPaths()
        Returns a reactive Publisher emitting all the files/directories in this account lazily as needed. For more information, see the Azure Docs.

        Code Samples

         client.listPaths().subscribe(path -> System.out.printf("Name: %s%n", path.getName()));
         
        Returns:
        A reactive response emitting the list of files/directories.
      • listPaths

        public com.azure.core.http.rest.PagedFlux<PathItem> listPaths​(ListPathsOptions options)
        Returns a reactive Publisher emitting all the files/directories in this account lazily as needed. For more information, see the Azure Docs.

        Code Samples

         ListPathsOptions options = new ListPathsOptions()
             .setPath("PathNamePrefixToMatch")
             .setMaxResults(10);
        
         client.listPaths(options).subscribe(path -> System.out.printf("Name: %s%n", path.getName()));
         
        Parameters:
        options - A ListPathsOptions which specifies what data should be returned by the service.
        Returns:
        A reactive response emitting the list of files/directories.
      • listDeletedPaths

        public com.azure.core.http.rest.PagedFlux<PathDeletedItem> listDeletedPaths()
        Returns a reactive Publisher emitting all the files/directories in this filesystem that have been recently soft deleted lazily as needed. For more information, see the Azure Docs.

        Code Samples

         client.listDeletedPaths().subscribe(path -> System.out.printf("Name: %s%n", path.getPath()));
         
        Returns:
        A reactive response emitting the list of files/directories.
      • listDeletedPaths

        public com.azure.core.http.rest.PagedFlux<PathDeletedItem> listDeletedPaths​(String prefix)
        Returns a reactive Publisher emitting all the files/directories in this account lazily as needed. For more information, see the Azure Docs. Note: You can specify the page size by using byPaged methods that accept an integer such as ContinuablePagedFluxCore.byPage(int). Please refer to the REST docs above for limitations on page size

        Code Samples

         int pageSize = 10;
         client.listDeletedPaths("PathNamePrefixToMatch")
             .byPage(pageSize)
             .subscribe(page ->
                 page.getValue().forEach(path ->
                     System.out.printf("Name: %s%n", path.getPath())));
         
        Parameters:
        prefix - Specifies the path to filter the results to.
        Returns:
        A reactive response emitting the list of files/directories.
      • createFile

        public Mono<DataLakeFileAsyncClient> createFile​(String fileName)
        Creates a new file within a file system. By default, this method will not overwrite an existing file. For more information, see the Azure Docs.

        Code Samples

         Mono<DataLakeFileAsyncClient> fileClient = client.createFile(fileName);
         
        Parameters:
        fileName - Name of the file to create. If the path name contains special characters, pass in the url encoded version of the path name.
        Returns:
        A Mono containing a DataLakeFileAsyncClient used to interact with the file created.
      • createFile

        public Mono<DataLakeFileAsyncClient> createFile​(String fileName,
                                                        boolean overwrite)
        Creates a new file within a file system. For more information, see the Azure Docs.

        Code Samples

         boolean overwrite = false; /* Default value. */
         Mono<DataLakeFileAsyncClient> fClient = client.createFile(fileName, overwrite);
         
        Parameters:
        fileName - Name of the file to create. If the path name contains special characters, pass in the url encoded version of the path name.
        overwrite - Whether to overwrite, should a file exist.
        Returns:
        A Mono containing a DataLakeFileAsyncClient used to interact with the file created.
      • createFileWithResponse

        public Mono<com.azure.core.http.rest.Response<DataLakeFileAsyncClient>> createFileWithResponse​(String fileName,
                                                                                                       String permissions,
                                                                                                       String umask,
                                                                                                       PathHttpHeaders headers,
                                                                                                       Map<String,​String> metadata,
                                                                                                       DataLakeRequestConditions requestConditions)
        Creates a new file within a file system. If a file with the same name already exists, the file will be overwritten. For more information, see the Azure Docs.

        Code Samples

         PathHttpHeaders httpHeaders = new PathHttpHeaders()
             .setContentLanguage("en-US")
             .setContentType("binary");
         DataLakeRequestConditions requestConditions = new DataLakeRequestConditions()
             .setLeaseId(leaseId);
         String permissions = "permissions";
         String umask = "umask";
         Mono<Response<DataLakeFileAsyncClient>> newFileClient = client.createFileWithResponse(fileName, permissions,
             umask, httpHeaders, Collections.singletonMap("metadata", "value"), requestConditions);
         
        Parameters:
        fileName - Name of the file to create. If the path name contains special characters, pass in the url encoded version of the path name.
        permissions - POSIX access permissions for the file owner, the file owning group, and others.
        umask - Restricts permissions of the file to be created.
        headers - PathHttpHeaders
        metadata - Metadata to associate with the file. If there is leading or trailing whitespace in any metadata key or value, it must be removed or encoded.
        requestConditions - DataLakeRequestConditions
        Returns:
        A Mono containing a Response whose value contains a DataLakeFileAsyncClient used to interact with the file created.
      • createFileIfNotExists

        public Mono<DataLakeFileAsyncClient> createFileIfNotExists​(String fileName)
        Creates a new file within a file system if it does not exist. For more information, see the Azure Docs.

        Code Samples

         DataLakeFileAsyncClient fileAsyncClient = client.createFileIfNotExists(fileName).block();
         
        Parameters:
        fileName - Name of the file to create. If the path name contains special characters, pass in the url encoded version of the path name.
        Returns:
        A Mono containing a DataLakeFileAsyncClient used to interact with the file created.
      • createFileIfNotExistsWithResponse

        public Mono<com.azure.core.http.rest.Response<DataLakeFileAsyncClient>> createFileIfNotExistsWithResponse​(String fileName,
                                                                                                                  DataLakePathCreateOptions options)
        Creates a new file within a file system if it does not exist. For more information, see the Azure Docs.

        Code Samples

         PathHttpHeaders headers = new PathHttpHeaders()
             .setContentLanguage("en-US")
             .setContentType("binary");
         String permissions = "permissions";
         String umask = "umask";
         DataLakePathCreateOptions options = new DataLakePathCreateOptions().setPathHttpHeaders(headers)
             .setPermissions(permissions).setUmask(umask).setMetadata(Collections.singletonMap("metadata", "value"));
        
         client.createFileIfNotExistsWithResponse(fileName, options).subscribe(response -> {
             if (response.getStatusCode() == 409) {
                 System.out.println("Already exists.");
             } else {
                 System.out.println("successfully created.");
             }
         });
         
        Parameters:
        fileName - Name of the file to create. If the path name contains special characters, pass in the url encoded version of the path name.
        options - DataLakePathCreateOptions
        Returns:
        A Mono containing a Response whose value contains a DataLakeFileAsyncClient used to interact with the file created. If Response's status code is 201, a new file was successfully created. If status code is 409, a file with the same name already existed at this location.
      • deleteFile

        public Mono<Void> deleteFile​(String fileName)
        Deletes the specified file in the file system. If the file doesn't exist the operation fails. For more information see the Azure Docs.

        Code Samples

         client.deleteFile(fileName).subscribe(response ->
             System.out.println("Delete request completed"));
         
        Parameters:
        fileName - Name of the file to delete. If the path name contains special characters, pass in the url encoded version of the path name.
        Returns:
        A reactive response signalling completion.
      • deleteFileWithResponse

        public Mono<com.azure.core.http.rest.Response<Void>> deleteFileWithResponse​(String fileName,
                                                                                    DataLakeRequestConditions requestConditions)
        Deletes the specified file in the file system. If the file doesn't exist the operation fails. For more information see the Azure Docs.

        Code Samples

         DataLakeRequestConditions requestConditions = new DataLakeRequestConditions()
             .setLeaseId(leaseId);
        
         client.deleteFileWithResponse(fileName, requestConditions)
             .subscribe(response -> System.out.println("Delete request completed"));
         
        Parameters:
        fileName - Name of the file to delete. If the path name contains special characters, pass in the url encoded version of the path name.
        requestConditions - DataLakeRequestConditions
        Returns:
        A Mono containing status code and HTTP headers
      • deleteFileIfExists

        public Mono<Boolean> deleteFileIfExists​(String fileName)
        Deletes the specified file in the file system if it exists. For more information see the Azure Docs.

        Code Samples

         client.deleteFileIfExists(fileName).subscribe(deleted -> {
             if (deleted) {
                 System.out.println("Successfully deleted.");
             } else {
                 System.out.println("Does not exist.");
             }
         });
         
        Parameters:
        fileName - Name of the file to delete. If the path name contains special characters, pass in the url encoded version of the path name.
        Returns:
        a reactive response signaling completion. true indicates that the specified file was successfully deleted, false indicates that the specified file did not exist.
      • deleteFileIfExistsWithResponse

        public Mono<com.azure.core.http.rest.Response<Void>> deleteFileIfExistsWithResponse​(String fileName,
                                                                                            DataLakePathDeleteOptions options)
        Deletes the specified file in the file system if it exists. For more information see the Azure Docs.

        Code Samples

         DataLakeRequestConditions requestConditions = new DataLakeRequestConditions()
             .setLeaseId(leaseId);
         DataLakePathDeleteOptions options = new DataLakePathDeleteOptions().setIsRecursive(false)
             .setRequestConditions(requestConditions);
        
         client.deleteFileIfExistsWithResponse(fileName, options).subscribe(response -> {
             if (response.getStatusCode() == 404) {
                 System.out.println("Does not exist.");
             } else {
                 System.out.println("successfully deleted.");
             }
         });
         
        Parameters:
        fileName - Name of the file to delete. If the path name contains special characters, pass in the url encoded version of the path name.
        options - DataLakePathDeleteOptions
        Returns:
        A reactive response signaling completion. If Response's status code is 200, the file was successfully deleted. If status code is 404, the file does not exist.
      • createDirectory

        public Mono<DataLakeDirectoryAsyncClient> createDirectory​(String directoryName)
        Creates a new directory within a file system. By default, this method will not overwrite an existing directory. For more information, see the Azure Docs.

        Code Samples

         Mono<DataLakeDirectoryAsyncClient> directoryClient = client.createDirectory(directoryName);
         
        Parameters:
        directoryName - Name of the directory to create. If the path name contains special characters, pass in the url encoded version of the path name.
        Returns:
        A Mono containing a DataLakeDirectoryAsyncClient used to interact with the directory created.
      • createDirectory

        public Mono<DataLakeDirectoryAsyncClient> createDirectory​(String directoryName,
                                                                  boolean overwrite)
        Creates a new directory within a file system. For more information, see the Azure Docs.

        Code Samples

         boolean overwrite = false; /* Default value. */
         Mono<DataLakeDirectoryAsyncClient> dClient = client.createDirectory(directoryName, overwrite);
         
        Parameters:
        directoryName - Name of the directory to create. If the path name contains special characters, pass in the url encoded version of the path name.
        overwrite - Whether to overwrite, should a directory exist.
        Returns:
        A Mono containing a DataLakeDirectoryAsyncClient used to interact with the directory created.
      • createDirectoryWithResponse

        public Mono<com.azure.core.http.rest.Response<DataLakeDirectoryAsyncClient>> createDirectoryWithResponse​(String directoryName,
                                                                                                                 String permissions,
                                                                                                                 String umask,
                                                                                                                 PathHttpHeaders headers,
                                                                                                                 Map<String,​String> metadata,
                                                                                                                 DataLakeRequestConditions requestConditions)
        Creates a new directory within a file system. If a directory with the same name already exists, the directory will be overwritten. For more information, see the Azure Docs.

        Code Samples

         PathHttpHeaders httpHeaders = new PathHttpHeaders()
             .setContentLanguage("en-US")
             .setContentType("binary");
         DataLakeRequestConditions requestConditions = new DataLakeRequestConditions()
             .setLeaseId(leaseId);
         String permissions = "permissions";
         String umask = "umask";
         Mono<Response<DataLakeDirectoryAsyncClient>> newDirectoryClient = client.createDirectoryWithResponse(
             directoryName, permissions, umask, httpHeaders, Collections.singletonMap("metadata", "value"),
             requestConditions);
         
        Parameters:
        directoryName - Name of the directory to create. If the path name contains special characters, pass in the url encoded version of the path name.
        permissions - POSIX access permissions for the directory owner, the directory owning group, and others.
        umask - Restricts permissions of the directory to be created.
        headers - PathHttpHeaders
        metadata - Metadata to associate with the resource. If there is leading or trailing whitespace in any metadata key or value, it must be removed or encoded.
        requestConditions - DataLakeRequestConditions
        Returns:
        A Mono containing a Response whose value contains a DataLakeDirectoryAsyncClient used to interact with the directory created.
      • createDirectoryIfNotExists

        public Mono<DataLakeDirectoryAsyncClient> createDirectoryIfNotExists​(String directoryName)
        Creates a new directory within a file system if it does not exist. For more information, see the Azure Docs.

        Code Samples

         DataLakeDirectoryAsyncClient directoryAsyncClient = client.createDirectoryIfNotExists(directoryName).block();
         
        Parameters:
        directoryName - Name of the directory to create. If the path name contains special characters, pass in the url encoded version of the path name.
        Returns:
        A Mono containing a DataLakeDirectoryAsyncClient used to interact with the directory created.
      • createDirectoryIfNotExistsWithResponse

        public Mono<com.azure.core.http.rest.Response<DataLakeDirectoryAsyncClient>> createDirectoryIfNotExistsWithResponse​(String directoryName,
                                                                                                                            DataLakePathCreateOptions options)
        Creates a new directory within a file system if it does not exist. For more information, see the Azure Docs.

        Code Samples

         PathHttpHeaders headers = new PathHttpHeaders()
             .setContentLanguage("en-US")
             .setContentType("binary");
         String permissions = "permissions";
         String umask = "umask";
         DataLakePathCreateOptions options = new DataLakePathCreateOptions().setPathHttpHeaders(headers)
             .setPermissions(permissions).setUmask(umask).setMetadata(Collections.singletonMap("metadata", "value"));
        
         client.createDirectoryIfNotExistsWithResponse(directoryName, options).subscribe(response -> {
             if (response.getStatusCode() == 409) {
                 System.out.println("Already exists.");
             } else {
                 System.out.println("successfully created.");
             }
         });
         
        Parameters:
        directoryName - Name of the directory to create. If the path name contains special characters, pass in the url encoded version of the path name.
        options - DataLakePathCreateOptions
        Returns:
        A Mono containing a Response whose value contains a DataLakeDirectoryAsyncClient used to interact with the directory created. If Response's status code is 201, a new directory was successfully created. If status code is 409, a directory with the same name already existed at this location.
      • deleteDirectory

        public Mono<Void> deleteDirectory​(String directoryName)
        Deletes the specified directory in the file system. If the directory doesn't exist the operation fails. For more information see the Azure Docs.

        Code Samples

         client.deleteDirectory(directoryName).subscribe(response ->
             System.out.println("Delete request completed"));
         
        Parameters:
        directoryName - Name of the directory to delete. If the path name contains special characters, pass in the url encoded version of the path name.
        Returns:
        A reactive response signalling completion.
      • deleteDirectoryWithResponse

        public Mono<com.azure.core.http.rest.Response<Void>> deleteDirectoryWithResponse​(String directoryName,
                                                                                         boolean recursive,
                                                                                         DataLakeRequestConditions requestConditions)
        Deletes the specified directory in the file system. If the directory doesn't exist the operation fails. For more information see the Azure Docs.

        Code Samples

         DataLakeRequestConditions requestConditions = new DataLakeRequestConditions()
             .setLeaseId(leaseId);
         boolean recursive = false; // Default value
        
         client.deleteDirectoryWithResponse(directoryName, recursive, requestConditions)
             .subscribe(response -> System.out.println("Delete request completed"));
         
        Parameters:
        directoryName - Name of the directory to delete. If the path name contains special characters, pass in the url encoded version of the path name.
        recursive - Whether to delete all paths beneath the directory.
        requestConditions - DataLakeRequestConditions
        Returns:
        A Mono containing status code and HTTP headers
      • deleteDirectoryIfExists

        public Mono<Boolean> deleteDirectoryIfExists​(String directoryName)
        Deletes the specified directory in the file system if it exists. For more information see the Azure Docs.

        Code Samples

         client.deleteDirectoryIfExists(fileName).subscribe(deleted -> {
             if (deleted) {
                 System.out.println("Successfully deleted.");
             } else {
                 System.out.println("Does not exist.");
             }
         });
         
        Parameters:
        directoryName - Name of the directory to delete. If the path name contains special characters, pass in the url encoded version of the path name.
        Returns:
        a reactive response signaling completion. true indicates that the specified directory was successfully deleted, false indicates that the specified directory did not exist.
      • deleteDirectoryIfExistsWithResponse

        public Mono<com.azure.core.http.rest.Response<Void>> deleteDirectoryIfExistsWithResponse​(String directoryName,
                                                                                                 DataLakePathDeleteOptions options)
        Deletes the specified directory in the file system if it exists. For more information see the Azure Docs.

        Code Samples

         DataLakeRequestConditions requestConditions = new DataLakeRequestConditions()
             .setLeaseId(leaseId);
         boolean recursive = false; // Default value
         DataLakePathDeleteOptions options = new DataLakePathDeleteOptions().setIsRecursive(recursive)
             .setRequestConditions(requestConditions);
        
         client.deleteDirectoryIfExistsWithResponse(directoryName, options).subscribe(response -> {
             if (response.getStatusCode() == 404) {
                 System.out.println("Does not exist.");
             } else {
                 System.out.println("successfully deleted.");
             }
         });
         
        Parameters:
        directoryName - Name of the directory to delete. If the path name contains special characters, pass in the url encoded version of the path name.
        options - DataLakePathDeleteOptions
        Returns:
        A reactive response signaling completion. If Response's status code is 200, the file was successfully deleted. If status code is 404, the file does not exist.
      • undeletePath

        public Mono<DataLakePathAsyncClient> undeletePath​(String deletedPath,
                                                          String deletionId)
        Restores a soft deleted path in the file system. For more information see the Azure Docs.

        Code Samples

         client.undeletePath(deletedPath, deletionId).doOnSuccess(response -> System.out.println("Completed undelete"));
         
        Parameters:
        deletedPath - The deleted path
        deletionId - deletion ID associated with the soft deleted path that uniquely identifies a resource if multiple have been soft deleted at this location. You can get soft deleted paths and their associated deletion IDs with listDeletedPaths().
        Returns:
        A reactive response signalling completion.
        Throws:
        NullPointerException - if deletedPath or deletionId is null.
      • undeletePathWithResponse

        public Mono<com.azure.core.http.rest.Response<DataLakePathAsyncClient>> undeletePathWithResponse​(String deletedPath,
                                                                                                         String deletionId)
        Restores a soft deleted path in the file system. For more information see the Azure Docs.

        Code Samples

         client.undeletePathWithResponse(deletedPath, deletionId)
             .doOnSuccess(response -> System.out.println("Completed undelete"));
         
        Parameters:
        deletedPath - The deleted path
        deletionId - deletion ID associated with the soft deleted path that uniquely identifies a resource if multiple have been soft deleted at this location. You can get soft deleted paths and their associated deletion IDs with listDeletedPaths().
        Returns:
        A reactive response signalling completion.
        Throws:
        NullPointerException - if deletedPath or deletionId is null.
      • setAccessPolicy

        public Mono<Void> setAccessPolicy​(PublicAccessType accessType,
                                          List<DataLakeSignedIdentifier> identifiers)
        Sets the file system's permissions. The permissions indicate whether paths in a file system may be accessed publicly. Note that, for each signed identifier, we will truncate the start and expiry times to the nearest second to ensure the time formatting is compatible with the service. For more information, see the Azure Docs.

        Code Samples

         DataLakeSignedIdentifier identifier = new DataLakeSignedIdentifier()
             .setId("name")
             .setAccessPolicy(new DataLakeAccessPolicy()
                 .setStartsOn(OffsetDateTime.now())
                 .setExpiresOn(OffsetDateTime.now().plusDays(7))
                 .setPermissions("permissionString"));
        
         client.setAccessPolicy(PublicAccessType.CONTAINER, Collections.singletonList(identifier)).subscribe(
             response -> System.out.printf("Set access policy completed%n"),
             error -> System.out.printf("Set access policy failed: %s%n", error));
         
        Parameters:
        accessType - Specifies how the data in this file system is available to the public. See the x-ms-blob-public-access header in the Azure Docs for more information. Pass null for no public access.
        identifiers - A list of DataLakeSignedIdentifier objects that specify the permissions for the file system. Please see here for more information. Passing null will clear all access policies.
        Returns:
        A reactive response signalling completion.
      • setAccessPolicyWithResponse

        public Mono<com.azure.core.http.rest.Response<Void>> setAccessPolicyWithResponse​(PublicAccessType accessType,
                                                                                         List<DataLakeSignedIdentifier> identifiers,
                                                                                         DataLakeRequestConditions requestConditions)
        Sets the file system's permissions. The permissions indicate whether paths in a file system may be accessed publicly. Note that, for each signed identifier, we will truncate the start and expiry times to the nearest second to ensure the time formatting is compatible with the service. For more information, see the Azure Docs.

        Code Samples

         DataLakeSignedIdentifier identifier = new DataLakeSignedIdentifier()
             .setId("name")
             .setAccessPolicy(new DataLakeAccessPolicy()
                 .setStartsOn(OffsetDateTime.now())
                 .setExpiresOn(OffsetDateTime.now().plusDays(7))
                 .setPermissions("permissionString"));
        
         DataLakeRequestConditions requestConditions = new DataLakeRequestConditions()
             .setLeaseId(leaseId)
             .setIfUnmodifiedSince(OffsetDateTime.now().minusDays(3));
        
         client.setAccessPolicyWithResponse(PublicAccessType.CONTAINER, Collections.singletonList(identifier), requestConditions)
             .subscribe(response ->
                 System.out.printf("Set access policy completed with status %d%n", response.getStatusCode()));
         
        Parameters:
        accessType - Specifies how the data in this file system is available to the public. See the x-ms-blob-public-access header in the Azure Docs for more information. Pass null for no public access.
        identifiers - A list of DataLakeSignedIdentifier objects that specify the permissions for the file system. Please see here for more information. Passing null will clear all access policies.
        requestConditions - DataLakeRequestConditions
        Returns:
        A reactive response signalling completion.
        Throws:
        UnsupportedOperationException - If either MatchConditions.getIfMatch() or MatchConditions.getIfNoneMatch() is set.
      • getAccessPolicy

        public Mono<FileSystemAccessPolicies> getAccessPolicy()
        Returns the file system's permissions. The permissions indicate whether file system's paths may be accessed publicly. For more information, see the Azure Docs.

        Code Samples

         client.getAccessPolicy().subscribe(response -> {
             System.out.printf("Data Lake Access Type: %s%n", response.getDataLakeAccessType());
        
             for (DataLakeSignedIdentifier identifier : response.getIdentifiers()) {
                 System.out.printf("Identifier Name: %s, Permissions %s%n",
                     identifier.getId(),
                     identifier.getAccessPolicy().getPermissions());
             }
         });
         
        Returns:
        A reactive response containing the file system access policy.
      • getAccessPolicyWithResponse

        public Mono<com.azure.core.http.rest.Response<FileSystemAccessPolicies>> getAccessPolicyWithResponse​(String leaseId)
        Returns the file system's permissions. The permissions indicate whether file system's paths may be accessed publicly. For more information, see the Azure Docs.

        Code Samples

         client.getAccessPolicyWithResponse(leaseId).subscribe(response -> {
             System.out.printf("Data Lake Access Type: %s%n", response.getValue().getDataLakeAccessType());
        
             for (DataLakeSignedIdentifier identifier : response.getValue().getIdentifiers()) {
                 System.out.printf("Identifier Name: %s, Permissions %s%n",
                     identifier.getId(),
                     identifier.getAccessPolicy().getPermissions());
             }
         });
         
        Parameters:
        leaseId - The lease ID the active lease on the file system must match.
        Returns:
        A reactive response containing the file system access policy.
      • generateUserDelegationSas

        public String generateUserDelegationSas​(DataLakeServiceSasSignatureValues dataLakeServiceSasSignatureValues,
                                                UserDelegationKey userDelegationKey,
                                                String accountName,
                                                com.azure.core.util.Context context)
        Generates a user delegation SAS for the file system using the specified DataLakeServiceSasSignatureValues.

        See DataLakeServiceSasSignatureValues for more information on how to construct a user delegation SAS.

        Code Samples

         OffsetDateTime myExpiryTime = OffsetDateTime.now().plusDays(1);
         FileSystemSasPermission myPermission = new FileSystemSasPermission().setReadPermission(true);
        
         DataLakeServiceSasSignatureValues myValues = new DataLakeServiceSasSignatureValues(expiryTime, permission)
             .setStartTime(OffsetDateTime.now());
        
         client.generateUserDelegationSas(values, userDelegationKey, accountName, new Context("key", "value"));
         
        Parameters:
        dataLakeServiceSasSignatureValues - DataLakeServiceSasSignatureValues
        userDelegationKey - A UserDelegationKey object used to sign the SAS values. See DataLakeServiceAsyncClient.getUserDelegationKey(OffsetDateTime, OffsetDateTime) for more information on how to get a user delegation key.
        accountName - The account name.
        context - Additional context that is passed through the code when generating a SAS.
        Returns:
        A String representing the SAS query parameters.
      • generateSas

        public String generateSas​(DataLakeServiceSasSignatureValues dataLakeServiceSasSignatureValues)
        Generates a service SAS for the file system using the specified DataLakeServiceSasSignatureValues

        Note : The client must be authenticated via StorageSharedKeyCredential

        See DataLakeServiceSasSignatureValues for more information on how to construct a service SAS.

        Code Samples

         OffsetDateTime expiryTime = OffsetDateTime.now().plusDays(1);
         FileSystemSasPermission permission = new FileSystemSasPermission().setReadPermission(true);
        
         DataLakeServiceSasSignatureValues values = new DataLakeServiceSasSignatureValues(expiryTime, permission)
             .setStartTime(OffsetDateTime.now());
        
         client.generateSas(values); // Client must be authenticated via StorageSharedKeyCredential
         
        Parameters:
        dataLakeServiceSasSignatureValues - DataLakeServiceSasSignatureValues
        Returns:
        A String representing the SAS query parameters.
      • generateSas

        public String generateSas​(DataLakeServiceSasSignatureValues dataLakeServiceSasSignatureValues,
                                  com.azure.core.util.Context context)
        Generates a service SAS for the file system using the specified DataLakeServiceSasSignatureValues

        Note : The client must be authenticated via StorageSharedKeyCredential

        See DataLakeServiceSasSignatureValues for more information on how to construct a service SAS.

        Code Samples

         OffsetDateTime expiryTime = OffsetDateTime.now().plusDays(1);
         FileSystemSasPermission permission = new FileSystemSasPermission().setReadPermission(true);
        
         DataLakeServiceSasSignatureValues values = new DataLakeServiceSasSignatureValues(expiryTime, permission)
             .setStartTime(OffsetDateTime.now());
        
         // Client must be authenticated via StorageSharedKeyCredential
         client.generateSas(values, new Context("key", "value"));
         
        Parameters:
        dataLakeServiceSasSignatureValues - DataLakeServiceSasSignatureValues
        context - Additional context that is passed through the code when generating a SAS.
        Returns:
        A String representing the SAS query parameters.