Skip to content

Commit 98e5a0c

Browse files
authored
Merge pull request #233963 from pauljewellmsft/pauljewell-lease-blob
Update .NET dev guide lease articles
2 parents d1d11e3 + 2697197 commit 98e5a0c

9 files changed

+253
-86
lines changed

articles/storage/blobs/TOC.yml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -609,6 +609,8 @@ items:
609609
href: storage-blob-container-delete.md
610610
- name: List containers
611611
href: storage-blob-containers-list.md
612+
- name: Manage container leases
613+
href: storage-blob-container-lease.md
612614
- name: Manage properties and metadata
613615
href: storage-blob-container-properties-metadata.md
614616
- name: Blob actions
@@ -627,8 +629,8 @@ items:
627629
href: storage-blob-tags.md
628630
- name: Manage blob properties and metadata
629631
href: storage-blob-properties-metadata.md
630-
- name: Create and manage leases
631-
href: storage-blob-container-lease.md
632+
- name: Manage blob leases
633+
href: storage-blob-lease.md
632634
- name: Create and manage snapshots
633635
href: snapshots-manage-dotnet.md
634636
- name: Create and list blob versions

articles/storage/blobs/storage-blob-container-lease-java.md

Lines changed: 17 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -16,15 +16,19 @@ ms.custom: devx-track-java, devguide-java
1616

1717
# Create and manage container leases with Java
1818

19-
This article shows how to create and manage container leases using the [Azure Storage client library for Java](/java/api/overview/azure/storage-blob-readme).
19+
This article shows how to create and manage container leases using the [Azure Storage client library for Java](/java/api/overview/azure/storage-blob-readme). You can use the client library to acquire, renew, release, and break container leases.
2020

21-
A lease establishes and manages a lock on a container for delete operations. The lock duration can be 15 to 60 seconds, or can be infinite. A lease on a container provides exclusive delete access to the container. A container lease only controls the ability to delete the container using the [Delete Container](/rest/api/storageservices/delete-container) operation. To delete a container with an active lease, a client must include the active lease ID with the delete request. All other container operations will succeed on a leased container without the lease ID. If you've enabled [container soft delete](soft-delete-container-overview.md), you can restore deleted containers.
21+
## About container leases
2222

23-
You can use the Java client library to acquire, renew, release and break leases. Lease operations are handled by the [BlobLeaseClient](/java/api/com.azure.storage.blob.specialized.blobleaseclient) class, which provides a client containing all lease operations for [BlobContainerClient](/java/api/com.azure.storage.blob.blobcontainerclient) and [BlobClient](/java/api/com.azure.storage.blob.blobclient). To learn more about lease states and when you might perform an operation, see [Lease states and actions](#lease-states-and-actions).
23+
[!INCLUDE [storage-dev-guide-about-container-lease](../../../includes/storage-dev-guides/storage-dev-guide-about-container-lease.md)]
24+
25+
Lease operations are handled by the [BlobLeaseClient](/java/api/com.azure.storage.blob.specialized.blobleaseclient) class, which provides a client containing all lease operations for blobs and containers. To learn more about blob leases using the client library, see [Create and manage blob leases with Java](storage-blob-lease-java.md).
2426

2527
## Acquire a lease
2628

27-
When you acquire a lease, you'll obtain a lease ID that your code can use to operate on the container. To acquire a lease, create an instance of the [BlobLeaseClient](/java/api/com.azure.storage.blob.specialized.blobleaseclient) class, and then use the following method:
29+
When you acquire a container lease, you obtain a lease ID that your code can use to operate on the container. If the container already has an active lease, you can only request a new lease by using the active lease ID. However, you can specify a new lease duration.
30+
31+
To acquire a lease, create an instance of the [BlobLeaseClient](/java/api/com.azure.storage.blob.specialized.blobleaseclient) class, and then use the following method:
2832

2933
- [acquireLease](/java/api/com.azure.storage.blob.specialized.blobleaseclient)
3034

@@ -34,7 +38,9 @@ The following example acquires a 30-second lease for a container:
3438

3539
## Renew a lease
3640

37-
If your lease expires, you can renew it. To renew an existing lease, use the following method:
41+
You can renew a container lease if the lease ID specified on the request matches the lease ID associated with the container. The lease can be renewed even if it has expired, as long as the container hasn't been leased again since the expiration of that lease. When you renew a lease, the duration of the lease resets.
42+
43+
To renew an existing lease, use the following method:
3844

3945
- [renewLease](/java/api/com.azure.storage.blob.specialized.blobleaseclient)
4046

@@ -44,7 +50,9 @@ The following example renews a lease for a container:
4450

4551
## Release a lease
4652

47-
You can either wait for a lease to expire or explicitly release it. When you release a lease, other clients can immediately acquire a lease for the container as soon as the operation is complete. You can release a lease by using the following method:
53+
You can release a container lease if the lease ID specified on the request matches the lease ID associated with the container. Releasing a lease allows another client to acquire a lease for the container immediately after the release is complete.
54+
55+
You can release a lease by using the following method:
4856

4957
- [releaseLease](/java/api/com.azure.storage.blob.specialized.blobleaseclient)
5058

@@ -54,7 +62,9 @@ The following example releases the lease on a container:
5462

5563
## Break a lease
5664

57-
When you break a lease, the lease ends, and other clients can't acquire a lease until the lease period expires. You can break a lease by using the following method:
65+
You can break a container lease if the container has an active lease. Any authorized request can break the lease; the request isn't required to specify a matching lease ID. A lease can't be renewed after it's broken, and breaking a lease prevents a new lease from being acquired for a period of time until the original lease expires or is released.
66+
67+
You can break a lease by using the following method:
5868

5969
- [breakLease](/java/api/com.azure.storage.blob.specialized.blobleaseclient)
6070

articles/storage/blobs/storage-blob-container-lease-python.md

Lines changed: 17 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -16,15 +16,19 @@ ms.custom: devx-track-python, devguide-python
1616

1717
# Create and manage container leases with Python
1818

19-
This article shows how to create and manage container leases using the [Azure Storage client library for Python](/python/api/overview/azure/storage).
19+
This article shows how to create and manage container leases using the [Azure Storage client library for Python](/python/api/overview/azure/storage). You can use the client library to acquire, renew, release and break container leases.
2020

21-
A lease establishes and manages a lock on a container for delete operations. The lock duration can be 15 to 60 seconds, or can be infinite. A lease on a container provides exclusive delete access to the container. A container lease only controls the ability to delete the container using the [Delete Container](/rest/api/storageservices/delete-container) REST API operation. To delete a container with an active lease, a client must include the active lease ID with the delete request. All other container operations will succeed on a leased container without the lease ID. If you've enabled [container soft delete](soft-delete-container-overview.md), you can restore deleted containers.
21+
## About container leases
2222

23-
You can use the Python client library to acquire, renew, release and break leases. Lease operations are handled by the [BlobLeaseClient](/python/api/azure-storage-blob/azure.storage.blob.blobleaseclient) class, which provides a client containing all lease operations for [ContainerClient](/python/api/azure-storage-blob/azure.storage.blob.containerclient) and [BlobClient](/python/api/azure-storage-blob/azure.storage.blob.blobclient). To learn more about lease states and when you might perform an operation, see [Lease states and actions](#lease-states-and-actions).
23+
[!INCLUDE [storage-dev-guide-about-container-lease](../../../includes/storage-dev-guides/storage-dev-guide-about-container-lease.md)]
24+
25+
Lease operations are handled by the [BlobLeaseClient](/python/api/azure-storage-blob/azure.storage.blob.blobleaseclient) class, which provides a client containing all lease operations for blobs and containers. To learn more about blob leases using the client library, see [Create and manage blob leases with Python](storage-blob-lease-python.md).
2426

2527
## Acquire a lease
2628

27-
When you acquire a lease, you'll obtain a lease ID that your code can use to operate on the container. To acquire a lease, create an instance of the [BlobLeaseClient](/python/api/azure-storage-blob/azure.storage.blob.blobleaseclient) class, and then use the following method:
29+
When you acquire a container lease, you obtain a lease ID that your code can use to operate on the container. If the container already has an active lease, you can only request a new lease by using the active lease ID. However, you can specify a new lease duration.
30+
31+
To acquire a lease, create an instance of the [BlobLeaseClient](/python/api/azure-storage-blob/azure.storage.blob.blobleaseclient) class, and then use the following method:
2832

2933
- [BlobLeaseClient.acquire](/python/api/azure-storage-blob/azure.storage.blob.blobleaseclient#azure-storage-blob-blobleaseclient-acquire)
3034

@@ -38,7 +42,9 @@ The following example acquires a 30-second lease on a container:
3842

3943
## Renew a lease
4044

41-
If your lease expires, you can renew it. To renew a lease, use the following method:
45+
You can renew a container lease if the lease ID specified on the request matches the lease ID associated with the container. The lease can be renewed even if it has expired, as long as the container hasn't been leased again since the expiration of that lease. When you renew a lease, the duration of the lease resets.
46+
47+
To renew a lease, use the following method:
4248

4349
- [BlobLeaseClient.renew](/python/api/azure-storage-blob/azure.storage.blob.blobleaseclient#azure-storage-blob-blobleaseclient-renew)
4450

@@ -48,7 +54,9 @@ The following example renews a lease for a container:
4854

4955
## Release a lease
5056

51-
You can either wait for a lease to expire or explicitly release it. When you release a lease, other clients can obtain a lease. You can release a lease by using the following method:
57+
You can release a container lease if the lease ID specified on the request matches the lease ID associated with the container. Releasing a lease allows another client to acquire a lease for the container immediately after the release is complete.
58+
59+
You can release a lease by using the following method:
5260

5361
- [BlobLeaseClient.release](/python/api/azure-storage-blob/azure.storage.blob.blobleaseclient#azure-storage-blob-blobleaseclient-release)
5462

@@ -58,7 +66,9 @@ The following example releases the lease on a container:
5866

5967
## Break a lease
6068

61-
When you break a lease, the lease ends, but other clients can't acquire a lease until the lease period expires. You can break a lease by using the following method:
69+
You can break a container lease if the container has an active lease. Any authorized request can break the lease; the request isn't required to specify a matching lease ID. A lease can't be renewed after it's broken, and breaking a lease prevents a new lease from being acquired for a period of time until the original lease expires or is released.
70+
71+
You can break a lease by using the following method:
6272

6373
- [BlobLeaseClient.break_lease](/python/api/azure-storage-blob/azure.storage.blob.blobleaseclient#azure-storage-blob-blobleaseclient-break-lease)
6474

0 commit comments

Comments
 (0)