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.
This commit is contained in:
@@ -0,0 +1,37 @@
|
||||
**Language / Язык:** [English](tasks.md) | [Русский](../ru/domains/tasks.md)
|
||||
|
||||
# Tasks
|
||||
|
||||
Long-running operations (power, clone, relocate, snapshot, OVF deploy, guest
|
||||
customize) return a CIS-style task id:
|
||||
[`app/vsphere/domain/tasks.py`](../../app/vsphere/domain/tasks.py),
|
||||
[`app/vsphere/rest/tasks.py`](../../app/vsphere/rest/tasks.py).
|
||||
|
||||
## Endpoints
|
||||
|
||||
| Method | Path | Notes |
|
||||
|---|---|---|
|
||||
| GET | `/api/cis/tasks` | List recent tasks (most recent 200) |
|
||||
| GET | `/api/cis/tasks/{task}` | Status, progress, `service`/`operation`, `result`/`error` |
|
||||
|
||||
## Client pattern
|
||||
|
||||
1. `POST`/`DELETE` mutation → read the task id from `{ "task": "task-…" }`
|
||||
(REST) or the SOAP `*_Task` MoRef.
|
||||
2. Poll `GET /api/cis/tasks/{task}` until `status` is `SUCCEEDED` or `FAILED`.
|
||||
3. `result` holds operation-specific output (for example `{"vm": "vm-104"}`
|
||||
on create/clone/deploy).
|
||||
|
||||
## Highlights
|
||||
|
||||
- Task rows commit to `vsphere_tasks` (`id`, `description`, `status`,
|
||||
`service`, `operation`, `result`, `error`, `completed_at`).
|
||||
- `progress` is synthesized as `50` while running and `100` once terminal —
|
||||
this simulator does not model fractional progress.
|
||||
- The same task store backs both REST `/api/cis/tasks` and SOAP task MoRefs,
|
||||
so a Terraform apply (SOAP `CreateVM_Task`) and a REST poll of the same id
|
||||
see consistent state.
|
||||
- Simulation durations honour `SIMULATION_TIME_SCALE`
|
||||
(higher = faster simulated completion).
|
||||
|
||||
See [API surface](../api-surface.md) and [Operations](../operations.md).
|
||||
Reference in New Issue
Block a user