BlobLeaseClient
The BlobLeaseClient allows you to manipulate Azure
Storage leases on containers and blobs.
The TimeSpan representing an infinite lease duration.
Gets the BlobClient to manage leases for.
Gets the BlobContainerClient to manage leases for.
Gets the Lease ID for this lease.
Gets the URI of the object being leased.
protected BlobLeaseClient()
Initializes a new instance of the BlobLeaseClient class
for mocking.
Initializes a new instance of the BlobLeaseClient class.
Initializes a new instance of the BlobLeaseClient class.
public virtual Response<BlobLease> Acquire(TimeSpan duration, RequestConditions conditions = null, CancellationToken cancellationToken = default)
The Acquire
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 Response Acquire(TimeSpan duration, RequestConditions conditions, RequestContext context)
The Acquire
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 Task<Response<BlobLease>> AcquireAsync(TimeSpan duration, RequestConditions conditions = null, CancellationToken cancellationToken = default)
The AcquireAsync
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 Task<Response> AcquireAsync(TimeSpan duration, RequestConditions conditions, RequestContext context)
The AcquireAsync
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 Response<BlobLease> Break(TimeSpan? breakPeriod = default, RequestConditions conditions = null, CancellationToken cancellationToken = default)
The Break 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
and Release 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 Task<Response<BlobLease>> BreakAsync(TimeSpan? breakPeriod = default, RequestConditions conditions = null, CancellationToken cancellationToken = default)
The BreakAsync 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
and ReleaseAsync 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 Response<BlobLease> Change(string proposedId, RequestConditions conditions = null, CancellationToken cancellationToken = default)
The Change 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.
public virtual Task<Response<BlobLease>> ChangeAsync(string proposedId, RequestConditions conditions = null, CancellationToken cancellationToken = default)
The ChangeAsync 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.
public virtual Response<ReleasedObjectInfo> Release(RequestConditions conditions = null, CancellationToken cancellationToken = default)
The Release 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.
public virtual Task<Response<ReleasedObjectInfo>> ReleaseAsync(RequestConditions conditions = null, CancellationToken cancellationToken = default)
The ReleaseAsync 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.
public virtual Task<Response<ReleasedObjectInfo>> ReleaseInternal(RequestConditions conditions, bool async, CancellationToken cancellationToken)
The ReleaseInternal 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.
public virtual Response<BlobLease> Renew(RequestConditions conditions = null, CancellationToken cancellationToken = default)
The Renew 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.
public virtual Task<Response<BlobLease>> RenewAsync(RequestConditions conditions = null, CancellationToken cancellationToken = default)
The RenewAsync 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.