This Page

Psst... hey. You're reading the latest content, but it might be out of sync with code. You can read Nova 2011.1 docs or all OpenStack docs too.

The nova.api.openstack.limits Module

Module dedicated functions/classes dealing with rate limiting requests.

class nova.api.openstack.limits.Limit(verb, uri, regex, value, unit)

Bases: object

Stores information about a limit for HTTP requets.

display()

Return a useful representation of this class.

display_unit()

Display the string name of the unit.

class nova.api.openstack.limits.Limiter(limits)

Bases: object

Rate-limit checking class which handles limits in memory.

check_for_delay(verb, url, username=None)

Check the given verb/user/user triplet for limit.

@return: Tuple of delay (in seconds) and error message (or None, None)

get_limits(username=None)

Return the limits for a given user.

class nova.api.openstack.limits.LimitsController

Bases: nova.api.openstack.common.OpenstackController

Controller for accessing limits in the OpenStack API.

index(req)

Return all global and rate limit information.

class nova.api.openstack.limits.RateLimitingMiddleware(application, limits=None)

Bases: nova.wsgi.Middleware

Rate-limits requests passing through this middleware. All limit information is stored in memory for this implementation.

class nova.api.openstack.limits.WsgiLimiter(limits=None)

Bases: object

Rate-limit checking from a WSGI application. Uses an in-memory Limiter.

To use:

POST /<username> with JSON data such as: {

“verb” : GET, “path” : “/servers”

}

and receive a 204 No Content, or a 403 Forbidden with an X-Wait-Seconds header containing the number of seconds to wait before the action would succeed.

class nova.api.openstack.limits.WsgiLimiterProxy(limiter_address)

Bases: object

Rate-limit requests based on answers from a remote source.

check_for_delay(verb, path, username=None)