Пример #1
0
    def PUT(self, node_id):
        """:returns: Collection of JSONized Node objects.
        :http: * 200 (nodes are successfully updated)
               * 400 (invalid nodes data specified)
        """
        interfaces_data = self.checked_data(
            self.validator.validate_structure_and_data, node_id=node_id)
        node_data = {'id': node_id, 'interfaces': interfaces_data}

        NetworkManager._update_attrs(node_data)
        node = self.get_object_or_404(Node, node_id)
        return map(self.render, node.interfaces)
Пример #2
0
    def PUT(self, node_id):
        """:returns: Collection of JSONized Node objects.
        :http: * 200 (nodes are successfully updated)
               * 400 (invalid nodes data specified)
        """
        interfaces_data = self.validator.validate_json(web.data())
        node_data = {'id': node_id, 'interfaces': interfaces_data}
        self.validator.validate(node_data)

        NetworkManager._update_attrs(node_data)
        node = self.get_object_or_404(Node, node_id)
        return map(self.render, node.interfaces)
Пример #3
0
    def PUT(self, node_id):
        """:returns: Collection of JSONized Node objects.
        :http: * 200 (nodes are successfully updated)
               * 400 (invalid nodes data specified)
        """
        interfaces_data = self.validator.validate_json(web.data())
        node_data = {'id': node_id, 'interfaces': interfaces_data}
        self.validator.validate(node_data)

        network_manager = NetworkManager()
        network_manager._update_attrs(node_data)
        node = self.get_object_or_404(Node, node_id)
        return self.render(node)['interfaces']
Пример #4
0
 def PUT(self):
     data = self.validator.validate_collection_structure(web.data())
     network_manager = NetworkManager()
     updated_nodes_ids = []
     for node_data in data:
         self.validator.verify_data_correctness(node_data)
         node_id = network_manager._update_attrs(node_data)
         updated_nodes_ids.append(node_id)
     updated_nodes = db().query(Node).filter(
         Node.id.in_(updated_nodes_ids)).all()
     return map(self.render, updated_nodes)
Пример #5
0
 def PUT(self):
     data = self.validator.validate_collection_structure(web.data())
     network_manager = NetworkManager()
     updated_nodes_ids = []
     for node_data in data:
         self.validator.verify_data_correctness(node_data)
         node_id = network_manager._update_attrs(node_data)
         updated_nodes_ids.append(node_id)
     updated_nodes = db().query(Node).filter(
         Node.id.in_(updated_nodes_ids)
     ).all()
     return map(self.render, updated_nodes)
Пример #6
0
 def PUT(self):
     """:returns: Collection of JSONized Node objects.
     :http: * 200 (nodes are successfully updated)
            * 400 (invalid nodes data specified)
     """
     data = self.validator.validate_collection_structure(web.data())
     network_manager = NetworkManager()
     updated_nodes_ids = []
     for node_data in data:
         self.validator.verify_data_correctness(node_data)
         node_id = network_manager._update_attrs(node_data)
         updated_nodes_ids.append(node_id)
     updated_nodes = db().query(Node).filter(Node.id.in_(updated_nodes_ids)).all()
     return map(self.render, updated_nodes)
Пример #7
0
 def PUT(self):
     """:returns: Collection of JSONized Node objects.
     :http: * 200 (nodes are successfully updated)
            * 400 (invalid nodes data specified)
     """
     data = self.validator.validate_collection_structure(web.data())
     network_manager = NetworkManager()
     updated_nodes_ids = []
     for node_data in data:
         self.validator.verify_data_correctness(node_data)
         node_id = network_manager._update_attrs(node_data)
         updated_nodes_ids.append(node_id)
     updated_nodes = db().query(Node).filter(
         Node.id.in_(updated_nodes_ids)).all()
     return map(self.render, updated_nodes)
Пример #8
0
 def PUT(self):
     """:returns: Collection of JSONized Node objects.
     :http: * 200 (nodes are successfully updated)
            * 400 (invalid nodes data specified)
     """
     data = self.checked_data(
         self.validator.validate_collection_structure_and_data)
     updated_nodes_ids = []
     for node_data in data:
         node_id = NetworkManager._update_attrs(node_data)
         updated_nodes_ids.append(node_id)
     updated_nodes = db().query(Node).filter(
         Node.id.in_(updated_nodes_ids)).all()
     return [{
         "id": n.id,
         "interfaces": map(self.render, n.interfaces)
     } for n in updated_nodes]
Пример #9
0
 def PUT(self):
     """:returns: Collection of JSONized Node objects.
     :http: * 200 (nodes are successfully updated)
            * 400 (invalid nodes data specified)
     """
     data = self.checked_data(
         self.validator.validate_collection_structure_and_data)
     updated_nodes_ids = []
     for node_data in data:
         node_id = NetworkManager._update_attrs(node_data)
         updated_nodes_ids.append(node_id)
     updated_nodes = db().query(Node).filter(
         Node.id.in_(updated_nodes_ids)
     ).all()
     return [
         {
             "id": n.id,
             "interfaces": map(self.render, n.interfaces)
         } for n in updated_nodes
     ]