|
3 | 3 | from ..utils import DataikuStreamedHttpUTF8CSVReader |
4 | 4 | import json |
5 | 5 | from .metrics import ComputedMetrics |
| 6 | +from .future import DSSFuture |
6 | 7 | from .discussion import DSSObjectDiscussions |
7 | 8 |
|
8 | 9 | class DSSManagedFolder(object): |
@@ -173,3 +174,22 @@ def get_object_discussions(self): |
173 | 174 | :rtype: :class:`dataikuapi.discussion.DSSObjectDiscussions` |
174 | 175 | """ |
175 | 176 | return DSSObjectDiscussions(self.client, self.project_key, "MANAGED_FOLDER", self.odb_id) |
| 177 | + |
| 178 | + ######################################################## |
| 179 | + # utilities |
| 180 | + ######################################################## |
| 181 | + def copy_to(self, target, write_mode="OVERWRITE"): |
| 182 | + """ |
| 183 | + Copies the data of this folder to another folder |
| 184 | +
|
| 185 | + :param target Folder: a :class:`dataikuapi.dss.managedfolder.DSSManagedFolder` representing the target of this copy |
| 186 | + :returns: a DSSFuture representing the operation |
| 187 | + """ |
| 188 | + dqr = { |
| 189 | + "targetProjectKey" : target.project_key, |
| 190 | + "targetFolderId": target.odb_id, |
| 191 | + "writeMode" : write_mode |
| 192 | + } |
| 193 | + future_resp = self.client._perform_json("POST", "/projects/%s/managedfolders/%s/actions/copyTo" % (self.project_key, self.odb_id), body=dqr) |
| 194 | + return DSSFuture(self.client, future_resp.get("jobId", None), future_resp) |
| 195 | + |
0 commit comments