Skip to content

Commit f98032c

Browse files
Clarify overwrite behavior on upload methods (Azure#19110)
* Clarify overwrite behavior on upload methods * pr feedback Co-authored-by: jschrepp-MSFT <41338290+jschrepp-MSFT@users.noreply.github.com>
1 parent 09db78c commit f98032c

File tree

2 files changed

+104
-60
lines changed

2 files changed

+104
-60
lines changed

sdk/storage/Azure.Storage.Blobs/src/BlobClient.cs

Lines changed: 68 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -273,9 +273,8 @@ protected internal virtual BlobClient WithClientSideEncryptionOptionsCore(Client
273273

274274
#region Upload
275275
/// <summary>
276-
/// The <see cref="Upload(Stream)"/> operation creates a new block blob
277-
/// or updates the content of an existing block blob. Updating an
278-
/// existing block blob overwrites any existing metadata on the blob.
276+
/// The <see cref="Upload(Stream)"/> operation
277+
/// creates a new block blob or throws if the blob already exists.
279278
///
280279
/// For partial block blob updates and other advanced features, please
281280
/// see <see cref="BlockBlobClient"/>. To create or modify page or
@@ -301,9 +300,8 @@ public virtual Response<BlobContentInfo> Upload(Stream content) =>
301300
Upload(content, CancellationToken.None);
302301

303302
/// <summary>
304-
/// The <see cref="Upload(string)"/> operation creates a new block blob
305-
/// or updates the content of an existing block blob. Updating an
306-
/// existing block blob overwrites any existing metadata on the blob.
303+
/// The <see cref="Upload(string)"/> operation
304+
/// creates a new block blob or throws if the blob already exists.
307305
///
308306
/// For partial block blob updates and other advanced features, please
309307
/// see <see cref="BlockBlobClient"/>. To create or modify page or
@@ -357,9 +355,8 @@ public virtual async Task<Response<BlobContentInfo>> UploadAsync(Stream content)
357355
await UploadAsync(content, CancellationToken.None).ConfigureAwait(false);
358356

359357
/// <summary>
360-
/// The <see cref="UploadAsync(string)"/> operation creates a new block blob
361-
/// or updates the content of an existing block blob. Updating an
362-
/// existing block blob overwrites any existing metadata on the blob.
358+
/// The <see cref="UploadAsync(string)"/> operation
359+
/// creates a new block blob or throws if the blob already exists.
363360
///
364361
/// For partial block blob updates and other advanced features, please
365362
/// see <see cref="BlockBlobClient"/>. To create or modify page or
@@ -386,9 +383,7 @@ public virtual async Task<Response<BlobContentInfo>> UploadAsync(string path) =>
386383

387384
/// <summary>
388385
/// The <see cref="Upload(Stream, CancellationToken)"/> operation
389-
/// creates a new block blob or updates the content of an existing
390-
/// block blob. Updating an existing block blob overwrites any
391-
/// existing metadata on the blob.
386+
/// creates a new block blob or throws if the blob already exists.
392387
///
393388
/// For partial block blob updates and other advanced features, please
394389
/// see <see cref="BlockBlobClient"/>. To create or modify page or
@@ -424,9 +419,7 @@ public virtual Response<BlobContentInfo> Upload(
424419

425420
/// <summary>
426421
/// The <see cref="Upload(string, CancellationToken)"/> operation
427-
/// creates a new block blob or updates the content of an existing
428-
/// block blob. Updating an existing block blob overwrites any
429-
/// existing metadata on the blob.
422+
/// creates a new block blob or throws if the blob already exists.
430423
///
431424
/// For partial block blob updates and other advanced features, please
432425
/// see <see cref="BlockBlobClient"/>. To create or modify page or
@@ -462,9 +455,7 @@ public virtual Response<BlobContentInfo> Upload(
462455

463456
/// <summary>
464457
/// The <see cref="UploadAsync(Stream, CancellationToken)"/> operation
465-
/// creates a new block blob or updates the content of an existing
466-
/// block blob. Updating an existing block blob overwrites any
467-
/// existing metadata on the blob.
458+
/// creates a new block blob or throws if the blob already exists.
468459
///
469460
/// For partial block blob updates and other advanced features, please
470461
/// see <see cref="BlockBlobClient"/>. To create or modify page or
@@ -500,9 +491,7 @@ public virtual Task<Response<BlobContentInfo>> UploadAsync(
500491

501492
/// <summary>
502493
/// The <see cref="UploadAsync(string, CancellationToken)"/> operation
503-
/// creates a new block blob or updates the content of an existing
504-
/// block blob. Updating an existing block blob overwrites any
505-
/// existing metadata on the blob.
494+
/// creates a new block blob or throws if the blob already exists.
506495
///
507496
/// For partial block blob updates and other advanced features, please
508497
/// see <see cref="BlockBlobClient"/>. To create or modify page or
@@ -539,9 +528,7 @@ await UploadAsync(
539528

540529
/// <summary>
541530
/// The <see cref="Upload(Stream, CancellationToken)"/> operation
542-
/// creates a new block blob or updates the content of an existing
543-
/// block blob. Updating an existing block blob overwrites any
544-
/// existing metadata on the blob.
531+
/// creates a new block blob or throws if the blob already exists.
545532
///
546533
/// For partial block blob updates and other advanced features, please
547534
/// see <see cref="BlockBlobClient"/>. To create or modify page or
@@ -582,9 +569,7 @@ public virtual Response<BlobContentInfo> Upload(
582569

583570
/// <summary>
584571
/// The <see cref="Upload(string, CancellationToken)"/> operation
585-
/// creates a new block blob or updates the content of an existing
586-
/// block blob. Updating an existing block blob overwrites any
587-
/// existing metadata on the blob.
572+
/// creates a new block blob or throws if the blob already exists.
588573
///
589574
/// For partial block blob updates and other advanced features, please
590575
/// see <see cref="BlockBlobClient"/>. To create or modify page or
@@ -625,9 +610,10 @@ public virtual Response<BlobContentInfo> Upload(
625610

626611
/// <summary>
627612
/// The <see cref="UploadAsync(Stream, CancellationToken)"/> operation
628-
/// creates a new block blob or updates the content of an existing
629-
/// block blob. Updating an existing block blob overwrites any
630-
/// existing metadata on the blob.
613+
/// creates a new block blob or throws if the blob already exists.
614+
/// Setting <paramref name="overwrite"/> to true allows updating the
615+
/// content of an existing block blob. Updating an existing block blob
616+
/// overwrites any existing metadata on the blob.
631617
///
632618
/// For partial block blob updates and other advanced features, please
633619
/// see <see cref="BlockBlobClient"/>. To create or modify page or
@@ -668,9 +654,10 @@ public virtual Task<Response<BlobContentInfo>> UploadAsync(
668654

669655
/// <summary>
670656
/// The <see cref="UploadAsync(string, CancellationToken)"/> operation
671-
/// creates a new block blob or updates the content of an existing
672-
/// block blob. Updating an existing block blob overwrites any
673-
/// existing metadata on the blob.
657+
/// creates a new block blob or throws if the blob already exists.
658+
/// Setting <paramref name="overwrite"/> to true allows updating the
659+
/// content of an existing block blob. Updating an existing block blob
660+
/// overwrites any existing metadata on the blob.
674661
///
675662
/// For partial block blob updates and other advanced features, please
676663
/// see <see cref="BlockBlobClient"/>. To create or modify page or
@@ -712,10 +699,14 @@ await UploadAsync(
712699

713700
/// <summary>
714701
/// The <see cref="Upload(Stream, BlobUploadOptions, CancellationToken)"/>
715-
/// operation creates a new block blob or updates the content of an
716-
/// existing block blob. Updating an existing block blob overwrites
702+
/// operation overwrites the contents of the blob, creating a new block
703+
/// blob if none exists. Overwriting an existing block blob replaces
717704
/// any existing metadata on the blob.
718705
///
706+
/// Set <see href="https://docs.microsoft.com/en-us/rest/api/storageservices/specifying-conditional-headers-for-blob-service-operations">
707+
/// access conditions</see> through <see cref="BlobUploadOptions.Conditions"/>
708+
/// to avoid overwriting existing data.
709+
///
719710
/// For partial block blob updates and other advanced features, please
720711
/// see <see cref="BlockBlobClient"/>. To create or modify page or
721712
/// append blobs, please see <see cref="PageBlobClient"/> or
@@ -756,10 +747,14 @@ public virtual Response<BlobContentInfo> Upload(
756747

757748
/// <summary>
758749
/// The <see cref="Upload(Stream, BlobHttpHeaders, Metadata, BlobRequestConditions, IProgress{long}, AccessTier?, StorageTransferOptions, CancellationToken)"/>
759-
/// operation creates a new block blob or updates the content of an
760-
/// existing block blob. Updating an existing block blob overwrites
750+
/// operation overwrites the contents of the blob, creating a new block
751+
/// blob if none exists. Overwriting an existing block blob replaces
761752
/// any existing metadata on the blob.
762753
///
754+
/// Set <see href="https://docs.microsoft.com/en-us/rest/api/storageservices/specifying-conditional-headers-for-blob-service-operations">
755+
/// access conditions</see> through <see cref="BlobRequestConditions"/>
756+
/// to avoid overwriting existing data.
757+
///
763758
/// For partial block blob updates and other advanced features, please
764759
/// see <see cref="BlockBlobClient"/>. To create or modify page or
765760
/// append blobs, please see <see cref="PageBlobClient"/> or
@@ -834,10 +829,14 @@ public virtual Response<BlobContentInfo> Upload(
834829

835830
/// <summary>
836831
/// The <see cref="Upload(string, BlobUploadOptions, CancellationToken)"/>
837-
/// operation creates a new block blob or updates the content of an
838-
/// existing block blob. Updating an existing block blob overwrites
832+
/// operation overwrites the contents of the blob, creating a new block
833+
/// blob if none exists. Overwriting an existing block blob replaces
839834
/// any existing metadata on the blob.
840835
///
836+
/// Set <see href="https://docs.microsoft.com/en-us/rest/api/storageservices/specifying-conditional-headers-for-blob-service-operations">
837+
/// access conditions</see> through <see cref="BlobUploadOptions.Conditions"/>
838+
/// to avoid overwriting existing data.
839+
///
841840
/// For partial block blob updates and other advanced features, please
842841
/// see <see cref="BlockBlobClient"/>. To create or modify page or
843842
/// append blobs, please see <see cref="PageBlobClient"/> or
@@ -883,10 +882,14 @@ public virtual Response<BlobContentInfo> Upload(
883882

884883
/// <summary>
885884
/// The <see cref="Upload(string, BlobHttpHeaders, Metadata, BlobRequestConditions, IProgress{long}, AccessTier?, StorageTransferOptions, CancellationToken)"/>
886-
/// operation creates a new block blob or updates the content of an
887-
/// existing block blob. Updating an existing block blob overwrites
885+
/// operation overwrites the contents of the blob, creating a new block
886+
/// blob if none exists. Overwriting an existing block blob replaces
888887
/// any existing metadata on the blob.
889888
///
889+
/// Set <see href="https://docs.microsoft.com/en-us/rest/api/storageservices/specifying-conditional-headers-for-blob-service-operations">
890+
/// access conditions</see> through <see cref="BlobRequestConditions"/>
891+
/// to avoid overwriting existing data.
892+
///
890893
/// For partial block blob updates and other advanced features, please
891894
/// see <see cref="BlockBlobClient"/>. To create or modify page or
892895
/// append blobs, please see <see cref="PageBlobClient"/> or
@@ -966,10 +969,14 @@ public virtual Response<BlobContentInfo> Upload(
966969

967970
/// <summary>
968971
/// The <see cref="UploadAsync(Stream, BlobHttpHeaders, Metadata, BlobRequestConditions, IProgress{long}, AccessTier?, StorageTransferOptions, CancellationToken)"/>
969-
/// operation creates a new block blob or updates the content of an
970-
/// existing block blob. Updating an existing block blob overwrites
972+
/// operation overwrites the contents of the blob, creating a new block
973+
/// blob if none exists. Overwriting an existing block blob replaces
971974
/// any existing metadata on the blob.
972975
///
976+
/// Set <see href="https://docs.microsoft.com/en-us/rest/api/storageservices/specifying-conditional-headers-for-blob-service-operations">
977+
/// access conditions</see> through <see cref="BlobUploadOptions.Conditions"/>
978+
/// to avoid overwriting existing data.
979+
///
973980
/// For partial block blob updates and other advanced features, please
974981
/// see <see cref="BlockBlobClient"/>. To create or modify page or
975982
/// append blobs, please see <see cref="PageBlobClient"/> or
@@ -1010,10 +1017,14 @@ await StagedUploadInternal(
10101017

10111018
/// <summary>
10121019
/// The <see cref="UploadAsync(Stream, BlobHttpHeaders, Metadata, BlobRequestConditions, IProgress{long}, AccessTier?, StorageTransferOptions, CancellationToken)"/>
1013-
/// operation creates a new block blob or updates the content of an
1014-
/// existing block blob. Updating an existing block blob overwrites
1020+
/// operation overwrites the contents of the blob, creating a new block
1021+
/// blob if none exists. Overwriting an existing block blob replaces
10151022
/// any existing metadata on the blob.
10161023
///
1024+
/// Set <see href="https://docs.microsoft.com/en-us/rest/api/storageservices/specifying-conditional-headers-for-blob-service-operations">
1025+
/// access conditions</see> through <see cref="BlobRequestConditions"/>
1026+
/// to avoid overwriting existing data.
1027+
///
10171028
/// For partial block blob updates and other advanced features, please
10181029
/// see <see cref="BlockBlobClient"/>. To create or modify page or
10191030
/// append blobs, please see <see cref="PageBlobClient"/> or
@@ -1088,10 +1099,14 @@ public virtual Task<Response<BlobContentInfo>> UploadAsync(
10881099

10891100
/// <summary>
10901101
/// The <see cref="UploadAsync(Stream, BlobUploadOptions, CancellationToken)"/>
1091-
/// operation creates a new block blob or updates the content of an
1092-
/// existing block blob. Updating an existing block blob overwrites
1102+
/// operation overwrites the contents of the blob, creating a new block
1103+
/// blob if none exists. Overwriting an existing block blob replaces
10931104
/// any existing metadata on the blob.
10941105
///
1106+
/// Set <see href="https://docs.microsoft.com/en-us/rest/api/storageservices/specifying-conditional-headers-for-blob-service-operations">
1107+
/// access conditions</see> through <see cref="BlobUploadOptions.Conditions"/>
1108+
/// to avoid overwriting existing data.
1109+
///
10951110
/// For partial block blob updates and other advanced features, please
10961111
/// see <see cref="BlockBlobClient"/>. To create or modify page or
10971112
/// append blobs, please see <see cref="PageBlobClient"/> or
@@ -1137,10 +1152,14 @@ public virtual async Task<Response<BlobContentInfo>> UploadAsync(
11371152

11381153
/// <summary>
11391154
/// The <see cref="UploadAsync(string, BlobHttpHeaders, Metadata, BlobRequestConditions, IProgress{long}, AccessTier?, StorageTransferOptions, CancellationToken)"/>
1140-
/// operation creates a new block blob or updates the content of an
1141-
/// existing block blob. Updating an existing block blob overwrites
1155+
/// operation overwrites the contents of the blob, creating a new block
1156+
/// blob if none exists. Overwriting an existing block blob replaces
11421157
/// any existing metadata on the blob.
11431158
///
1159+
/// Set <see href="https://docs.microsoft.com/en-us/rest/api/storageservices/specifying-conditional-headers-for-blob-service-operations">
1160+
/// access conditions</see> through <see cref="BlobRequestConditions"/>
1161+
/// to avoid overwriting existing data.
1162+
///
11441163
/// For partial block blob updates and other advanced features, please
11451164
/// see <see cref="BlockBlobClient"/>. To create or modify page or
11461165
/// append blobs, please see <see cref="PageBlobClient"/> or

0 commit comments

Comments
 (0)