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)
def edge_list(self): objs = self.request("/api/edge") return [Edge.from_object(o) for o in objs.values()]
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)