public static IVostokThrottlingBuilder UseCustomPropertyQuota([NotNull] this IVostokThrottlingBuilder builder, [NotNull] string propertyName, [NotNull] Func <HttpContext, string> propertyValueProvider, [NotNull] Func <PropertyQuotaOptions> quotaOptionsProvider) => builder .CustomizeMiddleware(settings => settings.AdditionalProperties.Add(context => (propertyName, propertyValueProvider(context))))
public static IVostokThrottlingBuilder DisableMetrics([NotNull] this IVostokThrottlingBuilder builder) { builder.Metrics = null; return(builder); }
public static IVostokThrottlingBuilder UseUrlQuota([NotNull] this IVostokThrottlingBuilder builder, [NotNull] Func <PropertyQuotaOptions> quotaOptionsProvider) => builder .CustomizeMiddleware(settings => settings.AddUrlProperty = true) .UsePropertyQuota(WellKnownThrottlingProperties.Url, quotaOptionsProvider);
public static IVostokThrottlingBuilder DisableThrottling([NotNull] this IVostokThrottlingBuilder builder) => builder.CustomizeMiddleware(s => s.Enabled = _ => false);