Skip to content

Commit

Permalink
Add RequestOptions to Azure.Core (#27149)
Browse files Browse the repository at this point in the history
* Add RequestOptions to Azure.Core

* Export API

* nit

* pr fb

* pr fb

* export APIs
  • Loading branch information
annelo-msft authored Feb 24, 2022
1 parent f784f40 commit c6b943c
Show file tree
Hide file tree
Showing 12 changed files with 224 additions and 245 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,6 @@ public BinaryContent() { }
public virtual System.BinaryData? Data { get { throw null; } set { } }
public virtual bool IsReadOnly { get { throw null; } }
}
public partial class RequestOptions
{
public RequestOptions() { }
public Azure.ErrorOptions ErrorOptions { get { throw null; } set { } }
public void AddPolicy(Azure.Core.Pipeline.HttpPipelinePolicy policy, Azure.Core.HttpPipelinePosition position) { }
}
}
namespace Azure.Core
{
Expand Down Expand Up @@ -104,10 +98,3 @@ public void Set(string propertyName, string? value) { }
public System.Threading.Tasks.Task<long> WriteToAsync(System.IO.Stream stream, System.Threading.CancellationToken cancellationToken) { throw null; }
}
}
namespace Azure.Core.Pipeline
{
public static partial class HttpPipelineExtensions
{
public static Azure.Core.HttpMessage CreateMessage(this Azure.Core.Pipeline.HttpPipeline pipeline, Azure.RequestOptions? options) { throw null; }
}
}
48 changes: 0 additions & 48 deletions sdk/core/Azure.Core.Experimental/src/HttpPipelineExtensions.cs

This file was deleted.

44 changes: 0 additions & 44 deletions sdk/core/Azure.Core.Experimental/src/RequestOptions.cs

This file was deleted.

1 change: 1 addition & 0 deletions sdk/core/Azure.Core/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
### Features Added

- Added `AddClassifier` methods to `RequestContext`. These methods allow callers to change the response classification behavior for a given method invocation.
- Added type `RequestOptions` to the `Azure` namespace and made `RequestContext` a subclass of `RequestOptions`. This enables `RequestOptions` to be exposed in methods that take `CancellationToken` without causing confusion regarding which cancellation token will take effect.

### Breaking Changes

Expand Down
17 changes: 12 additions & 5 deletions sdk/core/Azure.Core/api/Azure.Core.net461.cs
Original file line number Diff line number Diff line change
Expand Up @@ -189,14 +189,11 @@ public RequestConditions() { }
public System.DateTimeOffset? IfModifiedSince { get { throw null; } set { } }
public System.DateTimeOffset? IfUnmodifiedSince { get { throw null; } set { } }
}
public partial class RequestContext
public partial class RequestContext : Azure.RequestOptions
{
public RequestContext() { }
public RequestContext(Azure.RequestOptions options) { }
public System.Threading.CancellationToken CancellationToken { get { throw null; } set { } }
public Azure.ErrorOptions ErrorOptions { get { throw null; } set { } }
public void AddClassifier(Azure.Core.ResponseClassificationHandler classifier) { }
public void AddClassifier(int statusCode, bool isError) { }
public void AddPolicy(Azure.Core.Pipeline.HttpPipelinePolicy policy, Azure.Core.HttpPipelinePosition position) { }
public static implicit operator Azure.RequestContext (Azure.ErrorOptions options) { throw null; }
}
public partial class RequestFailedException : System.Exception, System.Runtime.Serialization.ISerializable
Expand All @@ -212,6 +209,16 @@ public RequestFailedException(string message, System.Exception? innerException)
public int Status { get { throw null; } }
public override void GetObjectData(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) { }
}
public partial class RequestOptions
{
public RequestOptions() { }
[System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)]
protected RequestOptions(Azure.RequestOptions options) { }
public Azure.ErrorOptions ErrorOptions { get { throw null; } set { } }
public void AddClassifier(Azure.Core.ResponseClassificationHandler classifier) { }
public void AddClassifier(int statusCode, bool isError) { }
public void AddPolicy(Azure.Core.Pipeline.HttpPipelinePolicy policy, Azure.Core.HttpPipelinePosition position) { }
}
public abstract partial class Response : System.IDisposable
{
protected Response() { }
Expand Down
17 changes: 12 additions & 5 deletions sdk/core/Azure.Core/api/Azure.Core.net5.0.cs
Original file line number Diff line number Diff line change
Expand Up @@ -189,14 +189,11 @@ public RequestConditions() { }
public System.DateTimeOffset? IfModifiedSince { get { throw null; } set { } }
public System.DateTimeOffset? IfUnmodifiedSince { get { throw null; } set { } }
}
public partial class RequestContext
public partial class RequestContext : Azure.RequestOptions
{
public RequestContext() { }
public RequestContext(Azure.RequestOptions options) { }
public System.Threading.CancellationToken CancellationToken { get { throw null; } set { } }
public Azure.ErrorOptions ErrorOptions { get { throw null; } set { } }
public void AddClassifier(Azure.Core.ResponseClassificationHandler classifier) { }
public void AddClassifier(int statusCode, bool isError) { }
public void AddPolicy(Azure.Core.Pipeline.HttpPipelinePolicy policy, Azure.Core.HttpPipelinePosition position) { }
public static implicit operator Azure.RequestContext (Azure.ErrorOptions options) { throw null; }
}
public partial class RequestFailedException : System.Exception, System.Runtime.Serialization.ISerializable
Expand All @@ -212,6 +209,16 @@ public RequestFailedException(string message, System.Exception? innerException)
public int Status { get { throw null; } }
public override void GetObjectData(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) { }
}
public partial class RequestOptions
{
public RequestOptions() { }
[System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)]
protected RequestOptions(Azure.RequestOptions options) { }
public Azure.ErrorOptions ErrorOptions { get { throw null; } set { } }
public void AddClassifier(Azure.Core.ResponseClassificationHandler classifier) { }
public void AddClassifier(int statusCode, bool isError) { }
public void AddPolicy(Azure.Core.Pipeline.HttpPipelinePolicy policy, Azure.Core.HttpPipelinePosition position) { }
}
public abstract partial class Response : System.IDisposable
{
protected Response() { }
Expand Down
17 changes: 12 additions & 5 deletions sdk/core/Azure.Core/api/Azure.Core.netcoreapp2.1.cs
Original file line number Diff line number Diff line change
Expand Up @@ -189,14 +189,11 @@ public RequestConditions() { }
public System.DateTimeOffset? IfModifiedSince { get { throw null; } set { } }
public System.DateTimeOffset? IfUnmodifiedSince { get { throw null; } set { } }
}
public partial class RequestContext
public partial class RequestContext : Azure.RequestOptions
{
public RequestContext() { }
public RequestContext(Azure.RequestOptions options) { }
public System.Threading.CancellationToken CancellationToken { get { throw null; } set { } }
public Azure.ErrorOptions ErrorOptions { get { throw null; } set { } }
public void AddClassifier(Azure.Core.ResponseClassificationHandler classifier) { }
public void AddClassifier(int statusCode, bool isError) { }
public void AddPolicy(Azure.Core.Pipeline.HttpPipelinePolicy policy, Azure.Core.HttpPipelinePosition position) { }
public static implicit operator Azure.RequestContext (Azure.ErrorOptions options) { throw null; }
}
public partial class RequestFailedException : System.Exception, System.Runtime.Serialization.ISerializable
Expand All @@ -212,6 +209,16 @@ public RequestFailedException(string message, System.Exception? innerException)
public int Status { get { throw null; } }
public override void GetObjectData(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) { }
}
public partial class RequestOptions
{
public RequestOptions() { }
[System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)]
protected RequestOptions(Azure.RequestOptions options) { }
public Azure.ErrorOptions ErrorOptions { get { throw null; } set { } }
public void AddClassifier(Azure.Core.ResponseClassificationHandler classifier) { }
public void AddClassifier(int statusCode, bool isError) { }
public void AddPolicy(Azure.Core.Pipeline.HttpPipelinePolicy policy, Azure.Core.HttpPipelinePosition position) { }
}
public abstract partial class Response : System.IDisposable
{
protected Response() { }
Expand Down
17 changes: 12 additions & 5 deletions sdk/core/Azure.Core/api/Azure.Core.netstandard2.0.cs
Original file line number Diff line number Diff line change
Expand Up @@ -189,14 +189,11 @@ public RequestConditions() { }
public System.DateTimeOffset? IfModifiedSince { get { throw null; } set { } }
public System.DateTimeOffset? IfUnmodifiedSince { get { throw null; } set { } }
}
public partial class RequestContext
public partial class RequestContext : Azure.RequestOptions
{
public RequestContext() { }
public RequestContext(Azure.RequestOptions options) { }
public System.Threading.CancellationToken CancellationToken { get { throw null; } set { } }
public Azure.ErrorOptions ErrorOptions { get { throw null; } set { } }
public void AddClassifier(Azure.Core.ResponseClassificationHandler classifier) { }
public void AddClassifier(int statusCode, bool isError) { }
public void AddPolicy(Azure.Core.Pipeline.HttpPipelinePolicy policy, Azure.Core.HttpPipelinePosition position) { }
public static implicit operator Azure.RequestContext (Azure.ErrorOptions options) { throw null; }
}
public partial class RequestFailedException : System.Exception, System.Runtime.Serialization.ISerializable
Expand All @@ -212,6 +209,16 @@ public RequestFailedException(string message, System.Exception? innerException)
public int Status { get { throw null; } }
public override void GetObjectData(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) { }
}
public partial class RequestOptions
{
public RequestOptions() { }
[System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)]
protected RequestOptions(Azure.RequestOptions options) { }
public Azure.ErrorOptions ErrorOptions { get { throw null; } set { } }
public void AddClassifier(Azure.Core.ResponseClassificationHandler classifier) { }
public void AddClassifier(int statusCode, bool isError) { }
public void AddPolicy(Azure.Core.Pipeline.HttpPipelinePolicy policy, Azure.Core.HttpPipelinePosition position) { }
}
public abstract partial class Response : System.IDisposable
{
protected Response() { }
Expand Down
4 changes: 2 additions & 2 deletions sdk/core/Azure.Core/src/Pipeline/HttpPipeline.cs
Original file line number Diff line number Diff line change
Expand Up @@ -30,13 +30,13 @@ public class HttpPipeline

/// <summary>
/// The pipeline index where <see cref="HttpPipelinePosition.PerCall"/> policies will be added,
/// if any are specified using <see cref="RequestContext.AddPolicy(HttpPipelinePolicy, HttpPipelinePosition)"/>.
/// if any are specified using <see cref="RequestOptions.AddPolicy(HttpPipelinePolicy, HttpPipelinePosition)"/>.
/// </summary>
private readonly int _perCallIndex;

/// <summary>
/// The pipeline index where <see cref="HttpPipelinePosition.PerRetry"/> policies will be added,
/// if any are specified using <see cref="RequestContext.AddPolicy(HttpPipelinePolicy, HttpPipelinePosition)"/>.
/// if any are specified using <see cref="RequestOptions.AddPolicy(HttpPipelinePolicy, HttpPipelinePosition)"/>.
/// </summary>
private readonly int _perRetryIndex;

Expand Down
Loading

0 comments on commit c6b943c

Please sign in to comment.