确定适配器所需的对象类型后,您可以为对象类型提供参数值以创建适配器实例。您的 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://www.mgmt.cloud.vmware.com/vrops-cloud/suite-api/api/adaptersJSON 格式的请求正文:
{ "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 提供的证书。适配器实例 ID 的值用于开始监控和收集数据。