Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add RequestOptions to Azure.Core #27149

Merged
merged 6 commits into from
Feb 24, 2022
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
16 changes: 11 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,15 @@ 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() { }
public 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
16 changes: 11 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,15 @@ 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() { }
public 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
16 changes: 11 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,15 @@ 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() { }
public 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
16 changes: 11 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,15 @@ 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() { }
public 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