(filename: str, request: WorkflowCopyRequest)
| 307 | |
| 308 | @router.post("/api/workflows/{filename}/copy") |
| 309 | async def copy_workflow_file(filename: str, request: WorkflowCopyRequest): |
| 310 | try: |
| 311 | copy_workflow(filename, request.new_filename, directory=YAML_DIR) |
| 312 | return { |
| 313 | "status": "success", |
| 314 | "source": validate_workflow_filename(filename, require_yaml_extension=True), |
| 315 | "target": validate_workflow_filename(request.new_filename, require_yaml_extension=True), |
| 316 | "message": f"Workflow copied to '{request.new_filename}' successfully", |
| 317 | } |
| 318 | except ValidationError: |
| 319 | raise |
| 320 | except SecurityError: |
| 321 | raise |
| 322 | except ResourceConflictError: |
| 323 | raise |
| 324 | except ResourceNotFoundError: |
| 325 | raise |
| 326 | except Exception as exc: |
| 327 | logger = get_server_logger() |
| 328 | logger.log_exception(exc, f"Unexpected error copying workflow: {filename}") |
| 329 | raise WorkflowExecutionError(f"Failed to copy workflow: {exc}") |
| 330 | |
| 331 | |
| 332 | @router.get("/api/workflows/{filename}/get") |
nothing calls this directly
no test coverage detected