refactoring wsgi to separate controller/serialization/deserialization logic; creating osapi-specific module

This commit is contained in:
Brian Waldon
2011-05-18 19:13:22 -04:00
parent 0946bac5fa
commit 5e722ea7b9
19 changed files with 624 additions and 366 deletions

View File

@@ -19,9 +19,8 @@ import time
from webob import exc
from nova.api.openstack import common
from nova.api.openstack import faults
import nova.image.service
from nova.api.openstack import wsgi
def _translate_keys(inst):
@@ -29,14 +28,9 @@ def _translate_keys(inst):
return dict(backupSchedule=inst)
class Controller(common.OpenstackController):
class Controller(object):
""" The backup schedule API controller for the Openstack API """
_serialization_metadata = {
'application/xml': {
'attributes': {
'backupSchedule': []}}}
def __init__(self):
pass
@@ -48,7 +42,7 @@ class Controller(common.OpenstackController):
""" Returns a single backup schedule for a given instance """
return faults.Fault(exc.HTTPNotImplemented())
def create(self, req, server_id):
def create(self, req, server_id, body):
""" No actual update method required, since the existing API allows
both create and update through a POST """
return faults.Fault(exc.HTTPNotImplemented())
@@ -56,3 +50,18 @@ class Controller(common.OpenstackController):
def delete(self, req, server_id, id):
""" Deletes an existing backup schedule """
return faults.Fault(exc.HTTPNotImplemented())
def resource_factory():
metadata = {
'attributes': {
'backupSchedule': [],
},
}
serializers = {
'application/xml': wsgi.XMLSerializer(xmlns=wsgi.XMLNS_V10,
metadata=metadata),
}
return wsgi.Resource(Controller(), serializers=serializers)