diff --git a/sdk/storage/Azure.Storage.Blobs.Batch/samples/Azure.Storage.Blobs.Batch.Samples.Tests.csproj b/sdk/storage/Azure.Storage.Blobs.Batch/samples/Azure.Storage.Blobs.Batch.Samples.Tests.csproj
index 5aca3c8837ea..5f75cd0d48e8 100644
--- a/sdk/storage/Azure.Storage.Blobs.Batch/samples/Azure.Storage.Blobs.Batch.Samples.Tests.csproj
+++ b/sdk/storage/Azure.Storage.Blobs.Batch/samples/Azure.Storage.Blobs.Batch.Samples.Tests.csproj
@@ -15,6 +15,7 @@
+
PreserveNewest
diff --git a/sdk/storage/Azure.Storage.Blobs.Batch/tests/Azure.Storage.Blobs.Batch.Tests.csproj b/sdk/storage/Azure.Storage.Blobs.Batch/tests/Azure.Storage.Blobs.Batch.Tests.csproj
index 751ae2384a9c..ff3aeebf5c21 100644
--- a/sdk/storage/Azure.Storage.Blobs.Batch/tests/Azure.Storage.Blobs.Batch.Tests.csproj
+++ b/sdk/storage/Azure.Storage.Blobs.Batch/tests/Azure.Storage.Blobs.Batch.Tests.csproj
@@ -16,6 +16,7 @@
+
PreserveNewest
@@ -30,6 +31,7 @@
+
diff --git a/sdk/storage/Azure.Storage.Blobs.ChangeFeed/samples/Azure.Storage.Blobs.ChangeFeed.Samples.Tests.csproj b/sdk/storage/Azure.Storage.Blobs.ChangeFeed/samples/Azure.Storage.Blobs.ChangeFeed.Samples.Tests.csproj
index 7cb6bc1417c9..ccde08f6734e 100644
--- a/sdk/storage/Azure.Storage.Blobs.ChangeFeed/samples/Azure.Storage.Blobs.ChangeFeed.Samples.Tests.csproj
+++ b/sdk/storage/Azure.Storage.Blobs.ChangeFeed/samples/Azure.Storage.Blobs.ChangeFeed.Samples.Tests.csproj
@@ -13,6 +13,7 @@
+
PreserveNewest
@@ -30,5 +31,6 @@
+
diff --git a/sdk/storage/Azure.Storage.Blobs.ChangeFeed/src/LazyLoadingBlobStream.cs b/sdk/storage/Azure.Storage.Blobs.ChangeFeed/src/LazyLoadingBlobStream.cs
index bf7776b2e660..34925a226fbc 100644
--- a/sdk/storage/Azure.Storage.Blobs.ChangeFeed/src/LazyLoadingBlobStream.cs
+++ b/sdk/storage/Azure.Storage.Blobs.ChangeFeed/src/LazyLoadingBlobStream.cs
@@ -105,8 +105,18 @@ private async Task DownloadBlock(bool async, CancellationToken cancellationToken
HttpRange range = new HttpRange(_offset, _blockSize);
response = async
- ? await _blobClient.DownloadStreamingAsync(range, cancellationToken: cancellationToken).ConfigureAwait(false)
- : _blobClient.DownloadStreaming(range, cancellationToken: cancellationToken);
+ ? await _blobClient.DownloadStreamingAsync(
+ new BlobDownloadOptions
+ {
+ Range = range
+ },
+ cancellationToken: cancellationToken).ConfigureAwait(false)
+ : _blobClient.DownloadStreaming(
+ new BlobDownloadOptions
+ {
+ Range = range
+ },
+ cancellationToken: cancellationToken);
_stream = response.Value.Content;
_offset += response.Value.Details.ContentLength;
_lastDownloadBytes = response.Value.Details.ContentLength;
diff --git a/sdk/storage/Azure.Storage.Blobs.ChangeFeed/tests/Azure.Storage.Blobs.ChangeFeed.Tests.csproj b/sdk/storage/Azure.Storage.Blobs.ChangeFeed/tests/Azure.Storage.Blobs.ChangeFeed.Tests.csproj
index 80a7d7c7c8cb..7bdc4ced7d27 100644
--- a/sdk/storage/Azure.Storage.Blobs.ChangeFeed/tests/Azure.Storage.Blobs.ChangeFeed.Tests.csproj
+++ b/sdk/storage/Azure.Storage.Blobs.ChangeFeed/tests/Azure.Storage.Blobs.ChangeFeed.Tests.csproj
@@ -14,6 +14,7 @@
+
PreserveNewest
diff --git a/sdk/storage/Azure.Storage.Blobs.ChangeFeed/tests/ChangeFeedFactoryTests.cs b/sdk/storage/Azure.Storage.Blobs.ChangeFeed/tests/ChangeFeedFactoryTests.cs
index ece1aa25c3bc..837b71bd06c4 100644
--- a/sdk/storage/Azure.Storage.Blobs.ChangeFeed/tests/ChangeFeedFactoryTests.cs
+++ b/sdk/storage/Azure.Storage.Blobs.ChangeFeed/tests/ChangeFeedFactoryTests.cs
@@ -99,18 +99,12 @@ public async Task ChangeFeedEnabledNoMetaSegmentsBlob()
if (IsAsync)
{
blobClient.Setup(r => r.DownloadStreamingAsync(
- default,
- default,
- default,
default,
CancellationToken.None)).ThrowsAsync(ex);
}
else
{
blobClient.Setup(r => r.DownloadStreaming(
- default,
- default,
- default,
default,
CancellationToken.None)).Throws(ex);
}
@@ -140,18 +134,12 @@ public async Task ChangeFeedEnabledNoMetaSegmentsBlob()
if (IsAsync)
{
blobClient.Verify(r => r.DownloadStreamingAsync(
- default,
- default,
- default,
default,
CancellationToken.None));
}
else
{
blobClient.Verify(r => r.DownloadStreaming(
- default,
- default,
- default,
default,
CancellationToken.None));
}
diff --git a/sdk/storage/Azure.Storage.Blobs.ChangeFeed/tests/ChangeFeedTests.cs b/sdk/storage/Azure.Storage.Blobs.ChangeFeed/tests/ChangeFeedTests.cs
index ae75b4bd0dde..bc415c2f5aa3 100644
--- a/sdk/storage/Azure.Storage.Blobs.ChangeFeed/tests/ChangeFeedTests.cs
+++ b/sdk/storage/Azure.Storage.Blobs.ChangeFeed/tests/ChangeFeedTests.cs
@@ -61,11 +61,11 @@ public async Task GetCursor()
if (IsAsync)
{
- blobClient.Setup(r => r.DownloadStreamingAsync(default, default, default, default, default)).ReturnsAsync(downloadResponse);
+ blobClient.Setup(r => r.DownloadStreamingAsync(default, default)).ReturnsAsync(downloadResponse);
}
else
{
- blobClient.Setup(r => r.DownloadStreaming(default, default, default, default, default)).Returns(downloadResponse);
+ blobClient.Setup(r => r.DownloadStreaming(default, default)).Returns(downloadResponse);
}
if (IsAsync)
@@ -191,11 +191,11 @@ public async Task GetCursor()
if (IsAsync)
{
- blobClient.Verify(r => r.DownloadStreamingAsync(default, default, default, default, default));
+ blobClient.Verify(r => r.DownloadStreamingAsync(default, default));
}
else
{
- blobClient.Verify(r => r.DownloadStreaming(default, default, default, default, default));
+ blobClient.Verify(r => r.DownloadStreaming(default, default));
}
if (IsAsync)
@@ -298,11 +298,11 @@ public async Task GetPage()
if (IsAsync)
{
- blobClient.Setup(r => r.DownloadStreamingAsync(default, default, default, default, default)).ReturnsAsync(downloadResponse);
+ blobClient.Setup(r => r.DownloadStreamingAsync(default, default)).ReturnsAsync(downloadResponse);
}
else
{
- blobClient.Setup(r => r.DownloadStreaming(default, default, default, default, default)).Returns(downloadResponse);
+ blobClient.Setup(r => r.DownloadStreaming(default, default)).Returns(downloadResponse);
}
if (IsAsync)
@@ -508,11 +508,11 @@ public async Task GetPage()
if (IsAsync)
{
- blobClient.Verify(r => r.DownloadStreamingAsync(default, default, default, default, default));
+ blobClient.Verify(r => r.DownloadStreamingAsync(default, default));
}
else
{
- blobClient.Verify(r => r.DownloadStreaming(default, default, default, default, default));
+ blobClient.Verify(r => r.DownloadStreaming(default, default));
}
if (IsAsync)
@@ -636,11 +636,11 @@ public async Task NoYearsAfterStartTime()
if (IsAsync)
{
- blobClient.Setup(r => r.DownloadStreamingAsync(default, default, default, default, default)).ReturnsAsync(downloadResponse);
+ blobClient.Setup(r => r.DownloadStreamingAsync(default, default)).ReturnsAsync(downloadResponse);
}
else
{
- blobClient.Setup(r => r.DownloadStreaming(default, default, default, default, default)).Returns(downloadResponse);
+ blobClient.Setup(r => r.DownloadStreaming(default, default)).Returns(downloadResponse);
}
if (IsAsync)
@@ -696,11 +696,11 @@ public async Task NoYearsAfterStartTime()
if (IsAsync)
{
- blobClient.Verify(r => r.DownloadStreamingAsync(default, default, default, default, default));
+ blobClient.Verify(r => r.DownloadStreamingAsync(default, default));
}
else
{
- blobClient.Verify(r => r.DownloadStreaming(default, default, default, default, default));
+ blobClient.Verify(r => r.DownloadStreaming(default, default));
}
if (IsAsync)
@@ -765,11 +765,11 @@ public async Task NoSegmentsRemainingInStartYear()
if (IsAsync)
{
- blobClient.Setup(r => r.DownloadStreamingAsync(default, default, default, default, default)).ReturnsAsync(downloadResponse);
+ blobClient.Setup(r => r.DownloadStreamingAsync(default, default)).ReturnsAsync(downloadResponse);
}
else
{
- blobClient.Setup(r => r.DownloadStreaming(default, default, default, default, default)).Returns(downloadResponse);
+ blobClient.Setup(r => r.DownloadStreaming(default, default)).Returns(downloadResponse);
}
if (IsAsync)
@@ -904,11 +904,11 @@ public async Task NoSegmentsRemainingInStartYear()
if (IsAsync)
{
- blobClient.Verify(r => r.DownloadStreamingAsync(default, default, default, default, default));
+ blobClient.Verify(r => r.DownloadStreamingAsync(default, default));
}
else
{
- blobClient.Verify(r => r.DownloadStreaming(default, default, default, default, default));
+ blobClient.Verify(r => r.DownloadStreaming(default, default));
}
if (IsAsync)
diff --git a/sdk/storage/Azure.Storage.Blobs.ChangeFeed/tests/SegmentFactoryTests.cs b/sdk/storage/Azure.Storage.Blobs.ChangeFeed/tests/SegmentFactoryTests.cs
index 69ed2c25966f..be1b45bb57c9 100644
--- a/sdk/storage/Azure.Storage.Blobs.ChangeFeed/tests/SegmentFactoryTests.cs
+++ b/sdk/storage/Azure.Storage.Blobs.ChangeFeed/tests/SegmentFactoryTests.cs
@@ -61,11 +61,11 @@ public async Task BuildSegment_SegmentCursorNullCurrentShardPath()
if (IsAsync)
{
- blobClient.Setup(r => r.DownloadStreamingAsync(default, default, default, default, default)).ReturnsAsync(downloadResponse);
+ blobClient.Setup(r => r.DownloadStreamingAsync(default, default)).ReturnsAsync(downloadResponse);
}
else
{
- blobClient.Setup(r => r.DownloadStreaming(default, default, default, default, default)).Returns(downloadResponse);
+ blobClient.Setup(r => r.DownloadStreaming(default, default)).Returns(downloadResponse);
}
shardFactory.SetupSequence(r => r.BuildShard(
@@ -110,11 +110,11 @@ public async Task BuildSegment_SegmentCursorNullCurrentShardPath()
if (IsAsync)
{
- blobClient.Verify(r => r.DownloadStreamingAsync(default, default, default, default, default));
+ blobClient.Verify(r => r.DownloadStreamingAsync(default, default));
}
else
{
- blobClient.Verify(r => r.DownloadStreaming(default, default, default, default, default));
+ blobClient.Verify(r => r.DownloadStreaming(default, default));
}
}
}
diff --git a/sdk/storage/Azure.Storage.Blobs.ChangeFeed/tests/SegmentTests.cs b/sdk/storage/Azure.Storage.Blobs.ChangeFeed/tests/SegmentTests.cs
index db350a343aa9..d8d607fd5ceb 100644
--- a/sdk/storage/Azure.Storage.Blobs.ChangeFeed/tests/SegmentTests.cs
+++ b/sdk/storage/Azure.Storage.Blobs.ChangeFeed/tests/SegmentTests.cs
@@ -66,11 +66,11 @@ public async Task GetCursor()
if (IsAsync)
{
- blobClient.Setup(r => r.DownloadStreamingAsync(default, default, default, default, default)).ReturnsAsync(downloadResponse);
+ blobClient.Setup(r => r.DownloadStreamingAsync(default, default)).ReturnsAsync(downloadResponse);
}
else
{
- blobClient.Setup(r => r.DownloadStreaming(default, default, default, default, default)).Returns(downloadResponse);
+ blobClient.Setup(r => r.DownloadStreaming(default, default)).Returns(downloadResponse);
}
shardFactory.SetupSequence(r => r.BuildShard(
@@ -114,11 +114,11 @@ public async Task GetCursor()
if (IsAsync)
{
- blobClient.Verify(r => r.DownloadStreamingAsync(default, default, default, default, default));
+ blobClient.Verify(r => r.DownloadStreamingAsync(default, default));
}
else
{
- blobClient.Verify(r => r.DownloadStreaming(default, default, default, default, default));
+ blobClient.Verify(r => r.DownloadStreaming(default, default));
}
for (int i = 0; i < shards.Count; i++)
@@ -153,11 +153,11 @@ public async Task GetCursor_NoShards()
if (IsAsync)
{
- blobClient.Setup(r => r.DownloadStreamingAsync(default, default, default, default, default)).ReturnsAsync(downloadResponse);
+ blobClient.Setup(r => r.DownloadStreamingAsync(default, default)).ReturnsAsync(downloadResponse);
}
else
{
- blobClient.Setup(r => r.DownloadStreaming(default, default, default, default, default)).Returns(downloadResponse);
+ blobClient.Setup(r => r.DownloadStreaming(default, default)).Returns(downloadResponse);
}
SegmentFactory segmentFactory = new SegmentFactory(
@@ -179,11 +179,11 @@ public async Task GetCursor_NoShards()
if (IsAsync)
{
- blobClient.Verify(r => r.DownloadStreamingAsync(default, default, default, default, default));
+ blobClient.Verify(r => r.DownloadStreamingAsync(default, default));
}
else
{
- blobClient.Verify(r => r.DownloadStreaming(default, default, default, default, default));
+ blobClient.Verify(r => r.DownloadStreaming(default, default));
}
}
@@ -227,11 +227,11 @@ public async Task GetPage()
if (IsAsync)
{
- blobClient.Setup(r => r.DownloadStreamingAsync(default, default, default, default, default)).ReturnsAsync(downloadResponse);
+ blobClient.Setup(r => r.DownloadStreamingAsync(default, default)).ReturnsAsync(downloadResponse);
}
else
{
- blobClient.Setup(r => r.DownloadStreaming(default, default, default, default, default)).Returns(downloadResponse);
+ blobClient.Setup(r => r.DownloadStreaming(default, default)).Returns(downloadResponse);
}
shardFactory.SetupSequence(r => r.BuildShard(
@@ -303,11 +303,11 @@ public async Task GetPage()
containerClient.Verify(r => r.GetBlobClient(manifestPath));
if (IsAsync)
{
- blobClient.Verify(r => r.DownloadStreamingAsync(default, default, default, default, default));
+ blobClient.Verify(r => r.DownloadStreamingAsync(default, default));
}
else
{
- blobClient.Verify(r => r.DownloadStreaming(default, default, default, default, default));
+ blobClient.Verify(r => r.DownloadStreaming(default, default));
}
for (int i = 0; i < shards.Count; i++)
@@ -357,11 +357,11 @@ public async Task GetPage_NoMoreEvents()
if (IsAsync)
{
- blobClient.Setup(r => r.DownloadStreamingAsync(default, default, default, default, default)).ReturnsAsync(downloadResponse);
+ blobClient.Setup(r => r.DownloadStreamingAsync(default, default)).ReturnsAsync(downloadResponse);
}
else
{
- blobClient.Setup(r => r.DownloadStreaming(default, default, default, default, default)).Returns(downloadResponse);
+ blobClient.Setup(r => r.DownloadStreaming(default, default)).Returns(downloadResponse);
}
shardFactory.SetupSequence(r => r.BuildShard(
@@ -398,11 +398,11 @@ public async Task GetPage_NoMoreEvents()
containerClient.Verify(r => r.GetBlobClient(manifestPath));
if (IsAsync)
{
- blobClient.Verify(r => r.DownloadStreamingAsync(default, default, default, default, default));
+ blobClient.Verify(r => r.DownloadStreamingAsync(default, default));
}
else
{
- blobClient.Verify(r => r.DownloadStreaming(default, default, default, default, default));
+ blobClient.Verify(r => r.DownloadStreaming(default, default));
}
for (int i = 0; i < shards.Count; i++)
diff --git a/sdk/storage/Azure.Storage.Blobs/AzureStorageNetMigrationV12.md b/sdk/storage/Azure.Storage.Blobs/AzureStorageNetMigrationV12.md
index d1fd196d3901..dd8b524c7a61 100644
--- a/sdk/storage/Azure.Storage.Blobs/AzureStorageNetMigrationV12.md
+++ b/sdk/storage/Azure.Storage.Blobs/AzureStorageNetMigrationV12.md
@@ -681,7 +681,16 @@ V12 does not currently provide this functionality. Users who manage their own in
await blockBlobClient.StageBlockAsync(
blockId,
blockContentStream,
- transactionalContentHash: precalculatedBlockHash);
+ new BlockBlobStageBlockOptions
+ {
+ TransferValidationOptions = new UploadTransferValidationOptions
+ {
+ Algorithm = ValidationAlgorithm.MD5,
+ // a precalculated hash can be provided as follows,
+ // the sdk will calculate one for you otherwise
+ PrecalculatedChecksum = precalculatedBlockHash
+ }
+ });
// upload more blocks as needed
@@ -690,12 +699,22 @@ await blockBlobClient.CommitBlockListAsync(blockList);
// download any range of blob with transactional MD5 requested (maximum 4 MB for downloads)
Response response = await blockBlobClient.DownloadStreamingAsync(
- range: new HttpRange(length: 4 * Constants.MB), // a range must be provided; here we use transactional download max size
- rangeGetContentHash: true);
+ new BlobDownloadOptions
+ {
+ // a range must be provided when requesting checksums; here we use transactional download max size
+ Range = new HttpRange(length: 4 * Constants.MB),
+ TransferValidationOptions = new DownloadTransferValidationOptions
+ {
+ Algorithm = ValidationAlgorithm.MD5,
+ // SDK will validate against checksum for you
+ // to disable this and check in your own workflow, uncomment the below
+ //Validate = false,
+ },
+ });
Stream downloadStream = response.Value.Content;
-byte[] transactionalMD5 = response.Value.Details.ContentHash;
-// validate stream against hash in your workflow
+// uncomment below to retrieve checksum for validating in your own workflow
+//byte[] transactionalMD5 = response.Value.Details.ContentHash;
```
### Resiliency
diff --git a/sdk/storage/Azure.Storage.Blobs/CHANGELOG.md b/sdk/storage/Azure.Storage.Blobs/CHANGELOG.md
index f01303d53bd5..be76fff57ad8 100644
--- a/sdk/storage/Azure.Storage.Blobs/CHANGELOG.md
+++ b/sdk/storage/Azure.Storage.Blobs/CHANGELOG.md
@@ -3,6 +3,7 @@
## 12.14.0-beta.1 (Unreleased)
### Features Added
+Support for SDK-calculated transactional checksums on data transfer.
### Breaking Changes
diff --git a/sdk/storage/Azure.Storage.Blobs/api/Azure.Storage.Blobs.netstandard2.0.cs b/sdk/storage/Azure.Storage.Blobs/api/Azure.Storage.Blobs.netstandard2.0.cs
index 2c17516c2838..0d4ac1c0657c 100644
--- a/sdk/storage/Azure.Storage.Blobs/api/Azure.Storage.Blobs.netstandard2.0.cs
+++ b/sdk/storage/Azure.Storage.Blobs/api/Azure.Storage.Blobs.netstandard2.0.cs
@@ -53,9 +53,11 @@ public partial class BlobClientOptions : Azure.Core.ClientOptions
{
public BlobClientOptions(Azure.Storage.Blobs.BlobClientOptions.ServiceVersion version = Azure.Storage.Blobs.BlobClientOptions.ServiceVersion.V2021_08_06) { }
public Azure.Storage.Blobs.Models.CustomerProvidedKey? CustomerProvidedKey { get { throw null; } set { } }
+ public Azure.Storage.DownloadTransferValidationOptions DownloadTransferValidationOptions { get { throw null; } set { } }
public bool EnableTenantDiscovery { get { throw null; } set { } }
public string EncryptionScope { get { throw null; } set { } }
public System.Uri GeoRedundantSecondaryUri { get { throw null; } set { } }
+ public Azure.Storage.UploadTransferValidationOptions UploadTransferValidationOptions { get { throw null; } set { } }
public Azure.Storage.Blobs.BlobClientOptions.ServiceVersion Version { get { throw null; } }
public enum ServiceVersion
{
@@ -263,6 +265,13 @@ public AppendBlobAppendBlockFromUriOptions() { }
public byte[] SourceContentHash { get { throw null; } set { } }
public Azure.HttpRange SourceRange { get { throw null; } set { } }
}
+ public partial class AppendBlobAppendBlockOptions
+ {
+ public AppendBlobAppendBlockOptions() { }
+ public Azure.Storage.Blobs.Models.AppendBlobRequestConditions Conditions { get { throw null; } set { } }
+ public System.IProgress ProgressHandler { get { throw null; } set { } }
+ public Azure.Storage.UploadTransferValidationOptions TransferValidationOptions { get { throw null; } set { } }
+ }
public partial class AppendBlobCreateOptions
{
public AppendBlobCreateOptions() { }
@@ -279,6 +288,7 @@ public AppendBlobOpenWriteOptions() { }
public long? BufferSize { get { throw null; } set { } }
public Azure.Storage.Blobs.Models.AppendBlobRequestConditions OpenConditions { get { throw null; } set { } }
public System.IProgress ProgressHandler { get { throw null; } set { } }
+ public Azure.Storage.UploadTransferValidationOptions TransferValidationOptions { get { throw null; } set { } }
}
public partial class AppendBlobRequestConditions : Azure.Storage.Blobs.Models.BlobRequestConditions
{
@@ -504,6 +514,14 @@ internal BlobDownloadInfo() { }
public Azure.Storage.Blobs.Models.BlobDownloadDetails Details { get { throw null; } }
public void Dispose() { }
}
+ public partial class BlobDownloadOptions
+ {
+ public BlobDownloadOptions() { }
+ public Azure.Storage.Blobs.Models.BlobRequestConditions Conditions { get { throw null; } set { } }
+ public System.IProgress ProgressHandler { get { throw null; } set { } }
+ public Azure.HttpRange Range { get { throw null; } set { } }
+ public Azure.Storage.DownloadTransferValidationOptions TransferValidationOptions { get { throw null; } set { } }
+ }
public partial class BlobDownloadResult
{
internal BlobDownloadResult() { }
@@ -523,6 +541,7 @@ public BlobDownloadToOptions() { }
public Azure.Storage.Blobs.Models.BlobRequestConditions Conditions { get { throw null; } set { } }
public System.IProgress ProgressHandler { get { throw null; } set { } }
public Azure.Storage.StorageTransferOptions TransferOptions { get { throw null; } set { } }
+ public Azure.Storage.DownloadTransferValidationOptions TransferValidationOptions { get { throw null; } set { } }
}
[System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)]
public readonly partial struct BlobErrorCode : System.IEquatable
@@ -800,6 +819,7 @@ public BlobOpenReadOptions(bool allowModifications) { }
public int? BufferSize { get { throw null; } set { } }
public Azure.Storage.Blobs.Models.BlobRequestConditions Conditions { get { throw null; } set { } }
public long Position { get { throw null; } set { } }
+ public Azure.Storage.DownloadTransferValidationOptions TransferValidationOptions { get { throw null; } set { } }
}
public partial class BlobOpenWriteOptions
{
@@ -810,6 +830,7 @@ public BlobOpenWriteOptions() { }
public Azure.Storage.Blobs.Models.BlobRequestConditions OpenConditions { get { throw null; } set { } }
public System.IProgress ProgressHandler { get { throw null; } set { } }
public System.Collections.Generic.IDictionary Tags { get { throw null; } set { } }
+ public Azure.Storage.UploadTransferValidationOptions TransferValidationOptions { get { throw null; } set { } }
}
public partial class BlobProperties
{
@@ -1120,6 +1141,7 @@ public BlobUploadOptions() { }
public System.IProgress ProgressHandler { get { throw null; } set { } }
public System.Collections.Generic.IDictionary Tags { get { throw null; } set { } }
public Azure.Storage.StorageTransferOptions TransferOptions { get { throw null; } set { } }
+ public Azure.Storage.UploadTransferValidationOptions TransferValidationOptions { get { throw null; } set { } }
}
public partial class BlockBlobOpenWriteOptions
{
@@ -1130,6 +1152,14 @@ public BlockBlobOpenWriteOptions() { }
public Azure.Storage.Blobs.Models.BlobRequestConditions OpenConditions { get { throw null; } set { } }
public System.IProgress ProgressHandler { get { throw null; } set { } }
public System.Collections.Generic.IDictionary Tags { get { throw null; } set { } }
+ public Azure.Storage.UploadTransferValidationOptions TransferValidationOptions { get { throw null; } set { } }
+ }
+ public partial class BlockBlobStageBlockOptions
+ {
+ public BlockBlobStageBlockOptions() { }
+ public Azure.Storage.Blobs.Models.BlobRequestConditions Conditions { get { throw null; } set { } }
+ public System.IProgress ProgressHandler { get { throw null; } set { } }
+ public Azure.Storage.UploadTransferValidationOptions TransferValidationOptions { get { throw null; } set { } }
}
public partial class BlockInfo
{
@@ -1296,6 +1326,7 @@ public PageBlobOpenWriteOptions() { }
public Azure.Storage.Blobs.Models.PageBlobRequestConditions OpenConditions { get { throw null; } set { } }
public System.IProgress ProgressHandler { get { throw null; } set { } }
public long? Size { get { throw null; } set { } }
+ public Azure.Storage.UploadTransferValidationOptions TransferValidationOptions { get { throw null; } set { } }
}
public partial class PageBlobRequestConditions : Azure.Storage.Blobs.Models.BlobRequestConditions
{
@@ -1312,6 +1343,13 @@ public PageBlobUploadPagesFromUriOptions() { }
public Azure.Storage.Blobs.Models.PageBlobRequestConditions SourceConditions { get { throw null; } set { } }
public byte[] SourceContentHash { get { throw null; } set { } }
}
+ public partial class PageBlobUploadPagesOptions
+ {
+ public PageBlobUploadPagesOptions() { }
+ public Azure.Storage.Blobs.Models.PageBlobRequestConditions Conditions { get { throw null; } set { } }
+ public System.IProgress ProgressHandler { get { throw null; } set { } }
+ public Azure.Storage.UploadTransferValidationOptions TransferValidationOptions { get { throw null; } set { } }
+ }
public partial class PageInfo
{
internal PageInfo() { }
@@ -1421,8 +1459,12 @@ public AppendBlobClient(System.Uri blobUri, Azure.Storage.Blobs.BlobClientOption
public AppendBlobClient(System.Uri blobUri, Azure.Storage.StorageSharedKeyCredential credential, Azure.Storage.Blobs.BlobClientOptions options = null) { }
public virtual int AppendBlobMaxAppendBlockBytes { get { throw null; } }
public virtual int AppendBlobMaxBlocks { get { throw null; } }
- public virtual Azure.Response AppendBlock(System.IO.Stream content, byte[] transactionalContentHash = null, Azure.Storage.Blobs.Models.AppendBlobRequestConditions conditions = null, System.IProgress progressHandler = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; }
- public virtual System.Threading.Tasks.Task> AppendBlockAsync(System.IO.Stream content, byte[] transactionalContentHash = null, Azure.Storage.Blobs.Models.AppendBlobRequestConditions conditions = null, System.IProgress progressHandler = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; }
+ public virtual Azure.Response AppendBlock(System.IO.Stream content, Azure.Storage.Blobs.Models.AppendBlobAppendBlockOptions options = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; }
+ [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)]
+ public virtual Azure.Response AppendBlock(System.IO.Stream content, byte[] transactionalContentHash, Azure.Storage.Blobs.Models.AppendBlobRequestConditions conditions, System.IProgress progressHandler, System.Threading.CancellationToken cancellationToken) { throw null; }
+ public virtual System.Threading.Tasks.Task> AppendBlockAsync(System.IO.Stream content, Azure.Storage.Blobs.Models.AppendBlobAppendBlockOptions options = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; }
+ [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)]
+ public virtual System.Threading.Tasks.Task> AppendBlockAsync(System.IO.Stream content, byte[] transactionalContentHash, Azure.Storage.Blobs.Models.AppendBlobRequestConditions conditions, System.IProgress progressHandler, System.Threading.CancellationToken cancellationToken) { throw null; }
[System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)]
public virtual Azure.Response AppendBlockFromUri(System.Uri sourceUri, Azure.HttpRange sourceRange, byte[] sourceContentHash, Azure.Storage.Blobs.Models.AppendBlobRequestConditions conditions, Azure.Storage.Blobs.Models.AppendBlobRequestConditions sourceConditions, System.Threading.CancellationToken cancellationToken) { throw null; }
public virtual Azure.Response AppendBlockFromUri(System.Uri sourceUri, Azure.Storage.Blobs.Models.AppendBlobAppendBlockFromUriOptions options = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; }
@@ -1487,21 +1529,29 @@ public BlobBaseClient(System.Uri blobUri, Azure.Storage.StorageSharedKeyCredenti
[System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)]
public virtual System.Threading.Tasks.Task> DownloadAsync(System.Threading.CancellationToken cancellationToken) { throw null; }
public virtual Azure.Response DownloadContent() { throw null; }
- public virtual Azure.Response DownloadContent(Azure.Storage.Blobs.Models.BlobRequestConditions conditions = null, System.IProgress progressHandler = null, Azure.HttpRange range = default(Azure.HttpRange), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; }
+ public virtual Azure.Response DownloadContent(Azure.Storage.Blobs.Models.BlobDownloadOptions options, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; }
+ [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)]
+ public virtual Azure.Response DownloadContent(Azure.Storage.Blobs.Models.BlobRequestConditions conditions, System.IProgress progressHandler, Azure.HttpRange range, System.Threading.CancellationToken cancellationToken) { throw null; }
[System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)]
public virtual Azure.Response DownloadContent(Azure.Storage.Blobs.Models.BlobRequestConditions conditions, System.Threading.CancellationToken cancellationToken) { throw null; }
public virtual Azure.Response DownloadContent(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; }
public virtual System.Threading.Tasks.Task> DownloadContentAsync() { throw null; }
- public virtual System.Threading.Tasks.Task> DownloadContentAsync(Azure.Storage.Blobs.Models.BlobRequestConditions conditions = null, System.IProgress progressHandler = null, Azure.HttpRange range = default(Azure.HttpRange), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; }
+ public virtual System.Threading.Tasks.Task> DownloadContentAsync(Azure.Storage.Blobs.Models.BlobDownloadOptions options, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; }
+ [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)]
+ public virtual System.Threading.Tasks.Task> DownloadContentAsync(Azure.Storage.Blobs.Models.BlobRequestConditions conditions, System.IProgress progressHandler, Azure.HttpRange range, System.Threading.CancellationToken cancellationToken) { throw null; }
[System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)]
public virtual System.Threading.Tasks.Task> DownloadContentAsync(Azure.Storage.Blobs.Models.BlobRequestConditions conditions, System.Threading.CancellationToken cancellationToken) { throw null; }
public virtual System.Threading.Tasks.Task> DownloadContentAsync(System.Threading.CancellationToken cancellationToken) { throw null; }
- public virtual Azure.Response DownloadStreaming(Azure.HttpRange range = default(Azure.HttpRange), Azure.Storage.Blobs.Models.BlobRequestConditions conditions = null, bool rangeGetContentHash = false, System.IProgress progressHandler = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; }
+ [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)]
+ public virtual Azure.Response DownloadStreaming(Azure.HttpRange range, Azure.Storage.Blobs.Models.BlobRequestConditions conditions, bool rangeGetContentHash, System.IProgress progressHandler, System.Threading.CancellationToken cancellationToken) { throw null; }
[System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)]
public virtual Azure.Response DownloadStreaming(Azure.HttpRange range, Azure.Storage.Blobs.Models.BlobRequestConditions conditions, bool rangeGetContentHash, System.Threading.CancellationToken cancellationToken) { throw null; }
- public virtual System.Threading.Tasks.Task> DownloadStreamingAsync(Azure.HttpRange range = default(Azure.HttpRange), Azure.Storage.Blobs.Models.BlobRequestConditions conditions = null, bool rangeGetContentHash = false, System.IProgress progressHandler = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; }
+ public virtual Azure.Response DownloadStreaming(Azure.Storage.Blobs.Models.BlobDownloadOptions options = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; }
+ [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)]
+ public virtual System.Threading.Tasks.Task> DownloadStreamingAsync(Azure.HttpRange range, Azure.Storage.Blobs.Models.BlobRequestConditions conditions, bool rangeGetContentHash, System.IProgress progressHandler, System.Threading.CancellationToken cancellationToken) { throw null; }
[System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)]
public virtual System.Threading.Tasks.Task> DownloadStreamingAsync(Azure.HttpRange range, Azure.Storage.Blobs.Models.BlobRequestConditions conditions, bool rangeGetContentHash, System.Threading.CancellationToken cancellationToken) { throw null; }
+ public virtual System.Threading.Tasks.Task> DownloadStreamingAsync(Azure.Storage.Blobs.Models.BlobDownloadOptions options = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; }
public virtual Azure.Response DownloadTo(System.IO.Stream destination) { throw null; }
public virtual Azure.Response DownloadTo(System.IO.Stream destination, Azure.Storage.Blobs.Models.BlobDownloadToOptions options, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; }
[System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)]
@@ -1622,8 +1672,12 @@ public BlockBlobClient(System.Uri blobUri, Azure.Storage.StorageSharedKeyCredent
public virtual System.Threading.Tasks.Task OpenWriteAsync(bool overwrite, Azure.Storage.Blobs.Models.BlockBlobOpenWriteOptions options = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; }
public virtual Azure.Response Query(string querySqlExpression, Azure.Storage.Blobs.Models.BlobQueryOptions options = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; }
public virtual System.Threading.Tasks.Task> QueryAsync(string querySqlExpression, Azure.Storage.Blobs.Models.BlobQueryOptions options = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; }
- public virtual Azure.Response StageBlock(string base64BlockId, System.IO.Stream content, byte[] transactionalContentHash = null, Azure.Storage.Blobs.Models.BlobRequestConditions conditions = null, System.IProgress progressHandler = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; }
- public virtual System.Threading.Tasks.Task> StageBlockAsync(string base64BlockId, System.IO.Stream content, byte[] transactionalContentHash = null, Azure.Storage.Blobs.Models.BlobRequestConditions conditions = null, System.IProgress progressHandler = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; }
+ public virtual Azure.Response StageBlock(string base64BlockId, System.IO.Stream content, Azure.Storage.Blobs.Models.BlockBlobStageBlockOptions options = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; }
+ [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)]
+ public virtual Azure.Response StageBlock(string base64BlockId, System.IO.Stream content, byte[] transactionalContentHash, Azure.Storage.Blobs.Models.BlobRequestConditions conditions, System.IProgress progressHandler, System.Threading.CancellationToken cancellationToken) { throw null; }
+ public virtual System.Threading.Tasks.Task> StageBlockAsync(string base64BlockId, System.IO.Stream content, Azure.Storage.Blobs.Models.BlockBlobStageBlockOptions options = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; }
+ [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)]
+ public virtual System.Threading.Tasks.Task> StageBlockAsync(string base64BlockId, System.IO.Stream content, byte[] transactionalContentHash, Azure.Storage.Blobs.Models.BlobRequestConditions conditions, System.IProgress progressHandler, System.Threading.CancellationToken cancellationToken) { throw null; }
[System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)]
public virtual Azure.Response StageBlockFromUri(System.Uri sourceUri, string base64BlockId, Azure.HttpRange sourceRange, byte[] sourceContentHash, Azure.RequestConditions sourceConditions, Azure.Storage.Blobs.Models.BlobRequestConditions conditions, System.Threading.CancellationToken cancellationToken) { throw null; }
public virtual Azure.Response StageBlockFromUri(System.Uri sourceUri, string base64BlockId, Azure.Storage.Blobs.Models.StageBlockFromUriOptions options = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; }
@@ -1693,8 +1747,12 @@ public PageBlobClient(System.Uri blobUri, Azure.Storage.StorageSharedKeyCredenti
public virtual System.Threading.Tasks.Task StartCopyIncrementalAsync(System.Uri sourceUri, string snapshot, Azure.Storage.Blobs.Models.PageBlobRequestConditions conditions = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; }
public virtual Azure.Response UpdateSequenceNumber(Azure.Storage.Blobs.Models.SequenceNumberAction action, long? sequenceNumber = default(long?), Azure.Storage.Blobs.Models.PageBlobRequestConditions conditions = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; }
public virtual System.Threading.Tasks.Task> UpdateSequenceNumberAsync(Azure.Storage.Blobs.Models.SequenceNumberAction action, long? sequenceNumber = default(long?), Azure.Storage.Blobs.Models.PageBlobRequestConditions conditions = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; }
- public virtual Azure.Response UploadPages(System.IO.Stream content, long offset, byte[] transactionalContentHash = null, Azure.Storage.Blobs.Models.PageBlobRequestConditions conditions = null, System.IProgress progressHandler = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; }
- public virtual System.Threading.Tasks.Task> UploadPagesAsync(System.IO.Stream content, long offset, byte[] transactionalContentHash = null, Azure.Storage.Blobs.Models.PageBlobRequestConditions conditions = null, System.IProgress progressHandler = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; }
+ public virtual Azure.Response UploadPages(System.IO.Stream content, long offset, Azure.Storage.Blobs.Models.PageBlobUploadPagesOptions options = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; }
+ [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)]
+ public virtual Azure.Response UploadPages(System.IO.Stream content, long offset, byte[] transactionalContentHash, Azure.Storage.Blobs.Models.PageBlobRequestConditions conditions, System.IProgress progressHandler, System.Threading.CancellationToken cancellationToken) { throw null; }
+ public virtual System.Threading.Tasks.Task> UploadPagesAsync(System.IO.Stream content, long offset, Azure.Storage.Blobs.Models.PageBlobUploadPagesOptions options = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; }
+ [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)]
+ public virtual System.Threading.Tasks.Task> UploadPagesAsync(System.IO.Stream content, long offset, byte[] transactionalContentHash, Azure.Storage.Blobs.Models.PageBlobRequestConditions conditions, System.IProgress progressHandler, System.Threading.CancellationToken cancellationToken) { throw null; }
public virtual Azure.Response UploadPagesFromUri(System.Uri sourceUri, Azure.HttpRange sourceRange, Azure.HttpRange range, Azure.Storage.Blobs.Models.PageBlobUploadPagesFromUriOptions options = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; }
[System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)]
public virtual Azure.Response UploadPagesFromUri(System.Uri sourceUri, Azure.HttpRange sourceRange, Azure.HttpRange range, byte[] sourceContentHash, Azure.Storage.Blobs.Models.PageBlobRequestConditions conditions, Azure.Storage.Blobs.Models.PageBlobRequestConditions sourceConditions, System.Threading.CancellationToken cancellationToken) { throw null; }
diff --git a/sdk/storage/Azure.Storage.Blobs/api/Azure.Storage.Blobs.netstandard2.1.cs b/sdk/storage/Azure.Storage.Blobs/api/Azure.Storage.Blobs.netstandard2.1.cs
index 2c17516c2838..0d4ac1c0657c 100644
--- a/sdk/storage/Azure.Storage.Blobs/api/Azure.Storage.Blobs.netstandard2.1.cs
+++ b/sdk/storage/Azure.Storage.Blobs/api/Azure.Storage.Blobs.netstandard2.1.cs
@@ -53,9 +53,11 @@ public partial class BlobClientOptions : Azure.Core.ClientOptions
{
public BlobClientOptions(Azure.Storage.Blobs.BlobClientOptions.ServiceVersion version = Azure.Storage.Blobs.BlobClientOptions.ServiceVersion.V2021_08_06) { }
public Azure.Storage.Blobs.Models.CustomerProvidedKey? CustomerProvidedKey { get { throw null; } set { } }
+ public Azure.Storage.DownloadTransferValidationOptions DownloadTransferValidationOptions { get { throw null; } set { } }
public bool EnableTenantDiscovery { get { throw null; } set { } }
public string EncryptionScope { get { throw null; } set { } }
public System.Uri GeoRedundantSecondaryUri { get { throw null; } set { } }
+ public Azure.Storage.UploadTransferValidationOptions UploadTransferValidationOptions { get { throw null; } set { } }
public Azure.Storage.Blobs.BlobClientOptions.ServiceVersion Version { get { throw null; } }
public enum ServiceVersion
{
@@ -263,6 +265,13 @@ public AppendBlobAppendBlockFromUriOptions() { }
public byte[] SourceContentHash { get { throw null; } set { } }
public Azure.HttpRange SourceRange { get { throw null; } set { } }
}
+ public partial class AppendBlobAppendBlockOptions
+ {
+ public AppendBlobAppendBlockOptions() { }
+ public Azure.Storage.Blobs.Models.AppendBlobRequestConditions Conditions { get { throw null; } set { } }
+ public System.IProgress ProgressHandler { get { throw null; } set { } }
+ public Azure.Storage.UploadTransferValidationOptions TransferValidationOptions { get { throw null; } set { } }
+ }
public partial class AppendBlobCreateOptions
{
public AppendBlobCreateOptions() { }
@@ -279,6 +288,7 @@ public AppendBlobOpenWriteOptions() { }
public long? BufferSize { get { throw null; } set { } }
public Azure.Storage.Blobs.Models.AppendBlobRequestConditions OpenConditions { get { throw null; } set { } }
public System.IProgress ProgressHandler { get { throw null; } set { } }
+ public Azure.Storage.UploadTransferValidationOptions TransferValidationOptions { get { throw null; } set { } }
}
public partial class AppendBlobRequestConditions : Azure.Storage.Blobs.Models.BlobRequestConditions
{
@@ -504,6 +514,14 @@ internal BlobDownloadInfo() { }
public Azure.Storage.Blobs.Models.BlobDownloadDetails Details { get { throw null; } }
public void Dispose() { }
}
+ public partial class BlobDownloadOptions
+ {
+ public BlobDownloadOptions() { }
+ public Azure.Storage.Blobs.Models.BlobRequestConditions Conditions { get { throw null; } set { } }
+ public System.IProgress ProgressHandler { get { throw null; } set { } }
+ public Azure.HttpRange Range { get { throw null; } set { } }
+ public Azure.Storage.DownloadTransferValidationOptions TransferValidationOptions { get { throw null; } set { } }
+ }
public partial class BlobDownloadResult
{
internal BlobDownloadResult() { }
@@ -523,6 +541,7 @@ public BlobDownloadToOptions() { }
public Azure.Storage.Blobs.Models.BlobRequestConditions Conditions { get { throw null; } set { } }
public System.IProgress ProgressHandler { get { throw null; } set { } }
public Azure.Storage.StorageTransferOptions TransferOptions { get { throw null; } set { } }
+ public Azure.Storage.DownloadTransferValidationOptions TransferValidationOptions { get { throw null; } set { } }
}
[System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)]
public readonly partial struct BlobErrorCode : System.IEquatable
@@ -800,6 +819,7 @@ public BlobOpenReadOptions(bool allowModifications) { }
public int? BufferSize { get { throw null; } set { } }
public Azure.Storage.Blobs.Models.BlobRequestConditions Conditions { get { throw null; } set { } }
public long Position { get { throw null; } set { } }
+ public Azure.Storage.DownloadTransferValidationOptions TransferValidationOptions { get { throw null; } set { } }
}
public partial class BlobOpenWriteOptions
{
@@ -810,6 +830,7 @@ public BlobOpenWriteOptions() { }
public Azure.Storage.Blobs.Models.BlobRequestConditions OpenConditions { get { throw null; } set { } }
public System.IProgress ProgressHandler { get { throw null; } set { } }
public System.Collections.Generic.IDictionary Tags { get { throw null; } set { } }
+ public Azure.Storage.UploadTransferValidationOptions TransferValidationOptions { get { throw null; } set { } }
}
public partial class BlobProperties
{
@@ -1120,6 +1141,7 @@ public BlobUploadOptions() { }
public System.IProgress ProgressHandler { get { throw null; } set { } }
public System.Collections.Generic.IDictionary Tags { get { throw null; } set { } }
public Azure.Storage.StorageTransferOptions TransferOptions { get { throw null; } set { } }
+ public Azure.Storage.UploadTransferValidationOptions TransferValidationOptions { get { throw null; } set { } }
}
public partial class BlockBlobOpenWriteOptions
{
@@ -1130,6 +1152,14 @@ public BlockBlobOpenWriteOptions() { }
public Azure.Storage.Blobs.Models.BlobRequestConditions OpenConditions { get { throw null; } set { } }
public System.IProgress ProgressHandler { get { throw null; } set { } }
public System.Collections.Generic.IDictionary Tags { get { throw null; } set { } }
+ public Azure.Storage.UploadTransferValidationOptions TransferValidationOptions { get { throw null; } set { } }
+ }
+ public partial class BlockBlobStageBlockOptions
+ {
+ public BlockBlobStageBlockOptions() { }
+ public Azure.Storage.Blobs.Models.BlobRequestConditions Conditions { get { throw null; } set { } }
+ public System.IProgress ProgressHandler { get { throw null; } set { } }
+ public Azure.Storage.UploadTransferValidationOptions TransferValidationOptions { get { throw null; } set { } }
}
public partial class BlockInfo
{
@@ -1296,6 +1326,7 @@ public PageBlobOpenWriteOptions() { }
public Azure.Storage.Blobs.Models.PageBlobRequestConditions OpenConditions { get { throw null; } set { } }
public System.IProgress ProgressHandler { get { throw null; } set { } }
public long? Size { get { throw null; } set { } }
+ public Azure.Storage.UploadTransferValidationOptions TransferValidationOptions { get { throw null; } set { } }
}
public partial class PageBlobRequestConditions : Azure.Storage.Blobs.Models.BlobRequestConditions
{
@@ -1312,6 +1343,13 @@ public PageBlobUploadPagesFromUriOptions() { }
public Azure.Storage.Blobs.Models.PageBlobRequestConditions SourceConditions { get { throw null; } set { } }
public byte[] SourceContentHash { get { throw null; } set { } }
}
+ public partial class PageBlobUploadPagesOptions
+ {
+ public PageBlobUploadPagesOptions() { }
+ public Azure.Storage.Blobs.Models.PageBlobRequestConditions Conditions { get { throw null; } set { } }
+ public System.IProgress ProgressHandler { get { throw null; } set { } }
+ public Azure.Storage.UploadTransferValidationOptions TransferValidationOptions { get { throw null; } set { } }
+ }
public partial class PageInfo
{
internal PageInfo() { }
@@ -1421,8 +1459,12 @@ public AppendBlobClient(System.Uri blobUri, Azure.Storage.Blobs.BlobClientOption
public AppendBlobClient(System.Uri blobUri, Azure.Storage.StorageSharedKeyCredential credential, Azure.Storage.Blobs.BlobClientOptions options = null) { }
public virtual int AppendBlobMaxAppendBlockBytes { get { throw null; } }
public virtual int AppendBlobMaxBlocks { get { throw null; } }
- public virtual Azure.Response AppendBlock(System.IO.Stream content, byte[] transactionalContentHash = null, Azure.Storage.Blobs.Models.AppendBlobRequestConditions conditions = null, System.IProgress progressHandler = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; }
- public virtual System.Threading.Tasks.Task> AppendBlockAsync(System.IO.Stream content, byte[] transactionalContentHash = null, Azure.Storage.Blobs.Models.AppendBlobRequestConditions conditions = null, System.IProgress progressHandler = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; }
+ public virtual Azure.Response AppendBlock(System.IO.Stream content, Azure.Storage.Blobs.Models.AppendBlobAppendBlockOptions options = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; }
+ [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)]
+ public virtual Azure.Response AppendBlock(System.IO.Stream content, byte[] transactionalContentHash, Azure.Storage.Blobs.Models.AppendBlobRequestConditions conditions, System.IProgress progressHandler, System.Threading.CancellationToken cancellationToken) { throw null; }
+ public virtual System.Threading.Tasks.Task> AppendBlockAsync(System.IO.Stream content, Azure.Storage.Blobs.Models.AppendBlobAppendBlockOptions options = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; }
+ [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)]
+ public virtual System.Threading.Tasks.Task> AppendBlockAsync(System.IO.Stream content, byte[] transactionalContentHash, Azure.Storage.Blobs.Models.AppendBlobRequestConditions conditions, System.IProgress progressHandler, System.Threading.CancellationToken cancellationToken) { throw null; }
[System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)]
public virtual Azure.Response AppendBlockFromUri(System.Uri sourceUri, Azure.HttpRange sourceRange, byte[] sourceContentHash, Azure.Storage.Blobs.Models.AppendBlobRequestConditions conditions, Azure.Storage.Blobs.Models.AppendBlobRequestConditions sourceConditions, System.Threading.CancellationToken cancellationToken) { throw null; }
public virtual Azure.Response AppendBlockFromUri(System.Uri sourceUri, Azure.Storage.Blobs.Models.AppendBlobAppendBlockFromUriOptions options = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; }
@@ -1487,21 +1529,29 @@ public BlobBaseClient(System.Uri blobUri, Azure.Storage.StorageSharedKeyCredenti
[System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)]
public virtual System.Threading.Tasks.Task> DownloadAsync(System.Threading.CancellationToken cancellationToken) { throw null; }
public virtual Azure.Response DownloadContent() { throw null; }
- public virtual Azure.Response DownloadContent(Azure.Storage.Blobs.Models.BlobRequestConditions conditions = null, System.IProgress progressHandler = null, Azure.HttpRange range = default(Azure.HttpRange), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; }
+ public virtual Azure.Response DownloadContent(Azure.Storage.Blobs.Models.BlobDownloadOptions options, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; }
+ [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)]
+ public virtual Azure.Response DownloadContent(Azure.Storage.Blobs.Models.BlobRequestConditions conditions, System.IProgress progressHandler, Azure.HttpRange range, System.Threading.CancellationToken cancellationToken) { throw null; }
[System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)]
public virtual Azure.Response DownloadContent(Azure.Storage.Blobs.Models.BlobRequestConditions conditions, System.Threading.CancellationToken cancellationToken) { throw null; }
public virtual Azure.Response DownloadContent(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; }
public virtual System.Threading.Tasks.Task> DownloadContentAsync() { throw null; }
- public virtual System.Threading.Tasks.Task> DownloadContentAsync(Azure.Storage.Blobs.Models.BlobRequestConditions conditions = null, System.IProgress progressHandler = null, Azure.HttpRange range = default(Azure.HttpRange), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; }
+ public virtual System.Threading.Tasks.Task> DownloadContentAsync(Azure.Storage.Blobs.Models.BlobDownloadOptions options, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; }
+ [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)]
+ public virtual System.Threading.Tasks.Task> DownloadContentAsync(Azure.Storage.Blobs.Models.BlobRequestConditions conditions, System.IProgress progressHandler, Azure.HttpRange range, System.Threading.CancellationToken cancellationToken) { throw null; }
[System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)]
public virtual System.Threading.Tasks.Task> DownloadContentAsync(Azure.Storage.Blobs.Models.BlobRequestConditions conditions, System.Threading.CancellationToken cancellationToken) { throw null; }
public virtual System.Threading.Tasks.Task> DownloadContentAsync(System.Threading.CancellationToken cancellationToken) { throw null; }
- public virtual Azure.Response DownloadStreaming(Azure.HttpRange range = default(Azure.HttpRange), Azure.Storage.Blobs.Models.BlobRequestConditions conditions = null, bool rangeGetContentHash = false, System.IProgress progressHandler = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; }
+ [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)]
+ public virtual Azure.Response DownloadStreaming(Azure.HttpRange range, Azure.Storage.Blobs.Models.BlobRequestConditions conditions, bool rangeGetContentHash, System.IProgress progressHandler, System.Threading.CancellationToken cancellationToken) { throw null; }
[System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)]
public virtual Azure.Response DownloadStreaming(Azure.HttpRange range, Azure.Storage.Blobs.Models.BlobRequestConditions conditions, bool rangeGetContentHash, System.Threading.CancellationToken cancellationToken) { throw null; }
- public virtual System.Threading.Tasks.Task> DownloadStreamingAsync(Azure.HttpRange range = default(Azure.HttpRange), Azure.Storage.Blobs.Models.BlobRequestConditions conditions = null, bool rangeGetContentHash = false, System.IProgress progressHandler = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; }
+ public virtual Azure.Response DownloadStreaming(Azure.Storage.Blobs.Models.BlobDownloadOptions options = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; }
+ [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)]
+ public virtual System.Threading.Tasks.Task> DownloadStreamingAsync(Azure.HttpRange range, Azure.Storage.Blobs.Models.BlobRequestConditions conditions, bool rangeGetContentHash, System.IProgress progressHandler, System.Threading.CancellationToken cancellationToken) { throw null; }
[System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)]
public virtual System.Threading.Tasks.Task> DownloadStreamingAsync(Azure.HttpRange range, Azure.Storage.Blobs.Models.BlobRequestConditions conditions, bool rangeGetContentHash, System.Threading.CancellationToken cancellationToken) { throw null; }
+ public virtual System.Threading.Tasks.Task> DownloadStreamingAsync(Azure.Storage.Blobs.Models.BlobDownloadOptions options = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; }
public virtual Azure.Response DownloadTo(System.IO.Stream destination) { throw null; }
public virtual Azure.Response DownloadTo(System.IO.Stream destination, Azure.Storage.Blobs.Models.BlobDownloadToOptions options, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; }
[System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)]
@@ -1622,8 +1672,12 @@ public BlockBlobClient(System.Uri blobUri, Azure.Storage.StorageSharedKeyCredent
public virtual System.Threading.Tasks.Task OpenWriteAsync(bool overwrite, Azure.Storage.Blobs.Models.BlockBlobOpenWriteOptions options = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; }
public virtual Azure.Response Query(string querySqlExpression, Azure.Storage.Blobs.Models.BlobQueryOptions options = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; }
public virtual System.Threading.Tasks.Task> QueryAsync(string querySqlExpression, Azure.Storage.Blobs.Models.BlobQueryOptions options = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; }
- public virtual Azure.Response StageBlock(string base64BlockId, System.IO.Stream content, byte[] transactionalContentHash = null, Azure.Storage.Blobs.Models.BlobRequestConditions conditions = null, System.IProgress progressHandler = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; }
- public virtual System.Threading.Tasks.Task> StageBlockAsync(string base64BlockId, System.IO.Stream content, byte[] transactionalContentHash = null, Azure.Storage.Blobs.Models.BlobRequestConditions conditions = null, System.IProgress progressHandler = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; }
+ public virtual Azure.Response StageBlock(string base64BlockId, System.IO.Stream content, Azure.Storage.Blobs.Models.BlockBlobStageBlockOptions options = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; }
+ [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)]
+ public virtual Azure.Response StageBlock(string base64BlockId, System.IO.Stream content, byte[] transactionalContentHash, Azure.Storage.Blobs.Models.BlobRequestConditions conditions, System.IProgress progressHandler, System.Threading.CancellationToken cancellationToken) { throw null; }
+ public virtual System.Threading.Tasks.Task> StageBlockAsync(string base64BlockId, System.IO.Stream content, Azure.Storage.Blobs.Models.BlockBlobStageBlockOptions options = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; }
+ [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)]
+ public virtual System.Threading.Tasks.Task> StageBlockAsync(string base64BlockId, System.IO.Stream content, byte[] transactionalContentHash, Azure.Storage.Blobs.Models.BlobRequestConditions conditions, System.IProgress progressHandler, System.Threading.CancellationToken cancellationToken) { throw null; }
[System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)]
public virtual Azure.Response StageBlockFromUri(System.Uri sourceUri, string base64BlockId, Azure.HttpRange sourceRange, byte[] sourceContentHash, Azure.RequestConditions sourceConditions, Azure.Storage.Blobs.Models.BlobRequestConditions conditions, System.Threading.CancellationToken cancellationToken) { throw null; }
public virtual Azure.Response StageBlockFromUri(System.Uri sourceUri, string base64BlockId, Azure.Storage.Blobs.Models.StageBlockFromUriOptions options = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; }
@@ -1693,8 +1747,12 @@ public PageBlobClient(System.Uri blobUri, Azure.Storage.StorageSharedKeyCredenti
public virtual System.Threading.Tasks.Task StartCopyIncrementalAsync(System.Uri sourceUri, string snapshot, Azure.Storage.Blobs.Models.PageBlobRequestConditions conditions = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; }
public virtual Azure.Response UpdateSequenceNumber(Azure.Storage.Blobs.Models.SequenceNumberAction action, long? sequenceNumber = default(long?), Azure.Storage.Blobs.Models.PageBlobRequestConditions conditions = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; }
public virtual System.Threading.Tasks.Task> UpdateSequenceNumberAsync(Azure.Storage.Blobs.Models.SequenceNumberAction action, long? sequenceNumber = default(long?), Azure.Storage.Blobs.Models.PageBlobRequestConditions conditions = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; }
- public virtual Azure.Response UploadPages(System.IO.Stream content, long offset, byte[] transactionalContentHash = null, Azure.Storage.Blobs.Models.PageBlobRequestConditions conditions = null, System.IProgress progressHandler = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; }
- public virtual System.Threading.Tasks.Task> UploadPagesAsync(System.IO.Stream content, long offset, byte[] transactionalContentHash = null, Azure.Storage.Blobs.Models.PageBlobRequestConditions conditions = null, System.IProgress progressHandler = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; }
+ public virtual Azure.Response UploadPages(System.IO.Stream content, long offset, Azure.Storage.Blobs.Models.PageBlobUploadPagesOptions options = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; }
+ [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)]
+ public virtual Azure.Response UploadPages(System.IO.Stream content, long offset, byte[] transactionalContentHash, Azure.Storage.Blobs.Models.PageBlobRequestConditions conditions, System.IProgress progressHandler, System.Threading.CancellationToken cancellationToken) { throw null; }
+ public virtual System.Threading.Tasks.Task> UploadPagesAsync(System.IO.Stream content, long offset, Azure.Storage.Blobs.Models.PageBlobUploadPagesOptions options = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; }
+ [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)]
+ public virtual System.Threading.Tasks.Task> UploadPagesAsync(System.IO.Stream content, long offset, byte[] transactionalContentHash, Azure.Storage.Blobs.Models.PageBlobRequestConditions conditions, System.IProgress progressHandler, System.Threading.CancellationToken cancellationToken) { throw null; }
public virtual Azure.Response UploadPagesFromUri(System.Uri sourceUri, Azure.HttpRange sourceRange, Azure.HttpRange range, Azure.Storage.Blobs.Models.PageBlobUploadPagesFromUriOptions options = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; }
[System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)]
public virtual Azure.Response UploadPagesFromUri(System.Uri sourceUri, Azure.HttpRange sourceRange, Azure.HttpRange range, byte[] sourceContentHash, Azure.Storage.Blobs.Models.PageBlobRequestConditions conditions, Azure.Storage.Blobs.Models.PageBlobRequestConditions sourceConditions, System.Threading.CancellationToken cancellationToken) { throw null; }
diff --git a/sdk/storage/Azure.Storage.Blobs/perf/Azure.Storage.Blobs.Perf/Scenarios/UploadBlob.cs b/sdk/storage/Azure.Storage.Blobs/perf/Azure.Storage.Blobs.Perf/Scenarios/UploadBlob.cs
index 3a531ad7c281..b04e403c8cd1 100644
--- a/sdk/storage/Azure.Storage.Blobs/perf/Azure.Storage.Blobs.Perf/Scenarios/UploadBlob.cs
+++ b/sdk/storage/Azure.Storage.Blobs/perf/Azure.Storage.Blobs.Perf/Scenarios/UploadBlob.cs
@@ -4,6 +4,7 @@
using System.IO;
using System.Threading;
using System.Threading.Tasks;
+using Azure.Storage.Blobs.Models;
using Azure.Test.Perf;
namespace Azure.Storage.Blobs.Perf.Scenarios
@@ -37,7 +38,13 @@ public override void Run(CancellationToken cancellationToken)
public override async Task RunAsync(CancellationToken cancellationToken)
{
_stream.Seek(0, SeekOrigin.Begin);
- await BlobClient.UploadAsync(_stream, transferOptions: Options.StorageTransferOptions, cancellationToken: cancellationToken);
+ await BlobClient.UploadAsync(
+ _stream,
+ new BlobUploadOptions
+ {
+ TransferOptions = Options.StorageTransferOptions,
+ },
+ cancellationToken: cancellationToken);
}
}
}
diff --git a/sdk/storage/Azure.Storage.Blobs/samples/Azure.Storage.Blobs.Samples.Tests.csproj b/sdk/storage/Azure.Storage.Blobs/samples/Azure.Storage.Blobs.Samples.Tests.csproj
index 8d9307e640dd..11a12699e834 100644
--- a/sdk/storage/Azure.Storage.Blobs/samples/Azure.Storage.Blobs.Samples.Tests.csproj
+++ b/sdk/storage/Azure.Storage.Blobs/samples/Azure.Storage.Blobs.Samples.Tests.csproj
@@ -15,6 +15,7 @@
+
PreserveNewest
diff --git a/sdk/storage/Azure.Storage.Blobs/samples/Sample03_Migrations.cs b/sdk/storage/Azure.Storage.Blobs/samples/Sample03_Migrations.cs
index e4e4a86cf2cf..8188fbb20b24 100644
--- a/sdk/storage/Azure.Storage.Blobs/samples/Sample03_Migrations.cs
+++ b/sdk/storage/Azure.Storage.Blobs/samples/Sample03_Migrations.cs
@@ -950,7 +950,16 @@ public async Task TransactionalMD5()
await blockBlobClient.StageBlockAsync(
blockId,
blockContentStream,
- transactionalContentHash: precalculatedBlockHash);
+ new BlockBlobStageBlockOptions
+ {
+ TransferValidationOptions = new UploadTransferValidationOptions
+ {
+ Algorithm = ValidationAlgorithm.MD5,
+ // a precalculated hash can be provided as follows,
+ // the sdk will calculate one for you otherwise
+ PrecalculatedChecksum = precalculatedBlockHash
+ }
+ });
// upload more blocks as needed
@@ -959,12 +968,22 @@ await blockBlobClient.StageBlockAsync(
// download any range of blob with transactional MD5 requested (maximum 4 MB for downloads)
Response response = await blockBlobClient.DownloadStreamingAsync(
- range: new HttpRange(length: 4 * Constants.MB), // a range must be provided; here we use transactional download max size
- rangeGetContentHash: true);
+ new BlobDownloadOptions
+ {
+ // a range must be provided when requesting checksums; here we use transactional download max size
+ Range = new HttpRange(length: 4 * Constants.MB),
+ TransferValidationOptions = new DownloadTransferValidationOptions
+ {
+ Algorithm = ValidationAlgorithm.MD5,
+ // SDK will validate against checksum for you
+ // to disable this and check in your own workflow, uncomment the below
+ //Validate = false,
+ },
+ });
Stream downloadStream = response.Value.Content;
- byte[] transactionalMD5 = response.Value.Details.ContentHash;
- // validate stream against hash in your workflow
+ // uncomment below to retrieve checksum for validating in your own workflow
+ //byte[] transactionalMD5 = response.Value.Details.ContentHash;
#endregion
byte[] downloadedBytes;
@@ -975,7 +994,6 @@ await blockBlobClient.StageBlockAsync(
}
Assert.AreEqual(data, Encoding.UTF8.GetString(downloadedBytes));
- Assert.IsTrue(Enumerable.SequenceEqual(precalculatedBlockHash, transactionalMD5));
}
finally
{
diff --git a/sdk/storage/Azure.Storage.Blobs/src/AppendBlobClient.cs b/sdk/storage/Azure.Storage.Blobs/src/AppendBlobClient.cs
index 0a488ee8be95..606cc5812308 100644
--- a/sdk/storage/Azure.Storage.Blobs/src/AppendBlobClient.cs
+++ b/sdk/storage/Azure.Storage.Blobs/src/AppendBlobClient.cs
@@ -997,37 +997,19 @@ private async Task> CreateInternal(
/// A will be thrown if
/// a failure occurs.
///
- // TODO #27253
- //[EditorBrowsable(EditorBrowsableState.Never)]
+ [EditorBrowsable(EditorBrowsableState.Never)]
#pragma warning disable AZC0002 // DO ensure all service methods, both asynchronous and synchronous, take an optional CancellationToken parameter called cancellationToken.
public virtual Response AppendBlock(
#pragma warning restore AZC0002 // DO ensure all service methods, both asynchronous and synchronous, take an optional CancellationToken parameter called cancellationToken.
Stream content,
- byte[] transactionalContentHash = default,
- AppendBlobRequestConditions conditions = default,
- IProgress progressHandler = default,
- CancellationToken cancellationToken = default)
+ byte[] transactionalContentHash,
+ AppendBlobRequestConditions conditions,
+ IProgress progressHandler,
+ CancellationToken cancellationToken)
{
- // TODO #27253
- //AppendBlobAppendBlockOptions options = default;
- //if (transactionalContentHash != default || conditions != default || progressHandler != default)
- //{
- // options = new AppendBlobAppendBlockOptions()
- // {
- // TransactionalHashingOptions = transactionalContentHash != default
- // ? new UploadTransactionalHashingOptions()
- // {
- // Algorithm = TransactionalHashAlgorithm.MD5,
- // PrecalculatedHash = transactionalContentHash
- // }
- // : default,
- // Conditions = conditions,
- // ProgressHandler = progressHandler
- // };
- //}
return AppendBlockInternal(
content,
- transactionalContentHash,
+ transactionalContentHash.ToValidationOptions(),
conditions,
progressHandler,
false, // async
@@ -1078,37 +1060,19 @@ public virtual Response AppendBlock(
/// A will be thrown if
/// a failure occurs.
///
- // TODO #27253
- //[EditorBrowsable(EditorBrowsableState.Never)]
+ [EditorBrowsable(EditorBrowsableState.Never)]
#pragma warning disable AZC0002 // DO ensure all service methods, both asynchronous and synchronous, take an optional CancellationToken parameter called cancellationToken.
public virtual async Task> AppendBlockAsync(
#pragma warning restore AZC0002 // DO ensure all service methods, both asynchronous and synchronous, take an optional CancellationToken parameter called cancellationToken.
Stream content,
- byte[] transactionalContentHash = default,
- AppendBlobRequestConditions conditions = default,
- IProgress progressHandler = default,
- CancellationToken cancellationToken = default)
+ byte[] transactionalContentHash,
+ AppendBlobRequestConditions conditions,
+ IProgress progressHandler,
+ CancellationToken cancellationToken)
{
- // TODO #27253
- //AppendBlobAppendBlockOptions options = default;
- //if (transactionalContentHash != default || conditions != default || progressHandler != default)
- //{
- // options = new AppendBlobAppendBlockOptions()
- // {
- // TransactionalHashingOptions = transactionalContentHash != default
- // ? new UploadTransactionalHashingOptions()
- // {
- // Algorithm = TransactionalHashAlgorithm.MD5,
- // PrecalculatedHash = transactionalContentHash
- // }
- // : default,
- // Conditions = conditions,
- // ProgressHandler = progressHandler
- // };
- //}
return await AppendBlockInternal(
content,
- transactionalContentHash,
+ transactionalContentHash.ToValidationOptions(),
conditions,
progressHandler,
true, // async
@@ -1116,91 +1080,91 @@ public virtual async Task> AppendBlockAsync(
.ConfigureAwait(false);
}
- // TODO #27253
- /////
- ///// The operation commits a new block
- ///// of data, represented by the ,
- ///// to the end of the existing append blob. The
- ///// operation is only permitted if the blob was created as an append
- ///// blob.
- /////
- ///// For more information, see
- /////
- ///// Append Block.
- /////
- /////
- ///// A containing the content of the block to
- ///// append.
- /////
- /////
- ///// Optional parameters.
- /////
- /////
- ///// Optional to propagate
- ///// notifications that the operation should be cancelled.
- /////
- /////
- ///// A describing the
- ///// state of the updated append blob.
- /////
- /////
- ///// A will be thrown if
- ///// a failure occurs.
- /////
- //public virtual Response AppendBlock(
- // Stream content,
- // AppendBlobAppendBlockOptions options = default,
- // CancellationToken cancellationToken = default) =>
- // AppendBlockInternal(
- // content,
- // options,
- // transactionalContentMD5: default,
- // false, // async
- // cancellationToken)
- // .EnsureCompleted();
-
- // TODO #27253
- /////
- ///// The operation commits a new block
- ///// of data, represented by the ,
- ///// to the end of the existing append blob. The
- ///// operation is only permitted if the blob was created as an append
- ///// blob.
- /////
- ///// For more information, see
- /////
- ///// Append Block.
- /////
- /////
- ///// A containing the content of the block to
- ///// append.
- /////
- /////
- ///// Optional parameters.
- /////
- /////
- ///// Optional to propagate
- ///// notifications that the operation should be cancelled.
- /////
- /////
- ///// A describing the
- ///// state of the updated append blob.
- /////
- /////
- ///// A will be thrown if
- ///// a failure occurs.
- /////
- //public virtual async Task> AppendBlockAsync(
- // Stream content,
- // AppendBlobAppendBlockOptions options = default,
- // CancellationToken cancellationToken = default) =>
- // await AppendBlockInternal(
- // content,
- // options,
- // transactionalContentMD5: default,
- // true, // async
- // cancellationToken)
- // .ConfigureAwait(false);
+ ///
+ /// The operation commits a new block
+ /// of data, represented by the ,
+ /// to the end of the existing append blob. The
+ /// operation is only permitted if the blob was created as an append
+ /// blob.
+ ///
+ /// For more information, see
+ ///
+ /// Append Block.
+ ///
+ ///
+ /// A containing the content of the block to
+ /// append.
+ ///
+ ///
+ /// Optional parameters.
+ ///
+ ///
+ /// Optional to propagate
+ /// notifications that the operation should be cancelled.
+ ///
+ ///
+ /// A describing the
+ /// state of the updated append blob.
+ ///
+ ///
+ /// A will be thrown if
+ /// a failure occurs.
+ ///
+ public virtual Response AppendBlock(
+ Stream content,
+ AppendBlobAppendBlockOptions options = default,
+ CancellationToken cancellationToken = default) =>
+ AppendBlockInternal(
+ content,
+ options?.TransferValidationOptions,
+ options?.Conditions,
+ options?.ProgressHandler,
+ false, // async
+ cancellationToken)
+ .EnsureCompleted();
+
+ ///
+ /// The operation commits a new block
+ /// of data, represented by the ,
+ /// to the end of the existing append blob. The
+ /// operation is only permitted if the blob was created as an append
+ /// blob.
+ ///
+ /// For more information, see
+ ///
+ /// Append Block.
+ ///
+ ///
+ /// A containing the content of the block to
+ /// append.
+ ///
+ ///
+ /// Optional parameters.
+ ///
+ ///
+ /// Optional to propagate
+ /// notifications that the operation should be cancelled.
+ ///
+ ///
+ /// A describing the
+ /// state of the updated append blob.
+ ///
+ ///
+ /// A will be thrown if
+ /// a failure occurs.
+ ///
+ public virtual async Task> AppendBlockAsync(
+ Stream content,
+ AppendBlobAppendBlockOptions options = default,
+ CancellationToken cancellationToken = default) =>
+ await AppendBlockInternal(
+ content,
+ options?.TransferValidationOptions,
+ options?.Conditions,
+ options?.ProgressHandler,
+ true, // async
+ cancellationToken)
+ .ConfigureAwait(false);
///
/// The operation commits a new block
@@ -1217,15 +1181,15 @@ public virtual async Task> AppendBlockAsync(
/// A containing the content of the block to
/// append.
///
+ ///
+ /// Validation options for content verification.
+ ///
///
/// Request conditions for append operation.
///
///
/// Progress handler for append progress.
///
- ///
- /// Transactional MD5 for content verification.
- ///
///
/// Whether to invoke the operation asynchronously.
///
@@ -1243,12 +1207,14 @@ public virtual async Task> AppendBlockAsync(
///
internal async Task> AppendBlockInternal(
Stream content,
- byte[] transactionalContentMD5,
+ UploadTransferValidationOptions validationOptionsOverride,
AppendBlobRequestConditions conditions,
IProgress progressHandler,
bool async,
CancellationToken cancellationToken)
{
+ UploadTransferValidationOptions validationOptions = validationOptionsOverride ?? ClientConfiguration.UploadTransferValidationOptions;
+
using (ClientConfiguration.Pipeline.BeginLoggingScope(nameof(AppendBlobClient)))
{
Argument.AssertNotNull(content, nameof(content));
@@ -1274,8 +1240,7 @@ internal async Task> AppendBlockInternal(
Errors.VerifyStreamPosition(content, nameof(content));
// compute hash BEFORE attaching progress handler
- // TODO #27253
- //ContentHasher.GetHashResult hashResult = ContentHasher.GetHashOrDefault(content, options?.TransactionalHashingOptions);
+ ContentHasher.GetHashResult hashResult = ContentHasher.GetHashOrDefault(content, validationOptions);
content = content.WithNoDispose().WithProgress(progressHandler);
@@ -1286,9 +1251,8 @@ internal async Task> AppendBlockInternal(
response = await AppendBlobRestClient.AppendBlockAsync(
contentLength: (content.Length - content.Position),
body: content,
- // TODO #27253
- //transactionalContentCrc64: hashResult?.StorageCrc64,
- transactionalContentMD5: transactionalContentMD5, //hashResult?.MD5,
+ transactionalContentCrc64: hashResult?.StorageCrc64,
+ transactionalContentMD5: hashResult?.MD5,
leaseId: conditions?.LeaseId,
maxSize: conditions?.IfMaxSizeLessThanOrEqual,
appendPosition: conditions?.IfAppendPositionEqual,
@@ -1309,9 +1273,8 @@ internal async Task> AppendBlockInternal(
response = AppendBlobRestClient.AppendBlock(
contentLength: (content.Length - content.Position),
body: content,
- // TODO #27253
- //transactionalContentCrc64: hashResult?.StorageCrc64,
- transactionalContentMD5: transactionalContentMD5, //hashResult?.MD5,
+ transactionalContentCrc64: hashResult?.StorageCrc64,
+ transactionalContentMD5: hashResult?.MD5,
leaseId: conditions?.LeaseId,
maxSize: conditions?.IfMaxSizeLessThanOrEqual,
appendPosition: conditions?.IfAppendPositionEqual,
@@ -2077,9 +2040,8 @@ private async Task OpenWriteInternal(
bufferSize: options?.BufferSize ?? Constants.DefaultBufferSize,
position: position,
conditions: conditions,
- progressHandler: options?.ProgressHandler
- // TODO #27253
- //options?.TransactionalHashingOptions
+ progressHandler: options?.ProgressHandler,
+ options?.TransferValidationOptions
);
}
catch (Exception ex)
diff --git a/sdk/storage/Azure.Storage.Blobs/src/AppendBlobWriteStream.cs b/sdk/storage/Azure.Storage.Blobs/src/AppendBlobWriteStream.cs
index 95bab7d208fb..7c976f3e55c7 100644
--- a/sdk/storage/Azure.Storage.Blobs/src/AppendBlobWriteStream.cs
+++ b/sdk/storage/Azure.Storage.Blobs/src/AppendBlobWriteStream.cs
@@ -20,15 +20,13 @@ public AppendBlobWriteStream(
long bufferSize,
long position,
AppendBlobRequestConditions conditions,
- IProgress progressHandler
- // TODO #27253
- //UploadTransactionalHashingOptions hashingOptions
+ IProgress progressHandler,
+ UploadTransferValidationOptions validationOptions
) : base(
position,
bufferSize,
- progressHandler
- // TODO #27253
- //hashingOptions
+ progressHandler,
+ validationOptions
)
{
ValidateBufferSize(bufferSize);
@@ -46,14 +44,7 @@ protected override async Task AppendInternal(
Response response = await _appendBlobClient.AppendBlockInternal(
content: _buffer,
- // TODO #27253
- //new AppendBlobAppendBlockOptions()
- //{
- // TransactionalHashingOptions = _hashingOptions,
- // Conditions = _conditions,
- // ProgressHandler = _progressHandler
- //},
- transactionalContentMD5: default,
+ _validationOptions,
_conditions,
_progressHandler,
async: async,
diff --git a/sdk/storage/Azure.Storage.Blobs/src/Azure.Storage.Blobs.csproj b/sdk/storage/Azure.Storage.Blobs/src/Azure.Storage.Blobs.csproj
index 86107e5af1a3..7f16fd440f78 100644
--- a/sdk/storage/Azure.Storage.Blobs/src/Azure.Storage.Blobs.csproj
+++ b/sdk/storage/Azure.Storage.Blobs/src/Azure.Storage.Blobs.csproj
@@ -84,6 +84,7 @@
+
diff --git a/sdk/storage/Azure.Storage.Blobs/src/BlobBaseClient.cs b/sdk/storage/Azure.Storage.Blobs/src/BlobBaseClient.cs
index cf7df5346006..ea69a6bcd777 100644
--- a/sdk/storage/Azure.Storage.Blobs/src/BlobBaseClient.cs
+++ b/sdk/storage/Azure.Storage.Blobs/src/BlobBaseClient.cs
@@ -213,6 +213,8 @@ public BlobBaseClient(string connectionString, string blobContainerName, string
clientDiagnostics: new StorageClientDiagnostics(options),
version: options.Version,
customerProvidedKey: options.CustomerProvidedKey,
+ uploadTransferValidationOptions: options.UploadTransferValidationOptions,
+ downloadTransferValidationOptions: options.DownloadTransferValidationOptions,
encryptionScope: options.EncryptionScope);
_clientSideEncryption = options._clientSideEncryptionOptions?.Clone();
@@ -365,6 +367,8 @@ internal BlobBaseClient(
clientDiagnostics: new StorageClientDiagnostics(options),
version: options.Version,
customerProvidedKey: options.CustomerProvidedKey,
+ uploadTransferValidationOptions: options.UploadTransferValidationOptions,
+ downloadTransferValidationOptions: options.DownloadTransferValidationOptions,
encryptionScope: options.EncryptionScope);
_clientSideEncryption = options._clientSideEncryptionOptions?.Clone();
@@ -937,28 +941,10 @@ private async Task> DownloadInternal(
bool async,
CancellationToken cancellationToken)
{
- // TODO #27253
- //BlobDownloadOptions options = default;
- //if (range != default || conditions != default || rangeGetContentHash != default)
- //{
- // options = new BlobDownloadOptions
- // {
- // Range = range,
- // Conditions = conditions,
- // RangeGetContentHash = rangeGetContentHash
- // // TODO #27253
- // //TransactionalHashingOptions = rangeGetContentHash
- // // ? new DownloadTransactionalHashingOptions()
- // // {
- // // Algorithm = TransactionalHashAlgorithm.MD5
- // // }
- // // : default,
- // };
- //}
Response response = await DownloadStreamingDirect(
range,
conditions,
- rangeGetContentHash,
+ rangeGetContentHash.ToValidationOptions(),
progressHandler: default,
$"{nameof(BlobBaseClient)}.{nameof(Download)}",
async,
@@ -1178,34 +1164,20 @@ public virtual async Task> DownloadStreami
///
///
///
+ [EditorBrowsable(EditorBrowsableState.Never)]
+#pragma warning disable AZC0002 // DO ensure all service methods, both asynchronous and synchronous, take an optional CancellationToken parameter called cancellationToken.
public virtual Response DownloadStreaming(
- HttpRange range = default,
- BlobRequestConditions conditions = default,
- bool rangeGetContentHash = default,
- IProgress progressHandler = default,
- CancellationToken cancellationToken = default)
+#pragma warning restore AZC0002 // DO ensure all service methods, both asynchronous and synchronous, take an optional CancellationToken parameter called cancellationToken.
+ HttpRange range,
+ BlobRequestConditions conditions,
+ bool rangeGetContentHash,
+ IProgress progressHandler,
+ CancellationToken cancellationToken)
{
- // TODO #27253
- //BlobDownloadOptions options = default;
- //if (range != default || conditions != default || rangeGetContentHash != default)
- //{
- // options = new BlobDownloadOptions
- // {
- // Range = range,
- // Conditions = conditions,
- // RangeGetContentHash = rangeGetContentHash
- // //TransactionalHashingOptions = rangeGetContentHash
- // // ? new DownloadTransactionalHashingOptions()
- // // {
- // // Algorithm = TransactionalHashAlgorithm.MD5
- // // }
- // // : default
- // };
- //}
return DownloadStreamingDirect(
range,
conditions,
- rangeGetContentHash,
+ rangeGetContentHash.ToValidationOptions(),
progressHandler,
$"{nameof(BlobBaseClient)}.{nameof(DownloadStreaming)}",
false, // async
@@ -1268,35 +1240,20 @@ public virtual Response DownloadStreaming(
///
///
///
+ [EditorBrowsable(EditorBrowsableState.Never)]
+#pragma warning disable AZC0002 // DO ensure all service methods, both asynchronous and synchronous, take an optional CancellationToken parameter called cancellationToken.
public virtual async Task> DownloadStreamingAsync(
- HttpRange range = default,
- BlobRequestConditions conditions = default,
- bool rangeGetContentHash = default,
- IProgress progressHandler = default,
- CancellationToken cancellationToken = default)
+#pragma warning restore AZC0002 // DO ensure all service methods, both asynchronous and synchronous, take an optional CancellationToken parameter called cancellationToken.
+ HttpRange range,
+ BlobRequestConditions conditions,
+ bool rangeGetContentHash,
+ IProgress progressHandler,
+ CancellationToken cancellationToken)
{
- // TODO #27253
- //BlobDownloadOptions options = default;
- //if (range != default || conditions != default || rangeGetContentHash != default)
- //{
- // options = new BlobDownloadOptions
- // {
- // Range = range,
- // Conditions = conditions,
- // RangeGetContentHash = rangeGetContentHash
- // // TODO #27253
- // //TransactionalHashingOptions = rangeGetContentHash
- // // ? new DownloadTransactionalHashingOptions()
- // // {
- // // Algorithm = TransactionalHashAlgorithm.MD5
- // // }
- // // : default
- // };
- //}
return await DownloadStreamingDirect(
range,
conditions,
- rangeGetContentHash,
+ rangeGetContentHash.ToValidationOptions(),
progressHandler,
$"{nameof(BlobBaseClient)}.{nameof(DownloadStreaming)}",
true, // async
@@ -1304,100 +1261,104 @@ public virtual async Task> DownloadStreami
.ConfigureAwait(false);
}
- // TODO #27253
- /////
- ///// The
- ///// operation downloads a blob from the service, including its metadata
- ///// and properties.
- /////
- ///// For more information, see
- /////
- ///// Get Blob.
- /////
- /////
- ///// Optional parameters.
- /////
- /////
- ///// Optional to propagate
- ///// notifications that the operation should be cancelled.
- /////
- /////
- ///// A describing the
- ///// downloaded blob. contains
- ///// the blob's data.
- /////
- /////
- ///// A will be thrown if
- ///// a failure occurs.
- /////
- ///// This API gives access directly to network stream that should be disposed after usage.
- ///// Consider the following alternatives:
- /////
- ///// -
- ///// DownloadContentAsync
- ///// as a prefered way of downloading small blobs that can fit into memory
- /////
- ///// -
- ///// DownloadToAsync
- ///// to stream blob content to a path or a
- /////
- /////
- /////
- //public virtual Response DownloadStreaming(
- // BlobDownloadOptions options,
- // CancellationToken cancellationToken = default)
- //{
- // return DownloadStreamingInternal(
- // options,
- // $"{nameof(BlobBaseClient)}.{nameof(DownloadStreaming)}",
- // async: false,
- // cancellationToken).EnsureCompleted();
- //}
+ ///
+ /// The
+ /// operation downloads a blob from the service, including its metadata
+ /// and properties.
+ ///
+ /// For more information, see
+ ///
+ /// Get Blob.
+ ///
+ ///
+ /// Optional parameters.
+ ///
+ ///
+ /// Optional to propagate
+ /// notifications that the operation should be cancelled.
+ ///
+ ///
+ /// A describing the
+ /// downloaded blob. contains
+ /// the blob's data.
+ ///
+ ///
+ /// A will be thrown if
+ /// a failure occurs.
+ ///
+ /// This API gives access directly to network stream that should be disposed after usage.
+ /// Consider the following alternatives:
+ ///
+ /// -
+ /// DownloadContentAsync
+ /// as a prefered way of downloading small blobs that can fit into memory
+ ///
+ /// -
+ /// DownloadToAsync
+ /// to stream blob content to a path or a
+ ///
+ ///
+ ///
+ public virtual Response DownloadStreaming(
+ BlobDownloadOptions options = default,
+ CancellationToken cancellationToken = default)
+ {
+ return DownloadStreamingDirect(
+ options?.Range ?? default,
+ options?.Conditions,
+ options?.TransferValidationOptions,
+ options?.ProgressHandler,
+ $"{nameof(BlobBaseClient)}.{nameof(DownloadStreaming)}",
+ async: false,
+ cancellationToken).EnsureCompleted();
+ }
- // TODO #27253
- /////
- ///// The
- ///// operation downloads a blob from the service, including its metadata
- ///// and properties.
- /////
- ///// For more information, see
- /////
- ///// Get Blob.
- /////
- ///// Optional parameters.
- /////
- /////
- ///// A describing the
- ///// downloaded blob. contains
- ///// the blob's data.
- /////
- /////
- ///// A will be thrown if
- ///// a failure occurs.
- /////
- ///// This API gives access directly to network stream that should be disposed after usage.
- ///// Consider the following alternatives:
- /////
- ///// -
- ///// DownloadContentAsync
- ///// as a prefered way of downloading small blobs that can fit into memory
- /////
- ///// -
- ///// DownloadToAsync
- ///// to stream blob content to a path or a
- /////
- /////
- /////
- //public virtual async Task> DownloadStreamingAsync(
- // BlobDownloadOptions options,
- // CancellationToken cancellationToken = default)
- //{
- // return await DownloadStreamingInternal(
- // options,
- // $"{nameof(BlobBaseClient)}.{nameof(DownloadStreaming)}",
- // async: true,
- // cancellationToken).ConfigureAwait(false);
- //}
+ ///
+ /// The
+ /// operation downloads a blob from the service, including its metadata
+ /// and properties.
+ ///
+ /// For more information, see
+ ///
+ /// Get Blob.
+ ///
+ /// Optional parameters.
+ ///
+ ///
+ /// A describing the
+ /// downloaded blob. contains
+ /// the blob's data.
+ ///
+ ///
+ /// A will be thrown if
+ /// a failure occurs.
+ ///
+ /// This API gives access directly to network stream that should be disposed after usage.
+ /// Consider the following alternatives:
+ ///
+ /// -
+ /// DownloadContentAsync
+ /// as a prefered way of downloading small blobs that can fit into memory
+ ///
+ /// -
+ /// DownloadToAsync
+ /// to stream blob content to a path or a
+ ///
+ ///
+ ///
+ public virtual async Task> DownloadStreamingAsync(
+ BlobDownloadOptions options = default,
+ CancellationToken cancellationToken = default)
+ {
+ return await DownloadStreamingDirect(
+ options?.Range ?? default,
+ options?.Conditions,
+ options?.TransferValidationOptions,
+ options?.ProgressHandler,
+ $"{nameof(BlobBaseClient)}.{nameof(DownloadStreaming)}",
+ async: true,
+ cancellationToken).ConfigureAwait(false);
+ }
///
/// Internal advanced download implementations should call into
@@ -1406,7 +1367,7 @@ public virtual async Task> DownloadStreami
///
///
///
- ///
+ ///
///
///
///
@@ -1415,7 +1376,7 @@ public virtual async Task> DownloadStreami
private async Task> DownloadStreamingDirect(
HttpRange range,
BlobRequestConditions conditions,
- bool rangeGetContentHash,
+ DownloadTransferValidationOptions transferValidationOverride,
IProgress progressHandler,
string operationName,
bool async,
@@ -1430,7 +1391,7 @@ private async Task> DownloadStreamingDirec
}
}
- var response = await DownloadStreamingInternal(range, conditions, rangeGetContentHash, progressHandler, operationName, async, cancellationToken).ConfigureAwait(false);
+ var response = await DownloadStreamingInternal(range, conditions, transferValidationOverride, progressHandler, operationName, async, cancellationToken).ConfigureAwait(false);
// if using clientside encryption, wrap the auto-retry stream in a decryptor
// we already return a nonseekable stream; returning a crypto stream is fine
@@ -1459,8 +1420,8 @@ private async Task> DownloadStreamingDirec
///
/// Access conditions.
///
- ///
- /// Whether to request an MD5 on download.
+ ///
+ /// Override options for transfer validation.
///
///
/// Progress handler.
@@ -1478,12 +1439,13 @@ private async Task> DownloadStreamingDirec
internal virtual async Task> DownloadStreamingInternal(
HttpRange range,
BlobRequestConditions conditions,
- bool rangeGetContentHash,
+ DownloadTransferValidationOptions transferValidationOverride,
IProgress progressHandler,
string operationName,
bool async,
CancellationToken cancellationToken)
{
+ DownloadTransferValidationOptions validationOptions = transferValidationOverride ?? ClientConfiguration.DownloadTransferValidationOptions;
using (ClientConfiguration.Pipeline.BeginLoggingScope(nameof(BlobBaseClient)))
{
ClientConfiguration.Pipeline.LogMethodEnter(nameof(BlobBaseClient), message: $"{nameof(Uri)}: {Uri}");
@@ -1498,7 +1460,7 @@ internal virtual async Task> DownloadStrea
Response response = await StartDownloadAsync(
range,
conditions,
- rangeGetContentHash,
+ validationOptions,
async: async,
cancellationToken: cancellationToken)
.ConfigureAwait(false);
@@ -1521,7 +1483,7 @@ internal virtual async Task> DownloadStrea
StartDownloadAsync(
range,
conditionsWithEtag,
- rangeGetContentHash,
+ validationOptions,
startOffset,
async,
cancellationToken)
@@ -1531,7 +1493,7 @@ internal virtual async Task> DownloadStrea
(await StartDownloadAsync(
range,
conditionsWithEtag,
- rangeGetContentHash,
+ validationOptions,
startOffset,
async,
cancellationToken)
@@ -1542,32 +1504,29 @@ internal virtual async Task> DownloadStrea
stream = stream.WithNoDispose().WithProgress(progressHandler);
- /* NOTE: we do not currently support both features together. This remains here for the
- * potential future where we do.
- * Comparing hash results comes BEFORE decryption.
- * Buffer response stream and ensure it matches the transactional hash if any.
- * Storage will not return a hash for payload >4MB, so this buffer is capped similarly.
- * Hashing is opt-in, so this buffer is part of that opt-in */
- // TODO #27253
- //if (options?.TransactionalHashingOptions != default && options.TransactionalHashingOptions.Validate)
- //{
- // // safe-buffer; transactional hash download limit well below maxInt
- // var readDestStream = new MemoryStream((int)response.Value.Details.ContentLength);
- // if (async)
- // {
- // await stream.CopyToAsync(readDestStream).ConfigureAwait(false);
- // }
- // else
- // {
- // stream.CopyTo(readDestStream);
- // }
- // readDestStream.Position = 0;
-
- // ContentHasher.AssertResponseHashMatch(readDestStream, options.TransactionalHashingOptions.Algorithm, response.GetRawResponse());
-
- // // we've consumed the network stream to hash it; return buffered stream to the user
- // stream = readDestStream;
- //}
+ /* Decryption handled by caller, so safe to check checksum now.
+ * Buffer response stream and ensure it matches the transactional checksum if any.
+ * Storage will not return a checksum for payload >4MB, so this buffer is capped similarly.
+ * Checksum validation is opt-in, so this buffer is part of that opt-in. */
+ if (validationOptions != default && validationOptions.Algorithm != ValidationAlgorithm.None && validationOptions.Validate)
+ {
+ // safe-buffer; transactional hash download limit well below maxInt
+ var readDestStream = new MemoryStream((int)response.Value.Details.ContentLength);
+ if (async)
+ {
+ await stream.CopyToAsync(readDestStream, 81920, cancellationToken).ConfigureAwait(false);
+ }
+ else
+ {
+ stream.CopyTo(readDestStream);
+ }
+ readDestStream.Position = 0;
+
+ ContentHasher.AssertResponseHashMatch(readDestStream, validationOptions.Algorithm, response.GetRawResponse());
+
+ // we've consumed the network stream to hash it; return buffered stream to the user
+ stream = readDestStream;
+ }
response.Value.Content = stream;
return response;
@@ -1598,13 +1557,10 @@ internal virtual async Task> DownloadStrea
/// Optional to add conditions on
/// downloading this blob.
///
- ///
- /// When set to true and specified together with the ,
- /// the service returns the MD5 hash for the range, as long as the
- /// range is less than or equal to 4 MB in size. If this value is
- /// specified without or set to true when the
- /// range exceeds 4 MB in size, a
- /// is thrown.
+ ///
+ /// Options for requesting a checksum.
+ /// This method will not check client options for this parameter and
+ /// expects defaults to have already been evaluated.
///
///
/// Starting offset to request - in the event of a retry.
@@ -1628,7 +1584,7 @@ internal virtual async Task> DownloadStrea
private async Task> StartDownloadAsync(
HttpRange range,
BlobRequestConditions conditions,
- bool rangeGetContentHash,
+ DownloadTransferValidationOptions validationOptions,
long startOffset = 0,
bool async = true,
CancellationToken cancellationToken = default)
@@ -1662,9 +1618,8 @@ private async Task> StartDownloadAsync(
response = await BlobRestClient.DownloadAsync(
range: pageRange?.ToString(),
leaseId: conditions?.LeaseId,
- // TODO #27253
- rangeGetContentMD5: rangeGetContentHash ? true : null, // options?.TransactionalHashingOptions?.Algorithm == TransactionalHashAlgorithm.MD5 ? true : null,
- //rangeGetContentCRC64: options?.TransactionalHashingOptions?.Algorithm == TransactionalHashAlgorithm.StorageCrc64 ? true : null,
+ rangeGetContentMD5: validationOptions?.Algorithm.ResolveAuto() == ValidationAlgorithm.MD5 ? true : null,
+ rangeGetContentCRC64: validationOptions?.Algorithm.ResolveAuto() == ValidationAlgorithm.StorageCrc64 ? true : null,
encryptionKey: ClientConfiguration.CustomerProvidedKey?.EncryptionKey,
encryptionKeySha256: ClientConfiguration.CustomerProvidedKey?.EncryptionKeyHash,
encryptionAlgorithm: ClientConfiguration.CustomerProvidedKey?.EncryptionAlgorithm == null ? null : EncryptionAlgorithmTypeInternal.AES256,
@@ -1681,9 +1636,8 @@ private async Task> StartDownloadAsync(
response = BlobRestClient.Download(
range: pageRange?.ToString(),
leaseId: conditions?.LeaseId,
- // TODO #27253
- rangeGetContentMD5: rangeGetContentHash ? true : null, // options?.TransactionalHashingOptions?.Algorithm == TransactionalHashAlgorithm.MD5 ? true : null,
- //rangeGetContentCRC64: options?.TransactionalHashingOptions?.Algorithm == TransactionalHashAlgorithm.StorageCrc64 ? true : null,
+ rangeGetContentMD5: validationOptions?.Algorithm.ResolveAuto() == ValidationAlgorithm.MD5 ? true : null,
+ rangeGetContentCRC64: validationOptions?.Algorithm.ResolveAuto() == ValidationAlgorithm.StorageCrc64 ? true : null,
encryptionKey: ClientConfiguration.CustomerProvidedKey?.EncryptionKey,
encryptionKeySha256: ClientConfiguration.CustomerProvidedKey?.EncryptionKeyHash,
encryptionAlgorithm: ClientConfiguration.CustomerProvidedKey?.EncryptionAlgorithm == null ? null : EncryptionAlgorithmTypeInternal.AES256,
@@ -1913,6 +1867,7 @@ public virtual Response DownloadContent(
conditions,
progressHandler: default,
range: default,
+ transferValidationOverride: default,
false, // async
cancellationToken)
.EnsureCompleted();
@@ -1968,6 +1923,7 @@ await DownloadContentInternal(
conditions,
progressHandler: default,
range: default,
+ transferValidationOverride: default,
true, // async
cancellationToken)
.ConfigureAwait(false);
@@ -2020,15 +1976,19 @@ await DownloadContentInternal(
///
///
///
+#pragma warning disable AZC0002 // DO ensure all service methods, both asynchronous and synchronous, take an optional CancellationToken parameter called cancellationToken.
+ [EditorBrowsable(EditorBrowsableState.Never)]
public virtual Response DownloadContent(
- BlobRequestConditions conditions = default,
- IProgress progressHandler = default,
- HttpRange range = default,
- CancellationToken cancellationToken = default) =>
+#pragma warning restore AZC0002 // DO ensure all service methods, both asynchronous and synchronous, take an optional CancellationToken parameter called cancellationToken.
+ BlobRequestConditions conditions,
+ IProgress progressHandler,
+ HttpRange range,
+ CancellationToken cancellationToken) =>
DownloadContentInternal(
conditions,
progressHandler,
range,
+ transferValidationOverride: default,
false, // async
cancellationToken)
.EnsureCompleted();
@@ -2081,30 +2041,137 @@ public virtual Response DownloadContent(
///
///
///
+#pragma warning disable AZC0002 // DO ensure all service methods, both asynchronous and synchronous, take an optional CancellationToken parameter called cancellationToken.
+ [EditorBrowsable(EditorBrowsableState.Never)]
public virtual async Task> DownloadContentAsync(
- BlobRequestConditions conditions = default,
- IProgress progressHandler = default,
- HttpRange range = default,
- CancellationToken cancellationToken = default) =>
+#pragma warning restore AZC0002 // DO ensure all service methods, both asynchronous and synchronous, take an optional CancellationToken parameter called cancellationToken.
+ BlobRequestConditions conditions,
+ IProgress progressHandler,
+ HttpRange range,
+ CancellationToken cancellationToken) =>
await DownloadContentInternal(
conditions,
progressHandler,
range,
+ transferValidationOverride: default,
true, // async
cancellationToken)
.ConfigureAwait(false);
+ ///
+ /// The
+ /// operation downloads a blob from the service, including its metadata
+ /// and properties.
+ ///
+ /// For more information, see
+ ///
+ /// Get Blob.
+ ///
+ ///
+ /// Optional parameters for download operation.
+ ///
+ ///
+ /// Optional to propagate
+ /// notifications that the operation should be cancelled.
+ ///
+ ///
+ /// A describing the
+ /// downloaded blob. contains
+ /// the blob's data.
+ ///
+ ///
+ /// A will be thrown if
+ /// a failure occurs.
+ ///
+ /// This API is a prefered way to fetch blobs that can fit into memory.
+ /// The content is provided as that provides a lightweight abstraction for a payload of bytes.
+ /// It provides convenient helper methods to get out commonly used primitives, such as streams, strings, or bytes.
+ /// Consider the following alternatives:
+ ///
+ /// -
+ /// DownloadToAsync
+ /// to stream blob content to a path or a
+ ///
+ /// -
+ /// DownloadStreamingAsync
+ /// as a replacement to this API. Use it to access network stream directly for any advanced scenario.
+ ///
+ ///
+ ///
+ public virtual Response DownloadContent(
+ BlobDownloadOptions options,
+ CancellationToken cancellationToken = default) =>
+ DownloadContentInternal(
+ options?.Conditions,
+ options?.ProgressHandler,
+ options?.Range ?? default,
+ options?.TransferValidationOptions,
+ async: false,
+ cancellationToken).EnsureCompleted();
+
+ ///
+ /// The
+ /// operation downloads a blob from the service, including its metadata
+ /// and properties.
+ ///
+ /// For more information, see
+ ///
+ /// Get Blob.
+ ///
+ ///
+ /// Optional parameters for download operation.
+ ///
+ ///
+ /// Optional to propagate
+ /// notifications that the operation should be cancelled.
+ ///
+ ///
+ /// A describing the
+ /// downloaded blob. contains
+ /// the blob's data.
+ ///
+ ///
+ /// A will be thrown if
+ /// a failure occurs.
+ ///
+ /// This API is a prefered way to fetch blobs that can fit into memory.
+ /// The content is provided as that provides a lightweight abstraction for a payload of bytes.
+ /// It provides convenient helper methods to get out commonly used primitives, such as streams, strings, or bytes.
+ /// Consider the following alternatives:
+ ///
+ /// -
+ /// DownloadToAsync
+ /// to stream blob content to a path or a
+ ///
+ /// -
+ /// DownloadStreamingAsync
+ /// as a replacement to this API. Use it to access network stream directly for any advanced scenario.
+ ///
+ ///
+ ///
+ public virtual async Task> DownloadContentAsync(
+ BlobDownloadOptions options,
+ CancellationToken cancellationToken = default) =>
+ await DownloadContentInternal(
+ options?.Conditions,
+ options?.ProgressHandler,
+ options?.Range ?? default,
+ options?.TransferValidationOptions,
+ async: true,
+ cancellationToken).ConfigureAwait(false);
+
private async Task> DownloadContentInternal(
BlobRequestConditions conditions,
IProgress progressHandler,
HttpRange range,
+ DownloadTransferValidationOptions transferValidationOverride,
bool async,
CancellationToken cancellationToken)
{
Response response = await DownloadStreamingDirect(
range,
conditions,
- rangeGetContentHash: default,
+ transferValidationOverride: transferValidationOverride,
progressHandler,
$"{nameof(BlobBaseClient)}.{nameof(DownloadContent)}",
async: async,
@@ -2346,8 +2413,7 @@ public virtual Response DownloadTo(
options?.Conditions,
options?.ProgressHandler,
options?.TransferOptions ?? default,
- // TODO #27253
- //options?.TransactionalHashingOptions,
+ options?.TransferValidationOptions,
async: false,
cancellationToken: cancellationToken)
.EnsureCompleted();
@@ -2386,8 +2452,7 @@ public virtual Response DownloadTo(
options?.Conditions,
options?.ProgressHandler,
options?.TransferOptions ?? default,
- // TODO #27253
- //options?.TransactionalHashingOptions,
+ options?.TransferValidationOptions,
async: false,
cancellationToken: cancellationToken)
.EnsureCompleted();
@@ -2425,8 +2490,7 @@ public virtual async Task DownloadToAsync(
options?.Conditions,
options?.ProgressHandler,
options?.TransferOptions ?? default,
- // TODO #27253
- //options?.TransactionalHashingOptions,
+ options?.TransferValidationOptions,
async: true,
cancellationToken: cancellationToken)
.ConfigureAwait(false);
@@ -2465,8 +2529,7 @@ public virtual async Task DownloadToAsync(
options?.Conditions,
options?.ProgressHandler,
options?.TransferOptions ?? default,
- // TODO #27253
- //options?.TransactionalHashingOptions,
+ options?.TransferValidationOptions,
async: true,
cancellationToken: cancellationToken)
.ConfigureAwait(false);
@@ -2686,6 +2749,9 @@ public virtual async Task DownloadToAsync(
/// Optional to configure
/// parallel transfer behavior.
///
+ ///
+ /// Override for client options on transfer validation.
+ ///
///
/// Whether to invoke the operation asynchronously.
///
@@ -2705,22 +2771,16 @@ internal async Task StagedDownloadAsync(
BlobRequestConditions conditions = default,
IProgress progressHandler = default,
StorageTransferOptions transferOptions = default,
- // TODO #27253
- //DownloadTransactionalHashingOptions hashingOptions = default,
+ DownloadTransferValidationOptions validationOptionsOverride = default,
bool async = true,
CancellationToken cancellationToken = default)
{
- // TODO #27253
- PartitionedDownloader downloader = new PartitionedDownloader(this, transferOptions, /*hashingOptions,*/ progressHandler);
+ DownloadTransferValidationOptions validationOptions = validationOptionsOverride ?? ClientConfiguration.DownloadTransferValidationOptions;
+
+ PartitionedDownloader downloader = new PartitionedDownloader(this, transferOptions, validationOptions, progressHandler);
if (UsingClientSideEncryption)
{
- // TODO #27253
- //if (hashingOptions != default)
- //{
- // throw Errors.TransactionalHashingNotSupportedWithClientSideEncryption();
- //}
-
ClientSideDecryptor.BeginContentEncryptionKeyCaching();
}
if (async)
@@ -2760,8 +2820,7 @@ public virtual Stream OpenRead(
options?.BufferSize,
options?.Conditions,
allowModifications: options?.AllowModifications ?? false,
- // TODO #27253
- //hashingOptions: options?.TransactionalHashingOptions,
+ validationOptionsOverride: options?.TransferValidationOptions,
async: false,
cancellationToken).EnsureCompleted();
@@ -2790,8 +2849,7 @@ public virtual async Task OpenReadAsync(
options?.BufferSize,
options?.Conditions,
allowModifications: options?.AllowModifications ?? false,
- // TODO #27253
- //hashingOptions: options?.TransactionalHashingOptions,
+ validationOptionsOverride: options?.TransferValidationOptions,
async: true,
cancellationToken).ConfigureAwait(false);
@@ -2832,8 +2890,7 @@ public virtual Stream OpenRead(
bufferSize,
conditions,
allowModifications: false,
- // TODO #27253
- //hashingOptions: default,
+ validationOptionsOverride: default,
async: false,
cancellationToken).EnsureCompleted();
@@ -2911,8 +2968,7 @@ public virtual async Task OpenReadAsync(
bufferSize,
conditions,
allowModifications: false,
- // TODO #27253
- //hashingOptions: default,
+ validationOptionsOverride: default,
async: true,
cancellationToken).ConfigureAwait(false);
@@ -2973,6 +3029,9 @@ public virtual async Task OpenReadAsync(
///