Partilhar via


DataLakePathClient Class

  • java.lang.Object
    • com.azure.storage.file.datalake.DataLakePathClient

public class DataLakePathClient

This class provides a client that contains all operations that apply to any path object.

Method Summary

Modifier and Type Method and Description
PathInfo create()

Creates a resource.

PathInfo create(boolean overwrite)

Creates a resource.

PathInfo createIfNotExists()

Creates a resource if a path does not exist.

Response<PathInfo> createIfNotExistsWithResponse(DataLakePathCreateOptions options, Duration timeout, Context context)

Creates a resource if a path does not exist.

Response<PathInfo> createWithResponse(DataLakePathCreateOptions options, Duration timeout, Context context)

Creates a resource.

Response<PathInfo> createWithResponse(String permissions, String umask, PathHttpHeaders headers, Map<String,String> metadata, DataLakeRequestConditions requestConditions, Duration timeout, Context context)

Creates a resource.

boolean deleteIfExists()

Deletes paths under the resource if it exists.

Response<Boolean> deleteIfExistsWithResponse(DataLakePathDeleteOptions options, Duration timeout, Context context)

Deletes all paths under the specified resource if exists.

Boolean exists()

Gets if the path this client represents exists in the cloud.

Response<Boolean> existsWithResponse(Duration timeout, Context context)

Gets if the path this client represents exists in the cloud.

String generateSas(DataLakeServiceSasSignatureValues dataLakeServiceSasSignatureValues)

Generates a service SAS for the path using the specified DataLakeServiceSasSignatureValues

String generateSas(DataLakeServiceSasSignatureValues dataLakeServiceSasSignatureValues, Context context)

Generates a service SAS for the path using the specified DataLakeServiceSasSignatureValues

String generateSas(DataLakeServiceSasSignatureValues dataLakeServiceSasSignatureValues, Consumer<String> stringToSignHandler, Context context)

Generates a service SAS for the path using the specified DataLakeServiceSasSignatureValues

String generateUserDelegationSas(DataLakeServiceSasSignatureValues dataLakeServiceSasSignatureValues, UserDelegationKey userDelegationKey)

Generates a user delegation SAS for the path using the specified DataLakeServiceSasSignatureValues.

String generateUserDelegationSas(DataLakeServiceSasSignatureValues dataLakeServiceSasSignatureValues, UserDelegationKey userDelegationKey, String accountName, Context context)

Generates a user delegation SAS for the path using the specified DataLakeServiceSasSignatureValues.

String generateUserDelegationSas(DataLakeServiceSasSignatureValues dataLakeServiceSasSignatureValues, UserDelegationKey userDelegationKey, String accountName, Consumer<String> stringToSignHandler, Context context)

Generates a user delegation SAS for the path using the specified DataLakeServiceSasSignatureValues.

PathAccessControl getAccessControl()

Returns the access control for a resource.

Response<PathAccessControl> getAccessControlWithResponse(boolean userPrincipalNameReturned, DataLakeRequestConditions requestConditions, Duration timeout, Context context)

Returns the access control for a resource.

String getAccountName()

Gets the associated account name.

CustomerProvidedKey getCustomerProvidedKey()

Gets the CpkInfo used to encrypt this path's content on the server.

DataLakePathClient getCustomerProvidedKeyClient(CustomerProvidedKey customerProvidedKey)

Creates a new DataLakePathClient with the specified customerProvidedKey.

String getFileSystemName()

Gets the name of the File System in which this object lives.

HttpPipeline getHttpPipeline()

Gets the HttpPipeline powering this client.

PathProperties getProperties()

Returns the resource's metadata and properties.

PathProperties getProperties(PathGetPropertiesOptions options)

Returns the resource's metadata and properties.

Response<PathProperties> getPropertiesWithResponse(DataLakeRequestConditions requestConditions, Duration timeout, Context context)

Returns the resource's metadata and properties.

DataLakeServiceVersion getServiceVersion()

Gets the service version the client is using.

AccessControlChangeResult removeAccessControlRecursive(List<PathRemoveAccessControlEntry> accessControlList)

Recursively removes the access control on a path and all subpaths.

Response<AccessControlChangeResult> removeAccessControlRecursiveWithResponse(PathRemoveAccessControlRecursiveOptions options, Duration timeout, Context context)

Recursively removes the access control on a path and all subpaths.

PathInfo setAccessControlList(List<PathAccessControlEntry> accessControlList, String group, String owner)

Changes the access control list, group and/or owner for a resource.

Response<PathInfo> setAccessControlListWithResponse(List<PathAccessControlEntry> accessControlList, String group, String owner, DataLakeRequestConditions requestConditions, Duration timeout, Context context)

Changes the access control list, group and/or owner for a resource.

AccessControlChangeResult setAccessControlRecursive(List<PathAccessControlEntry> accessControlList)

Recursively sets the access control on a path and all subpaths.

Response<AccessControlChangeResult> setAccessControlRecursiveWithResponse(PathSetAccessControlRecursiveOptions options, Duration timeout, Context context)

Recursively sets the access control on a path and all subpaths.

void setHttpHeaders(PathHttpHeaders headers)

Changes a resource's HTTP header properties.

Response<Void> setHttpHeadersWithResponse(PathHttpHeaders headers, DataLakeRequestConditions requestConditions, Duration timeout, Context context)

Changes a resource's HTTP header properties.

void setMetadata(Map<String,String> metadata)

Changes a resource's metadata.

Response<Void> setMetadataWithResponse(Map<String,String> metadata, DataLakeRequestConditions requestConditions, Duration timeout, Context context)

Changes a resource's metadata.

PathInfo setPermissions(PathPermissions permissions, String group, String owner)

Changes the permissions, group and/or owner for a resource.

Response<PathInfo> setPermissionsWithResponse(PathPermissions permissions, String group, String owner, DataLakeRequestConditions requestConditions, Duration timeout, Context context)

Changes the permissions, group and/or owner for a resource.

AccessControlChangeResult updateAccessControlRecursive(List<PathAccessControlEntry> accessControlList)

Recursively updates the access control on a path and all subpaths.

Response<AccessControlChangeResult> updateAccessControlRecursiveWithResponse(PathUpdateAccessControlRecursiveOptions options, Duration timeout, Context context)

Recursively updates the access control on a path and all subpaths.

Methods inherited from java.lang.Object

Method Details

create

public PathInfo create()

Creates a resource. By default, this method will not overwrite an existing path.

Code Samples

System.out.printf("Last Modified Time:%s", client.create().getLastModified());

For more information see the Azure Docs

Returns:

Information about the created resource.

create

public PathInfo create(boolean overwrite)

Creates a resource.

Code Samples

boolean overwrite = true;
 System.out.printf("Last Modified Time:%s", client.create(true).getLastModified());

For more information see the Azure Docs

Parameters:

overwrite - Whether to overwrite, should data exist on the path.

Returns:

Information about the created resource.

createIfNotExists

public PathInfo createIfNotExists()

Creates a resource if a path does not exist.

Code Samples

PathInfo pathInfo = client.createIfNotExists();
 System.out.printf("Last Modified Time:%s", pathInfo.getLastModified());

For more information see the Azure Docs

Returns:

PathInfo that contains information about the created resource.

createIfNotExistsWithResponse

public Response createIfNotExistsWithResponse(DataLakePathCreateOptions options, Duration timeout, Context context)

Creates a resource if a path 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);

 Response<PathInfo> response = client.createIfNotExistsWithResponse(options, timeout, new Context(key1, value1));
 if (response.getStatusCode() == 409) {
     System.out.println("Already existed.");
 } else {
     System.out.printf("Create completed with status %d%n", response.getStatusCode());
 }

For more information see the Azure Docs

Parameters:

options - DataLakePathCreateOptions metadata key or value, it must be removed or encoded.
timeout - An optional timeout value beyond which a RuntimeException will be raised.
context - Additional context that is passed through the Http pipeline during the service call.

Returns:

A reactive Response<T> signaling completion, whose value contains a PathInfo containing information about the resource. If Response<T>'s status code is 201, a new resource was successfully created. If status code is 409, a resource already existed at this location.

createWithResponse

public Response createWithResponse(DataLakePathCreateOptions options, Duration timeout, Context context)

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);

 Response<PathInfo> response = client.createWithResponse(options, timeout, new Context(key1, value1));
 System.out.printf("Last Modified Time:%s", response.getValue().getLastModified());

For more information see the Azure Docs

Parameters:

timeout - An optional timeout value beyond which a RuntimeException will be raised.
context - Additional context that is passed through the Http pipeline during the service call.

Returns:

A response containing information about the created resource

createWithResponse

public Response createWithResponse(String permissions, String umask, PathHttpHeaders headers, Map metadata, DataLakeRequestConditions requestConditions, Duration timeout, Context context)

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";

 Response<PathInfo> response = client.createWithResponse(permissions, umask, httpHeaders,
     Collections.singletonMap("metadata", "value"), requestConditions, timeout,
     new Context(key1, value1));
 System.out.printf("Last Modified Time:%s", response.getValue().getLastModified());

For more information see the Azure Docs

Parameters:

permissions - POSIX access permissions for the resource owner, the resource owning group, and others.
umask - Restricts permissions of the resource 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
timeout - An optional timeout value beyond which a RuntimeException will be raised.
context - Additional context that is passed through the Http pipeline during the service call.

Returns:

A response containing information about the created resource

deleteIfExists

public boolean deleteIfExists()

Deletes paths under the resource if it exists.

Code Samples

client.create();
 boolean result = client.deleteIfExists();
 System.out.println("Delete complete: " + result);

For more information see the Azure Docs

Returns:

true if the resource is successfully deleted, false if resource does not exist.

deleteIfExistsWithResponse

public Response deleteIfExistsWithResponse(DataLakePathDeleteOptions options, Duration timeout, Context context)

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);

 Response<Boolean> response = client.deleteIfExistsWithResponse(options, timeout, new Context(key1, value1));

 if (response.getStatusCode() == 404) {
     System.out.println("Does not exist.");
 } else {
     System.out.printf("Delete completed with status %d%n", response.getStatusCode());
 }

For more information see the Azure Docs

Parameters:

timeout - An optional timeout value beyond which a RuntimeException will be raised.
context - Additional context that is passed through the Http pipeline during the service call.

Returns:

A response containing status code and HTTP headers. If Response<T>'s status code is 200, the resource was successfully deleted. If status code is 404, the resource does not exist.

exists

public Boolean exists()

Gets 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

System.out.printf("Exists? %b%n", client.exists());

Returns:

true if the path exists, false if it doesn't

existsWithResponse

public Response existsWithResponse(Duration timeout, Context context)

Gets 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

System.out.printf("Exists? %b%n", client.existsWithResponse(timeout, new Context(key2, value2)).getValue());

Parameters:

timeout - An optional timeout value beyond which a RuntimeException will be raised.
context - Additional context that is passed through the Http pipeline during the service call.

Returns:

true if the path exists, false if it doesn't

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:

dataLakeServiceSasSignatureValues - DataLakeServiceSasSignatureValues

Returns:

A 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:

dataLakeServiceSasSignatureValues - DataLakeServiceSasSignatureValues
context - Additional context that is passed through the code when generating a SAS.

Returns:

A String representing the SAS query parameters.

generateSas

public String generateSas(DataLakeServiceSasSignatureValues dataLakeServiceSasSignatureValues, Consumer stringToSignHandler, 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.

Parameters:

dataLakeServiceSasSignatureValues - DataLakeServiceSasSignatureValues
stringToSignHandler - For debugging purposes only. Returns the string to sign that was used to generate the signature.
context - Additional context that is passed through the code when generating a SAS.

Returns:

A 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:

dataLakeServiceSasSignatureValues - DataLakeServiceSasSignatureValues
userDelegationKey - A UserDelegationKey object used to sign the SAS values. See getUserDelegationKey(OffsetDateTime start, OffsetDateTime expiry) for more information on how to get a user delegation key.

Returns:

A 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:

dataLakeServiceSasSignatureValues - DataLakeServiceSasSignatureValues
userDelegationKey - A UserDelegationKey object used to sign the SAS values. See getUserDelegationKey(OffsetDateTime start, OffsetDateTime expiry) for more information on how to get a user delegation key.
accountName - The account name.
context - Additional context that is passed through the code when generating a SAS.

Returns:

A String representing the SAS query parameters.

generateUserDelegationSas

public String generateUserDelegationSas(DataLakeServiceSasSignatureValues dataLakeServiceSasSignatureValues, UserDelegationKey userDelegationKey, String accountName, Consumer stringToSignHandler, 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.

Parameters:

dataLakeServiceSasSignatureValues - DataLakeServiceSasSignatureValues
userDelegationKey - A UserDelegationKey object used to sign the SAS values. See getUserDelegationKey(OffsetDateTime start, OffsetDateTime expiry) for more information on how to get a user delegation key.
accountName - The account name.
stringToSignHandler - For debugging purposes only. Returns the string to sign that was used to generate the signature.
context - Additional context that is passed through the code when generating a SAS.

Returns:

A String representing the SAS query parameters.

getAccessControl

public PathAccessControl getAccessControl()

Returns the access control for a resource.

Code Samples

PathAccessControl response = client.getAccessControl();
 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:

The resource access control.

getAccessControlWithResponse

public Response getAccessControlWithResponse(boolean userPrincipalNameReturned, DataLakeRequestConditions requestConditions, Duration timeout, Context context)

Returns the access control for a resource.

Code Samples

DataLakeRequestConditions requestConditions = new DataLakeRequestConditions().setLeaseId(leaseId);
 boolean userPrincipalNameReturned = false;

 Response<PathAccessControl> response = client.getAccessControlWithResponse(userPrincipalNameReturned,
     requestConditions, timeout, new Context(key1, value1));

 PathAccessControl pac = response.getValue();

 System.out.printf("Access Control List: %s, Group: %s, Owner: %s, Permissions: %s",
     PathAccessControlEntry.serializeList(pac.getAccessControlList()), pac.getGroup(), pac.getOwner(),
     pac.getPermissions());

For more information, see the Azure Docs

Parameters:

userPrincipalNameReturned - When true, user identity values returned as User Principal Names. When false, user identity values returned as Azure Active Directory Object IDs. Default value is false.
requestConditions - DataLakeRequestConditions
timeout - An optional timeout value beyond which a RuntimeException will be raised.
context - Additional context that is passed through the Http pipeline during the service call.

Returns:

A response containing the resource access control.

getAccountName

public String getAccountName()

Gets the associated account name.

Returns:

Account name associated with this storage resource.

getCustomerProvidedKey

public CustomerProvidedKey getCustomerProvidedKey()

Gets the CpkInfo used to encrypt this path's content on the server.

Returns:

the customer provided key used for encryption.

getCustomerProvidedKeyClient

public DataLakePathClient getCustomerProvidedKeyClient(CustomerProvidedKey customerProvidedKey)

Creates a new DataLakePathClient with the specified customerProvidedKey.

Parameters:

customerProvidedKey - the CustomerProvidedKey for the path, pass null to use no customer provided key.

Returns:

a DataLakePathClient with the specified customerProvidedKey.

getFileSystemName

public String getFileSystemName()

Gets the name of the File System in which this object lives.

Returns:

The name of the File System.

getHttpPipeline

public HttpPipeline getHttpPipeline()

Gets the HttpPipeline powering this client.

Returns:

The pipeline.

getProperties

public PathProperties getProperties()

Returns the resource's metadata and properties.

Code Samples

System.out.printf("Creation Time: %s, Size: %d%n", client.getProperties().getCreationTime(),
     client.getProperties().getFileSize());

For more information, see the Azure Docs

Returns:

The resource properties and metadata.

getProperties

public PathProperties getProperties(PathGetPropertiesOptions options)

Returns the resource's metadata and properties.

Code Samples

PathGetPropertiesOptions options = new PathGetPropertiesOptions().setUserPrincipalName(true);

 System.out.printf("Creation Time: %s, Size: %d%n", client.getProperties(options).getCreationTime(),
     client.getProperties(options).getFileSize());

For more information, see the Azure Docs

Parameters:

Returns:

The resource properties and metadata.

getPropertiesWithResponse

public Response getPropertiesWithResponse(DataLakeRequestConditions requestConditions, Duration timeout, Context context)

Returns the resource's metadata and properties.

Code Samples

DataLakeRequestConditions requestConditions = new DataLakeRequestConditions().setLeaseId(leaseId);

 Response<PathProperties> response = client.getPropertiesWithResponse(requestConditions, timeout,
     new Context(key2, value2));

 System.out.printf("Creation Time: %s, Size: %d%n", response.getValue().getCreationTime(),
     response.getValue().getFileSize());

For more information, see the Azure Docs

Parameters:

requestConditions - DataLakeRequestConditions
timeout - An optional timeout value beyond which a RuntimeException will be raised.
context - Additional context that is passed through the Http pipeline during the service call.

Returns:

A response containing the resource properties and metadata.

getServiceVersion

public DataLakeServiceVersion getServiceVersion()

Gets the service version the client is using.

Returns:

the service version the client is using.

removeAccessControlRecursive

public AccessControlChangeResult removeAccessControlRecursive(List accessControlList)

Recursively removes the access control on a path and all subpaths.

Code Samples

PathRemoveAccessControlEntry ownerEntry = new PathRemoveAccessControlEntry()
     .setEntityId("entityId")
     .setAccessControlType(AccessControlType.USER)
     .setDefaultScope(true);

 PathRemoveAccessControlEntry groupEntry = new PathRemoveAccessControlEntry()
     .setEntityId("entityId")
     .setAccessControlType(AccessControlType.GROUP)
     .setDefaultScope(true);

 PathRemoveAccessControlEntry otherEntry = new PathRemoveAccessControlEntry()
     .setEntityId("entityId")
     .setAccessControlType(AccessControlType.OTHER)
     .setDefaultScope(true);
 List<PathRemoveAccessControlEntry> pathAccessControlEntries = new ArrayList<>();
 pathAccessControlEntries.add(ownerEntry);
 pathAccessControlEntries.add(groupEntry);
 pathAccessControlEntries.add(otherEntry);

 AccessControlChangeResult response = client.removeAccessControlRecursive(pathAccessControlEntries);

 System.out.printf("Successful changed file operations: %d",
     response.getCounters().getChangedFilesCount());

For more information, see the Azure Docs

Parameters:

accessControlList - The POSIX access control list for the file or directory.

Returns:

The result of the operation.

removeAccessControlRecursiveWithResponse

public Response removeAccessControlRecursiveWithResponse(PathRemoveAccessControlRecursiveOptions options, Duration timeout, Context context)

Recursively removes the access control on a path and all subpaths.

Code Samples

DataLakeRequestConditions requestConditions = new DataLakeRequestConditions().setLeaseId(leaseId);
 PathRemoveAccessControlEntry ownerEntry = new PathRemoveAccessControlEntry()
     .setEntityId("entityId")
     .setAccessControlType(AccessControlType.USER)
     .setDefaultScope(true);

 PathRemoveAccessControlEntry groupEntry = new PathRemoveAccessControlEntry()
     .setEntityId("entityId")
     .setAccessControlType(AccessControlType.GROUP)
     .setDefaultScope(true);

 PathRemoveAccessControlEntry otherEntry = new PathRemoveAccessControlEntry()
     .setEntityId("entityId")
     .setAccessControlType(AccessControlType.OTHER)
     .setDefaultScope(true);
 List<PathRemoveAccessControlEntry> pathAccessControlEntries = new ArrayList<>();
 pathAccessControlEntries.add(ownerEntry);
 pathAccessControlEntries.add(groupEntry);
 pathAccessControlEntries.add(otherEntry);

 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);

 Response<AccessControlChangeResult> response = client.removeAccessControlRecursiveWithResponse(options, timeout,
     new Context(key2, value2));
 System.out.printf("Successful changed file operations: %d",
     response.getValue().getCounters().getChangedFilesCount());

For more information, see the Azure Docs

Parameters:

timeout - An optional timeout value beyond which a RuntimeException will be raised.
context - Additional context that is passed through the Http pipeline during the service call.

Returns:

A response containing the result of the operation.

setAccessControlList

public PathInfo setAccessControlList(List accessControlList, String group, String owner)

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";

 System.out.printf("Last Modified Time: %s", client.setAccessControlList(pathAccessControlEntries, group, owner)
     .getLastModified());

For more information, see the Azure Docs

Parameters:

accessControlList - A list of PathAccessControlEntry objects.
group - The group of the resource.
owner - The owner of the resource.

Returns:

The resource info.

setAccessControlListWithResponse

public Response setAccessControlListWithResponse(List accessControlList, String group, String owner, DataLakeRequestConditions requestConditions, Duration timeout, Context context)

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";

 Response<PathInfo> response = client.setAccessControlListWithResponse(pathAccessControlEntries, group, owner,
     requestConditions, timeout, new Context(key2, value2));
 System.out.printf("Last Modified Time: %s", response.getValue().getLastModified());

For more information, see the Azure Docs

Parameters:

accessControlList - A list of PathAccessControlEntry objects.
group - The group of the resource.
owner - The owner of the resource.
requestConditions - DataLakeRequestConditions
timeout - An optional timeout value beyond which a RuntimeException will be raised.
context - Additional context that is passed through the Http pipeline during the service call.

Returns:

A response containing the resource info.

setAccessControlRecursive

public AccessControlChangeResult setAccessControlRecursive(List accessControlList)

Recursively sets the access control on a path and all subpaths.

Code Samples

PathAccessControlEntry pathAccessControlEntry = new PathAccessControlEntry()
     .setEntityId("entityId")
     .setAccessControlType(AccessControlType.USER)
     .setPermissions(new RolePermissions().setReadPermission(true));
 List<PathAccessControlEntry> pathAccessControlEntries = new ArrayList<>();
 pathAccessControlEntries.add(pathAccessControlEntry);

 AccessControlChangeResult response = client.setAccessControlRecursive(pathAccessControlEntries);

 System.out.printf("Successful changed file operations: %d",
     response.getCounters().getChangedFilesCount());

For more information, see the Azure Docs

Parameters:

accessControlList - The POSIX access control list for the file or directory.

Returns:

The result of the operation.

setAccessControlRecursiveWithResponse

public Response setAccessControlRecursiveWithResponse(PathSetAccessControlRecursiveOptions options, Duration timeout, Context context)

Recursively sets the access control on a path and all subpaths.

Code Samples

DataLakeRequestConditions requestConditions = new DataLakeRequestConditions().setLeaseId(leaseId);
 PathAccessControlEntry ownerEntry = new PathAccessControlEntry()
     .setEntityId("entityId")
     .setAccessControlType(AccessControlType.USER)
     .setPermissions(new RolePermissions().setReadPermission(true).setWritePermission(true)
         .setExecutePermission(true));

 PathAccessControlEntry groupEntry = new PathAccessControlEntry()
     .setEntityId("entityId")
     .setAccessControlType(AccessControlType.GROUP)
     .setPermissions(new RolePermissions().setReadPermission(true).setWritePermission(true));

 PathAccessControlEntry otherEntry = new PathAccessControlEntry()
     .setEntityId("entityId")
     .setAccessControlType(AccessControlType.OTHER)
     .setPermissions(new RolePermissions());

 List<PathAccessControlEntry> pathAccessControlEntries = new ArrayList<>();
 pathAccessControlEntries.add(ownerEntry);
 pathAccessControlEntries.add(groupEntry);
 pathAccessControlEntries.add(otherEntry);

 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);

 Response<AccessControlChangeResult> response = client.setAccessControlRecursiveWithResponse(options, timeout,
     new Context(key2, value2));
 System.out.printf("Successful changed file operations: %d",
     response.getValue().getCounters().getChangedFilesCount());

For more information, see the Azure Docs

Parameters:

timeout - An optional timeout value beyond which a RuntimeException will be raised.
context - Additional context that is passed through the Http pipeline during the service call.

Returns:

A response containing the result of the operation.

setHttpHeaders

public void setHttpHeaders(PathHttpHeaders headers)

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:

headers - PathHttpHeaders

setHttpHeadersWithResponse

public Response setHttpHeadersWithResponse(PathHttpHeaders headers, DataLakeRequestConditions requestConditions, Duration timeout, Context context)

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);

 Response<Void> response = client.setHttpHeadersWithResponse(new PathHttpHeaders()
     .setContentLanguage("en-US")
     .setContentType("binary"), requestConditions, timeout, new Context(key2, value2));
 System.out.printf("Set HTTP headers completed with status %d%n",
             response.getStatusCode());

For more information, see the Azure Docs

Parameters:

headers - PathHttpHeaders
requestConditions - DataLakeRequestConditions
timeout - An optional timeout value beyond which a RuntimeException will be raised.
context - Additional context that is passed through the Http pipeline during the service call.

Returns:

A response containing status code and HTTP headers.

setMetadata

public void setMetadata(Map metadata)

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"));
 System.out.println("Set metadata completed");

For more information, see the Azure Docs

Parameters:

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.

setMetadataWithResponse

public Response setMetadataWithResponse(Map metadata, DataLakeRequestConditions requestConditions, Duration timeout, Context context)

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, timeout,
     new Context(key2, value2));
 System.out.println("Set metadata completed");

For more information, see the Azure Docs

Parameters:

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
timeout - An optional timeout value beyond which a RuntimeException will be raised.
context - Additional context that is passed through the Http pipeline during the service call.

Returns:

A response containing status code and HTTP headers.

setPermissions

public PathInfo setPermissions(PathPermissions permissions, String group, String owner)

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";

 System.out.printf("Last Modified Time: %s", client.setPermissions(permissions, group, owner)
     .getLastModified());

For more information, see the Azure Docs

Parameters:

permissions - PathPermissions
group - The group of the resource.
owner - The owner of the resource.

Returns:

The resource info.

setPermissionsWithResponse

public Response setPermissionsWithResponse(PathPermissions permissions, String group, String owner, DataLakeRequestConditions requestConditions, Duration timeout, Context context)

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";

 Response<PathInfo> response = client.setPermissionsWithResponse(permissions, group, owner, requestConditions,
     timeout, new Context(key2, value2));
 System.out.printf("Last Modified Time: %s", response.getValue().getLastModified());

For more information, see the Azure Docs

Parameters:

permissions - PathPermissions
group - The group of the resource.
owner - The owner of the resource.
requestConditions - DataLakeRequestConditions
timeout - An optional timeout value beyond which a RuntimeException will be raised.
context - Additional context that is passed through the Http pipeline during the service call.

Returns:

A response containing the resource info.

updateAccessControlRecursive

public AccessControlChangeResult updateAccessControlRecursive(List accessControlList)

Recursively updates the access control on a path and all subpaths.

Code Samples

PathAccessControlEntry ownerEntry = new PathAccessControlEntry()
     .setEntityId("entityId")
     .setAccessControlType(AccessControlType.USER)
     .setPermissions(new RolePermissions().setReadPermission(true).setWritePermission(true)
         .setExecutePermission(true));

 PathAccessControlEntry groupEntry = new PathAccessControlEntry()
     .setEntityId("entityId")
     .setAccessControlType(AccessControlType.GROUP)
     .setPermissions(new RolePermissions().setReadPermission(true).setWritePermission(true));

 PathAccessControlEntry otherEntry = new PathAccessControlEntry()
     .setEntityId("entityId")
     .setAccessControlType(AccessControlType.OTHER)
     .setPermissions(new RolePermissions());

 List<PathAccessControlEntry> pathAccessControlEntries = new ArrayList<>();
 pathAccessControlEntries.add(ownerEntry);
 pathAccessControlEntries.add(groupEntry);
 pathAccessControlEntries.add(otherEntry);

 AccessControlChangeResult response = client.updateAccessControlRecursive(pathAccessControlEntries);

 System.out.printf("Successful changed file operations: %d",
     response.getCounters().getChangedFilesCount());

For more information, see the Azure Docs

Parameters:

accessControlList - The POSIX access control list for the file or directory.

Returns:

The result of the operation.

updateAccessControlRecursiveWithResponse

public Response updateAccessControlRecursiveWithResponse(PathUpdateAccessControlRecursiveOptions options, Duration timeout, Context context)

Recursively updates the access control on a path and all subpaths.

Code Samples

DataLakeRequestConditions requestConditions = new DataLakeRequestConditions().setLeaseId(leaseId);
 PathAccessControlEntry ownerEntry = new PathAccessControlEntry()
     .setEntityId("entityId")
     .setAccessControlType(AccessControlType.USER)
     .setPermissions(new RolePermissions().setReadPermission(true).setWritePermission(true)
         .setExecutePermission(true));

 PathAccessControlEntry groupEntry = new PathAccessControlEntry()
     .setEntityId("entityId")
     .setAccessControlType(AccessControlType.GROUP)
     .setPermissions(new RolePermissions().setReadPermission(true).setWritePermission(true));

 PathAccessControlEntry otherEntry = new PathAccessControlEntry()
     .setEntityId("entityId")
     .setAccessControlType(AccessControlType.OTHER)
     .setPermissions(new RolePermissions());

 List<PathAccessControlEntry> pathAccessControlEntries = new ArrayList<>();
 pathAccessControlEntries.add(ownerEntry);
 pathAccessControlEntries.add(groupEntry);
 pathAccessControlEntries.add(otherEntry);

 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);

 Response<AccessControlChangeResult> response = client.updateAccessControlRecursiveWithResponse(options, timeout,
     new Context(key2, value2));
 System.out.printf("Successful changed file operations: %d",
     response.getValue().getCounters().getChangedFilesCount());

For more information, see the Azure Docs

Parameters:

timeout - An optional timeout value beyond which a RuntimeException will be raised.
context - Additional context that is passed through the Http pipeline during the service call.

Returns:

A response containing the result of the operation.

Applies to