Azure.Storage.DataMovement 12.0.0-beta.3

Prefix Reserved
This is a prerelease version of Azure.Storage.DataMovement.
There is a newer prerelease version of this package available.
See the version list below for details.
dotnet add package Azure.Storage.DataMovement --version 12.0.0-beta.3                
NuGet\Install-Package Azure.Storage.DataMovement -Version 12.0.0-beta.3                
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="Azure.Storage.DataMovement" Version="12.0.0-beta.3" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add Azure.Storage.DataMovement --version 12.0.0-beta.3                
#r "nuget: Azure.Storage.DataMovement, 12.0.0-beta.3"                
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install Azure.Storage.DataMovement as a Cake Addin
#addin nuget:?package=Azure.Storage.DataMovement&version=12.0.0-beta.3&prerelease

// Install Azure.Storage.DataMovement as a Cake Tool
#tool nuget:?package=Azure.Storage.DataMovement&version=12.0.0-beta.3&prerelease                

Azure Storage Data Movement Common client library for .NET

Server Version: 2021-02-12, 2020-12-06, 2020-10-02, 2020-08-04, 2020-06-12, 2020-04-08, 2020-02-10, 2019-12-12, 2019-07-07, and 2020-02-02

Azure Storage is a Microsoft-managed service providing cloud storage that is highly available, secure, durable, scalable, and redundant.

The Azure Storage Data Movement library is optimized for uploading, downloading and copying customer data.

Currently this version of the Data Movement library only supports Blobs.

Source code | API reference documentation | REST API documentation | Product documentation

Getting started

Install the package

Install the Azure Storage client library for .NET you'd like to use with NuGet and the Azure.Storage.DataMovement client library will be included:

dotnet add package Azure.Storage.DataMovement --prerelease

Prerequisites

You need an Azure subscription and a Storage Account to use this package.

To create a new Storage Account, you can use the Azure Portal, Azure PowerShell, or the Azure CLI. Here's an example using the Azure CLI:

az storage account create --name MyStorageAccount --resource-group MyResourceGroup --location westus --sku Standard_LRS

Authenticate the client

In order to interact with the Data Movement library you have to create an instance with the TransferManager class.

Create Instance of TransferManager

TransferManager transferManager = new TransferManager(new TransferManagerOptions());

Create Instance of TransferManager with Options

// Create BlobTransferManager with event handler in Options bag
TransferManagerOptions transferManagerOptions = new TransferManagerOptions();
TransferOptions options = new TransferOptions()
{
    MaximumTransferChunkSize = 4 * Constants.MB,
    CreateMode = StorageResourceCreateMode.Overwrite,
};
TransferManager transferManager = new TransferManager(transferManagerOptions);

Key concepts

The Azure Storage Common client library contains shared infrastructure like authentication credentials and RequestFailedException.

Thread safety

We guarantee that all client instance methods are thread-safe and independent of each other (guideline). This ensures that the recommendation of reusing client instances is always safe, even across threads.

Additional concepts

Client options | Accessing the response | Long-running operations | Handling failures | Diagnostics | Mocking | Client lifetime

Examples

Please see the examples for Blobs DataMovement.

Pause a transfer using the TransferManager using the respective DataTransfer object

DataTransfer dataTransfer = await transferManager.StartTransferAsync(
    sourceResource: sourceResource,
    destinationResource: destinationResource);

// Pause from the Transfer Manager using the DataTransfer object
await transferManager.PauseTransferIfRunningAsync(dataTransfer);

Pause a transfer using the TransferManager using the respective transfer ID

DataTransfer dataTransfer = await transferManager.StartTransferAsync(
    sourceResource: sourceResource,
    destinationResource: destinationResource);
string transferId = dataTransfer.Id;

// Pause from the Transfer Manager using the Transfer Id
await transferManager.PauseTransferIfRunningAsync(transferId);

Pause a transfer using the respective DataTransfer

DataTransfer dataTransfer = await transferManager.StartTransferAsync(
    sourceResource: sourceResource,
    destinationResource: destinationResource);

// Pause from the DataTransfer object
await dataTransfer.PauseIfRunningAsync();

Resume a transfer

async Task<(StorageResource Source, StorageResource Destination)> MakeResourcesAsync(DataTransferProperties info)
{
    StorageResource sourceResource = null, destinationResource = null;
    if (BlobStorageResources.TryGetResourceProviders(
        info,
        out BlobStorageResourceProvider blobSrcProvider,
        out BlobStorageResourceProvider blobDstProvider))
    {
        sourceResource ??= await blobSrcProvider.MakeResourceAsync(GetMyCredential(info.SourcePath));
        destinationResource ??= await blobSrcProvider.MakeResourceAsync(GetMyCredential(info.DestinationPath));
    }
    if (LocalStorageResources.TryGetResourceProviders(
        info,
        out LocalStorageResourceProvider localSrcProvider,
        out LocalStorageResourceProvider localDstProvider))
    {
        sourceResource ??= localSrcProvider.MakeResource();
        destinationResource ??= localDstProvider.MakeResource();
    }
    return (sourceResource, destinationResource);
}
List<DataTransfer> resumedTransfers = new();
await foreach (DataTransferProperties transferProperties in transferManager.GetResumableTransfersAsync())
{
    (StorageResource resumeSource, StorageResource resumeDestination) = await MakeResourcesAsync(transferProperties);
    resumedTransfers.Add(await transferManager.ResumeTransferAsync(transferProperties.TransferId, resumeSource, resumeDestination));
}

Troubleshooting

All Azure Storage services will throw a RequestFailedException with helpful ErrorCodes.

Next steps

Get started with our Blob DataMovement samples.

Contributing

See the Storage CONTRIBUTING.md for details on building, testing, and contributing to these libraries.

This project welcomes contributions and suggestions. Most contributions require you to agree to a Contributor License Agreement (CLA) declaring that you have the right to, and actually do, grant us the rights to use your contribution. For details, visit cla.microsoft.com.

This project has adopted the Microsoft Open Source Code of Conduct. For more information see the Code of Conduct FAQ or contact opencode@microsoft.com with any additional questions or comments.

Product Compatible and additional computed target framework versions.
.NET net5.0 was computed.  net5.0-windows was computed.  net6.0 is compatible.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 was computed.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 was computed.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed. 
.NET Core netcoreapp2.0 was computed.  netcoreapp2.1 was computed.  netcoreapp2.2 was computed.  netcoreapp3.0 was computed.  netcoreapp3.1 was computed. 
.NET Standard netstandard2.0 is compatible.  netstandard2.1 was computed. 
.NET Framework net461 was computed.  net462 was computed.  net463 was computed.  net47 was computed.  net471 was computed.  net472 was computed.  net48 was computed.  net481 was computed. 
MonoAndroid monoandroid was computed. 
MonoMac monomac was computed. 
MonoTouch monotouch was computed. 
Tizen tizen40 was computed.  tizen60 was computed. 
Xamarin.iOS xamarinios was computed. 
Xamarin.Mac xamarinmac was computed. 
Xamarin.TVOS xamarintvos was computed. 
Xamarin.WatchOS xamarinwatchos was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages (3)

Showing the top 3 NuGet packages that depend on Azure.Storage.DataMovement:

Package Downloads
Azure.Storage.DataMovement.Blobs

This client library enables working with the Microsoft Azure Storage services which include the blob and file services for storing binary and text data, and the queue service for storing messages that may be accessed by a client. For this release see notes - https://github.com/Azure/azure-sdk-for-net/blob/master/sdk/storage/Azure.Storage.Blob.DataMovement/README.md and https://github.com/Azure/azure-sdk-for-net/blob/master/sdk/storage/Azure.Storage.Blob.DataMovement/CHANGELOG.md in addition to the breaking changes https://github.com/Azure/azure-sdk-for-net/blob/master/sdk/storage/Azure.Storage.Blob.DataMovement/BreakingChanges.txt Microsoft Azure Storage quickstarts and tutorials - https://docs.microsoft.com/en-us/azure/storage/ Microsoft Azure Storage REST API Reference - https://docs.microsoft.com/en-us/rest/api/storageservices/

Azure.Storage.DataMovement.Files.Shares

This client library enables working with the Microsoft Azure Storage services which include the blob and file services for storing binary and text data, and the queue service for storing messages that may be accessed by a client. For this release see notes - https://github.com/Azure/azure-sdk-for-net/blob/master/sdk/storage/Azure.Storage.Blob.DataMovement/README.md and https://github.com/Azure/azure-sdk-for-net/blob/master/sdk/storage/Azure.Storage.Blob.DataMovement/CHANGELOG.md in addition to the breaking changes https://github.com/Azure/azure-sdk-for-net/blob/master/sdk/storage/Azure.Storage.Blob.DataMovement/BreakingChanges.txt Microsoft Azure Storage quickstarts and tutorials - https://docs.microsoft.com/en-us/azure/storage/ Microsoft Azure Storage REST API Reference - https://docs.microsoft.com/en-us/rest/api/storageservices/

HHDev.CanopyApi

Library that provides functionality for users of the Canopy Simulations portal to submit and download studies directly through the HH DM client.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
12.0.0-beta.6 1,843 10/14/2024
12.0.0-beta.5 4,718 7/17/2024
12.0.0-beta.4 6,974 12/5/2023
12.0.0-beta.3 20,293 7/11/2023
12.0.0-beta.2 2,586 4/27/2023
12.0.0-beta.1 603 12/16/2022