Example #1
0
 def delete(self, req, id):
     context = req.environ["coriolis.context"]
     context.can(endpoint_policies.get_endpoints_policy_label("delete"))
     try:
         self._endpoint_api.delete(req.environ['coriolis.context'], id)
         raise exc.HTTPNoContent()
     except exception.NotFound as ex:
         raise exc.HTTPNotFound(explanation=ex.msg)
Example #2
0
 def update(self, req, id, body):
     context = req.environ["coriolis.context"]
     context.can(endpoint_policies.get_endpoints_policy_label("update"))
     updated_values = self._validate_update_body(body)
     return endpoint_view.single(
         req,
         self._endpoint_api.update(req.environ['coriolis.context'], id,
                                   updated_values))
Example #3
0
    def show(self, req, id):
        context = req.environ["coriolis.context"]
        context.can(endpoint_policies.get_endpoints_policy_label("show"))
        endpoint = self._endpoint_api.get_endpoint(context, id)
        if not endpoint:
            raise exc.HTTPNotFound()

        return endpoint_view.single(req, endpoint)
Example #4
0
 def create(self, req, body):
     context = req.environ["coriolis.context"]
     context.can(endpoint_policies.get_endpoints_policy_label("create"))
     (name, endpoint_type, description, connection_info,
      mapped_regions) = self._validate_create_body(body)
     return endpoint_view.single(
         req,
         self._endpoint_api.create(context, name, endpoint_type,
                                   description, connection_info,
                                   mapped_regions))
Example #5
0
 def index(self, req):
     context = req.environ["coriolis.context"]
     context.can(endpoint_policies.get_endpoints_policy_label("list"))
     return endpoint_view.collection(
         req, self._endpoint_api.get_endpoints(context))