Share via


BlobLeaseClient.AcquireAsync Method

Definition

Overloads

AcquireAsync(TimeSpan, RequestConditions, RequestContext)

The AcquireAsync(TimeSpan, RequestConditions, RequestContext) operation acquires a lease on the blob or container. The lease duration must be between 15 to 60 seconds, or infinite (-1).

If the container does not have an active lease, the Blob service creates a lease on the blob or container and returns it. If the container 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.

AcquireAsync(TimeSpan, RequestConditions, CancellationToken)

The AcquireAsync(TimeSpan, RequestConditions, CancellationToken) operation acquires a lease on the blob or container. The lease duration must be between 15 to 60 seconds, or infinite (-1).

If the container does not have an active lease, the Blob service creates a lease on the blob or container and returns it. If the container 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.

AcquireAsync(TimeSpan, RequestConditions, RequestContext)

Source:
BlobLeaseClient.cs
Source:
BlobLeaseClient.cs

The AcquireAsync(TimeSpan, RequestConditions, RequestContext) operation acquires a lease on the blob or container. The lease duration must be between 15 to 60 seconds, or infinite (-1).

If the container does not have an active lease, the Blob service creates a lease on the blob or container and returns it. If the container 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 System.Threading.Tasks.Task<Azure.Response> AcquireAsync (TimeSpan duration, Azure.RequestConditions conditions, Azure.RequestContext context);
abstract member AcquireAsync : TimeSpan * Azure.RequestConditions * Azure.RequestContext -> System.Threading.Tasks.Task<Azure.Response>
override this.AcquireAsync : TimeSpan * Azure.RequestConditions * Azure.RequestContext -> System.Threading.Tasks.Task<Azure.Response>
Public Overridable Function AcquireAsync (duration As TimeSpan, conditions As RequestConditions, context As RequestContext) As Task(Of Response)

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 BlobLeaseRequestConditions to add conditions on acquiring a lease.

context
RequestContext

Optional RequestContext for the operation.

Returns

A Response as returned by the Storage service.

Remarks

A RequestFailedException will be thrown if a failure occurs.

Applies to

AcquireAsync(TimeSpan, RequestConditions, CancellationToken)

Source:
BlobLeaseClient.cs
Source:
BlobLeaseClient.cs

The AcquireAsync(TimeSpan, RequestConditions, CancellationToken) operation acquires a lease on the blob or container. The lease duration must be between 15 to 60 seconds, or infinite (-1).

If the container does not have an active lease, the Blob service creates a lease on the blob or container and returns it. If the container 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 System.Threading.Tasks.Task<Azure.Response<Azure.Storage.Blobs.Models.BlobLease>> AcquireAsync (TimeSpan duration, Azure.RequestConditions conditions = default, System.Threading.CancellationToken cancellationToken = default);
abstract member AcquireAsync : TimeSpan * Azure.RequestConditions * System.Threading.CancellationToken -> System.Threading.Tasks.Task<Azure.Response<Azure.Storage.Blobs.Models.BlobLease>>
override this.AcquireAsync : TimeSpan * Azure.RequestConditions * System.Threading.CancellationToken -> System.Threading.Tasks.Task<Azure.Response<Azure.Storage.Blobs.Models.BlobLease>>
Public Overridable Function AcquireAsync (duration As TimeSpan, Optional conditions As RequestConditions = Nothing, Optional cancellationToken As CancellationToken = Nothing) As Task(Of Response(Of BlobLease))

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 BlobLeaseRequestConditions 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