Share via


BlobLeaseClient.Acquire Method

Definition

Overloads

Acquire(TimeSpan, RequestConditions, RequestContext)

The Acquire(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.

Acquire(TimeSpan, RequestConditions, CancellationToken)

The Acquire(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.

Acquire(TimeSpan, RequestConditions, RequestContext)

Source:
BlobLeaseClient.cs
Source:
BlobLeaseClient.cs

The Acquire(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 Azure.Response Acquire (TimeSpan duration, Azure.RequestConditions conditions, Azure.RequestContext context);
abstract member Acquire : TimeSpan * Azure.RequestConditions * Azure.RequestContext -> Azure.Response
override this.Acquire : TimeSpan * Azure.RequestConditions * Azure.RequestContext -> Azure.Response
Public Overridable Function Acquire (duration As TimeSpan, conditions As RequestConditions, context As RequestContext) As 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

Acquire(TimeSpan, RequestConditions, CancellationToken)

Source:
BlobLeaseClient.cs
Source:
BlobLeaseClient.cs

The Acquire(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 Azure.Response<Azure.Storage.Blobs.Models.BlobLease> 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.Blobs.Models.BlobLease>
override this.Acquire : TimeSpan * Azure.RequestConditions * System.Threading.CancellationToken -> Azure.Response<Azure.Storage.Blobs.Models.BlobLease>
Public Overridable Function Acquire (duration As TimeSpan, Optional conditions As RequestConditions = Nothing, Optional cancellationToken As CancellationToken = Nothing) As 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