**Language / Язык:** [English](../../domains/content-library.md) | [Русский](content-library.md) # Content library Локальные content libraries, library items, upload/download sessions и OVF deploy: [`app/vsphere/rest/content_rest.py`](../../../app/vsphere/rest/content_rest.py), [`nfc_rest.py`](../../../app/vsphere/rest/nfc_rest.py), [`app/vsphere/domain/content.py`](../../../app/vsphere/domain/content.py). ## Эндпоинты | Метод | Путь | Заметки | |---|---|---| | GET | `/api/content/library` | Список library ids | | POST | `/api/content/local-library` | Создать local library | | GET/POST | `/api/content/library/item` | Список / create items (`?library_id=`) | | POST | `/api/vcenter/ovf/library-item/{item_id}` | Deploy OVF item → новая `VirtualMachine` + task | | POST | `/api/content/library/item/update-session[/{session_id}[/file]]` | Поток push-upload (стиль Ansible/Terraform) | | GET/POST | `/api/content/library/item/download-session[/{session_id}[/file]]` | Поток pull-download | | GET/PUT/POST | `/nfc/{lease}` \| `/nfc/{lease}/files/{filename}` \| `/nfc/{lease}/complete` | Эндпоинты transfer в стиле HttpNfcLease для SOAP import path | ## Основные моменты - Libraries/items живут в `vsphere_libraries` / `vsphere_library_items`; seed создаёт две libraries («Local Content», «Published Templates») с OVF-typed items (`ubuntu-22.04`, `centos-stream-9`, `golden-image`). - Update/download sessions живут в PostgreSQL (`vsphere_transfer_sessions`, миграция `012`) и моделируют handshake передачи файлов — не реальное byte-for-byte хранилище OVF/VMDK. Строки HttpNfcLease — в `vsphere_nfc_leases`. - `deploy_ovf_from_library` создаёт реальную строку `VirtualMachine` и возвращает task id, зеркаля SOAP-поток `ImportVApp_Task` / `CreateImportSpec` + `HttpNfcLease*`, используемый govc-style `ovf.import`. - Для create нужны `ContentLibrary.CreateLocalLibrary` / `.AddLibraryItem`, для deploy — `VirtualMachine.Provisioning.DeployTemplate`. Операции HttpNfcLease progress/complete/abort для upload-heavy клиентов — [SOAP / VIM](soap.md).