def show(self, req, id): replica = self._replica_api.get_replica( req.environ["coriolis.context"], id) if not replica: raise exc.HTTPNotFound() return replica_view.single(req, replica)
def show(self, req, id): context = req.environ["coriolis.context"] context.can(replica_policies.get_replicas_policy_label("show")) replica = self._replica_api.get_replica(context, id) if not replica: raise exc.HTTPNotFound() return replica_view.single(req, replica)
def update(self, req, id, body): context = req.environ["coriolis.context"] context.can(replica_policies.get_replicas_policy_label("update")) updated_values = self._validate_update_body(body) return replica_view.single( req, self._replica_api.update(req.environ['coriolis.context'], id, updated_values))
def create(self, req, body): (origin_endpoint_id, destination_endpoint_id, destination_environment, instances, notes) = self._validate_create_body(body) return replica_view.single( req, self._replica_api.create(req.environ['coriolis.context'], origin_endpoint_id, destination_endpoint_id, destination_environment, instances, notes))
def create(self, req, body): context = req.environ["coriolis.context"] context.can(replica_policies.get_replicas_policy_label("create")) (origin_endpoint_id, destination_endpoint_id, source_environment, destination_environment, instances, network_map, storage_mappings, notes) = self._validate_create_body(context, body) return replica_view.single( req, self._replica_api.create(context, origin_endpoint_id, destination_endpoint_id, source_environment, destination_environment, instances, network_map, storage_mappings, notes))