ShareLeaseClient class
Definition
Creates a new ShareLeaseClient.
This client provides lease operations on a ShareFileClient.
ShareLeaseClient(client, lease_id=None)
- Inheritance
-
builtins.objectazure.storage.fileshare._lease.ShareLeaseClientShareLeaseClient
Parameters
- client
- ShareFileClient
The client of the file to lease.
- lease_id
- str
A string representing the lease ID of an existing lease. This value does not need to be specified in order to acquire a new lease, or break one.
Variables
- id
- str
- etag
- str
- last_modified
- datetime.datetime
Methods
| acquire |
Requests a new lease. This operation establishes and manages a lock on a file for write and delete operations. If the file does not have an active lease, the File service creates a lease on the file. If the file has an active lease, you can only request a new lease using the active lease ID. If the file does not have an active lease, the File service creates a lease on the file and returns a new lease ID. |
| break_lease |
Force breaks the lease if the file has an active lease. Any authorized request can break the lease; the request is not required to specify a matching lease ID. An infinite lease breaks immediately. Once a lease is broken, it cannot be changed. Any authorized request can break the lease; the request is not required to specify a matching lease ID. When a lease is successfully broken, the response indicates the interval in seconds until a new lease can be acquired. |
| change |
Changes the lease ID of an active lease. A change must include the current lease ID in x-ms-lease-id and a new lease ID in x-ms-proposed-lease-id. |
| release |
Releases the lease. The lease may be released if the lease ID specified on the request matches that associated with the file. Releasing the lease allows another client to immediately acquire the lease for the file as soon as the release is complete. The lease may be released if the client lease id specified matches that associated with the file. Releasing the lease allows another client to immediately acquire the lease for the file as soon as the release is complete. |
acquire
Requests a new lease. This operation establishes and manages a lock on a file for write and delete operations. If the file does not have an active lease, the File service creates a lease on the file. If the file has an active lease, you can only request a new lease using the active lease ID.
If the file does not have an active lease, the File service creates a lease on the file and returns a new lease ID.
acquire(**kwargs)
Return type
break_lease
Force breaks the lease if the file has an active lease. Any authorized request can break the lease; the request is not required to specify a matching lease ID. An infinite lease breaks immediately.
Once a lease is broken, it cannot be changed. Any authorized request can break the lease; the request is not required to specify a matching lease ID. When a lease is successfully broken, the response indicates the interval in seconds until a new lease can be acquired.
break_lease(**kwargs)
Returns
Approximate time remaining in the lease period, in seconds.
Return type
change
Changes the lease ID of an active lease. A change must include the current lease ID in x-ms-lease-id and a new lease ID in x-ms-proposed-lease-id.
change(proposed_lease_id, **kwargs)
Parameters
- proposed_lease_id
- str
Proposed lease ID, in a GUID string format. The File service returns 400 (Invalid request) if the proposed lease ID is not in the correct format.
Returns
None
release
Releases the lease. The lease may be released if the lease ID specified on the request matches that associated with the file. Releasing the lease allows another client to immediately acquire the lease for the file as soon as the release is complete.
The lease may be released if the client lease id specified matches that associated with the file. Releasing the lease allows another client to immediately acquire the lease for the file as soon as the release is complete.
release(**kwargs)
Returns
None