refactoring wsgi to separate controller/serialization/deserialization logic; creating osapi-specific module
This commit is contained in:
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user