Skip to content

Commit c2dd7d4

Browse files
authored
[Storage] [Datamovement] Replacing DataTransferProperty with isPropertySet (Azure#47868)
* WIP - removed DataTransferProperty from checkpointer * Removed DataTransferProperty from API options and implemented isPropertySet * Export API * Update changelog * Update Snippets and remove wrong api generate * PR comments * Update to default comments for preserve properties
1 parent d79be96 commit c2dd7d4

File tree

87 files changed

+1655
-1849
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

87 files changed

+1655
-1849
lines changed

sdk/storage/Azure.Storage.DataMovement.Blobs/CHANGELOG.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,14 @@
55
### Features Added
66

77
### Breaking Changes
8+
- Changed `BlobStorageResourceContainerOptions.BlobType` type from `DataTransferProperty<BlobType>` to `BlobType`
9+
- Changed `BlobStorageResourceOptions.Metadata` type from `DataTransferProperty<IDictionary<string, string>>` to `IDictionary<string, string>`
10+
- Changed the following types from `DataTranferProperty<string>` to `string`
11+
- `BlobStorageResourceOptions.ContentType`
12+
- `BlobStorageResourceOptions.ContentLanguage`
13+
- `BlobStorageResourceOptions.ContentEncoding`
14+
- `BlobStorageResourceOptions.ContentDisposition`
15+
- `BlobStorageResourceOptions.CacheControl`
816
- Changed `BlobContainerClient.StartUploadDirectoryAsync` to `BlobContainerClient.UploadDirectoryAsync` and added a required `waitUntil` parameter.
917
- Changed `BlobContainerClient.StartDownloadToDirectoryAsync` to `BlobContainerClient.DownloadToDirectoryAsync` and added a required `waitUntil` parameter.
1018

sdk/storage/Azure.Storage.DataMovement.Blobs/README.md

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -136,11 +136,10 @@ StorageResource virtualDirectoryResource = blobs.FromClient(
136136
```C# Snippet:ResourceConstruction_Blobs_WithOptions_BlockBlob
137137
BlockBlobStorageResourceOptions resourceOptions = new()
138138
{
139-
Metadata = new DataTransferProperty<IDictionary<string, string>> (
140-
new Dictionary<string, string>
139+
Metadata = new Dictionary<string, string>
141140
{
142141
{ "key", "value" }
143-
})
142+
}
144143
};
145144
StorageResource leasedBlockBlobResource = blobs.FromClient(
146145
blockBlobClient,
@@ -170,7 +169,7 @@ TransferOperation transferOperation = await transferManager.StartTransferAsync(
170169
new BlobStorageResourceContainerOptions()
171170
{
172171
// Block blobs are the default if not specified
173-
BlobType = new(BlobType.Block),
172+
BlobType = BlobType.Block,
174173
BlobDirectoryPrefix = optionalDestinationPrefix,
175174
}));
176175
```
@@ -231,7 +230,7 @@ destinationResource: blobs.FromContainer(
231230
{
232231
// all source blobs will be copied as a single type of destination blob
233232
// defaults to block blobs if unspecified
234-
BlobType = new(BlobType.Block),
233+
BlobType = BlobType.Block,
235234
BlobDirectoryPrefix = downloadPath
236235
}));
237236
await transferOperation.WaitForCompletionAsync();

sdk/storage/Azure.Storage.DataMovement.Blobs/api/Azure.Storage.DataMovement.Blobs.net6.0.cs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -49,18 +49,18 @@ public partial class BlobStorageResourceContainerOptions
4949
public BlobStorageResourceContainerOptions() { }
5050
public string BlobDirectoryPrefix { get { throw null; } set { } }
5151
public Azure.Storage.DataMovement.Blobs.BlobStorageResourceOptions BlobOptions { get { throw null; } set { } }
52-
public Azure.Storage.DataMovement.DataTransferProperty<Azure.Storage.Blobs.Models.BlobType?> BlobType { get { throw null; } set { } }
52+
public Azure.Storage.Blobs.Models.BlobType? BlobType { get { throw null; } set { } }
5353
}
5454
public partial class BlobStorageResourceOptions
5555
{
5656
public BlobStorageResourceOptions() { }
5757
public Azure.Storage.Blobs.Models.AccessTier? AccessTier { get { throw null; } set { } }
58-
public Azure.Storage.DataMovement.DataTransferProperty<string> CacheControl { get { throw null; } set { } }
59-
public Azure.Storage.DataMovement.DataTransferProperty<string> ContentDisposition { get { throw null; } set { } }
60-
public Azure.Storage.DataMovement.DataTransferProperty<string> ContentEncoding { get { throw null; } set { } }
61-
public Azure.Storage.DataMovement.DataTransferProperty<string> ContentLanguage { get { throw null; } set { } }
62-
public Azure.Storage.DataMovement.DataTransferProperty<string> ContentType { get { throw null; } set { } }
63-
public Azure.Storage.DataMovement.DataTransferProperty<System.Collections.Generic.IDictionary<string, string>> Metadata { get { throw null; } set { } }
58+
public string CacheControl { get { throw null; } set { } }
59+
public string ContentDisposition { get { throw null; } set { } }
60+
public string ContentEncoding { get { throw null; } set { } }
61+
public string ContentLanguage { get { throw null; } set { } }
62+
public string ContentType { get { throw null; } set { } }
63+
public System.Collections.Generic.IDictionary<string, string> Metadata { get { throw null; } set { } }
6464
}
6565
public partial class BlockBlobStorageResourceOptions : Azure.Storage.DataMovement.Blobs.BlobStorageResourceOptions
6666
{

sdk/storage/Azure.Storage.DataMovement.Blobs/api/Azure.Storage.DataMovement.Blobs.net8.0.cs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -49,18 +49,18 @@ public partial class BlobStorageResourceContainerOptions
4949
public BlobStorageResourceContainerOptions() { }
5050
public string BlobDirectoryPrefix { get { throw null; } set { } }
5151
public Azure.Storage.DataMovement.Blobs.BlobStorageResourceOptions BlobOptions { get { throw null; } set { } }
52-
public Azure.Storage.DataMovement.DataTransferProperty<Azure.Storage.Blobs.Models.BlobType?> BlobType { get { throw null; } set { } }
52+
public Azure.Storage.Blobs.Models.BlobType? BlobType { get { throw null; } set { } }
5353
}
5454
public partial class BlobStorageResourceOptions
5555
{
5656
public BlobStorageResourceOptions() { }
5757
public Azure.Storage.Blobs.Models.AccessTier? AccessTier { get { throw null; } set { } }
58-
public Azure.Storage.DataMovement.DataTransferProperty<string> CacheControl { get { throw null; } set { } }
59-
public Azure.Storage.DataMovement.DataTransferProperty<string> ContentDisposition { get { throw null; } set { } }
60-
public Azure.Storage.DataMovement.DataTransferProperty<string> ContentEncoding { get { throw null; } set { } }
61-
public Azure.Storage.DataMovement.DataTransferProperty<string> ContentLanguage { get { throw null; } set { } }
62-
public Azure.Storage.DataMovement.DataTransferProperty<string> ContentType { get { throw null; } set { } }
63-
public Azure.Storage.DataMovement.DataTransferProperty<System.Collections.Generic.IDictionary<string, string>> Metadata { get { throw null; } set { } }
58+
public string CacheControl { get { throw null; } set { } }
59+
public string ContentDisposition { get { throw null; } set { } }
60+
public string ContentEncoding { get { throw null; } set { } }
61+
public string ContentLanguage { get { throw null; } set { } }
62+
public string ContentType { get { throw null; } set { } }
63+
public System.Collections.Generic.IDictionary<string, string> Metadata { get { throw null; } set { } }
6464
}
6565
public partial class BlockBlobStorageResourceOptions : Azure.Storage.DataMovement.Blobs.BlobStorageResourceOptions
6666
{

sdk/storage/Azure.Storage.DataMovement.Blobs/api/Azure.Storage.DataMovement.Blobs.netstandard2.0.cs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -49,18 +49,18 @@ public partial class BlobStorageResourceContainerOptions
4949
public BlobStorageResourceContainerOptions() { }
5050
public string BlobDirectoryPrefix { get { throw null; } set { } }
5151
public Azure.Storage.DataMovement.Blobs.BlobStorageResourceOptions BlobOptions { get { throw null; } set { } }
52-
public Azure.Storage.DataMovement.DataTransferProperty<Azure.Storage.Blobs.Models.BlobType?> BlobType { get { throw null; } set { } }
52+
public Azure.Storage.Blobs.Models.BlobType? BlobType { get { throw null; } set { } }
5353
}
5454
public partial class BlobStorageResourceOptions
5555
{
5656
public BlobStorageResourceOptions() { }
5757
public Azure.Storage.Blobs.Models.AccessTier? AccessTier { get { throw null; } set { } }
58-
public Azure.Storage.DataMovement.DataTransferProperty<string> CacheControl { get { throw null; } set { } }
59-
public Azure.Storage.DataMovement.DataTransferProperty<string> ContentDisposition { get { throw null; } set { } }
60-
public Azure.Storage.DataMovement.DataTransferProperty<string> ContentEncoding { get { throw null; } set { } }
61-
public Azure.Storage.DataMovement.DataTransferProperty<string> ContentLanguage { get { throw null; } set { } }
62-
public Azure.Storage.DataMovement.DataTransferProperty<string> ContentType { get { throw null; } set { } }
63-
public Azure.Storage.DataMovement.DataTransferProperty<System.Collections.Generic.IDictionary<string, string>> Metadata { get { throw null; } set { } }
58+
public string CacheControl { get { throw null; } set { } }
59+
public string ContentDisposition { get { throw null; } set { } }
60+
public string ContentEncoding { get { throw null; } set { } }
61+
public string ContentLanguage { get { throw null; } set { } }
62+
public string ContentType { get { throw null; } set { } }
63+
public System.Collections.Generic.IDictionary<string, string> Metadata { get { throw null; } set { } }
6464
}
6565
public partial class BlockBlobStorageResourceOptions : Azure.Storage.DataMovement.Blobs.BlobStorageResourceOptions
6666
{

sdk/storage/Azure.Storage.DataMovement.Blobs/samples/Sample01b_HelloWorldAsync.cs

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -148,11 +148,10 @@ public async Task ConstructFromClientsDemonstration()
148148
#region Snippet:ResourceConstruction_Blobs_WithOptions_BlockBlob
149149
BlockBlobStorageResourceOptions resourceOptions = new()
150150
{
151-
Metadata = new DataTransferProperty<IDictionary<string, string>> (
152-
new Dictionary<string, string>
151+
Metadata = new Dictionary<string, string>
153152
{
154153
{ "key", "value" }
155-
})
154+
}
156155
};
157156
StorageResource leasedBlockBlobResource = blobs.FromClient(
158157
blockBlobClient,
@@ -382,7 +381,7 @@ public async Task UploadDirectory_SasAsync()
382381
new BlobStorageResourceContainerOptions()
383382
{
384383
// Block blobs are the default if not specified
385-
BlobType = new(BlobType.Block),
384+
BlobType = BlobType.Block,
386385
BlobDirectoryPrefix = optionalDestinationPrefix,
387386
}));
388387
#endregion
@@ -841,7 +840,7 @@ public async Task CopyDirectory()
841840
{
842841
// all source blobs will be copied as a single type of destination blob
843842
// defaults to block blobs if unspecified
844-
BlobType = new(BlobType.Block),
843+
BlobType = BlobType.Block,
845844
BlobDirectoryPrefix = downloadPath
846845
}));
847846
await transferOperation.WaitForCompletionAsync();

sdk/storage/Azure.Storage.DataMovement.Blobs/src/AppendBlobStorageResource.cs

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -306,15 +306,9 @@ protected override StorageResourceCheckpointDetails GetSourceCheckpointDetails()
306306
protected override StorageResourceCheckpointDetails GetDestinationCheckpointDetails()
307307
{
308308
return new BlobDestinationCheckpointDetails(
309-
blobType: new(BlobType.Append),
310-
contentType: _options?.ContentType,
311-
contentEncoding: _options?.ContentEncoding,
312-
contentLanguage: _options?.ContentLanguage,
313-
contentDisposition: _options?.ContentDisposition,
314-
cacheControl: _options?.CacheControl,
315-
accessTier: _options?.AccessTier,
316-
metadata:_options?.Metadata,
317-
tags: default);
309+
isBlobTypeSet: true,
310+
blobType: BlobType.Append,
311+
blobOptions: _options);
318312
}
319313

320314
// no-op for get permissions

sdk/storage/Azure.Storage.DataMovement.Blobs/src/AppendBlobStorageResourceOptions.cs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,10 @@ internal AppendBlobStorageResourceOptions(BlobStorageResourceOptions other) : ba
2222
{
2323
}
2424

25+
internal AppendBlobStorageResourceOptions(BlobDestinationCheckpointDetails checkpointDetails) : base(checkpointDetails)
26+
{
27+
}
28+
2529
/// <summary>
2630
/// Optional. See <see cref="BlobRequestConditions"/>.
2731
/// Access conditions on the copying of data from this source storage resource blob.

0 commit comments

Comments
 (0)