Class DataLakeDirectoryAsyncClient
This client is instantiated through DataLakePathClientBuilder
or retrieved via
getDirectoryAsyncClient
.
Please refer to the Azure Docs for more information.
-
Method Summary
Modifier and TypeMethodDescriptioncreateFile
(String fileName) Creates a new file within a directory.createFile
(String fileName, boolean overwrite) Creates a new file within a directory.createFileIfNotExists
(String fileName) Creates a new file within a directory if it does not exist.Mono
<com.azure.core.http.rest.Response<DataLakeFileAsyncClient>> createFileIfNotExistsWithResponse
(String fileName, DataLakePathCreateOptions options) Creates a new file within a directory if it does not exist.Mono
<com.azure.core.http.rest.Response<DataLakeFileAsyncClient>> createFileWithResponse
(String fileName, DataLakePathCreateOptions options) Creates a new file within a directory.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 directory.createSubdirectory
(String subdirectoryName) Creates a new sub-directory within a directory.createSubdirectory
(String subdirectoryName, boolean overwrite) Creates a new sub-directory within a directory.createSubdirectoryIfNotExists
(String subdirectoryName) Creates a new subdirectory within a directory if it does not exist.Mono
<com.azure.core.http.rest.Response<DataLakeDirectoryAsyncClient>> createSubdirectoryIfNotExistsWithResponse
(String subdirectoryName, DataLakePathCreateOptions options) Creates a new sub-directory within a directory if it does not exist.Mono
<com.azure.core.http.rest.Response<DataLakeDirectoryAsyncClient>> createSubdirectoryWithResponse
(String subdirectoryName, DataLakePathCreateOptions options) Creates a new sub-directory within a directory.Mono
<com.azure.core.http.rest.Response<DataLakeDirectoryAsyncClient>> createSubdirectoryWithResponse
(String subdirectoryName, String permissions, String umask, PathHttpHeaders headers, Map<String, String> metadata, DataLakeRequestConditions requestConditions) Creates a new sub-directory within a directory.delete()
Deletes a directory.deleteFile
(String fileName) Deletes the specified file in the file system.deleteFileIfExists
(String fileName) Deletes the specified file in the file system if it exists.deleteFileIfExistsWithResponse
(String fileName, DataLakePathDeleteOptions options) Deletes the specified file in the directory if it exists.deleteFileWithResponse
(String fileName, DataLakeRequestConditions requestConditions) Deletes the specified file in the directory.Deletes a directory if it exists.Deletes a directory if it exists.Recursively deletes a directory and all contents within the directory.deleteRecursivelyWithResponse
(DataLakeRequestConditions requestConditions) Recursively deletes a directory and all contents within the directory.deleteSubdirectory
(String subdirectoryName) Deletes the specified sub-directory in the directory.deleteSubdirectoryIfExists
(String subdirectoryName) Deletes the specified subdirectory in the directory if it exists.deleteSubdirectoryIfExistsWithResponse
(String directoryName, DataLakePathDeleteOptions options) Deletes the specified subdirectory in the directory if it exists.deleteSubdirectoryWithResponse
(String directoryName, boolean recursive, DataLakeRequestConditions requestConditions) Deletes the specified sub-directory in the directory.deleteWithResponse
(boolean recursive, DataLakeRequestConditions requestConditions) Deletes a directory.getCustomerProvidedKeyAsyncClient
(CustomerProvidedKey customerProvidedKey) Creates a newDataLakeDirectoryAsyncClient
with the specifiedcustomerProvidedKey
.Gets the name of this directory, not including its full path.Gets the path of this directory, not including the name of the resource itself.Gets the URL of the directory represented by this client on the Data Lake service.getFileAsyncClient
(String fileName) Creates a new DataLakeFileAsyncClient object by concatenating fileName to the end of DataLakeDirectoryAsyncClient's URL.getSubdirectoryAsyncClient
(String subdirectoryName) Creates a new DataLakeDirectoryAsyncClient object by concatenating subdirectoryName to the end of DataLakeDirectoryAsyncClient's URL.com.azure.core.http.rest.PagedFlux
<PathItem> Returns a reactive Publisher emitting all the files/directories in this directory lazily as needed.com.azure.core.http.rest.PagedFlux
<PathItem> Returns a reactive Publisher emitting all the files/directories in this directory lazily as needed.Moves the directory to another location within the file system.Mono
<com.azure.core.http.rest.Response<DataLakeDirectoryAsyncClient>> renameWithResponse
(String destinationFileSystem, String destinationPath, DataLakeRequestConditions sourceRequestConditions, DataLakeRequestConditions destinationRequestConditions) Moves the directory to another location within the file system.Methods inherited from class com.azure.storage.file.datalake.DataLakePathAsyncClient
create, create, createIfNotExists, createIfNotExistsWithResponse, createWithResponse, createWithResponse, exists, existsWithResponse, generateSas, generateSas, generateSas, generateUserDelegationSas, generateUserDelegationSas, generateUserDelegationSas, getAccessControl, getAccessControlWithResponse, getAccountName, getCustomerProvidedKey, getFileSystemName, getHttpPipeline, getProperties, getProperties, getPropertiesWithResponse, getServiceVersion, removeAccessControlRecursive, removeAccessControlRecursiveWithResponse, setAccessControlList, setAccessControlListWithResponse, setAccessControlRecursive, setAccessControlRecursiveWithResponse, setHttpHeaders, setHttpHeadersWithResponse, setMetadata, setMetadataWithResponse, setPermissions, setPermissionsWithResponse, updateAccessControlRecursive, updateAccessControlRecursiveWithResponse
-
Method Details
-
getDirectoryUrl
Gets the URL of the directory represented by this client on the Data Lake service.- Returns:
- the URL.
-
getDirectoryPath
Gets the path of this directory, not including the name of the resource itself.- Returns:
- The path of the directory.
-
getDirectoryName
Gets the name of this directory, not including its full path.- Returns:
- The name of the directory.
-
getCustomerProvidedKeyAsyncClient
public DataLakeDirectoryAsyncClient getCustomerProvidedKeyAsyncClient(CustomerProvidedKey customerProvidedKey) Creates a newDataLakeDirectoryAsyncClient
with the specifiedcustomerProvidedKey
.- Overrides:
getCustomerProvidedKeyAsyncClient
in classDataLakePathAsyncClient
- Parameters:
customerProvidedKey
- theCustomerProvidedKey
for the directory, passnull
to use no customer provided key.- Returns:
- a
DataLakeDirectoryAsyncClient
with the specifiedcustomerProvidedKey
.
-
delete
Deletes a directory.Code Samples
client.delete().subscribe(response -> System.out.println("Delete request completed"));
For more information see the Azure Docs
- Returns:
- A reactive response signalling completion.
-
deleteRecursively
Recursively deletes a directory and all contents within the directory.Code Samples
client.deleteRecursively().subscribe(response -> System.out.println("Delete request completed"));
For more information see the Azure Docs
- Returns:
- A reactive response signalling completion.
-
deleteRecursivelyWithResponse
public Mono<com.azure.core.http.rest.Response<Void>> deleteRecursivelyWithResponse(DataLakeRequestConditions requestConditions) Recursively deletes a directory and all contents within the directory.Code Samples
DataLakeRequestConditions requestConditions = new DataLakeRequestConditions() .setLeaseId(leaseId); boolean recursive = false; // Default value client.deleteWithResponse(recursive, requestConditions) .subscribe(response -> System.out.println("Delete request completed"));
For more information see the Azure Docs
- Parameters:
requestConditions
-DataLakeRequestConditions
- Returns:
- A reactive response signalling completion.
-
deleteWithResponse
public Mono<com.azure.core.http.rest.Response<Void>> deleteWithResponse(boolean recursive, DataLakeRequestConditions requestConditions) Deletes a directory.Code Samples
DataLakeRequestConditions requestConditions = new DataLakeRequestConditions() .setLeaseId(leaseId); boolean recursive = false; // Default value client.deleteWithResponse(recursive, requestConditions) .subscribe(response -> System.out.println("Delete request completed"));
For more information see the Azure Docs
- Parameters:
recursive
- Whether to delete all paths beneath the directory.requestConditions
-DataLakeRequestConditions
- Returns:
- A reactive response signalling completion.
-
deleteIfExists
Deletes a directory if it exists.Code Samples
client.deleteIfExists().subscribe(deleted -> { if (deleted) { System.out.println("Successfully deleted."); } else { System.out.println("Does not exist."); } });
For more information see the Azure Docs
- Overrides:
deleteIfExists
in classDataLakePathAsyncClient
- Returns:
- a reactive response signaling completion.
true
indicates that the directory was successfully deleted,true
indicates that the directory did not exist.
-
deleteIfExistsWithResponse
public Mono<com.azure.core.http.rest.Response<Boolean>> deleteIfExistsWithResponse(DataLakePathDeleteOptions options) Deletes a directory if it exists.Code Samples
DataLakeRequestConditions requestConditions = new DataLakeRequestConditions() .setLeaseId(leaseId); boolean recursive = false; // Default value DataLakePathDeleteOptions options = new DataLakePathDeleteOptions().setIsRecursive(recursive) .setRequestConditions(requestConditions); client.deleteIfExistsWithResponse(options).subscribe(response -> { if (response.getStatusCode() == 404) { System.out.println("Does not exist."); } else { System.out.println("successfully deleted."); } });
For more information see the Azure Docs
- Overrides:
deleteIfExistsWithResponse
in classDataLakePathAsyncClient
- Parameters:
options
-DataLakePathDeleteOptions
- Returns:
- A reactive response signaling completion. If
Response
's status code is 200, the directory was successfully deleted. If status code is 404, the directory does not exist.
-
getFileAsyncClient
Creates a new DataLakeFileAsyncClient object by concatenating fileName to the end of DataLakeDirectoryAsyncClient's URL. The new DataLakeFileAsyncClient uses the same request policy pipeline as the DataLakeDirectoryAsyncClient.Code Samples
DataLakeFileAsyncClient dataLakeFileClient = client.getFileAsyncClient(fileName);
- Parameters:
fileName
- AString
representing the name of the file.- Returns:
- A new
DataLakeFileAsyncClient
object which references the file with the specified name in this file system.
-
createFile
Creates a new file within a directory. By default, this method will not overwrite an existing file. For more information, see the Azure Docs.Code Samples
DataLakeFileAsyncClient fileClient = client.createFile(fileName).block();
- Parameters:
fileName
- Name of the file to create.- Returns:
- A
Mono
containing aDataLakeFileAsyncClient
used to interact with the file created.
-
createFile
Creates a new file within a directory. For more information, see the Azure Docs.Code Samples
boolean overwrite = false; /* Default value. */ DataLakeFileAsyncClient fClient = client.createFile(fileName, overwrite).block();
- Parameters:
fileName
- Name of the file to create.overwrite
- Whether to overwrite, should the file exist.- Returns:
- A
Mono
containing aDataLakeFileAsyncClient
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 directory. 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"; DataLakeFileAsyncClient newFileClient = client.createFileWithResponse(fileName, permissions, umask, httpHeaders, Collections.singletonMap("metadata", "value"), requestConditions ).block().getValue();
- Parameters:
fileName
- Name of the file to create.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 aResponse
whosevalue
contains aDataLakeFileAsyncClient
used to interact with the file created.
-
createFileWithResponse
public Mono<com.azure.core.http.rest.Response<DataLakeFileAsyncClient>> createFileWithResponse(String fileName, DataLakePathCreateOptions options) Creates a new file within a directory. 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); Map<String, String> metadata = Collections.singletonMap("metadata", "value"); String permissions = "permissions"; String umask = "umask"; String owner = "rwx"; String group = "r--"; String leaseId = CoreUtils.randomUuid().toString(); Integer duration = 15; DataLakePathCreateOptions options = new DataLakePathCreateOptions() .setPermissions(permissions) .setUmask(umask) .setOwner(owner) .setGroup(group) .setPathHttpHeaders(httpHeaders) .setRequestConditions(requestConditions) .setMetadata(metadata) .setProposedLeaseId(leaseId) .setLeaseDuration(duration); DataLakeFileAsyncClient newFileClient = client.createFileWithResponse(fileName, options).block().getValue();
- Parameters:
fileName
- Name of the file to create.options
-DataLakePathCreateOptions
- Returns:
- A
Mono
containing aResponse
whosevalue
contains aDataLakeFileAsyncClient
used to interact with the file created.
-
createFileIfNotExists
Creates a new file within a directory if it does not exist. By default this method will not overwrite an existing file. For more information, see the Azure Docs.Code Samples
DataLakeFileAsyncClient fileClient = client.createFileIfNotExists(fileName).block();
- Parameters:
fileName
- Name of the file to create.- Returns:
- A
Mono
containing aDataLakeFileAsyncClient
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 directory 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() .setPermissions(permissions) .setUmask(umask) .setPathHttpHeaders(headers) .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.options
-DataLakePathCreateOptions
metadata key or value, it must be removed or encoded.- Returns:
- A
Mono
containing aResponse
whosevalue
contains aDataLakeFileAsyncClient
used to interact with the file created. IfResponse
'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
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.- 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 directory. 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.requestConditions
-DataLakeRequestConditions
- Returns:
- A
Mono
containing status code and HTTP headers
-
deleteFileIfExists
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.- 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<Boolean>> deleteFileIfExistsWithResponse(String fileName, DataLakePathDeleteOptions options) Deletes the specified file in the directory 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.options
-DataLakePathDeleteOptions
- Returns:
- A reactive response signaling completion. If
Response
's status code is 200, the specified file was successfully deleted. If status code is 404, the specified file does not exist.
-
getSubdirectoryAsyncClient
Creates a new DataLakeDirectoryAsyncClient object by concatenating subdirectoryName to the end of DataLakeDirectoryAsyncClient's URL. The new DataLakeDirectoryAsyncClient uses the same request policy pipeline as the DataLakeDirectoryAsyncClient.Code Samples
DataLakeDirectoryAsyncClient dataLakeDirectoryClient = client.getSubdirectoryAsyncClient(directoryName);
- Parameters:
subdirectoryName
- AString
representing the name of the sub-directory.- Returns:
- A new
DataLakeDirectoryAsyncClient
object which references the directory with the specified name in this file system.
-
createSubdirectory
Creates a new sub-directory within a directory. By default, this method will not overwrite an existing sub-directory. For more information, see the Azure Docs.Code Samples
DataLakeDirectoryAsyncClient directoryClient = client.createSubdirectory(directoryName).block();
- Parameters:
subdirectoryName
- Name of the sub-directory to create.- Returns:
- A
Mono
containing aDataLakeDirectoryAsyncClient
used to interact with the directory created.
-
createSubdirectory
public Mono<DataLakeDirectoryAsyncClient> createSubdirectory(String subdirectoryName, boolean overwrite) Creates a new sub-directory within a directory. For more information, see the Azure Docs.Code Samples
boolean overwrite = false; /* Default value. */ DataLakeDirectoryAsyncClient dClient = client.createSubdirectory(directoryName, overwrite).block();
- Parameters:
subdirectoryName
- Name of the sub-directory to create.overwrite
- Whether to overwrite, should the subdirectory exist.- Returns:
- A
Mono
containing aDataLakeDirectoryAsyncClient
used to interact with the directory created.
-
createSubdirectoryWithResponse
public Mono<com.azure.core.http.rest.Response<DataLakeDirectoryAsyncClient>> createSubdirectoryWithResponse(String subdirectoryName, String permissions, String umask, PathHttpHeaders headers, Map<String, String> metadata, DataLakeRequestConditions requestConditions) Creates a new sub-directory within a directory. If a sub-directory with the same name already exists, the sub-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"; DataLakeDirectoryAsyncClient newDirectoryClient = client.createSubdirectoryWithResponse( directoryName, permissions, umask, httpHeaders, Collections.singletonMap("metadata", "value"), requestConditions ).block().getValue();
- Parameters:
subdirectoryName
- Name of the sub-directory to create.permissions
- POSIX access permissions for the sub-directory owner, the sub-directory owning group, and others.umask
- Restricts permissions of the sub-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 aResponse
whosevalue
contains aDataLakeDirectoryAsyncClient
used to interact with the sub-directory created.
-
createSubdirectoryWithResponse
public Mono<com.azure.core.http.rest.Response<DataLakeDirectoryAsyncClient>> createSubdirectoryWithResponse(String subdirectoryName, DataLakePathCreateOptions options) Creates a new sub-directory within a directory. If a sub-directory with the same name already exists, the sub-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); Map<String, String> metadata = Collections.singletonMap("metadata", "value"); String permissions = "permissions"; String umask = "umask"; String owner = "rwx"; String group = "r--"; String leaseId = CoreUtils.randomUuid().toString(); Integer duration = 15; DataLakePathCreateOptions options = new DataLakePathCreateOptions() .setPermissions(permissions) .setUmask(umask) .setOwner(owner) .setGroup(group) .setPathHttpHeaders(httpHeaders) .setRequestConditions(requestConditions) .setMetadata(metadata) .setProposedLeaseId(leaseId) .setLeaseDuration(duration); DataLakeDirectoryAsyncClient newDirectoryClient = client.createSubdirectoryWithResponse(directoryName, options) .block().getValue();
- Parameters:
subdirectoryName
- Name of the sub-directory to create.options
-DataLakePathCreateOptions
- Returns:
- A
Mono
containing aResponse
whosevalue
contains aDataLakeDirectoryAsyncClient
used to interact with the sub-directory created.
-
createSubdirectoryIfNotExists
Creates a new subdirectory within a directory if it does not exist. For more information, see the Azure Docs.Code Samples
DataLakeDirectoryAsyncClient subdirectoryClient = client.createSubdirectoryIfNotExists(directoryName).block();
- Parameters:
subdirectoryName
- Name of the sub-directory to create.- Returns:
- A
Mono
containing aDataLakeDirectoryAsyncClient
used to interact with the subdirectory created.
-
createSubdirectoryIfNotExistsWithResponse
public Mono<com.azure.core.http.rest.Response<DataLakeDirectoryAsyncClient>> createSubdirectoryIfNotExistsWithResponse(String subdirectoryName, DataLakePathCreateOptions options) Creates a new sub-directory within a directory 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() .setPermissions(permissions) .setUmask(umask) .setPathHttpHeaders(headers) .setMetadata(Collections.singletonMap("metadata", "value")); client.createSubdirectoryIfNotExistsWithResponse(directoryName, options).subscribe(response -> { if (response.getStatusCode() == 409) { System.out.println("Already exists."); } else { System.out.println("successfully created."); } });
- Parameters:
subdirectoryName
- Name of the subdirectory to create.options
-DataLakePathCreateOptions
- Returns:
- A
Mono
containing aResponse
whosevalue
contains aDataLakeDirectoryAsyncClient
used to interact with the subdirectory created. IfResponse
's status code is 201, a new subdirectory was successfully created. If status code is 409, a subdirectory with the same name already existed at this location.
-
deleteSubdirectory
Deletes the specified sub-directory in the directory. If the sub-directory doesn't exist or is not empty the operation fails. For more information see the Azure Docs.Code Samples
client.deleteSubdirectory(directoryName).subscribe(response -> System.out.println("Delete request completed"));
- Parameters:
subdirectoryName
- Name of the sub-directory to delete.- Returns:
- A reactive response signalling completion.
-
deleteSubdirectoryWithResponse
public Mono<com.azure.core.http.rest.Response<Void>> deleteSubdirectoryWithResponse(String directoryName, boolean recursive, DataLakeRequestConditions requestConditions) Deletes the specified sub-directory in the directory. If the sub-directory doesn't exist or is not empty the operation fails. For more information see the Azure Docs.Code Samples
DataLakeRequestConditions requestConditions = new DataLakeRequestConditions() .setLeaseId(leaseId); boolean recursive = false; // Default value client.deleteSubdirectoryWithResponse(directoryName, recursive, requestConditions) .subscribe(response -> System.out.println("Delete request completed"));
- Parameters:
directoryName
- Name of the sub-directory to delete.recursive
- Whether to delete all paths beneath the sub-directory.requestConditions
-DataLakeRequestConditions
- Returns:
- A
Mono
containing status code and HTTP headers
-
deleteSubdirectoryIfExists
Deletes the specified subdirectory in the directory if it exists. For more information see the Azure Docs.Code Samples
client.deleteSubdirectoryIfExists(directoryName).subscribe(deleted -> { if (deleted) { System.out.println("Successfully deleted."); } else { System.out.println("Does not exist."); } });
- Parameters:
subdirectoryName
- Name of the subdirectory to delete.- Returns:
- A reactive response signaling completion.
true
indicates that the subdirectory was deleted.false
indicates the specified subdirectory does not exist.
-
deleteSubdirectoryIfExistsWithResponse
public Mono<com.azure.core.http.rest.Response<Boolean>> deleteSubdirectoryIfExistsWithResponse(String directoryName, DataLakePathDeleteOptions options) Deletes the specified subdirectory in the directory 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.deleteSubdirectoryIfExistsWithResponse(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 subdirectory to delete.options
-DataLakePathDeleteOptions
- Returns:
- A reactive response signaling completion. If
Response
's status code is 200, the specified subdirectory was successfully deleted. If status code is 404, the specified subdirectory does not exist.
-
rename
public Mono<DataLakeDirectoryAsyncClient> rename(String destinationFileSystem, String destinationPath) Moves the directory to another location within the file system. For more information see the Azure Docs.Code Samples
DataLakeDirectoryAsyncClient renamedClient = client.rename(fileSystemName, destinationPath).block(); System.out.println("Directory Client has been renamed");
- Parameters:
destinationFileSystem
- The file system of the destination within the account.null
for the current file system.destinationPath
- Relative path from the file system to rename the directory to, excludes the file system name. For example if you want to move a directory with fileSystem = "myfilesystem", path = "mydir/mysubdir" to another path in myfilesystem (ex: newdir) then set the destinationPath = "newdir"- Returns:
- A
Mono
containing aDataLakeDirectoryAsyncClient
used to interact with the new directory created.
-
renameWithResponse
public Mono<com.azure.core.http.rest.Response<DataLakeDirectoryAsyncClient>> renameWithResponse(String destinationFileSystem, String destinationPath, DataLakeRequestConditions sourceRequestConditions, DataLakeRequestConditions destinationRequestConditions) Moves the directory to another location within the file system. For more information, see the Azure Docs.Code Samples
DataLakeRequestConditions sourceRequestConditions = new DataLakeRequestConditions() .setLeaseId(leaseId); DataLakeRequestConditions destinationRequestConditions = new DataLakeRequestConditions(); DataLakeDirectoryAsyncClient newRenamedClient = client.renameWithResponse(fileSystemName, destinationPath, sourceRequestConditions, destinationRequestConditions).block().getValue(); System.out.println("Directory Client has been renamed");
- Parameters:
destinationFileSystem
- The file system of the destination within the account.null
for the current file system.destinationPath
- Relative path from the file system to rename the directory to, excludes the file system name. For example if you want to move a directory with fileSystem = "myfilesystem", path = "mydir/mysubdir" to another path in myfilesystem (ex: newdir) then set the destinationPath = "newdir"sourceRequestConditions
-DataLakeRequestConditions
against the source.destinationRequestConditions
-DataLakeRequestConditions
against the destination.- Returns:
- A
Mono
containing aResponse
whosevalue
contains aDataLakeDirectoryAsyncClient
used to interact with the directory created.
-
listPaths
Returns a reactive Publisher emitting all the files/directories in this directory 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(boolean recursive, boolean userPrincipleNameReturned, Integer maxResults) Returns a reactive Publisher emitting all the files/directories in this directory lazily as needed. For more information, see the Azure Docs.Code Samples
client.listPaths(false, false, 10) .subscribe(path -> System.out.printf("Name: %s%n", path.getName()));
- Parameters:
recursive
- Specifies if the call should recursively include all paths.userPrincipleNameReturned
- If "true", the user identity values returned by the x-ms-owner, x-ms-group, and x-ms-acl response headers will be transformed from Azure Active Directory Object IDs to User Principal Names. If "false", the values will be returned as Azure Active Directory Object IDs. The default value is false. Note that group and application Object IDs are not translated because they do not have unique friendly names.maxResults
- Specifies the maximum number of blobs to return per page, including all BlobPrefix elements. If the request does not specify maxResults or specifies a value greater than 5,000, the server will return up to 5,000 items per page.- Returns:
- A reactive response emitting the list of files/directories.
-