add rest/request backoffMgr and throttle setters

Kubernetes-commit: 427884aa3969a2a5826b198854602cc62a0fff32
This commit is contained in:
juanvallejo 2017-11-16 13:06:43 -05:00 committed by Kubernetes Publisher
parent a9b11fb1b4
commit f1ca0e5f1d

View File

@ -179,6 +179,24 @@ func (r *Request) Resource(resource string) *Request {
return r
}
// BackOff sets the request's backoff manager to the one specified,
// or defaults to the stub implementation if nil is provided
func (r *Request) BackOff(manager BackoffManager) *Request {
if manager == nil {
r.backoffMgr = &NoBackoff{}
return r
}
r.backoffMgr = manager
return r
}
// Throttle receives a rate-limiter and sets or replaces an existing request limiter
func (r *Request) Throttle(limiter flowcontrol.RateLimiter) *Request {
r.throttle = limiter
return r
}
// SubResource sets a sub-resource path which can be multiple segments segment after the resource
// name but before the suffix.
func (r *Request) SubResource(subresources ...string) *Request {