Take over ownership of historical computing resources¶
Register workspace ownership for historical computing resources. This operation is for controlled remediation and requires appropriate administrative rights.
POST https://moi.matrixorigin.cn/newmoi/compute-resources/{resource_id}/adopt-legacy-ownership
Preparation before calling¶
First Query the computing resource details confirm that the target is a historical resource that needs to be repaired. Prepare the personal access token, target workspace ID, and compute resource ID that have access to the target workspace.
The example below uses:
$AI_STUDIO_API_KEY: The actual personal access token, passed through theX-API-KeyHeader.$WORKSPACE_ID: Target workspace ID, passed throughX-Workspace-IDHeader.$RESOURCE_ID: ID of the computing resource whose ownership is to be registered.
Request example¶
curl -X POST "https://moi.matrixorigin.cn/newmoi/compute-resources/$RESOURCE_ID/adopt-legacy-ownership" \
-H "X-API-Key: $AI_STUDIO_API_KEY" \
-H "X-Workspace-ID: $WORKSPACE_ID"
Path parameters¶
Parameter |
Type |
Required |
Description |
|---|---|---|---|
|
string |
Yes |
Compute resource ID. |
Successful response¶
Returns 200 and registered ownership information on success.
{
"code": "OK",
"msg": "OK",
"data": {
"workspace_id": "ws-01",
"resource_type": "compute_resource",
"resource_id": "cr-01",
"owner_role_id": "role-owner",
"authorized_role_id": "role-admin",
"status": "active",
"ownership_version": 1,
"idempotent_replay": false
}
}
The response fields are as follows.
Field |
Type |
Description |
|---|---|---|
|
string |
ID of the workspace to which the resource belongs. |
|
string |
Resource type. |
|
string |
Computing resource ID. |
|
string |
Owner role ID. |
|
string |
This authorization role ID. |
|
string |
Ownership record status. |
|
integer |
Ownership version number. |
|
boolean |
Whether the replay is idempotent. |
Error response¶
{
"code": "ADOPT_LEGACY_OWNERSHIP_FAILED",
"msg": "服务器内部错误",
"data": null
}
Common HTTP errors¶
HTTP status code |
error code |
Common causes |
Recommended actions |
|---|---|---|---|
|
— |
Missing or invalid access credentials. |
Check API Key and Workspace Header. |
|
|
The current identity does not have permission to perform historical ownership restoration. |
Contact the administrator to confirm remediation permissions and target resources. |
|
|
The computing resource does not exist or does not belong to the current workspace. |
Check |
|
|
The server failed to register ownership. |
Contact the administrator after recording the request time and error message. |