API请求
URLs
POST zstack/v1/container/management/endpointHeaders
Authorization: OAuth the-session-uuidBody
{
"params": {
"name": "containerEndpoint1",
"description": "This is a container management endpoint",
"managementIp": "192.168.0.1",
"vendor": "VendorName",
"managementPort": 8080,
"containerAccessKeyId": "accessKeyId",
"containerAccessKeySecret": "accessKeySecret"
},
"systemTags": [],
"userTags": []
}说明: 上述示例中systemTags、userTags字段可以省略。列出是为了表示body中可以包含这两个字段。
Curl示例
curl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X POST -d '{"params":{"name":"containerEndpoint1","description":"This is a container management endpoint","managementIp":"192.168.0.1","vendor":"VendorName","managementPort":8080,"containerAccessKeyId":"accessKeyId","containerAccessKeySecret":"accessKeySecret"}}' \
http://localhost:8080/zstack/v1/container/management/endpoint参数列表
| 名字 | 类型 | 位置 | 描述 | 可选值 | 起始版本 |
|---|---|---|---|---|---|
| name | String | body(包含在params结构中) | 资源名称 | 5.3.6 | |
| description (可选) | String | body(包含在params结构中) | 资源的详细描述 | 5.3.6 | |
| managementIp | String | body(包含在params结构中) | 管理IP | 5.3.6 | |
| vendor | String | body(包含在params结构中) | 供应商 | 5.3.6 | |
| managementPort | Integer | body(包含在params结构中) | 管理端口 | 5.3.6 | |
| containerAccessKeyId | String | body(包含在params结构中) | 容器访问密钥ID | 5.3.6 | |
| containerAccessKeySecret | String | body(包含在params结构中) | 容器访问密钥 | 5.3.6 | |
| resourceUuid (可选) | String | body(包含在params结构中) | 资源UUID | 5.3.6 | |
| tagUuids (可选) | List | body(包含在params结构中) | 标签UUID列表 | 5.3.6 | |
| systemTags (可选) | List | body | 系统标签 | 5.3.6 | |
| userTags (可选) | List | body | 用户标签 | 5.3.6 |
API返回
返回示例
{
"inventory": {
"name": "containerEndpoint1",
"description": "This is a container management endpoint",
"managementIp": "192.168.0.1",
"managementPort": 8080,
"vendor": "VendorName"
}
}#error
| 名字 | 类型 | 描述 | 起始版本 |
|---|---|---|---|
| code | String | 错误码号,错误的全局唯一标识,例如SYS.1000, HOST.1001 | 5.3.6 |
| description | String | 错误的概要描述 | 5.3.6 |
| details | String | 错误的详细信息 | 5.3.6 |
| elaboration | String | 保留字段,默认为null | 5.3.6 |
| opaque | LinkedHashMap | 保留字段,默认为null | 5.3.6 |
| cause | ErrorCode | 根错误,引发当前错误的源错误,若无原错误,该字段为null | 5.3.6 |
#inventory
| 名字 | 类型 | 描述 | 起始版本 |
|---|---|---|---|
| uuid | String | 资源的UUID,唯一标示该资源 | 5.3.0 |
| name | String | 资源名称 | 5.3.0 |
| description | String | 资源的详细描述 | 5.3.0 |
| accessKeyId | String | 5.3.0 | |
| managementIp | String | 容器管理节点的IP地址 | 5.3.0 |
| managementPort | Integer | 容器管理节点的端口 | 5.3.0 |
| vendor | String | 容器管理节点的厂商 | 5.3.0 |
| createDate | Timestamp | 创建时间 | 5.3.0 |
| lastOpDate | Timestamp | 最后一次修改时间 | 5.3.0 |
SDK示例
Java
SDK
AddContainerManagementEndpointAction action = new AddContainerManagementEndpointAction();
action.name = "containerEndpoint1";
action.description = "This is a container management endpoint";
action.managementIp = "192.168.0.1";
action.vendor = "VendorName";
action.managementPort = 8080;
action.containerAccessKeyId = "accessKeyId";
action.containerAccessKeySecret = "accessKeySecret";
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
AddContainerManagementEndpointAction.Result res = action.call();Python
SDK
AddContainerManagementEndpointAction action = AddContainerManagementEndpointAction()
action.name = "containerEndpoint1"
action.description = "This is a container management endpoint"
action.managementIp = "192.168.0.1"
action.vendor = "VendorName"
action.managementPort = 8080
action.containerAccessKeyId = "accessKeyId"
action.containerAccessKeySecret = "accessKeySecret"
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
AddContainerManagementEndpointAction.Result res = action.call()