Feature description
Queries the list of host information.
Call instructions
Interface constraints
The caller must have the HOST_VIEWER privilege.
Request path
GET /api/v2/compute/hosts
Request parameters
body:
Parameter |
Type |
Required |
Example Value |
Description |
|---|---|---|---|---|
| status | StringArray | No | ONLINE,NEW | The status of the host. Valid values: |
| keyword | String | No | cluster1 | The keyword for host search, which supports fuzzy match. The keyword can match the following information: |
| includedServiceType | StringArray | No | OB_CLUSTER,OB_PROXY | The service type to be included in the host list. Valid values: |
| excludedServiceType | StringArray | No | OB_CLUSTER,OB_PROXY | The service type not to be included in the host list. Valid values: |
| page | Integer | No | 1 | The page number for pagination, which starts from 1. |
| size | Integer | No | 10 | The size of the page for the request data. Default value: 10. Maximum value: 2000. |
| sort | String | No | id,asc | The sorting rule for the request data. |
Response
Basic data structures
Parameter |
Type |
Description |
|---|---|---|
| data | Object | The requested data. |
| ├─ contents | Array | An array of Host objects. For more information, see Host data structure. |
| ├─ page | Object | Paging information. For more information, see page data structure. |
| successful | Boolean | Indicates whether the request was successful. |
| timestamp | Datetime | The timestamp indicating when the server completed the request. |
| duration | Integer | The time taken by the server to process the request, in milliseconds. |
| status | Integer | An HTTP status code that conforms to the HTTP Status specification. |
| traceId | String | The Trace ID of the request, which is used to troubleshoot issues. |
| server | String | The address of the application service that responded to the request. |
Host data structure
Parameter |
Type |
Description |
|---|---|---|
| id | Long | The ID of the host. |
| name | String | The name of the host. |
| alias | String | The alias of the host. |
| description | String | The description of the host. |
| operatingSystem | String | The operating system. |
| operatingSystemRelease | String | The name of the operating system release. |
| architecture | String | The hardware architecture. |
| serialNumber | String | The serial number. |
| innerIpAddress | String | The IP address of the host. |
| sshPort | Integer | The SSH port. |
| kind | String | The host type. Valid values: |
| publishPorts | String | Port mapping. |
| services | ObjectArray | An array of ServiceSummary objects. For more information, see ServiceSummary data structure. |
| status | String | The host status. Valid values: |
| idcId | Long | The ID of the IDC. |
| idcName | String | The name of the IDC. |
| idcDescription | String | The description of the IDC. |
| typeId | Long | The ID of the host type. |
| typeName | String | The name of the host type. |
| typeDescription | String | The description of the host type. |
| regionId | Long | The ID of the region. |
| regionName | String | The name of the region. |
| regionDescription | String | The description of the region. |
| hostAgentId | Long | The ID of OCP Agent. |
| hostAgentVersion | String | The version of OCP Agent. |
| hostAgentStatus | String | The status of OCP Agent. Valid values: |
| createTime | String | The creation time of the host. |
| updateTime | String | The modification time of the host. |
ServiceSummary data structure
Parameter |
Type |
Description |
|---|---|---|
| name | String | The name of the service. |
| version | String | The version of the service. |
| type | String | The type of the service. Valid values: |
| softwarePackageId | Long | The ID of the software package. |
page data structure
Parameter |
Type |
Description |
|---|---|---|
| totalElements | Integer | The total number of records. |
| totalPages | Integer | The total number of pages. |
| number | Integer | The current page number. |
| size | Integer | The size of the current page. |
Example
Request example
GET /api/v2/compute/hosts?page=1&size=10
Response example
{
"data": {
"contents": [
{
"alias": null,
"architecture": "x86_64",
"createTime": "2021-08-10T11:56:16+08:00",
"description": null,
"hostAgentId": 6000001,
"hostAgentStatus": "AVAILABLE",
"hostAgentVersion": "3.1.2-20210812221645",
"id": 3000002,
"idcDescription": null,
"idcId": 1,
"idcName": "bejing1",
"innerIpAddress": "xx.xx.xx.xx",
"kind": "DEDICATED_PHYSICAL_MACHINE",
"name": "OceanBase152105.et15sqa",
"operatingSystem": "4.9.168-018.ali3000.alios7.x86_64",
"operatingSystemRelease": "alios7",
"publishPorts": null,
"regionDescription": null,
"regionId": 1,
"regionName": "beijing",
"serialNumber": null,
"services": [
{
"name": "cluster01:1",
"softwarePackageId": null,
"type": "OB_CLUSTER",
"version": "2.2.76"
}
],
"sshPort": 22,
"status": "ONLINE",
"typeDescription": null,
"typeId": 1,
"typeName": "beijing",
"updateTime": "2021-08-25T15:09:53+08:00"
}
],
"page": {
"number": 1,
"size": 10,
"totalElements": 1,
"totalPages": 1
}
},
"duration": 31,
"server": "a83ad33525",
"status": 200,
"successful": true,
"timestamp": "2021-08-25T17:19:47.311+08:00",
"traceId": "7afbe6e4d7ad403b"
}
