Remove API key From Console
parent
f6120e361d
commit
3357c9d4b1
|
|
@ -119,6 +119,19 @@ class CL_SET_HOST(BaseModel):
|
||||||
hddtotal: str
|
hddtotal: str
|
||||||
ipadresse: str
|
ipadresse: str
|
||||||
|
|
||||||
|
class CL_GET_CPU(BaseModel):
|
||||||
|
hostname: str
|
||||||
|
cputype: str
|
||||||
|
cpuname: str
|
||||||
|
dbname: str
|
||||||
|
|
||||||
|
class CL_SET_CPU(BaseModel):
|
||||||
|
hostname: str
|
||||||
|
cputype: str
|
||||||
|
ghz: str
|
||||||
|
cpuname: str
|
||||||
|
dbname: str
|
||||||
|
|
||||||
class CL_UPDATE_HOST(BaseModel):
|
class CL_UPDATE_HOST(BaseModel):
|
||||||
hostname: str
|
hostname: str
|
||||||
dbname: str
|
dbname: str
|
||||||
|
|
|
||||||
24
main.py
24
main.py
|
|
@ -94,6 +94,16 @@ async def gethost(get: CL.CL_GET_HOST,api_key: APIKey = Depends(auth.get_api_key
|
||||||
else:
|
else:
|
||||||
return result[0][0]
|
return result[0][0]
|
||||||
|
|
||||||
|
@app.post("/host/get/cpu")
|
||||||
|
async def getcpu(get: CL.CL_GET_CPU,api_key: APIKey = Depends(auth.get_api_key)):
|
||||||
|
result = database(
|
||||||
|
f"SELECT id FROM `{get.dbname}`.cpulist WHERE cpuname = '{get.cpuname} AND cputyp = {get.cputype}')",
|
||||||
|
"", "")
|
||||||
|
if not result:
|
||||||
|
return False
|
||||||
|
else:
|
||||||
|
return result[0][0]
|
||||||
|
|
||||||
@app.post("/host/get/database")
|
@app.post("/host/get/database")
|
||||||
async def getdatabase(get: CL.CL_GET_DATABASE,api_key: APIKey = Depends(auth.get_api_key)):
|
async def getdatabase(get: CL.CL_GET_DATABASE,api_key: APIKey = Depends(auth.get_api_key)):
|
||||||
result = database(f"SELECT Datenbank FROM `Kunden` where `Subnetz` = '{get.ip}'","Stines-GmbH","")
|
result = database(f"SELECT Datenbank FROM `Kunden` where `Subnetz` = '{get.ip}'","Stines-GmbH","")
|
||||||
|
|
@ -113,6 +123,20 @@ async def sethost(get: CL.CL_SET_HOST,api_key: APIKey = Depends(auth.get_api_key
|
||||||
else:
|
else:
|
||||||
return result[0][0]
|
return result[0][0]
|
||||||
|
|
||||||
|
@app.post("/host/set/cpu")
|
||||||
|
async def setcpu(get: CL.CL_SET_CPU,api_key: APIKey = Depends(auth.get_api_key)):
|
||||||
|
database(f"INSERT INTO `{get.dbname}`.cpulist (cpuname,ghz,cputyp) VALUES ('{get.cpuname}','{get.ghz}','{get.cputyp}')","","")
|
||||||
|
result = database(
|
||||||
|
f"SELECT id FROM `{get.dbname}`.cpulist WHERE cpuname = '{get.cpuname} AND cputyp = {get.cputyp}')",
|
||||||
|
"", "")
|
||||||
|
database(
|
||||||
|
f"INSERT INTO `{get.dbname}`.cpu_to_client (hardwareID,cpulistID) VALUES ('{get.hardwareID}','{result[0][0]}',)",
|
||||||
|
"", "")
|
||||||
|
if not result:
|
||||||
|
return False
|
||||||
|
else:
|
||||||
|
return result[0][0]
|
||||||
|
|
||||||
@app.post("/host/update")
|
@app.post("/host/update")
|
||||||
async def updatehost(get: CL.CL_UPDATE_HOST,api_key: APIKey = Depends(auth.get_api_key)):
|
async def updatehost(get: CL.CL_UPDATE_HOST,api_key: APIKey = Depends(auth.get_api_key)):
|
||||||
database(f"UPDATE `{get.dbname}`.hardware SET ipadresse = '{get.ipadresse}', ram = '{get.ram}', hddused = '{get.hddused}' ,hddfree = '{get.hddfree}',hddtotal = '{get.hddtotal}' WHERE hostname = '{get.hostname}'","","")
|
database(f"UPDATE `{get.dbname}`.hardware SET ipadresse = '{get.ipadresse}', ram = '{get.ram}', hddused = '{get.hddused}' ,hddfree = '{get.hddfree}',hddtotal = '{get.hddtotal}' WHERE hostname = '{get.hostname}'","","")
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue