Welcome to mirror list, hosted at ThFree Co, Russian Federation.

7.0-rc1_Microsoft.AspNetCore.RateLimiting.md « Microsoft.AspNetCore.App « rc1 « api-diff « preview « 7.0 « release-notes - github.com/dotnet/core.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 217bcb75fc60e11c4246912166b3d9d28ac49f2d (plain)
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
36
37
38
39
40
# Microsoft.AspNetCore.RateLimiting

``` diff
+namespace Microsoft.AspNetCore.RateLimiting {
+    [AttributeUsageAttribute(68, AllowMultiple=false, Inherited=true)]
+    public sealed class DisableRateLimitingAttribute : Attribute {
+        public DisableRateLimitingAttribute();
+    }
+    [AttributeUsageAttribute(68, AllowMultiple=false, Inherited=true)]
+    public sealed class EnableRateLimitingAttribute : Attribute {
+        public EnableRateLimitingAttribute(string policyName);
+        public string PolicyName { [CompilerGeneratedAttribute] get; }
+    }
+    public interface IRateLimiterPolicy<TPartitionKey> {
+        Func<OnRejectedContext, CancellationToken, ValueTask>? OnRejected { get; }
+        RateLimitPartition<TPartitionKey> GetPartition(HttpContext httpContext);
+    }
+    public sealed class OnRejectedContext {
+        public OnRejectedContext();
+        public required HttpContext HttpContext { [CompilerGeneratedAttribute] get; [CompilerGeneratedAttribute] set; }
+        public required RateLimitLease Lease { [CompilerGeneratedAttribute] get; [CompilerGeneratedAttribute] set; }
+    }
+    public sealed class RateLimiterOptions {
+        public RateLimiterOptions();
+        public PartitionedRateLimiter<HttpContext>? GlobalLimiter { [CompilerGeneratedAttribute] get; [CompilerGeneratedAttribute] set; }
+        public Func<OnRejectedContext, CancellationToken, ValueTask>? OnRejected { [CompilerGeneratedAttribute] get; [CompilerGeneratedAttribute] set; }
+        public int RejectionStatusCode { [CompilerGeneratedAttribute] get; [CompilerGeneratedAttribute] set; }
+        public RateLimiterOptions AddPolicy<TPartitionKey, TPolicy>(string policyName) where TPolicy : IRateLimiterPolicy<TPartitionKey>;
+        public RateLimiterOptions AddPolicy<TPartitionKey>(string policyName, IRateLimiterPolicy<TPartitionKey> policy);
+        public RateLimiterOptions AddPolicy<TPartitionKey>(string policyName, Func<HttpContext, RateLimitPartition<TPartitionKey>> partitioner);
+    }
+    public static class RateLimiterOptionsExtensions {
+        public static RateLimiterOptions AddConcurrencyLimiter(this RateLimiterOptions options, string policyName, Action<ConcurrencyLimiterOptions> configureOptions);
+        public static RateLimiterOptions AddFixedWindowLimiter(this RateLimiterOptions options, string policyName, Action<FixedWindowRateLimiterOptions> configureOptions);
+        public static RateLimiterOptions AddSlidingWindowLimiter(this RateLimiterOptions options, string policyName, Action<SlidingWindowRateLimiterOptions> configureOptions);
+        public static RateLimiterOptions AddTokenBucketLimiter(this RateLimiterOptions options, string policyName, Action<TokenBucketRateLimiterOptions> configureOptions);
+    }
+}
```