-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
/
OnRateLimiterRejectedArguments.cs
35 lines (30 loc) · 1.26 KB
/
OnRateLimiterRejectedArguments.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
using System.Threading.RateLimiting;
namespace Polly.RateLimiting;
#pragma warning disable CA1815 // Override equals and operator equals on value types
/// <summary>
/// The arguments used by the <see cref="RateLimiterStrategyOptions.OnRejected"/>.
/// </summary>
/// <remarks>
/// Always use the constructor when creating this struct, otherwise we do not guarantee binary compatibility.
/// </remarks>
public readonly struct OnRateLimiterRejectedArguments
{
/// <summary>
/// Initializes a new instance of the <see cref="OnRateLimiterRejectedArguments"/> struct.
/// </summary>
/// <param name="context">The context associated with the execution of a user-provided callback.</param>
/// <param name="lease">The lease that has no permits and was rejected by the rate limiter.</param>
public OnRateLimiterRejectedArguments(ResilienceContext context, RateLimitLease lease)
{
Context = context;
Lease = lease;
}
/// <summary>
/// Gets the context associated with the execution of a user-provided callback.
/// </summary>
public ResilienceContext Context { get; }
/// <summary>
/// Gets the lease that has no permits and was rejected by the rate limiter.
/// </summary>
public RateLimitLease Lease { get; }
}