Облако VMware
Тема интерфейса

Запрос объектов виртуального ЦОД с помощью API

В виртуальном ЦОД размещаются ВМ, шаблоны vApp, образы ISO, Edge Gateway и сети организации. Чтобы получить к ним доступ, необходимо получить список виртуальных ЦОД организации и запросить список объектов нужного виртуального ЦОД.

Запрос списка виртуальных ЦОД

Request

Отправьте GET-запрос на https://{SITE}/api/query?type=orgVdc. URL можно получить в ответе на Запрос объектов организации с помощью API.


curl -k --header "Accept: application/*+json;version={VERSION}" --header "Authorization: Bearer {TOKEN}" --request GET "https://{SITE}/api/query?type=orgVdc"

Response

Сервер вернет список виртуальных ЦОД организации и их ресурсы в JSON-элементах.

{
"otherAttributes": {},
"link": [
{
"otherAttributes": {},
"href": "https://{SITE}/api/query?type=orgVdc&page=1&pageSize=25&format=references",
"id": null,
"type": "application/vnd.vmware.vcloud.query.references+xml",
"name": null,
"rel": "alternate",
"model": null,
"vCloudExtension": []
},
{
"otherAttributes": {},
"href": "https://{SITE}/api/query?type=orgVdc&page=1&pageSize=25&format=references",
"id": null,
"type": "application/vnd.vmware.vcloud.query.references+json",
"name": null,
"rel": "alternate",
"model": null,
"vCloudExtension": []
},
{
"otherAttributes": {},
"href": "https://{SITE}/api/query?type=orgVdc&page=1&pageSize=25&format=idrecords",
"id": null,
"type": "application/vnd.vmware.vcloud.query.idrecords+xml",
"name": null,
"rel": "alternate",
"model": null,
"vCloudExtension": []
},
{
"otherAttributes": {},
"href": "https://{SITE}/api/query?type=orgVdc&page=1&pageSize=25&format=idrecords",
"id": null,
"type": "application/vnd.vmware.vcloud.query.idrecords+json",
"name": null,
"rel": "alternate",
"model": null,
"vCloudExtension": []
}
],
"href": "https://{SITE}/api/query?type=orgVdc&page=1&pageSize=25&format=records",
"type": "application/vnd.vmware.vcloud.query.records+json",
"name": "orgVdc",
"page": 1,
"pageSize": 25,
"total": 1,
"record": [
{
"_type": "QueryResultOrgVdcRecordType",
"link": [],
"metadata": null,
"href": "https://{SITE}/api/vdc/{VDC-ID}",
"id": null,
"type": null,
"otherAttributes": {
"cpuOverheadMhz": "0",
"pvdcHardwareVersion": "19",
"numberOfResourcePools": "-2147483648",
"allocationModel": "2",
"networkPool": "https://{SITE}/api/admin/extension/networkPool/{NP-ID}",
"storageOverheadMB": "0",
"vcName": "******",
"memoryOverheadMB": "67"
},
"name": "vdc-name",
"description": null,
"computeProviderScope": null,
"networkProviderScope": "NPS",
"isEnabled": true,
"cpuAllocationMhz": 120000,
"cpuLimitMhz": 120000,
"cpuUsedMhz": 12000,
"cpuReservedMhz": 12000,
"memoryAllocationMB": 102400,
"memoryLimitMB": 102400,
"memoryUsedMB": 2048,
"memoryReservedMB": 102400,
"storageLimitMB": 204800,
"storageUsedMB": 133120,
"providerVdcName": null,
"providerVdc": null,
"orgName": "org-name",
"orgId": "org-id",
"numberOfVApps": 3,
"numberOfUnmanagedVApps": 2,
"numberOfMedia": 0,
"numberOfDisks": 0,
"numberOfVAppTemplates": 0,
"isBusy": false,
"status": "READY",
"numberOfDatastores": null,
"numberOfStorageProfiles": 1,
"numberOfVMs": 1,
"numberOfRunningVMs": 1,
"networkPoolUniversalId": null,
"numberOfDeployedVApps": 2,
"numberOfDeployedUnmanagedVApps": 1,
"isThinProvisioned": null,
"isFastProvisioned": null,
"isVgpuEnabled": false
}
],
"vCloudExtension": []
}

Запрос JSON-представления виртуального ЦОД

Request

Отправьте GET-запрос на URL виртуального ЦОД.


curl -k --header "Accept: application/*+json;version={VERSION}" --header "Authorization: Bearer {TOKEN}" --request GET "https://{SITE}/api/vdc/{VDC-ID}"

Response

Сервер вернет список объектов виртуального ЦОД.

См.также

Полное описание эндпоинтов, методов и параметров запросов можно посмотреть по ссылке https://{SITE}/docs/.