summaryrefslogtreecommitdiffstats
path: root/src/restRequest.py
diff options
context:
space:
mode:
authorAlejandro Sirgo Rica <asirgo@soleta.eu>2024-05-23 11:17:35 +0200
committerAlejandro Sirgo Rica <asirgo@soleta.eu>2024-05-30 17:22:23 +0200
commit8de2b785a9be79f9cc0caa0011293f95a42d4d31 (patch)
tree660b9c7088f56e3d9a768c05fe1a0f65b296bc69 /src/restRequest.py
parente2d48ba3a0909f34afcf286ece339aa6a426678c (diff)
src: add POST cache/delete method
Add API REST method to delete cache contents. Resquest payload structure: { 'images': ['windows.img', 'linux.img'] } The client will try to delete as many images in cache as available with names matching the list of filenames in the 'images' field. Resquest response structure: { 'cache': [ {'name': 'windows.img', 'size': 2432370213, checksum: '5d4dcc677bc19f40a647d0002f4ade90'}, {'name': 'linux.img', 'size': 243234534213, checksum: '3eb22f888f88a55ad954f55644e1192e'} ] }
Diffstat (limited to 'src/restRequest.py')
-rw-r--r--src/restRequest.py7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/restRequest.py b/src/restRequest.py
index 8128b08..fdfe633 100644
--- a/src/restRequest.py
+++ b/src/restRequest.py
@@ -37,6 +37,7 @@ class restRequest:
self.code = None
self.seq = None
self.backup = None
+ self.images = None
def parser(self,data):
self.request_line, self.headers_alone = data.split('\n', 1)
@@ -75,6 +76,9 @@ class restRequest:
except:
pass
+ if "images" in json_param:
+ self.images = json_param["images"]
+
if "disk" in json_param:
self.disk = json_param["disk"]
@@ -114,6 +118,9 @@ class restRequest:
def get_method(self):
return self.method
+ def getImages(self):
+ return self.images
+
def get_uri(self):
return self.URI