变更资源的资源分组
更新时间:2024-03-11
描述
- 本接口用于修改资源与资源分组的绑定关系
请求
请求结构
POST /v1/res/resource/move?force={force}
请求头域
除公共头域外,无其它特殊头域。
请求参数
参数名称 | 类型 | 是否必需 | 参数位置 | 描述 |
---|---|---|---|---|
force | boolean | 是 | query | 是否强制绑定 |
resRequest | List<OpenMoveResRequest> | 是 | body | 资源绑定请求 |
返回
返回头域
除公共头域,无其它特殊头域。
返回参数
参数名称 | 类型 | 是否必需 | 描述 |
---|---|---|---|
response | BindResourceResponse | 是 | 当请求参数中force为true的时候,一定可以成功;当请求参数force为false的时候,根据情况会出现无法绑定的情况,此时会把约束返回。 |
示例
请求示例
POST /v1/res/resource/move?force=false HTTP/1.1
Host: resourcemanager.baidubce.com
content-type: application/json
Authorization: bce-auth-v1/04795b2a1d12490bbee94511b7b78d7e/2016-11-11T10:34:26Z/1800/host/9e5619677b3a461f5b95d061b88823634e8bbc0e6b46e5b3cecbb75f21906a3d
Content-Length: 20
{
"moveResModels":[
{
"oldGroupResInfo":{
"resourceId":"i-xMfbkAtv",
"resourceType":"BCC",
"resourceRegion":"su",
"groupId":"RESG-nAry9duMxag"
},
"targetGroupId":"RESG-Ezv4wdoAhaP"
}, {
"oldGroupResInfo":{
"resourceId":"v-c0rYs8uE",
"resourceType":"CDS",
"resourceRegion":"su",
"groupId":"RESG-nAry9duMxag"
},
"targetGroupId":"RESG-Ezv4wdoAhaP"
}
]}
返回示例
HTTP/1.1 200 OK
Content-Type: application/json;charset=UTF-8
X-Bce-Request-Id: 8d51a788-e79d-4ced-a9e0-0662ec85b7f7
Server: BWS
{
"status": "todo",
"resGroups": [
{
"name": "BCC资源名称",
"type": "BCC",
"region": "su",
"id": "i-xMfbkAtv",
"uuid": "xxxxxxxx-yyyy-zzzz-mmmm-nnnnnnnnnnnn",
"authId": "",
"summary": "",
"url": "https://console.bce.baidu.com/bcc/#/bcc/instance/detail?instanceId=xxxxxxxx-yyyy-zzzz-mmmm-nnnnnnnnnnnn",
"accountId": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",
"userId": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",
"tags": [],
"groups": [
{
"name": "分组名称",
"extra": "分组备注",
"parentUuid": "",
"groupId": "RESG-Ezv4wdoAhaP",
"accountId": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",
"userId": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",
"createTime": "2021-10-21T08:02:58Z",
"updateTime": "1971-01-01T00:00:00Z"
}
]
},
{
"name": "volume-200jf2hr",
"type": "CDS",
"region": "su",
"id": "v-c0rYs8uE",
"uuid": "xxxxxxxx-yyyy-zzzz-mmmm-nnnnnnnnnnnn",
"authId": "",
"summary": "",
"url": "https://console.bce.baidu.com/bcc/#/bcc/cds/detail?diskId=xxxxxxxx-yyyy-zzzz-mmmm-nnnnnnnnnnnn",
"accountId": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",
"userId": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",
"tags": [],
"groups": [
{
"name": "分组名称",
"extra": "分组备注",
"parentUuid": "",
"groupId": "RESG-Ezv4wdoAhaP",
"accountId": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",
"userId": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",
"createTime": "2021-10-21T08:02:58Z",
"updateTime": "1971-01-01T00:00:00Z"
}
]
}
],
"ancestorGroup": {
"name": "分组名称",
"extra": "分组备注",
"parentUuid": "",
"groupId": "RESG-Ezv4wdoAhaP",
"accountId": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",
"userId": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",
"createTime": "2021-10-21T08:02:58Z",
"updateTime": "1971-01-01T00:00:00Z"
}
}
错误码
错误码 | 错误描述 | HTTP状态码 | 中文解释 |
---|---|---|---|
ArgumentInvalid | Argument is invalid | 400 | 入参资源或分组不存在 |