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

47 lines
2.3 KiB
Markdown

**Language / Язык:** [English](inventory.md) | [Русский](../ru/domains/inventory.md)
# Inventory
Datacenter, cluster, folder, resource pool, host, and datastore/network
listing + CRUD:
[`app/vsphere/rest/router.py`](../../app/vsphere/rest/router.py),
[`app/vsphere/domain/inventory_ops.py`](../../app/vsphere/domain/inventory_ops.py).
## Endpoints
| Method | Path | Notes |
|---|---|---|
| GET | `/api/vcenter/datacenter` | List |
| POST/DELETE | `/api/vcenter/datacenter[/{datacenter}]` | Create seeds host/vm/datastore/network sub-folders |
| GET | `/api/vcenter/cluster` | List |
| POST/DELETE | `/api/vcenter/cluster[/{cluster}]` | Create seeds a `ResourcePool` |
| GET | `/api/vcenter/folder` | List; `GET /api/vcenter/folder/{folder}/children` |
| POST/DELETE | `/api/vcenter/folder[/{folder}]` | |
| GET | `/api/vcenter/resource-pool` | List |
| POST/DELETE | `/api/vcenter/resource-pool[/{resource_pool}]` | |
| GET | `/api/vcenter/host[/{host}]` | Connection state, CPU/memory, IP, storage devices, networking |
| POST | `/api/vcenter/host/{host}/maintenance` | Toggle maintenance mode |
| GET | `/api/vcenter/datastore[/{datastore}]` | Type, capacity, free space, accessibility |
| GET | `/api/vcenter/network` | Standard networks + distributed portgroups |
Legacy `/rest/vcenter/*` mirrors most GET paths with a `{ "value": … }`
envelope — see [API surface](../api-surface.md).
## Highlights
- Every inventory object is a row in `vsphere_objects` (MOID, type, name,
`parent_moid`, `props` JSONB) — see
[`app/vsphere/inventory.py`](../../app/vsphere/inventory.py).
- MOID conventions follow real vCenter shapes: `datacenter-NN`,
`domain-cNN` (cluster), `resgroup-NN` (resource pool), `group-vNN`/`group-hNN`/
`group-sNN`/`group-nNN` (VM/host/datastore/network folders), `host-NN`,
`datastore-NN`, `network-NN` / `dvportgroup-NN`.
- `list_hosts`/`list_clusters`/etc. filter live PostgreSQL state; there is no
separate cache to invalidate after a mutation.
- VM listing (`GET /api/vcenter/vm`) supports filters: `names`,
`power_states`, `hosts`, `folders`, `datacenters`, `clusters`,
`resource_pools`, plus `limit`/`cursor` pagination.
See [Seed profiles](../seed-profiles.md) for the default topology shape and
[Virtual machines](vm.md) for VM-specific operations.