Package com.azure.storage.file.datalake
Class DataLakeDirectoryAsyncClient
- java.lang.Object
-
- com.azure.storage.file.datalake.DataLakePathAsyncClient
-
- com.azure.storage.file.datalake.DataLakeDirectoryAsyncClient
-
public final class DataLakeDirectoryAsyncClient extends DataLakePathAsyncClient
This class provides a client that contains directory operations for Azure Storage Data Lake. Operations provided by this client include creating a directory, deleting a directory, renaming a directory, setting metadata and http headers, setting and retrieving access control, getting properties and creating and deleting files and subdirectories.This client is instantiated through
DataLakePathClientBuilder
or retrieved viagetDirectoryAsyncClient
.Please refer to the Azure Docs for more information.
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Mono<DataLakeFileAsyncClient>
createFile(String fileName)
Creates a new file within a directory.Mono<DataLakeFileAsyncClient>
createFile(String fileName, boolean overwrite)
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.Mono<DataLakeDirectoryAsyncClient>
createSubdirectory(String subdirectoryName)
Creates a new sub-directory within a directory.Mono<DataLakeDirectoryAsyncClient>
createSubdirectory(String subdirectoryName, boolean overwrite)
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.Mono<Void>
delete()
Deletes a directory.Mono<Void>
deleteFile(String fileName)
Deletes the specified file in the file system.Mono<com.azure.core.http.rest.Response<Void>>
deleteFileWithResponse(String fileName, DataLakeRequestConditions requestConditions)
Deletes the specified file in the directory.Mono<Void>
deleteSubdirectory(String subdirectoryName)
Deletes the specified sub-directory in the directory.Mono<com.azure.core.http.rest.Response<Void>>
deleteSubdirectoryWithResponse(String directoryName, boolean recursive, DataLakeRequestConditions requestConditions)
Deletes the specified sub-directory in the directory.Mono<com.azure.core.http.rest.Response<Void>>
deleteWithResponse(boolean recursive, DataLakeRequestConditions requestConditions)
Deletes a directory.String
getDirectoryName()
Gets the name of this directory, not including its full path.String
getDirectoryPath()
Gets the path of this directory, not including the name of the resource itself.String
getDirectoryUrl()
Gets the URL of the directory represented by this client on the Data Lake service.DataLakeFileAsyncClient
getFileAsyncClient(String fileName)
Creates a new DataLakeFileAsyncClient object by concatenating fileName to the end of DataLakeDirectoryAsyncClient's URL.DataLakeDirectoryAsyncClient
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>
listPaths()
Returns a reactive Publisher emitting all the files/directories in this directory lazily as needed.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.Mono<DataLakeDirectoryAsyncClient>
rename(String destinationFileSystem, String destinationPath)
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, createWithResponse, exists, existsWithResponse, generateSas, generateSas, generateUserDelegationSas, generateUserDelegationSas, getAccessControl, getAccessControlWithResponse, getAccountName, getFileSystemName, getHttpPipeline, getProperties, getPropertiesWithResponse, getServiceVersion, removeAccessControlRecursive, removeAccessControlRecursiveWithResponse, setAccessControlList, setAccessControlListWithResponse, setAccessControlRecursive, setAccessControlRecursiveWithResponse, setHttpHeaders, setHttpHeadersWithResponse, setMetadata, setMetadataWithResponse, setPermissions, setPermissionsWithResponse, updateAccessControlRecursive, updateAccessControlRecursiveWithResponse
-
-
-
-
Method Detail
-
getDirectoryUrl
public String getDirectoryUrl()
Gets the URL of the directory represented by this client on the Data Lake service.- Returns:
- the URL.
-
getDirectoryPath
public String getDirectoryPath()
Gets the path of this directory, not including the name of the resource itself.- Returns:
- The path of the directory.
-
getDirectoryName
public String getDirectoryName()
Gets the name of this directory, not including its full path.- Returns:
- The name of the directory.
-
delete
public Mono<Void> 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.
-
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 or not to delete all paths beneath the directory.requestConditions
-DataLakeRequestConditions
- Returns:
- A reactive response signalling completion.
-
getFileAsyncClient
public DataLakeFileAsyncClient getFileAsyncClient(String fileName)
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
public Mono<DataLakeFileAsyncClient> createFile(String fileName)
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
public Mono<DataLakeFileAsyncClient> createFile(String fileName, boolean overwrite)
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 or not 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.
-
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.- 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 containing status code and HTTP headers
-
getSubdirectoryAsyncClient
public DataLakeDirectoryAsyncClient getSubdirectoryAsyncClient(String subdirectoryName)
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
public Mono<DataLakeDirectoryAsyncClient> createSubdirectory(String subdirectoryName)
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 or not to overwrite, should the sub directory 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.
-
deleteSubdirectory
public Mono<Void> deleteSubdirectory(String subdirectoryName)
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 or not to delete all paths beneath the sub-directory.requestConditions
-DataLakeRequestConditions
- Returns:
- A
Mono
containing containing status code and HTTP headers
-
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
public com.azure.core.http.rest.PagedFlux<PathItem> 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 in 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.
-
-