Skip to content

Commit d7439d8

Browse files
seanmcc-msftannelo-msft
authored andcommitted
Added support for AccountInfo.IsHierarchicalNamespaceEnabled (Azure#17285)
1 parent 8dd8de7 commit d7439d8

File tree

9 files changed

+227
-1
lines changed

9 files changed

+227
-1
lines changed

sdk/storage/Azure.Storage.Blobs/CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
## 12.8.0-beta.1 (Unreleased)
44
- Fixed bug where BlobContainerClient.GetBlobClient(), BlobContainerClient.GetParentServiceClient(), BlobServiceClient.GetBlobContainerClient(), BlobBaseClient.WithClientSideEncryptionOptions(), BlobBaseClient.GetParentBlobContainerClient(), BlobBaseClient.WithSnapshot() and BlobBaseClient.WithVersion() created clients that could not generate a SAS from clients that could generate a SAS
5+
- Added IsHierarchicalNamespaceEnabled to AccountInfo.
56

67
## 12.7.0 (2020-11-10)
78
- Includes all features from 12.7.0-preview.1

sdk/storage/Azure.Storage.Blobs/api/Azure.Storage.Blobs.netstandard2.0.cs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -209,6 +209,7 @@ public partial class AccountInfo
209209
{
210210
internal AccountInfo() { }
211211
public Azure.Storage.Blobs.Models.AccountKind AccountKind { get { throw null; } }
212+
public bool IsHierarchicalNamespaceEnabled { get { throw null; } }
212213
public Azure.Storage.Blobs.Models.SkuName SkuName { get { throw null; } }
213214
}
214215
public enum AccountKind
@@ -827,7 +828,9 @@ public BlobSignedIdentifier() { }
827828
}
828829
public static partial class BlobsModelFactory
829830
{
831+
[System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)]
830832
public static Azure.Storage.Blobs.Models.AccountInfo AccountInfo(Azure.Storage.Blobs.Models.SkuName skuName, Azure.Storage.Blobs.Models.AccountKind accountKind) { throw null; }
833+
public static Azure.Storage.Blobs.Models.AccountInfo AccountInfo(Azure.Storage.Blobs.Models.SkuName skuName, Azure.Storage.Blobs.Models.AccountKind accountKind, bool isHierarchicalNamespaceEnabled) { throw null; }
831834
[System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)]
832835
public static Azure.Storage.Blobs.Models.BlobAppendInfo BlobAppendInfo(Azure.ETag eTag, System.DateTimeOffset lastModified, byte[] contentHash, byte[] contentCrc64, string blobAppendOffset, int blobCommittedBlockCount, bool isServerEncrypted, string encryptionKeySha256) { throw null; }
833836
public static Azure.Storage.Blobs.Models.BlobAppendInfo BlobAppendInfo(Azure.ETag eTag, System.DateTimeOffset lastModified, byte[] contentHash, byte[] contentCrc64, string blobAppendOffset, int blobCommittedBlockCount, bool isServerEncrypted, string encryptionKeySha256, string encryptionScope) { throw null; }

sdk/storage/Azure.Storage.Blobs/src/Generated/BlobRestClient.cs

Lines changed: 12 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

sdk/storage/Azure.Storage.Blobs/src/Models/BlobsModelFactory.cs

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1002,5 +1002,20 @@ public static BlobContainerProperties BlobContainerProperties(
10021002
Metadata = metadata,
10031003
HasImmutabilityPolicy = hasImmutabilityPolicy,
10041004
};
1005+
1006+
/// <summary>
1007+
/// Creates a new AccountInfo instance for mocking.
1008+
/// </summary>
1009+
[EditorBrowsable(EditorBrowsableState.Never)]
1010+
public static AccountInfo AccountInfo(
1011+
Azure.Storage.Blobs.Models.SkuName skuName,
1012+
Azure.Storage.Blobs.Models.AccountKind accountKind)
1013+
{
1014+
return new AccountInfo()
1015+
{
1016+
SkuName = skuName,
1017+
AccountKind = accountKind,
1018+
};
1019+
}
10051020
}
10061021
}

sdk/storage/Azure.Storage.Blobs/tests/ServiceClientTests.cs

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -322,6 +322,34 @@ public async Task GetAccountInfoAsync()
322322
Assert.IsNotNull(response.GetRawResponse().Headers.RequestId);
323323
}
324324

325+
[Test]
326+
[ServiceVersion(Min = BlobClientOptions.ServiceVersion.V2019_07_07)]
327+
public async Task GetAccountInfoAsync_HnsFalse()
328+
{
329+
// Arrange
330+
BlobServiceClient service = GetServiceClient_SharedKey();
331+
332+
// Act
333+
Response<AccountInfo> response = await service.GetAccountInfoAsync();
334+
335+
// Assert
336+
Assert.IsFalse(response.Value.IsHierarchicalNamespaceEnabled);
337+
}
338+
339+
[Test]
340+
[ServiceVersion(Min = BlobClientOptions.ServiceVersion.V2019_07_07)]
341+
public async Task GetAccountInfoAsync_HnsTrue()
342+
{
343+
// Arrange
344+
BlobServiceClient service = GetServiceClient_Hns();
345+
346+
// Act
347+
Response<AccountInfo> response = await service.GetAccountInfoAsync();
348+
349+
// Assert
350+
Assert.IsTrue(response.Value.IsHierarchicalNamespaceEnabled);
351+
}
352+
325353
[Test]
326354
public async Task GetAccountInfoAsync_Error()
327355
{

sdk/storage/Azure.Storage.Blobs/tests/SessionRecords/ServiceClientTests/GetAccountInfoAsync_HnsFalse.json

Lines changed: 43 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

sdk/storage/Azure.Storage.Blobs/tests/SessionRecords/ServiceClientTests/GetAccountInfoAsync_HnsFalseAsync.json

Lines changed: 43 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

sdk/storage/Azure.Storage.Blobs/tests/SessionRecords/ServiceClientTests/GetAccountInfoAsync_HnsTrue.json

Lines changed: 41 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

sdk/storage/Azure.Storage.Blobs/tests/SessionRecords/ServiceClientTests/GetAccountInfoAsync_HnsTrueAsync.json

Lines changed: 41 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)