public TranscientThrottlePolicyBuilder(ThrottlePolicy policy) { if (policy == null) { throw new ArgumentNullException(nameof(policy)); } _policy = policy; }
public ThrottlePolicyLogValues(ThrottlePolicy inner) { if (inner == null) { throw new ArgumentNullException(nameof(inner)); } Name = inner.Name; }
public UnnamedThrottleRoute(string routeTemplate, ThrottlePolicy policy) : base(routeTemplate) { if (policy == null) { throw new ArgumentNullException(nameof(policy)); } _policy = policy; }
public UnnamedThrottleRoute(IEnumerable <string> httpMethods, string routeTemplate, ThrottlePolicy policy) : base(routeTemplate, httpMethods) { if (policy == null) { throw new ArgumentNullException(nameof(policy)); } _policy = policy; }
/// <summary> /// Adds a new policy. /// </summary> /// <param name="name">The name of the policy.</param> /// <param name="policy">The <see cref="IThrottlePolicy"/> policy to be added.</param> public void AddPolicy(string name, ThrottlePolicy policy) { if (name == null) { throw new ArgumentNullException(nameof(name)); } if (policy == null) { throw new ArgumentNullException(nameof(policy)); } PolicyMap[name] = policy; }
public override ThrottlePolicy GetPolicy(HttpRequest httpContext, ThrottleOptions options) { if (httpContext == null) { throw new ArgumentNullException(nameof(httpContext)); } if (options == null) { throw new ArgumentNullException(nameof(options)); } if (_policy == null) { _policy = _policyBuilder.Build(options); } return(_policy); }
public static void AddRoute(this ThrottleRouteBuilder router, IEnumerable <string> httpMethods, string routeTemplate, ThrottlePolicy policy) { router.Add(new UnnamedThrottleRoute(httpMethods, routeTemplate, policy)); }