public final class ShareLeaseAsyncClient extends Object
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.
ShareLeaseClientBuilder
Modifier and Type | Method and Description |
---|---|
Mono<String> |
acquireLease()
Acquires an infinite lease for write and delete operations.
|
Mono<com.azure.core.http.rest.Response<String>> |
acquireLeaseWithResponse()
Acquires an infinite lease for write and delete operations.
|
Mono<com.azure.core.http.rest.Response<String>> |
acquireLeaseWithResponse(ShareAcquireLeaseOptions options)
Acquires a lease for write and delete operations.
|
Mono<Void> |
breakLease()
Breaks the previously acquired lease, if it exists.
|
Mono<com.azure.core.http.rest.Response<Void>> |
breakLeaseWithResponse()
Breaks the previously acquired lease, if it exists.
|
Mono<com.azure.core.http.rest.Response<Void>> |
breakLeaseWithResponse(ShareBreakLeaseOptions options)
Breaks the previously acquired lease, if it exists.
|
Mono<String> |
changeLease(String proposedId)
Changes the lease ID.
|
Mono<com.azure.core.http.rest.Response<String>> |
changeLeaseWithResponse(String proposedId)
Changes the lease ID.
|
String |
getAccountName()
Get associated account name.
|
String |
getFileUrl()
Deprecated.
Please use
ShareLeaseAsyncClient.getResourceUrl() |
String |
getLeaseId()
Get the lease ID for this lease.
|
String |
getResourceUrl()
Gets the
URL of the lease client. |
Mono<Void> |
releaseLease()
Releases the previously acquired lease.
|
Mono<com.azure.core.http.rest.Response<Void>> |
releaseLeaseWithResponse()
Releases the previously acquired lease.
|
Mono<String> |
renewLease()
Renews the previously acquired lease on a share.
|
Mono<com.azure.core.http.rest.Response<String>> |
renewLeaseWithResponse()
Renews the previously acquired lease on a share.
|
@Deprecated public String getFileUrl()
ShareLeaseAsyncClient.getResourceUrl()
public String getResourceUrl()
URL
of the lease client.
The lease will either be a share or share file URL depending on which the lease client is associated.
public String getLeaseId()
public Mono<String> acquireLease()
Code Samples
client.acquireLease().subscribe(response -> System.out.printf("Lease ID is %s%n", response));
public Mono<com.azure.core.http.rest.Response<String>> acquireLeaseWithResponse()
Code Samples
client.acquireLeaseWithResponse().subscribe(response -> System.out.printf("Lease ID is %s%n", response.getValue()));
public Mono<com.azure.core.http.rest.Response<String>> acquireLeaseWithResponse(ShareAcquireLeaseOptions options)
Code Samples
client.acquireLeaseWithResponse(new ShareAcquireLeaseOptions().setDuration(10)).subscribe(response -> System.out.printf("Lease ID is %s%n", response.getValue()));
options
- ShareAcquireLeaseOptions
public Mono<Void> releaseLease()
Code Samples
client.releaseLease().subscribe(response -> System.out.println("Completed release lease"));
public Mono<com.azure.core.http.rest.Response<Void>> releaseLeaseWithResponse()
Code Samples
client.releaseLeaseWithResponse().subscribe(response -> System.out.printf("Release lease completed with status %d%n", response.getStatusCode()));
public Mono<Void> breakLease()
Code Samples
client.breakLease().subscribe(response -> System.out.println("The lease has been successfully broken"));
public Mono<com.azure.core.http.rest.Response<Void>> breakLeaseWithResponse()
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"));
public Mono<com.azure.core.http.rest.Response<Void>> breakLeaseWithResponse(ShareBreakLeaseOptions options)
For files, leases will break immediately.
For shares, leases will break after the specified duration.
Code Samples
client.breakLeaseWithResponse(new ShareBreakLeaseOptions().setBreakPeriod(Duration.ofSeconds(25))) .subscribe(response -> System.out.println("The lease has been successfully broken"));
options
- ShareBreakLeaseOptions
public Mono<String> changeLease(String proposedId)
Code Samples
client.changeLease("proposedId").subscribe(response -> System.out.printf("Changed lease ID is %s%n", response));
proposedId
- A new lease ID in a valid GUID format.public Mono<com.azure.core.http.rest.Response<String>> changeLeaseWithResponse(String proposedId)
Code Samples
client.changeLeaseWithResponse("proposedId").subscribe(response -> System.out.printf("Changed lease ID is %s%n", response.getValue()));
proposedId
- A new lease ID in a valid GUID format.public Mono<String> renewLease()
Code Samples
client.renewLease().subscribe(response -> System.out.printf("Renewed lease ID is %s%n", response));
public Mono<com.azure.core.http.rest.Response<String>> renewLeaseWithResponse()
Code Samples
client.renewLeaseWithResponse().subscribe(response -> System.out.printf("Renewed lease ID is %s%n", response.getValue()));
public String getAccountName()
Copyright © 2020 Microsoft Corporation. All rights reserved.