work work hard work

This commit is contained in:
StellaOps Bot
2025-12-18 00:47:24 +02:00
parent dee252940b
commit b4235c134c
189 changed files with 9627 additions and 3258 deletions

View File

@@ -0,0 +1,35 @@
// -----------------------------------------------------------------------------
// RateLimitRule.cs
// Sprint: SPRINT_1200_001_003_router_rate_limiting_rule_stacking
// Task: 3.1 - Extend Configuration for Rule Arrays
// Description: Single rate limit rule definition (window + max requests)
// -----------------------------------------------------------------------------
using Microsoft.Extensions.Configuration;
namespace StellaOps.Router.Gateway.RateLimit;
/// <summary>
/// A single rate limit rule (window + max requests).
/// </summary>
public sealed class RateLimitRule
{
[ConfigurationKeyName("per_seconds")]
public int PerSeconds { get; set; }
[ConfigurationKeyName("max_requests")]
public int MaxRequests { get; set; }
[ConfigurationKeyName("name")]
public string? Name { get; set; }
public void Validate(string path)
{
if (PerSeconds <= 0)
throw new ArgumentException($"{path}: per_seconds must be > 0");
if (MaxRequests <= 0)
throw new ArgumentException($"{path}: max_requests must be > 0");
}
}