ShareLeaseClient class

Constructors

ShareLeaseClient(ShareFileClient, string)

Creates an instance of ShareLeaseClient.

Properties

leaseId

Gets the lease Id.

url

Gets the url.

Methods

acquireLease(number, LeaseOperationOptions)

Establishes and manages a lock on a file, share or share snapshot for write and delete operations.

breakLease(LeaseOperationOptions)

To force end the lease.

changeLease(string, LeaseOperationOptions)

To change the ID of an existing lease.

releaseLease(LeaseOperationOptions)

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

renewLease(LeaseOperationOptions)

To renew the lease. Only available for lease on share or share snapshot. Note that the lease may be renewed even if it has expired as long as the share has not been leased again since the expiration of that lease. When you renew a lease, the lease duration clock resets.

Constructor Details

ShareLeaseClient(ShareFileClient, string)

Creates an instance of ShareLeaseClient.

new ShareLeaseClient(client: ShareFileClient, leaseId?: string)

Parameters

client
ShareFileClient

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 file, share or share snapshot for write and delete operations.

function acquireLease(duration?: number, options?: LeaseOperationOptions): Promise<LeaseOperationResponse>

Parameters

duration

number

Specifies the duration of lease in seconds. For file, the only allowed value is -1 for a lease that never expires. For share, must be -1 or between 15 to 60.

options
LeaseOperationOptions

Options for the lease management operation.

Returns

Response data for acquire lease operation.

breakLease(LeaseOperationOptions)

To force end the lease.

function breakLease(options?: LeaseOperationOptions): Promise<LeaseOperationResponse>

Parameters

options
LeaseOperationOptions

Options for the lease management operation.

Returns

Response data for break lease operation.

changeLease(string, LeaseOperationOptions)

To change the ID of an existing lease.

function changeLease(proposedLeaseId: string, options?: LeaseOperationOptions): Promise<LeaseOperationResponse>

Parameters

proposedLeaseId

string

the proposed new lease Id.

options
LeaseOperationOptions

Options for the lease management operation.

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.

function releaseLease(options?: LeaseOperationOptions): Promise<LeaseOperationResponse>

Parameters

options
LeaseOperationOptions

Options for the lease management operation.

Returns

Response data for release lease operation.

renewLease(LeaseOperationOptions)

To renew the lease. Only available for lease on share or share snapshot. Note that the lease may be renewed even if it has expired as long as the share has not been leased again since the expiration of that lease. When you renew a lease, the lease duration clock resets.

function renewLease(options?: LeaseOperationOptions): Promise<LeaseOperationResponse>

Parameters

options
LeaseOperationOptions

Options for the lease management operation.

Returns

Response data for renew lease operation.