Merge "changing the routes for the api to be clear"

This commit is contained in:
Jenkins
2014-01-29 23:06:46 +00:00
committed by Gerrit Code Review

View File

@@ -37,7 +37,10 @@ class API(wsgi.Router):
def _versions_router(self, mapper): def _versions_router(self, mapper):
versions_resource = VersionsController().create_resource() versions_resource = VersionsController().create_resource()
mapper.connect("/", controller=versions_resource, action="show") mapper.connect("/",
controller=versions_resource,
action="show",
conditions={'method': ['GET']})
def _datastore_router(self, mapper): def _datastore_router(self, mapper):
datastore_resource = DatastoreController().create_resource() datastore_resource = DatastoreController().create_resource()
@@ -55,25 +58,71 @@ class API(wsgi.Router):
def _instance_router(self, mapper): def _instance_router(self, mapper):
instance_resource = InstanceController().create_resource() instance_resource = InstanceController().create_resource()
path = "/{tenant_id}/instances" mapper.connect("/{tenant_id}/instances",
mapper.resource("instance", path, controller=instance_resource, controller=instance_resource,
member={'action': 'POST', 'backups': 'GET'}) action="index",
conditions={'method': ['GET']})
mapper.connect("/{tenant_id}/instances",
controller=instance_resource,
action="create",
conditions={'method': ['POST']})
mapper.connect("/{tenant_id}/instances/{id}",
controller=instance_resource,
action="show",
conditions={'method': ['GET']})
mapper.connect("/{tenant_id}/instances/{id}/action",
controller=instance_resource,
action="action",
conditions={'method': ['POST']})
mapper.connect("/{tenant_id}/instances/{id}",
controller=instance_resource,
action="delete",
conditions={'method': ['DELETE']})
mapper.connect("/{tenant_id}/instances/{id}/backups",
controller=instance_resource,
action="backups",
conditions={'method': ['GET']})
def _flavor_router(self, mapper): def _flavor_router(self, mapper):
flavor_resource = FlavorController().create_resource() flavor_resource = FlavorController().create_resource()
path = "/{tenant_id}/flavors" mapper.connect("/{tenant_id}/flavors",
mapper.resource("flavor", path, controller=flavor_resource) controller=flavor_resource,
action="index",
conditions={'method': ['GET']})
mapper.connect("/{tenant_id}/flavors/{id}",
controller=flavor_resource,
action="show",
conditions={'method': ['GET']})
def _limits_router(self, mapper): def _limits_router(self, mapper):
limits_resource = LimitsController().create_resource() limits_resource = LimitsController().create_resource()
path = "/{tenant_id}/limits" mapper.connect("/{tenant_id}/limits",
mapper.resource("limits", path, controller=limits_resource) controller=limits_resource,
action="index",
conditions={'method': ['GET']})
def _backups_router(self, mapper): def _backups_router(self, mapper):
backups_resource = BackupController().create_resource() backups_resource = BackupController().create_resource()
path = "/{tenant_id}/backups" mapper.connect("/{tenant_id}/backups",
mapper.resource("backups", path, controller=backups_resource, controller=backups_resource,
member={'action': 'POST'}) action="index",
conditions={'method': ['GET']})
mapper.connect("/{tenant_id}/backups",
controller=backups_resource,
action="create",
conditions={'method': ['POST']})
mapper.connect("/{tenant_id}/backups/{id}",
controller=backups_resource,
action="show",
conditions={'method': ['GET']})
mapper.connect("/{tenant_id}/backups/{id}",
controller=backups_resource,
action="action",
conditions={'method': ['POST']})
mapper.connect("/{tenant_id}/backups/{id}",
controller=backups_resource,
action="delete",
conditions={'method': ['DELETE']})
def app_factory(global_conf, **local_conf): def app_factory(global_conf, **local_conf):