// Convert_v1alpha1_Limit_To_eventratelimit_Limit is an autogenerated conversion function.
546715
func Convert_v1alpha1_Limit_To_eventratelimit_Limit(in *Limit, out *eventratelimit.Limit, s conversion.Scope) error {
	return autoConvert_v1alpha1_Limit_To_eventratelimit_Limit(in, out, s)
}
699315
func Convert_core_EventList_To_v1beta1_EventList(in *core.EventList, out *v1beta1.EventList, s conversion.Scope) error {
	return autoConvert_core_EventList_To_v1beta1_EventList(in, out, s)
}
304056
func Convert_config_DeprecatedControllerConfiguration_To_v1alpha1_DeprecatedControllerConfiguration(in *config.DeprecatedControllerConfiguration, out *v1alpha1.DeprecatedControllerConfiguration, s conversion.Scope) error {
	return autoConvert_config_DeprecatedControllerConfiguration_To_v1alpha1_DeprecatedControllerConfiguration(in, out, s)
}
1131225
func Convert_v1_LimitRange_To_core_LimitRange(in *v1.LimitRange, out *core.LimitRange, s conversion.Scope) error {
	return autoConvert_v1_LimitRange_To_core_LimitRange(in, out, s)
}
110136
func (bldr *aeBackupInformationKindTypeInfoQueryBuilder) Limit(limit int) *aeBackupInformationKindTypeInfoQueryBuilder {
	bldr.q = bldr.q.Limit(limit)
	if bldr.plugin != nil {
		bldr.plugin.Limit(limit)
	}
	return bldr
}
401828
func Convert_config_NodeLifecycleControllerConfiguration_To_v1alpha1_NodeLifecycleControllerConfiguration(in *config.NodeLifecycleControllerConfiguration, out *v1alpha1.NodeLifecycleControllerConfiguration, s conversion.Scope) error {
	return autoConvert_config_NodeLifecycleControllerConfiguration_To_v1alpha1_NodeLifecycleControllerConfiguration(in, out, s)
}
51533
func (r *Response) RateLimit() int {
	value, _ := strconv.Atoi(r.HttpResponse.Header.Get("X-RateLimit-Limit"))
	return value
}
299836
func (c *Compiler) SetErrorLimit(limit int) *Compiler {
	c.maxErrs = limit
	return c
}
1119422
func (s *UpdateRateBasedRuleInput) SetRateLimit(v int64) *UpdateRateBasedRuleInput {
	s.RateLimit = &v
	return s
}
1025542
func Convert_apiserver_AdmissionConfiguration_To_v1alpha1_AdmissionConfiguration(in *apiserver.AdmissionConfiguration, out *AdmissionConfiguration, s conversion.Scope) error {
	return autoConvert_apiserver_AdmissionConfiguration_To_v1alpha1_AdmissionConfiguration(in, out, s)
}
453525
func (conn *Conn) rateLimit(chars int) time.Duration {
	// Hybrid's algorithm allows for 2 seconds per line and an additional
	// 1/120 of a second per character on that line.
	linetime := 2*time.Second + time.Duration(chars)*time.Second/120
	elapsed := time.Now().Sub(conn.lastsent)
	if conn.badness += linetime - elapsed; conn.badness < 0 {
		// negative badness times are badness...
		conn.badness = 0
	}
	conn.lastsent = time.Now()
	// If we've sent more than 10 second's worth of lines according to the
	// calculation above, then we're at risk of "Excess Flood".
	if conn.badness > 10*time.Second {
		return linetime
	}
	return 0
}
1045550
func (api *API) RateLimit(zoneID, limitID string) (RateLimit, error) {
	uri := "/zones/" + zoneID + "/rate_limits/" + limitID
	res, err := api.makeRequest("GET", uri, nil)
	if err != nil {
		return RateLimit{}, errors.Wrap(err, errMakeRequestError)
	}
	var r rateLimitResponse
	err = json.Unmarshal(res, &r)
	if err != nil {
		return RateLimit{}, errors.Wrap(err, errUnmarshalError)
	}
	return r.Result, nil
}
705533
func (opts *Options) SetRateLimitDelayMaxMilliseconds(value uint) {
	C.rocksdb_options_set_rate_limit_delay_max_milliseconds(opts.c, C.uint(value))
}
1164906
func RateLimit(period time.Duration, limit int) RateLimiter {
	store := memory.NewStore()
	rate := limiter.Rate{
		Period: period,
		Limit:  int64(limit),
	}

	lmt := limiter.New(store, rate)
	middleware := stdlib.NewMiddleware(lmt, stdlib.WithForwardHeader(true))
	middleware.OnLimitReached = func(w http.ResponseWriter, r *http.Request) {
		// Get the clients ip address.
		ipString := r.RemoteAddr
		// Account for proxies.
		if forwardString := r.Header.Get("X-Forwarded-For"); forwardString != "" {
			ipString = forwardString
		}
		// Cloudflare creates a special ipv6 address if the client uses ipv6,
		// so check for the appropriate header
		// We will rate limit on this special ipv4 address, but this is not a problem
		// as Cloudflare maps these special addresses to the underlying ipv6 address
		// in a one on one relationship
		if ipv6 := r.Header.Get("Cf-Connecting-Ipv6"); ipv6 != "" {
			ipString = ipv6
		}
		log.Info("Rate limiting request from: ", ipString)

		// Write some info back to the client
		w.WriteHeader(http.StatusTooManyRequests)
		w.Header().Set("Content-Type", "text/plain")
		w.Write([]byte("You have reached the maximum request limit."))
		return
	}
	return RateLimiter{middleware}

}
708222
func AggRateLimitsP(rlimits []*chat1.RateLimit) (res []chat1.RateLimit) {
	m := make(map[string]chat1.RateLimit)
	for _, l := range rlimits {
		if l != nil {
			m[l.Name] = *l
		}
	}
	for _, v := range m {
		res = append(res, v)
	}
	return res
}
563441
func Convert_security_AllowedFlexVolume_To_v1_AllowedFlexVolume(in *security.AllowedFlexVolume, out *v1.AllowedFlexVolume, s conversion.Scope) error {
	return autoConvert_security_AllowedFlexVolume_To_v1_AllowedFlexVolume(in, out, s)
}
268067
func (s *MethodSetting) SetThrottlingRateLimit(v float64) *MethodSetting {
	s.ThrottlingRateLimit = &v
	return s
}