INNER CODE UNIT · Python
list_schedules
bunkeriot/BunkerM · backend/app/agent-api/main.py:368
async def list_schedules(x_api_key: str = Header(...)):
_auth(x_api_key)
with _lock:
data = _load_agents()
return {"jobs": data["jobs"]}
@app.post("/schedules", status_code=201)
async def create_schedule(body: JobCreate, x_api_key: str = Header(...)):
_auth(x_api_key)
_require_activation()
try:
CronTrigger.from_crontab(body.cron)
except Exception:
raise HTTPException(status_code=400, detail="Invalid cron expression")
with _lock:
data = _load_agents()
total = len(data["watchers"]) + len(data["jobs"])