Remove role inheritance¶
Removes the inheritance relationship between the specified role and a direct parent role. After deletion, the role no longer inherits the permissions of the parent role through this relationship.
DELETE $CLOUDSIGMA_API_BASE/workspaces/{workspace_id}/iam/roles/{role_id}/parents/{parent_role_id}
Before you call¶
Configure the CloudSigma regional endpoint and authentication before calling. The endpoint, credentials, workspace, and resource IDs must belong to the same region. First select the role and determine the child role and parent role. Then Query the role inheritance relationship to confirm that there is currently a direct inheritance relationship between the two.
Prepare personal access token and target workspace ID with corresponding permissions for the target workspace.
Request body¶
Replace $WORKSPACE_ID, $ROLE_ID, $PARENT_ROLE_ID, $CLOUDSIGMA_API_KEY in the example with actual values.
curl -X DELETE "$CLOUDSIGMA_API_BASE/workspaces/$WORKSPACE_ID/iam/roles/$ROLE_ID/parents/$PARENT_ROLE_ID" \
-H "X-API-Key: $CLOUDSIGMA_API_KEY" \
-H "X-Workspace-ID: $WORKSPACE_ID" \
-H "Content-Type: application/json" \
-d "{
\"parent_role_id\": \"$PARENT_ROLE_ID\",
\"expected_child_lifecycle_version\": 1,
\"expected_parent_lifecycle_version\": 1,
\"expected_role_graph_version\": \"mo-role-graph-sha256:0000000000000000000000000000000000000000000000000000000000000000\",
\"request_id\": \"req-001\"
}"
Parameter |
Type |
Required |
Description |
|---|---|---|---|
|
string |
Yes |
Target workspace ID. |
|
string |
Yes |
The child role ID whose inheritance is to be removed. |
|
string |
Yes |
Parent role ID, must be the same as parent_role_id in the path. |
Request body
Field |
Type |
Required |
Description |
|---|---|---|---|
|
string |
Yes |
Parent role ID, must be the same as parent_role_id in the path. |
|
integer |
Yes |
The current sub-role life cycle version must be greater than 0. |
|
integer |
Yes |
The current parent role life cycle version must be greater than 0. |
|
string |
Yes |
Current character diagram version. Cannot be empty. |
|
string |
Yes |
The caller-generated idempotent request ID. Cannot be empty. |
Successful response¶
{
"code": "OK",
"msg": "OK",
"data": {
"child_role_id": "role-001",
"parent_role_id": "role-parent",
"role_graph_version": "graph-v2",
"idempotent_replay": false
}
}
Field |
Type |
Description |
|---|---|---|
|
string |
Subrole ID. |
|
string |
Removed parent role ID. |
|
string |
Updated version of the character map. |
|
boolean |
Whether it is an idempotent replay of the same request. |
Error response¶
Normal errors only return code and msg. When core error codes are present, data may contain request_id, trace_id, and core_error_code. Parse results by error response fields.
{
"code": "ErrParamInvalid",
"msg": "请求参数无效"
}
Field |
Type |
Description |
|---|---|---|
code |
string |
error code. |
msg |
string |
error message. |
data |
object |
Only errors carrying core error codes return this object. Other errors are omitted. |
data.request_id |
string |
Current request identifier. |
data.trace_id |
string |
The tracking ID of the current request. |
data.core_error_code |
string |
Core error code. |