diff --git a/sdk/storage/Azure.Storage.DataMovement.Blobs/CHANGELOG.md b/sdk/storage/Azure.Storage.DataMovement.Blobs/CHANGELOG.md index bebb5e9bdab5..7b464913527b 100644 --- a/sdk/storage/Azure.Storage.DataMovement.Blobs/CHANGELOG.md +++ b/sdk/storage/Azure.Storage.DataMovement.Blobs/CHANGELOG.md @@ -5,7 +5,22 @@ ### Features Added ### Breaking Changes - +- [BREAKING CHANGE] Made the following members `public` to `protected` members (including all derived classes): + - `BlobStorageResourceContainer.CanProduceUri` + - `BlobStorageResourceContainer.GetStorageResourcesAsync` + - `*BlobStorageResource.CanProduceUri` + - `*BlobStorageResource.Length` + - `*BlobStorageResource.MaxChunkSize` + - `*BlobStorageResource.ResourceId` + - `*BlobStorageResource.TransferType` + - `*BlobStorageResource.CompleteTransferAsync` + - `*BlobStorageResource.CopyBlockFromUriAsync` + - `*BlobStorageResource.CopyFromUriAsync` + - `*BlobStorageResource.DeleteIfExistsAsync` + - `*BlobStorageResource.GetCopyAuthorizationHeaderAsync` + - `*BlobStorageResource.GetPropertiesAsync` + - `*BlobStorageResource.ReadStreamAsync` + - `*BlobStorageResource.WriteFromStreamAsync` ### Bugs Fixed ### Other Changes diff --git a/sdk/storage/Azure.Storage.DataMovement.Blobs/api/Azure.Storage.DataMovement.Blobs.net6.0.cs b/sdk/storage/Azure.Storage.DataMovement.Blobs/api/Azure.Storage.DataMovement.Blobs.net6.0.cs index 61307db7a24d..54930e267620 100644 --- a/sdk/storage/Azure.Storage.DataMovement.Blobs/api/Azure.Storage.DataMovement.Blobs.net6.0.cs +++ b/sdk/storage/Azure.Storage.DataMovement.Blobs/api/Azure.Storage.DataMovement.Blobs.net6.0.cs @@ -22,21 +22,21 @@ namespace Azure.Storage.DataMovement.Blobs public partial class AppendBlobStorageResource : Azure.Storage.DataMovement.StorageResourceSingle { public AppendBlobStorageResource(Azure.Storage.Blobs.Specialized.AppendBlobClient blobClient, Azure.Storage.DataMovement.Blobs.AppendBlobStorageResourceOptions options = null) { } - public override bool CanProduceUri { get { throw null; } } - public override long? Length { get { throw null; } } - public override long MaxChunkSize { get { throw null; } } + protected override bool CanProduceUri { get { throw null; } } + protected override long? Length { get { throw null; } } + protected override long MaxChunkSize { get { throw null; } } public override string Path { get { throw null; } } - public override string ResourceId { get { throw null; } } - public override Azure.Storage.DataMovement.TransferType TransferType { get { throw null; } } + protected override string ResourceId { get { throw null; } } + protected override Azure.Storage.DataMovement.TransferType TransferType { get { throw null; } } public override System.Uri Uri { get { throw null; } } - public override System.Threading.Tasks.Task CompleteTransferAsync(bool overwrite, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - public override System.Threading.Tasks.Task CopyBlockFromUriAsync(Azure.Storage.DataMovement.StorageResourceSingle sourceResource, Azure.HttpRange range, bool overwrite, long completeLength = (long)0, Azure.Storage.DataMovement.Models.StorageResourceCopyFromUriOptions options = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - public override System.Threading.Tasks.Task CopyFromUriAsync(Azure.Storage.DataMovement.StorageResourceSingle sourceResource, bool overwrite, long completeLength, Azure.Storage.DataMovement.Models.StorageResourceCopyFromUriOptions options = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - public override System.Threading.Tasks.Task DeleteIfExistsAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - public override System.Threading.Tasks.Task GetCopyAuthorizationHeaderAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - public override System.Threading.Tasks.Task GetPropertiesAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - public override System.Threading.Tasks.Task ReadStreamAsync(long position = (long)0, long? length = default(long?), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - public override System.Threading.Tasks.Task WriteFromStreamAsync(System.IO.Stream stream, long streamLength, bool overwrite, long position = (long)0, long completeLength = (long)0, Azure.Storage.DataMovement.Models.StorageResourceWriteToOffsetOptions options = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + protected override System.Threading.Tasks.Task CompleteTransferAsync(bool overwrite, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + protected override System.Threading.Tasks.Task CopyBlockFromUriAsync(Azure.Storage.DataMovement.StorageResourceSingle sourceResource, Azure.HttpRange range, bool overwrite, long completeLength = (long)0, Azure.Storage.DataMovement.Models.StorageResourceCopyFromUriOptions options = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + protected override System.Threading.Tasks.Task CopyFromUriAsync(Azure.Storage.DataMovement.StorageResourceSingle sourceResource, bool overwrite, long completeLength, Azure.Storage.DataMovement.Models.StorageResourceCopyFromUriOptions options = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + protected override System.Threading.Tasks.Task DeleteIfExistsAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + protected override System.Threading.Tasks.Task GetCopyAuthorizationHeaderAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + protected override System.Threading.Tasks.Task GetPropertiesAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + protected override System.Threading.Tasks.Task ReadStreamAsync(long position = (long)0, long? length = default(long?), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + protected override System.Threading.Tasks.Task WriteFromStreamAsync(System.IO.Stream stream, long streamLength, bool overwrite, long position = (long)0, long completeLength = (long)0, Azure.Storage.DataMovement.Models.StorageResourceWriteToOffsetOptions options = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } } public partial class AppendBlobStorageResourceOptions : Azure.Storage.DataMovement.Blobs.BlobStorageResourceOptions { @@ -47,11 +47,11 @@ public AppendBlobStorageResourceOptions() { } public partial class BlobStorageResourceContainer : Azure.Storage.DataMovement.StorageResourceContainer { public BlobStorageResourceContainer(Azure.Storage.Blobs.BlobContainerClient blobContainerClient, Azure.Storage.DataMovement.Blobs.BlobStorageResourceContainerOptions options = null) { } - public override bool CanProduceUri { get { throw null; } } + protected override bool CanProduceUri { get { throw null; } } public override string Path { get { throw null; } } public override System.Uri Uri { get { throw null; } } - public override Azure.Storage.DataMovement.StorageResourceSingle GetChildStorageResource(string path) { throw null; } - public override System.Collections.Generic.IAsyncEnumerable GetStorageResourcesAsync([System.Runtime.CompilerServices.EnumeratorCancellationAttribute] System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + protected override Azure.Storage.DataMovement.StorageResourceSingle GetChildStorageResource(string path) { throw null; } + protected override System.Collections.Generic.IAsyncEnumerable GetStorageResourcesAsync([System.Runtime.CompilerServices.EnumeratorCancellationAttribute] System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } } public partial class BlobStorageResourceContainerOptions { @@ -87,21 +87,21 @@ public static partial class BlobStorageResources public partial class BlockBlobStorageResource : Azure.Storage.DataMovement.StorageResourceSingle { public BlockBlobStorageResource(Azure.Storage.Blobs.Specialized.BlockBlobClient blobClient, Azure.Storage.DataMovement.Blobs.BlockBlobStorageResourceOptions options = null) { } - public override bool CanProduceUri { get { throw null; } } - public override long? Length { get { throw null; } } - public override long MaxChunkSize { get { throw null; } } + protected override bool CanProduceUri { get { throw null; } } + protected override long? Length { get { throw null; } } + protected override long MaxChunkSize { get { throw null; } } public override string Path { get { throw null; } } - public override string ResourceId { get { throw null; } } - public override Azure.Storage.DataMovement.TransferType TransferType { get { throw null; } } + protected override string ResourceId { get { throw null; } } + protected override Azure.Storage.DataMovement.TransferType TransferType { get { throw null; } } public override System.Uri Uri { get { throw null; } } - public override System.Threading.Tasks.Task CompleteTransferAsync(bool overwrite, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - public override System.Threading.Tasks.Task CopyBlockFromUriAsync(Azure.Storage.DataMovement.StorageResourceSingle sourceResource, Azure.HttpRange range, bool overwrite, long completeLength = (long)0, Azure.Storage.DataMovement.Models.StorageResourceCopyFromUriOptions options = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - public override System.Threading.Tasks.Task CopyFromUriAsync(Azure.Storage.DataMovement.StorageResourceSingle sourceResource, bool overwrite, long completeLength, Azure.Storage.DataMovement.Models.StorageResourceCopyFromUriOptions options = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - public override System.Threading.Tasks.Task DeleteIfExistsAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - public override System.Threading.Tasks.Task GetCopyAuthorizationHeaderAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - public override System.Threading.Tasks.Task GetPropertiesAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - public override System.Threading.Tasks.Task ReadStreamAsync(long position = (long)0, long? length = default(long?), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - public override System.Threading.Tasks.Task WriteFromStreamAsync(System.IO.Stream stream, long streamLength, bool overwrite, long position = (long)0, long completeLength = (long)0, Azure.Storage.DataMovement.Models.StorageResourceWriteToOffsetOptions options = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + protected override System.Threading.Tasks.Task CompleteTransferAsync(bool overwrite, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + protected override System.Threading.Tasks.Task CopyBlockFromUriAsync(Azure.Storage.DataMovement.StorageResourceSingle sourceResource, Azure.HttpRange range, bool overwrite, long completeLength = (long)0, Azure.Storage.DataMovement.Models.StorageResourceCopyFromUriOptions options = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + protected override System.Threading.Tasks.Task CopyFromUriAsync(Azure.Storage.DataMovement.StorageResourceSingle sourceResource, bool overwrite, long completeLength, Azure.Storage.DataMovement.Models.StorageResourceCopyFromUriOptions options = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + protected override System.Threading.Tasks.Task DeleteIfExistsAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + protected override System.Threading.Tasks.Task GetCopyAuthorizationHeaderAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + protected override System.Threading.Tasks.Task GetPropertiesAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + protected override System.Threading.Tasks.Task ReadStreamAsync(long position = (long)0, long? length = default(long?), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + protected override System.Threading.Tasks.Task WriteFromStreamAsync(System.IO.Stream stream, long streamLength, bool overwrite, long position = (long)0, long completeLength = (long)0, Azure.Storage.DataMovement.Models.StorageResourceWriteToOffsetOptions options = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } } public partial class BlockBlobStorageResourceOptions : Azure.Storage.DataMovement.Blobs.BlobStorageResourceOptions { @@ -112,21 +112,21 @@ public BlockBlobStorageResourceOptions() { } public partial class PageBlobStorageResource : Azure.Storage.DataMovement.StorageResourceSingle { public PageBlobStorageResource(Azure.Storage.Blobs.Specialized.PageBlobClient blobClient, Azure.Storage.DataMovement.Blobs.PageBlobStorageResourceOptions options = null) { } - public override bool CanProduceUri { get { throw null; } } - public override long? Length { get { throw null; } } - public override long MaxChunkSize { get { throw null; } } + protected override bool CanProduceUri { get { throw null; } } + protected override long? Length { get { throw null; } } + protected override long MaxChunkSize { get { throw null; } } public override string Path { get { throw null; } } - public override string ResourceId { get { throw null; } } - public override Azure.Storage.DataMovement.TransferType TransferType { get { throw null; } } + protected override string ResourceId { get { throw null; } } + protected override Azure.Storage.DataMovement.TransferType TransferType { get { throw null; } } public override System.Uri Uri { get { throw null; } } - public override System.Threading.Tasks.Task CompleteTransferAsync(bool overwrite, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - public override System.Threading.Tasks.Task CopyBlockFromUriAsync(Azure.Storage.DataMovement.StorageResourceSingle sourceResource, Azure.HttpRange range, bool overwrite, long completeLength = (long)0, Azure.Storage.DataMovement.Models.StorageResourceCopyFromUriOptions options = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - public override System.Threading.Tasks.Task CopyFromUriAsync(Azure.Storage.DataMovement.StorageResourceSingle sourceResource, bool overwrite, long completeLength, Azure.Storage.DataMovement.Models.StorageResourceCopyFromUriOptions options = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - public override System.Threading.Tasks.Task DeleteIfExistsAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - public override System.Threading.Tasks.Task GetCopyAuthorizationHeaderAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - public override System.Threading.Tasks.Task GetPropertiesAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - public override System.Threading.Tasks.Task ReadStreamAsync(long position = (long)0, long? length = default(long?), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - public override System.Threading.Tasks.Task WriteFromStreamAsync(System.IO.Stream stream, long streamLength, bool overwrite, long position = (long)0, long completeLength = (long)0, Azure.Storage.DataMovement.Models.StorageResourceWriteToOffsetOptions options = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + protected override System.Threading.Tasks.Task CompleteTransferAsync(bool overwrite, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + protected override System.Threading.Tasks.Task CopyBlockFromUriAsync(Azure.Storage.DataMovement.StorageResourceSingle sourceResource, Azure.HttpRange range, bool overwrite, long completeLength = (long)0, Azure.Storage.DataMovement.Models.StorageResourceCopyFromUriOptions options = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + protected override System.Threading.Tasks.Task CopyFromUriAsync(Azure.Storage.DataMovement.StorageResourceSingle sourceResource, bool overwrite, long completeLength, Azure.Storage.DataMovement.Models.StorageResourceCopyFromUriOptions options = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + protected override System.Threading.Tasks.Task DeleteIfExistsAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + protected override System.Threading.Tasks.Task GetCopyAuthorizationHeaderAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + protected override System.Threading.Tasks.Task GetPropertiesAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + protected override System.Threading.Tasks.Task ReadStreamAsync(long position = (long)0, long? length = default(long?), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + protected override System.Threading.Tasks.Task WriteFromStreamAsync(System.IO.Stream stream, long streamLength, bool overwrite, long position = (long)0, long completeLength = (long)0, Azure.Storage.DataMovement.Models.StorageResourceWriteToOffsetOptions options = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } } public partial class PageBlobStorageResourceOptions : Azure.Storage.DataMovement.Blobs.BlobStorageResourceOptions { diff --git a/sdk/storage/Azure.Storage.DataMovement.Blobs/api/Azure.Storage.DataMovement.Blobs.netstandard2.0.cs b/sdk/storage/Azure.Storage.DataMovement.Blobs/api/Azure.Storage.DataMovement.Blobs.netstandard2.0.cs index 61307db7a24d..54930e267620 100644 --- a/sdk/storage/Azure.Storage.DataMovement.Blobs/api/Azure.Storage.DataMovement.Blobs.netstandard2.0.cs +++ b/sdk/storage/Azure.Storage.DataMovement.Blobs/api/Azure.Storage.DataMovement.Blobs.netstandard2.0.cs @@ -22,21 +22,21 @@ namespace Azure.Storage.DataMovement.Blobs public partial class AppendBlobStorageResource : Azure.Storage.DataMovement.StorageResourceSingle { public AppendBlobStorageResource(Azure.Storage.Blobs.Specialized.AppendBlobClient blobClient, Azure.Storage.DataMovement.Blobs.AppendBlobStorageResourceOptions options = null) { } - public override bool CanProduceUri { get { throw null; } } - public override long? Length { get { throw null; } } - public override long MaxChunkSize { get { throw null; } } + protected override bool CanProduceUri { get { throw null; } } + protected override long? Length { get { throw null; } } + protected override long MaxChunkSize { get { throw null; } } public override string Path { get { throw null; } } - public override string ResourceId { get { throw null; } } - public override Azure.Storage.DataMovement.TransferType TransferType { get { throw null; } } + protected override string ResourceId { get { throw null; } } + protected override Azure.Storage.DataMovement.TransferType TransferType { get { throw null; } } public override System.Uri Uri { get { throw null; } } - public override System.Threading.Tasks.Task CompleteTransferAsync(bool overwrite, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - public override System.Threading.Tasks.Task CopyBlockFromUriAsync(Azure.Storage.DataMovement.StorageResourceSingle sourceResource, Azure.HttpRange range, bool overwrite, long completeLength = (long)0, Azure.Storage.DataMovement.Models.StorageResourceCopyFromUriOptions options = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - public override System.Threading.Tasks.Task CopyFromUriAsync(Azure.Storage.DataMovement.StorageResourceSingle sourceResource, bool overwrite, long completeLength, Azure.Storage.DataMovement.Models.StorageResourceCopyFromUriOptions options = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - public override System.Threading.Tasks.Task DeleteIfExistsAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - public override System.Threading.Tasks.Task GetCopyAuthorizationHeaderAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - public override System.Threading.Tasks.Task GetPropertiesAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - public override System.Threading.Tasks.Task ReadStreamAsync(long position = (long)0, long? length = default(long?), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - public override System.Threading.Tasks.Task WriteFromStreamAsync(System.IO.Stream stream, long streamLength, bool overwrite, long position = (long)0, long completeLength = (long)0, Azure.Storage.DataMovement.Models.StorageResourceWriteToOffsetOptions options = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + protected override System.Threading.Tasks.Task CompleteTransferAsync(bool overwrite, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + protected override System.Threading.Tasks.Task CopyBlockFromUriAsync(Azure.Storage.DataMovement.StorageResourceSingle sourceResource, Azure.HttpRange range, bool overwrite, long completeLength = (long)0, Azure.Storage.DataMovement.Models.StorageResourceCopyFromUriOptions options = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + protected override System.Threading.Tasks.Task CopyFromUriAsync(Azure.Storage.DataMovement.StorageResourceSingle sourceResource, bool overwrite, long completeLength, Azure.Storage.DataMovement.Models.StorageResourceCopyFromUriOptions options = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + protected override System.Threading.Tasks.Task DeleteIfExistsAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + protected override System.Threading.Tasks.Task GetCopyAuthorizationHeaderAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + protected override System.Threading.Tasks.Task GetPropertiesAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + protected override System.Threading.Tasks.Task ReadStreamAsync(long position = (long)0, long? length = default(long?), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + protected override System.Threading.Tasks.Task WriteFromStreamAsync(System.IO.Stream stream, long streamLength, bool overwrite, long position = (long)0, long completeLength = (long)0, Azure.Storage.DataMovement.Models.StorageResourceWriteToOffsetOptions options = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } } public partial class AppendBlobStorageResourceOptions : Azure.Storage.DataMovement.Blobs.BlobStorageResourceOptions { @@ -47,11 +47,11 @@ public AppendBlobStorageResourceOptions() { } public partial class BlobStorageResourceContainer : Azure.Storage.DataMovement.StorageResourceContainer { public BlobStorageResourceContainer(Azure.Storage.Blobs.BlobContainerClient blobContainerClient, Azure.Storage.DataMovement.Blobs.BlobStorageResourceContainerOptions options = null) { } - public override bool CanProduceUri { get { throw null; } } + protected override bool CanProduceUri { get { throw null; } } public override string Path { get { throw null; } } public override System.Uri Uri { get { throw null; } } - public override Azure.Storage.DataMovement.StorageResourceSingle GetChildStorageResource(string path) { throw null; } - public override System.Collections.Generic.IAsyncEnumerable GetStorageResourcesAsync([System.Runtime.CompilerServices.EnumeratorCancellationAttribute] System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + protected override Azure.Storage.DataMovement.StorageResourceSingle GetChildStorageResource(string path) { throw null; } + protected override System.Collections.Generic.IAsyncEnumerable GetStorageResourcesAsync([System.Runtime.CompilerServices.EnumeratorCancellationAttribute] System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } } public partial class BlobStorageResourceContainerOptions { @@ -87,21 +87,21 @@ public static partial class BlobStorageResources public partial class BlockBlobStorageResource : Azure.Storage.DataMovement.StorageResourceSingle { public BlockBlobStorageResource(Azure.Storage.Blobs.Specialized.BlockBlobClient blobClient, Azure.Storage.DataMovement.Blobs.BlockBlobStorageResourceOptions options = null) { } - public override bool CanProduceUri { get { throw null; } } - public override long? Length { get { throw null; } } - public override long MaxChunkSize { get { throw null; } } + protected override bool CanProduceUri { get { throw null; } } + protected override long? Length { get { throw null; } } + protected override long MaxChunkSize { get { throw null; } } public override string Path { get { throw null; } } - public override string ResourceId { get { throw null; } } - public override Azure.Storage.DataMovement.TransferType TransferType { get { throw null; } } + protected override string ResourceId { get { throw null; } } + protected override Azure.Storage.DataMovement.TransferType TransferType { get { throw null; } } public override System.Uri Uri { get { throw null; } } - public override System.Threading.Tasks.Task CompleteTransferAsync(bool overwrite, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - public override System.Threading.Tasks.Task CopyBlockFromUriAsync(Azure.Storage.DataMovement.StorageResourceSingle sourceResource, Azure.HttpRange range, bool overwrite, long completeLength = (long)0, Azure.Storage.DataMovement.Models.StorageResourceCopyFromUriOptions options = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - public override System.Threading.Tasks.Task CopyFromUriAsync(Azure.Storage.DataMovement.StorageResourceSingle sourceResource, bool overwrite, long completeLength, Azure.Storage.DataMovement.Models.StorageResourceCopyFromUriOptions options = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - public override System.Threading.Tasks.Task DeleteIfExistsAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - public override System.Threading.Tasks.Task GetCopyAuthorizationHeaderAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - public override System.Threading.Tasks.Task GetPropertiesAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - public override System.Threading.Tasks.Task ReadStreamAsync(long position = (long)0, long? length = default(long?), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - public override System.Threading.Tasks.Task WriteFromStreamAsync(System.IO.Stream stream, long streamLength, bool overwrite, long position = (long)0, long completeLength = (long)0, Azure.Storage.DataMovement.Models.StorageResourceWriteToOffsetOptions options = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + protected override System.Threading.Tasks.Task CompleteTransferAsync(bool overwrite, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + protected override System.Threading.Tasks.Task CopyBlockFromUriAsync(Azure.Storage.DataMovement.StorageResourceSingle sourceResource, Azure.HttpRange range, bool overwrite, long completeLength = (long)0, Azure.Storage.DataMovement.Models.StorageResourceCopyFromUriOptions options = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + protected override System.Threading.Tasks.Task CopyFromUriAsync(Azure.Storage.DataMovement.StorageResourceSingle sourceResource, bool overwrite, long completeLength, Azure.Storage.DataMovement.Models.StorageResourceCopyFromUriOptions options = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + protected override System.Threading.Tasks.Task DeleteIfExistsAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + protected override System.Threading.Tasks.Task GetCopyAuthorizationHeaderAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + protected override System.Threading.Tasks.Task GetPropertiesAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + protected override System.Threading.Tasks.Task ReadStreamAsync(long position = (long)0, long? length = default(long?), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + protected override System.Threading.Tasks.Task WriteFromStreamAsync(System.IO.Stream stream, long streamLength, bool overwrite, long position = (long)0, long completeLength = (long)0, Azure.Storage.DataMovement.Models.StorageResourceWriteToOffsetOptions options = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } } public partial class BlockBlobStorageResourceOptions : Azure.Storage.DataMovement.Blobs.BlobStorageResourceOptions { @@ -112,21 +112,21 @@ public BlockBlobStorageResourceOptions() { } public partial class PageBlobStorageResource : Azure.Storage.DataMovement.StorageResourceSingle { public PageBlobStorageResource(Azure.Storage.Blobs.Specialized.PageBlobClient blobClient, Azure.Storage.DataMovement.Blobs.PageBlobStorageResourceOptions options = null) { } - public override bool CanProduceUri { get { throw null; } } - public override long? Length { get { throw null; } } - public override long MaxChunkSize { get { throw null; } } + protected override bool CanProduceUri { get { throw null; } } + protected override long? Length { get { throw null; } } + protected override long MaxChunkSize { get { throw null; } } public override string Path { get { throw null; } } - public override string ResourceId { get { throw null; } } - public override Azure.Storage.DataMovement.TransferType TransferType { get { throw null; } } + protected override string ResourceId { get { throw null; } } + protected override Azure.Storage.DataMovement.TransferType TransferType { get { throw null; } } public override System.Uri Uri { get { throw null; } } - public override System.Threading.Tasks.Task CompleteTransferAsync(bool overwrite, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - public override System.Threading.Tasks.Task CopyBlockFromUriAsync(Azure.Storage.DataMovement.StorageResourceSingle sourceResource, Azure.HttpRange range, bool overwrite, long completeLength = (long)0, Azure.Storage.DataMovement.Models.StorageResourceCopyFromUriOptions options = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - public override System.Threading.Tasks.Task CopyFromUriAsync(Azure.Storage.DataMovement.StorageResourceSingle sourceResource, bool overwrite, long completeLength, Azure.Storage.DataMovement.Models.StorageResourceCopyFromUriOptions options = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - public override System.Threading.Tasks.Task DeleteIfExistsAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - public override System.Threading.Tasks.Task GetCopyAuthorizationHeaderAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - public override System.Threading.Tasks.Task GetPropertiesAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - public override System.Threading.Tasks.Task ReadStreamAsync(long position = (long)0, long? length = default(long?), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - public override System.Threading.Tasks.Task WriteFromStreamAsync(System.IO.Stream stream, long streamLength, bool overwrite, long position = (long)0, long completeLength = (long)0, Azure.Storage.DataMovement.Models.StorageResourceWriteToOffsetOptions options = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + protected override System.Threading.Tasks.Task CompleteTransferAsync(bool overwrite, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + protected override System.Threading.Tasks.Task CopyBlockFromUriAsync(Azure.Storage.DataMovement.StorageResourceSingle sourceResource, Azure.HttpRange range, bool overwrite, long completeLength = (long)0, Azure.Storage.DataMovement.Models.StorageResourceCopyFromUriOptions options = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + protected override System.Threading.Tasks.Task CopyFromUriAsync(Azure.Storage.DataMovement.StorageResourceSingle sourceResource, bool overwrite, long completeLength, Azure.Storage.DataMovement.Models.StorageResourceCopyFromUriOptions options = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + protected override System.Threading.Tasks.Task DeleteIfExistsAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + protected override System.Threading.Tasks.Task GetCopyAuthorizationHeaderAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + protected override System.Threading.Tasks.Task GetPropertiesAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + protected override System.Threading.Tasks.Task ReadStreamAsync(long position = (long)0, long? length = default(long?), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + protected override System.Threading.Tasks.Task WriteFromStreamAsync(System.IO.Stream stream, long streamLength, bool overwrite, long position = (long)0, long completeLength = (long)0, Azure.Storage.DataMovement.Models.StorageResourceWriteToOffsetOptions options = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } } public partial class PageBlobStorageResourceOptions : Azure.Storage.DataMovement.Blobs.BlobStorageResourceOptions { diff --git a/sdk/storage/Azure.Storage.DataMovement.Blobs/src/AppendBlobStorageResource.cs b/sdk/storage/Azure.Storage.DataMovement.Blobs/src/AppendBlobStorageResource.cs index eafc55b093eb..4765136b641f 100644 --- a/sdk/storage/Azure.Storage.DataMovement.Blobs/src/AppendBlobStorageResource.cs +++ b/sdk/storage/Azure.Storage.DataMovement.Blobs/src/AppendBlobStorageResource.cs @@ -19,13 +19,13 @@ public class AppendBlobStorageResource : StorageResourceSingle { internal AppendBlobClient BlobClient { get; set; } internal AppendBlobStorageResourceOptions _options; - private long? _length; - private ETag? _etagDownloadLock = default; + internal long? _length; + internal ETag? _etagDownloadLock = default; /// /// The identifier for the type of storage resource. /// - public override string ResourceId => "AppendBlob"; + protected override string ResourceId => "AppendBlob"; /// /// Gets the URL of the storage resource. @@ -40,24 +40,24 @@ public class AppendBlobStorageResource : StorageResourceSingle /// /// Defines whether the storage resource type can produce a web URL. /// - public override bool CanProduceUri => true; + protected override bool CanProduceUri => true; /// /// Defines the recommended Transfer Type for the storage resource. /// - public override TransferType TransferType => TransferType.Sequential; + protected override TransferType TransferType => TransferType.Sequential; /// /// Defines the maximum chunk size for the storage resource. /// - public override long MaxChunkSize => Constants.Blob.Append.MaxAppendBlockBytes; + protected override long MaxChunkSize => Constants.Blob.Append.MaxAppendBlockBytes; /// /// Length of the storage resource. This information is obtained during a GetStorageResources API call. /// /// Will return default if the length was not set by a GetStorageResources API call. /// - public override long? Length => _length; + protected override long? Length => _length; /// /// The constructor for a new instance of the @@ -104,7 +104,7 @@ internal AppendBlobStorageResource( /// notifications that the operation should be cancelled. /// /// The resulting from the upload operation. - public override async Task ReadStreamAsync( + protected override async Task ReadStreamAsync( long position = 0, long? length = default, CancellationToken cancellationToken = default) @@ -135,7 +135,7 @@ public override async Task ReadStreamAsync( /// notifications that the operation should be cancelled. /// /// - public override async Task WriteFromStreamAsync( + protected override async Task WriteFromStreamAsync( Stream stream, long streamLength, bool overwrite, @@ -176,7 +176,7 @@ await BlobClient.AppendBlockAsync( /// notifications that the operation should be cancelled. /// /// - public override async Task CopyFromUriAsync( + protected override async Task CopyFromUriAsync( StorageResourceSingle sourceResource, bool overwrite, long completeLength, @@ -218,7 +218,7 @@ await BlobClient.AppendBlockFromUriAsync( /// notifications that the operation should be cancelled. /// /// - public override async Task CopyBlockFromUriAsync( + protected override async Task CopyBlockFromUriAsync( StorageResourceSingle sourceResource, HttpRange range, bool overwrite, @@ -247,7 +247,7 @@ await BlobClient.AppendBlockFromUriAsync( /// See . /// /// Returns the properties of the Append Blob Storage Resource. See . - public override async Task GetPropertiesAsync(CancellationToken cancellationToken = default) + protected override async Task GetPropertiesAsync(CancellationToken cancellationToken = default) { Response response = await BlobClient.GetPropertiesAsync(cancellationToken: cancellationToken).ConfigureAwait(false); GrabEtag(response.GetRawResponse()); @@ -265,7 +265,7 @@ public override async Task GetPropertiesAsync(Cancell /// Gets the HTTP Authorization header for the storage resource if available. If not available /// will return default. /// - public override async Task GetCopyAuthorizationHeaderAsync(CancellationToken cancellationToken = default) + protected override async Task GetCopyAuthorizationHeaderAsync(CancellationToken cancellationToken = default) { return await BlobBaseClientInternals.GetCopyAuthorizationTokenAsync(BlobClient, cancellationToken).ConfigureAwait(false); } @@ -273,7 +273,7 @@ public override async Task GetCopyAuthorizationHeaderAsync(Ca /// /// Commits the block list given. /// - public override Task CompleteTransferAsync(bool overwrite, CancellationToken cancellationToken = default) + protected override Task CompleteTransferAsync(bool overwrite, CancellationToken cancellationToken = default) { // no-op for now return Task.CompletedTask; @@ -290,7 +290,7 @@ public override Task CompleteTransferAsync(bool overwrite, CancellationToken can /// If the storage resource exists and is deleted, true will be returned. /// Otherwise if the storage resource does not exist, false will be returned. /// - public override async Task DeleteIfExistsAsync(CancellationToken cancellationToken = default) + protected override async Task DeleteIfExistsAsync(CancellationToken cancellationToken = default) { return await BlobClient.DeleteIfExistsAsync(cancellationToken: cancellationToken).ConfigureAwait(false); } diff --git a/sdk/storage/Azure.Storage.DataMovement.Blobs/src/BlobStorageResourceContainer.cs b/sdk/storage/Azure.Storage.DataMovement.Blobs/src/BlobStorageResourceContainer.cs index 0bcc98be039f..8fd2924207a5 100644 --- a/sdk/storage/Azure.Storage.DataMovement.Blobs/src/BlobStorageResourceContainer.cs +++ b/sdk/storage/Azure.Storage.DataMovement.Blobs/src/BlobStorageResourceContainer.cs @@ -50,7 +50,7 @@ public BlobStorageResourceContainer(BlobContainerClient blobContainerClient, Blo /// /// Defines whether the storage resource type can produce a web URL. /// - public override bool CanProduceUri => true; + protected override bool CanProduceUri => true; /// /// Gets the path of the storage resource. @@ -67,7 +67,7 @@ public BlobStorageResourceContainer(BlobContainerClient blobContainerClient, Blo /// Retrieves a single blob resource based on this respective resource. /// /// The path to the storage resource, relative to the directory prefix if any. - public override StorageResourceSingle GetChildStorageResource(string path) + protected override StorageResourceSingle GetChildStorageResource(string path) => GetBlobAsStorageResource(ApplyOptionalPrefix(path), type: _options?.BlobType ?? BlobType.Block); /// @@ -123,7 +123,7 @@ private StorageResourceSingle GetBlobAsStorageResource( /// Because blobs is a flat namespace, virtual directories will not be returned. /// /// List of the child resources in the storage container. - public override async IAsyncEnumerable GetStorageResourcesAsync( + protected override async IAsyncEnumerable GetStorageResourcesAsync( [EnumeratorCancellation] CancellationToken cancellationToken = default) { AsyncPageable pages = _blobContainerClient.GetBlobsAsync( diff --git a/sdk/storage/Azure.Storage.DataMovement.Blobs/src/BlockBlobStorageResource.cs b/sdk/storage/Azure.Storage.DataMovement.Blobs/src/BlockBlobStorageResource.cs index 98a452ada54b..101fcd0e17da 100644 --- a/sdk/storage/Azure.Storage.DataMovement.Blobs/src/BlockBlobStorageResource.cs +++ b/sdk/storage/Azure.Storage.DataMovement.Blobs/src/BlockBlobStorageResource.cs @@ -12,6 +12,7 @@ using Azure.Storage.Blobs.Models; using Azure.Storage.Blobs.Specialized; using Azure.Storage.DataMovement.Models; +using Azure.Storage.Shared; namespace Azure.Storage.DataMovement.Blobs { @@ -22,19 +23,19 @@ public class BlockBlobStorageResource : StorageResourceSingle { internal BlockBlobClient BlobClient { get; set; } internal BlockBlobStorageResourceOptions _options; + internal long? _length; + internal ETag? _etagDownloadLock = default; /// /// In order to ensure the block list is sent in the correct order /// we will order them by the offset (i.e. {offset, block_id}). /// private ConcurrentDictionary _blocks; - private long? _length; - private ETag? _etagDownloadLock = default; /// /// The identifier for the type of storage resource. /// - public override string ResourceId => "BlockBlob"; + protected override string ResourceId => "BlockBlob"; /// /// Gets the URL of the storage resource. @@ -49,12 +50,12 @@ public class BlockBlobStorageResource : StorageResourceSingle /// /// Defines whether the storage resource type can produce a web URL. /// - public override bool CanProduceUri => true; + protected override bool CanProduceUri => true; /// /// Defines the recommended Transfer Type of the storage resource. /// - public override TransferType TransferType => TransferType.Concurrent; + protected override TransferType TransferType => TransferType.Concurrent; /// /// Store Max Initial Size that a Put Blob can get to. @@ -64,14 +65,14 @@ public class BlockBlobStorageResource : StorageResourceSingle /// /// Defines the maximum chunk size for the storage resource. /// - public override long MaxChunkSize => Constants.Blob.Block.MaxStageBytes; + protected override long MaxChunkSize => Constants.Blob.Block.MaxStageBytes; /// /// Length of the storage resource. This information is can obtained during a GetStorageResources API call. /// /// Will return default if the length was not set by a GetStorageResources API call. /// - public override long? Length => _length; + protected override long? Length => _length; /// /// The constructor for a new instance of the @@ -120,7 +121,7 @@ internal BlockBlobStorageResource( /// Optional to propagate /// notifications that the operation should be cancelled. /// The resulting from the upload operation. - public override async Task ReadStreamAsync( + protected override async Task ReadStreamAsync( long position = 0, long? length = default, CancellationToken cancellationToken = default) @@ -153,7 +154,7 @@ await BlobClient.DownloadStreamingAsync( /// notifications that the operation should be cancelled. /// /// - public override async Task WriteFromStreamAsync( + protected override async Task WriteFromStreamAsync( Stream stream, long streamLength, bool overwrite, @@ -174,7 +175,7 @@ await BlobClient.UploadAsync( return; } - string id = Shared.StorageExtensions.GenerateBlockId(position); + string id = Azure.Storage.Shared.StorageExtensions.GenerateBlockId(position); if (!_blocks.TryAdd(position, id)) { throw new ArgumentException($"Cannot Stage Block to the specific offset \"{position}\", it already exists in the block list."); @@ -203,7 +204,7 @@ await BlobClient.StageBlockAsync( /// notifications that the operation should be cancelled. /// /// - public override async Task CopyFromUriAsync( + protected override async Task CopyFromUriAsync( StorageResourceSingle sourceResource, bool overwrite, long completeLength, @@ -238,7 +239,7 @@ await BlobClient.SyncUploadFromUriAsync( /// notifications that the operation should be cancelled. /// /// - public override async Task CopyBlockFromUriAsync( + protected override async Task CopyBlockFromUriAsync( StorageResourceSingle sourceResource, HttpRange range, bool overwrite, @@ -270,7 +271,7 @@ await BlobClient.StageBlockFromUriAsync( /// notifications that the operation should be cancelled. /// /// Returns the properties of the Storage Resource. See . - public override async Task GetPropertiesAsync(CancellationToken cancellationToken = default) + protected override async Task GetPropertiesAsync(CancellationToken cancellationToken = default) { CancellationHelper.ThrowIfCancellationRequested(cancellationToken); Response response = await BlobClient.GetPropertiesAsync(cancellationToken: cancellationToken).ConfigureAwait(false); @@ -289,7 +290,7 @@ public override async Task GetPropertiesAsync(Cancell /// Gets the HTTP Authorization header for the storage resource if available. If not available /// will return default. /// - public override async Task GetCopyAuthorizationHeaderAsync(CancellationToken cancellationToken = default) + protected override async Task GetCopyAuthorizationHeaderAsync(CancellationToken cancellationToken = default) { return await BlobBaseClientInternals.GetCopyAuthorizationTokenAsync(BlobClient, cancellationToken).ConfigureAwait(false); } @@ -305,7 +306,7 @@ public override async Task GetCopyAuthorizationHeaderAsync(Ca /// notifications that the operation should be cancelled. /// /// The Task which Commits the list of ids - public override async Task CompleteTransferAsync( + protected override async Task CompleteTransferAsync( bool overwrite, CancellationToken cancellationToken = default) { @@ -332,7 +333,7 @@ await BlobClient.CommitBlockListAsync( /// If the storage resource exists and is deleted, true will be returned. /// Otherwise if the storage resource does not exist, false will be returned. /// - public override async Task DeleteIfExistsAsync(CancellationToken cancellationToken = default) + protected override async Task DeleteIfExistsAsync(CancellationToken cancellationToken = default) { return await BlobClient.DeleteIfExistsAsync(cancellationToken: cancellationToken).ConfigureAwait(false); } diff --git a/sdk/storage/Azure.Storage.DataMovement.Blobs/src/DataMovementBlobsExtensions.cs b/sdk/storage/Azure.Storage.DataMovement.Blobs/src/DataMovementBlobsExtensions.cs index 7b606d548472..b595f1312de1 100644 --- a/sdk/storage/Azure.Storage.DataMovement.Blobs/src/DataMovementBlobsExtensions.cs +++ b/sdk/storage/Azure.Storage.DataMovement.Blobs/src/DataMovementBlobsExtensions.cs @@ -1,7 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -using System.IO; using System.Threading.Tasks; using System.Threading; using Azure.Storage.Blobs.Models; diff --git a/sdk/storage/Azure.Storage.DataMovement.Blobs/src/PageBlobStorageResource.cs b/sdk/storage/Azure.Storage.DataMovement.Blobs/src/PageBlobStorageResource.cs index c0f8339406a7..6b3e976fd433 100644 --- a/sdk/storage/Azure.Storage.DataMovement.Blobs/src/PageBlobStorageResource.cs +++ b/sdk/storage/Azure.Storage.DataMovement.Blobs/src/PageBlobStorageResource.cs @@ -19,13 +19,13 @@ public class PageBlobStorageResource : StorageResourceSingle { internal PageBlobClient BlobClient { get; set; } internal PageBlobStorageResourceOptions _options; - private long? _length; - private ETag? _etagDownloadLock = default; + internal long? _length; + internal ETag? _etagDownloadLock = default; /// /// The identifier for the type of storage resource. /// - public override string ResourceId => "PageBlob"; + protected override string ResourceId => "PageBlob"; /// /// Gets the URL of the storage resource. @@ -40,24 +40,24 @@ public class PageBlobStorageResource : StorageResourceSingle /// /// Defines whether the storage resource type can produce a web URL. /// - public override bool CanProduceUri => true; + protected override bool CanProduceUri => true; /// /// Defines the recommended Transfer Type for the storage resource. /// - public override TransferType TransferType => TransferType.Concurrent; + protected override TransferType TransferType => TransferType.Concurrent; /// /// Defines the maximum chunk size for the storage resource. /// - public override long MaxChunkSize => Constants.Blob.Page.MaxPageBlockBytes; + protected override long MaxChunkSize => Constants.Blob.Page.MaxPageBlockBytes; /// /// Length of the storage resource. This information is obtained during a GetStorageResources API call. /// /// Will return default if the length was not set by a GetStorageResources API call. /// - public override long? Length => _length; + protected override long? Length => _length; /// /// The constructor for a new instance of the @@ -103,7 +103,7 @@ internal PageBlobStorageResource( /// notifications that the operation should be cancelled. /// /// The resulting from the upload operation. - public override async Task ReadStreamAsync( + protected override async Task ReadStreamAsync( long position = 0, long? length = default, CancellationToken cancellationToken = default) @@ -136,7 +136,7 @@ public override async Task ReadStreamAsync( /// notifications that the operation should be cancelled. /// /// - public override async Task WriteFromStreamAsync( + protected override async Task WriteFromStreamAsync( Stream stream, long streamLength, bool overwrite, @@ -180,7 +180,7 @@ await BlobClient.UploadPagesAsync( /// notifications that the operation should be cancelled. /// /// - public override async Task CopyFromUriAsync( + protected override async Task CopyFromUriAsync( StorageResourceSingle sourceResource, bool overwrite, long completeLength, @@ -224,7 +224,7 @@ await BlobClient.UploadPagesFromUriAsync( /// notifications that the operation should be cancelled. /// /// - public override async Task CopyBlockFromUriAsync( + protected override async Task CopyBlockFromUriAsync( StorageResourceSingle sourceResource, HttpRange range, bool overwrite, @@ -254,7 +254,7 @@ await BlobClient.UploadPagesFromUriAsync( /// See . /// /// Returns the properties of the Page Blob Storage Resource. See - public override async Task GetPropertiesAsync(CancellationToken cancellationToken = default) + protected override async Task GetPropertiesAsync(CancellationToken cancellationToken = default) { Response response = await BlobClient.GetPropertiesAsync(cancellationToken: cancellationToken).ConfigureAwait(false); GrabEtag(response.GetRawResponse()); @@ -272,7 +272,7 @@ public override async Task GetPropertiesAsync(Cancell /// Gets the HTTP Authorization header for the storage resource if available. If not available /// will return default. /// - public override async Task GetCopyAuthorizationHeaderAsync(CancellationToken cancellationToken = default) + protected override async Task GetCopyAuthorizationHeaderAsync(CancellationToken cancellationToken = default) { return await BlobBaseClientInternals.GetCopyAuthorizationTokenAsync(BlobClient, cancellationToken).ConfigureAwait(false); } @@ -280,7 +280,7 @@ public override async Task GetCopyAuthorizationHeaderAsync(Ca /// /// Commits the block list given. /// - public override Task CompleteTransferAsync(bool overwrite, CancellationToken cancellationToken = default) + protected override Task CompleteTransferAsync(bool overwrite, CancellationToken cancellationToken = default) { // no-op for now return Task.CompletedTask; @@ -297,7 +297,7 @@ public override Task CompleteTransferAsync(bool overwrite, CancellationToken can /// If the storage resource exists and is deleted, true will be returned. /// Otherwise if the storage resource does not exist, false will be returned. /// - public override async Task DeleteIfExistsAsync(CancellationToken cancellationToken = default) + protected override async Task DeleteIfExistsAsync(CancellationToken cancellationToken = default) { return await BlobClient.DeleteIfExistsAsync(cancellationToken: cancellationToken).ConfigureAwait(false); } diff --git a/sdk/storage/Azure.Storage.DataMovement.Blobs/tests/MockAppendBlobStorageResource.cs b/sdk/storage/Azure.Storage.DataMovement.Blobs/tests/MockAppendBlobStorageResource.cs new file mode 100644 index 000000000000..14aad306874f --- /dev/null +++ b/sdk/storage/Azure.Storage.DataMovement.Blobs/tests/MockAppendBlobStorageResource.cs @@ -0,0 +1,47 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +using System.Threading; +using System.Threading.Tasks; +using Azure.Storage.Blobs.Specialized; +using Azure.Storage.DataMovement.Models; + +namespace Azure.Storage.DataMovement.Blobs.Tests +{ + internal class MockAppendBlobStorageResource : AppendBlobStorageResource + { + public MockAppendBlobStorageResource( + AppendBlobClient blobClient, + AppendBlobStorageResourceOptions options = null) + : base(blobClient, options) + { + } + + internal MockAppendBlobStorageResource( + AppendBlobClient blobClient, + long? length, + ETag? etagLock, + AppendBlobStorageResourceOptions options = default) + : base(blobClient, length, etagLock, options) + { + } + + internal MockAppendBlobStorageResource( + AppendBlobStorageResource resource) + : base(resource.BlobClient, + resource._length, + resource._etagDownloadLock, + resource._options) + { + } + + public async Task MockGetPropertiesAsync(CancellationToken cancellationToken = default) + => await base.GetPropertiesAsync(cancellationToken); + + public async Task MockReadStreamAsync( + long position = 0, + long? length = default, + CancellationToken cancellationToken = default) + => await base.ReadStreamAsync(position, length, cancellationToken); + } +} diff --git a/sdk/storage/Azure.Storage.DataMovement.Blobs/tests/MockBlobStorageResourceContainer.cs b/sdk/storage/Azure.Storage.DataMovement.Blobs/tests/MockBlobStorageResourceContainer.cs new file mode 100644 index 000000000000..6b0265d110e9 --- /dev/null +++ b/sdk/storage/Azure.Storage.DataMovement.Blobs/tests/MockBlobStorageResourceContainer.cs @@ -0,0 +1,33 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +using System; +using System.Collections.Generic; +using System.Linq; +using System.Runtime.CompilerServices; +using System.Text; +using System.Threading; +using System.Threading.Tasks; +using Azure.Storage.Blobs; + +namespace Azure.Storage.DataMovement.Blobs.Tests +{ + internal class MockBlobStorageResourceContainer : BlobStorageResourceContainer + { + public MockBlobStorageResourceContainer( + BlobContainerClient blobContainerClient, + BlobStorageResourceContainerOptions options = null) + : base(blobContainerClient, options) + { + } + + public async IAsyncEnumerable MockGetStorageResourcesAsync( + [EnumeratorCancellation] CancellationToken cancellationToken = default) + { + await foreach (StorageResource resource in base.GetStorageResourcesAsync(cancellationToken)) + { + yield return resource; + } + } + } +} diff --git a/sdk/storage/Azure.Storage.DataMovement.Blobs/tests/MockBlockBlobStorageResource.cs b/sdk/storage/Azure.Storage.DataMovement.Blobs/tests/MockBlockBlobStorageResource.cs new file mode 100644 index 000000000000..d660076d036f --- /dev/null +++ b/sdk/storage/Azure.Storage.DataMovement.Blobs/tests/MockBlockBlobStorageResource.cs @@ -0,0 +1,47 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +using System.Threading; +using System.Threading.Tasks; +using Azure.Storage.Blobs.Specialized; +using Azure.Storage.DataMovement.Models; + +namespace Azure.Storage.DataMovement.Blobs.Tests +{ + internal class MockBlockBlobStorageResource : BlockBlobStorageResource + { + public MockBlockBlobStorageResource( + BlockBlobClient blobClient, + BlockBlobStorageResourceOptions options = null) + : base(blobClient, options) + { + } + + internal MockBlockBlobStorageResource( + BlockBlobClient blobClient, + long? length, + ETag? etagLock, + BlockBlobStorageResourceOptions options = default) + : base(blobClient, length, etagLock, options) + { + } + + internal MockBlockBlobStorageResource( + BlockBlobStorageResource resource) + : base(resource.BlobClient, + resource._length, + resource._etagDownloadLock, + resource._options) + { + } + + public async Task MockGetPropertiesAsync(CancellationToken cancellationToken = default) + => await base.GetPropertiesAsync(cancellationToken); + + public async Task MockReadStreamAsync( + long position = 0, + long? length = default, + CancellationToken cancellationToken = default) + => await base.ReadStreamAsync(position, length, cancellationToken); + } +} diff --git a/sdk/storage/Azure.Storage.DataMovement.Blobs/tests/MockPageBlobStorageResource.cs b/sdk/storage/Azure.Storage.DataMovement.Blobs/tests/MockPageBlobStorageResource.cs new file mode 100644 index 000000000000..60789edb181c --- /dev/null +++ b/sdk/storage/Azure.Storage.DataMovement.Blobs/tests/MockPageBlobStorageResource.cs @@ -0,0 +1,47 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +using System.Threading; +using System.Threading.Tasks; +using Azure.Storage.Blobs.Specialized; +using Azure.Storage.DataMovement.Models; + +namespace Azure.Storage.DataMovement.Blobs.Tests +{ + internal class MockPageBlobStorageResource : PageBlobStorageResource + { + public MockPageBlobStorageResource( + PageBlobClient blobClient, + PageBlobStorageResourceOptions options = null) + : base(blobClient, options) + { + } + + internal MockPageBlobStorageResource( + PageBlobClient blobClient, + long? length, + ETag? etagLock, + PageBlobStorageResourceOptions options = default) + : base(blobClient, length, etagLock, options) + { + } + + internal MockPageBlobStorageResource( + PageBlobStorageResource resource) + : base(resource.BlobClient, + resource._length, + resource._etagDownloadLock, + resource._options) + { + } + + public async Task MockGetPropertiesAsync(CancellationToken cancellationToken = default) + => await base.GetPropertiesAsync(cancellationToken); + + public async Task MockReadStreamAsync( + long position = 0, + long? length = default, + CancellationToken cancellationToken = default) + => await base.ReadStreamAsync(position, length, cancellationToken); + } +} diff --git a/sdk/storage/Azure.Storage.DataMovement.Blobs/tests/StorageResourceEtagManagementTests.cs b/sdk/storage/Azure.Storage.DataMovement.Blobs/tests/StorageResourceEtagManagementTests.cs index 7bb9048b799c..79c43cb7cb79 100644 --- a/sdk/storage/Azure.Storage.DataMovement.Blobs/tests/StorageResourceEtagManagementTests.cs +++ b/sdk/storage/Azure.Storage.DataMovement.Blobs/tests/StorageResourceEtagManagementTests.cs @@ -7,7 +7,6 @@ using System.Linq; using System.Threading; using System.Threading.Tasks; -using Azure.Core; using Azure.Core.TestFramework; using Azure.Storage.Blobs; using Azure.Storage.Blobs.Models; @@ -36,9 +35,9 @@ public async Task BlockBlobMaintainsEtagForDownloads() BlobsModelFactory.BlobDownloadStreamingResult(Stream.Null, new BlobDownloadDetails()), new MockResponse(201)))); - BlockBlobStorageResource storageResource = new(mock.Object); - await storageResource.GetPropertiesAsync(); - await storageResource.ReadStreamAsync(); + MockBlockBlobStorageResource storageResource = new(mock.Object); + await storageResource.MockGetPropertiesAsync(); + await storageResource.MockReadStreamAsync(); mock.Verify( b => b.GetPropertiesAsync(It.IsAny(), It.IsAny()), @@ -66,9 +65,9 @@ public async Task PageBlobBlobMaintainsEtagForDownloads() BlobsModelFactory.BlobDownloadStreamingResult(Stream.Null, new BlobDownloadDetails()), new MockResponse(201)))); - PageBlobStorageResource storageResource = new(mock.Object); - await storageResource.GetPropertiesAsync(); - await storageResource.ReadStreamAsync(); + MockPageBlobStorageResource storageResource = new(mock.Object); + await storageResource.MockGetPropertiesAsync(); + await storageResource.MockReadStreamAsync(); mock.Verify( b => b.GetPropertiesAsync(It.IsAny(), It.IsAny()), @@ -96,9 +95,9 @@ public async Task AppendBlobMaintainsEtagForDownloads() BlobsModelFactory.BlobDownloadStreamingResult(Stream.Null, new BlobDownloadDetails()), new MockResponse(201)))); - AppendBlobStorageResource storageResource = new(mock.Object); - await storageResource.GetPropertiesAsync(); - await storageResource.ReadStreamAsync(); + MockAppendBlobStorageResource storageResource = new(mock.Object); + await storageResource.MockGetPropertiesAsync(); + await storageResource.MockReadStreamAsync(); mock.Verify( b => b.GetPropertiesAsync(It.IsAny(), It.IsAny()), @@ -122,8 +121,8 @@ public async Task BlockBlobUsesProvidedEtag() BlobsModelFactory.BlobDownloadStreamingResult(Stream.Null, new BlobDownloadDetails()), new MockResponse(201)))); - BlockBlobStorageResource storageResource = new(mock.Object, length: default, etag); - await storageResource.ReadStreamAsync(); + MockBlockBlobStorageResource storageResource = new(mock.Object, length: default, etag); + await storageResource.MockReadStreamAsync(); mock.Verify( b => b.DownloadStreamingAsync( @@ -144,8 +143,8 @@ public async Task PageBlobUsesProvidedEtag() BlobsModelFactory.BlobDownloadStreamingResult(Stream.Null, new BlobDownloadDetails()), new MockResponse(201)))); - PageBlobStorageResource storageResource = new(mock.Object, length: default, etag); - await storageResource.ReadStreamAsync(); + MockPageBlobStorageResource storageResource = new(mock.Object, length: default, etag); + await storageResource.MockReadStreamAsync(); mock.Verify( b => b.DownloadStreamingAsync( @@ -166,8 +165,8 @@ public async Task AppendBlobUsesProvidedEtag() BlobsModelFactory.BlobDownloadStreamingResult(Stream.Null, new BlobDownloadDetails()), new MockResponse(201)))); - AppendBlobStorageResource storageResource = new(mock.Object, length: default, etag); - await storageResource.ReadStreamAsync(); + MockAppendBlobStorageResource storageResource = new(mock.Object, length: default, etag); + await storageResource.MockReadStreamAsync(); mock.Verify( b => b.DownloadStreamingAsync( @@ -205,8 +204,8 @@ public async Task ContainerProvidesETagFromList() })); // Act - BlobStorageResourceContainer containerResource = new(mock.Object); - List children = await containerResource.GetStorageResourcesAsync().ToEnumerableAsync(); + MockBlobStorageResourceContainer containerResource = new(mock.Object); + List children = await containerResource.MockGetStorageResourcesAsync().ToEnumerableAsync(); // Assert @@ -220,7 +219,7 @@ public async Task ContainerProvidesETagFromList() switch (blobType) { case BlobType.Block: - BlockBlobStorageResource blockChild = children[i] as BlockBlobStorageResource; + MockBlockBlobStorageResource blockChild = new(children[i] as BlockBlobStorageResource); Mock blockClient = new( new Uri("https://storageaccount.blob.core.windows.net/container/blob"), new BlobClientOptions()); @@ -230,7 +229,7 @@ public async Task ContainerProvidesETagFromList() new MockResponse(201)))); blockChild.BlobClient = blockClient.Object; - await blockChild.ReadStreamAsync(); + await blockChild.MockReadStreamAsync(); blockClient.Verify( b => b.DownloadStreamingAsync( @@ -240,7 +239,7 @@ public async Task ContainerProvidesETagFromList() break; case BlobType.Page: - PageBlobStorageResource pageChild = children[i] as PageBlobStorageResource; + MockPageBlobStorageResource pageChild = new(children[i] as PageBlobStorageResource); Mock pageClient = new( new Uri("https://storageaccount.blob.core.windows.net/container/blob"), new BlobClientOptions()); @@ -250,7 +249,7 @@ public async Task ContainerProvidesETagFromList() new MockResponse(201)))); pageChild.BlobClient = pageClient.Object; - await pageChild.ReadStreamAsync(); + await pageChild.MockReadStreamAsync(); pageClient.Verify( b => b.DownloadStreamingAsync( @@ -260,7 +259,7 @@ public async Task ContainerProvidesETagFromList() break; case BlobType.Append: - AppendBlobStorageResource appendChild = children[i] as AppendBlobStorageResource; + MockAppendBlobStorageResource appendChild = new(children[i] as AppendBlobStorageResource); Mock appendClient = new( new Uri("https://storageaccount.blob.core.windows.net/container/blob"), new BlobClientOptions()); @@ -270,7 +269,7 @@ public async Task ContainerProvidesETagFromList() new MockResponse(201)))); appendChild.BlobClient = appendClient.Object; - await appendChild.ReadStreamAsync(); + await appendChild.MockReadStreamAsync(); appendClient.Verify( b => b.DownloadStreamingAsync( diff --git a/sdk/storage/Azure.Storage.DataMovement/CHANGELOG.md b/sdk/storage/Azure.Storage.DataMovement/CHANGELOG.md index 644fede110ad..98eadc5deada 100644 --- a/sdk/storage/Azure.Storage.DataMovement/CHANGELOG.md +++ b/sdk/storage/Azure.Storage.DataMovement/CHANGELOG.md @@ -5,6 +5,22 @@ ### Features Added ### Breaking Changes +- [BREAKING CHANGE] Made the following members `public` to `protected internal` members (including all derived classes): + - `StorageResource.CanProduceUri` + - `StorageResource.IsContainer` + - `StorageResourceContainer.GetStorageResourcesAsync` + - `StorageResourceSingle.Length` + - `StorageResourceSingle.MaxChunkSize` + - `StorageResourceSingle.ResourceId` + - `StorageResourceSingle.TransferType` + - `StorageResourceSingle.CompleteTransferAsync` + - `StorageResourceSingle.CopyBlockFromUriAsync` + - `StorageResourceSingle.CopyFromUriAsync` + - `StorageResourceSingle.DeleteIfExistsAsync` + - `StorageResourceSingle.GetCopyAuthorizationHeaderAsync` + - `StorageResourceSingle.GetPropertiesAsync` + - `StorageResourceSingle.ReadStreamAsync` + - `StorageResourceSingle.WriteFromStreamAsync` ### Bugs Fixed diff --git a/sdk/storage/Azure.Storage.DataMovement/api/Azure.Storage.DataMovement.net6.0.cs b/sdk/storage/Azure.Storage.DataMovement/api/Azure.Storage.DataMovement.net6.0.cs index 47ee8e3d34ab..a2fd3a8d7dac 100644 --- a/sdk/storage/Azure.Storage.DataMovement/api/Azure.Storage.DataMovement.net6.0.cs +++ b/sdk/storage/Azure.Storage.DataMovement/api/Azure.Storage.DataMovement.net6.0.cs @@ -19,30 +19,30 @@ public enum ErrorHandlingBehavior public partial class LocalDirectoryStorageResourceContainer : Azure.Storage.DataMovement.StorageResourceContainer { public LocalDirectoryStorageResourceContainer(string path) { } - public override bool CanProduceUri { get { throw null; } } + protected internal override bool CanProduceUri { get { throw null; } } public override string Path { get { throw null; } } public override System.Uri Uri { get { throw null; } } - public override Azure.Storage.DataMovement.StorageResourceSingle GetChildStorageResource(string childPath) { throw null; } - public override System.Collections.Generic.IAsyncEnumerable GetStorageResourcesAsync([System.Runtime.CompilerServices.EnumeratorCancellationAttribute] System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + protected internal override Azure.Storage.DataMovement.StorageResourceSingle GetChildStorageResource(string childPath) { throw null; } + protected internal override System.Collections.Generic.IAsyncEnumerable GetStorageResourcesAsync([System.Runtime.CompilerServices.EnumeratorCancellationAttribute] System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } } public partial class LocalFileStorageResource : Azure.Storage.DataMovement.StorageResourceSingle { public LocalFileStorageResource(string path) { } - public override bool CanProduceUri { get { throw null; } } - public override long? Length { get { throw null; } } - public override long MaxChunkSize { get { throw null; } } + protected internal override bool CanProduceUri { get { throw null; } } + protected internal override long? Length { get { throw null; } } + protected internal override long MaxChunkSize { get { throw null; } } public override string Path { get { throw null; } } - public override string ResourceId { get { throw null; } } - public override Azure.Storage.DataMovement.TransferType TransferType { get { throw null; } } + protected internal override string ResourceId { get { throw null; } } + protected internal override Azure.Storage.DataMovement.TransferType TransferType { get { throw null; } } public override System.Uri Uri { get { throw null; } } - public override System.Threading.Tasks.Task CompleteTransferAsync(bool overwrite, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - public override System.Threading.Tasks.Task CopyBlockFromUriAsync(Azure.Storage.DataMovement.StorageResourceSingle sourceResource, Azure.HttpRange range, bool overwrite, long completeLength = (long)0, Azure.Storage.DataMovement.Models.StorageResourceCopyFromUriOptions options = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - public override System.Threading.Tasks.Task CopyFromUriAsync(Azure.Storage.DataMovement.StorageResourceSingle sourceResource, bool overwrite, long completeLength, Azure.Storage.DataMovement.Models.StorageResourceCopyFromUriOptions options = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - public override System.Threading.Tasks.Task DeleteIfExistsAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - public override System.Threading.Tasks.Task GetCopyAuthorizationHeaderAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - public override System.Threading.Tasks.Task GetPropertiesAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - public override System.Threading.Tasks.Task ReadStreamAsync(long position = (long)0, long? length = default(long?), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - public override System.Threading.Tasks.Task WriteFromStreamAsync(System.IO.Stream stream, long streamLength, bool overwrite, long position = (long)0, long completeLength = (long)0, Azure.Storage.DataMovement.Models.StorageResourceWriteToOffsetOptions options = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + protected internal override System.Threading.Tasks.Task CompleteTransferAsync(bool overwrite, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + protected internal override System.Threading.Tasks.Task CopyBlockFromUriAsync(Azure.Storage.DataMovement.StorageResourceSingle sourceResource, Azure.HttpRange range, bool overwrite, long completeLength = (long)0, Azure.Storage.DataMovement.Models.StorageResourceCopyFromUriOptions options = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + protected internal override System.Threading.Tasks.Task CopyFromUriAsync(Azure.Storage.DataMovement.StorageResourceSingle sourceResource, bool overwrite, long completeLength, Azure.Storage.DataMovement.Models.StorageResourceCopyFromUriOptions options = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + protected internal override System.Threading.Tasks.Task DeleteIfExistsAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + protected internal override System.Threading.Tasks.Task GetCopyAuthorizationHeaderAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + protected internal override System.Threading.Tasks.Task GetPropertiesAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + protected internal override System.Threading.Tasks.Task ReadStreamAsync(long position = (long)0, long? length = default(long?), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + protected internal override System.Threading.Tasks.Task WriteFromStreamAsync(System.IO.Stream stream, long streamLength, bool overwrite, long position = (long)0, long completeLength = (long)0, Azure.Storage.DataMovement.Models.StorageResourceWriteToOffsetOptions options = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } } public partial class LocalStorageResourceProvider { @@ -56,17 +56,17 @@ public static partial class LocalStorageResources public abstract partial class StorageResource { protected StorageResource() { } - public abstract bool CanProduceUri { get; } - public abstract bool IsContainer { get; } + protected internal abstract bool CanProduceUri { get; } + protected internal abstract bool IsContainer { get; } public abstract string Path { get; } public abstract System.Uri Uri { get; } } public abstract partial class StorageResourceContainer : Azure.Storage.DataMovement.StorageResource { protected StorageResourceContainer() { } - public override bool IsContainer { get { throw null; } } - public abstract Azure.Storage.DataMovement.StorageResourceSingle GetChildStorageResource(string path); - public abstract System.Collections.Generic.IAsyncEnumerable GetStorageResourcesAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + protected internal override bool IsContainer { get { throw null; } } + protected internal abstract Azure.Storage.DataMovement.StorageResourceSingle GetChildStorageResource(string path); + protected internal abstract System.Collections.Generic.IAsyncEnumerable GetStorageResourcesAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); } public enum StorageResourceCreateMode { @@ -78,19 +78,19 @@ public enum StorageResourceCreateMode public abstract partial class StorageResourceSingle : Azure.Storage.DataMovement.StorageResource { protected StorageResourceSingle() { } - public override bool IsContainer { get { throw null; } } - public abstract long? Length { get; } - public abstract long MaxChunkSize { get; } - public abstract string ResourceId { get; } - public abstract Azure.Storage.DataMovement.TransferType TransferType { get; } - public abstract System.Threading.Tasks.Task CompleteTransferAsync(bool overwrite, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); - public abstract System.Threading.Tasks.Task CopyBlockFromUriAsync(Azure.Storage.DataMovement.StorageResourceSingle sourceResource, Azure.HttpRange range, bool overwrite, long completeLength = (long)0, Azure.Storage.DataMovement.Models.StorageResourceCopyFromUriOptions options = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); - public abstract System.Threading.Tasks.Task CopyFromUriAsync(Azure.Storage.DataMovement.StorageResourceSingle sourceResource, bool overwrite, long completeLength, Azure.Storage.DataMovement.Models.StorageResourceCopyFromUriOptions options = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); - public abstract System.Threading.Tasks.Task DeleteIfExistsAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); - public abstract System.Threading.Tasks.Task GetCopyAuthorizationHeaderAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); - public abstract System.Threading.Tasks.Task GetPropertiesAsync(System.Threading.CancellationToken token = default(System.Threading.CancellationToken)); - public abstract System.Threading.Tasks.Task ReadStreamAsync(long position = (long)0, long? length = default(long?), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); - public abstract System.Threading.Tasks.Task WriteFromStreamAsync(System.IO.Stream stream, long streamLength, bool overwrite, long position = (long)0, long completeLength = (long)0, Azure.Storage.DataMovement.Models.StorageResourceWriteToOffsetOptions options = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + protected internal override bool IsContainer { get { throw null; } } + protected internal abstract long? Length { get; } + protected internal abstract long MaxChunkSize { get; } + protected internal abstract string ResourceId { get; } + protected internal abstract Azure.Storage.DataMovement.TransferType TransferType { get; } + protected internal abstract System.Threading.Tasks.Task CompleteTransferAsync(bool overwrite, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + protected internal abstract System.Threading.Tasks.Task CopyBlockFromUriAsync(Azure.Storage.DataMovement.StorageResourceSingle sourceResource, Azure.HttpRange range, bool overwrite, long completeLength = (long)0, Azure.Storage.DataMovement.Models.StorageResourceCopyFromUriOptions options = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + protected internal abstract System.Threading.Tasks.Task CopyFromUriAsync(Azure.Storage.DataMovement.StorageResourceSingle sourceResource, bool overwrite, long completeLength, Azure.Storage.DataMovement.Models.StorageResourceCopyFromUriOptions options = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + protected internal abstract System.Threading.Tasks.Task DeleteIfExistsAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + protected internal abstract System.Threading.Tasks.Task GetCopyAuthorizationHeaderAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + protected internal abstract System.Threading.Tasks.Task GetPropertiesAsync(System.Threading.CancellationToken token = default(System.Threading.CancellationToken)); + protected internal abstract System.Threading.Tasks.Task ReadStreamAsync(long position = (long)0, long? length = default(long?), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + protected internal abstract System.Threading.Tasks.Task WriteFromStreamAsync(System.IO.Stream stream, long streamLength, bool overwrite, long position = (long)0, long completeLength = (long)0, Azure.Storage.DataMovement.Models.StorageResourceWriteToOffsetOptions options = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); } public enum StorageResourceType { diff --git a/sdk/storage/Azure.Storage.DataMovement/api/Azure.Storage.DataMovement.netstandard2.0.cs b/sdk/storage/Azure.Storage.DataMovement/api/Azure.Storage.DataMovement.netstandard2.0.cs index 47ee8e3d34ab..a2fd3a8d7dac 100644 --- a/sdk/storage/Azure.Storage.DataMovement/api/Azure.Storage.DataMovement.netstandard2.0.cs +++ b/sdk/storage/Azure.Storage.DataMovement/api/Azure.Storage.DataMovement.netstandard2.0.cs @@ -19,30 +19,30 @@ public enum ErrorHandlingBehavior public partial class LocalDirectoryStorageResourceContainer : Azure.Storage.DataMovement.StorageResourceContainer { public LocalDirectoryStorageResourceContainer(string path) { } - public override bool CanProduceUri { get { throw null; } } + protected internal override bool CanProduceUri { get { throw null; } } public override string Path { get { throw null; } } public override System.Uri Uri { get { throw null; } } - public override Azure.Storage.DataMovement.StorageResourceSingle GetChildStorageResource(string childPath) { throw null; } - public override System.Collections.Generic.IAsyncEnumerable GetStorageResourcesAsync([System.Runtime.CompilerServices.EnumeratorCancellationAttribute] System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + protected internal override Azure.Storage.DataMovement.StorageResourceSingle GetChildStorageResource(string childPath) { throw null; } + protected internal override System.Collections.Generic.IAsyncEnumerable GetStorageResourcesAsync([System.Runtime.CompilerServices.EnumeratorCancellationAttribute] System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } } public partial class LocalFileStorageResource : Azure.Storage.DataMovement.StorageResourceSingle { public LocalFileStorageResource(string path) { } - public override bool CanProduceUri { get { throw null; } } - public override long? Length { get { throw null; } } - public override long MaxChunkSize { get { throw null; } } + protected internal override bool CanProduceUri { get { throw null; } } + protected internal override long? Length { get { throw null; } } + protected internal override long MaxChunkSize { get { throw null; } } public override string Path { get { throw null; } } - public override string ResourceId { get { throw null; } } - public override Azure.Storage.DataMovement.TransferType TransferType { get { throw null; } } + protected internal override string ResourceId { get { throw null; } } + protected internal override Azure.Storage.DataMovement.TransferType TransferType { get { throw null; } } public override System.Uri Uri { get { throw null; } } - public override System.Threading.Tasks.Task CompleteTransferAsync(bool overwrite, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - public override System.Threading.Tasks.Task CopyBlockFromUriAsync(Azure.Storage.DataMovement.StorageResourceSingle sourceResource, Azure.HttpRange range, bool overwrite, long completeLength = (long)0, Azure.Storage.DataMovement.Models.StorageResourceCopyFromUriOptions options = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - public override System.Threading.Tasks.Task CopyFromUriAsync(Azure.Storage.DataMovement.StorageResourceSingle sourceResource, bool overwrite, long completeLength, Azure.Storage.DataMovement.Models.StorageResourceCopyFromUriOptions options = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - public override System.Threading.Tasks.Task DeleteIfExistsAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - public override System.Threading.Tasks.Task GetCopyAuthorizationHeaderAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - public override System.Threading.Tasks.Task GetPropertiesAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - public override System.Threading.Tasks.Task ReadStreamAsync(long position = (long)0, long? length = default(long?), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - public override System.Threading.Tasks.Task WriteFromStreamAsync(System.IO.Stream stream, long streamLength, bool overwrite, long position = (long)0, long completeLength = (long)0, Azure.Storage.DataMovement.Models.StorageResourceWriteToOffsetOptions options = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + protected internal override System.Threading.Tasks.Task CompleteTransferAsync(bool overwrite, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + protected internal override System.Threading.Tasks.Task CopyBlockFromUriAsync(Azure.Storage.DataMovement.StorageResourceSingle sourceResource, Azure.HttpRange range, bool overwrite, long completeLength = (long)0, Azure.Storage.DataMovement.Models.StorageResourceCopyFromUriOptions options = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + protected internal override System.Threading.Tasks.Task CopyFromUriAsync(Azure.Storage.DataMovement.StorageResourceSingle sourceResource, bool overwrite, long completeLength, Azure.Storage.DataMovement.Models.StorageResourceCopyFromUriOptions options = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + protected internal override System.Threading.Tasks.Task DeleteIfExistsAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + protected internal override System.Threading.Tasks.Task GetCopyAuthorizationHeaderAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + protected internal override System.Threading.Tasks.Task GetPropertiesAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + protected internal override System.Threading.Tasks.Task ReadStreamAsync(long position = (long)0, long? length = default(long?), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + protected internal override System.Threading.Tasks.Task WriteFromStreamAsync(System.IO.Stream stream, long streamLength, bool overwrite, long position = (long)0, long completeLength = (long)0, Azure.Storage.DataMovement.Models.StorageResourceWriteToOffsetOptions options = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } } public partial class LocalStorageResourceProvider { @@ -56,17 +56,17 @@ public static partial class LocalStorageResources public abstract partial class StorageResource { protected StorageResource() { } - public abstract bool CanProduceUri { get; } - public abstract bool IsContainer { get; } + protected internal abstract bool CanProduceUri { get; } + protected internal abstract bool IsContainer { get; } public abstract string Path { get; } public abstract System.Uri Uri { get; } } public abstract partial class StorageResourceContainer : Azure.Storage.DataMovement.StorageResource { protected StorageResourceContainer() { } - public override bool IsContainer { get { throw null; } } - public abstract Azure.Storage.DataMovement.StorageResourceSingle GetChildStorageResource(string path); - public abstract System.Collections.Generic.IAsyncEnumerable GetStorageResourcesAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + protected internal override bool IsContainer { get { throw null; } } + protected internal abstract Azure.Storage.DataMovement.StorageResourceSingle GetChildStorageResource(string path); + protected internal abstract System.Collections.Generic.IAsyncEnumerable GetStorageResourcesAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); } public enum StorageResourceCreateMode { @@ -78,19 +78,19 @@ public enum StorageResourceCreateMode public abstract partial class StorageResourceSingle : Azure.Storage.DataMovement.StorageResource { protected StorageResourceSingle() { } - public override bool IsContainer { get { throw null; } } - public abstract long? Length { get; } - public abstract long MaxChunkSize { get; } - public abstract string ResourceId { get; } - public abstract Azure.Storage.DataMovement.TransferType TransferType { get; } - public abstract System.Threading.Tasks.Task CompleteTransferAsync(bool overwrite, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); - public abstract System.Threading.Tasks.Task CopyBlockFromUriAsync(Azure.Storage.DataMovement.StorageResourceSingle sourceResource, Azure.HttpRange range, bool overwrite, long completeLength = (long)0, Azure.Storage.DataMovement.Models.StorageResourceCopyFromUriOptions options = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); - public abstract System.Threading.Tasks.Task CopyFromUriAsync(Azure.Storage.DataMovement.StorageResourceSingle sourceResource, bool overwrite, long completeLength, Azure.Storage.DataMovement.Models.StorageResourceCopyFromUriOptions options = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); - public abstract System.Threading.Tasks.Task DeleteIfExistsAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); - public abstract System.Threading.Tasks.Task GetCopyAuthorizationHeaderAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); - public abstract System.Threading.Tasks.Task GetPropertiesAsync(System.Threading.CancellationToken token = default(System.Threading.CancellationToken)); - public abstract System.Threading.Tasks.Task ReadStreamAsync(long position = (long)0, long? length = default(long?), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); - public abstract System.Threading.Tasks.Task WriteFromStreamAsync(System.IO.Stream stream, long streamLength, bool overwrite, long position = (long)0, long completeLength = (long)0, Azure.Storage.DataMovement.Models.StorageResourceWriteToOffsetOptions options = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + protected internal override bool IsContainer { get { throw null; } } + protected internal abstract long? Length { get; } + protected internal abstract long MaxChunkSize { get; } + protected internal abstract string ResourceId { get; } + protected internal abstract Azure.Storage.DataMovement.TransferType TransferType { get; } + protected internal abstract System.Threading.Tasks.Task CompleteTransferAsync(bool overwrite, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + protected internal abstract System.Threading.Tasks.Task CopyBlockFromUriAsync(Azure.Storage.DataMovement.StorageResourceSingle sourceResource, Azure.HttpRange range, bool overwrite, long completeLength = (long)0, Azure.Storage.DataMovement.Models.StorageResourceCopyFromUriOptions options = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + protected internal abstract System.Threading.Tasks.Task CopyFromUriAsync(Azure.Storage.DataMovement.StorageResourceSingle sourceResource, bool overwrite, long completeLength, Azure.Storage.DataMovement.Models.StorageResourceCopyFromUriOptions options = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + protected internal abstract System.Threading.Tasks.Task DeleteIfExistsAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + protected internal abstract System.Threading.Tasks.Task GetCopyAuthorizationHeaderAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + protected internal abstract System.Threading.Tasks.Task GetPropertiesAsync(System.Threading.CancellationToken token = default(System.Threading.CancellationToken)); + protected internal abstract System.Threading.Tasks.Task ReadStreamAsync(long position = (long)0, long? length = default(long?), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + protected internal abstract System.Threading.Tasks.Task WriteFromStreamAsync(System.IO.Stream stream, long streamLength, bool overwrite, long position = (long)0, long completeLength = (long)0, Azure.Storage.DataMovement.Models.StorageResourceWriteToOffsetOptions options = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); } public enum StorageResourceType { diff --git a/sdk/storage/Azure.Storage.DataMovement/src/LocalDirectoryStorageResourceContainer.cs b/sdk/storage/Azure.Storage.DataMovement/src/LocalDirectoryStorageResourceContainer.cs index 8bbd143afd1f..d6b5e4da9963 100644 --- a/sdk/storage/Azure.Storage.DataMovement/src/LocalDirectoryStorageResourceContainer.cs +++ b/sdk/storage/Azure.Storage.DataMovement/src/LocalDirectoryStorageResourceContainer.cs @@ -27,7 +27,7 @@ public class LocalDirectoryStorageResourceContainer : StorageResourceContainer /// /// Defines whether the storage resource type can produce a web URL. /// - public override bool CanProduceUri => false; + protected internal override bool CanProduceUri => false; /// /// Cannot get Uri. Will throw NotSupportedException(); @@ -49,7 +49,7 @@ public LocalDirectoryStorageResourceContainer(string path) /// /// /// - public override StorageResourceSingle GetChildStorageResource(string childPath) + protected internal override StorageResourceSingle GetChildStorageResource(string childPath) { string concatPath = System.IO.Path.Combine(Path, childPath); return new LocalFileStorageResource(concatPath); @@ -61,7 +61,7 @@ public override StorageResourceSingle GetChildStorageResource(string childPath) /// /// #pragma warning disable CS1998 // Async method lacks 'await' operators and will run synchronously - public override async IAsyncEnumerable GetStorageResourcesAsync( + protected internal override async IAsyncEnumerable GetStorageResourcesAsync( [EnumeratorCancellation] CancellationToken cancellationToken = default) #pragma warning restore CS1998 // Async method lacks 'await' operators and will run synchronously { diff --git a/sdk/storage/Azure.Storage.DataMovement/src/LocalFileStorageResource.cs b/sdk/storage/Azure.Storage.DataMovement/src/LocalFileStorageResource.cs index 0dea2de14519..da3d18154ade 100644 --- a/sdk/storage/Azure.Storage.DataMovement/src/LocalFileStorageResource.cs +++ b/sdk/storage/Azure.Storage.DataMovement/src/LocalFileStorageResource.cs @@ -20,7 +20,7 @@ public class LocalFileStorageResource : StorageResourceSingle /// /// The identifier for the type of storage resource. /// - public override string ResourceId => "LocalFile"; + protected internal override string ResourceId => "LocalFile"; /// /// Returns URL @@ -35,25 +35,25 @@ public class LocalFileStorageResource : StorageResourceSingle /// /// Defines whether the storage resource type can produce a web URL. /// - public override bool CanProduceUri => false; + protected internal override bool CanProduceUri => false; /// /// Defines the recommended Transfer Type of the resource /// - public override TransferType TransferType => TransferType.Sequential; + protected internal override TransferType TransferType => TransferType.Sequential; /// /// Defines the maximum chunk size for the storage resource. /// /// TODO: consider changing this. - public override long MaxChunkSize => Constants.Blob.Block.MaxStageBytes; + protected internal override long MaxChunkSize => Constants.Blob.Block.MaxStageBytes; /// /// Length of the storage resource. This information is can obtained during a GetStorageResources API call. /// /// Will return default if the length was not set by a GetStorageResources API call. /// - public override long? Length => default; + protected internal override long? Length => default; /// /// Constructor @@ -76,7 +76,7 @@ public LocalFileStorageResource(string path) /// /// /// - public override Task ReadStreamAsync( + protected internal override Task ReadStreamAsync( long position = 0, long? length = default, CancellationToken cancellationToken = default) @@ -121,7 +121,7 @@ internal Task CreateAsync(bool overwrite) /// /// /// - public override async Task WriteFromStreamAsync( + protected internal override async Task WriteFromStreamAsync( Stream stream, long streamLength, bool overwrite, @@ -170,7 +170,7 @@ await stream.CopyToAsync( /// /// /// - public override Task CopyFromUriAsync( + protected internal override Task CopyFromUriAsync( StorageResourceSingle sourceResource, bool overwrite, long completeLength, @@ -194,7 +194,7 @@ public override Task CopyFromUriAsync( /// /// /// - public override Task CopyBlockFromUriAsync( + protected internal override Task CopyBlockFromUriAsync( StorageResourceSingle sourceResource, HttpRange range, bool overwrite, @@ -211,7 +211,7 @@ public override Task CopyBlockFromUriAsync( /// See . /// /// Returns the properties of the Local File Storage Resource. See - public override Task GetPropertiesAsync(CancellationToken cancellationToken = default) + protected internal override Task GetPropertiesAsync(CancellationToken cancellationToken = default) { FileInfo fileInfo = new FileInfo(_path); if (fileInfo.Exists) @@ -232,7 +232,7 @@ public override Task GetPropertiesAsync(CancellationT /// Gets the HTTP Authorization header for the storage resource if available. If not available /// will return default. /// - public override Task GetCopyAuthorizationHeaderAsync(CancellationToken cancellationToken = default) + protected internal override Task GetCopyAuthorizationHeaderAsync(CancellationToken cancellationToken = default) { throw new NotSupportedException(); } @@ -243,7 +243,7 @@ public override Task GetCopyAuthorizationHeaderAsync(Cancella /// If the transfer requires client-side encryption, necessary /// operations will occur here. /// - public override Task CompleteTransferAsync(bool overwrite, CancellationToken cancellationToken = default) + protected internal override Task CompleteTransferAsync(bool overwrite, CancellationToken cancellationToken = default) { if (File.Exists(_path)) { @@ -265,7 +265,7 @@ public override Task CompleteTransferAsync(bool overwrite, CancellationToken can /// If the storage resource exists and is deleted, true will be returned. /// Otherwise if the storage resource does not exist, false will be returned. /// - public override Task DeleteIfExistsAsync(CancellationToken cancellationToken = default) + protected internal override Task DeleteIfExistsAsync(CancellationToken cancellationToken = default) { if (File.Exists(_path)) { diff --git a/sdk/storage/Azure.Storage.DataMovement/src/StorageResource.cs b/sdk/storage/Azure.Storage.DataMovement/src/StorageResource.cs index f0a25b42fb39..0d6d79c42c69 100644 --- a/sdk/storage/Azure.Storage.DataMovement/src/StorageResource.cs +++ b/sdk/storage/Azure.Storage.DataMovement/src/StorageResource.cs @@ -20,7 +20,7 @@ protected StorageResource() /// /// Defines whether the storage resource type can produce a web URL. /// - public abstract bool CanProduceUri { get; } + protected internal abstract bool CanProduceUri { get; } /// /// Gets the Uri. @@ -35,6 +35,6 @@ protected StorageResource() /// /// Defines whether the storage resource is a container. /// - public abstract bool IsContainer { get; } + protected internal abstract bool IsContainer { get; } } } diff --git a/sdk/storage/Azure.Storage.DataMovement/src/StorageResourceContainer.cs b/sdk/storage/Azure.Storage.DataMovement/src/StorageResourceContainer.cs index f20d9b9e64c2..41531b934b99 100644 --- a/sdk/storage/Azure.Storage.DataMovement/src/StorageResourceContainer.cs +++ b/sdk/storage/Azure.Storage.DataMovement/src/StorageResourceContainer.cs @@ -19,18 +19,18 @@ protected StorageResourceContainer() { } /// /// Lists all the child storage resources in the path. /// - public abstract IAsyncEnumerable GetStorageResourcesAsync( + protected internal abstract IAsyncEnumerable GetStorageResourcesAsync( CancellationToken cancellationToken = default); /// /// Returns storage resources from the parent resource container /// /// - public abstract StorageResourceSingle GetChildStorageResource(string path); + protected internal abstract StorageResourceSingle GetChildStorageResource(string path); /// /// Storage Resource is a container. /// - public override bool IsContainer => true; + protected internal override bool IsContainer => true; } } diff --git a/sdk/storage/Azure.Storage.DataMovement/src/StorageResourceSingle.cs b/sdk/storage/Azure.Storage.DataMovement/src/StorageResourceSingle.cs index 2148a5748065..c9822c49a094 100644 --- a/sdk/storage/Azure.Storage.DataMovement/src/StorageResourceSingle.cs +++ b/sdk/storage/Azure.Storage.DataMovement/src/StorageResourceSingle.cs @@ -22,29 +22,29 @@ protected StorageResourceSingle() { } /// /// The identifier for the type of storage resource. /// - public abstract string ResourceId { get; } + protected internal abstract string ResourceId { get; } /// /// Defines the transfer type of the storage resource. /// - public abstract TransferType TransferType { get; } + protected internal abstract TransferType TransferType { get; } /// /// Defines the maximum chunk size for the storage resource. /// - public abstract long MaxChunkSize { get; } + protected internal abstract long MaxChunkSize { get; } /// /// Storage Resource is a container. /// - public override bool IsContainer => false; + protected internal override bool IsContainer => false; /// /// Length of the storage resource. This information is can obtained during a GetStorageResources API call. /// /// Will return default if the length was not set by a GetStorageResources API call. /// - public abstract long? Length { get; } + protected internal abstract long? Length { get; } /// /// Consumes the readable stream to upload @@ -60,7 +60,7 @@ protected StorageResourceSingle() { } /// notifications that the operation should be cancelled. /// /// - public abstract Task ReadStreamAsync( + protected internal abstract Task ReadStreamAsync( long position = 0, long? length = default, CancellationToken cancellationToken = default); @@ -87,7 +87,7 @@ public abstract Task ReadStreamAsync( /// notifications that the operation should be cancelled. /// /// - public abstract Task WriteFromStreamAsync( + protected internal abstract Task WriteFromStreamAsync( Stream stream, long streamLength, bool overwrite, @@ -112,7 +112,7 @@ public abstract Task WriteFromStreamAsync( /// notifications that the operation should be cancelled. /// /// - public abstract Task CopyFromUriAsync( + protected internal abstract Task CopyFromUriAsync( StorageResourceSingle sourceResource, bool overwrite, long completeLength, @@ -136,7 +136,7 @@ public abstract Task CopyFromUriAsync( /// notifications that the operation should be cancelled. /// /// - public abstract Task CopyBlockFromUriAsync( + protected internal abstract Task CopyBlockFromUriAsync( StorageResourceSingle sourceResource, HttpRange range, bool overwrite, @@ -150,7 +150,7 @@ public abstract Task CopyBlockFromUriAsync( /// See . /// /// Returns the properties of the Storage Resource. See - public abstract Task GetPropertiesAsync(CancellationToken token = default); + protected internal abstract Task GetPropertiesAsync(CancellationToken token = default); /// /// Gets the Authorization Header for the storage resource if available. @@ -163,7 +163,7 @@ public abstract Task CopyBlockFromUriAsync( /// Gets the HTTP Authorization header for the storage resource if available. If not available /// will return default. /// - public abstract Task GetCopyAuthorizationHeaderAsync(CancellationToken cancellationToken = default); + protected internal abstract Task GetCopyAuthorizationHeaderAsync(CancellationToken cancellationToken = default); /// /// If the operation requires any ending transfers (e.g. Committing a block list, flushing crypto streams) @@ -176,7 +176,7 @@ public abstract Task CopyBlockFromUriAsync( /// notifications that the operation should be cancelled. /// /// The Task which Commits the list of ids - public abstract Task CompleteTransferAsync(bool overwrite, CancellationToken cancellationToken = default); + protected internal abstract Task CompleteTransferAsync(bool overwrite, CancellationToken cancellationToken = default); /// /// Deletes the respective storage resource. @@ -189,6 +189,6 @@ public abstract Task CopyBlockFromUriAsync( /// If the storage resource exists and is deleted, true will be returned. /// Otherwise if the storage resource does not exist, false will be returned. /// - public abstract Task DeleteIfExistsAsync(CancellationToken cancellationToken = default); + protected internal abstract Task DeleteIfExistsAsync(CancellationToken cancellationToken = default); } } diff --git a/sdk/storage/Azure.Storage.DataMovement/tests/MockStorageResource.cs b/sdk/storage/Azure.Storage.DataMovement/tests/MockStorageResource.cs index 69381e5aa4d0..9c069fdda945 100644 --- a/sdk/storage/Azure.Storage.DataMovement/tests/MockStorageResource.cs +++ b/sdk/storage/Azure.Storage.DataMovement/tests/MockStorageResource.cs @@ -15,21 +15,21 @@ internal class MockStorageResource : StorageResourceSingle { private readonly Stream _readStream; - public override string ResourceId => "Mock"; + protected internal override string ResourceId => "Mock"; - public override TransferType TransferType => TransferType.Sequential; + protected internal override TransferType TransferType => TransferType.Sequential; private readonly long _maxChunkSize; - public override long MaxChunkSize => _maxChunkSize; + protected internal override long MaxChunkSize => _maxChunkSize; private readonly bool _canProduceUri; - public override bool CanProduceUri => _canProduceUri; + protected internal override bool CanProduceUri => _canProduceUri; public override Uri Uri => new Uri("https://example.com"); public override string Path => "random"; - public override long? Length { get; } + protected internal override long? Length { get; } private MockStorageResource(long? length, bool conProduceUri, long maxChunkSize) { @@ -52,27 +52,27 @@ public static MockStorageResource MakeDestinationResource(bool canProduceUri, lo return new MockStorageResource(default, canProduceUri, maxChunkSize ?? 1024); } - public override Task CompleteTransferAsync(bool overwrite, CancellationToken cancellationToken = default) + protected internal override Task CompleteTransferAsync(bool overwrite, CancellationToken cancellationToken = default) { return Task.CompletedTask; } - public override Task CopyBlockFromUriAsync(StorageResourceSingle sourceResource, HttpRange range, bool overwrite, long completeLength = 0, StorageResourceCopyFromUriOptions options = null, CancellationToken cancellationToken = default) + protected internal override Task CopyBlockFromUriAsync(StorageResourceSingle sourceResource, HttpRange range, bool overwrite, long completeLength = 0, StorageResourceCopyFromUriOptions options = null, CancellationToken cancellationToken = default) { return Task.CompletedTask; } - public override Task CopyFromUriAsync(StorageResourceSingle sourceResource, bool overwrite, long completeLength, StorageResourceCopyFromUriOptions options = null, CancellationToken cancellationToken = default) + protected internal override Task CopyFromUriAsync(StorageResourceSingle sourceResource, bool overwrite, long completeLength, StorageResourceCopyFromUriOptions options = null, CancellationToken cancellationToken = default) { return Task.CompletedTask; } - public override Task DeleteIfExistsAsync(CancellationToken cancellationToken = default) + protected internal override Task DeleteIfExistsAsync(CancellationToken cancellationToken = default) { return Task.FromResult(true); } - public override Task GetPropertiesAsync(CancellationToken token = default) + protected internal override Task GetPropertiesAsync(CancellationToken token = default) { return Task.FromResult(new StorageResourceProperties( lastModified: default, @@ -82,18 +82,18 @@ public override Task GetPropertiesAsync(CancellationT resourceType: StorageResourceType.LocalFile)); } - public override Task GetCopyAuthorizationHeaderAsync(CancellationToken cancellationToken = default) + protected internal override Task GetCopyAuthorizationHeaderAsync(CancellationToken cancellationToken = default) { return Task.FromResult(default); } - public override Task ReadStreamAsync(long position = 0, long? length = null, CancellationToken cancellationToken = default) + protected internal override Task ReadStreamAsync(long position = 0, long? length = null, CancellationToken cancellationToken = default) { _readStream.Position = 0; return Task.FromResult(new ReadStreamStorageResourceResult(_readStream)); } - public override async Task WriteFromStreamAsync(Stream stream, long streamLength, bool overwrite, long position = 0, long completeLength = 0, StorageResourceWriteToOffsetOptions options = null, CancellationToken cancellationToken = default) + protected internal override async Task WriteFromStreamAsync(Stream stream, long streamLength, bool overwrite, long position = 0, long completeLength = 0, StorageResourceWriteToOffsetOptions options = null, CancellationToken cancellationToken = default) { await stream.CopyToAsync(Stream.Null); }