1
# vim: tabstop=4 shiftwidth=4 softtabstop=4
3
# Copyright 2010 United States Government as represented by the
4
# Administrator of the National Aeronautics and Space Administration.
7
# Licensed under the Apache License, Version 2.0 (the "License"); you may
8
# not use this file except in compliance with the License. You may obtain
9
# a copy of the License at
11
# http://www.apache.org/licenses/LICENSE-2.0
13
# Unless required by applicable law or agreed to in writing, software
14
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
15
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
16
# License for the specific language governing permissions and limitations
20
WSGI middleware for OpenStack Volume API.
23
import cinder.api.openstack
24
from cinder.api.openstack.volume import extensions
25
from cinder.api.openstack.volume import snapshots
26
from cinder.api.openstack.volume import types
27
from cinder.api.openstack.volume import volumes
28
from cinder.api.openstack.volume import versions
29
from cinder import log as logging
32
LOG = logging.getLogger(__name__)
35
class APIRouter(cinder.api.openstack.APIRouter):
37
Routes requests on the OpenStack API to the appropriate controller
40
ExtensionManager = extensions.ExtensionManager
42
def _setup_routes(self, mapper):
43
self.resources['versions'] = versions.create_resource()
44
mapper.connect("versions", "/",
45
controller=self.resources['versions'],
48
mapper.redirect("", "/")
50
self.resources['volumes'] = volumes.create_resource()
51
mapper.resource("volume", "volumes",
52
controller=self.resources['volumes'],
53
collection={'detail': 'GET'})
55
self.resources['types'] = types.create_resource()
56
mapper.resource("type", "types",
57
controller=self.resources['types'])
59
self.resources['snapshots'] = snapshots.create_resource()
60
mapper.resource("snapshot", "snapshots",
61
controller=self.resources['snapshots'],
62
collection={'detail': 'GET'})