DataLakeLeaseClient.Acquire Method
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
The Acquire(TimeSpan, RequestConditions, CancellationToken) operation acquires a lease on
the path or file system. The lease duration
must
be between 15 to 60 seconds, or infinite (-1).
If the file system does not have an active lease, the Data Lake service
creates a lease on the path or file system and returns it. If the
file system has an active lease, you can only request a new lease
using the active lease ID as LeaseId, but you can
specify a new duration
.
For more information, see Lease Container.
public virtual Azure.Response<Azure.Storage.Files.DataLake.Models.DataLakeLease> Acquire (TimeSpan duration, Azure.RequestConditions conditions = default, System.Threading.CancellationToken cancellationToken = default);
abstract member Acquire : TimeSpan * Azure.RequestConditions * System.Threading.CancellationToken -> Azure.Response<Azure.Storage.Files.DataLake.Models.DataLakeLease>
override this.Acquire : TimeSpan * Azure.RequestConditions * System.Threading.CancellationToken -> Azure.Response<Azure.Storage.Files.DataLake.Models.DataLakeLease>
Public Overridable Function Acquire (duration As TimeSpan, Optional conditions As RequestConditions = Nothing, Optional cancellationToken As CancellationToken = Nothing) As Response(Of DataLakeLease)
Parameters
- duration
- TimeSpan
Specifies the duration of the lease, in seconds, or specify InfiniteLeaseDuration for a lease that never expires. A non-infinite lease can be between 15 and 60 seconds. A lease duration cannot be changed using RenewAsync(RequestConditions, CancellationToken) or ChangeAsync(String, RequestConditions, CancellationToken).
- conditions
- RequestConditions
Optional RequestConditions to add conditions on acquiring a lease.
- cancellationToken
- CancellationToken
Optional CancellationToken to propagate notifications that the operation should be cancelled.
Returns
A Response<T> describing the lease.
Remarks
A RequestFailedException will be thrown if a failure occurs.
Applies to
Azure SDK for .NET