BlobLeaseClient class

A client that manages leases for a <xref:ContainerClient> or a <xref:BlobClient>.

Constructors

BlobLeaseClient(ContainerClient | BlobClient, string)

Creates an instance of BlobLeaseClient.

Properties

leaseId

Gets the lease Id.

url

Gets the url.

Methods

acquireLease(number, LeaseOperationOptions)

Establishes and manages a lock on a container for delete operations, or on a blob for write and delete operations. The lock duration can be 15 to 60 seconds, or can be infinite.

breakLease(number, LeaseOperationOptions)

To end the lease but ensure that another client cannot acquire a new lease until the current lease period has expired.

changeLease(string, LeaseOperationOptions)

To change the ID of the lease.

releaseLease(LeaseOperationOptions)

To free the lease if it is no longer needed so that another client may immediately acquire a lease against the container or the blob.

renewLease(LeaseOperationOptions)

To renew the lease.

Constructor Details

BlobLeaseClient(ContainerClient | BlobClient, string)

Creates an instance of BlobLeaseClient.

new BlobLeaseClient(client: ContainerClient | BlobClient, leaseId?: string)

Parameters

client

ContainerClient | BlobClient

The client to make the lease operation requests.

leaseId

string

Initial proposed lease id.

Property Details

leaseId

Gets the lease Id.

string leaseId

Property Value

string

url

Gets the url.

string url

Property Value

string

Method Details

acquireLease(number, LeaseOperationOptions)

Establishes and manages a lock on a container for delete operations, or on a blob for write and delete operations. The lock duration can be 15 to 60 seconds, or can be infinite.

function acquireLease(duration: number, options?: LeaseOperationOptions)

Parameters

duration

number

Must be between 15 to 60 seconds, or infinite (-1)

options
LeaseOperationOptions

option to configure lease management operations.

Returns

Response data for acquire lease operation.

breakLease(number, LeaseOperationOptions)

To end the lease but ensure that another client cannot acquire a new lease until the current lease period has expired.

function breakLease(breakPeriod: number, options?: LeaseOperationOptions)

Parameters

breakPeriod

number

Break period

options
LeaseOperationOptions

Optional options to configure lease management operations.

Returns

Response data for break lease operation.

changeLease(string, LeaseOperationOptions)

To change the ID of the lease.

function changeLease(proposedLeaseId: string, options?: LeaseOperationOptions)

Parameters

proposedLeaseId

string

the proposed new lease Id.

options
LeaseOperationOptions

option to configure lease management operations.

Returns

Response data for change lease operation.

releaseLease(LeaseOperationOptions)

To free the lease if it is no longer needed so that another client may immediately acquire a lease against the container or the blob.

function releaseLease(options?: LeaseOperationOptions)

Parameters

options
LeaseOperationOptions

option to configure lease management operations.

Returns

Response data for release lease operation.

renewLease(LeaseOperationOptions)

To renew the lease.

function renewLease(options?: LeaseOperationOptions)

Parameters

options
LeaseOperationOptions

Optional option to configure lease management operations.

Returns

Promise<Lease>

Response data for renew lease operation.