DataLakePathAsyncClient Class
- java.
lang. Object - com.
azure. storage. file. datalake. DataLakePathAsyncClient
- com.
public class DataLakePathAsyncClient
This class provides a client that contains all operations that apply to any path object.
Method Summary
Methods inherited from java.lang.Object
Method Details
create
public Mono
Creates a resource. By default, this method will not overwrite an existing path.
Code Samples
client.create().subscribe(response ->
System.out.printf("Last Modified Time:%s", response.getLastModified()));
For more information see the Azure Docs
Returns:
create
public Mono
Creates a resource.
Code Samples
boolean overwrite = true;
client.create(overwrite).subscribe(response ->
System.out.printf("Last Modified Time:%s", response.getLastModified()));
For more information see the Azure Docs
Parameters:
Returns:
createIfNotExists
public Mono
Creates a resource if it does not exist.
Code Samples
client.createIfNotExists().subscribe(response ->
System.out.printf("Created at %s%n", response.getLastModified()));
For more information see the Azure Docs
Returns:
createIfNotExistsWithResponse
public Mono
Creates a resource if it does not exist.
Code Samples
PathHttpHeaders headers = new PathHttpHeaders()
.setContentLanguage("en-US")
.setContentType("binary");
String permissions = "permissions";
String umask = "umask";
Map<String, String> metadata = Collections.singletonMap("metadata", "value");
DataLakePathCreateOptions options = new DataLakePathCreateOptions()
.setPermissions(permissions)
.setUmask(umask)
.setPathHttpHeaders(headers)
.setMetadata(metadata);
client.createIfNotExistsWithResponse(options).subscribe(response -> {
if (response.getStatusCode() == 409) {
System.out.println("Already exists.");
} else {
System.out.println("successfully created.");
}
});
For more information see the Azure Docs
Parameters:
Returns:
createWithResponse
public Mono
Creates a resource.
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);
client.createWithResponse(options).subscribe(response ->
System.out.printf("Last Modified Time:%s", response.getValue().getLastModified()));
For more information see the Azure Docs
Parameters:
Returns:
createWithResponse
public Mono
Creates a resource.
Code Samples
PathHttpHeaders httpHeaders = new PathHttpHeaders()
.setContentLanguage("en-US")
.setContentType("binary");
DataLakeRequestConditions requestConditions = new DataLakeRequestConditions()
.setLeaseId(leaseId);
String permissions = "permissions";
String umask = "umask";
client.createWithResponse(permissions, umask, httpHeaders, Collections.singletonMap("metadata", "value"),
requestConditions)
.subscribe(response -> System.out.printf("Last Modified Time:%s", response.getValue().getLastModified()));
For more information see the Azure Docs
Parameters:
Returns:
deleteIfExists
public Mono
Deletes paths under the resource if it exists.
Code Samples
client.deleteIfExists().subscribe(
response -> System.out.printf("Delete completed%n"),
error -> System.out.printf("Delete failed: %s%n", error));
For more information see the Azure Docs
Returns:
true
indicates that the resource under the path was
successfully deleted, false
indicates the resource did not exist.deleteIfExistsWithResponse
public Mono
Deletes all paths under the specified resource if exists.
Code Samples
DataLakeRequestConditions requestConditions = new DataLakeRequestConditions()
.setLeaseId(leaseId);
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.");
}
});
For more information see the Azure Docs
Parameters:
Returns:
exists
public Mono
Determines if the path this client represents exists in the cloud.
Note that this method does not guarantee that the path type (file/directory) matches expectations.
For example, a DataLakeFileClient representing a path to a datalake directory will return true, and vice versa.
Code Samples
client.exists().subscribe(response -> System.out.printf("Exists? %b%n", response));
Returns:
existsWithResponse
public Mono
Determines if the path this client represents exists in the cloud.
Note that this method does not guarantee that the path type (file/directory) matches expectations.
For example, a DataLakeFileClient representing a path to a datalake directory will return true, and vice versa.
Code Samples
client.existsWithResponse().subscribe(response -> System.out.printf("Exists? %b%n", response.getValue()));
Returns:
generateSas
public String generateSas(DataLakeServiceSasSignatureValues dataLakeServiceSasSignatureValues)
Generates a service SAS for the path 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);
PathSasPermission permission = new PathSasPermission().setReadPermission(true);
DataLakeServiceSasSignatureValues values = new DataLakeServiceSasSignatureValues(expiryTime, permission)
.setStartTime(OffsetDateTime.now());
client.generateSas(values); // Client must be authenticated via StorageSharedKeyCredential
Parameters:
Returns:
String
representing the SAS query parameters.generateSas
public String generateSas(DataLakeServiceSasSignatureValues dataLakeServiceSasSignatureValues, Context context)
Generates a service SAS for the path 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);
PathSasPermission permission = new PathSasPermission().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:
Returns:
String
representing the SAS query parameters.generateSas
public String generateSas(DataLakeServiceSasSignatureValues dataLakeServiceSasSignatureValues, Consumer
Generates a service SAS for the path using the specified DataLakeServiceSasSignatureValues
Note : The client must be authenticated via StorageSharedKeyCredential
See DataLakeServiceSasSignatureValues for more information on how to construct a service SAS.
Parameters:
Returns:
String
representing the SAS query parameters.generateUserDelegationSas
public String generateUserDelegationSas(DataLakeServiceSasSignatureValues dataLakeServiceSasSignatureValues, UserDelegationKey userDelegationKey)
Generates a user delegation SAS for the path 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);
PathSasPermission myPermission = new PathSasPermission().setReadPermission(true);
DataLakeServiceSasSignatureValues myValues = new DataLakeServiceSasSignatureValues(expiryTime, permission)
.setStartTime(OffsetDateTime.now());
client.generateUserDelegationSas(values, userDelegationKey);
Parameters:
Returns:
String
representing the SAS query parameters.generateUserDelegationSas
public String generateUserDelegationSas(DataLakeServiceSasSignatureValues dataLakeServiceSasSignatureValues, UserDelegationKey userDelegationKey, String accountName, Context context)
Generates a user delegation SAS for the path 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);
PathSasPermission myPermission = new PathSasPermission().setReadPermission(true);
DataLakeServiceSasSignatureValues myValues = new DataLakeServiceSasSignatureValues(expiryTime, permission)
.setStartTime(OffsetDateTime.now());
client.generateUserDelegationSas(values, userDelegationKey, accountName, new Context("key", "value"));
Parameters:
Returns:
String
representing the SAS query parameters.generateUserDelegationSas
public String generateUserDelegationSas(DataLakeServiceSasSignatureValues dataLakeServiceSasSignatureValues, UserDelegationKey userDelegationKey, String accountName, Consumer
Generates a user delegation SAS for the path using the specified DataLakeServiceSasSignatureValues.
See DataLakeServiceSasSignatureValues for more information on how to construct a user delegation SAS.
Parameters:
Returns:
String
representing the SAS query parameters.getAccessControl
public Mono
Returns the access control for a resource.
Code Samples
client.getAccessControl().subscribe(
response -> System.out.printf("Access Control List: %s, Group: %s, Owner: %s, Permissions: %s",
PathAccessControlEntry.serializeList(response.getAccessControlList()), response.getGroup(),
response.getOwner(), response.getPermissions()));
For more information, see the Azure Docs
Returns:
getAccessControlWithResponse
public Mono
Returns the access control for a resource.
Code Samples
DataLakeRequestConditions requestConditions = new DataLakeRequestConditions().setLeaseId(leaseId);
boolean userPrincipalNameReturned = false;
client.getAccessControlWithResponse(userPrincipalNameReturned, requestConditions).subscribe(
response -> System.out.printf("Access Control List: %s, Group: %s, Owner: %s, Permissions: %s",
PathAccessControlEntry.serializeList(response.getValue().getAccessControlList()),
response.getValue().getGroup(), response.getValue().getOwner(), response.getValue().getPermissions()));
For more information, see the Azure Docs
Parameters:
Returns:
getAccountName
public String getAccountName()
Gets the associated account name.
Returns:
getCustomerProvidedKey
public CustomerProvidedKey getCustomerProvidedKey()
Gets the CpkInfo used to encrypt this path's content on the server.
Returns:
getCustomerProvidedKeyAsyncClient
public DataLakePathAsyncClient getCustomerProvidedKeyAsyncClient(CustomerProvidedKey customerProvidedKey)
Creates a new DataLakePathAsyncClient with the specified customerProvidedKey
.
Parameters:
null
to use no customer provided key.
Returns:
customerProvidedKey
.getFileSystemName
public String getFileSystemName()
Gets the name of the File System in which this object lives.
Returns:
getHttpPipeline
public HttpPipeline getHttpPipeline()
Gets the HttpPipeline powering this client.
Returns:
getProperties
public Mono
Returns the resource's metadata and properties.
Code Samples
client.getProperties().subscribe(response ->
System.out.printf("Creation Time: %s, Size: %d%n", response.getCreationTime(), response.getFileSize()));
For more information, see the Azure Docs
Returns:
getProperties
public Mono
Returns the resource's metadata and properties.
Code Samples
PathGetPropertiesOptions options = new PathGetPropertiesOptions().setUserPrincipalName(true);
client.getProperties(options).subscribe(response ->
System.out.printf("Creation Time: %s, Size: %d%n", response.getCreationTime(), response.getFileSize()));
For more information, see the Azure Docs
Parameters:
Returns:
getPropertiesWithResponse
public Mono
Returns the resource's metadata and properties.
Code Samples
DataLakeRequestConditions requestConditions = new DataLakeRequestConditions().setLeaseId(leaseId);
client.getPropertiesWithResponse(requestConditions).subscribe(
response -> System.out.printf("Creation Time: %s, Size: %d%n", response.getValue().getCreationTime(),
response.getValue().getFileSize()));
For more information, see the Azure Docs
Parameters:
Returns:
getServiceVersion
public DataLakeServiceVersion getServiceVersion()
Gets the service version the client is using.
Returns:
removeAccessControlRecursive
public Mono
Recursively removes the access control on a path and all subpaths.
Code Samples
PathRemoveAccessControlEntry pathAccessControlEntry = new PathRemoveAccessControlEntry()
.setEntityId("entityId");
List<PathRemoveAccessControlEntry> pathAccessControlEntries = new ArrayList<>();
pathAccessControlEntries.add(pathAccessControlEntry);
client.removeAccessControlRecursive(pathAccessControlEntries).subscribe(
response -> System.out.printf("Successful changed file operations: %d",
response.getCounters().getChangedFilesCount()));
For more information, see the Azure Docs
Parameters:
Returns:
removeAccessControlRecursiveWithResponse
public Mono
Recursively removes the access control on a path and all subpaths.
Code Samples
PathRemoveAccessControlEntry pathAccessControlEntry = new PathRemoveAccessControlEntry()
.setEntityId("entityId");
List<PathRemoveAccessControlEntry> pathAccessControlEntries = new ArrayList<>();
pathAccessControlEntries.add(pathAccessControlEntry);
Integer batchSize = 2;
Integer maxBatches = 10;
boolean continueOnFailure = false;
String continuationToken = null;
Consumer<Response<AccessControlChanges>> progressHandler =
response -> System.out.println("Received response");
PathRemoveAccessControlRecursiveOptions options =
new PathRemoveAccessControlRecursiveOptions(pathAccessControlEntries)
.setBatchSize(batchSize)
.setMaxBatches(maxBatches)
.setContinueOnFailure(continueOnFailure)
.setContinuationToken(continuationToken)
.setProgressHandler(progressHandler);
client.removeAccessControlRecursive(pathAccessControlEntries).subscribe(
response -> System.out.printf("Successful changed file operations: %d",
response.getCounters().getChangedFilesCount()));
For more information, see the Azure Docs
Parameters:
Returns:
setAccessControlList
public Mono
Changes the access control list, group and/or owner for a resource.
Code Samples
PathAccessControlEntry pathAccessControlEntry = new PathAccessControlEntry()
.setEntityId("entityId")
.setPermissions(new RolePermissions().setReadPermission(true));
List<PathAccessControlEntry> pathAccessControlEntries = new ArrayList<>();
pathAccessControlEntries.add(pathAccessControlEntry);
String group = "group";
String owner = "owner";
client.setAccessControlList(pathAccessControlEntries, group, owner).subscribe(
response -> System.out.printf("Last Modified Time: %s", response.getLastModified()));
For more information, see the Azure Docs
Parameters:
Returns:
setAccessControlListWithResponse
public Mono
Changes the access control list, group and/or owner for a resource.
Code Samples
DataLakeRequestConditions requestConditions = new DataLakeRequestConditions().setLeaseId(leaseId);
PathAccessControlEntry pathAccessControlEntry = new PathAccessControlEntry()
.setEntityId("entityId")
.setPermissions(new RolePermissions().setReadPermission(true));
List<PathAccessControlEntry> pathAccessControlEntries = new ArrayList<>();
pathAccessControlEntries.add(pathAccessControlEntry);
String group = "group";
String owner = "owner";
client.setAccessControlListWithResponse(pathAccessControlEntries, group, owner, requestConditions).subscribe(
response -> System.out.printf("Last Modified Time: %s", response.getValue().getLastModified()));
For more information, see the Azure Docs
Parameters:
Returns:
setAccessControlRecursive
public Mono
Recursively sets the access control on a path and all subpaths.
Code Samples
PathAccessControlEntry pathAccessControlEntry = new PathAccessControlEntry()
.setEntityId("entityId")
.setPermissions(new RolePermissions().setReadPermission(true));
List<PathAccessControlEntry> pathAccessControlEntries = new ArrayList<>();
pathAccessControlEntries.add(pathAccessControlEntry);
client.setAccessControlRecursive(pathAccessControlEntries).subscribe(
response -> System.out.printf("Successful changed file operations: %d",
response.getCounters().getChangedFilesCount()));
For more information, see the Azure Docs
Parameters:
Returns:
setAccessControlRecursiveWithResponse
public Mono
Recursively sets the access control on a path and all subpaths.
Code Samples
PathAccessControlEntry pathAccessControlEntry = new PathAccessControlEntry()
.setEntityId("entityId")
.setPermissions(new RolePermissions().setReadPermission(true));
List<PathAccessControlEntry> pathAccessControlEntries = new ArrayList<>();
pathAccessControlEntries.add(pathAccessControlEntry);
Integer batchSize = 2;
Integer maxBatches = 10;
boolean continueOnFailure = false;
String continuationToken = null;
Consumer<Response<AccessControlChanges>> progressHandler =
response -> System.out.println("Received response");
PathSetAccessControlRecursiveOptions options =
new PathSetAccessControlRecursiveOptions(pathAccessControlEntries)
.setBatchSize(batchSize)
.setMaxBatches(maxBatches)
.setContinueOnFailure(continueOnFailure)
.setContinuationToken(continuationToken)
.setProgressHandler(progressHandler);
client.setAccessControlRecursive(pathAccessControlEntries).subscribe(
response -> System.out.printf("Successful changed file operations: %d",
response.getCounters().getChangedFilesCount()));
For more information, see the Azure Docs
Parameters:
Returns:
setHttpHeaders
public Mono
Changes a resource's HTTP header properties. If only one HTTP header is updated, the others will all be erased. In order to preserve existing values, they must be passed alongside the header being changed.
Code Samples
client.setHttpHeaders(new PathHttpHeaders()
.setContentLanguage("en-US")
.setContentType("binary"));
For more information, see the Azure Docs
Parameters:
Returns:
setHttpHeadersWithResponse
public Mono
Changes a resource's HTTP header properties. If only one HTTP header is updated, the others will all be erased. In order to preserve existing values, they must be passed alongside the header being changed.
Code Samples
DataLakeRequestConditions requestConditions = new DataLakeRequestConditions().setLeaseId(leaseId);
client.setHttpHeadersWithResponse(new PathHttpHeaders()
.setContentLanguage("en-US")
.setContentType("binary"), requestConditions).subscribe(response ->
System.out.printf("Set HTTP headers completed with status %d%n", response.getStatusCode()));
For more information, see the Azure Docs
Parameters:
Returns:
setMetadata
public Mono
Changes a resource's metadata. The specified metadata in this method will replace existing metadata. If old values must be preserved, they must be downloaded and included in the call to this method.
Code Samples
client.setMetadata(Collections.singletonMap("metadata", "value"))
.subscribe(response -> System.out.println("Set metadata completed"));
For more information, see the Azure Docs
Parameters:
Returns:
setMetadataWithResponse
public Mono
Changes a resource's metadata. The specified metadata in this method will replace existing metadata. If old values must be preserved, they must be downloaded and included in the call to this method.
Code Samples
DataLakeRequestConditions requestConditions = new DataLakeRequestConditions().setLeaseId(leaseId);
client.setMetadataWithResponse(Collections.singletonMap("metadata", "value"), requestConditions)
.subscribe(response -> System.out.printf("Set metadata completed with status %d%n",
response.getStatusCode()));
For more information, see the Azure Docs
Parameters:
Returns:
setPermissions
public Mono
Changes the permissions, group and/or owner for a resource.
Code Samples
PathPermissions permissions = new PathPermissions()
.setGroup(new RolePermissions().setExecutePermission(true).setReadPermission(true))
.setOwner(new RolePermissions().setExecutePermission(true).setReadPermission(true).setWritePermission(true))
.setOther(new RolePermissions().setReadPermission(true));
String group = "group";
String owner = "owner";
client.setPermissions(permissions, group, owner).subscribe(
response -> System.out.printf("Last Modified Time: %s", response.getLastModified()));
For more information, see the Azure Docs
Parameters:
Returns:
setPermissionsWithResponse
public Mono
Changes the permissions, group and/or owner for a resource.
Code Samples
DataLakeRequestConditions requestConditions = new DataLakeRequestConditions().setLeaseId(leaseId);
PathPermissions permissions = new PathPermissions()
.setGroup(new RolePermissions().setExecutePermission(true).setReadPermission(true))
.setOwner(new RolePermissions().setExecutePermission(true).setReadPermission(true).setWritePermission(true))
.setOther(new RolePermissions().setReadPermission(true));
String group = "group";
String owner = "owner";
client.setPermissionsWithResponse(permissions, group, owner, requestConditions).subscribe(
response -> System.out.printf("Last Modified Time: %s", response.getValue().getLastModified()));
For more information, see the Azure Docs
Parameters:
Returns:
updateAccessControlRecursive
public Mono
Recursively updates the access control on a path and all subpaths.
Code Samples
PathAccessControlEntry pathAccessControlEntry = new PathAccessControlEntry()
.setEntityId("entityId")
.setPermissions(new RolePermissions().setReadPermission(true));
List<PathAccessControlEntry> pathAccessControlEntries = new ArrayList<>();
pathAccessControlEntries.add(pathAccessControlEntry);
client.updateAccessControlRecursive(pathAccessControlEntries).subscribe(
response -> System.out.printf("Successful changed file operations: %d",
response.getCounters().getChangedFilesCount()));
For more information, see the Azure Docs
Parameters:
Returns:
updateAccessControlRecursiveWithResponse
public Mono
Recursively updates the access control on a path and all subpaths.
Code Samples
PathAccessControlEntry pathAccessControlEntry = new PathAccessControlEntry()
.setEntityId("entityId")
.setPermissions(new RolePermissions().setReadPermission(true));
List<PathAccessControlEntry> pathAccessControlEntries = new ArrayList<>();
pathAccessControlEntries.add(pathAccessControlEntry);
Integer batchSize = 2;
Integer maxBatches = 10;
boolean continueOnFailure = false;
String continuationToken = null;
Consumer<Response<AccessControlChanges>> progressHandler =
response -> System.out.println("Received response");
PathUpdateAccessControlRecursiveOptions options =
new PathUpdateAccessControlRecursiveOptions(pathAccessControlEntries)
.setBatchSize(batchSize)
.setMaxBatches(maxBatches)
.setContinueOnFailure(continueOnFailure)
.setContinuationToken(continuationToken)
.setProgressHandler(progressHandler);
client.updateAccessControlRecursive(pathAccessControlEntries).subscribe(
response -> System.out.printf("Successful changed file operations: %d",
response.getCounters().getChangedFilesCount()));
For more information, see the Azure Docs
Parameters:
Returns:
Applies to
Azure SDK for Java