public class DataLakeServiceAsyncClient extends Object
DataLakeServiceClientBuilder
. This class
does not hold any state about a particular storage account but is instead a convenient way of sending off appropriate
requests to the resource on the service. It may also be used to construct URLs to file systems, files and
directories.
This client contains operations on the main data lake service account. Operations on a file system are available on
DataLakeFileSystemAsyncClient
through DataLakeServiceAsyncClient.getFileSystemAsyncClient(String)
, and operations on a file or
directory are available on DataLakeFileAsyncClient
or DataLakeDirectoryAsyncClient
.
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 | Method and Description |
---|---|
Mono<DataLakeFileSystemAsyncClient> |
createFileSystem(String fileSystemName)
Creates a new file system within a storage account.
|
Mono<com.azure.core.http.rest.Response<DataLakeFileSystemAsyncClient>> |
createFileSystemWithResponse(String fileSystemName,
Map<String,String> metadata,
PublicAccessType accessType)
Creates a new file system within a storage account.
|
Mono<Void> |
deleteFileSystem(String fileSystemName)
Deletes the specified file system in the storage account.
|
Mono<com.azure.core.http.rest.Response<Void>> |
deleteFileSystemWithResponse(String fileSystemName,
DataLakeRequestConditions requestConditions)
Deletes the specified file system in the storage account.
|
String |
generateAccountSas(com.azure.storage.common.sas.AccountSasSignatureValues accountSasSignatureValues)
Generates an account SAS for the Azure Storage account using the specified
AccountSasSignatureValues . |
String |
getAccountName()
Get associated account name.
|
String |
getAccountUrl()
Gets the URL of the storage account represented by this client.
|
DataLakeFileSystemAsyncClient |
getFileSystemAsyncClient(String fileSystemName)
Initializes a
DataLakeFileSystemAsyncClient object pointing to the specified file system. |
com.azure.core.http.HttpPipeline |
getHttpPipeline()
Gets the
HttpPipeline powering this client. |
DataLakeServiceVersion |
getServiceVersion()
Gets the service version the client is using.
|
Mono<UserDelegationKey> |
getUserDelegationKey(OffsetDateTime start,
OffsetDateTime expiry)
Gets a user delegation key for use with this account's data lake storage.
|
Mono<com.azure.core.http.rest.Response<UserDelegationKey>> |
getUserDelegationKeyWithResponse(OffsetDateTime start,
OffsetDateTime expiry)
Gets a user delegation key for use with this account's data lake storage.
|
com.azure.core.http.rest.PagedFlux<FileSystemItem> |
listFileSystems()
Returns a reactive Publisher emitting all the file systems in this account lazily as needed.
|
com.azure.core.http.rest.PagedFlux<FileSystemItem> |
listFileSystems(ListFileSystemsOptions options)
Returns a reactive Publisher emitting all the file systems in this account lazily as needed.
|
public DataLakeFileSystemAsyncClient getFileSystemAsyncClient(String fileSystemName)
DataLakeFileSystemAsyncClient
object pointing to the specified file system. This method
does not create a file system. It simply constructs the URL to the file system and offers access to methods
relevant to file systems.
Code Samples
DataLakeFileSystemAsyncClient dataLakeFileSystemAsyncClient = client.getFileSystemAsyncClient("fileSystemName");
fileSystemName
- The name of the file system to point to. A value of null or empty string will be
interpreted as pointing to the root file system and will be replaced by "$root".DataLakeFileSystemAsyncClient
object pointing to the specified file systempublic com.azure.core.http.HttpPipeline getHttpPipeline()
HttpPipeline
powering this client.public DataLakeServiceVersion getServiceVersion()
public Mono<DataLakeFileSystemAsyncClient> createFileSystem(String fileSystemName)
Code Samples
DataLakeFileSystemAsyncClient dataLakeFileSystemAsyncClient = client.createFileSystem("fileSystemName").block();
fileSystemName
- Name of the file system to createMono
containing a DataLakeFileSystemAsyncClient
used to interact with the file system
created.public Mono<com.azure.core.http.rest.Response<DataLakeFileSystemAsyncClient>> createFileSystemWithResponse(String fileSystemName, Map<String,String> metadata, PublicAccessType accessType)
Code Samples
Map<String, String> metadata = Collections.singletonMap("metadata", "value"); DataLakeFileSystemAsyncClient dataLakeFileSystemAsyncClient = client .createFileSystemWithResponse("fileSystemName", metadata, PublicAccessType.CONTAINER).block().getValue();
fileSystemName
- Name of the file system to createmetadata
- Metadata to associate with the file systemaccessType
- 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.Mono
containing a Response
whose value
contains a DataLakeFileSystemAsyncClient
used to interact with the file system created.public Mono<Void> deleteFileSystem(String fileSystemName)
Code Samples
client.deleteFileSystem("fileSystemName").subscribe( response -> System.out.printf("Delete file system completed%n"), error -> System.out.printf("Delete file system failed: %s%n", error));
fileSystemName
- Name of the file system to deletepublic Mono<com.azure.core.http.rest.Response<Void>> deleteFileSystemWithResponse(String fileSystemName, DataLakeRequestConditions requestConditions)
Code Samples
client.deleteFileSystemWithResponse("fileSystemName", new DataLakeRequestConditions()).subscribe(response -> System.out.printf("Delete file system completed with status %d%n", response.getStatusCode()));
fileSystemName
- Name of the file system to deleterequestConditions
- DataLakeRequestConditions
Mono
containing containing status code and HTTP headerspublic String getAccountUrl()
public com.azure.core.http.rest.PagedFlux<FileSystemItem> listFileSystems()
Code Samples
client.listFileSystems().subscribe(fileSystem -> System.out.printf("Name: %s%n", fileSystem.getName()));
public com.azure.core.http.rest.PagedFlux<FileSystemItem> listFileSystems(ListFileSystemsOptions options)
Code Samples
ListFileSystemsOptions options = new ListFileSystemsOptions() .setPrefix("fileSystemNamePrefixToMatch") .setDetails(new FileSystemListDetails().setRetrieveMetadata(true)); client.listFileSystems(options).subscribe(fileSystem -> System.out.printf("Name: %s%n", fileSystem.getName()));
options
- A ListFileSystemsOptions
which specifies what data should be returned by the service.public Mono<UserDelegationKey> getUserDelegationKey(OffsetDateTime start, OffsetDateTime expiry)
TokenCredential
in this object's HttpPipeline
.
Code Samples
client.getUserDelegationKey(delegationKeyStartTime, delegationKeyExpiryTime).subscribe(response -> System.out.printf("User delegation key: %s%n", response.getValue()));
start
- Start time for the key's validity. Null indicates immediate start.expiry
- Expiration of the key's validity.Mono
containing the user delegation key.IllegalArgumentException
- If start
isn't null and is after expiry
.NullPointerException
- If expiry
is null.public Mono<com.azure.core.http.rest.Response<UserDelegationKey>> getUserDelegationKeyWithResponse(OffsetDateTime start, OffsetDateTime expiry)
TokenCredential
in this object's HttpPipeline
.
Code Samples
client.getUserDelegationKeyWithResponse(delegationKeyStartTime, delegationKeyExpiryTime).subscribe(response -> System.out.printf("User delegation key: %s%n", response.getValue().getValue()));
start
- Start time for the key's validity. Null indicates immediate start.expiry
- Expiration of the key's validity.Mono
containing a Response
whose value
containing the user
delegation key.IllegalArgumentException
- If start
isn't null and is after expiry
.NullPointerException
- If expiry
is null.public String getAccountName()
public String generateAccountSas(com.azure.storage.common.sas.AccountSasSignatureValues accountSasSignatureValues)
AccountSasSignatureValues
.
Note : The client must be authenticated via StorageSharedKeyCredential
See AccountSasSignatureValues
for more information on how to construct an account SAS.
The snippet below generates a SAS that lasts for two days and gives the user read and list access to file systems and file shares.
AccountSasPermission permissions = new AccountSasPermission() .setListPermission(true) .setReadPermission(true); AccountSasResourceType resourceTypes = new AccountSasResourceType().setContainer(true); AccountSasService services = new AccountSasService().setBlobAccess(true).setFileAccess(true); OffsetDateTime expiryTime = OffsetDateTime.now().plus(Duration.ofDays(2)); AccountSasSignatureValues sasValues = new AccountSasSignatureValues(expiryTime, permissions, services, resourceTypes); // Client must be authenticated via StorageSharedKeyCredential String sas = client.generateAccountSas(sasValues);
accountSasSignatureValues
- AccountSasSignatureValues
String
representing all SAS query parameters.Copyright © 2020 Microsoft Corporation. All rights reserved.