識別介面卡所需的物件類型之後,請為物件類型提供參數值以建立介面卡執行個體。您的 POST 要求包含具有所需參數的要求內文。
若要建立介面卡執行個體,VCURL 設定為必填。
必要條件
確認您擁有 vCenter 的 IP 位址和認證。
程序
範例: 介面卡執行個體
此範例會使用下列參數建立 vCenter 的介面卡執行個體:
- 顯示名稱:VC 介面卡執行個體
- 說明:VC 12.345.678.9 的 vCenter 介面卡執行個體
- vCenter Server IP 位址:https://12.345.678.9
- 認證名稱:VC-Credential-1
- 使用者名稱:[email protected]
- 密碼:VC-dummy-passwd
AUTODISCOVERY 和 PROCESSCHANGEEVENTS 為選用,但會包含在內,以在要求內文和回應中顯示資源識別碼的其他範例。
要求標頭:
POST https://operations.example.com/suite-api/api/adapters以 JSON 格式撰寫的要求內文:
{ "name" : "VC Adapter Instance", "description" : "A vCenter Adapter Instance for VC 12.345.678.9", "collectorId" : "1", "adapterKindKey" : "VMWARE", "resourceIdentifiers" : [ { "name" : "AUTODISCOVERY", "value" : "true" }, { "name" : "PROCESSCHANGEEVENTS", "value" : "true" }, { "name" : "VCURL", "value" : "https://12.345.678.9" } ], "credential" : { "id" : null, "name" : "VC-Credential-1", "adapterKindKey" : "VMWARE", "credentialKindKey" : "PRINCIPALCREDENTIAL", "fields" : [ { "name" : "USER", "value" : "[email protected]" }, { "name" : "PASSWORD", "value" : "VC-dummy-passwd" } ], }, }
以 JSON 撰寫回應的程式碼片段:
201 Created
{ "resourceKey": { "name": "VC Adapter Instance", "adapterKindKey": "VMWARE", "resourceKindKey": "VMwareAdapter Instance", "resourceIdentifiers": [ { "identifierType": { "name": "AUTODISCOVERY", "dataType": "STRING", "isPartOfUniqueness": false }, "value": "true" }, { "identifierType": { "name": "DISABLE_COMPUTATION_BASED_ON_CONSUMERS", "dataType": "STRING", "isPartOfUniqueness": false }, "value": "" }, { "identifierType": { "name": "DV_PORT_GROUP_DISABLED", "dataType": "STRING", "isPartOfUniqueness": false }, "value": "" }, { "identifierType": { "name": "DVS_DISABLED", "dataType": "STRING", "isPartOfUniqueness": false }, "value": "" }, { "identifierType": { "name": "PROCESSCHANGEEVENTS", "dataType": "STRING", "isPartOfUniqueness": false }, "value": "true" }, { "identifierType": { "name": "VCURL", "dataType": "STRING", "isPartOfUniqueness": true }, "value": "https://12.345.678.9" }, { "identifierType": { "name": "VM_FOLDER_DISABLED", "dataType": "STRING", "isPartOfUniqueness": false }, "value": "" }, { "identifierType": { "name": "VM_LIMIT", "dataType": "STRING", "isPartOfUniqueness": false }, "value": "" } ] }, "description": "A vCenter Adapter Instance for VC 12.345.678.9", "collectorId": 1, "collectorGroupId": "909c2fbf-2c2c-4957-9a75-21bf2a887d31", "credentialInstanceId": "65081a8d-d462-43b2-b4e0-596eaf3d497e", "monitoringInterval": 5, "adapter-certificates": [ { "thumbprint": "2520fb4351bc91ee7b82ef7cc54a8d88fa893da9", "certificateDetails": "[ Version: V3 Subject: C=US, CN=12.345.678.9 Signature Algorithm: SHA256withRSA, OID = 1.2.840.113549.1.1.11 Key: Sun RSA public key, 2048 bits modulus: ... Validity: [From: Wed Jul 15 19:26:51 UTC 2015, To: Tue Jul 08 11:26:30 UTC 2025] Issuer: O=W12R2UINanduVC, C=US, DC=local, DC=vsphere, CN=CA ... ... ]" } ], ... "id": "a97bd204-e3e5-404b-a219-e2b20cf158d2" }
API 會建立一個新的介面卡,當中包含由內部產生的 UUID,可唯一識別物件。API 回應包括 vCenter 12.345.678.9 提供的憑證。介面卡執行個體識別碼的值,可用於啟動監控和收集資料。