Skip to content
This repository was archived by the owner on Sep 22, 2023. It is now read-only.

Commit 41a8e53

Browse files
committed
Separate vfolder deletion API
* Original delete (instance) method do not accept folder ID to keep the abstraction. * vfolder deletion by folder ID will be performed by class method "delete_by_id".
1 parent ca07ff4 commit 41a8e53

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

src/ai/backend/client/vfolder.py

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,14 @@ async def create(cls, name: str, host: str = None, group: str = None):
3737
async with rqst.fetch() as resp:
3838
return await resp.json()
3939

40+
@api_function
41+
@classmethod
42+
async def delete_by_id(cls, oid):
43+
rqst = Request(cls.session, 'DELETE', '/folders')
44+
rqst.set_json({'id': oid})
45+
async with rqst.fetch():
46+
return {}
47+
4048
@api_function
4149
@classmethod
4250
async def list(cls, list_all=False):
@@ -73,10 +81,8 @@ async def info(self):
7381
return await resp.json()
7482

7583
@api_function
76-
async def delete(self, oid=None):
84+
async def delete(self):
7785
rqst = Request(self.session, 'DELETE', '/folders/{0}'.format(self.name))
78-
if oid is not None:
79-
rqst.set_json({'id': oid})
8086
async with rqst.fetch():
8187
return {}
8288

0 commit comments

Comments
 (0)