DataLakeFileSystemClient Class
- java.
lang. Object - com.
azure. storage. file. datalake. DataLakeFileSystemClient
- com.
public class DataLakeFileSystemClient
Client to a file system. It may only be instantiated through a DataLakeFileSystemClientBuilder or via the method getFileSystemClient(String fileSystemName). This class does not hold any state about a particular file system 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 files/directories.
This client contains operations on a file system. Operations on a path are available on DataLakeFileClient and DataLakeDirectoryClient through getFileClient(String fileName) and getDirectoryClient(String directoryName) respectively, and operations on the service are available on DataLakeServiceClient.
Please refer to the Azure Docs for more information on file systems.
Field Summary
Modifier and Type | Field and Description |
---|---|
static final String |
ROOT_DIRECTORY_NAME
Special directory name for the root directory of the file system. |
static final String |
ROOT_FILESYSTEM_NAME
Special file system name for the root file system in the Storage account. |
Method Summary
Methods inherited from java.lang.Object
Field Details
ROOT_DIRECTORY_NAME
public static final String ROOT_DIRECTORY_NAME
Special directory name for the root directory of the file system.
This should only be used while getting the root directory from the file system client.
ROOT_FILESYSTEM_NAME
public static final String ROOT_FILESYSTEM_NAME
Special file system name for the root file system in the Storage account.
Method Details
create
public void create()
Creates a new file system within a storage account. If a file system with the same name already exists, the operation fails. For more information, see the Azure Docs.
Code Samples
try {
client.create();
System.out.printf("Create completed%n");
} catch (BlobStorageException error) {
if (error.getErrorCode().equals(BlobErrorCode.CONTAINER_ALREADY_EXISTS)) {
System.out.printf("Can't create file system. It already exists %n");
}
}
createDirectory
public DataLakeDirectoryClient createDirectory(String directoryName)
Creates a new directory within a file system. By default, this method will not overwrite an existing directory. For more information, see the Azure Docs.
Code Samples
DataLakeDirectoryClient directoryClient = client.createDirectory(directoryName);
Parameters:
Returns:
createDirectory
public DataLakeDirectoryClient createDirectory(String directoryName, boolean overwrite)
Creates a new directory within a file system. For more information, see the Azure Docs.
Code Samples
boolean overwrite = false; /* Default value. */
DataLakeDirectoryClient dClient = client.createDirectory(fileName, overwrite);
Parameters:
Returns:
createDirectoryIfNotExists
public DataLakeDirectoryClient createDirectoryIfNotExists(String directoryName)
Creates a new directory within a file system if it does not exist. For more information, see the Azure Docs.
Code Samples
DataLakeDirectoryClient directoryClient = client.createDirectoryIfNotExists(directoryName);
Parameters:
Returns:
createDirectoryIfNotExistsWithResponse
public Response
Creates a new directory within a file system if it does not exist. For more information, see the Azure Docs.
Code Samples
PathHttpHeaders headers = new PathHttpHeaders()
.setContentLanguage("en-US")
.setContentType("binary");
String permissions = "permissions";
String umask = "umask";
DataLakePathCreateOptions options = new DataLakePathCreateOptions()
.setPermissions(permissions)
.setUmask(umask)
.setPathHttpHeaders(headers)
.setMetadata(Collections.singletonMap("metadata", "value"));
Response<DataLakeDirectoryClient> response = client.createDirectoryIfNotExistsWithResponse(directoryName,
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());
}
Parameters:
Returns:
createDirectoryWithResponse
public Response
Creates a new directory within a file system. If a directory with the same name already exists, the directory will be overwritten. For more information, see the Azure Docs.
Code Samples
PathHttpHeaders httpHeaders = new PathHttpHeaders()
.setContentLanguage("en-US")
.setContentType("binary");
DataLakeRequestConditions requestConditions = new DataLakeRequestConditions()
.setLeaseId(leaseId);
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<DataLakeDirectoryClient> newDirectoryClient = client.createDirectoryWithResponse(directoryName,
options, timeout, new Context(key1, value1));
Parameters:
Returns:
createDirectoryWithResponse
public Response
Creates a new directory within a file system. If a directory with the same name already exists, the directory will be overwritten. For more information, see the Azure Docs.
Code Samples
PathHttpHeaders httpHeaders = new PathHttpHeaders()
.setContentLanguage("en-US")
.setContentType("binary");
DataLakeRequestConditions requestConditions = new DataLakeRequestConditions()
.setLeaseId(leaseId);
String permissions = "permissions";
String umask = "umask";
Response<DataLakeDirectoryClient> newDirectoryClient = client.createDirectoryWithResponse(directoryName,
permissions, umask, httpHeaders, Collections.singletonMap("metadata", "value"), requestConditions,
timeout, new Context(key1, value1));
Parameters:
Returns:
createFile
public DataLakeFileClient createFile(String fileName)
Creates a new file within a file system. By default, this method will not overwrite an existing file. For more information, see the Azure Docs.
Code Samples
DataLakeFileClient fileClient = client.createFile(fileName);
Parameters:
Returns:
createFile
public DataLakeFileClient createFile(String fileName, boolean overwrite)
Creates a new file within a file system. For more information, see the Azure Docs.
Code Samples
boolean overwrite = false; /* Default value. */
DataLakeFileClient fClient = client.createFile(fileName, overwrite);
Parameters:
Returns:
createFileIfNotExists
public DataLakeFileClient createFileIfNotExists(String fileName)
Creates a new file within a file system if it does not exist. For more information, see the Azure Docs.
Code Samples
DataLakeFileClient fileClient = client.createFile(fileName);
Parameters:
Returns:
createFileIfNotExistsWithResponse
public Response
Creates a new file within a file system if it does not exist. For more information, see the Azure Docs.
Code Samples
PathHttpHeaders headers = new PathHttpHeaders().setContentLanguage("en-US").setContentType("binary");
String permissions = "permissions";
String umask = "umask";
DataLakePathCreateOptions options = new DataLakePathCreateOptions()
.setPermissions(permissions)
.setUmask(umask)
.setPathHttpHeaders(headers)
.setMetadata(Collections.singletonMap("metadata", "value"));
Response<DataLakeFileClient> response = client.createFileIfNotExistsWithResponse(fileName, 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());
}
Parameters:
Returns:
createFileWithResponse
public Response
Creates a new file within a file system. If a file with the same name already exists, the file will be overwritten. For more information, see the Azure Docs.
Code Samples
PathHttpHeaders httpHeaders = new PathHttpHeaders()
.setContentLanguage("en-US")
.setContentType("binary");
DataLakeRequestConditions requestConditions = new DataLakeRequestConditions()
.setLeaseId(leaseId);
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<DataLakeFileClient> newFileClient = client.createFileWithResponse(fileName, options, timeout,
new Context(key1, value1));
Parameters:
Returns:
createFileWithResponse
public Response
Creates a new file within a file system. If a file with the same name already exists, the file will be overwritten. For more information, see the Azure Docs.
Code Samples
PathHttpHeaders httpHeaders = new PathHttpHeaders()
.setContentLanguage("en-US")
.setContentType("binary");
DataLakeRequestConditions requestConditions = new DataLakeRequestConditions()
.setLeaseId(leaseId);
String permissions = "permissions";
String umask = "umask";
Response<DataLakeFileClient> newFileClient = client.createFileWithResponse(fileName, permissions, umask, httpHeaders,
Collections.singletonMap("metadata", "value"), requestConditions,
timeout, new Context(key1, value1));
Parameters:
Returns:
createIfNotExists
public boolean createIfNotExists()
Creates a new file system within a storage account if it does not exist. For more information, see the Azure Docs.
Code Samples
boolean result = client.createIfNotExists();
System.out.println("file system created: " + result);
Returns:
true
if file system is successfully created, false
if file system already exists.createIfNotExistsWithResponse
public Response
Creates a new file system within a storage account if it does not exist. For more information, see the Azure Docs.
Code Samples
Map<String, String> metadata = Collections.singletonMap("metadata", "value");
Context context = new Context("Key", "Value");
Response<Boolean> response = client.createIfNotExistsWithResponse(metadata, PublicAccessType.CONTAINER, timeout,
context);
if (response.getStatusCode() == 409) {
System.out.println("Already existed.");
} else {
System.out.printf("Create completed with status %d%n", response.getStatusCode());
}
Parameters:
Returns:
createWithResponse
public Response
Creates a new file system within a storage account. If a file system with the same name already exists, the operation fails. For more information, see the Azure Docs.
Code Samples
Map<String, String> metadata = Collections.singletonMap("metadata", "value");
Context context = new Context("Key", "Value");
System.out.printf("Create completed with status %d%n",
client.createWithResponse(metadata, PublicAccessType.CONTAINER, timeout, context).getStatusCode());
Parameters:
Returns:
delete
public void delete()
Marks the specified file system for deletion. The file system and any files/directories contained within it are later deleted during garbage collection. For more information, see the Azure Docs.
Code Samples
try {
client.delete();
System.out.printf("Delete completed%n");
} catch (BlobStorageException error) {
if (error.getErrorCode().equals(BlobErrorCode.CONTAINER_NOT_FOUND)) {
System.out.printf("Delete failed. File System was not found %n");
}
}
deleteDirectory
public void deleteDirectory(String directoryName)
Deletes the specified directory in the file system. If the directory doesn't exist the operation fails. For more information see the Azure Docs.
Code Samples
client.deleteDirectory(directoryName);
System.out.println("Delete request completed");
Parameters:
deleteDirectoryIfExists
public boolean deleteDirectoryIfExists(String directoryName)
Deletes the specified directory in the file system if it exists. For more information see the Azure Docs.
Code Samples
boolean result = client.deleteDirectoryIfExists(directoryName);
System.out.println("Delete request completed: " + result);
Parameters:
Returns:
true
if the directory is successfully deleted, false
if the directory does not exist.deleteDirectoryIfExistsWithResponse
public Response
Deletes the specified directory in the file system if it exists. For more information see the Azure Docs.
Code Samples
DataLakeRequestConditions requestConditions = new DataLakeRequestConditions()
.setLeaseId(leaseId);
boolean recursive = false; // Default value
DataLakePathDeleteOptions options = new DataLakePathDeleteOptions().setIsRecursive(recursive)
.setRequestConditions(requestConditions);
Response<Boolean> response = client.deleteDirectoryIfExistsWithResponse(directoryName, 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());
}
Parameters:
Returns:
deleteDirectoryWithResponse
public Response
Deletes the specified directory in the file system. If the directory doesn't exist the operation fails. For more information see the Azure Docs.
Code Samples
DataLakeRequestConditions requestConditions = new DataLakeRequestConditions()
.setLeaseId(leaseId);
boolean recursive = false; // Default value
client.deleteDirectoryWithResponse(directoryName, recursive, requestConditions, timeout,
new Context(key1, value1));
System.out.println("Delete request completed");
Parameters:
Returns:
deleteFile
public void deleteFile(String fileName)
Deletes the specified file in the file system. If the file doesn't exist the operation fails. For more information see the Azure Docs.
Code Samples
client.deleteFile(fileName);
System.out.println("Delete request completed");
Parameters:
deleteFileIfExists
public boolean deleteFileIfExists(String fileName)
Deletes the specified file in the file system if it exists. For more information see the Azure Docs.
Code Samples
boolean result = client.deleteFileIfExists(fileName);
System.out.println("Delete request completed: " + result);
Parameters:
Returns:
true
if the file is successfully deleted, false
if the file does not exist.deleteFileIfExistsWithResponse
public Response
Deletes the specified file in the file system if it exists. For more information see the Azure Docs.
Code Samples
DataLakeRequestConditions requestConditions = new DataLakeRequestConditions()
.setLeaseId(leaseId);
DataLakePathDeleteOptions options = new DataLakePathDeleteOptions().setRequestConditions(requestConditions);
Response<Boolean> response = client.deleteFileIfExistsWithResponse(fileName, 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());
}
Parameters:
Returns:
deleteFileWithResponse
public Response
Deletes the specified file in the file system. If the file doesn't exist the operation fails. For more information see the Azure Docs.
Code Samples
DataLakeRequestConditions requestConditions = new DataLakeRequestConditions()
.setLeaseId(leaseId);
client.deleteFileWithResponse(fileName, requestConditions, timeout, new Context(key1, value1));
System.out.println("Delete request completed");
Parameters:
Returns:
deleteIfExists
public boolean deleteIfExists()
Marks the specified file system for deletion if it exists. The file system and any files/directories contained within it are later deleted during garbage collection. For more information, see the Azure Docs.
Code Samples
client.deleteIfExists();
Returns:
true
if file system is successfully deleted, false
if the file system does not exist.deleteIfExistsWithResponse
public Response
Marks the specified file system for deletion if it exists. The file system and any files/directories contained within it are later deleted during garbage collection. For more information, see the Azure Docs.
Code Samples
DataLakeRequestConditions requestConditions = new DataLakeRequestConditions()
.setLeaseId(leaseId)
.setIfUnmodifiedSince(OffsetDateTime.now().minusDays(3));
Context context = new Context("Key", "Value");
DataLakePathDeleteOptions options = new DataLakePathDeleteOptions().setIsRecursive(false)
.setRequestConditions(requestConditions);
Response<Boolean> response = client.deleteIfExistsWithResponse(options, timeout, context);
if (response.getStatusCode() == 404) {
System.out.println("Does not exist.");
} else {
System.out.printf("Delete completed with status %d%n", response.getStatusCode());
}
Parameters:
Returns:
null
indicates the file system does not exist at this location.deleteWithResponse
public Response
Marks the specified file system for deletion. The file system and any files/directories contained within it are later deleted during garbage collection. For more information, see the Azure Docs.
Code Samples
DataLakeRequestConditions requestConditions = new DataLakeRequestConditions()
.setLeaseId(leaseId)
.setIfUnmodifiedSince(OffsetDateTime.now().minusDays(3));
Context context = new Context("Key", "Value");
System.out.printf("Delete completed with status %d%n", client.deleteWithResponse(
requestConditions, timeout, context).getStatusCode());
Parameters:
Returns:
exists
public boolean exists()
Determines if the file system exists in the cloud.
Code Samples
System.out.printf("Exists? %b%n", client.exists());
Returns:
existsWithResponse
public Response
Determines if the file system exists in the cloud.
Code Samples
System.out.printf("Exists? %b%n", client.existsWithResponse(timeout, new Context("Key", "Value")).getValue());
Parameters:
Returns:
generateSas
public String generateSas(DataLakeServiceSasSignatureValues dataLakeServiceSasSignatureValues)
Generates a service SAS for the file system 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);
FileSystemSasPermission permission = new FileSystemSasPermission().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 file system 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);
FileSystemSasPermission permission = new FileSystemSasPermission().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 file system 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 file system 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);
FileSystemSasPermission myPermission = new FileSystemSasPermission().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 file system 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);
FileSystemSasPermission myPermission = new FileSystemSasPermission().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 file system 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.getAccessPolicy
public FileSystemAccessPolicies getAccessPolicy()
Returns the file system's permissions. The permissions indicate whether file system's paths may be accessed publicly. For more information, see the Azure Docs.
Code Samples
FileSystemAccessPolicies accessPolicies = client.getAccessPolicy();
System.out.printf("Data Lake Access Type: %s%n", accessPolicies.getDataLakeAccessType());
for (DataLakeSignedIdentifier identifier : accessPolicies.getIdentifiers()) {
System.out.printf("Identifier Name: %s, Permissions %s%n",
identifier.getId(),
identifier.getAccessPolicy().getPermissions());
}
Returns:
getAccessPolicyWithResponse
public Response
Returns the file system's permissions. The permissions indicate whether file system's paths may be accessed publicly. For more information, see the Azure Docs.
Code Samples
Context context = new Context("Key", "Value");
FileSystemAccessPolicies accessPolicies = client.getAccessPolicyWithResponse(leaseId, timeout, context)
.getValue();
System.out.printf("Data Lake Access Type: %s%n", accessPolicies.getDataLakeAccessType());
for (DataLakeSignedIdentifier identifier : accessPolicies.getIdentifiers()) {
System.out.printf("Identifier Name: %s, Permissions %s%n",
identifier.getId(),
identifier.getAccessPolicy().getPermissions());
}
Parameters:
Returns:
getAccountName
public String getAccountName()
Get associated account name.
Returns:
getAccountUrl
public String getAccountUrl()
Get the url of the storage account.
Returns:
getDirectoryClient
public DataLakeDirectoryClient getDirectoryClient(String directoryName)
Initializes a new DataLakeDirectoryClient object by concatenating directoryName to the end of DataLakeFileSystemClient's URL. The new DataLakeDirectoryClient uses the same request policy pipeline as the DataLakeFileSystemClient.
Parameters:
String
representing the name of the directory. If the path name contains special
characters, pass in the url encoded version of the path name.
Code Samples
DataLakeDirectoryClient dataLakeDirectoryClient = client.getDirectoryClient(directoryName);
Returns:
getFileClient
public DataLakeFileClient getFileClient(String fileName)
Initializes a new DataLakeFileClient object by concatenating fileName to the end of DataLakeFileSystemClient's URL. The new DataLakeFileClient uses the same request policy pipeline as the DataLakeFileSystemClient.
Parameters:
String
representing the name of the file. If the path name contains special characters,
pass in the url encoded version of the path name.
Code Samples
DataLakeFileClient dataLakeFileClient = client.getFileClient(fileName);
Returns:
getFileSystemName
public String getFileSystemName()
Get the file system name.
Code Samples
String fileSystemName = client.getFileSystemName();
System.out.println("The name of the file system is " + fileSystemName);
Returns:
getFileSystemUrl
public String getFileSystemUrl()
Gets the URL of the file system represented by this client.
Returns:
getHttpPipeline
public HttpPipeline getHttpPipeline()
Gets the HttpPipeline powering this client.
Returns:
getProperties
public FileSystemProperties getProperties()
Returns the file system's metadata and system properties. For more information, see the Azure Docs.
Code Samples
FileSystemProperties properties = client.getProperties();
System.out.printf("Public Access Type: %s, Legal Hold? %b, Immutable? %b%n",
properties.getDataLakePublicAccess(),
properties.hasLegalHold(),
properties.hasImmutabilityPolicy());
Returns:
getPropertiesWithResponse
public Response
Returns the file system's metadata and system properties. For more information, see the Azure Docs.
Code Samples
Context context = new Context("Key", "Value");
FileSystemProperties properties = client.getPropertiesWithResponse(leaseId, timeout, context)
.getValue();
System.out.printf("Public Access Type: %s, Legal Hold? %b, Immutable? %b%n",
properties.getDataLakePublicAccess(),
properties.hasLegalHold(),
properties.hasImmutabilityPolicy());
Parameters:
Returns:
getServiceVersion
public DataLakeServiceVersion getServiceVersion()
Gets the service version the client is using.
Returns:
listDeletedPaths
public PagedIterable
Returns a lazy loaded list of files/directories recently soft deleted in this file system. The returned PagedIterable<T> can be consumed while new items are automatically retrieved as needed. For more information, see the Azure Docs.
Code Samples
client.listDeletedPaths().forEach(path -> System.out.printf("Name: %s%n", path.getPath()));
Returns:
listDeletedPaths
public PagedIterable
Returns a lazy loaded list of files/directories recently soft deleted in this account. The returned PagedIterable<T> can be consumed while new items are automatically retrieved as needed. For more information, see the Azure Docs.
Code Samples
Context context = new Context("Key", "Value");
int pageSize = 10;
client.listDeletedPaths("PathPrefixToMatch", timeout, context)
.iterableByPage(pageSize)
.forEach(page ->
page.getValue().forEach(path ->
System.out.printf("Name: %s%n", path.getPath())));
Parameters:
Returns:
listPaths
public PagedIterable
Returns a lazy loaded list of files/directories in this account. The returned PagedIterable<T> can be consumed while new items are automatically retrieved as needed. For more information, see the Azure Docs.
Code Samples
client.listPaths().forEach(path -> System.out.printf("Name: %s%n", path.getName()));
Returns:
listPaths
public PagedIterable
Returns a lazy loaded list of files/directories in this account. The returned PagedIterable<T> can be consumed while new items are automatically retrieved as needed. For more information, see the Azure Docs.
Code Samples
ListPathsOptions options = new ListPathsOptions()
.setPath("pathPrefixToMatch")
.setMaxResults(10);
client.listPaths(options, timeout).forEach(path -> System.out.printf("Name: %s%n", path.getName()));
Parameters:
Returns:
setAccessPolicy
public void setAccessPolicy(PublicAccessType accessType, List
Sets the file system's permissions. The permissions indicate whether paths in a file system may be accessed publicly. Note that, for each signed identifier, we will truncate the start and expiry times to the nearest second to ensure the time formatting is compatible with the service. For more information, see the Azure Docs.
Code Samples
DataLakeSignedIdentifier identifier = new DataLakeSignedIdentifier()
.setId("name")
.setAccessPolicy(new DataLakeAccessPolicy()
.setStartsOn(OffsetDateTime.now())
.setExpiresOn(OffsetDateTime.now().plusDays(7))
.setPermissions("permissionString"));
try {
client.setAccessPolicy(PublicAccessType.CONTAINER, Collections.singletonList(identifier));
System.out.printf("Set Access Policy completed %n");
} catch (UnsupportedOperationException error) {
System.out.printf("Set Access Policy completed %s%n", error);
}
Parameters:
setAccessPolicyWithResponse
public Response
Sets the file system's permissions. The permissions indicate whether paths in a file system may be accessed publicly. Note that, for each signed identifier, we will truncate the start and expiry times to the nearest second to ensure the time formatting is compatible with the service. For more information, see the Azure Docs.
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));
Context context = new Context("Key", "Value");
System.out.printf("Set access policy completed with status %d%n",
client.setAccessPolicyWithResponse(PublicAccessType.CONTAINER,
Collections.singletonList(identifier),
requestConditions,
timeout,
context).getStatusCode());
Parameters:
Returns:
setMetadata
public void setMetadata(Map
Sets the file system's metadata. For more information, see the Azure Docs.
Code Samples
Map<String, String> metadata = Collections.singletonMap("metadata", "value");
try {
client.setMetadata(metadata);
System.out.printf("Set metadata completed with status %n");
} catch (UnsupportedOperationException error) {
System.out.printf("Fail while setting metadata %n");
}
Parameters:
setMetadataWithResponse
public Response
Sets the file system's metadata. For more information, see the Azure Docs.
Code Samples
Map<String, String> metadata = Collections.singletonMap("metadata", "value");
DataLakeRequestConditions requestConditions = new DataLakeRequestConditions()
.setLeaseId(leaseId)
.setIfUnmodifiedSince(OffsetDateTime.now().minusDays(3));
Context context = new Context("Key", "Value");
System.out.printf("Set metadata completed with status %d%n",
client.setMetadataWithResponse(metadata, requestConditions, timeout, context).getStatusCode());
Parameters:
Returns:
undeletePath
public DataLakePathClient undeletePath(String deletedPath, String deletionId)
Restores a soft deleted path in the file system. For more information see the Azure Docs.
Code Samples
client.undeletePath(deletedPath, deletionId);
System.out.println("Delete request completed");
Parameters:
Returns:
undeletePathWithResponse
public Response
Restores a soft deleted path in the file system. For more information see the Azure Docs.
Code Samples
client.undeletePathWithResponse(deletedPath, deletionId, timeout, new Context(key1, value1));
System.out.println("Delete request completed");
Parameters:
Returns: