Extending mgmt api from core instancce api.
This commit is contained in:
parent
209182d96d
commit
f5f1a152d6
@ -48,7 +48,7 @@ class Mgmt(extensions.ExtensionsDescriptor):
|
|||||||
body_serializers={'application/xml':
|
body_serializers={'application/xml':
|
||||||
wsgi.ReddwarfXMLDictSerializer()})
|
wsgi.ReddwarfXMLDictSerializer()})
|
||||||
resource = extensions.ResourceExtension('{tenant_id}/mgmt/instances',
|
resource = extensions.ResourceExtension('{tenant_id}/mgmt/instances',
|
||||||
service.InstanceController(),
|
service.MgmtInstanceController(),
|
||||||
deserializer=wsgi.RequestDeserializer(),
|
deserializer=wsgi.RequestDeserializer(),
|
||||||
serializer=serializer)
|
serializer=serializer)
|
||||||
resources.append(resource)
|
resources.append(resource)
|
||||||
|
@ -18,45 +18,16 @@
|
|||||||
import logging
|
import logging
|
||||||
import webob.exc
|
import webob.exc
|
||||||
|
|
||||||
from reddwarf.common import exception, config
|
from reddwarf.common import exception
|
||||||
from reddwarf.common import wsgi
|
from reddwarf.common import wsgi
|
||||||
from reddwarf.instance import models as instance_models
|
from reddwarf.instance import models as instance_models
|
||||||
from reddwarf.extensions.mgmt import views
|
from reddwarf.extensions.mgmt import views
|
||||||
|
from reddwarf.instance.service import InstanceController
|
||||||
|
|
||||||
LOG = logging.getLogger(__name__)
|
LOG = logging.getLogger(__name__)
|
||||||
|
|
||||||
|
|
||||||
class BaseController(wsgi.Controller):
|
class MgmtInstanceController(InstanceController):
|
||||||
"""Base controller class."""
|
|
||||||
|
|
||||||
exclude_attr = []
|
|
||||||
exception_map = {
|
|
||||||
webob.exc.HTTPUnprocessableEntity: [
|
|
||||||
exception.UnprocessableEntity,
|
|
||||||
],
|
|
||||||
webob.exc.HTTPBadRequest: [
|
|
||||||
exception.BadRequest,
|
|
||||||
],
|
|
||||||
webob.exc.HTTPNotFound: [
|
|
||||||
exception.NotFound,
|
|
||||||
instance_models.ModelNotFoundError,
|
|
||||||
],
|
|
||||||
webob.exc.HTTPConflict: [
|
|
||||||
],
|
|
||||||
}
|
|
||||||
|
|
||||||
def __init__(self):
|
|
||||||
self.add_addresses = config.Config.get('add_addresses', False)
|
|
||||||
pass
|
|
||||||
|
|
||||||
def _extract_required_params(self, params, model_name):
|
|
||||||
params = params or {}
|
|
||||||
model_params = params.get(model_name, {})
|
|
||||||
return utils.stringify_keys(utils.exclude(model_params,
|
|
||||||
*self.exclude_attr))
|
|
||||||
|
|
||||||
|
|
||||||
class InstanceController(BaseController):
|
|
||||||
"""Controller for instance functionality"""
|
"""Controller for instance functionality"""
|
||||||
|
|
||||||
def index(self, req, tenant_id, detailed=False):
|
def index(self, req, tenant_id, detailed=False):
|
||||||
|
Loading…
Reference in New Issue
Block a user