diff --git a/sdk/storage/Azure.Storage.Blobs/src/LeaseClient.cs b/sdk/storage/Azure.Storage.Blobs/src/BlobLeaseClient.cs
similarity index 96%
rename from sdk/storage/Azure.Storage.Blobs/src/LeaseClient.cs
rename to sdk/storage/Azure.Storage.Blobs/src/BlobLeaseClient.cs
index 2c1f6cfb0c7b..3c137e048548 100644
--- a/sdk/storage/Azure.Storage.Blobs/src/LeaseClient.cs
+++ b/sdk/storage/Azure.Storage.Blobs/src/BlobLeaseClient.cs
@@ -12,10 +12,10 @@
namespace Azure.Storage.Blobs.Specialized
{
///
- /// The allows you to manipulate Azure
+ /// The allows you to manipulate Azure
/// Storage leases on containers and blobs.
///
- public class LeaseClient
+ public class BlobLeaseClient
{
///
/// The to manage leases for.
@@ -65,17 +65,17 @@ public class LeaseClient
public static readonly TimeSpan InfiniteLeaseDuration = TimeSpan.FromSeconds(Constants.Blob.Lease.InfiniteLeaseDuration);
///
- /// Initializes a new instance of the class
+ /// Initializes a new instance of the class
/// for mocking.
///
- protected LeaseClient()
+ protected BlobLeaseClient()
{
_blob = null;
_container = null;
}
///
- /// Initializes a new instance of the class.
+ /// Initializes a new instance of the class.
///
///
/// A representing the blob being leased.
@@ -84,7 +84,7 @@ protected LeaseClient()
/// An optional lease ID. If no lease ID is provided, a random lease
/// ID will be created.
///
- public LeaseClient(BlobBaseClient client, string leaseId = null)
+ public BlobLeaseClient(BlobBaseClient client, string leaseId = null)
{
_blob = client ?? throw Errors.ArgumentNull(nameof(client));
_container = null;
@@ -92,7 +92,7 @@ public LeaseClient(BlobBaseClient client, string leaseId = null)
}
///
- /// Initializes a new instance of the class.
+ /// Initializes a new instance of the class.
///
///
/// A representing the blob container
@@ -102,7 +102,7 @@ public LeaseClient(BlobBaseClient client, string leaseId = null)
/// An optional lease ID. If no lease ID is provided, a random lease
/// ID will be created.
///
- public LeaseClient(BlobContainerClient client, string leaseId = null)
+ public BlobLeaseClient(BlobContainerClient client, string leaseId = null)
{
_blob = null;
_container = client ?? throw Errors.ArgumentNull(nameof(client));
@@ -123,7 +123,7 @@ private void EnsureClient()
if (BlobClient == null && BlobContainerClient == null)
{
// This can only happen if someone's not being careful while mocking
- throw BlobErrors.BlobOrContainerMissing(nameof(LeaseClient), nameof(BlobBaseClient), nameof(BlobContainerClient));
+ throw BlobErrors.BlobOrContainerMissing(nameof(BlobLeaseClient), nameof(BlobBaseClient), nameof(BlobContainerClient));
}
}
@@ -264,10 +264,10 @@ private async Task> AcquireInternal(
EnsureClient();
// Int64 is an overflow safe cast relative to TimeSpan.MaxValue
var serviceDuration = duration < TimeSpan.Zero ? Constants.Blob.Lease.InfiniteLeaseDuration : Convert.ToInt64(duration.TotalSeconds);
- using (Pipeline.BeginLoggingScope(nameof(LeaseClient)))
+ using (Pipeline.BeginLoggingScope(nameof(BlobLeaseClient)))
{
Pipeline.LogMethodEnter(
- nameof(LeaseClient),
+ nameof(BlobLeaseClient),
message:
$"{nameof(Uri)}: {Uri}\n" +
$"{nameof(LeaseId)}: {LeaseId}\n" +
@@ -320,7 +320,7 @@ private async Task> AcquireInternal(
}
finally
{
- Pipeline.LogMethodExit(nameof(LeaseClient));
+ Pipeline.LogMethodExit(nameof(BlobLeaseClient));
}
}
}
@@ -434,10 +434,10 @@ private async Task> RenewInternal(
bool async,
CancellationToken cancellationToken)
{
- using (Pipeline.BeginLoggingScope(nameof(LeaseClient)))
+ using (Pipeline.BeginLoggingScope(nameof(BlobLeaseClient)))
{
Pipeline.LogMethodEnter(
- nameof(LeaseClient),
+ nameof(BlobLeaseClient),
message:
$"{nameof(Uri)}: {Uri}\n" +
$"{nameof(LeaseId)}: {LeaseId}\n" +
@@ -488,7 +488,7 @@ private async Task> RenewInternal(
}
finally
{
- Pipeline.LogMethodExit(nameof(LeaseClient));
+ Pipeline.LogMethodExit(nameof(BlobLeaseClient));
}
}
}
@@ -603,10 +603,10 @@ public virtual async Task> ReleaseInternal(
CancellationToken cancellationToken)
{
EnsureClient();
- using (Pipeline.BeginLoggingScope(nameof(LeaseClient)))
+ using (Pipeline.BeginLoggingScope(nameof(BlobLeaseClient)))
{
Pipeline.LogMethodEnter(
- nameof(LeaseClient),
+ nameof(BlobLeaseClient),
message:
$"{nameof(Uri)}: {Uri}\n" +
$"{nameof(LeaseId)}: {LeaseId}\n" +
@@ -661,7 +661,7 @@ await BlobRestClient.Container.ReleaseLeaseAsync(
}
finally
{
- Pipeline.LogMethodExit(nameof(LeaseClient));
+ Pipeline.LogMethodExit(nameof(BlobLeaseClient));
}
}
}
@@ -781,10 +781,10 @@ private async Task> ChangeInternal(
CancellationToken cancellationToken)
{
EnsureClient();
- using (Pipeline.BeginLoggingScope(nameof(LeaseClient)))
+ using (Pipeline.BeginLoggingScope(nameof(BlobLeaseClient)))
{
Pipeline.LogMethodEnter(
- nameof(LeaseClient),
+ nameof(BlobLeaseClient),
message:
$"{nameof(Uri)}: {Uri}\n" +
$"{nameof(LeaseId)}: {LeaseId}\n" +
@@ -838,7 +838,7 @@ private async Task> ChangeInternal(
}
finally
{
- Pipeline.LogMethodExit(nameof(LeaseClient));
+ Pipeline.LogMethodExit(nameof(BlobLeaseClient));
}
}
}
@@ -1013,10 +1013,10 @@ private async Task> BreakInternal(
{
EnsureClient();
long? serviceBreakPeriod = breakPeriod != null ? Convert.ToInt64(breakPeriod.Value.TotalSeconds) : (long?) null;
- using (Pipeline.BeginLoggingScope(nameof(LeaseClient)))
+ using (Pipeline.BeginLoggingScope(nameof(BlobLeaseClient)))
{
Pipeline.LogMethodEnter(
- nameof(LeaseClient),
+ nameof(BlobLeaseClient),
message:
$"{nameof(Uri)}: {Uri}\n" +
$"{nameof(breakPeriod)}: {breakPeriod}\n" +
@@ -1069,7 +1069,7 @@ private async Task> BreakInternal(
}
finally
{
- Pipeline.LogMethodExit(nameof(LeaseClient));
+ Pipeline.LogMethodExit(nameof(BlobLeaseClient));
}
}
}
@@ -1078,13 +1078,13 @@ private async Task> BreakInternal(
///
/// Add easy to discover methods to and
- /// for easily creating
+ /// for easily creating
/// instances.
///
public static partial class SpecializedBlobExtensions
{
///
- /// Initializes a new instance of the class.
+ /// Initializes a new instance of the class.
///
///
/// A representing the blob being leased.
@@ -1093,13 +1093,13 @@ public static partial class SpecializedBlobExtensions
/// An optional lease ID. If no lease ID is provided, a random lease
/// ID will be created.
///
- public static LeaseClient GetLeaseClient(
+ public static BlobLeaseClient GetBlobLeaseClient(
this BlobBaseClient client,
string leaseId = null) =>
- new LeaseClient(client, leaseId);
+ new BlobLeaseClient(client, leaseId);
///
- /// Initializes a new instance of the class.
+ /// Initializes a new instance of the class.
///
///
/// A representing the container
@@ -1109,9 +1109,9 @@ public static LeaseClient GetLeaseClient(
/// An optional lease ID. If no lease ID is provided, a random lease
/// ID will be created.
///
- public static LeaseClient GetLeaseClient(
+ public static BlobLeaseClient GetBlobLeaseClient(
this BlobContainerClient client,
string leaseId = null) =>
- new LeaseClient(client, leaseId);
+ new BlobLeaseClient(client, leaseId);
}
}
diff --git a/sdk/storage/Azure.Storage.Blobs/tests/BlobBaseClientTests.cs b/sdk/storage/Azure.Storage.Blobs/tests/BlobBaseClientTests.cs
index 7ed4abd35595..fdc5a3a49d30 100644
--- a/sdk/storage/Azure.Storage.Blobs/tests/BlobBaseClientTests.cs
+++ b/sdk/storage/Azure.Storage.Blobs/tests/BlobBaseClientTests.cs
@@ -849,8 +849,8 @@ public async Task AbortCopyFromUriAsync_Lease()
await destBlob.UploadAsync(stream);
}
- TimeSpan duration = LeaseClient.InfiniteLeaseDuration;
- LeaseClient lease = InstrumentClient(destBlob.GetLeaseClient(Recording.Random.NewGuid().ToString()));
+ TimeSpan duration = BlobLeaseClient.InfiniteLeaseDuration;
+ BlobLeaseClient lease = InstrumentClient(destBlob.GetBlobLeaseClient(Recording.Random.NewGuid().ToString()));
Response leaseResponse = await lease.AcquireAsync(duration);
Operation operation = await destBlob.StartCopyFromUriAsync(
@@ -1833,7 +1833,7 @@ public async Task AcquireLeaseAsync()
var duration = TimeSpan.FromSeconds(15);
// Act
- Response response = await InstrumentClient(blob.GetLeaseClient(leaseId)).AcquireAsync(duration);
+ Response response = await InstrumentClient(blob.GetBlobLeaseClient(leaseId)).AcquireAsync(duration);
// Assert
Assert.IsNotNull(response.GetRawResponse().Headers.RequestId);
@@ -1858,7 +1858,7 @@ public async Task AcquireLeaseAsync_AccessConditions()
parameters: parameters);
// Act
- Response response = await InstrumentClient(blob.GetLeaseClient(leaseId)).AcquireAsync(
+ Response response = await InstrumentClient(blob.GetBlobLeaseClient(leaseId)).AcquireAsync(
duration: duration,
conditions: accessConditions);
@@ -1886,7 +1886,7 @@ public async Task AcquireLeaseAsync_AccessConditionsFail()
// Act
await TestHelper.AssertExpectedExceptionAsync(
- InstrumentClient(blob.GetLeaseClient(leaseId)).AcquireAsync(
+ InstrumentClient(blob.GetBlobLeaseClient(leaseId)).AcquireAsync(
duration: duration,
conditions: accessConditions),
e => { });
@@ -1906,7 +1906,7 @@ public async Task AcquireLeaseAsync_Error()
// Act
await TestHelper.AssertExpectedExceptionAsync(
- InstrumentClient(blob.GetLeaseClient(leaseId)).AcquireAsync(duration),
+ InstrumentClient(blob.GetBlobLeaseClient(leaseId)).AcquireAsync(duration),
e => Assert.AreEqual("BlobNotFound", e.ErrorCode));
}
}
@@ -1922,7 +1922,7 @@ public async Task RenewLeaseAsync()
var leaseId = Recording.Random.NewGuid().ToString();
var duration = TimeSpan.FromSeconds(15);
- LeaseClient lease = InstrumentClient(blob.GetLeaseClient(leaseId));
+ BlobLeaseClient lease = InstrumentClient(blob.GetBlobLeaseClient(leaseId));
await lease.AcquireAsync(duration);
// Act
@@ -1950,7 +1950,7 @@ public async Task RenewLeaseAsync_AccessConditions()
RequestConditions accessConditions = BuildRequestConditions(
parameters: parameters);
- LeaseClient lease = InstrumentClient(blob.GetLeaseClient(leaseId));
+ BlobLeaseClient lease = InstrumentClient(blob.GetBlobLeaseClient(leaseId));
await lease.AcquireAsync(duration: duration);
// Act
@@ -1978,7 +1978,7 @@ public async Task RenewLeaseAsync_AccessConditionsFail()
parameters.NoneMatch = await SetupBlobMatchCondition(blob, parameters.NoneMatch);
RequestConditions accessConditions = BuildRequestConditions(parameters);
- LeaseClient lease = InstrumentClient(blob.GetLeaseClient(leaseId));
+ BlobLeaseClient lease = InstrumentClient(blob.GetBlobLeaseClient(leaseId));
await lease.AcquireAsync(duration: duration);
// Act
@@ -2000,7 +2000,7 @@ public async Task RenewLeaseAsync_Error()
// Act
await TestHelper.AssertExpectedExceptionAsync(
- InstrumentClient(blob.GetLeaseClient(leaseId)).ReleaseAsync(),
+ InstrumentClient(blob.GetBlobLeaseClient(leaseId)).ReleaseAsync(),
e => Assert.AreEqual("BlobNotFound", e.ErrorCode));
}
}
@@ -2016,7 +2016,7 @@ public async Task ReleaseLeaseAsync()
var leaseId = Recording.Random.NewGuid().ToString();
var duration = TimeSpan.FromSeconds(15);
- LeaseClient lease = InstrumentClient(blob.GetLeaseClient(leaseId));
+ BlobLeaseClient lease = InstrumentClient(blob.GetBlobLeaseClient(leaseId));
await lease.AcquireAsync(duration);
// Act
@@ -2044,7 +2044,7 @@ public async Task ReleaseLeaseAsync_AccessConditions()
RequestConditions accessConditions = BuildRequestConditions(
parameters: parameters);
- LeaseClient lease = InstrumentClient(blob.GetLeaseClient(leaseId));
+ BlobLeaseClient lease = InstrumentClient(blob.GetBlobLeaseClient(leaseId));
await lease.AcquireAsync(duration: duration);
// Act
@@ -2072,7 +2072,7 @@ public async Task ReleaseLeaseAsync_AccessConditionsFail()
parameters.NoneMatch = await SetupBlobMatchCondition(blob, parameters.NoneMatch);
RequestConditions accessConditions = BuildRequestConditions(parameters);
- LeaseClient lease = InstrumentClient(blob.GetLeaseClient(leaseId));
+ BlobLeaseClient lease = InstrumentClient(blob.GetBlobLeaseClient(leaseId));
await lease.AcquireAsync(duration: duration);
// Act
@@ -2094,7 +2094,7 @@ public async Task ReleaseLeaseAsync_Error()
// Act
await TestHelper.AssertExpectedExceptionAsync(
- InstrumentClient(blob.GetLeaseClient(leaseId)).RenewAsync(),
+ InstrumentClient(blob.GetBlobLeaseClient(leaseId)).RenewAsync(),
e => Assert.AreEqual("BlobNotFound", e.ErrorCode));
}
}
@@ -2110,7 +2110,7 @@ public async Task BreakLeaseAsync()
var leaseId = Recording.Random.NewGuid().ToString();
var duration = TimeSpan.FromSeconds(15);
- LeaseClient lease = InstrumentClient(blob.GetLeaseClient(leaseId));
+ BlobLeaseClient lease = InstrumentClient(blob.GetBlobLeaseClient(leaseId));
await lease.AcquireAsync(duration);
// Act
@@ -2133,7 +2133,7 @@ public async Task BreakLeaseAsync_BreakPeriod()
var duration = TimeSpan.FromSeconds(15);
TimeSpan breakPeriod = TimeSpan.FromSeconds(5);
- LeaseClient lease = InstrumentClient(blob.GetLeaseClient(leaseId));
+ BlobLeaseClient lease = InstrumentClient(blob.GetBlobLeaseClient(leaseId));
await lease.AcquireAsync(duration);
// Act
@@ -2161,7 +2161,7 @@ public async Task BreakLeaseAsync_AccessConditions()
RequestConditions accessConditions = BuildRequestConditions(
parameters: parameters);
- LeaseClient lease = InstrumentClient(blob.GetLeaseClient(leaseId));
+ BlobLeaseClient lease = InstrumentClient(blob.GetBlobLeaseClient(leaseId));
await lease.AcquireAsync(duration: duration);
// Act
@@ -2189,7 +2189,7 @@ public async Task BreakLeaseAsync_AccessConditionsFail()
parameters.NoneMatch = await SetupBlobMatchCondition(blob, parameters.NoneMatch);
RequestConditions accessConditions = BuildRequestConditions(parameters);
- LeaseClient lease = InstrumentClient(blob.GetLeaseClient(leaseId));
+ BlobLeaseClient lease = InstrumentClient(blob.GetBlobLeaseClient(leaseId));
await lease.AcquireAsync(duration: duration);
// Act
@@ -2210,7 +2210,7 @@ public async Task BreakLeaseAsync_Error()
// Act
await TestHelper.AssertExpectedExceptionAsync(
- InstrumentClient(blob.GetLeaseClient()).BreakAsync(),
+ InstrumentClient(blob.GetBlobLeaseClient()).BreakAsync(),
e => Assert.AreEqual("BlobNotFound", e.ErrorCode));
}
}
@@ -2227,7 +2227,7 @@ public async Task ChangeLeaseAsync()
var newLeaseId = Recording.Random.NewGuid().ToString();
var duration = TimeSpan.FromSeconds(15);
- LeaseClient lease = InstrumentClient(blob.GetLeaseClient(leaseId));
+ BlobLeaseClient lease = InstrumentClient(blob.GetBlobLeaseClient(leaseId));
await lease.AcquireAsync(duration);
// Act
@@ -2256,7 +2256,7 @@ public async Task ChangeLeaseAsync_AccessConditions()
RequestConditions accessConditions = BuildRequestConditions(
parameters: parameters);
- LeaseClient lease = InstrumentClient(blob.GetLeaseClient(leaseId));
+ BlobLeaseClient lease = InstrumentClient(blob.GetBlobLeaseClient(leaseId));
await lease.AcquireAsync(duration: duration);
// Act
@@ -2287,7 +2287,7 @@ public async Task ChangeLeaseAsync_AccessConditionsFail()
parameters.NoneMatch = await SetupBlobMatchCondition(blob, parameters.NoneMatch);
RequestConditions accessConditions = BuildRequestConditions(parameters);
- LeaseClient lease = InstrumentClient(blob.GetLeaseClient(leaseId));
+ BlobLeaseClient lease = InstrumentClient(blob.GetBlobLeaseClient(leaseId));
await lease.AcquireAsync(duration: duration);
// Act
@@ -2312,7 +2312,7 @@ public async Task ChangeLeaseAsync_Error()
// Act
await TestHelper.AssertExpectedExceptionAsync(
- InstrumentClient(blob.GetLeaseClient(leaseId)).ChangeAsync(proposedId: newLeaseId),
+ InstrumentClient(blob.GetBlobLeaseClient(leaseId)).ChangeAsync(proposedId: newLeaseId),
e => Assert.AreEqual("BlobNotFound", e.ErrorCode));
}
}
@@ -2344,7 +2344,7 @@ public async Task SetTierAsync_Lease()
var leaseId = Recording.Random.NewGuid().ToString();
var duration = TimeSpan.FromSeconds(15);
- await InstrumentClient(blob.GetLeaseClient(leaseId)).AcquireAsync(duration);
+ await InstrumentClient(blob.GetBlobLeaseClient(leaseId)).AcquireAsync(duration);
// Act
Response response = await blob.SetAccessTierAsync(
diff --git a/sdk/storage/Azure.Storage.Blobs/tests/BlobTestBase.cs b/sdk/storage/Azure.Storage.Blobs/tests/BlobTestBase.cs
index 7caf59f932d7..2f2dcb70e4e6 100644
--- a/sdk/storage/Azure.Storage.Blobs/tests/BlobTestBase.cs
+++ b/sdk/storage/Azure.Storage.Blobs/tests/BlobTestBase.cs
@@ -400,7 +400,7 @@ public async Task SetupBlobLeaseCondition(BlobBaseClient blob, string le
BlobLease lease = null;
if (leaseId == ReceivedLeaseId || leaseId == garbageLeaseId)
{
- lease = await InstrumentClient(blob.GetLeaseClient(Recording.Random.NewGuid().ToString())).AcquireAsync(LeaseClient.InfiniteLeaseDuration);
+ lease = await InstrumentClient(blob.GetBlobLeaseClient(Recording.Random.NewGuid().ToString())).AcquireAsync(BlobLeaseClient.InfiniteLeaseDuration);
}
return leaseId == ReceivedLeaseId ? lease.LeaseId : leaseId;
}
@@ -411,7 +411,7 @@ public async Task SetupContainerLeaseCondition(BlobContainerClient conta
BlobLease lease = null;
if (leaseId == ReceivedLeaseId || leaseId == garbageLeaseId)
{
- lease = await InstrumentClient(container.GetLeaseClient(Recording.Random.NewGuid().ToString())).AcquireAsync(LeaseClient.InfiniteLeaseDuration);
+ lease = await InstrumentClient(container.GetBlobLeaseClient(Recording.Random.NewGuid().ToString())).AcquireAsync(BlobLeaseClient.InfiniteLeaseDuration);
}
return leaseId == ReceivedLeaseId ? lease.LeaseId : leaseId;
}
diff --git a/sdk/storage/Azure.Storage.Blobs/tests/ContainerClientTests.cs b/sdk/storage/Azure.Storage.Blobs/tests/ContainerClientTests.cs
index ff8a8ef76171..e03cde60272b 100644
--- a/sdk/storage/Azure.Storage.Blobs/tests/ContainerClientTests.cs
+++ b/sdk/storage/Azure.Storage.Blobs/tests/ContainerClientTests.cs
@@ -665,7 +665,7 @@ public async Task AcquireLeaseAsync()
var duration = TimeSpan.FromSeconds(15);
// Act
- Response response = await InstrumentClient(container.GetLeaseClient(id)).AcquireAsync(duration: duration);
+ Response response = await InstrumentClient(container.GetBlobLeaseClient(id)).AcquireAsync(duration: duration);
// Assert
Assert.AreEqual(id, response.Value.LeaseId);
@@ -685,7 +685,7 @@ public async Task AcquireLeaseAsync_ErrorDurationTooLarge()
// Assert
await TestHelper.AssertExpectedExceptionAsync(
- InstrumentClient(container.GetLeaseClient(id)).AcquireAsync(duration: duration),
+ InstrumentClient(container.GetBlobLeaseClient(id)).AcquireAsync(duration: duration),
e => StringAssert.Contains("InvalidHeaderValue", e.ErrorCode));
}
@@ -700,7 +700,7 @@ public async Task AcquireLeaseAsync_Error()
// Act
await TestHelper.AssertExpectedExceptionAsync(
- InstrumentClient(container.GetLeaseClient(id)).AcquireAsync(duration: duration),
+ InstrumentClient(container.GetBlobLeaseClient(id)).AcquireAsync(duration: duration),
e => Assert.AreEqual("ContainerNotFound", e.ErrorCode.Split('\n')[0]));
}
@@ -722,7 +722,7 @@ public async Task AcquireLeaseAsync_AccessConditions()
var duration = TimeSpan.FromSeconds(15);
// Act
- Response response = await InstrumentClient(container.GetLeaseClient(id)).AcquireAsync(
+ Response response = await InstrumentClient(container.GetBlobLeaseClient(id)).AcquireAsync(
duration: duration,
conditions: accessConditions);
@@ -752,7 +752,7 @@ public async Task AcquireLeaseAsync_AccessConditionsFail()
// Act
await TestHelper.AssertExpectedExceptionAsync(
- InstrumentClient(container.GetLeaseClient(id)).AcquireAsync(
+ InstrumentClient(container.GetBlobLeaseClient(id)).AcquireAsync(
duration: duration,
conditions: accessConditions),
e => { });
@@ -771,11 +771,11 @@ public async Task RenewLeaseAsync()
var id = Recording.Random.NewGuid().ToString();
var duration = TimeSpan.FromSeconds(15);
- Response leaseResponse = await InstrumentClient(container.GetLeaseClient(id)).AcquireAsync(
+ Response leaseResponse = await InstrumentClient(container.GetBlobLeaseClient(id)).AcquireAsync(
duration: duration);
// Act
- Response renewResponse = await InstrumentClient(container.GetLeaseClient(leaseResponse.Value.LeaseId)).RenewAsync();
+ Response renewResponse = await InstrumentClient(container.GetBlobLeaseClient(leaseResponse.Value.LeaseId)).RenewAsync();
// Assert
Assert.IsNotNull(renewResponse.GetRawResponse().Headers.RequestId);
@@ -794,7 +794,7 @@ public async Task RenewLeaseAsync_Error()
// Act
await TestHelper.AssertExpectedExceptionAsync(
- InstrumentClient(container.GetLeaseClient(id)).ReleaseAsync(),
+ InstrumentClient(container.GetBlobLeaseClient(id)).ReleaseAsync(),
e => Assert.AreEqual("ContainerNotFound", e.ErrorCode.Split('\n')[0]));
}
@@ -814,7 +814,7 @@ public async Task RenewLeaseAsync_AccessConditions()
var id = Recording.Random.NewGuid().ToString();
var duration = TimeSpan.FromSeconds(15);
- LeaseClient lease = InstrumentClient(container.GetLeaseClient(id));
+ BlobLeaseClient lease = InstrumentClient(container.GetBlobLeaseClient(id));
_ = await lease.AcquireAsync(duration: duration);
// Act
@@ -845,7 +845,7 @@ public async Task RenewLeaseAsync_AccessConditionsFail()
var id = Recording.Random.NewGuid().ToString();
var duration = TimeSpan.FromSeconds(15);
- LeaseClient lease = InstrumentClient(container.GetLeaseClient(id));
+ BlobLeaseClient lease = InstrumentClient(container.GetBlobLeaseClient(id));
Response aquireLeaseResponse = await lease.AcquireAsync(duration: duration);
// Act
@@ -866,10 +866,10 @@ public async Task ReleaseLeaseAsync()
// Arrange
var id = Recording.Random.NewGuid().ToString();
var duration = TimeSpan.FromSeconds(15);
- Response leaseResponse = await InstrumentClient(container.GetLeaseClient(id)).AcquireAsync(duration);
+ Response leaseResponse = await InstrumentClient(container.GetBlobLeaseClient(id)).AcquireAsync(duration);
// Act
- Response releaseResponse = await InstrumentClient(container.GetLeaseClient(leaseResponse.Value.LeaseId)).ReleaseAsync();
+ Response releaseResponse = await InstrumentClient(container.GetBlobLeaseClient(leaseResponse.Value.LeaseId)).ReleaseAsync();
// Assert
Response response = await container.GetPropertiesAsync();
@@ -889,7 +889,7 @@ public async Task ReleaseLeaseAsync_Error()
// Act
await TestHelper.AssertExpectedExceptionAsync(
- InstrumentClient(container.GetLeaseClient(id)).ReleaseAsync(),
+ InstrumentClient(container.GetBlobLeaseClient(id)).ReleaseAsync(),
e => Assert.AreEqual("ContainerNotFound", e.ErrorCode.Split('\n')[0]));
}
@@ -909,7 +909,7 @@ public async Task ReleaseLeaseAsync_AccessConditions()
var id = Recording.Random.NewGuid().ToString();
var duration = TimeSpan.FromSeconds(15);
- LeaseClient lease = InstrumentClient(container.GetLeaseClient(id));
+ BlobLeaseClient lease = InstrumentClient(container.GetBlobLeaseClient(id));
Response aquireLeaseResponse = await lease.AcquireAsync(duration: duration);
// Act
@@ -938,7 +938,7 @@ public async Task ReleaseLeaseAsync_AccessConditionsFail()
var id = Recording.Random.NewGuid().ToString();
var duration = TimeSpan.FromSeconds(15);
- LeaseClient lease = InstrumentClient(container.GetLeaseClient(id));
+ BlobLeaseClient lease = InstrumentClient(container.GetBlobLeaseClient(id));
Response aquireLeaseResponse = await lease.AcquireAsync(duration: duration);
// Act
@@ -959,11 +959,11 @@ public async Task BreakLeaseAsync()
// Arrange
var id = Recording.Random.NewGuid().ToString();
var duration = TimeSpan.FromSeconds(15);
- await InstrumentClient(container.GetLeaseClient(id)).AcquireAsync(duration);
+ await InstrumentClient(container.GetBlobLeaseClient(id)).AcquireAsync(duration);
TimeSpan breakPeriod = TimeSpan.FromSeconds(0);
// Act
- Response breakResponse = await InstrumentClient(container.GetLeaseClient()).BreakAsync(breakPeriod);
+ Response breakResponse = await InstrumentClient(container.GetBlobLeaseClient()).BreakAsync(breakPeriod);
// Assert
Response response = await container.GetPropertiesAsync();
@@ -982,7 +982,7 @@ public async Task BreakLeaseAsync_Error()
// Act
await TestHelper.AssertExpectedExceptionAsync(
- InstrumentClient(container.GetLeaseClient()).BreakAsync(),
+ InstrumentClient(container.GetBlobLeaseClient()).BreakAsync(),
e => Assert.AreEqual("ContainerNotFound", e.ErrorCode.Split('\n')[0]));
}
@@ -1004,10 +1004,10 @@ public async Task BreakLeaseAsync_AccessConditions()
var id = Recording.Random.NewGuid().ToString();
var duration = TimeSpan.FromSeconds(15);
- Response aquireLeaseResponse = await InstrumentClient(container.GetLeaseClient(id)).AcquireAsync(duration: duration);
+ Response aquireLeaseResponse = await InstrumentClient(container.GetBlobLeaseClient(id)).AcquireAsync(duration: duration);
// Act
- Response response = await InstrumentClient(container.GetLeaseClient()).BreakAsync(
+ Response response = await InstrumentClient(container.GetBlobLeaseClient()).BreakAsync(
conditions: accessConditions);
// Assert
@@ -1035,11 +1035,11 @@ public async Task BreakLeaseAsync_AccessConditionsFail()
var id = Recording.Random.NewGuid().ToString();
var duration = TimeSpan.FromSeconds(15);
- Response aquireLeaseResponse = await InstrumentClient(container.GetLeaseClient(id)).AcquireAsync(duration: duration);
+ Response aquireLeaseResponse = await InstrumentClient(container.GetBlobLeaseClient(id)).AcquireAsync(duration: duration);
// Act
await TestHelper.AssertExpectedExceptionAsync(
- InstrumentClient(container.GetLeaseClient()).BreakAsync(
+ InstrumentClient(container.GetBlobLeaseClient()).BreakAsync(
conditions: accessConditions),
e => { });
@@ -1056,17 +1056,17 @@ public async Task ChangeLeaseAsync()
// Arrange
var id = Recording.Random.NewGuid().ToString();
var duration = TimeSpan.FromSeconds(15);
- Response leaseResponse = await InstrumentClient(container.GetLeaseClient(id)).AcquireAsync(duration);
+ Response leaseResponse = await InstrumentClient(container.GetBlobLeaseClient(id)).AcquireAsync(duration);
var newId = Recording.Random.NewGuid().ToString();
// Act
- Response changeResponse = await InstrumentClient(container.GetLeaseClient(id)).ChangeAsync(newId);
+ Response changeResponse = await InstrumentClient(container.GetBlobLeaseClient(id)).ChangeAsync(newId);
// Assert
Assert.AreEqual(newId, changeResponse.Value.LeaseId);
// Cleanup
- await InstrumentClient(container.GetLeaseClient(changeResponse.Value.LeaseId)).ReleaseAsync();
+ await InstrumentClient(container.GetBlobLeaseClient(changeResponse.Value.LeaseId)).ReleaseAsync();
}
}
@@ -1080,7 +1080,7 @@ public async Task ChangeLeaseAsync_Error()
// Act
await TestHelper.AssertExpectedExceptionAsync(
- InstrumentClient(container.GetLeaseClient(id)).ChangeAsync(id),
+ InstrumentClient(container.GetBlobLeaseClient(id)).ChangeAsync(id),
e => Assert.AreEqual("ContainerNotFound", e.ErrorCode.Split('\n')[0]));
}
@@ -1103,10 +1103,10 @@ public async Task ChangeLeaseAsync_AccessConditions()
var newId = Recording.Random.NewGuid().ToString();
var duration = TimeSpan.FromSeconds(15);
- Response aquireLeaseResponse = await InstrumentClient(container.GetLeaseClient(id)).AcquireAsync(duration: duration);
+ Response aquireLeaseResponse = await InstrumentClient(container.GetBlobLeaseClient(id)).AcquireAsync(duration: duration);
// Act
- Response response = await InstrumentClient(container.GetLeaseClient(aquireLeaseResponse.Value.LeaseId)).ChangeAsync(
+ Response response = await InstrumentClient(container.GetBlobLeaseClient(aquireLeaseResponse.Value.LeaseId)).ChangeAsync(
proposedId: newId,
conditions: accessConditions);
@@ -1136,11 +1136,11 @@ public async Task ChangeLeaseAsync_AccessConditionsFail()
var newId = Recording.Random.NewGuid().ToString();
var duration = TimeSpan.FromSeconds(15);
- Response aquireLeaseResponse = await InstrumentClient(container.GetLeaseClient(id)).AcquireAsync(duration: duration);
+ Response aquireLeaseResponse = await InstrumentClient(container.GetBlobLeaseClient(id)).AcquireAsync(duration: duration);
// Act
await TestHelper.AssertExpectedExceptionAsync(
- InstrumentClient(container.GetLeaseClient(aquireLeaseResponse.Value.LeaseId)).ChangeAsync(
+ InstrumentClient(container.GetBlobLeaseClient(aquireLeaseResponse.Value.LeaseId)).ChangeAsync(
proposedId: newId,
conditions: accessConditions),
e => { });
diff --git a/sdk/storage/Azure.Storage.Common/src/Constants.cs b/sdk/storage/Azure.Storage.Common/src/Constants.cs
index 7ec29320005a..e535c7113b64 100644
--- a/sdk/storage/Azure.Storage.Common/src/Constants.cs
+++ b/sdk/storage/Azure.Storage.Common/src/Constants.cs
@@ -224,15 +224,15 @@ internal static class Lease
/// The Azure Storage Operation Names for Blob Lease Client.
///
public const string AcquireOperationName =
- "Azure.Storage.Blobs.Specialized.LeaseClient.Acquire";
+ "Azure.Storage.Blobs.Specialized.BlobLeaseClient.Acquire";
public const string RenewOperationName =
- "Azure.Storage.Blobs.Specialized.LeaseClient.Renew";
+ "Azure.Storage.Blobs.Specialized.BlobLeaseClient.Renew";
public const string ReleaseOperationName =
- "Azure.Storage.Blobs.Specialized.LeaseClient.Release";
+ "Azure.Storage.Blobs.Specialized.BlobLeaseClient.Release";
public const string ChangeOperationName =
- "Azure.Storage.Blobs.Specialized.LeaseClient.Change";
+ "Azure.Storage.Blobs.Specialized.BlobLeaseClient.Change";
public const string BreakOperationName =
- "Azure.Storage.Blobs.Specialized.LeaseClient.Break";
+ "Azure.Storage.Blobs.Specialized.BlobLeaseClient.Break";
}
internal static class Page
diff --git a/sdk/storage/Azure.Storage.Common/tests/UtilityTests.cs b/sdk/storage/Azure.Storage.Common/tests/UtilityTests.cs
index b9b087516e60..1b2f4d138c58 100644
--- a/sdk/storage/Azure.Storage.Common/tests/UtilityTests.cs
+++ b/sdk/storage/Azure.Storage.Common/tests/UtilityTests.cs
@@ -53,7 +53,7 @@ public async Task CollectGarbage_Explicit()
catch (RequestFailedException ex) when (ex.ErrorCode == BlobErrorCode.LeaseIdMissing)
{
// Break any lingering leases
- await blobs.GetBlobContainerClient(container.Name).GetLeaseClient().BreakAsync();
+ await blobs.GetBlobContainerClient(container.Name).GetBlobLeaseClient().BreakAsync();
}
catch (RequestFailedException ex) when (ex.ErrorCode == BlobErrorCode.ContainerBeingDeleted)
{