Skip to content

Commit

Permalink
stg75 PR comments (#17328)
Browse files Browse the repository at this point in the history
  • Loading branch information
amnguye authored Dec 4, 2020
1 parent bd4f0b8 commit 9824c92
Show file tree
Hide file tree
Showing 6 changed files with 46 additions and 192 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -802,7 +802,6 @@ public BlobRequestConditions() { }
public partial class BlobRetentionPolicy
{
public BlobRetentionPolicy() { }
public bool? AllowPermanentDelete { get { throw null; } set { } }
public int? Days { get { throw null; } set { } }
public bool Enabled { get { throw null; } set { } }
}
Expand Down Expand Up @@ -936,6 +935,17 @@ public BlobStaticWebsite() { }
public string ErrorDocument404Path { get { throw null; } set { } }
public string IndexDocument { get { throw null; } set { } }
}
public partial class BlobSyncUploadFromUriOptions
{
public BlobSyncUploadFromUriOptions() { }
public Azure.Storage.Blobs.Models.AccessTier? AccessTier { get { throw null; } set { } }
public byte[] ContentHash { get { throw null; } set { } }
public bool? CopySourceBlobProperties { get { throw null; } set { } }
public Azure.Storage.Blobs.Models.BlobRequestConditions DestinationConditions { get { throw null; } set { } }
public Azure.Storage.Blobs.Models.BlobHttpHeaders HttpHeaders { get { throw null; } set { } }
public Azure.Storage.Blobs.Models.BlobRequestConditions SourceConditions { get { throw null; } set { } }
public System.Collections.Generic.IDictionary<string, string> Tags { get { throw null; } set { } }
}
[System.FlagsAttribute]
public enum BlobTraits
{
Expand All @@ -951,17 +961,6 @@ public enum BlobType
Page = 1,
Append = 2,
}
public partial class BlobUploadFromUriOptions
{
public BlobUploadFromUriOptions() { }
public Azure.Storage.Blobs.Models.AccessTier? AccessTier { get { throw null; } set { } }
public byte[] ContentMd5 { get { throw null; } set { } }
public bool? CopySourceBlobProperties { get { throw null; } set { } }
public Azure.Storage.Blobs.Models.BlobRequestConditions DestinationConditions { get { throw null; } set { } }
public Azure.Storage.Blobs.Models.BlobHttpHeaders HttpHeaders { get { throw null; } set { } }
public Azure.Storage.Blobs.Models.BlobRequestConditions SourceConditions { get { throw null; } set { } }
public System.Collections.Generic.IDictionary<string, string> Tags { get { throw null; } set { } }
}
public partial class BlobUploadOptions
{
public BlobUploadOptions() { }
Expand Down Expand Up @@ -1389,14 +1388,10 @@ public BlockBlobClient(System.Uri blobUri, Azure.Storage.StorageSharedKeyCredent
public virtual System.Threading.Tasks.Task<Azure.Response<Azure.Storage.Blobs.Models.BlockInfo>> StageBlockAsync(string base64BlockId, System.IO.Stream content, byte[] transactionalContentHash = null, Azure.Storage.Blobs.Models.BlobRequestConditions conditions = null, System.IProgress<long> progressHandler = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; }
public virtual Azure.Response<Azure.Storage.Blobs.Models.BlockInfo> StageBlockFromUri(System.Uri sourceUri, string base64BlockId, Azure.HttpRange sourceRange = default(Azure.HttpRange), byte[] sourceContentHash = null, Azure.RequestConditions sourceConditions = null, Azure.Storage.Blobs.Models.BlobRequestConditions conditions = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; }
public virtual System.Threading.Tasks.Task<Azure.Response<Azure.Storage.Blobs.Models.BlockInfo>> StageBlockFromUriAsync(System.Uri sourceUri, string base64BlockId, Azure.HttpRange sourceRange = default(Azure.HttpRange), byte[] sourceContentHash = null, Azure.RequestConditions sourceConditions = null, Azure.Storage.Blobs.Models.BlobRequestConditions conditions = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; }
public virtual Azure.Response<Azure.Storage.Blobs.Models.BlobContentInfo> SyncUploadFromUri(System.Uri copySource) { throw null; }
public virtual Azure.Response<Azure.Storage.Blobs.Models.BlobContentInfo> SyncUploadFromUri(System.Uri copySource, Azure.Storage.Blobs.Models.BlobUploadFromUriOptions options, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; }
public virtual Azure.Response<Azure.Storage.Blobs.Models.BlobContentInfo> SyncUploadFromUri(System.Uri copySource, Azure.Storage.Blobs.Models.BlobSyncUploadFromUriOptions options, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; }
public virtual Azure.Response<Azure.Storage.Blobs.Models.BlobContentInfo> SyncUploadFromUri(System.Uri copySource, bool overwrite = false, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; }
public virtual Azure.Response<Azure.Storage.Blobs.Models.BlobContentInfo> SyncUploadFromUri(System.Uri copySource, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; }
public virtual System.Threading.Tasks.Task<Azure.Response<Azure.Storage.Blobs.Models.BlobContentInfo>> SyncUploadFromUriAsync(System.Uri copySource) { throw null; }
public virtual System.Threading.Tasks.Task<Azure.Response<Azure.Storage.Blobs.Models.BlobContentInfo>> SyncUploadFromUriAsync(System.Uri copySource, Azure.Storage.Blobs.Models.BlobUploadFromUriOptions options, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; }
public virtual System.Threading.Tasks.Task<Azure.Response<Azure.Storage.Blobs.Models.BlobContentInfo>> SyncUploadFromUriAsync(System.Uri copySource, Azure.Storage.Blobs.Models.BlobSyncUploadFromUriOptions options, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; }
public virtual System.Threading.Tasks.Task<Azure.Response<Azure.Storage.Blobs.Models.BlobContentInfo>> SyncUploadFromUriAsync(System.Uri copySource, bool overwrite = false, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; }
public virtual System.Threading.Tasks.Task<Azure.Response<Azure.Storage.Blobs.Models.BlobContentInfo>> SyncUploadFromUriAsync(System.Uri copySource, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; }
[System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)]
public virtual Azure.Response<Azure.Storage.Blobs.Models.BlobContentInfo> Upload(System.IO.Stream content, Azure.Storage.Blobs.Models.BlobHttpHeaders httpHeaders = null, System.Collections.Generic.IDictionary<string, string> metadata = null, Azure.Storage.Blobs.Models.BlobRequestConditions conditions = null, Azure.Storage.Blobs.Models.AccessTier? accessTier = default(Azure.Storage.Blobs.Models.AccessTier?), System.IProgress<long> progressHandler = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; }
public virtual Azure.Response<Azure.Storage.Blobs.Models.BlobContentInfo> Upload(System.IO.Stream content, Azure.Storage.Blobs.Models.BlobUploadOptions options, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; }
Expand Down
147 changes: 7 additions & 140 deletions sdk/storage/Azure.Storage.Blobs/src/BlockBlobClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2165,140 +2165,7 @@ private async Task<Stream> OpenWriteInternal(
}
#endregion OpenWrite

#region UploadFromUri
/// <summary>
/// The Upload from Uri operation creates a new Block Blob where the contents of the
/// blob are read from a given URL. This API is supported beginning with the 2020-04-08 version.
///
/// Partial updates are not supported with Put Blob from URL; the content of an existing blob is
/// overwritten with the content of the new blob. To perform partial updates to a block blob’s
/// contents using a source URL, use the Put Block from URL API in conjunction with Put Block List.
/// </summary>
/// <param name="copySource">
/// Required. Specifies the URL of the source blob. The source blob may be of any type,
/// including a block blob, append blob, or page blob. The value may be a URL of up to 2
/// KiB in length that specifies a blob. The value should be URL-encoded as it would appear
/// in a request URI. The source blob must either be public or must be authorized via a
/// shared access signature. If the source blob is public, no authorization is required
/// to perform the operation.
/// </param>
/// <returns>
/// A <see cref="Response{BlobContentInfo}"/> describing the
/// state of the updated block blob.
/// </returns>
/// <remarks>
/// A <see cref="RequestFailedException"/> will be thrown if
/// a failure occurs.
/// </remarks>
public virtual Response<BlobContentInfo> SyncUploadFromUri(Uri copySource)
=> SyncUploadFromUri(
copySource,
overwrite: false,
CancellationToken.None);

/// <summary>
/// The Upload from Uri operation creates a new Block Blob where the contents of the
/// blob are read from a given URL. This API is supported beginning with the 2020-04-08 version.
///
/// Partial updates are not supported with Put Blob from URL; the content of an existing blob is
/// overwritten with the content of the new blob. To perform partial updates to a block blob’s
/// contents using a source URL, use the Put Block from URL API in conjunction with Put Block List.
/// </summary>
/// <param name="copySource">
/// Required. Specifies the URL of the source blob. The source blob may be of any type,
/// including a block blob, append blob, or page blob. The value may be a URL of up to 2
/// KiB in length that specifies a blob. The value should be URL-encoded as it would appear
/// in a request URI. The source blob must either be public or must be authorized via a
/// shared access signature. If the source blob is public, no authorization is required
/// to perform the operation.
/// </param>
/// <returns>
/// A <see cref="Response{BlobContentInfo}"/> describing the
/// state of the updated block blob.
/// </returns>
/// <remarks>
/// A <see cref="RequestFailedException"/> will be thrown if
/// a failure occurs.
/// </remarks>
public virtual async Task<Response<BlobContentInfo>> SyncUploadFromUriAsync(Uri copySource)
=> await SyncUploadFromUriAsync(
copySource,
CancellationToken.None)
.ConfigureAwait(false);

/// <summary>
/// The Upload from Uri operation creates a new Block Blob where the contents of the
/// blob are read from a given URL. This API is supported beginning with the 2020-04-08 version.
///
/// Partial updates are not supported with Put Blob from URL; the content of an existing blob is
/// overwritten with the content of the new blob. To perform partial updates to a block blob’s
/// contents using a source URL, use the Put Block from URL API in conjunction with Put Block List.
/// </summary>
/// <param name="copySource">
/// Required. Specifies the URL of the source blob. The source blob may be of any type,
/// including a block blob, append blob, or page blob. The value may be a URL of up to 2
/// KiB in length that specifies a blob. The value should be URL-encoded as it would appear
/// in a request URI. The source blob must either be public or must be authorized via a
/// shared access signature. If the source blob is public, no authorization is required
/// to perform the operation.
/// </param>
/// <param name="cancellationToken">
/// Optional <see cref="CancellationToken"/> to propagate
/// notifications that the operation should be cancelled.
/// </param>
/// <returns>
/// A <see cref="Response{BlobContentInfo}"/> describing the
/// state of the updated block blob.
/// </returns>
/// <remarks>
/// A <see cref="RequestFailedException"/> will be thrown if
/// a failure occurs.
/// </remarks>
public virtual Response<BlobContentInfo> SyncUploadFromUri(
Uri copySource,
CancellationToken cancellationToken = default)
=> SyncUploadFromUri(
copySource,
overwrite: false,
cancellationToken);

/// <summary>
/// The Upload from Uri operation creates a new Block Blob where the contents of the
/// blob are read from a given URL. This API is supported beginning with the 2020-04-08 version.
///
/// Partial updates are not supported with Put Blob from URL; the content of an existing blob is
/// overwritten with the content of the new blob. To perform partial updates to a block blob’s
/// contents using a source URL, use the Put Block from URL API in conjunction with Put Block List.
/// </summary>
/// <param name="copySource">
/// Required. Specifies the URL of the source blob. The source blob may be of any type,
/// including a block blob, append blob, or page blob. The value may be a URL of up to 2
/// KiB in length that specifies a blob. The value should be URL-encoded as it would appear
/// in a request URI. The source blob must either be public or must be authorized via a
/// shared access signature. If the source blob is public, no authorization is required
/// to perform the operation.
/// </param>
/// <param name="cancellationToken">
/// Optional <see cref="CancellationToken"/> to propagate
/// notifications that the operation should be cancelled.
/// </param>
/// <returns>
/// A <see cref="Response{BlobContentInfo}"/> describing the
/// state of the updated block blob.
/// </returns>
/// <remarks>
/// A <see cref="RequestFailedException"/> will be thrown if
/// a failure occurs.
/// </remarks>
public virtual async Task<Response<BlobContentInfo>> SyncUploadFromUriAsync(
Uri copySource,
CancellationToken cancellationToken = default)
=> await SyncUploadFromUriAsync(
copySource,
overwrite: false,
cancellationToken)
.ConfigureAwait(false);

#region SyncUploadFromUri
/// <summary>
/// The Upload from Uri operation creates a new Block Blob where the contents of the
/// blob are read from a given URL. This API is supported beginning with the 2020-04-08 version.
Expand Down Expand Up @@ -2337,7 +2204,7 @@ public virtual Response<BlobContentInfo> SyncUploadFromUri(
CancellationToken cancellationToken = default)
=> SyncUploadFromUriInternal(
copySource,
overwrite ? null : new BlobUploadFromUriOptions{ DestinationConditions = new BlobRequestConditions
overwrite ? null : new BlobSyncUploadFromUriOptions{ DestinationConditions = new BlobRequestConditions
{ IfNoneMatch = new ETag(Constants.Wildcard) } },
async: false,
cancellationToken)
Expand Down Expand Up @@ -2381,7 +2248,7 @@ public virtual async Task<Response<BlobContentInfo>> SyncUploadFromUriAsync(
CancellationToken cancellationToken = default)
=> await SyncUploadFromUriInternal(
copySource,
overwrite ? null : new BlobUploadFromUriOptions { DestinationConditions = new BlobRequestConditions
overwrite ? null : new BlobSyncUploadFromUriOptions { DestinationConditions = new BlobRequestConditions
{ IfNoneMatch = new ETag(Constants.Wildcard) } },
async: true,
cancellationToken)
Expand Down Expand Up @@ -2420,7 +2287,7 @@ public virtual async Task<Response<BlobContentInfo>> SyncUploadFromUriAsync(
/// </remarks>
public virtual Response<BlobContentInfo> SyncUploadFromUri(
Uri copySource,
BlobUploadFromUriOptions options,
BlobSyncUploadFromUriOptions options,
CancellationToken cancellationToken = default)
=> SyncUploadFromUriInternal(
copySource,
Expand Down Expand Up @@ -2462,7 +2329,7 @@ public virtual Response<BlobContentInfo> SyncUploadFromUri(
/// </remarks>
public virtual async Task<Response<BlobContentInfo>> SyncUploadFromUriAsync(
Uri copySource,
BlobUploadFromUriOptions options,
BlobSyncUploadFromUriOptions options,
CancellationToken cancellationToken = default)
=> await SyncUploadFromUriInternal(
copySource,
Expand Down Expand Up @@ -2507,7 +2374,7 @@ public virtual async Task<Response<BlobContentInfo>> SyncUploadFromUriAsync(
/// </remarks>
internal virtual async Task<Response<BlobContentInfo>> SyncUploadFromUriInternal(
Uri copySource,
BlobUploadFromUriOptions options,
BlobSyncUploadFromUriOptions options,
bool async,
CancellationToken cancellationToken)
{
Expand Down Expand Up @@ -2555,7 +2422,7 @@ internal virtual async Task<Response<BlobContentInfo>> SyncUploadFromUriInternal
sourceIfNoneMatch: options?.SourceConditions?.IfNoneMatch,
sourceIfTags: options?.SourceConditions?.TagConditions,
requestId: default,
sourceContentHash: options?.ContentMd5,
sourceContentHash: options?.ContentHash,
blobTagsString: options?.Tags?.ToTagsString(),
copySourceBlobProperties: options?.CopySourceBlobProperties,
async: async,
Expand Down
Loading

0 comments on commit 9824c92

Please sign in to comment.