예제 #1
0
    def edge_create(self, parent_id, child_id, edge_id=None, host=None,
                    metadata=None):
        now = int(time())
        if not edge_id:
            edge_id = str(uuid4())

        if not host:
            host = gethostname()

        data = json.dumps(
            {
                "ID": edge_id,
                "CreatedAt": now,
                "UpdatedAt": now,
                "Host": host,
                "Parent": parent_id,
                "Child": child_id,
                "Metadata": metadata
            }
        )
        r = self.request("/api/edge", method="POST", data=data)
        return Edge.from_object(r)
예제 #2
0
 def edge_list(self):
     objs = self.request("/api/edge")
     return [Edge.from_object(o) for o in objs.values()]
예제 #3
0
파일: client.py 프로젝트: pu55yf3r/skydive
 def edge_update(self, edge_id=None, patches=[]):
     data = json.dumps(patches)
     path = "/api/edge/%s" % edge_id
     r = self.request(path, method="PATCH", data=data)
     return Edge.from_object(r)