Files
inecs f8d3cbdd59 Initial commit: VMware vSphere API simulator scaffold.
Add the FastAPI app, PostgreSQL migrations, Docker/Helm packaging, API
contracts, docs, client examples, and the unit/integration/compatibility
test suite for local client and tooling labs without a real vCenter.
2026-07-18 04:42:11 +03:00

39 lines
2.0 KiB
Markdown
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
**Language / Язык:** [English](../../domains/tasks.md) | [Русский](tasks.md)
# Tasks
Длительные операции (power, clone, relocate, snapshot, OVF deploy, guest
customize) возвращают CIS-style task id:
[`app/vsphere/domain/tasks.py`](../../../app/vsphere/domain/tasks.py),
[`app/vsphere/rest/tasks.py`](../../../app/vsphere/rest/tasks.py).
## Эндпоинты
| Метод | Путь | Заметки |
|---|---|---|
| GET | `/api/cis/tasks` | Список недавних задач (до 200 последних) |
| GET | `/api/cis/tasks/{task}` | Status, progress, `service`/`operation`, `result`/`error` |
## Паттерн клиента
1. Мутация `POST`/`DELETE` → прочитайте task id из `{ "task": "task-…" }`
(REST) или SOAP MoRef `*_Task`.
2. Опрашивайте `GET /api/cis/tasks/{task}`, пока `status` не станет
`SUCCEEDED` или `FAILED`.
3. В `result` — результат операции (например `{"vm": "vm-104"}` при
create/clone/deploy).
## Основные моменты
- Строки задач коммитятся в `vsphere_tasks` (`id`, `description`, `status`,
`service`, `operation`, `result`, `error`, `completed_at`).
- `progress` синтезируется как `50` во время выполнения и `100` в терминальном
состоянии — дробный progress этот симулятор не моделирует.
- Одно и то же хранилище задач обслуживает и REST `/api/cis/tasks`, и SOAP
task MoRefs, поэтому Terraform apply (SOAP `CreateVM_Task`) и REST-опрос
того же id видят согласованное состояние.
- Длительности симуляции учитывают `SIMULATION_TIME_SCALE`
(больше = быстрее завершение).
См. [Поверхность API](../api-surface.md) и [Эксплуатация](../operations.md).