Beispiel #1
0
 def delete(self, request, tenant_id, id):
     """Destroys the qos with the given id."""
     try:
         self._plugin.delete_qos(tenant_id, id)
         return exc.HTTPOk()
     except exception.QosNotFound as exp:
         return faults.Fault(faults.QosNotFound(exp))
Beispiel #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))
Beispiel #3
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))