public class DataLakeFileSystemAsyncClient extends Object
DataLakeFileSystemClientBuilder
or via the
method DataLakeServiceAsyncClient.getFileSystemAsyncClient(String)
. This class does not hold any state about
a particular blob but is instead a convenient way of sending off appropriate requests to the resource on the service.
It may also be used to construct clients for files/directories.
This client contains operations on a file system. Operations on a path are available on
DataLakeFileAsyncClient
and DataLakeDirectoryAsyncClient
through DataLakeFileSystemAsyncClient.getFileAsyncClient(String)
and DataLakeFileSystemAsyncClient.getDirectoryAsyncClient(String)
respectively, and operations on the service are available on
DataLakeServiceAsyncClient
.
Please refer to the Azure Docs for more information on file systems.
Note this client is an async client that returns reactive responses from Spring Reactor Core project
(https://projectreactor.io/). Calling the methods in this client will NOT start the actual network
operation, until .subscribe()
is called on the reactive response. You can simply convert one of these
responses to a CompletableFuture
object through Mono.toFuture()
.
Modifier and Type | Field and Description |
---|---|
static String |
ROOT_FILESYSTEM_NAME |
Modifier and Type | Method and Description |
---|---|
Mono<Void> |
create()
Creates a new file system within a storage account.
|
Mono<DataLakeDirectoryAsyncClient> |
createDirectory(String directoryName)
Creates a new directory within a file system.
|
Mono<DataLakeDirectoryAsyncClient> |
createDirectory(String directoryName,
boolean overwrite)
Creates a new directory within a file system.
|
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.
|
Mono<DataLakeFileAsyncClient> |
createFile(String fileName)
Creates a new file within a file system.
|
Mono<DataLakeFileAsyncClient> |
createFile(String fileName,
boolean overwrite)
Creates a new file within a file system.
|
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.
|
Mono<com.azure.core.http.rest.Response<Void>> |
createWithResponse(Map<String,String> metadata,
PublicAccessType accessType)
Creates a new file system within a storage account.
|
Mono<Void> |
delete()
Marks the specified file system for deletion.
|
Mono<Void> |
deleteDirectory(String directoryName)
Deletes the specified directory in the file system.
|
Mono<com.azure.core.http.rest.Response<Void>> |
deleteDirectoryWithResponse(String directoryName,
boolean recursive,
DataLakeRequestConditions requestConditions)
Deletes the specified directory in the file system.
|
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 file system.
|
Mono<com.azure.core.http.rest.Response<Void>> |
deleteWithResponse(DataLakeRequestConditions requestConditions)
Marks the specified file system for deletion.
|
String |
generateSas(DataLakeServiceSasSignatureValues dataLakeServiceSasSignatureValues)
Generates a service SAS for the file system using the specified
DataLakeServiceSasSignatureValues
Note : The client must be authenticated via StorageSharedKeyCredential |
String |
generateUserDelegationSas(DataLakeServiceSasSignatureValues dataLakeServiceSasSignatureValues,
UserDelegationKey userDelegationKey)
Generates a user delegation SAS for the file system using the specified
DataLakeServiceSasSignatureValues . |
Mono<FileSystemAccessPolicies> |
getAccessPolicy()
Returns the file system's permissions.
|
Mono<com.azure.core.http.rest.Response<FileSystemAccessPolicies>> |
getAccessPolicyWithResponse(String leaseId)
Returns the file system's permissions.
|
String |
getAccountName()
Get associated account name.
|
DataLakeDirectoryAsyncClient |
getDirectoryAsyncClient(String directoryName)
Initializes a new DataLakeDirectoryAsyncClient object by concatenating directoryName to the end of
DataLakeFileSystemAsyncClient's URL.
|
DataLakeFileAsyncClient |
getFileAsyncClient(String fileName)
Initializes a new DataLakeFileAsyncClient object by concatenating fileName to the end of
DataLakeFileSystemAsyncClient's URL.
|
String |
getFileSystemName()
Get the file system name.
|
String |
getFileSystemUrl()
Gets the URL of the file system represented by this client.
|
com.azure.core.http.HttpPipeline |
getHttpPipeline()
Gets the
HttpPipeline powering this client. |
Mono<FileSystemProperties> |
getProperties()
Returns the file system's metadata and system properties.
|
Mono<com.azure.core.http.rest.Response<FileSystemProperties>> |
getPropertiesWithResponse(String leaseId)
Returns the file system's metadata and system properties.
|
DataLakeServiceVersion |
getServiceVersion()
Gets the service version the client is using.
|
com.azure.core.http.rest.PagedFlux<PathItem> |
listPaths()
Returns a reactive Publisher emitting all the files/directories in this account lazily as needed.
|
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.
|
Mono<Void> |
setAccessPolicy(PublicAccessType accessType,
List<DataLakeSignedIdentifier> identifiers)
Sets the file system's permissions.
|
Mono<com.azure.core.http.rest.Response<Void>> |
setAccessPolicyWithResponse(PublicAccessType accessType,
List<DataLakeSignedIdentifier> identifiers,
DataLakeRequestConditions requestConditions)
Sets the file system's permissions.
|
Mono<Void> |
setMetadata(Map<String,String> metadata)
Sets the file system's metadata.
|
Mono<com.azure.core.http.rest.Response<Void>> |
setMetadataWithResponse(Map<String,String> metadata,
DataLakeRequestConditions requestConditions)
Sets the file systems's metadata.
|
public static final String ROOT_FILESYSTEM_NAME
public DataLakeFileAsyncClient getFileAsyncClient(String fileName)
Code Samples
DataLakeFileAsyncClient dataLakeFileAsyncClient = client.getFileAsyncClient(fileName);
fileName
- A String
representing the name of the file.DataLakeFileAsyncClient
object which references the file with the specified name in this
file system.public DataLakeDirectoryAsyncClient getDirectoryAsyncClient(String directoryName)
Code Samples
DataLakeDirectoryAsyncClient dataLakeDirectoryAsyncClient = client.getDirectoryAsyncClient(directoryName);
directoryName
- A String
representing the name of the directory.DataLakeDirectoryAsyncClient
object which references the directory with the specified name
in this file system.public String getFileSystemUrl()
public String getFileSystemName()
Code Samples
String fileSystemName = client.getFileSystemName(); System.out.println("The name of the file system is " + fileSystemName);
public String getAccountName()
public DataLakeServiceVersion getServiceVersion()
public com.azure.core.http.HttpPipeline getHttpPipeline()
HttpPipeline
powering this client.public Mono<Void> create()
Code Samples
client.create().subscribe( response -> System.out.printf("Create completed%n"), error -> System.out.printf("Error while creating file system %s%n", error));
public Mono<com.azure.core.http.rest.Response<Void>> createWithResponse(Map<String,String> metadata, PublicAccessType accessType)
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()));
metadata
- Metadata to associate with the file system.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.public Mono<Void> delete()
Code Samples
client.delete().subscribe( response -> System.out.printf("Delete completed%n"), error -> System.out.printf("Delete failed: %s%n", error));
public Mono<com.azure.core.http.rest.Response<Void>> deleteWithResponse(DataLakeRequestConditions requestConditions)
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()));
requestConditions
- DataLakeRequestConditions
UnsupportedOperationException
- If either MatchConditions.getIfMatch()
or
MatchConditions.getIfNoneMatch()
is set.public Mono<FileSystemProperties> getProperties()
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()));
Mono
containing a Response
whose value
containing the
file system properties.public Mono<com.azure.core.http.rest.Response<FileSystemProperties>> getPropertiesWithResponse(String leaseId)
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()));
leaseId
- The lease ID the active lease on the file system must match.public Mono<Void> setMetadata(Map<String,String> metadata)
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));
metadata
- Metadata to associate with the file system.public Mono<com.azure.core.http.rest.Response<Void>> setMetadataWithResponse(Map<String,String> metadata, DataLakeRequestConditions requestConditions)
Code Samples
Map<String, String> metadata = Collections.singletonMap("metadata", "value"); DataLakeRequestConditions requestConditions = new DataLakeRequestConditions() .setLeaseId(leaseId) .setIfUnmodifiedSince(OffsetDateTime.now().minusDays(3)); client.setMetadataWithResponse(metadata, requestConditions).subscribe(response -> System.out.printf("Set metadata completed with status %d%n", response.getStatusCode()));
metadata
- Metadata to associate with the file system.requestConditions
- DataLakeRequestConditions
Mono
containing a Response
whose value
contains signalling
completion.UnsupportedOperationException
- If one of MatchConditions.getIfMatch()
,
MatchConditions.getIfNoneMatch()
, or RequestConditions.getIfUnmodifiedSince()
is set.public com.azure.core.http.rest.PagedFlux<PathItem> listPaths()
Code Samples
client.listPaths().subscribe(path -> System.out.printf("Name: %s%n", path.getName()));
public com.azure.core.http.rest.PagedFlux<PathItem> listPaths(ListPathsOptions options)
Code Samples
ListPathsOptions options = new ListPathsOptions() .setPath("PathNamePrefixToMatch") .setMaxResults(10); client.listPaths(options).subscribe(path -> System.out.printf("Name: %s%n", path.getName()));
options
- A ListPathsOptions
which specifies what data should be returned by the service.public Mono<DataLakeFileAsyncClient> createFile(String fileName)
Code Samples
Mono<DataLakeFileAsyncClient> fileClient = client.createFile(fileName);
fileName
- Name of the file to create.Mono
containing a DataLakeFileAsyncClient
used to interact with the file created.public Mono<DataLakeFileAsyncClient> createFile(String fileName, boolean overwrite)
Code Samples
boolean overwrite = false; /* Default value. */ Mono<DataLakeFileAsyncClient> fClient = client.createFile(fileName, overwrite);
fileName
- Name of the file to create.overwrite
- Whether or not to overwrite, should a file exist.Mono
containing a DataLakeFileAsyncClient
used to interact with the file created.public Mono<com.azure.core.http.rest.Response<DataLakeFileAsyncClient>> createFileWithResponse(String fileName, String permissions, String umask, PathHttpHeaders headers, Map<String,String> metadata, DataLakeRequestConditions requestConditions)
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);
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.requestConditions
- DataLakeRequestConditions
Mono
containing a Response
whose value
contains a DataLakeFileAsyncClient
used to interact with the file created.public Mono<Void> deleteFile(String fileName)
Code Samples
client.deleteFile(fileName).subscribe(response -> System.out.println("Delete request completed"));
fileName
- Name of the file to delete.public Mono<com.azure.core.http.rest.Response<Void>> deleteFileWithResponse(String fileName, DataLakeRequestConditions requestConditions)
Code Samples
DataLakeRequestConditions requestConditions = new DataLakeRequestConditions() .setLeaseId(leaseId); client.deleteFileWithResponse(fileName, requestConditions) .subscribe(response -> System.out.println("Delete request completed"));
fileName
- Name of the file to delete.requestConditions
- DataLakeRequestConditions
Mono
containing containing status code and HTTP headerspublic Mono<DataLakeDirectoryAsyncClient> createDirectory(String directoryName)
Code Samples
Mono<DataLakeDirectoryAsyncClient> directoryClient = client.createDirectory(directoryName);
directoryName
- Name of the directory to create.Mono
containing a DataLakeDirectoryAsyncClient
used to interact with the directory
created.public Mono<DataLakeDirectoryAsyncClient> createDirectory(String directoryName, boolean overwrite)
Code Samples
boolean overwrite = false; /* Default value. */ Mono<DataLakeDirectoryAsyncClient> dClient = client.createDirectory(directoryName, overwrite);
directoryName
- Name of the directory to create.overwrite
- Whether or not to overwrite, should a directory exist.Mono
containing a DataLakeDirectoryAsyncClient
used to interact with the directory
created.public Mono<com.azure.core.http.rest.Response<DataLakeDirectoryAsyncClient>> createDirectoryWithResponse(String directoryName, String permissions, String umask, PathHttpHeaders headers, Map<String,String> metadata, DataLakeRequestConditions requestConditions)
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);
directoryName
- Name of the directory to create.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 directory.requestConditions
- DataLakeRequestConditions
Mono
containing a Response
whose value
contains a DataLakeDirectoryAsyncClient
used to interact with the directory created.public Mono<Void> deleteDirectory(String directoryName)
Code Samples
client.deleteDirectory(directoryName).subscribe(response -> System.out.println("Delete request completed"));
directoryName
- Name of the directory to delete.public Mono<com.azure.core.http.rest.Response<Void>> deleteDirectoryWithResponse(String directoryName, boolean recursive, DataLakeRequestConditions requestConditions)
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"));
directoryName
- Name of the directory to delete.recursive
- Whether or not to delete all paths beneath the directory.requestConditions
- DataLakeRequestConditions
Mono
containing containing status code and HTTP headerspublic Mono<Void> setAccessPolicy(PublicAccessType accessType, List<DataLakeSignedIdentifier> identifiers)
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));
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.public Mono<com.azure.core.http.rest.Response<Void>> setAccessPolicyWithResponse(PublicAccessType accessType, List<DataLakeSignedIdentifier> identifiers, DataLakeRequestConditions requestConditions)
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()));
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
UnsupportedOperationException
- If either MatchConditions.getIfMatch()
or
MatchConditions.getIfNoneMatch()
is set.public Mono<FileSystemAccessPolicies> getAccessPolicy()
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()); } });
public Mono<com.azure.core.http.rest.Response<FileSystemAccessPolicies>> getAccessPolicyWithResponse(String leaseId)
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()); } });
leaseId
- The lease ID the active lease on the file system must match.public String generateUserDelegationSas(DataLakeServiceSasSignatureValues dataLakeServiceSasSignatureValues, UserDelegationKey userDelegationKey)
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);
dataLakeServiceSasSignatureValues
- DataLakeServiceSasSignatureValues
userDelegationKey
- A UserDelegationKey
object used to sign the SAS values.String
representing all SAS query parameters.for more information on how
to get a user delegation key.
public String generateSas(DataLakeServiceSasSignatureValues dataLakeServiceSasSignatureValues)
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
dataLakeServiceSasSignatureValues
- DataLakeServiceSasSignatureValues
String
representing all SAS query parameters.Copyright © 2020 Microsoft Corporation. All rights reserved.