API请求
URLs
PUT zstack/v1/iam2/projects/{uuid}/container/cluster/actionsHeaders
Authorization: OAuth the-session-uuidBody
{
"setIAM2ProjectContainerCluster": {
"containerUuid": "6f3bc8d92c6e395f81f3f2f6876be151",
"clusterId": 1,
"force": false
},
"systemTags": [],
"userTags": []
}上述示例中systemTags、userTags字段可以省略。列出是为了表示body中可以包含这两个字段。
Curl示例
curl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X PUT -d '{"setIAM2ProjectContainerCluster":{"containerUuid":"6f3bc8d92c6e395f81f3f2f6876be151","clusterId":1,"force":false}}' http://localhost:8080/zstack/v1/iam2/projects/e88c25ca2c573b33b22aed1d2d25d005/container/cluster/actions参数列表
| 名字 | 类型 | 位置 | 描述 | 可选值 | 起始版本 |
|---|---|---|---|---|---|
| uuid | String | url | 资源的UUID,唯一标示该资源 | 5.2.1 | |
| containerUuid | String | body(包含在setIAM2ProjectContainerCluster结构中) | 5.2.1 | ||
| clusterId | Long | body(包含在setIAM2ProjectContainerCluster结构中) | 5.2.1 | ||
| force (可选) | Boolean | body(包含在setIAM2ProjectContainerCluster结构中) | 是否强制执行。 | 5.5.22 | |
| systemTags (可选) | List | body | 系统标签 | 5.2.1 | |
| userTags (可选) | List | body | 用户标签 | 5.2.1 |
API返回
该API成功时返回一个空的JSON结构{},出错时返回的JSON结构包含一个error字段,例如:
{
"error": {
"code": "SYS.1001",
"description": "A message or a operation timeout",
"details": "Create VM on KVM timeout after 300s"
}
}SDK示例
Java
SDK
SetIAM2ProjectContainerClusterAction action = new SetIAM2ProjectContainerClusterAction();
action.uuid = "e88c25ca2c573b33b22aed1d2d25d005";
action.containerUuid = "6f3bc8d92c6e395f81f3f2f6876be151";
action.clusterId = 1;
action.force = false;
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
SetIAM2ProjectContainerClusterAction.Result res = action.call();Python
SDK
SetIAM2ProjectContainerClusterAction action = SetIAM2ProjectContainerClusterAction()
action.uuid = "e88c25ca2c573b33b22aed1d2d25d005"
action.containerUuid = "6f3bc8d92c6e395f81f3f2f6876be151"
action.clusterId = 1
action.force = false
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
SetIAM2ProjectContainerClusterAction.Result res = action.call()