Aracılığıyla paylaş


BlobLeaseClient.BreakAsync Method

Definition

The BreakAsync(Nullable<TimeSpan>, RequestConditions, CancellationToken) operation breaks the blob or container's previously-acquired lease (if it exists).

Once a lease is broken, it cannot be renewed. Any authorized request can break the lease; the request is not required to specify a matching lease ID. When a lease is broken, the lease break breakPeriod is allowed to elapse, during which time no lease operation except BreakAsync(Nullable<TimeSpan>, RequestConditions, CancellationToken) and ReleaseAsync(RequestConditions, CancellationToken) can be performed on the blob or container. When a lease is successfully broken, the response indicates the interval in seconds until a new lease can be acquired.

A lease that has been broken can also be released. A client can immediately acquire a blob or container lease that has been released.

For more information, see Lease Container.

public virtual System.Threading.Tasks.Task<Azure.Response<Azure.Storage.Blobs.Models.BlobLease>> BreakAsync (TimeSpan? breakPeriod = default, Azure.RequestConditions conditions = default, System.Threading.CancellationToken cancellationToken = default);
abstract member BreakAsync : Nullable<TimeSpan> * Azure.RequestConditions * System.Threading.CancellationToken -> System.Threading.Tasks.Task<Azure.Response<Azure.Storage.Blobs.Models.BlobLease>>
override this.BreakAsync : Nullable<TimeSpan> * Azure.RequestConditions * System.Threading.CancellationToken -> System.Threading.Tasks.Task<Azure.Response<Azure.Storage.Blobs.Models.BlobLease>>
Public Overridable Function BreakAsync (Optional breakPeriod As Nullable(Of TimeSpan) = Nothing, Optional conditions As RequestConditions = Nothing, Optional cancellationToken As CancellationToken = Nothing) As Task(Of Response(Of BlobLease))

Parameters

breakPeriod
Nullable<TimeSpan>

Specifies the proposed duration the lease should continue before it is broken, in seconds, between 0 and 60. This break period is only used if it is shorter than the time remaining on the lease. If longer, the time remaining on the lease is used. A new lease will not be available before the break period has expired, but the lease may be held for longer than the break period. If this value is not provided, a fixed-duration lease breaks after the remaining lease period elapses, and an infinite lease breaks immediately.

conditions
RequestConditions

Optional BlobLeaseRequestConditions to add conditions on breaking a lease.

cancellationToken
CancellationToken

Optional CancellationToken to propagate notifications that the operation should be cancelled.

Returns

A Response<T> describing the broken lease.

Remarks

A RequestFailedException will be thrown if a failure occurs.

Applies to