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 02c30d9377d12..c4e2817f88fb1 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 @@ -1361,11 +1361,11 @@ public AppendBlobClient(System.Uri blobUri, Azure.Storage.StorageSharedKeyCreden 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; } [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] - public virtual Azure.Response AppendBlockFromUri(System.Uri sourceUri, Azure.HttpRange sourceRange = default(Azure.HttpRange), byte[] sourceContentHash = null, Azure.Storage.Blobs.Models.AppendBlobRequestConditions conditions = null, Azure.Storage.Blobs.Models.AppendBlobRequestConditions sourceConditions = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - public virtual Azure.Response AppendBlockFromUri(System.Uri sourceUri, Azure.Storage.Blobs.Models.AppendBlobAppendBlockFromUriOptions options, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + 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; } [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] - public virtual System.Threading.Tasks.Task> AppendBlockFromUriAsync(System.Uri sourceUri, Azure.HttpRange sourceRange = default(Azure.HttpRange), byte[] sourceContentHash = null, Azure.Storage.Blobs.Models.AppendBlobRequestConditions conditions = null, Azure.Storage.Blobs.Models.AppendBlobRequestConditions sourceConditions = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - public virtual System.Threading.Tasks.Task> AppendBlockFromUriAsync(System.Uri sourceUri, Azure.Storage.Blobs.Models.AppendBlobAppendBlockFromUriOptions options, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> AppendBlockFromUriAsync(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 System.Threading.Tasks.Task> AppendBlockFromUriAsync(System.Uri sourceUri, Azure.Storage.Blobs.Models.AppendBlobAppendBlockFromUriOptions options = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public virtual Azure.Response Create(Azure.Storage.Blobs.Models.AppendBlobCreateOptions options, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] public virtual Azure.Response Create(Azure.Storage.Blobs.Models.BlobHttpHeaders httpHeaders = null, System.Collections.Generic.IDictionary metadata = null, Azure.Storage.Blobs.Models.AppendBlobRequestConditions conditions = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } @@ -1546,11 +1546,11 @@ public BlockBlobClient(System.Uri blobUri, Azure.Storage.StorageSharedKeyCredent 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; } [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] - public virtual Azure.Response StageBlockFromUri(System.Uri sourceUri, string base64BlockId, Azure.HttpRange sourceRange = default(Azure.HttpRange), byte[] sourceContentHash = null, Azure.RequestConditions sourceConditions = null, Azure.Storage.Blobs.Models.BlobRequestConditions conditions = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - public virtual Azure.Response StageBlockFromUri(System.Uri sourceUri, string base64BlockId, Azure.Storage.Blobs.Models.StageBlockFromUriOptions options, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + 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; } [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] - public virtual System.Threading.Tasks.Task> StageBlockFromUriAsync(System.Uri sourceUri, string base64BlockId, Azure.HttpRange sourceRange = default(Azure.HttpRange), byte[] sourceContentHash = null, Azure.RequestConditions sourceConditions = null, Azure.Storage.Blobs.Models.BlobRequestConditions conditions = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - public virtual System.Threading.Tasks.Task> StageBlockFromUriAsync(System.Uri sourceUri, string base64BlockId, Azure.Storage.Blobs.Models.StageBlockFromUriOptions options, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> StageBlockFromUriAsync(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 System.Threading.Tasks.Task> StageBlockFromUriAsync(System.Uri sourceUri, string base64BlockId, Azure.Storage.Blobs.Models.StageBlockFromUriOptions options = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public virtual Azure.Response SyncUploadFromUri(System.Uri copySource, Azure.Storage.Blobs.Models.BlobSyncUploadFromUriOptions options, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public virtual Azure.Response SyncUploadFromUri(System.Uri copySource, bool overwrite = false, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public virtual System.Threading.Tasks.Task> SyncUploadFromUriAsync(System.Uri copySource, Azure.Storage.Blobs.Models.BlobSyncUploadFromUriOptions options, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } @@ -1608,12 +1608,12 @@ public PageBlobClient(System.Uri blobUri, Azure.Storage.StorageSharedKeyCredenti 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 UploadPagesFromUri(System.Uri sourceUri, Azure.HttpRange sourceRange, Azure.HttpRange range, Azure.Storage.Blobs.Models.PageBlobUploadPagesFromUriOptions options, System.Threading.CancellationToken cancellationToken = default(System.Threading.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 = null, Azure.Storage.Blobs.Models.PageBlobRequestConditions conditions = null, Azure.Storage.Blobs.Models.PageBlobRequestConditions sourceConditions = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - public virtual System.Threading.Tasks.Task> UploadPagesFromUriAsync(System.Uri sourceUri, Azure.HttpRange sourceRange, Azure.HttpRange range, Azure.Storage.Blobs.Models.PageBlobUploadPagesFromUriOptions options, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + 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; } + public virtual System.Threading.Tasks.Task> UploadPagesFromUriAsync(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 System.Threading.Tasks.Task> UploadPagesFromUriAsync(System.Uri sourceUri, Azure.HttpRange sourceRange, Azure.HttpRange range, byte[] sourceContentHash = null, Azure.Storage.Blobs.Models.PageBlobRequestConditions conditions = null, Azure.Storage.Blobs.Models.PageBlobRequestConditions sourceConditions = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> UploadPagesFromUriAsync(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; } public new Azure.Storage.Blobs.Specialized.PageBlobClient WithCustomerProvidedKey(Azure.Storage.Blobs.Models.CustomerProvidedKey? customerProvidedKey) { throw null; } public new Azure.Storage.Blobs.Specialized.PageBlobClient WithEncryptionScope(string encryptionScope) { throw null; } public new Azure.Storage.Blobs.Specialized.PageBlobClient WithSnapshot(string snapshot) { throw null; } diff --git a/sdk/storage/Azure.Storage.Blobs/src/AppendBlobClient.cs b/sdk/storage/Azure.Storage.Blobs/src/AppendBlobClient.cs index 19b80e01335b7..97102a4934ee8 100644 --- a/sdk/storage/Azure.Storage.Blobs/src/AppendBlobClient.cs +++ b/sdk/storage/Azure.Storage.Blobs/src/AppendBlobClient.cs @@ -1247,7 +1247,7 @@ internal async Task> AppendBlockInternal( /// public virtual Response AppendBlockFromUri( Uri sourceUri, - AppendBlobAppendBlockFromUriOptions options, + AppendBlobAppendBlockFromUriOptions options = default, CancellationToken cancellationToken = default) => AppendBlockFromUriInternal( sourceUri, @@ -1295,7 +1295,7 @@ public virtual Response AppendBlockFromUri( /// public virtual async Task> AppendBlockFromUriAsync( Uri sourceUri, - AppendBlobAppendBlockFromUriOptions options, + AppendBlobAppendBlockFromUriOptions options = default, CancellationToken cancellationToken = default) => await AppendBlockFromUriInternal( sourceUri, @@ -1363,13 +1363,15 @@ await AppendBlockFromUriInternal( /// a failure occurs. /// [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 AppendBlockFromUri( +#pragma warning restore AZC0002 // DO ensure all service methods, both asynchronous and synchronous, take an optional CancellationToken parameter called cancellationToken. Uri sourceUri, - HttpRange sourceRange = default, - byte[] sourceContentHash = default, - AppendBlobRequestConditions conditions = default, - AppendBlobRequestConditions sourceConditions = default, - CancellationToken cancellationToken = default) => + HttpRange sourceRange, + byte[] sourceContentHash, + AppendBlobRequestConditions conditions, + AppendBlobRequestConditions sourceConditions, + CancellationToken cancellationToken) => AppendBlockFromUriInternal( sourceUri, sourceRange, @@ -1436,13 +1438,15 @@ public virtual Response AppendBlockFromUri( /// a failure occurs. /// [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> AppendBlockFromUriAsync( +#pragma warning restore AZC0002 // DO ensure all service methods, both asynchronous and synchronous, take an optional CancellationToken parameter called cancellationToken. Uri sourceUri, - HttpRange sourceRange = default, - byte[] sourceContentHash = default, - AppendBlobRequestConditions conditions = default, - AppendBlobRequestConditions sourceConditions = default, - CancellationToken cancellationToken = default) => + HttpRange sourceRange, + byte[] sourceContentHash, + AppendBlobRequestConditions conditions, + AppendBlobRequestConditions sourceConditions, + CancellationToken cancellationToken) => await AppendBlockFromUriInternal( sourceUri, sourceRange, diff --git a/sdk/storage/Azure.Storage.Blobs/src/BlockBlobClient.cs b/sdk/storage/Azure.Storage.Blobs/src/BlockBlobClient.cs index c082309b2cf28..bc359d98f4f78 100644 --- a/sdk/storage/Azure.Storage.Blobs/src/BlockBlobClient.cs +++ b/sdk/storage/Azure.Storage.Blobs/src/BlockBlobClient.cs @@ -1253,16 +1253,16 @@ internal virtual async Task> StageBlockInternal( public virtual Response StageBlockFromUri( Uri sourceUri, string base64BlockId, - StageBlockFromUriOptions options, + StageBlockFromUriOptions options = default, CancellationToken cancellationToken = default) => StageBlockFromUriInternal( sourceUri, base64BlockId, - options.SourceRange, - options.SourceContentHash, - options.SourceConditions, - options.DestinationConditions, - options.SourceAuthentication, + options?.SourceRange ?? default, + options?.SourceContentHash, + options?.SourceConditions, + options?.DestinationConditions, + options?.SourceAuthentication, async: false, cancellationToken) .EnsureCompleted(); @@ -1309,16 +1309,16 @@ public virtual Response StageBlockFromUri( public virtual async Task> StageBlockFromUriAsync( Uri sourceUri, string base64BlockId, - StageBlockFromUriOptions options, + StageBlockFromUriOptions options = default, CancellationToken cancellationToken = default) => await StageBlockFromUriInternal( sourceUri, base64BlockId, - options.SourceRange, - options.SourceContentHash, - options.SourceConditions, - options.DestinationConditions, - options.SourceAuthentication, + options?.SourceRange ?? default, + options?.SourceContentHash, + options?.SourceConditions, + options?.DestinationConditions, + options?.SourceAuthentication, async: true, cancellationToken) .ConfigureAwait(false); @@ -1384,14 +1384,16 @@ await StageBlockFromUriInternal( /// a failure occurs. /// [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 StageBlockFromUri( +#pragma warning restore AZC0002 // DO ensure all service methods, both asynchronous and synchronous, take an optional CancellationToken parameter called cancellationToken. Uri sourceUri, string base64BlockId, - HttpRange sourceRange = default, - byte[] sourceContentHash = default, - RequestConditions sourceConditions = default, - BlobRequestConditions conditions = default, - CancellationToken cancellationToken = default) => + HttpRange sourceRange, + byte[] sourceContentHash, + RequestConditions sourceConditions, + BlobRequestConditions conditions, + CancellationToken cancellationToken) => StageBlockFromUriInternal( sourceUri, base64BlockId, @@ -1465,14 +1467,16 @@ public virtual Response StageBlockFromUri( /// a failure occurs. /// [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> StageBlockFromUriAsync( +#pragma warning restore AZC0002 // DO ensure all service methods, both asynchronous and synchronous, take an optional CancellationToken parameter called cancellationToken. Uri sourceUri, string base64BlockId, - HttpRange sourceRange = default, - byte[] sourceContentHash = default, - RequestConditions sourceConditions = default, - BlobRequestConditions conditions = default, - CancellationToken cancellationToken = default) => + HttpRange sourceRange, + byte[] sourceContentHash, + RequestConditions sourceConditions, + BlobRequestConditions conditions, + CancellationToken cancellationToken) => await StageBlockFromUriInternal( sourceUri, base64BlockId, diff --git a/sdk/storage/Azure.Storage.Blobs/src/PageBlobClient.cs b/sdk/storage/Azure.Storage.Blobs/src/PageBlobClient.cs index 705197181ba26..8728347006eeb 100644 --- a/sdk/storage/Azure.Storage.Blobs/src/PageBlobClient.cs +++ b/sdk/storage/Azure.Storage.Blobs/src/PageBlobClient.cs @@ -3051,16 +3051,16 @@ public virtual Response UploadPagesFromUri( Uri sourceUri, HttpRange sourceRange, HttpRange range, - PageBlobUploadPagesFromUriOptions options, + PageBlobUploadPagesFromUriOptions options = default, CancellationToken cancellationToken = default) => UploadPagesFromUriInternal( sourceUri, sourceRange, range, - options.SourceContentHash, - options.DestinationConditions, - options.SourceConditions, - options.SourceAuthentication, + options?.SourceContentHash, + options?.DestinationConditions, + options?.SourceConditions, + options?.SourceAuthentication, async: false, cancellationToken) .EnsureCompleted(); @@ -3112,16 +3112,16 @@ public virtual async Task> UploadPagesFromUriAsync( Uri sourceUri, HttpRange sourceRange, HttpRange range, - PageBlobUploadPagesFromUriOptions options, + PageBlobUploadPagesFromUriOptions options = default, CancellationToken cancellationToken = default) => await UploadPagesFromUriInternal( sourceUri, sourceRange, range, - options.SourceContentHash, - options.DestinationConditions, - options.SourceConditions, - options.SourceAuthentication, + options?.SourceContentHash, + options?.DestinationConditions, + options?.SourceConditions, + options?.SourceAuthentication, async: true, cancellationToken) .ConfigureAwait(false); @@ -3185,14 +3185,16 @@ await UploadPagesFromUriInternal( /// a failure occurs. /// [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 UploadPagesFromUri( +#pragma warning restore AZC0002 // DO ensure all service methods, both asynchronous and synchronous, take an optional CancellationToken parameter called cancellationToken. Uri sourceUri, HttpRange sourceRange, HttpRange range, - byte[] sourceContentHash = default, - PageBlobRequestConditions conditions = default, - PageBlobRequestConditions sourceConditions = default, - CancellationToken cancellationToken = default) => + byte[] sourceContentHash, + PageBlobRequestConditions conditions, + PageBlobRequestConditions sourceConditions, + CancellationToken cancellationToken) => UploadPagesFromUriInternal( sourceUri, sourceRange, @@ -3264,14 +3266,16 @@ public virtual Response UploadPagesFromUri( /// a failure occurs. /// [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> UploadPagesFromUriAsync( +#pragma warning restore AZC0002 // DO ensure all service methods, both asynchronous and synchronous, take an optional CancellationToken parameter called cancellationToken. Uri sourceUri, HttpRange sourceRange, HttpRange range, - byte[] sourceContentHash = default, - PageBlobRequestConditions conditions = default, - PageBlobRequestConditions sourceConditions = default, - CancellationToken cancellationToken = default) => + byte[] sourceContentHash, + PageBlobRequestConditions conditions, + PageBlobRequestConditions sourceConditions, + CancellationToken cancellationToken) => await UploadPagesFromUriInternal( sourceUri, sourceRange, diff --git a/sdk/storage/Azure.Storage.Blobs/tests/AppendBlobClientTests.cs b/sdk/storage/Azure.Storage.Blobs/tests/AppendBlobClientTests.cs index f4a861686cf2f..345c8aa753e19 100644 --- a/sdk/storage/Azure.Storage.Blobs/tests/AppendBlobClientTests.cs +++ b/sdk/storage/Azure.Storage.Blobs/tests/AppendBlobClientTests.cs @@ -994,8 +994,13 @@ public async Task AppendBlockFromUriAsync_Min() AppendBlobClient destBlob = InstrumentClient(test.Container.GetAppendBlobClient(GetNewBlobName())); await destBlob.CreateIfNotExistsAsync(); + AppendBlobAppendBlockFromUriOptions options = new AppendBlobAppendBlockFromUriOptions + { + SourceRange = new HttpRange(0, Constants.KB) + }; + // Act - await destBlob.AppendBlockFromUriAsync(sourceBlob.Uri, new HttpRange(0, Constants.KB)); + await destBlob.AppendBlockFromUriAsync(sourceBlob.Uri, options); } } @@ -1066,10 +1071,15 @@ public async Task AppendBlockFromUriAsync_CPK() destBlob = InstrumentClient(destBlob.WithCustomerProvidedKey(customerProvidedKey)); await destBlob.CreateIfNotExistsAsync(); + AppendBlobAppendBlockFromUriOptions options = new AppendBlobAppendBlockFromUriOptions + { + SourceRange = new HttpRange(0, Constants.KB) + }; + // Act Response response = await destBlob.AppendBlockFromUriAsync( sourceBlob.Uri, - new HttpRange(0, Constants.KB)); + options); Assert.AreEqual(customerProvidedKey.EncryptionKeyHash, response.Value.EncryptionKeySha256); } @@ -1096,10 +1106,15 @@ public async Task AppendBlockFromUriAsync_EncryptionScope() destBlob = InstrumentClient(destBlob.WithEncryptionScope(TestConfigDefault.EncryptionScope)); await destBlob.CreateIfNotExistsAsync(); + AppendBlobAppendBlockFromUriOptions options = new AppendBlobAppendBlockFromUriOptions + { + SourceRange = new HttpRange(0, Constants.KB) + }; + // Act Response response = await destBlob.AppendBlockFromUriAsync( sourceBlob.Uri, - new HttpRange(0, Constants.KB)); + options); Assert.AreEqual(TestConfigDefault.EncryptionScope, response.Value.EncryptionScope); } diff --git a/sdk/storage/Azure.Storage.Blobs/tests/PageBlobClientTests.cs b/sdk/storage/Azure.Storage.Blobs/tests/PageBlobClientTests.cs index ae40a6c3d01bb..25312e73d62a8 100644 --- a/sdk/storage/Azure.Storage.Blobs/tests/PageBlobClientTests.cs +++ b/sdk/storage/Azure.Storage.Blobs/tests/PageBlobClientTests.cs @@ -2520,13 +2520,18 @@ public async Task UploadPagesFromUriAsync_InvalidSourceRequestConditions(string HttpRange httpRange = new HttpRange(0, 1); + PageBlobUploadPagesFromUriOptions options = new PageBlobUploadPagesFromUriOptions + { + SourceConditions = sourceConditions + }; + // Act await TestHelper.AssertExpectedExceptionAsync( pageBlobClient.UploadPagesFromUriAsync( uri, httpRange, httpRange, - sourceConditions: sourceConditions), + options), e => { Assert.IsTrue(e.Message.Contains($"UploadPagesFromUri does not support the {invalidSourceCondition} condition(s).")); diff --git a/sdk/storage/Azure.Storage.Files.Shares/api/Azure.Storage.Files.Shares.netstandard2.0.cs b/sdk/storage/Azure.Storage.Files.Shares/api/Azure.Storage.Files.Shares.netstandard2.0.cs index 1c694999c168b..ce811bddb527f 100644 --- a/sdk/storage/Azure.Storage.Files.Shares/api/Azure.Storage.Files.Shares.netstandard2.0.cs +++ b/sdk/storage/Azure.Storage.Files.Shares/api/Azure.Storage.Files.Shares.netstandard2.0.cs @@ -284,13 +284,13 @@ public ShareFileClient(System.Uri fileUri, Azure.Storage.StorageSharedKeyCredent [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] public virtual System.Threading.Tasks.Task> UploadRangeAsync(Azure.Storage.Files.Shares.Models.ShareFileRangeWriteType writeType, Azure.HttpRange range, System.IO.Stream content, byte[] transactionalContentHash = null, 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 UploadRangeFromUri(System.Uri sourceUri, Azure.HttpRange range, Azure.HttpRange sourceRange, Azure.Storage.Files.Shares.Models.ShareFileRequestConditions conditions = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - public virtual Azure.Response UploadRangeFromUri(System.Uri sourceUri, Azure.HttpRange range, Azure.HttpRange sourceRange, Azure.Storage.Files.Shares.Models.ShareFileUploadRangeFromUriOptions options, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response UploadRangeFromUri(System.Uri sourceUri, Azure.HttpRange range, Azure.HttpRange sourceRange, Azure.Storage.Files.Shares.Models.ShareFileRequestConditions conditions, System.Threading.CancellationToken cancellationToken) { throw null; } + public virtual Azure.Response UploadRangeFromUri(System.Uri sourceUri, Azure.HttpRange range, Azure.HttpRange sourceRange, Azure.Storage.Files.Shares.Models.ShareFileUploadRangeFromUriOptions options = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] public virtual Azure.Response UploadRangeFromUri(System.Uri sourceUri, Azure.HttpRange range, Azure.HttpRange sourceRange, System.Threading.CancellationToken cancellationToken) { throw null; } [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] - public virtual System.Threading.Tasks.Task> UploadRangeFromUriAsync(System.Uri sourceUri, Azure.HttpRange range, Azure.HttpRange sourceRange, Azure.Storage.Files.Shares.Models.ShareFileRequestConditions conditions = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - public virtual System.Threading.Tasks.Task> UploadRangeFromUriAsync(System.Uri sourceUri, Azure.HttpRange range, Azure.HttpRange sourceRange, Azure.Storage.Files.Shares.Models.ShareFileUploadRangeFromUriOptions options, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> UploadRangeFromUriAsync(System.Uri sourceUri, Azure.HttpRange range, Azure.HttpRange sourceRange, Azure.Storage.Files.Shares.Models.ShareFileRequestConditions conditions, System.Threading.CancellationToken cancellationToken) { throw null; } + public virtual System.Threading.Tasks.Task> UploadRangeFromUriAsync(System.Uri sourceUri, Azure.HttpRange range, Azure.HttpRange sourceRange, Azure.Storage.Files.Shares.Models.ShareFileUploadRangeFromUriOptions 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> UploadRangeFromUriAsync(System.Uri sourceUri, Azure.HttpRange range, Azure.HttpRange sourceRange, System.Threading.CancellationToken cancellationToken) { throw null; } public virtual Azure.Storage.Files.Shares.ShareFileClient WithSnapshot(string shareSnapshot) { throw null; } diff --git a/sdk/storage/Azure.Storage.Files.Shares/src/ShareFileClient.cs b/sdk/storage/Azure.Storage.Files.Shares/src/ShareFileClient.cs index 5f9680ffec4f7..d121fd80786bc 100644 --- a/sdk/storage/Azure.Storage.Files.Shares/src/ShareFileClient.cs +++ b/sdk/storage/Azure.Storage.Files.Shares/src/ShareFileClient.cs @@ -3897,7 +3897,7 @@ public virtual Response UploadRangeFromUri( Uri sourceUri, HttpRange range, HttpRange sourceRange, - ShareFileUploadRangeFromUriOptions options, + ShareFileUploadRangeFromUriOptions options = default, CancellationToken cancellationToken = default) => UploadRangeFromUriInternal( sourceUri: sourceUri, @@ -3943,7 +3943,7 @@ public virtual async Task> UploadRangeFromUriAsync Uri sourceUri, HttpRange range, HttpRange sourceRange, - ShareFileUploadRangeFromUriOptions options, + ShareFileUploadRangeFromUriOptions options = default, CancellationToken cancellationToken = default) => await UploadRangeFromUriInternal( sourceUri: sourceUri, @@ -3987,12 +3987,14 @@ await UploadRangeFromUriInternal( /// a failure occurs. /// [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 UploadRangeFromUri( +#pragma warning restore AZC0002 // DO ensure all service methods, both asynchronous and synchronous, take an optional CancellationToken parameter called cancellationToken. Uri sourceUri, HttpRange range, HttpRange sourceRange, - ShareFileRequestConditions conditions = default, - CancellationToken cancellationToken = default) => + ShareFileRequestConditions conditions, + CancellationToken cancellationToken) => UploadRangeFromUriInternal( sourceUri: sourceUri, range: range, @@ -4082,12 +4084,14 @@ public virtual Response UploadRangeFromUri( /// [EditorBrowsable(EditorBrowsableState.Never)] [ForwardsClientCalls] +#pragma warning disable AZC0002 // DO ensure all service methods, both asynchronous and synchronous, take an optional CancellationToken parameter called cancellationToken. public virtual async Task> UploadRangeFromUriAsync( +#pragma warning restore AZC0002 // DO ensure all service methods, both asynchronous and synchronous, take an optional CancellationToken parameter called cancellationToken. Uri sourceUri, HttpRange range, HttpRange sourceRange, - ShareFileRequestConditions conditions = default, - CancellationToken cancellationToken = default) => + ShareFileRequestConditions conditions, + CancellationToken cancellationToken) => await UploadRangeFromUriInternal( sourceUri: sourceUri, range: range, diff --git a/sdk/storage/Azure.Storage.Files.Shares/tests/FileClientTests.cs b/sdk/storage/Azure.Storage.Files.Shares/tests/FileClientTests.cs index e6a8168d37343..16029f6653ebf 100644 --- a/sdk/storage/Azure.Storage.Files.Shares/tests/FileClientTests.cs +++ b/sdk/storage/Azure.Storage.Files.Shares/tests/FileClientTests.cs @@ -2808,12 +2808,17 @@ public async Task UploadRangeFromUriAsync_Lease() .GetDirectoryClient(directoryName) .GetFileClient(fileName)); + ShareFileUploadRangeFromUriOptions options = new ShareFileUploadRangeFromUriOptions + { + Conditions = conditions + }; + // Act await destFile.UploadRangeFromUriAsync( sourceUri: sasFile.Uri, range: destRange, sourceRange: sourceRange, - conditions: conditions); + options: options); } [Test] @@ -2856,13 +2861,18 @@ public async Task UploadRangeFromUriAsync_InvalidLease() .GetDirectoryClient(directoryName) .GetFileClient(fileName)); + ShareFileUploadRangeFromUriOptions options = new ShareFileUploadRangeFromUriOptions + { + Conditions = conditions + }; + // Act await TestHelper.AssertExpectedExceptionAsync( destFile.UploadRangeFromUriAsync( sourceUri: sasFile.Uri, range: destRange, sourceRange: sourceRange, - conditions: conditions), + options: options), e => Assert.AreEqual("LeaseNotPresentWithFileOperation", e.ErrorCode)); }