Exemple #1
0
 def _items(self, request, tenant_id, is_detail):
     """ Returns a list of qoss. """
     qoss = self._plugin.get_all_qoss(tenant_id)
     builder = qos_view.get_view_builder(request)
     result = [builder.build(qos, is_detail)['qos']
               for qos in qoss]
     return dict(qoss=result)
Exemple #2
0
 def show(self, request, tenant_id, id):
     """ Returns qos details for the given qos id """
     try:
         qos = self._plugin.get_qos_details(tenant_id, id)
         builder = qos_view.get_view_builder(request)
         #build response with details
         result = builder.build(qos, True)
         return dict(qoss=result)
     except exception.QosNotFound as exp:
         return faults.Fault(faults.QosNotFound(exp))
Exemple #3
0
 def show(self, request, tenant_id, id):
     """ Returns qos details for the given qos id """
     try:
         qos = self._plugin.get_qos_details(tenant_id, id)
         builder = qos_view.get_view_builder(request)
         #build response with details
         result = builder.build(qos, True)
         return dict(qoss=result)
     except exception.QosNotFound as exp:
         return faults.Fault(faults.QosNotFound(exp))
Exemple #4
0
 def create(self, request, tenant_id):
     """ Creates a new qos for a given tenant """
     #look for qos name in request
     try:
         body = self._deserialize(request.body, request.get_content_type())
         req_body = self._prepare_request_body(body,
                                               self._qos_ops_param_list)
         req_params = req_body[self._resource_name]
     except exc.HTTPError as exp:
         return faults.Fault(exp)
     qos = self._plugin.create_qos(tenant_id, req_params['qos_name'],
                                   req_params['qos_desc'])
     builder = qos_view.get_view_builder(request)
     result = builder.build(qos)
     return dict(qoss=result)
Exemple #5
0
 def create(self, request, tenant_id):
     """ Creates a new qos for a given tenant """
     #look for qos name in request
     try:
         req_params = \
             self._parse_request_params(request,
                                        self._qos_ops_param_list)
     except exc.HTTPError as exp:
         return faults.Fault(exp)
     qos = self._plugin.\
                    create_qos(tenant_id,
                                       req_params['qos_name'],
                                       req_params['qos_desc'])
     builder = qos_view.get_view_builder(request)
     result = builder.build(qos)
     return dict(qoss=result)
Exemple #6
0
 def create(self, request, tenant_id):
     """ Creates a new qos for a given tenant """
     #look for qos name in request
     try:
         req_params = \
             self._parse_request_params(request,
                                        self._qos_ops_param_list)
     except exc.HTTPError as exp:
         return faults.Fault(exp)
     qos = self._plugin.\
                    create_qos(tenant_id,
                                       req_params['qos_name'],
                                       req_params['qos_desc'])
     builder = qos_view.get_view_builder(request)
     result = builder.build(qos)
     return dict(qoss=result)
Exemple #7
0
 def create(self, request, tenant_id):
     """ Creates a new qos for a given tenant """
     #look for qos name in request
     try:
         body = self._deserialize(request.body, request.get_content_type())
         req_body = self._prepare_request_body(body,
                                               self._qos_ops_param_list)
         req_params = req_body[self._resource_name]
     except exc.HTTPError as exp:
         return faults.Fault(exp)
     qos = self._plugin.create_qos(tenant_id,
                                   req_params['qos_name'],
                                   req_params['qos_desc'])
     builder = qos_view.get_view_builder(request)
     result = builder.build(qos)
     return dict(qoss=result)
Exemple #8
0
    def update(self, request, tenant_id, id):
        """ Updates the name for the qos with the given id """
        try:
            req_params = \
                self._parse_request_params(request,
                                           self._qos_ops_param_list)
        except exc.HTTPError as exp:
            return faults.Fault(exp)
        try:
            qos = self._plugin.\
            rename_qos(tenant_id,
                        id, req_params['qos_name'])

            builder = qos_view.get_view_builder(request)
            result = builder.build(qos, True)
            return dict(qoss=result)
        except exception.QosNotFound as exp:
            return faults.Fault(faults.QosNotFound(exp))
Exemple #9
0
    def update(self, request, tenant_id, id):
        """ Updates the name for the qos with the given id """
        try:
            req_params = \
                self._parse_request_params(request,
                                           self._qos_ops_param_list)
        except exc.HTTPError as exp:
            return faults.Fault(exp)
        try:
            qos = self._plugin.\
            rename_qos(tenant_id,
                        id, req_params['qos_name'])

            builder = qos_view.get_view_builder(request)
            result = builder.build(qos, True)
            return dict(qoss=result)
        except exception.QosNotFound as exp:
            return faults.Fault(faults.QosNotFound(exp))
Exemple #10
0
    def update(self, request, tenant_id, id):
        """ Updates the name for the qos with the given id """
        try:
            body = self._deserialize(request.body, request.get_content_type())
            req_body = self._prepare_request_body(body,
                                                  self._qos_ops_param_list)
            req_params = req_body[self._resource_name]
        except exc.HTTPError as exp:
            return faults.Fault(exp)
        try:
            qos = self._plugin.rename_qos(tenant_id, id,
                                          req_params['qos_name'])

            builder = qos_view.get_view_builder(request)
            result = builder.build(qos, True)
            return dict(qoss=result)
        except exception.QosNotFound as exp:
            return faults.Fault(faults.QosNotFound(exp))
Exemple #11
0
    def update(self, request, tenant_id, id):
        """ Updates the name for the qos with the given id """
        try:
            body = self._deserialize(request.body, request.get_content_type())
            req_body = self._prepare_request_body(body,
                                                  self._qos_ops_param_list)
            req_params = req_body[self._resource_name]
        except exc.HTTPError as exp:
            return faults.Fault(exp)
        try:
            qos = self._plugin.rename_qos(tenant_id, id,
                                          req_params['qos_name'])

            builder = qos_view.get_view_builder(request)
            result = builder.build(qos, True)
            return dict(qoss=result)
        except exception.QosNotFound as exp:
            return faults.Fault(faults.QosNotFound(exp))
Exemple #12
0
 def _items(self, request, tenant_id, is_detail):
     """ Returns a list of qoss. """
     qoss = self._plugin.get_all_qoss(tenant_id)
     builder = qos_view.get_view_builder(request)
     result = [builder.build(qos, is_detail)['qos'] for qos in qoss]
     return dict(qoss=result)