Class ShareLeaseAsyncClient
java.lang.Object
com.azure.storage.file.share.specialized.ShareLeaseAsyncClient
This class provides a client that contains all the leasing operations for
files
.
This client acts as a supplement to that client and only handles leasing operations.
Instantiating a ShareLeaseAsyncClient
ShareLeaseAsyncClient fileLeaseAsyncClient = new ShareLeaseClientBuilder() .fileAsyncClient(shareFileAsyncClient) .buildAsyncClient();
View this
for additional ways to construct the client.
For more information about leasing see the Azure Docs.
- See Also:
-
Method Summary
Modifier and TypeMethodDescriptionAcquires an infinite lease for write and delete operations.Acquires an infinite lease for write and delete operations.Acquires a lease for write and delete operations.Breaks the previously acquired lease, if it exists.Breaks the previously acquired lease, if it exists.Breaks the previously acquired lease, if it exists.changeLease
(String proposedId) Changes the lease ID.changeLeaseWithResponse
(String proposedId) Changes the lease ID.Get associated account name.Deprecated.Get the lease ID for this lease.Gets theURL
of the lease client.Releases the previously acquired lease.Releases the previously acquired lease.Renews the previously acquired lease on a share.Renews the previously acquired lease on a share.
-
Method Details
-
getFileUrl
Deprecated.Please usegetResourceUrl()
- Returns:
- URL of the lease client.
-
getResourceUrl
Gets theURL
of the lease client.The lease will either be a share or share file URL depending on which the lease client is associated.
- Returns:
- URL of the lease client.
-
getLeaseId
Get the lease ID for this lease.- Returns:
- the lease ID.
-
acquireLease
Acquires an infinite lease for write and delete operations.Code Samples
client.acquireLease().subscribe(response -> System.out.printf("Lease ID is %s%n", response));
- Returns:
- A reactive response containing the lease ID.
-
acquireLeaseWithResponse
Acquires an infinite lease for write and delete operations.Code Samples
client.acquireLeaseWithResponse().subscribe(response -> System.out.printf("Lease ID is %s%n", response.getValue()));
- Returns:
- A reactive response containing the lease ID.
-
releaseLease
Releases the previously acquired lease.Code Samples
client.releaseLease().subscribe(response -> System.out.println("Completed release lease"));
- Returns:
- A reactive response signalling completion.
-
releaseLeaseWithResponse
Releases the previously acquired lease.Code Samples
client.releaseLeaseWithResponse().subscribe(response -> System.out.printf("Release lease completed with status %d%n", response.getStatusCode()));
- Returns:
- A reactive response signalling completion.
-
breakLease
Breaks the previously acquired lease, if it exists. Leases will break immediately.Code Samples
client.breakLease().subscribe(response -> System.out.println("The lease has been successfully broken"));
- Returns:
- A reactive response signalling completion.
-
breakLeaseWithResponse
Breaks the previously acquired lease, if it exists.For files, leases will break immediately.
For shares, leases will break after the specified duration.
Code Samples
client.breakLeaseWithResponse().subscribe(response -> System.out.println("The lease has been successfully broken"));
- Returns:
- A reactive response signalling completion.
-
changeLease
Changes the lease ID.Code Samples
client.changeLease("proposedId").subscribe(response -> System.out.printf("Changed lease ID is %s%n", response));
- Parameters:
proposedId
- A new lease ID in a valid GUID format.- Returns:
- A reactive response containing the new lease ID.
-
changeLeaseWithResponse
Changes the lease ID.Code Samples
client.changeLeaseWithResponse("proposedId").subscribe(response -> System.out.printf("Changed lease ID is %s%n", response.getValue()));
- Parameters:
proposedId
- A new lease ID in a valid GUID format.- Returns:
- A reactive response containing the new lease ID.
-
renewLease
Renews the previously acquired lease on a share.Code Samples
client.renewLease().subscribe(response -> System.out.printf("Renewed lease ID is %s%n", response));
- Returns:
- A reactive response containing the renewed lease ID.
-
renewLeaseWithResponse
Renews the previously acquired lease on a share.Code Samples
client.renewLeaseWithResponse().subscribe(response -> System.out.printf("Renewed lease ID is %s%n", response.getValue()));
- Returns:
- A reactive response containing the renewed lease ID.
-
getAccountName
Get associated account name.- Returns:
- account name associated with this storage resource.
-
getResourceUrl()