cinder.api.openstack package

Submodules

Module contents

WSGI middleware for OpenStack API controllers.

class APIMapper(controller_scan=<function controller_scan>, directory=None, always_scan=False, register=True, explicit=True)

Bases: Mapper

connect(*args, **kwargs)

Create and connect a new Route to the Mapper.

Usage:

m = Mapper()
m.connect(':controller/:action/:id')
m.connect('date/:year/:month/:day', controller="blog",
          action="view")
m.connect('archives/:page', controller="blog", action="by_page",
requirements = { 'page':'\d{1,2}' })
m.connect('category_list', 'archives/category/:section',
          controller='blog', action='category',
          section='home', type='list')
m.connect('home', '', controller='blog', action='view',
          section='home')
routematch(url=None, environ=None)

Match a URL against against one of the routes contained.

Will return None if no valid match is found, otherwise a result dict and a route object is returned.

resultdict, route_obj = m.match('/joe/sixpack')
class APIRouter(ext_mgr=None)

Bases: Router

Routes requests on the API to the appropriate controller and method.

ExtensionManager = None
classmethod factory(global_config, **local_config)

Simple paste factory, cinder.wsgi.Router doesn’t have.

class ProjectMapper(controller_scan=<function controller_scan>, directory=None, always_scan=False, register=True, explicit=True)

Bases: APIMapper

resource(member_name, collection_name, **kwargs)

Base resource path handler

This method is compatible with resource paths that include a project_id and those that don’t. Including project_id in the URLs was a legacy API requirement; and making API requests against such endpoints won’t work for users that don’t belong to a particular project.