Skip to content

Commit

Permalink
[Storage] [DataMovement] Renamed API from API Arch Board Feedback (#3…
Browse files Browse the repository at this point in the history
…7935)

* Renamed API from API Arch Board Feedback

* Export API and Update Snippetes
  • Loading branch information
amnguye authored Aug 3, 2023
1 parent af51917 commit dbec632
Show file tree
Hide file tree
Showing 96 changed files with 1,685 additions and 1,703 deletions.
5 changes: 5 additions & 0 deletions sdk/storage/Azure.Storage.DataMovement.Blobs/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,11 @@
- `*BlobStorageResource.GetPropertiesAsync`
- `*BlobStorageResource.ReadStreamAsync`
- `*BlobStorageResource.WriteFromStreamAsync`
- [BREAKING CHANGE] Renamed `BlobStorageResourceProvider.MakeResourceAsync` to `BlobStorageResourceProvider.CreateResourceAsync`
- [BREAKING CHANGE] Renamed `BlobStorageResourceContainerOptions.DirectoryPrefix` to `BlobDirectoryPrefix`
- [BREAKING CHANGE] Renamed `BlobStorageResourceContainerOptions.ResourceOptions` to `BlobOptions`
- [BREAKING CHANGE] Moved `BlobContainerClientTransferOptions` to the `Azure.Storage.DataMovement.Blobs` namespace

### Bugs Fixed

### Other Changes
Expand Down
26 changes: 13 additions & 13 deletions sdk/storage/Azure.Storage.DataMovement.Blobs/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -97,11 +97,11 @@ BlobContainerClientTransferOptions options = new BlobContainerClientTransferOpti
{
BlobContainerOptions = new BlobStorageResourceContainerOptions
{
DirectoryPrefix = blobDirectoryPrefix
BlobDirectoryPrefix = blobDirectoryPrefix
},
TransferOptions = new TransferOptions()
TransferOptions = new DataTransferOptions()
{
CreateMode = StorageResourceCreateMode.Overwrite,
CreationPreference = StorageResourceCreationPreference.OverwriteIfExists,
}
};

Expand Down Expand Up @@ -130,11 +130,11 @@ BlobContainerClientTransferOptions options = new BlobContainerClientTransferOpti
{
BlobContainerOptions = new BlobStorageResourceContainerOptions
{
DirectoryPrefix = blobDirectoryPrefix
BlobDirectoryPrefix = blobDirectoryPrefix
},
TransferOptions = new TransferOptions()
TransferOptions = new DataTransferOptions()
{
CreateMode = StorageResourceCreateMode.Overwrite,
CreationPreference = StorageResourceCreationPreference.OverwriteIfExists,
}
};

Expand All @@ -159,7 +159,7 @@ Blob `StorageResource` objects can be constructed with optional "options" argume
```C# Snippet:ResourceConstruction_Blobs_WithOptions_VirtualDirectory
BlobStorageResourceContainerOptions virtualDirectoryOptions = new()
{
DirectoryPrefix = "blob/directory/prefix"
BlobDirectoryPrefix = "blob/directory/prefix"
};

StorageResource virtualDirectoryResource = new BlobStorageResourceContainer(
Expand Down Expand Up @@ -190,9 +190,9 @@ if (BlobStorageResources.TryGetResourceProviders(
out BlobStorageResourceProvider blobSrcProvider,
out BlobStorageResourceProvider blobDstProvider))
{
sourceResource ??= await blobSrcProvider?.MakeResourceAsync(
sourceResource ??= await blobSrcProvider?.CreateResourceAsync(
GenerateMySasCredential(info.SourcePath));
destinationResource ??= await blobSrcProvider?.MakeResourceAsync(
destinationResource ??= await blobSrcProvider?.CreateResourceAsync(
GenerateMySasCredential(info.DestinationPath));
}
```
Expand Down Expand Up @@ -221,7 +221,7 @@ DataTransfer dataTransfer = await transferManager.StartTransferAsync(
{
// Block blobs are the default if not specified
BlobType = BlobType.Block,
DirectoryPrefix = optionalDestinationPrefix,
BlobDirectoryPrefix = optionalDestinationPrefix,
}),
transferOptions: options);
await dataTransfer.WaitForCompletionAsync();
Expand All @@ -248,7 +248,7 @@ DataTransfer dataTransfer = await transferManager.StartTransferAsync(
blobContainerClient,
new BlobStorageResourceContainerOptions()
{
DirectoryPrefix = optionalSourcePrefix
BlobDirectoryPrefix = optionalSourcePrefix
}),
destinationResource: new LocalDirectoryStorageResourceContainer(downloadPath));
await dataTransfer.WaitForCompletionAsync();
Expand All @@ -275,7 +275,7 @@ DataTransfer dataTransfer = await transferManager.StartTransferAsync(
sourceContainer,
new BlobStorageResourceContainerOptions()
{
DirectoryPrefix = sourceDirectoryName
BlobDirectoryPrefix = sourceDirectoryName
}),
destinationResource: new BlobStorageResourceContainer(
destinationContainer,
Expand All @@ -284,7 +284,7 @@ DataTransfer dataTransfer = await transferManager.StartTransferAsync(
// all source blobs will be copied as a single type of destination blob
// defaults to block blobs if unspecified
BlobType = BlobType.Block,
DirectoryPrefix = downloadPath
BlobDirectoryPrefix = downloadPath
}));
```

Expand Down

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ public async Task ResourceConstructionDemonstration()
#region Snippet:ResourceConstruction_Blobs_WithOptions_VirtualDirectory
BlobStorageResourceContainerOptions virtualDirectoryOptions = new()
{
DirectoryPrefix = "blob/directory/prefix"
BlobDirectoryPrefix = "blob/directory/prefix"
};

StorageResource virtualDirectoryResource = new BlobStorageResourceContainer(
Expand Down Expand Up @@ -161,7 +161,7 @@ public async Task RehydrateBlobResource_SasAsync()
DataTransfer dataTransfer = await transferManager.StartTransferAsync(
sourceResource: source,
destinationResource: destination);
await dataTransfer.PauseIfRunningAsync();
await dataTransfer.PauseAsync();

DataTransferProperties info = await transferManager.GetResumableTransfersAsync().FirstAsync();

Expand All @@ -181,9 +181,9 @@ AzureSasCredential GenerateMySasCredential(string blobUri)
out BlobStorageResourceProvider blobSrcProvider,
out BlobStorageResourceProvider blobDstProvider))
{
sourceResource ??= await blobSrcProvider?.MakeResourceAsync(
sourceResource ??= await blobSrcProvider?.CreateResourceAsync(
GenerateMySasCredential(info.SourcePath));
destinationResource ??= await blobSrcProvider?.MakeResourceAsync(
destinationResource ??= await blobSrcProvider?.CreateResourceAsync(
GenerateMySasCredential(info.DestinationPath));
}
#endregion
Expand Down Expand Up @@ -249,7 +249,7 @@ public async Task DownloadSingle_SharedKeyAuthAsync()
// Create Blob Data Controller to skip through all failures
TransferManagerOptions options = new TransferManagerOptions()
{
ErrorHandling = ErrorHandlingBehavior.ContinueOnFailure
ErrorHandling = DataTransferErrorMode.ContinueOnFailure
};
TransferManager transferManager = new TransferManager(options);

Expand Down Expand Up @@ -340,14 +340,14 @@ public async Task UploadDirectory_SasAsync()
// Get a storage resource to a destination blob directory
StorageResourceContainer directoryDestination = new BlobStorageResourceContainer(
blobContainerClient,
new BlobStorageResourceContainerOptions() { DirectoryPrefix = "sample-directory" });
new BlobStorageResourceContainerOptions() { BlobDirectoryPrefix = "sample-directory" });

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

Expand All @@ -362,7 +362,7 @@ public async Task UploadDirectory_SasAsync()
{
// Block blobs are the default if not specified
BlobType = BlobType.Block,
DirectoryPrefix = optionalDestinationPrefix,
BlobDirectoryPrefix = optionalDestinationPrefix,
}),
transferOptions: options);
await dataTransfer.WaitForCompletionAsync();
Expand Down Expand Up @@ -437,8 +437,8 @@ public async Task UploadDirectory_CompletedEventHandler()
{
// Create BlobTransferManager with event handler in Options bag
TransferManagerOptions options = new TransferManagerOptions();
TransferOptions transferOptions = new TransferOptions();
transferOptions.SingleTransferCompleted += (SingleTransferCompletedEventArgs args) =>
DataTransferOptions transferOptions = new DataTransferOptions();
transferOptions.ItemTransferCompleted += (TransferItemCompletedEventArgs args) =>
{
using (StreamWriter logStream = File.AppendText(logFile))
{
Expand All @@ -453,7 +453,7 @@ public async Task UploadDirectory_CompletedEventHandler()
new LocalDirectoryStorageResourceContainer(sourcePath),
new BlobStorageResourceContainer(
container,
new BlobStorageResourceContainerOptions() { DirectoryPrefix = "sample-blob-directory" }));
new BlobStorageResourceContainerOptions() { BlobDirectoryPrefix = "sample-blob-directory" }));
}
finally
{
Expand Down Expand Up @@ -524,10 +524,10 @@ public async Task UploadDirectory_EventHandler_SasAsync()
{
// Create BlobTransferManager with event handler in Options bag
TransferManagerOptions options = new TransferManagerOptions();
TransferOptions transferOptions = new TransferOptions();
transferOptions.TransferStatus += (TransferStatusEventArgs args) =>
DataTransferOptions transferOptions = new DataTransferOptions();
transferOptions.TransferStatusChanged += (TransferStatusEventArgs args) =>
{
if (args.StorageTransferStatus == StorageTransferStatus.Completed)
if (args.StorageTransferStatus == DataTransferStatus.Completed)
{
using (StreamWriter logStream = File.AppendText(logFile))
{
Expand All @@ -536,7 +536,7 @@ public async Task UploadDirectory_EventHandler_SasAsync()
}
return Task.CompletedTask;
};
transferOptions.TransferFailed += (TransferFailedEventArgs args) =>
transferOptions.ItemTransferFailed += (TransferItemFailedEventArgs args) =>
{
using (StreamWriter logStream = File.AppendText(logFile))
{
Expand All @@ -556,7 +556,7 @@ public async Task UploadDirectory_EventHandler_SasAsync()
new LocalDirectoryStorageResourceContainer(sourcePath),
new BlobStorageResourceContainer(
container,
new BlobStorageResourceContainerOptions() { DirectoryPrefix = "sample-blob-directory" }));
new BlobStorageResourceContainerOptions() { BlobDirectoryPrefix = "sample-blob-directory" }));
}
finally
{
Expand Down Expand Up @@ -609,9 +609,9 @@ public async Task DownloadDirectory_EventHandler_ActiveDirectoryAuthAsync()
{
// Get a reference to a source blobs and upload sample content to download
StorageResourceContainer sourceDirectory = new BlobStorageResourceContainer(blobContainerClient,
new BlobStorageResourceContainerOptions() { DirectoryPrefix = "sample-blob-directory" });
new BlobStorageResourceContainerOptions() { BlobDirectoryPrefix = "sample-blob-directory" });
StorageResourceContainer sourceDirectory2 = new BlobStorageResourceContainer(blobContainerClient,
new BlobStorageResourceContainerOptions() { DirectoryPrefix = "sample-blob-directory2" });
new BlobStorageResourceContainerOptions() { BlobDirectoryPrefix = "sample-blob-directory2" });
StorageResourceContainer destinationDirectory = new LocalDirectoryStorageResourceContainer(downloadPath);
StorageResourceContainer destinationDirectory2 = new LocalDirectoryStorageResourceContainer(downloadPath2);

Expand All @@ -624,8 +624,8 @@ public async Task DownloadDirectory_EventHandler_ActiveDirectoryAuthAsync()

// Create BlobTransferManager with event handler in Options bag
TransferManagerOptions options = new TransferManagerOptions();
TransferOptions downloadOptions = new TransferOptions();
downloadOptions.TransferFailed += async (TransferFailedEventArgs args) =>
DataTransferOptions downloadOptions = new DataTransferOptions();
downloadOptions.ItemTransferFailed += async (TransferItemFailedEventArgs args) =>
{
// Log Exception Message
Console.WriteLine(args.Exception.Message);
Expand All @@ -646,7 +646,7 @@ await transferManager.StartTransferAsync(
blobContainerClient,
new BlobStorageResourceContainerOptions()
{
DirectoryPrefix = optionalSourcePrefix
BlobDirectoryPrefix = optionalSourcePrefix
}),
destinationResource: new LocalDirectoryStorageResourceContainer(downloadPath));
await dataTransfer.WaitForCompletionAsync();
Expand Down Expand Up @@ -713,7 +713,7 @@ public async Task CopySingle_ConnectionStringAsync()
#endregion

Assert.IsTrue(await destinationAppendBlobClient.ExistsAsync());
Assert.AreEqual(dataTransfer.TransferStatus, StorageTransferStatus.Completed);
Assert.AreEqual(dataTransfer.TransferStatus, DataTransferStatus.Completed);
}
finally
{
Expand Down Expand Up @@ -767,9 +767,9 @@ public async Task CopyDirectory()

// Get a reference to a source blobs and upload sample content to download
StorageResourceContainer sourceDirectory1 = new BlobStorageResourceContainer(container,
new BlobStorageResourceContainerOptions() { DirectoryPrefix = sourceDirectoryName });
new BlobStorageResourceContainerOptions() { BlobDirectoryPrefix = sourceDirectoryName });
StorageResourceContainer sourceDirectory2 = new BlobStorageResourceContainer(container,
new BlobStorageResourceContainerOptions() { DirectoryPrefix = sourceDirectoryName2 });
new BlobStorageResourceContainerOptions() { BlobDirectoryPrefix = sourceDirectoryName2 });

// Create destination paths
StorageResourceContainer destinationDirectory1 = new LocalDirectoryStorageResourceContainer(downloadPath);
Expand All @@ -786,8 +786,8 @@ public async Task CopyDirectory()
// Create Blob Transfer Manager
TransferManager transferManager = new TransferManager(default);
#pragma warning disable CS1998 // Async method lacks 'await' operators and will run synchronously
TransferOptions options = new TransferOptions();
options.TransferFailed += async (TransferFailedEventArgs args) =>
DataTransferOptions options = new DataTransferOptions();
options.ItemTransferFailed += async (TransferItemFailedEventArgs args) =>
{
//await LogFailedFileAsync(args.SourceFileUri, args.DestinationFileClient.Uri, args.Exception.Message);
};
Expand All @@ -802,7 +802,7 @@ public async Task CopyDirectory()
sourceContainer,
new BlobStorageResourceContainerOptions()
{
DirectoryPrefix = sourceDirectoryName
BlobDirectoryPrefix = sourceDirectoryName
}),
destinationResource: new BlobStorageResourceContainer(
destinationContainer,
Expand All @@ -811,7 +811,7 @@ public async Task CopyDirectory()
// all source blobs will be copied as a single type of destination blob
// defaults to block blobs if unspecified
BlobType = BlobType.Block,
DirectoryPrefix = downloadPath
BlobDirectoryPrefix = downloadPath
}));
#endregion
}
Expand Down Expand Up @@ -878,8 +878,8 @@ StorageSharedKeyCredential GetMyCredential(string uri)
out LocalStorageResourceProvider localSrcProvider,
out LocalStorageResourceProvider localDstProvider))
{
sourceResource ??= localSrcProvider.MakeResource();
destinationResource ??= localDstProvider.MakeResource();
sourceResource ??= localSrcProvider.CreateResource();
destinationResource ??= localDstProvider.CreateResource();
}
return (sourceResource, destinationResource);
}
Expand Down Expand Up @@ -942,7 +942,7 @@ public async Task PauseAndResumeAsync_DataTransferPause()
destinationResource: destinationResource);

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

DataTransfer resumedTransfer = await transferManager.ResumeTransferAsync(
transferId: dataTransfer.Id,
Expand Down Expand Up @@ -1007,11 +1007,11 @@ public async Task UploadDirectory()
{
BlobContainerOptions = new BlobStorageResourceContainerOptions
{
DirectoryPrefix = blobDirectoryPrefix
BlobDirectoryPrefix = blobDirectoryPrefix
},
TransferOptions = new TransferOptions()
TransferOptions = new DataTransferOptions()
{
CreateMode = StorageResourceCreateMode.Overwrite,
CreationPreference = StorageResourceCreationPreference.OverwriteIfExists,
}
};

Expand Down Expand Up @@ -1077,11 +1077,11 @@ public async Task DownloadDirectory()
{
BlobContainerOptions = new BlobStorageResourceContainerOptions
{
DirectoryPrefix = blobDirectoryPrefix
BlobDirectoryPrefix = blobDirectoryPrefix
},
TransferOptions = new TransferOptions()
TransferOptions = new DataTransferOptions()
{
CreateMode = StorageResourceCreateMode.Overwrite,
CreationPreference = StorageResourceCreationPreference.OverwriteIfExists,
}
};

Expand Down
Loading

0 comments on commit dbec632

Please sign in to comment.