public class ShareAsyncClient extends Object
Instantiating an Asynchronous Share Client
ShareAsyncClient
client = newShareClientBuilder
() .connectionString("${connectionString}") .endpoint("${endpoint}") .buildAsyncClient();
View this
for additional ways to construct the azureFileStorageClient.
ShareClientBuilder
,
ShareClient
,
StorageSharedKeyCredential
Modifier and Type | Method and Description |
---|---|
Mono<ShareInfo> |
create()
Creates the share in the storage account.
|
Mono<ShareDirectoryAsyncClient> |
createDirectory(String directoryName)
Creates the directory in the share with the given name.
|
Mono<com.azure.core.http.rest.Response<ShareDirectoryAsyncClient>> |
createDirectoryWithResponse(String directoryName,
FileSmbProperties smbProperties,
String filePermission,
Map<String,String> metadata)
Creates the directory in the share with the given name and associates the passed metadata to it.
|
Mono<ShareFileAsyncClient> |
createFile(String fileName,
long maxSize)
Creates the file in the share with the given name and file max size.
|
Mono<com.azure.core.http.rest.Response<ShareFileAsyncClient>> |
createFileWithResponse(String fileName,
long maxSize,
ShareFileHttpHeaders httpHeaders,
FileSmbProperties smbProperties,
String filePermission,
Map<String,String> metadata)
Creates the file in the share with the given name, file max size and associates the passed properties to it.
|
Mono<com.azure.core.http.rest.Response<ShareFileAsyncClient>> |
createFileWithResponse(String fileName,
long maxSize,
ShareFileHttpHeaders httpHeaders,
FileSmbProperties smbProperties,
String filePermission,
Map<String,String> metadata,
ShareRequestConditions requestConditions)
Creates the file in the share with the given name, file max size and associates the passed properties to it.
|
Mono<String> |
createPermission(String filePermission)
Creates a permission at the share level.
|
Mono<com.azure.core.http.rest.Response<String>> |
createPermissionWithResponse(String filePermission)
Creates a permission at the share level.
|
Mono<ShareSnapshotInfo> |
createSnapshot()
Creates a snapshot of the share with the same metadata associated to the share at the time of creation.
|
Mono<com.azure.core.http.rest.Response<ShareSnapshotInfo>> |
createSnapshotWithResponse(Map<String,String> metadata)
Creates a snapshot of the share with the metadata that was passed associated to the snapshot.
|
Mono<com.azure.core.http.rest.Response<ShareInfo>> |
createWithResponse(Map<String,String> metadata,
Integer quotaInGB)
Creates the share in the storage account with the specified metadata and quota.
|
Mono<Void> |
delete()
Deletes the share in the storage account
|
Mono<Void> |
deleteDirectory(String directoryName)
Deletes the specified directory in the share.
|
Mono<com.azure.core.http.rest.Response<Void>> |
deleteDirectoryWithResponse(String directoryName)
Deletes the specified directory in the share.
|
Mono<Void> |
deleteFile(String fileName)
Deletes the specified file in the share.
|
Mono<com.azure.core.http.rest.Response<Void>> |
deleteFileWithResponse(String fileName)
Deletes the specified file in the share.
|
Mono<com.azure.core.http.rest.Response<Void>> |
deleteFileWithResponse(String fileName,
ShareRequestConditions requestConditions)
Deletes the specified file in the share.
|
Mono<com.azure.core.http.rest.Response<Void>> |
deleteWithResponse()
Deletes the share in the storage account
|
String |
generateSas(ShareServiceSasSignatureValues shareServiceSasSignatureValues)
Generates a service sas for the queue using the specified
ShareServiceSasSignatureValues
Note : The client must be authenticated via StorageSharedKeyCredential |
com.azure.core.http.rest.PagedFlux<ShareSignedIdentifier> |
getAccessPolicy()
Retrieves stored access policies specified for the share.
|
String |
getAccountName()
Get associated account name.
|
ShareDirectoryAsyncClient |
getDirectoryClient(String directoryName)
Constructs a
ShareDirectoryAsyncClient that interacts with the specified directory. |
ShareFileAsyncClient |
getFileClient(String filePath)
Constructs a
ShareFileAsyncClient that interacts with the specified file. |
com.azure.core.http.HttpPipeline |
getHttpPipeline()
Gets the
HttpPipeline powering this client. |
Mono<String> |
getPermission(String filePermissionKey)
Gets a permission for a given key.
|
Mono<com.azure.core.http.rest.Response<String>> |
getPermissionWithResponse(String filePermissionKey)
Gets a permission for a given key.
|
Mono<ShareProperties> |
getProperties()
Retrieves the properties of the share, these include the metadata associated to it and the quota that the share
is restricted to.
|
Mono<com.azure.core.http.rest.Response<ShareProperties>> |
getPropertiesWithResponse()
Retrieves the properties of the share, these include the metadata associated to it and the quota that the share
is restricted to.
|
ShareDirectoryAsyncClient |
getRootDirectoryClient()
Constructs a
ShareDirectoryAsyncClient that interacts with the root directory in the share. |
ShareServiceVersion |
getServiceVersion()
Gets the service version the client is using.
|
String |
getShareName()
Get share name from share client.
|
String |
getShareUrl()
Get the url of the storage share client.
|
String |
getSnapshotId()
Get snapshot id which attached to
ShareAsyncClient . |
Mono<ShareStatistics> |
getStatistics()
Retrieves storage statistics about the share.
|
Mono<com.azure.core.http.rest.Response<ShareStatistics>> |
getStatisticsWithResponse()
Retrieves storage statistics about the share.
|
Mono<ShareInfo> |
setAccessPolicy(List<ShareSignedIdentifier> permissions)
Sets stored access policies for the share.
|
Mono<com.azure.core.http.rest.Response<ShareInfo>> |
setAccessPolicyWithResponse(List<ShareSignedIdentifier> permissions)
Sets stored access policies for the share.
|
Mono<ShareInfo> |
setMetadata(Map<String,String> metadata)
Sets the user-defined metadata to associate to the share.
|
Mono<com.azure.core.http.rest.Response<ShareInfo>> |
setMetadataWithResponse(Map<String,String> metadata)
Sets the user-defined metadata to associate to the share.
|
Mono<ShareInfo> |
setQuota(int quotaInGB)
Sets the maximum size in GB that the share is allowed to grow.
|
Mono<com.azure.core.http.rest.Response<ShareInfo>> |
setQuotaWithResponse(int quotaInGB)
Sets the maximum size in GB that the share is allowed to grow.
|
public String getShareUrl()
public ShareServiceVersion getServiceVersion()
public ShareDirectoryAsyncClient getRootDirectoryClient()
ShareDirectoryAsyncClient
that interacts with the root directory in the share.
If the directory doesn't exist in the share ShareDirectoryAsyncClient.create()
in the
azureFileStorageClient will need to be called before interaction with the directory can happen.
ShareDirectoryAsyncClient
that interacts with the root directory in the sharepublic ShareDirectoryAsyncClient getDirectoryClient(String directoryName)
ShareDirectoryAsyncClient
that interacts with the specified directory.
If the directory doesn't exist in the share create
in the
azureFileStorageClient will need to be called before interaction with the directory can happen.
directoryName
- Name of the directoryShareDirectoryAsyncClient
that interacts with the directory in the sharepublic ShareFileAsyncClient getFileClient(String filePath)
ShareFileAsyncClient
that interacts with the specified file.
If the file doesn't exist in the share ShareFileAsyncClient.create(long)
) create} in the client will
need to be called before interaction with the file can happen.
filePath
- Name of the fileShareFileAsyncClient
that interacts with the file in the sharepublic Mono<ShareInfo> create()
Code Samples
Create the share
shareAsyncClient.create().subscribe( response -> { }, error ->System
.err.print(error.toString()), () ->System
.out.println("Complete creating the share!") );
For more information, see the Azure Docs.
share
ShareStorageException
- If the share already exists with different metadatapublic Mono<com.azure.core.http.rest.Response<ShareInfo>> createWithResponse(Map<String,String> metadata, Integer quotaInGB)
Code Samples
Create the share with metadata "share:metadata"
shareAsyncClient.createWithResponse(Collections
.singletonMap("share", "metadata"), null).subscribe( response ->System
.out.printf("Creating the share completed with status code %d", response.getStatusCode()), error ->System
.err.print(error.toString()), () ->System
.out.println("Complete creating the share!") );
Create the share with a quota of 10 GB
shareAsyncClient.createWithResponse(null, 10).subscribe( response ->System
.out.printf("Creating the share completed with status code %d", response.getStatusCode()), error ->System
.err.print(error.toString()), () ->System
.out.println("Complete creating the share!") );
For more information, see the Azure Docs.
metadata
- Optional metadata to associate with the sharequotaInGB
- Optional maximum size the share is allowed to grow to in GB. This must be greater than 0 and
less than or equal to 5120. The default value is 5120.share
and the status its creation.ShareStorageException
- If the share already exists with different metadata or quotaInGB
is outside
the allowed range.public Mono<ShareSnapshotInfo> createSnapshot()
Code Samples
Create a snapshot
shareAsyncClient.createSnapshot().subscribe( response ->System
.out.println("Successfully creating the share snapshot with snapshot id: " + response.getSnapshot()), error ->System
.err.println(error.toString()), () ->System
.out.println("Complete creating the share snapshot.") );
For more information, see the Azure Docs.
snapshot of share
.ShareStorageException
- If the share doesn't exist, there are 200 snapshots of the share, or a snapshot is
in progress for the sharepublic Mono<com.azure.core.http.rest.Response<ShareSnapshotInfo>> createSnapshotWithResponse(Map<String,String> metadata)
Code Samples
Create a snapshot with metadata "snapshot:metadata"
shareAsyncClient.createSnapshotWithResponse(Collections
.singletonMap("snapshot", "metadata")).subscribe( response ->System
.out.println("Successfully creating the share snapshot with snapshot id: " + response.getValue().getSnapshot()), error ->System
.err.println(error.toString()), () ->System
.out.println("Complete creating the share snapshot.") );
For more information, see the Azure Docs.
metadata
- Optional metadata to associate with the snapshot. If null
the metadata of the share will
be copied to the snapshot.snapshot of share
.ShareStorageException
- If the share doesn't exist, there are 200 snapshots of the share, or a snapshot is
in progress for the sharepublic Mono<Void> delete()
Code Samples
Delete the share
shareAsyncClient.delete().subscribe( response ->System
.out.println("Deleting the shareAsyncClient completed."), error ->System
.err.println(error.toString()), () ->System
.out.println("Complete deleting the share.") );
For more information, see the Azure Docs.
ShareStorageException
- If the share doesn't existpublic Mono<com.azure.core.http.rest.Response<Void>> deleteWithResponse()
Code Samples
Delete the share
shareAsyncClient.deleteWithResponse().subscribe( response ->System
.out.println("Deleting the shareAsyncClient completed with status code: " + response.getStatusCode()), error ->System
.err.println(error.toString()), () ->System
.out.println("Complete deleting the share.") );
For more information, see the Azure Docs.
ShareStorageException
- If the share doesn't existpublic Mono<ShareProperties> getProperties()
Code Samples
Retrieve the share properties
shareAsyncClient.getProperties()
.subscribe(properties -> {
System
.out.printf("Share quota: %d, Metadata: %s", properties.getQuota(), properties.getMetadata());
});
For more information, see the Azure Docs.
properties of the share
ShareStorageException
- If the share doesn't existpublic Mono<com.azure.core.http.rest.Response<ShareProperties>> getPropertiesWithResponse()
Code Samples
Retrieve the share properties
shareAsyncClient.getPropertiesWithResponse()
.subscribe(properties -> {
System
.out.printf("Share quota: %d, Metadata: %s", properties.getValue().getQuota(),
properties.getValue().getMetadata());
});
For more information, see the Azure Docs.
properties of the share
with headers and response
status codeShareStorageException
- If the share doesn't existpublic Mono<ShareInfo> setQuota(int quotaInGB)
Code Samples
Set the quota to 1024 GB
shareAsyncClient.setQuota(1024).doOnSuccess(response ->
System
.out.println("Setting the share quota completed.")
);
For more information, see the Azure Docs.
quotaInGB
- Size in GB to limit the share's growth. The quota in GB must be between 1 and 5120.information about the share
ShareStorageException
- If the share doesn't exist or quotaInGB
is outside the allowed boundspublic Mono<com.azure.core.http.rest.Response<ShareInfo>> setQuotaWithResponse(int quotaInGB)
Code Samples
Set the quota to 1024 GB
shareAsyncClient.setQuotaWithResponse(1024)
.subscribe(response ->
System
.out.printf("Setting the share quota completed with status code %d", response.getStatusCode())
);
For more information, see the Azure Docs.
quotaInGB
- Size in GB to limit the share's growth. The quota in GB must be between 1 and 5120.information about the share
with headers and response status
codeShareStorageException
- If the share doesn't exist or quotaInGB
is outside the allowed boundspublic Mono<ShareInfo> setMetadata(Map<String,String> metadata)
If null
is passed for the metadata it will clear the metadata associated to the share.
Code Samples
Set the metadata to "share:updatedMetadata"
shareAsyncClient.setMetadata(Collections
.singletonMap("share", "updatedMetadata")).doOnSuccess(response ->System
.out.println("Setting the share metadata completed.") );
Clear the metadata of the share
shareAsyncClient.setMetadata(null).doOnSuccess(response ->
System
.out.println("Setting the share metadata completed.")
);
For more information, see the Azure Docs.
metadata
- Metadata to set on the share, if null is passed the metadata for the share is clearedinformation about the share
ShareStorageException
- If the share doesn't exist or the metadata contains invalid keyspublic Mono<com.azure.core.http.rest.Response<ShareInfo>> setMetadataWithResponse(Map<String,String> metadata)
If null
is passed for the metadata it will clear the metadata associated to the share.
Code Samples
Set the metadata to "share:updatedMetadata"
shareAsyncClient.setMetadata(Collections
.singletonMap("share", "updatedMetadata")).doOnSuccess(response ->System
.out.println("Setting the share metadata completed.") );
Clear the metadata of the share
shareAsyncClient.setMetadata(null).doOnSuccess(response ->
System
.out.println("Setting the share metadata completed.")
);
For more information, see the Azure Docs.
metadata
- Metadata to set on the share, if null is passed the metadata for the share is clearedinformation about the share
with headers and response status
codeShareStorageException
- If the share doesn't exist or the metadata contains invalid keyspublic com.azure.core.http.rest.PagedFlux<ShareSignedIdentifier> getAccessPolicy()
Code Samples
List the stored access policies
shareAsyncClient.getAccessPolicy()
.subscribe(result -> System
.out.printf("Access policy %s allows these permissions: %s", result.getId(),
result.getAccessPolicy().getPermissions())
);
For more information, see the Azure Docs.
ShareStorageException
- If the share doesn't existpublic Mono<ShareInfo> setAccessPolicy(List<ShareSignedIdentifier> permissions)
Code Samples
Set a read only stored access policy
ShareAccessPolicy
accessPolicy = newShareAccessPolicy
().setPermissions("r") .setStartsOn(OffsetDateTime
.now(ZoneOffset
.UTC)) .setExpiresOn(OffsetDateTime
.now(ZoneOffset
.UTC).plusDays(10));ShareSignedIdentifier
permission = newShareSignedIdentifier
().setId("mypolicy").setAccessPolicy(accessPolicy); shareAsyncClient.setAccessPolicy(Collections
.singletonList(permission)).doOnSuccess( response ->System
.out.println("Setting access policies completed."));
For more information, see the Azure Docs.
permissions
- Access policies to set on the queueinformation about the share
ShareStorageException
- If the share doesn't exist, a stored access policy doesn't have all fields filled
out, or the share will have more than five policies.public Mono<com.azure.core.http.rest.Response<ShareInfo>> setAccessPolicyWithResponse(List<ShareSignedIdentifier> permissions)
Code Samples
Set a read only stored access policy
ShareAccessPolicy
accessPolicy = newShareAccessPolicy
().setPermissions("r") .setStartsOn(OffsetDateTime
.now(ZoneOffset
.UTC)) .setExpiresOn(OffsetDateTime
.now(ZoneOffset
.UTC).plusDays(10));ShareSignedIdentifier
permission = newShareSignedIdentifier
().setId("mypolicy").setAccessPolicy(accessPolicy); shareAsyncClient.setAccessPolicyWithResponse(Collections
.singletonList(permission)) .subscribe(response ->System
.out.printf("Setting access policies completed completed with status code %d", response.getStatusCode()));
For more information, see the Azure Docs.
permissions
- Access policies to set on the queueinformation about the share
with headers and response status
codeShareStorageException
- If the share doesn't exist, a stored access policy doesn't have all fields filled
out, or the share will have more than five policies.public Mono<ShareStatistics> getStatistics()
Code Samples
Retrieve the storage statistics
shareAsyncClient.getStatistics().doOnSuccess(response -> System
.out.printf("The share is using %d GB",
response.getShareUsageInGB()));
For more information, see the Azure Docs.
statistics of the share
public Mono<com.azure.core.http.rest.Response<ShareStatistics>> getStatisticsWithResponse()
Code Samples
Retrieve the storage statistics
shareAsyncClient.getStatisticsWithResponse().subscribe(response -> System
.out.printf("The share is using %d GB",
response.getValue().getShareUsageInGB()));
For more information, see the Azure Docs.
statistics of the share
with headers and
response status codepublic Mono<ShareDirectoryAsyncClient> createDirectory(String directoryName)
Code Samples
Create the directory "mydirectory"
shareAsyncClient.createDirectory("mydirectory").subscribe( response -> { }, error ->System
.err.print(error.toString()), () ->System
.out.println("Complete creating the directory!") );
For more information, see the Azure Docs.
directoryName
- Name of the directoryShareDirectoryAsyncClient
to interact with the created directory.ShareStorageException
- If the share doesn't exist, the directory already exists or is in the process of
being deleted, or the parent directory for the new directory doesn't existpublic Mono<com.azure.core.http.rest.Response<ShareDirectoryAsyncClient>> createDirectoryWithResponse(String directoryName, FileSmbProperties smbProperties, String filePermission, Map<String,String> metadata)
Code Samples
Create the directory "documents" with metadata "directory:metadata"
FileSmbProperties
smbProperties = newFileSmbProperties
();String
filePermission = "filePermission"; shareAsyncClient.createDirectoryWithResponse("documents", smbProperties, filePermission,Collections
.singletonMap("directory", "metadata")) .subscribe(response ->System
.out.printf("Creating the directory completed with status code %d", response.getStatusCode()));
For more information, see the Azure Docs.
directoryName
- Name of the directorysmbProperties
- The SMB properties of the directory.filePermission
- The file permission of the directory.metadata
- Optional metadata to associate with the directoryShareDirectoryAsyncClient
to interact with the created directory and the
status of its creation.ShareStorageException
- If the share doesn't exist, the directory already exists or is in the process of
being deleted, the parent directory for the new directory doesn't exist, or the metadata is using an illegal key
name.public Mono<ShareFileAsyncClient> createFile(String fileName, long maxSize)
Code Samples
Create the file "myfile" with size of 1024 bytes.
shareAsyncClient.createFile("myfile", 1024).subscribe( response -> { }, error ->System
.err.print(error.toString()), () ->System
.out.println("Complete creating the directory!") );
For more information, see the Azure Docs.
fileName
- Name of the file.maxSize
- The maximum size in bytes for the file, up to 1 TiB.ShareFileAsyncClient
to interact with the created file.ShareStorageException
- If one of the following cases happen:
public Mono<com.azure.core.http.rest.Response<ShareFileAsyncClient>> createFileWithResponse(String fileName, long maxSize, ShareFileHttpHeaders httpHeaders, FileSmbProperties smbProperties, String filePermission, Map<String,String> metadata)
Code Samples
Create the file "myfile" with length of 1024 bytes, some headers, file smb properties and metadata
ShareFileHttpHeaders
httpHeaders = newShareFileHttpHeaders
() .setContentType("text/html") .setContentEncoding("gzip") .setContentLanguage("en") .setCacheControl("no-transform") .setContentDisposition("attachment");FileSmbProperties
smbProperties = newFileSmbProperties
() .setNtfsFileAttributes(EnumSet
.of(NtfsFileAttributes
.READ_ONLY)) .setFileCreationTime(OffsetDateTime
.now()) .setFileLastWriteTime(OffsetDateTime
.now()) .setFilePermissionKey("filePermissionKey");String
filePermission = "filePermission"; // NOTE: filePermission and filePermissionKey should never be both set shareAsyncClient.createFileWithResponse("myfile", 1024, httpHeaders, smbProperties, filePermission,Collections
.singletonMap("directory", "metadata")) .subscribe(response ->System
.out.printf("Creating the file completed with status code %d", response.getStatusCode()));
For more information, see the Azure Docs.
fileName
- Name of the file.maxSize
- The maximum size in bytes for the file, up to 1 TiB.httpHeaders
- The user settable file http headers.smbProperties
- The user settable file smb properties.filePermission
- The file permission of the file.metadata
- Optional name-value pairs associated with the file as metadata.ShareFileAsyncClient
to interact with the created file and the status of
its creation.ShareStorageException
- If one of the following cases happen:
public Mono<com.azure.core.http.rest.Response<ShareFileAsyncClient>> createFileWithResponse(String fileName, long maxSize, ShareFileHttpHeaders httpHeaders, FileSmbProperties smbProperties, String filePermission, Map<String,String> metadata, ShareRequestConditions requestConditions)
Code Samples
Create the file "myfile" with length of 1024 bytes, some headers, file smb properties and metadata
ShareFileHttpHeaders
httpHeaders = newShareFileHttpHeaders
() .setContentType("text/html") .setContentEncoding("gzip") .setContentLanguage("en") .setCacheControl("no-transform") .setContentDisposition("attachment");FileSmbProperties
smbProperties = newFileSmbProperties
() .setNtfsFileAttributes(EnumSet
.of(NtfsFileAttributes
.READ_ONLY)) .setFileCreationTime(OffsetDateTime
.now()) .setFileLastWriteTime(OffsetDateTime
.now()) .setFilePermissionKey("filePermissionKey");String
filePermission = "filePermission"; // NOTE: filePermission and filePermissionKey should never be both setShareRequestConditions
requestConditions = newShareRequestConditions
().setLeaseId(leaseId); shareAsyncClient.createFileWithResponse("myfile", 1024, httpHeaders, smbProperties, filePermission,Collections
.singletonMap("directory", "metadata"), requestConditions) .subscribe(response ->System
.out.printf("Creating the file completed with status code %d", response.getStatusCode()));
For more information, see the Azure Docs.
fileName
- Name of the file.maxSize
- The maximum size in bytes for the file, up to 1 TiB.httpHeaders
- The user settable file http headers.smbProperties
- The user settable file smb properties.filePermission
- The file permission of the file.metadata
- Optional name-value pairs associated with the file as metadata.requestConditions
- ShareRequestConditions
ShareFileAsyncClient
to interact with the created file and the status of
its creation.ShareStorageException
- If one of the following cases happen:
public Mono<Void> deleteDirectory(String directoryName)
Code Samples
Delete the directory "mydirectory"
shareAsyncClient.deleteDirectory("mydirectory").subscribe( response -> { }, error ->System
.err.println(error.toString()), () ->System
.out.println("Complete deleting the directory.") );
For more information, see the Azure Docs.
directoryName
- Name of the directoryShareStorageException
- If the share doesn't exist or the directory isn't emptypublic Mono<com.azure.core.http.rest.Response<Void>> deleteDirectoryWithResponse(String directoryName)
Code Samples
Delete the directory "mydirectory"
shareAsyncClient.deleteDirectory("mydirectory").subscribe( response -> { }, error ->System
.err.println(error.toString()), () ->System
.out.println("Complete deleting the directory.") );
For more information, see the Azure Docs.
directoryName
- Name of the directoryShareStorageException
- If the share doesn't exist or the directory isn't emptypublic Mono<Void> deleteFile(String fileName)
Code Samples
Delete the file "myfile"
shareAsyncClient.deleteFile("myfile").subscribe( response -> { }, error ->System
.err.println(error.toString()), () ->System
.out.println("Complete deleting the file.") );
For more information, see the Azure Docs.
fileName
- Name of the file.ShareStorageException
- If the share or the file doesn't exist.public Mono<com.azure.core.http.rest.Response<Void>> deleteFileWithResponse(String fileName)
Code Samples
Delete the file "myfile"
shareAsyncClient.deleteFile("myfile").subscribe( response -> { }, error ->System
.err.println(error.toString()), () ->System
.out.println("Complete deleting the file.") );
For more information, see the Azure Docs.
fileName
- Name of the file.ShareStorageException
- If the share or the file doesn't exist.public Mono<com.azure.core.http.rest.Response<Void>> deleteFileWithResponse(String fileName, ShareRequestConditions requestConditions)
Code Samples
Delete the file "myfile"
ShareRequestConditions
requestConditions = newShareRequestConditions
().setLeaseId(leaseId); shareAsyncClient.deleteFileWithResponse("myfile", requestConditions).subscribe( response -> { }, error ->System
.err.println(error.toString()), () ->System
.out.println("Complete deleting the file.") );
For more information, see the Azure Docs.
fileName
- Name of the file.requestConditions
- ShareRequestConditions
ShareStorageException
- If the share or the file doesn't exist.public Mono<String> createPermission(String filePermission)
Code Samples
shareAsyncClient.createPermission("filePermission").subscribe(
response -> System
.out.printf("The file permission key is %s", response));
filePermission
- The file permission to get/create.public Mono<com.azure.core.http.rest.Response<String>> createPermissionWithResponse(String filePermission)
Code Samples
shareAsyncClient.createPermissionWithResponse("filePermission").subscribe(
response -> System
.out.printf("The file permission key is %s", response.getValue()));
filePermission
- The file permission to get/create.public Mono<String> getPermission(String filePermissionKey)
Code Samples
shareAsyncClient.getPermission("filePermissionKey").subscribe(
response -> System
.out.printf("The file permission is %s", response));
filePermissionKey
- The file permission key.public Mono<com.azure.core.http.rest.Response<String>> getPermissionWithResponse(String filePermissionKey)
Code Samples
shareAsyncClient.getPermissionWithResponse("filePermissionKey").subscribe(
response -> System
.out.printf("The file permission is %s", response.getValue()));
filePermissionKey
- The file permission key.public String getSnapshotId()
ShareAsyncClient
. Return null
if no snapshot id attached.
Code Samples
Get the share snapshot id.
OffsetDateTime
currentTime =OffsetDateTime
.of(LocalDateTime
.now(),ZoneOffset
.UTC);ShareAsyncClient
shareAsyncClient = newShareClientBuilder
() .endpoint("https://${accountName}.file.core.windows.net") .sasToken("${SASToken}") .shareName("myshare") .snapshot(currentTime.toString()) .buildAsyncClient();System
.out.printf("Snapshot ID: %s%n", shareAsyncClient.getSnapshotId());
DateTime
value that identifies the share snapshot to its base
share.public String getShareName()
Code Samples
String
shareName = shareAsyncClient.getShareName();System
.out.println("The name of the share is " + shareName);
public String getAccountName()
public com.azure.core.http.HttpPipeline getHttpPipeline()
HttpPipeline
powering this client.public String generateSas(ShareServiceSasSignatureValues shareServiceSasSignatureValues)
ShareServiceSasSignatureValues
Note : The client must be authenticated via StorageSharedKeyCredential
See ShareServiceSasSignatureValues
for more information on how to construct a service SAS.
Code Samples
OffsetDateTime
expiryTime =OffsetDateTime
.now().plusDays(1);ShareSasPermission
permission = newShareSasPermission
().setReadPermission(true);ShareServiceSasSignatureValues
values = newShareServiceSasSignatureValues
(expiryTime, permission) .setStartTime(OffsetDateTime
.now()); shareAsyncClient.generateSas(values); // Client must be authenticated via StorageSharedKeyCredential
shareServiceSasSignatureValues
- ShareServiceSasSignatureValues
String
representing all SAS query parameters.Copyright © 2020 Microsoft Corporation. All rights reserved.