def get_stack_instance( name: str, document_manager: DocumentManager = Depends(get_document_manager)): """Returns a stack instance with a specific name""" logger.info( f"[StackInstancesName GET] Getting document for stack instance '{name}'" ) stack_instance = document_manager.get_stack_instance(name) if not stack_instance: raise HTTPException(status_code=404, detail="Stack instance not found") return stack_instance
def delete_stack_instance( name: str, background_tasks: BackgroundTasks, force: bool = False, document_manager: DocumentManager = Depends(get_document_manager), redis=Depends(get_redis)): """Delete a stack instance with a specific name""" stack_instance = document_manager.get_stack_instance(name) background_tasks.add_task(create_job_for_agent, stack_instance, "delete", document_manager, redis, force_delete=force) return {"result": f"Deleting stack instance {name}"}
def delete_stack_instance( name: str, background_tasks: BackgroundTasks, force: bool = False, document_manager: DocumentManager = Depends(get_document_manager), redis=Depends(get_redis)): """Delete a stack instance with a specific name""" stack_instance = document_manager.get_stack_instance(name) if stack_instance is None: return { "result": f"Stack instance {name} can't be deleted because it does not exist" } else: background_tasks.add_task(create_job_for_agent, stack_instance, "delete", redis, force_delete=force) return {"result": f"Stack instance {name} is being deleted"}