mirror of
https://gitlab.com/JKANetwork/powerfulcomputermanager.git
synced 2026-02-27 07:23:43 +01:00
GUI version to control all
This commit is contained in:
193
api.py
193
api.py
@@ -1,5 +1,6 @@
|
||||
#!/usr/bin/python3
|
||||
# Build 5
|
||||
BUILD = 12
|
||||
API_VER = 0 #Its beta, API 1 will have password checks enabled
|
||||
##It can be run directly with "waitress-serve --port=3333 api:api"
|
||||
import falcon
|
||||
import random
|
||||
@@ -31,7 +32,7 @@ class getComputerExists(object):
|
||||
UUID = value
|
||||
|
||||
if ComputerName is None:
|
||||
response.media = {'RESULT': '0'}
|
||||
response.media = {'RESULT': 'ERROR'}
|
||||
else:
|
||||
result = sql.select("SELECT COUNT(*) 'RESULT' FROM COMPUTERS WHERE Name='"+ComputerName+"' AND UUID='"+UUID+"'")
|
||||
|
||||
@@ -40,11 +41,14 @@ class getComputerExists(object):
|
||||
sql.insert("UPDATE COMPUTERS SET UUID='"+UUID+"' WHERE Name='"+ComputerName+"'")
|
||||
response.media = {'RESULT': '1'}
|
||||
return
|
||||
elif sql.select("SELECT COUNT(*) 'RESULT' FROM COMPUTERS WHERE Name='"+ComputerName+"'")[0]['RESULT'] != 0:
|
||||
response.media = {'RESULT': 'ERROR'}
|
||||
return
|
||||
if sysopt.addComputers == True:
|
||||
sql.insert("INSERT INTO COMPUTERS (`Name`,`UUID`) VALUES('"+ComputerName+"','"+UUID+"')")
|
||||
response.media = {'RESULT': '1'}
|
||||
else:
|
||||
response.media = {'RESULT': '0'}
|
||||
response.media = {'RESULT': 'ERROR'}
|
||||
else: #Exists
|
||||
response.media = {'RESULT': '1'}
|
||||
|
||||
@@ -93,8 +97,28 @@ class getComputersGrp(object): #List of computers in a group
|
||||
GroupID = value
|
||||
data = sql.select("SELECT * FROM COMPUTERS WHERE ID_C IN (SELECT ID_C FROM COMPUTER_GROUP WHERE ID_G='"+GroupID+"') ORDER BY Name")
|
||||
response.media = data
|
||||
|
||||
class getCook(object): # Get the list of cooks for a computer to implement (Var all=1 for see all of, implemented or not)
|
||||
|
||||
##
|
||||
# getCookAll: Get the list of cooks added at least to one group
|
||||
# /get/cookall?
|
||||
# NoParams
|
||||
##
|
||||
class getCookAll(object):
|
||||
def on_get(self,request, response):
|
||||
logit(request)
|
||||
data = sql.select("SELECT DISTINCT CookName FROM COOKS_IDG ORDER BY CookName ASC") #All cooks
|
||||
response.media = data
|
||||
|
||||
|
||||
##
|
||||
# getCookPend: Get the list of cooks that are pending to deploy to a computer
|
||||
# /get/cookpend?
|
||||
# @param ComputerName/ComputerID -> Computer to deploy it
|
||||
# @param GroupName/GroupID: Groups
|
||||
# @param SeeAll: Send all cooks from this computer
|
||||
# @param UUID: Check UUID validation of this computer (Not implemented yet)
|
||||
##
|
||||
class getCookPend(object): # Get the list of cooks for a computer to implement (Var all=1 for see all of, implemented or not)
|
||||
def on_get(self,request, response):
|
||||
logit(request)
|
||||
ComputerID,GroupID, SeeAll =None, None, None
|
||||
@@ -110,10 +134,10 @@ class getCook(object): # Get the list of cooks for a computer to implement (Var
|
||||
if key == "SeeAll":
|
||||
SeeAll = str(value)
|
||||
|
||||
if ComputerID is None and GroupID is None:
|
||||
response.media = {'ERROR': 'I need a Group or Computer to search'}
|
||||
if ComputerID is None and GroupID is None: # Error of null parameters
|
||||
response.media = {'TEXT': 'I need a Group or Computer to search','RESULT':'ERROR'}
|
||||
elif ComputerID is not None and SeeAll is None:
|
||||
data = sql.select("SELECT * FROM COOKS_IDG WHERE ID_G IN (SELECT ID_G FROM COMPUTER_GROUP WHERE ID_C = '"+ComputerID+"')") #All cooks for this computer
|
||||
data = sql.select("SELECT DISTINCT CookName FROM COOKS_IDG WHERE ID_G IN (SELECT ID_G FROM COMPUTER_GROUP WHERE ID_C = '"+ComputerID+"')") #All cooks for this computer
|
||||
fordelete = []
|
||||
for i in range(len(data)):
|
||||
for key, value in data[i].items(): #Iterate in a dict (json)
|
||||
@@ -127,11 +151,16 @@ class getCook(object): # Get the list of cooks for a computer to implement (Var
|
||||
for x in reversed(fordelete): #Deleting cooks that are implemented in client. Reverse order (Because is an array and index..)
|
||||
data.pop(x)
|
||||
response.media = data
|
||||
else:
|
||||
response.media = sql.select("SELECT * FROM COOKS_IDG WHERE ID_G IN (SELECT ID_G FROM COMPUTER_GROUP WHERE ID_C = '"+ComputerID+"')") #All cooks for this computer
|
||||
else: # SeeAll. Send all cooks
|
||||
response.media = sql.select("SELECT DISTINCT CookName FROM COOKS_IDG WHERE ID_G IN (SELECT ID_G FROM COMPUTER_GROUP WHERE ID_C = '"+ComputerID+"')") #All cooks for this computer
|
||||
|
||||
|
||||
class setCook(object): #Assign Cook to group
|
||||
##
|
||||
# addCookGrp: Assign Cook to group
|
||||
# /add/cookgrp?
|
||||
# @param GroupName/GroupID -> Group to show cooks
|
||||
# @param CookName -> Cook to assign
|
||||
##
|
||||
class addCookGrp(object): #Assign Cook to group
|
||||
def on_get(self, request, response):
|
||||
logit(request)
|
||||
GroupID, CookName = None, None # Initialize
|
||||
@@ -144,12 +173,12 @@ class setCook(object): #Assign Cook to group
|
||||
if key == "GroupID":
|
||||
GroupID = value
|
||||
if GroupID is None or exists is False:
|
||||
response.media = {'ERROR': 'GroupID is not defined or Cook not exists'}
|
||||
response.media = {'TEXT': 'GroupID is not defined or Cook not exists','RESULT':'ERROR'}
|
||||
elif int(sql.select("SELECT COUNT(*) 'COUNT' FROM COOKS_IDG WHERE `ID_G`='"+GroupID+"' AND `CookName`='"+CookName+"'")[0]['COUNT']) > 0:
|
||||
response.media = {'WARNING': 'This union GROUP-CookName exists'}
|
||||
response.media = {'TEXT': 'This union GROUP-CookName exists','RESULT':'0'}
|
||||
else:
|
||||
result = sql.insert("INSERT INTO COOKS_IDG (`ID_G`,`CookName`) VALUES ('"+GroupID+"','"+CookName+"')")
|
||||
response.media = result
|
||||
response.media = {'TEXT': 'OK'}
|
||||
|
||||
class delCookGrp(object): #Delete cook from a group
|
||||
def on_get(self,request,response):
|
||||
@@ -167,9 +196,9 @@ class delCookGrp(object): #Delete cook from a group
|
||||
|
||||
if GroupID is not None and CookName is not None:
|
||||
result = sql.insert("DELETE FROM COOKS_IDG WHERE ID_G='"+GroupID+"' AND CookName='"+CookName+"'")
|
||||
response.media = result
|
||||
#response.media = result
|
||||
else:
|
||||
response.media = {'RESULT': 'Error, no Group, or CookName does\'t exists'}
|
||||
response.media = {'TEXT': 'Error, no Group, or CookName does\'t exists','RESULT':'ERROR'}
|
||||
|
||||
class delEmptyPcsGroup(object): #Delete all computers from a group
|
||||
def on_get(self,request,response):
|
||||
@@ -185,11 +214,15 @@ class delEmptyPcsGroup(object): #Delete all computers from a group
|
||||
result = sql.insert("DELETE FROM COMPUTER_GROUP WHERE ID_G='"+GroupID+"'")
|
||||
response.media = result
|
||||
else:
|
||||
response.media = {'RESULT': 'Error, this group doesn\'t exists'}
|
||||
response.media = {'TEXT': 'Error, this group doesn\'t exists','RESULT':'ERROR'}
|
||||
|
||||
|
||||
|
||||
class getCookGrp(object): # Get cooks from a Group
|
||||
##
|
||||
# getCookGrp: Get cooks from a Group
|
||||
# /get/cookgrp?
|
||||
# @param GroupName/GroupID -> Group to show cooks
|
||||
##
|
||||
class getCookGrp(object):
|
||||
def on_get(self,request,response):
|
||||
logit(request)
|
||||
GroupID = None # Initialize
|
||||
@@ -203,8 +236,13 @@ class getCookGrp(object): # Get cooks from a Group
|
||||
result = sql.select("SELECT * FROM COOKS_IDG WHERE ID_G='"+GroupID+"'")
|
||||
response.media = result
|
||||
else:
|
||||
response.media = {'RESULT': 'Error, no Group selected'}
|
||||
response.media = {'TEXT': 'Error, no Group selected','RESULT':'ERROR'}
|
||||
|
||||
##
|
||||
# getGrpCook: Get groups from a Cook
|
||||
# /get/grpcook?
|
||||
# @param CookName -> Cook to show groups
|
||||
##
|
||||
class getGrpCook(object): # Get Groups of a Cook
|
||||
def on_get(self,request,response):
|
||||
logit(request)
|
||||
@@ -218,7 +256,7 @@ class getGrpCook(object): # Get Groups of a Cook
|
||||
if CookName is not None:
|
||||
response.media = sql.select("SELECT Name FROM GROUPS WHERE ID_G IN (SELECT ID_G FROM COOKS_IDG WHERE CookName='"+CookName+"')")
|
||||
else:
|
||||
response.media = {'RESULT': 'Error, no Cook selected'}
|
||||
response.media = {'TEXT': 'Error, no Cook selected','RESULT':'ERROR'}
|
||||
|
||||
class getStatusCook(object): # Get Status of a Cook (If Brief=1 is sent too, brief status (Completed:X, updated:X..))
|
||||
def on_get(self,request,response):
|
||||
@@ -233,7 +271,7 @@ class getStatusCook(object): # Get Status of a Cook (If Brief=1 is sent too, bri
|
||||
if CookName is not None:
|
||||
response.media = sql.select("SELECT Name, Revision, Error FROM COMPUTERS,COOKS_STATUS WHERE CookName = '"+CookName+"' AND COMPUTERS.ID_C=COOKS_STATUS.ID_C")
|
||||
else:
|
||||
response.media = {'RESULT': 'Error, no Cook selected'}
|
||||
response.media = {'TEXT': 'Error, no Cook selected','RESULT':'ERROR'}
|
||||
|
||||
class getLastRevisionCook(object): # Get Number Revision (Revision=X)
|
||||
def on_get(self,request,response):
|
||||
@@ -250,8 +288,13 @@ class getLastRevisionCook(object): # Get Number Revision (Revision=X)
|
||||
filecook = myfile.read()
|
||||
response.media = {'Revision': str(yaml.safe_load(filecook)['revision'])}
|
||||
else:
|
||||
response.media = {'RESULT': 'Error, no Cook selected'}
|
||||
response.media = {'TEXT': 'Error, no Cook selected','RESULT':'ERROR'}
|
||||
|
||||
##
|
||||
# addComputer: Add a computer in database
|
||||
# /add/computer?
|
||||
# @param ComputerName -> ComputerName to add
|
||||
##
|
||||
class addComputer(object):
|
||||
def on_get(self, request, response):
|
||||
logit(request)
|
||||
@@ -261,7 +304,7 @@ class addComputer(object):
|
||||
ComputerName = value
|
||||
|
||||
if ComputerName is None:
|
||||
response.media = {'RESULT': 'Error, you need a ComputerName to add'}
|
||||
response.media = {'TEXT': 'Error, you need a ComputerName to add','RESULT':'ERROR'}
|
||||
else:
|
||||
result = sql.insert("INSERT INTO COMPUTERS (Name) VALUES ('"+ComputerName+"')")
|
||||
response.media = result
|
||||
@@ -276,7 +319,7 @@ class addGroup(object):
|
||||
|
||||
|
||||
if GroupName is None:
|
||||
response.media = {'RESULT': 'Error, you need a GroupName to add'}
|
||||
response.media = {'TEXT': 'Error, you need a GroupName to add','RESULT':'ERROR'}
|
||||
else:
|
||||
result = sql.insert("INSERT INTO GROUPS (Name) VALUES ('"+GroupName+"')")
|
||||
response.media = result
|
||||
@@ -292,7 +335,7 @@ class delGroup(object): #Delete group
|
||||
GroupID = str(sql.select("SELECT ID_G FROM GROUPS WHERE Name='"+value+"'")[0]['ID_G'])
|
||||
|
||||
if GroupID is None:
|
||||
response.media = {'RESULT': 'Error, you need a GroupName to delete'}
|
||||
response.media = {'TEXT': 'Error, you need a GroupName to delete','RESULT':'ERROR'}
|
||||
else:
|
||||
sql.insert("DELETE FROM COMPUTER_GROUP WHERE ID_G='"+GroupID+"'")
|
||||
sql.insert("DELETE FROM COOKS_IDG WHERE ID_G='"+GroupID+"'")
|
||||
@@ -313,10 +356,10 @@ class updGroup(object): #Delete group
|
||||
if Count == "0":
|
||||
GroupNewName = value
|
||||
else:
|
||||
response.media = {'RESULT': 'Error, New group name exists'}
|
||||
response.media = {'TEXT': 'Error, New group name exists','RESULT':'ERROR'}
|
||||
|
||||
if GroupID is None or GroupNewName is None:
|
||||
response.media = {'RESULT': 'Error, you need a GroupName and new name to update name'}
|
||||
response.media = {'TEXT': 'Error, you need a GroupName and new name to update name','RESULT':'ERROR'}
|
||||
else:
|
||||
result = sql.insert("UPDATE GROUPS SET Name='"+GroupNewName+"' WHERE ID_G='"+GroupID+"'")
|
||||
response.media = result
|
||||
@@ -336,7 +379,7 @@ class addGrpComputer(object): #Add computer to a group (Local)
|
||||
GroupID = value
|
||||
|
||||
if ComputerID is None or GroupID is None:
|
||||
response.media = {'RESULT': 'Error, you need a Name and Group to add'}
|
||||
response.media = {'TEXT': 'Error, you need a Name and Group to add','RESULT':'ERROR'}
|
||||
else:
|
||||
result = sql.insert("INSERT INTO COMPUTER_GROUP (ID_C,ID_G) VALUES ('"+ComputerID+"','"+GroupID+"')")
|
||||
response.media = result
|
||||
@@ -356,7 +399,7 @@ class delGrpComputer(object): #Del computer from a group
|
||||
GroupID = value
|
||||
|
||||
if ComputerID is None or GroupID is None:
|
||||
response.media = {'RESULT': 'Error, you need a Name and Group to add'}
|
||||
response.media = {'TEXT': 'Error, you need a Name and Group to add','RESULT':'ERROR'}
|
||||
else:
|
||||
result = sql.insert("DELETE FROM COMPUTER_GROUP WHERE ID_C='"+ComputerID+"' AND ID_G='"+GroupID+"'")
|
||||
response.media = result
|
||||
@@ -370,10 +413,12 @@ class delComputer(object): #Delete computer
|
||||
if key == "ComputerName":
|
||||
ComputerID = str(sql.select("SELECT ID_C FROM COMPUTERS WHERE Name='"+value+"'")[0]['ID_C'])
|
||||
if key == "ComputerID":
|
||||
ComputerID = value
|
||||
ComputerID = str(sql.select("SELECT ID_C FROM COMPUTERS WHERE ID_C='"+value+"'")[0]['ID_C'])
|
||||
|
||||
if ComputerID is None:
|
||||
response.media = {'RESULT': 'Error, you need a Name/ComputerID to update data'}
|
||||
response.media = {'TEXT': 'Error, you need a Name/ComputerID to update data','RESULT':'ERROR'}
|
||||
elif ComputerID=='':
|
||||
response.media = {'TEXT': 'Error, this Name/ID is not valid','RESULT':'ERROR'}
|
||||
else:
|
||||
sql.insert("DELETE FROM COMPUTER_GROUP WHERE ID_C='"+ComputerID+"'")
|
||||
sql.insert("DELETE FROM COOKS_STATUS WHERE ID_C='"+ComputerID+"'")
|
||||
@@ -390,18 +435,18 @@ class updComputer(object):
|
||||
try:
|
||||
ComputerID = str(sql.select("SELECT ID_C FROM COMPUTERS WHERE Name='"+value+"'")[0]['ID_C'])
|
||||
except:
|
||||
response.media = {'RESULT': 'Error: Computer not exists in database'}
|
||||
response.media = {'TEXT': 'Error: Computer not exists in database','RESULT':'ERROR'}
|
||||
break
|
||||
if key == "ComputerID":
|
||||
ComputerID = value
|
||||
if key == "UUID":
|
||||
UUID = value
|
||||
if ComputerID is None and response.media is None:
|
||||
response.media = {'RESULT': 'Error, you need a ComputerName/ComputerID to update data'}
|
||||
response.media = {'TEXT': 'Error, you need a ComputerName/ComputerID to update data','RESULT':'ERROR'}
|
||||
elif response.media is None and ComputerID is not None and UUID is not None:
|
||||
Count = str(sql.select("SELECT COUNT(*) 'Count' FROM COMPUTERS WHERE UUID='"+UUID+"' AND ID_C='"+ComputerID+"'")[0]['Count'])
|
||||
if Count == "0":
|
||||
response.media = {'RESULT': 'Error, computer doesn\'t exists in database'}
|
||||
response.media = {'TEXT': 'Error, computer doesn\'t exists in database','RESULT':'ERROR'}
|
||||
else:
|
||||
for key, value in request.params.items():
|
||||
if key == "SOVersion":
|
||||
@@ -419,7 +464,12 @@ class updComputer(object):
|
||||
if key == "CPUName":
|
||||
response.media = sql.insert("UPDATE COMPUTERS SET CPUName='"+value+"' WHERE ID_C='"+ComputerID+"'")
|
||||
|
||||
|
||||
##
|
||||
# updCookName: Rename cook name
|
||||
# /upd/cookname?
|
||||
# @param CookName -> Original Cook Name
|
||||
# @param CookNewName -> New Cook Name
|
||||
##
|
||||
class updCookName(object):
|
||||
def on_get(self, request, response):
|
||||
logit(request)
|
||||
@@ -429,16 +479,16 @@ class updCookName(object):
|
||||
if os.path.isfile('cooks/'+value+'.yaml'):
|
||||
CookName= value
|
||||
else:
|
||||
response.media = {'RESULT': 'Error: Cook not exists in folder'}
|
||||
response.media = {'TEXT': 'Error: Cook not exists in folder','RESULT':'ERROR'}
|
||||
break
|
||||
if key == "CookNewName":
|
||||
if os.path.isfile('cooks/'+value+'.yaml'):
|
||||
response.media = {'RESULT': 'Error: There is a cook with the new name in folder!'}
|
||||
response.media = {'TEXT': 'Error: There is a cook with the new name in folder!','RESULT':'ERROR'}
|
||||
break
|
||||
else:
|
||||
CookNewName= value
|
||||
if CookName is None or CookNewName is None:
|
||||
response.media = {'RESULT': 'Error, you need the old and new Cook Name to update data'}
|
||||
response.media = {'TEXT': 'Error, you need the old and new Cook Name to update data','RESULT':'ERROR'}
|
||||
elif response.media is None:
|
||||
old_file = os.path.join("cooks", CookName+'.yaml')
|
||||
new_file = os.path.join("cooks", CookNewName+'.yaml')
|
||||
@@ -456,7 +506,7 @@ class loadCook(object):
|
||||
if os.path.isfile('cooks/'+value+'.yaml'):
|
||||
CookName= value
|
||||
else:
|
||||
response.media = {'RESULT': 'Error: Cook not exists in folder'}
|
||||
response.media = {'TEXT': 'Error: Cook not exists in folder','RESULT':'ERROR'}
|
||||
break
|
||||
if key == "ComputerName":
|
||||
ComputerID = str(sql.select("SELECT ID_C FROM COMPUTERS WHERE Name='"+value+"'")[0]['ID_C'])
|
||||
@@ -466,11 +516,11 @@ class loadCook(object):
|
||||
UUID = value
|
||||
|
||||
if CookName is None and response.media is None:
|
||||
response.media = {'RESULT': 'Error, you need a CookName to load it'}
|
||||
response.media = {'TEXT': 'Error, you need a CookName to load it','RESULT':'ERROR'}
|
||||
elif response.media is None:
|
||||
Count = str(sql.select("SELECT COUNT(*) 'Count' FROM COMPUTERS WHERE UUID='"+UUID+"' AND ID_C='"+ComputerID+"'")[0]['Count'])
|
||||
if Count == "0":
|
||||
response.media = {'RESULT': 'Error, computer doesn\'t exists in database'}
|
||||
response.media = {'TEXT': 'Error, computer doesn\'t exists in database','RESULT':'ERROR'}
|
||||
else:
|
||||
with open('cooks/'+CookName+'.yaml', 'r') as myfile:
|
||||
data = myfile.read()
|
||||
@@ -485,7 +535,7 @@ class setCookStatus(object):
|
||||
if os.path.isfile('cooks/'+value+'.yaml'): # You have to know that cook exists.
|
||||
CookName= value
|
||||
else:
|
||||
response.media = {'RESULT': 'Error: Cook not exists in folder'}
|
||||
response.media = {'TEXT': 'Error: Cook not exists in folder','RESULT':'ERROR'}
|
||||
break
|
||||
if key == "ComputerName":
|
||||
ComputerID = str(sql.select("SELECT ID_C FROM COMPUTERS WHERE Name='"+value+"'")[0]['ID_C'])
|
||||
@@ -499,7 +549,7 @@ class setCookStatus(object):
|
||||
ErrorDesc = value
|
||||
|
||||
if CookName is None and response.media is None:
|
||||
response.media = {'RESULT': 'Error, you need a CookName to load it'}
|
||||
response.media = {'TEXT': 'Error, you need a CookName to load it','RESULT':'ERROR'}
|
||||
elif response.media is None and CookName is not None and ComputerID is not None and Revision is not None and Error is not None:
|
||||
statt = sql.select("SELECT COUNT(*) 'RESULT' FROM COOKS_STATUS WHERE CookName='"+CookName+"' AND ID_C='"+ComputerID+"'")[0]['RESULT']
|
||||
if statt == 0:
|
||||
@@ -509,33 +559,48 @@ class setCookStatus(object):
|
||||
#UPDATE, NOT NEW
|
||||
response.media = sql.insert("UPDATE COOKS_STATUS SET Revision='"+Revision+"',`Error`='"+Error+"',`ErrorDesc`='"+ErrorDesc+"' WHERE ID_C='"+ComputerID+"' AND CookName='"+CookName+"'")
|
||||
else:
|
||||
response.media = {'RESULT': 'Error in parameters...'}
|
||||
response.media = {'TEXT': 'Error in parameters...','RESULT':'ERROR'}
|
||||
|
||||
logit(response.media)
|
||||
|
||||
|
||||
api = falcon.API()
|
||||
api.add_route('/get/computers', getComputers()) #Get list of computer
|
||||
api.add_route('/get/computerexists', getComputerExists()) #Returns 0 or 1 (name status)
|
||||
api.add_route('/get/groups', getGroups()) #Get groups of a computer (Or list if not args)
|
||||
api.add_route('/get/computersgrp', getComputersGrp()) #Get computers in a group
|
||||
api.add_route('/get/cook', getCook()) #Get cooks from a group
|
||||
api.add_route('/set/cook', setCook()) #Assign cook to group
|
||||
api.add_route('/add/computer', addComputer()) #Add computer
|
||||
api.add_route('/add/group', addGroup()) #Add group to the list of local groups
|
||||
api.add_route('/add/cookgrp', addCookGrp()) #Assign cook to group
|
||||
api.add_route('/add/grpcomputer', addGrpComputer()) #Add computer to a group
|
||||
api.add_route('/del/computer', delComputer()) #Delete computer
|
||||
api.add_route('/del/cookgrp', delCookGrp()) # Deassign cook from a group
|
||||
api.add_route('/del/emptypcsgroup', delEmptyPcsGroup()) # Delete all computers from a group
|
||||
api.add_route('/get/cookgrp', getCookGrp()) # See cooks that have a determinated group
|
||||
api.add_route('/get/grpcook', getGrpCook()) # See groups of a determinated cook
|
||||
api.add_route('/get/statuscook', getStatusCook()) # See status of a cook
|
||||
api.add_route('/get/lastrevisioncook', getLastRevisionCook()) # Returns number of last revision of a cook
|
||||
api.add_route('/add/computer', addComputer()) #Add computer
|
||||
api.add_route('/del/computer', delComputer()) #Delete computer
|
||||
api.add_route('/add/group', addGroup()) #Add group to the list of local groups
|
||||
api.add_route('/del/group', delGroup()) #Delete group
|
||||
api.add_route('/upd/group', updGroup()) #Update group name
|
||||
api.add_route('/add/grpcomputer', addGrpComputer()) #Add computer to a group
|
||||
api.add_route('/del/grpcomputer', delGrpComputer()) #Delete computer from a group
|
||||
|
||||
api.add_route('/get/computerexists', getComputerExists()) #Returns 0 or 1 (name status)
|
||||
api.add_route('/get/computers', getComputers()) #Get list of computer
|
||||
api.add_route('/get/computersgrp', getComputersGrp()) #Get computers in a group
|
||||
api.add_route('/get/cookall', getCookAll()) #Get all cooks implemented in one group at least
|
||||
api.add_route('/get/cookgrp', getCookGrp()) # See cooks that have a determinated group
|
||||
api.add_route('/get/cookpend', getCookPend()) #Get cooks pending to implement to a computer
|
||||
api.add_route('/get/groups', getGroups()) #Get groups of a computer (Or list if not args)
|
||||
api.add_route('/get/grpcook', getGrpCook()) # See groups of a determinated cook
|
||||
api.add_route('/get/lastrevisioncook', getLastRevisionCook()) # Returns number of last revision of a cook
|
||||
api.add_route('/get/statuscook', getStatusCook()) # See status of a cook
|
||||
api.add_route('/load/cook', loadCook()) # Load a cook (Transfer in json way)
|
||||
api.add_route('/set/cookstatus', setCookStatus()) # Update status of a cook in a computer (OLD)
|
||||
api.add_route('/upd/cookstatus', setCookStatus()) # Update status of a cook in a computer
|
||||
api.add_route('/upd/computer', updComputer()) #Update data of computer
|
||||
api.add_route('/upd/cookname', updCookName()) #Update file name of cook and SQL references to it.
|
||||
api.add_route('/load/cook', loadCook()) # Load a cook (Transfer in json way)
|
||||
api.add_route('/set/cookstatus', setCookStatus()) # Update status of a cook in a computer
|
||||
api.add_route('/upd/group', updGroup()) #Update group name
|
||||
|
||||
|
||||
#api.add_route('/check/password', checkPassword()) #Check admin password
|
||||
#api.add_route('/upd/password', updPassword()) # Update password (Or create it not exists)
|
||||
#api.add_route('/get/password', getPassword()) # Get password (Will be '' if password not exists)
|
||||
|
||||
class getApiVer(object):
|
||||
def on_get(self, request, response):
|
||||
logit(request)
|
||||
response.media = {'API':API_VER}
|
||||
api.add_route('/get/apiver', getApiVer()) # Get API version
|
||||
|
||||
print("Build: "+str(BUILD))
|
||||
print("API Version: "+str(API_VER))
|
||||
|
||||
Reference in New Issue
Block a user