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,33 @@
|
||||
**Language / Язык:** [English](../../examples/python-requests.md) | [Русский](python-requests.md)
|
||||
|
||||
# Python — REST (requests / stdlib)
|
||||
|
||||
Сырой HTTP к REST-шлюзу vSphere без vendor SDK.
|
||||
|
||||
```bash
|
||||
pip install -r examples/python/requirements.txt
|
||||
python examples/python/requests_cookbook.py
|
||||
```
|
||||
|
||||
[`requests_cookbook.py`](../../../examples/python/requests_cookbook.py)
|
||||
демонстрирует общий поток session → create → wait-for-task → power on → wait →
|
||||
power off → delete с помощью `requests`; идентификатор сессии передаётся в
|
||||
заголовке `vmware-api-session-id`.
|
||||
|
||||
Для варианта без внешних зависимостей, только на стандартной библиотеке
|
||||
(`urllib`), см. [`vsphere_rest_smoke.py`](../../../examples/python/vsphere_rest_smoke.py):
|
||||
|
||||
```bash
|
||||
python examples/python/vsphere_rest_smoke.py https://localhost
|
||||
```
|
||||
|
||||
Для комбинированного smoke REST-create + SOAP-`CreateVM_Task` + guest-filesystem
|
||||
см. [`vsphere_lifecycle.py`](../../../examples/python/vsphere_lifecycle.py):
|
||||
|
||||
```bash
|
||||
VSPHERE_BASE=https://localhost python examples/python/vsphere_lifecycle.py
|
||||
```
|
||||
|
||||
Все три скрипта по умолчанию используют `administrator@vsphere.local` / `VMware1!`
|
||||
и отключают проверку TLS только для локального самоподписанного сертификата
|
||||
разработческого шлюза.
|
||||
Reference in New Issue
Block a user