BlobLeaseClient class
A client that manages leases for a <xref:ContainerClient> or a <xref:BlobClient>.
Constructors
Blob |
Creates an instance of BlobLeaseClient. |
Properties
lease |
Gets the lease Id. |
url | Gets the url. |
Methods
acquire |
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. |
break |
To end the lease but ensure that another client cannot acquire a new lease until the current lease period has expired. |
change |
To change the ID of the lease. |
release |
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. |
renew |
To renew the lease. |
Constructor Details
BlobLeaseClient(ContainerClient | BlobClient, string)
Creates an instance of BlobLeaseClient.
new BlobLeaseClient(client: ContainerClient | BlobClient, leaseId?: string)
Parameters
- client
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
Promise<LeaseOperationResponse>
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
Promise<LeaseOperationResponse>
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
Promise<LeaseOperationResponse>
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
Promise<LeaseOperationResponse>
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.
Azure SDK for JavaScript