Share via


BlobLeaseClient Class

Definition

The BlobLeaseClient allows you to manipulate Azure Storage leases on containers and blobs.

public class BlobLeaseClient
type BlobLeaseClient = class
Public Class BlobLeaseClient
Inheritance
BlobLeaseClient

Constructors

BlobLeaseClient()

Initializes a new instance of the BlobLeaseClient class for mocking.

BlobLeaseClient(BlobBaseClient, String)

Initializes a new instance of the BlobLeaseClient class.

BlobLeaseClient(BlobContainerClient, String)

Initializes a new instance of the BlobLeaseClient class.

Fields

InfiniteLeaseDuration

The TimeSpan representing an infinite lease duration.

Properties

BlobClient

Gets the BlobClient to manage leases for.

BlobContainerClient

Gets the BlobContainerClient to manage leases for.

LeaseId

Gets the Lease ID for this lease.

Uri

Gets the URI of the object being leased.

Methods

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)

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.

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)

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.

Break(Nullable<TimeSpan>, RequestConditions, CancellationToken)

The Break(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 Break(Nullable<TimeSpan>, RequestConditions, CancellationToken) and Release(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.

BreakAsync(Nullable<TimeSpan>, RequestConditions, CancellationToken)

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.

Change(String, RequestConditions, CancellationToken)

The Change(String, RequestConditions, CancellationToken) operation changes the lease of an active lease. A change must include the current LeaseId and a new proposedId.

For more information, see Lease Container.

ChangeAsync(String, RequestConditions, CancellationToken)

The ChangeAsync(String, RequestConditions, CancellationToken) operation changes the lease of an active lease. A change must include the current LeaseId and a new proposedId.

For more information, see Lease Container.

Release(RequestConditions, CancellationToken)

The Release(RequestConditions, CancellationToken) operation releases the container or blob's previously-acquired lease.

The lease may be released if the LeaseId matches that associated with the container or blob. Releasing the lease allows another client to immediately acquire the lease for the container or blob as soon as the release is complete.

For more information, see Lease Container.

ReleaseAsync(RequestConditions, CancellationToken)

The ReleaseAsync(RequestConditions, CancellationToken) operation releases the container or blob's previously-acquired lease.

The lease may be released if the LeaseId matches that associated with the container or blob. Releasing the lease allows another client to immediately acquire the lease for the container or blob as soon as the release is complete.

For more information, see Lease Container.

Renew(RequestConditions, CancellationToken)

The Renew(RequestConditions, CancellationToken) operation renews the blob or container's previously-acquired lease.

The lease can be renewed if the leaseId matches that associated with the blob or container. Note that the lease may be renewed even if it has expired as long as the blob or container has not been leased again since the expiration of that lease. When you renew a lease, the lease duration clock resets.

For more information, see Lease Container.

RenewAsync(RequestConditions, CancellationToken)

The RenewAsync(RequestConditions, CancellationToken) operation renews the blob or container's previously-acquired lease.

The lease can be renewed if the leaseId matches that associated with the blob or container. Note that the] lease may be renewed even if it has expired as long as the blob or container has not been leased again since the expiration of that lease. When you renew a lease, the lease duration clock resets.

For more information, see Lease Container.

Applies to