Class DataLakeFileSystemClient
DataLakeFileSystemClientBuilder
or via the
method DataLakeServiceClient.getFileSystemClient(String)
. 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)
and getDirectoryClient(String)
respectively, and operations on the service are available on DataLakeServiceClient
.
Please refer to the Azure Docs for more information on file systems.
-
Field Summary
Fields -
Method Summary
Modifier and TypeMethodDescriptionvoid
create()
Creates a new file system within a storage account.createDirectory
(String directoryName) Creates a new directory within a file system.createDirectory
(String directoryName, boolean overwrite) Creates a new directory within a file system.createDirectoryIfNotExists
(String directoryName) Creates a new directory within a file system if it does not exist.com.azure.core.http.rest.Response
<DataLakeDirectoryClient> createDirectoryIfNotExistsWithResponse
(String directoryName, DataLakePathCreateOptions options, Duration timeout, com.azure.core.util.Context context) Creates a new directory within a file system if it does not exist.com.azure.core.http.rest.Response
<DataLakeDirectoryClient> createDirectoryWithResponse
(String directoryName, DataLakePathCreateOptions options, Duration timeout, com.azure.core.util.Context context) Creates a new directory within a file system.com.azure.core.http.rest.Response
<DataLakeDirectoryClient> createDirectoryWithResponse
(String directoryName, String permissions, String umask, PathHttpHeaders headers, Map<String, String> metadata, DataLakeRequestConditions requestConditions, Duration timeout, com.azure.core.util.Context context) Creates a new directory within a file system.createFile
(String fileName) Creates a new file within a file system.createFile
(String fileName, boolean overwrite) Creates a new file within a file system.createFileIfNotExists
(String fileName) Creates a new file within a file system if it does not exist.com.azure.core.http.rest.Response
<DataLakeFileClient> createFileIfNotExistsWithResponse
(String fileName, DataLakePathCreateOptions options, Duration timeout, com.azure.core.util.Context context) Creates a new file within a file system if it does not exist.com.azure.core.http.rest.Response
<DataLakeFileClient> createFileWithResponse
(String fileName, DataLakePathCreateOptions options, Duration timeout, com.azure.core.util.Context context) Creates a new file within a file system.com.azure.core.http.rest.Response
<DataLakeFileClient> createFileWithResponse
(String fileName, String permissions, String umask, PathHttpHeaders headers, Map<String, String> metadata, DataLakeRequestConditions requestConditions, Duration timeout, com.azure.core.util.Context context) Creates a new file within a file system.boolean
Creates a new file system within a storage account if it does not exist.com.azure.core.http.rest.Response
<Boolean> createIfNotExistsWithResponse
(Map<String, String> metadata, PublicAccessType accessType, Duration timeout, com.azure.core.util.Context context) Creates a new file system within a storage account if it does not exist.com.azure.core.http.rest.Response
<Void> createWithResponse
(Map<String, String> metadata, PublicAccessType accessType, Duration timeout, com.azure.core.util.Context context) Creates a new file system within a storage account.void
delete()
Marks the specified file system for deletion.void
deleteDirectory
(String directoryName) Deletes the specified directory in the file system.boolean
deleteDirectoryIfExists
(String directoryName) Deletes the specified directory in the file system if it exists.com.azure.core.http.rest.Response
<Boolean> deleteDirectoryIfExistsWithResponse
(String directoryName, DataLakePathDeleteOptions options, Duration timeout, com.azure.core.util.Context context) Deletes the specified directory in the file system if it exists.com.azure.core.http.rest.Response
<Void> deleteDirectoryWithResponse
(String directoryName, boolean recursive, DataLakeRequestConditions requestConditions, Duration timeout, com.azure.core.util.Context context) Deletes the specified directory in the file system.void
deleteFile
(String fileName) Deletes the specified file in the file system.boolean
deleteFileIfExists
(String fileName) Deletes the specified file in the file system if it exists.com.azure.core.http.rest.Response
<Boolean> deleteFileIfExistsWithResponse
(String fileName, DataLakePathDeleteOptions options, Duration timeout, com.azure.core.util.Context context) Deletes the specified file in the file system if it exists.com.azure.core.http.rest.Response
<Void> deleteFileWithResponse
(String fileName, DataLakeRequestConditions requestConditions, Duration timeout, com.azure.core.util.Context context) Deletes the specified file in the file system.boolean
Marks the specified file system for deletion if it exists.com.azure.core.http.rest.Response
<Boolean> deleteIfExistsWithResponse
(DataLakePathDeleteOptions options, Duration timeout, com.azure.core.util.Context context) Marks the specified file system for deletion if it exists.com.azure.core.http.rest.Response
<Void> deleteWithResponse
(DataLakeRequestConditions requestConditions, Duration timeout, com.azure.core.util.Context context) Marks the specified file system for deletion.boolean
exists()
Determines if the file system exists in the cloud.com.azure.core.http.rest.Response
<Boolean> existsWithResponse
(Duration timeout, com.azure.core.util.Context context) Determines if the file system exists in the cloud.generateSas
(DataLakeServiceSasSignatureValues dataLakeServiceSasSignatureValues) Generates a service SAS for the file system using the specifiedDataLakeServiceSasSignatureValues
generateSas
(DataLakeServiceSasSignatureValues dataLakeServiceSasSignatureValues, com.azure.core.util.Context context) Generates a service SAS for the file system using the specifiedDataLakeServiceSasSignatureValues
generateSas
(DataLakeServiceSasSignatureValues dataLakeServiceSasSignatureValues, Consumer<String> stringToSignHandler, com.azure.core.util.Context context) Generates a service SAS for the file system using the specifiedDataLakeServiceSasSignatureValues
generateUserDelegationSas
(DataLakeServiceSasSignatureValues dataLakeServiceSasSignatureValues, UserDelegationKey userDelegationKey) Generates a user delegation SAS for the file system using the specifiedDataLakeServiceSasSignatureValues
.generateUserDelegationSas
(DataLakeServiceSasSignatureValues dataLakeServiceSasSignatureValues, UserDelegationKey userDelegationKey, String accountName, com.azure.core.util.Context context) Generates a user delegation SAS for the file system using the specifiedDataLakeServiceSasSignatureValues
.generateUserDelegationSas
(DataLakeServiceSasSignatureValues dataLakeServiceSasSignatureValues, UserDelegationKey userDelegationKey, String accountName, Consumer<String> stringToSignHandler, com.azure.core.util.Context context) Generates a user delegation SAS for the file system using the specifiedDataLakeServiceSasSignatureValues
.Returns the file system's permissions.com.azure.core.http.rest.Response
<FileSystemAccessPolicies> getAccessPolicyWithResponse
(String leaseId, Duration timeout, com.azure.core.util.Context context) Returns the file system's permissions.Get associated account name.Get the url of the storage account.getDirectoryClient
(String directoryName) Initializes a new DataLakeDirectoryClient object by concatenating directoryName to the end of DataLakeFileSystemClient's URL.getFileClient
(String fileName) Initializes a new DataLakeFileClient object by concatenating fileName to the end of DataLakeFileSystemClient's URL.Get the file system name.Gets the URL of the file system represented by this client.com.azure.core.http.HttpPipeline
Gets theHttpPipeline
powering this client.Returns the file system's metadata and system properties.com.azure.core.http.rest.Response
<FileSystemProperties> getPropertiesWithResponse
(String leaseId, Duration timeout, com.azure.core.util.Context context) Returns the file system's metadata and system properties.Gets the service version the client is using.com.azure.core.http.rest.PagedIterable
<PathDeletedItem> Returns a lazy loaded list of files/directories recently soft deleted in this file system.com.azure.core.http.rest.PagedIterable
<PathDeletedItem> listDeletedPaths
(String prefix, Duration timeout, com.azure.core.util.Context context) Returns a lazy loaded list of files/directories recently soft deleted in this account.com.azure.core.http.rest.PagedIterable
<PathItem> Returns a lazy loaded list of files/directories in this account.com.azure.core.http.rest.PagedIterable
<PathItem> listPaths
(ListPathsOptions options, Duration timeout) Returns a lazy loaded list of files/directories in this account.void
setAccessPolicy
(PublicAccessType accessType, List<DataLakeSignedIdentifier> identifiers) Sets the file system's permissions.com.azure.core.http.rest.Response
<Void> setAccessPolicyWithResponse
(PublicAccessType accessType, List<DataLakeSignedIdentifier> identifiers, DataLakeRequestConditions requestConditions, Duration timeout, com.azure.core.util.Context context) Sets the file system's permissions.void
setMetadata
(Map<String, String> metadata) Sets the file system's metadata.com.azure.core.http.rest.Response
<Void> setMetadataWithResponse
(Map<String, String> metadata, DataLakeRequestConditions requestConditions, Duration timeout, com.azure.core.util.Context context) Sets the file system's metadata.undeletePath
(String deletedPath, String deletionId) Restores a soft deleted path in the file system.com.azure.core.http.rest.Response
<DataLakePathClient> undeletePathWithResponse
(String deletedPath, String deletionId, Duration timeout, com.azure.core.util.Context context) Restores a soft deleted path in the file system.
-
Field Details
-
ROOT_FILESYSTEM_NAME
Special file system name for the root file system in the Storage account.- See Also:
-
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.
- See Also:
-
-
Method Details
-
getFileClient
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:
fileName
- AString
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:
- A new
DataLakeFileClient
object which references the file with the specified name in this file system.
-
getDirectoryClient
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:
directoryName
- AString
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:
- A new
DataLakeDirectoryClient
object which references the directory with the specified name in this file system.
-
getFileSystemName
Get the file system name.Code Samples
String fileSystemName = client.getFileSystemName(); System.out.println("The name of the file system is " + fileSystemName);
- Returns:
- The name of file system.
-
getAccountUrl
Get the url of the storage account.- Returns:
- the URL of the storage account
-
getFileSystemUrl
Gets the URL of the file system represented by this client.- Returns:
- the URL.
-
getAccountName
Get associated account name.- Returns:
- account name associated with this storage resource.
-
getServiceVersion
Gets the service version the client is using.- Returns:
- the service version the client is using.
-
getHttpPipeline
public com.azure.core.http.HttpPipeline getHttpPipeline()Gets theHttpPipeline
powering this client.- Returns:
- The pipeline.
-
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"); } }
-
createWithResponse
public com.azure.core.http.rest.Response<Void> createWithResponse(Map<String, String> metadata, PublicAccessType accessType, Duration timeout, com.azure.core.util.Context context) 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:
metadata
- Metadata to associate with the file system. If there is leading or trailing whitespace in any metadata key or value, it must be removed or encoded.accessType
- Specifies how the data in this file system is available to the public. See the x-ms-blob-public-access header in the Azure Docs for more information. Pass null for no public access.timeout
- An optional timeout value beyond which aRuntimeException
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
-
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 com.azure.core.http.rest.Response<Boolean> createIfNotExistsWithResponse(Map<String, String> metadata, PublicAccessType accessType, Duration timeout, com.azure.core.util.Context context) 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:
metadata
- Metadata to associate with the file system. If there is leading or trailing whitespace in any metadata key or value, it must be removed or encoded.accessType
- Specifies how the data in this file system is available to the public. See the x-ms-blob-public-access header in the Azure Docs for more information. Pass null for no public access.timeout
- An optional timeout value beyond which aRuntimeException
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
's status code is 201, a new file system was successfully created. If status code is 409, a file system already existed at this location.
-
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"); } }
-
deleteWithResponse
public com.azure.core.http.rest.Response<Void> deleteWithResponse(DataLakeRequestConditions requestConditions, Duration timeout, com.azure.core.util.Context context) 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:
requestConditions
-DataLakeRequestConditions
timeout
- An optional timeout value beyond which aRuntimeException
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
-
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 com.azure.core.http.rest.Response<Boolean> deleteIfExistsWithResponse(DataLakePathDeleteOptions options, Duration timeout, com.azure.core.util.Context context) 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:
options
-DataLakePathDeleteOptions
timeout
- An optional timeout value beyond which aRuntimeException
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. The presence of a
Response
indicates the file system was deleted successfully,null
indicates the file system does not exist at this location.
-
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:
- The file system properties.
-
getPropertiesWithResponse
public com.azure.core.http.rest.Response<FileSystemProperties> getPropertiesWithResponse(String leaseId, Duration timeout, com.azure.core.util.Context context) 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:
leaseId
- The lease ID the active lease on the file system must match.timeout
- An optional timeout value beyond which aRuntimeException
will be raised.context
- Additional context that is passed through the Http pipeline during the service call.- Returns:
- A response containing the file system properties.
-
exists
public boolean exists()Determines if the file system exists in the cloud.Code Samples
System.out.printf("Exists? %b%n", client.exists());
- Returns:
- true if the path exists, false if it doesn't
-
existsWithResponse
public com.azure.core.http.rest.Response<Boolean> existsWithResponse(Duration timeout, com.azure.core.util.Context context) 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:
timeout
- An optional timeout value beyond which aRuntimeException
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
-
setMetadata
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:
metadata
- Metadata to associate with the file system. If there is leading or trailing whitespace in any metadata key or value, it must be removed or encoded.
-
setMetadataWithResponse
public com.azure.core.http.rest.Response<Void> setMetadataWithResponse(Map<String, String> metadata, DataLakeRequestConditions requestConditions, Duration timeout, com.azure.core.util.Context context) 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:
metadata
- Metadata to associate with the file system. 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 aRuntimeException
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
-
listPaths
Returns a lazy loaded list of files/directories in this account. The returnedPagedIterable
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:
- The list of files/directories.
-
listPaths
public com.azure.core.http.rest.PagedIterable<PathItem> listPaths(ListPathsOptions options, Duration timeout) Returns a lazy loaded list of files/directories in this account. The returnedPagedIterable
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:
options
- AListPathsOptions
which specifies what data should be returned by the service. If iterating by page, the page size passed to byPage methods such asContinuablePagedIterable.iterableByPage(int)
will be preferred over the value set on these options.timeout
- An optional timeout value beyond which aRuntimeException
will be raised.- Returns:
- The list of files/directories.
-
listDeletedPaths
Returns a lazy loaded list of files/directories recently soft deleted in this file system. The returnedPagedIterable
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:
- The list of files/directories.
-
listDeletedPaths
public com.azure.core.http.rest.PagedIterable<PathDeletedItem> listDeletedPaths(String prefix, Duration timeout, com.azure.core.util.Context context) Returns a lazy loaded list of files/directories recently soft deleted in this account. The returnedPagedIterable
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:
prefix
- Specifies the path to filter the results to.timeout
- An optional timeout value beyond which aRuntimeException
will be raised.context
- Additional context that is passed through the Http pipeline during the service call.- Returns:
- The list of files/directories.
-
createFile
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:
fileName
- Name of the file to create. If the path name contains special characters, pass in the url encoded version of the path name.- Returns:
- A
DataLakeFileClient
used to interact with the file created.
-
createFile
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:
fileName
- Name of the file to create. If the path name contains special characters, pass in the url encoded version of the path name.overwrite
- Whether to overwrite, should a file exist.- Returns:
- A
DataLakeFileClient
used to interact with the file created.
-
createFileWithResponse
public com.azure.core.http.rest.Response<DataLakeFileClient> createFileWithResponse(String fileName, String permissions, String umask, PathHttpHeaders headers, Map<String, String> metadata, DataLakeRequestConditions requestConditions, Duration timeout, com.azure.core.util.Context context) 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:
fileName
- Name of the file to create. If the path name contains special characters, pass in the url encoded version of the path name.permissions
- POSIX access permissions for the file owner, the file owning group, and others.umask
- Restricts permissions of the file to be created.headers
-PathHttpHeaders
metadata
- Metadata to associate with the file. 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 aRuntimeException
will be raised.context
- Additional context that is passed through the Http pipeline during the service call.- Returns:
- A
Response
whosevalue
contains theDataLakeFileClient
used to interact with the file created.
-
createFileWithResponse
public com.azure.core.http.rest.Response<DataLakeFileClient> createFileWithResponse(String fileName, DataLakePathCreateOptions options, Duration timeout, com.azure.core.util.Context context) 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:
fileName
- Name of the file to create. If the path name contains special characters, pass in the url encoded version of the path name.options
-DataLakePathCreateOptions
timeout
- An optional timeout value beyond which aRuntimeException
will be raised.context
- Additional context that is passed through the Http pipeline during the service call.- Returns:
- A
Response
whosevalue
contains theDataLakeFileClient
used to interact with the file created.
-
createFileIfNotExists
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:
fileName
- Name of the file to create. If the path name contains special characters, pass in the url encoded version of the path name.- Returns:
- A
DataLakeFileClient
used to interact with the file created.
-
createFileIfNotExistsWithResponse
public com.azure.core.http.rest.Response<DataLakeFileClient> createFileIfNotExistsWithResponse(String fileName, DataLakePathCreateOptions options, Duration timeout, com.azure.core.util.Context context) 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:
fileName
- Name of the file to create. If the path name contains special characters, pass in the url encoded version of the path name.options
-DataLakePathCreateOptions
metadata key or value, it must be removed or encoded.timeout
- An optional timeout value beyond which aRuntimeException
will be raised.context
- Additional context that is passed through the Http pipeline during the service call.- Returns:
- A
Response
whosevalue
contains theDataLakeFileClient
used to interact with the file created. IfResponse
's status code is 201, a new file was successfully created. If status code is 409, a file with the same name already existed at this location.
-
deleteFile
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:
fileName
- Name of the file to delete. If the path name contains special characters, pass in the url encoded version of the path name.
-
deleteFileWithResponse
public com.azure.core.http.rest.Response<Void> deleteFileWithResponse(String fileName, DataLakeRequestConditions requestConditions, Duration timeout, com.azure.core.util.Context context) 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:
fileName
- Name of the file to delete. If the path name contains special characters, pass in the url encoded version of the path name.requestConditions
-DataLakeRequestConditions
timeout
- An optional timeout value beyond which aRuntimeException
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
-
deleteFileIfExists
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:
fileName
- Name of the file to delete. If the path name contains special characters, pass in the url encoded version of the path name.- Returns:
true
if the file is successfully deleted,false
if the file does not exist.
-
deleteFileIfExistsWithResponse
public com.azure.core.http.rest.Response<Boolean> deleteFileIfExistsWithResponse(String fileName, DataLakePathDeleteOptions options, Duration timeout, com.azure.core.util.Context context) 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:
fileName
- Name of the file to delete. If the path name contains special characters, pass in the url encoded version of the path name.options
-DataLakePathDeleteOptions
timeout
- An optional timeout value beyond which aRuntimeException
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
's status code is 200, the file was successfully deleted. If status code is 404, the file does not exist.
-
createDirectory
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:
directoryName
- Name of the directory to create. If the path name contains special characters, pass in the url encoded version of the path name.- Returns:
- A
DataLakeDirectoryClient
used to interact with the directory created.
-
createDirectory
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:
directoryName
- Name of the directory to create. If the path name contains special characters, pass in the url encoded version of the path name.overwrite
- Whether to overwrite, should a directory exist.- Returns:
- A
DataLakeDirectoryClient
used to interact with the directory created.
-
createDirectoryWithResponse
public com.azure.core.http.rest.Response<DataLakeDirectoryClient> createDirectoryWithResponse(String directoryName, String permissions, String umask, PathHttpHeaders headers, Map<String, String> metadata, DataLakeRequestConditions requestConditions, Duration timeout, com.azure.core.util.Context context) 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:
directoryName
- Name of the directory to create. If the path name contains special characters, pass in the url encoded version of the path name.permissions
- POSIX access permissions for the directory owner, the directory owning group, and others.umask
- Restricts permissions of the directory to be created.headers
-PathHttpHeaders
metadata
- Metadata to associate with the 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 aRuntimeException
will be raised.context
- Additional context that is passed through the Http pipeline during the service call.- Returns:
- A
Response
whosevalue
contains aDataLakeDirectoryClient
used to interact with the directory created.
-
createDirectoryWithResponse
public com.azure.core.http.rest.Response<DataLakeDirectoryClient> createDirectoryWithResponse(String directoryName, DataLakePathCreateOptions options, Duration timeout, com.azure.core.util.Context context) 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:
directoryName
- Name of the directory to create. If the path name contains special characters, pass in the url encoded version of the path name.options
-DataLakePathCreateOptions
timeout
- An optional timeout value beyond which aRuntimeException
will be raised.context
- Additional context that is passed through the Http pipeline during the service call.- Returns:
- A
Response
whosevalue
contains aDataLakeDirectoryClient
used to interact with the directory created.
-
createDirectoryIfNotExists
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:
directoryName
- Name of the directory to create. If the path name contains special characters, pass in the url encoded version of the path name.- Returns:
- A
DataLakeDirectoryClient
used to interact with the subdirectory created.
-
createDirectoryIfNotExistsWithResponse
public com.azure.core.http.rest.Response<DataLakeDirectoryClient> createDirectoryIfNotExistsWithResponse(String directoryName, DataLakePathCreateOptions options, Duration timeout, com.azure.core.util.Context context) 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:
directoryName
- Name of the directory to create. If the path name contains special characters, pass in the url encoded version of the path name.options
-DataLakePathCreateOptions
timeout
- An optional timeout value beyond which aRuntimeException
will be raised.context
- Additional context that is passed through the Http pipeline during the service call.- Returns:
- A
Response
whosevalue
contains theDataLakeDirectoryClient
used to interact with the directory created. IfResponse
's status code is 201, a new directory was successfully created. If status code is 409, a directory with the same name already existed at this location.
-
deleteDirectory
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:
directoryName
- Name of the directory to delete. If the path name contains special characters, pass in the url encoded version of the path name.
-
deleteDirectoryWithResponse
public com.azure.core.http.rest.Response<Void> deleteDirectoryWithResponse(String directoryName, boolean recursive, DataLakeRequestConditions requestConditions, Duration timeout, com.azure.core.util.Context context) 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:
directoryName
- Name of the directory to delete. If the path name contains special characters, pass in the url encoded version of the path name.recursive
- Whether to delete all paths beneath the directory.requestConditions
-DataLakeRequestConditions
timeout
- An optional timeout value beyond which aRuntimeException
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
-
deleteDirectoryIfExists
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:
directoryName
- Name of the directory to delete. If the path name contains special characters, pass in the url encoded version of the path name.- Returns:
true
if the directory is successfully deleted,false
if the directory does not exist.
-
deleteDirectoryIfExistsWithResponse
public com.azure.core.http.rest.Response<Boolean> deleteDirectoryIfExistsWithResponse(String directoryName, DataLakePathDeleteOptions options, Duration timeout, com.azure.core.util.Context context) 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:
directoryName
- Name of the directory to delete. If the path name contains special characters, pass in the url encoded version of the path name.options
-DataLakePathDeleteOptions
timeout
- An optional timeout value beyond which aRuntimeException
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
's status code is 200, the directory was successfully deleted. If status code is 404, the directory does not exist.
-
undeletePath
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:
deletedPath
- The deleted pathdeletionId
- deletion ID associated with the soft deleted path that uniquely identifies a resource if multiple have been soft deleted at this location. You can get soft deleted paths and their associated deletion IDs withlistDeletedPaths()
.- Returns:
- A client pointing to the restored resource.
- Throws:
NullPointerException
- if deletedPath or deletionId is null.
-
undeletePathWithResponse
public com.azure.core.http.rest.Response<DataLakePathClient> undeletePathWithResponse(String deletedPath, String deletionId, Duration timeout, com.azure.core.util.Context context) 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:
deletedPath
- The deleted pathdeletionId
- deletion ID associated with the soft deleted path that uniquely identifies a resource if multiple have been soft deleted at this location. You can get soft deleted paths and their associated deletion IDs withlistDeletedPaths()
.timeout
- An optional timeout value beyond which aRuntimeException
will be raised.context
- Additional context that is passed through the Http pipeline during the service call.- Returns:
- A response containing a client pointing to the restored resource.
- Throws:
NullPointerException
- if deletedPath or deletionId is null.
-
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:
- The file system access policy.
-
getAccessPolicyWithResponse
public com.azure.core.http.rest.Response<FileSystemAccessPolicies> getAccessPolicyWithResponse(String leaseId, Duration timeout, com.azure.core.util.Context context) 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:
leaseId
- The lease ID the active lease on the file system must match.timeout
- An optional timeout value beyond which aRuntimeException
will be raised.context
- Additional context that is passed through the Http pipeline during the service call.- Returns:
- The file system access policy.
-
setAccessPolicy
public void setAccessPolicy(PublicAccessType accessType, List<DataLakeSignedIdentifier> identifiers) 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:
accessType
- Specifies how the data in this file system is available to the public. See the x-ms-blob-public-access header in the Azure Docs for more information. Pass null for no public access.identifiers
- A list ofDataLakeSignedIdentifier
objects that specify the permissions for the file system. Please see here for more information. Passing null will clear all access policies.
-
setAccessPolicyWithResponse
public com.azure.core.http.rest.Response<Void> setAccessPolicyWithResponse(PublicAccessType accessType, List<DataLakeSignedIdentifier> identifiers, DataLakeRequestConditions requestConditions, Duration timeout, com.azure.core.util.Context context) 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:
accessType
- Specifies how the data in this file system is available to the public. See the x-ms-blob-public-access header in the Azure Docs for more information. Pass null for no public access.identifiers
- A list ofDataLakeSignedIdentifier
objects that specify the permissions for the file system. Please see here for more information. Passing null will clear all access policies.requestConditions
-DataLakeRequestConditions
timeout
- An optional timeout value beyond which aRuntimeException
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
-
generateUserDelegationSas
public String generateUserDelegationSas(DataLakeServiceSasSignatureValues dataLakeServiceSasSignatureValues, UserDelegationKey userDelegationKey) Generates a user delegation SAS for the file system using the specifiedDataLakeServiceSasSignatureValues
.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:
dataLakeServiceSasSignatureValues
-DataLakeServiceSasSignatureValues
userDelegationKey
- AUserDelegationKey
object used to sign the SAS values. SeeDataLakeServiceClient.getUserDelegationKey(OffsetDateTime, OffsetDateTime)
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, com.azure.core.util.Context context) Generates a user delegation SAS for the file system using the specifiedDataLakeServiceSasSignatureValues
.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:
dataLakeServiceSasSignatureValues
-DataLakeServiceSasSignatureValues
userDelegationKey
- AUserDelegationKey
object used to sign the SAS values. SeeDataLakeServiceClient.getUserDelegationKey(OffsetDateTime, OffsetDateTime)
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<String> stringToSignHandler, com.azure.core.util.Context context) Generates a user delegation SAS for the file system using the specifiedDataLakeServiceSasSignatureValues
.See
DataLakeServiceSasSignatureValues
for more information on how to construct a user delegation SAS.- Parameters:
dataLakeServiceSasSignatureValues
-DataLakeServiceSasSignatureValues
userDelegationKey
- AUserDelegationKey
object used to sign the SAS values. SeeDataLakeServiceClient.getUserDelegationKey(OffsetDateTime, OffsetDateTime)
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.
-
generateSas
Generates a service SAS for the file system using the specifiedDataLakeServiceSasSignatureValues
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:
dataLakeServiceSasSignatureValues
-DataLakeServiceSasSignatureValues
- Returns:
- A
String
representing the SAS query parameters.
-
generateSas
public String generateSas(DataLakeServiceSasSignatureValues dataLakeServiceSasSignatureValues, com.azure.core.util.Context context) Generates a service SAS for the file system using the specifiedDataLakeServiceSasSignatureValues
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:
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<String> stringToSignHandler, com.azure.core.util.Context context) Generates a service SAS for the file system using the specifiedDataLakeServiceSasSignatureValues
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.
-