Update a role¶
Update the role name, description, application policy, and incremental database permissions. The application policy is processed as a complete replacement, and the write must match the current version.
PATCH $CLOUDSIGMA_API_BASE/workspaces/{workspace_id}/iam/roles/{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, confirm that the role still allows modification, and prepare to update based on the current status in the list.
Prepare personal access token and target workspace ID with corresponding permissions for the target workspace. Confirm the current role version and policy schema version.
Request body¶
Replace $WORKSPACE_ID, $ROLE_ID, $CLOUDSIGMA_API_KEY, $SCHEMA_VERSION in the example with actual values.
curl -X PATCH "$CLOUDSIGMA_API_BASE/workspaces/$WORKSPACE_ID/iam/roles/$ROLE_ID" \
-H "X-API-Key: $CLOUDSIGMA_API_KEY" \
-H "X-Workspace-ID: $WORKSPACE_ID" \
-H "Content-Type: application/json" \
-d '{
"request_id": "req-001",
"name": "数据分析师",
"description": "负责查看分析数据",
"expected_lifecycle_version": 1,
"schema_version": "'"$SCHEMA_VERSION"'",
"expected_policy_version": 1
}'
Parameter |
Type |
Required |
Description |
|---|---|---|---|
|
string |
Yes |
Target workspace ID. |
|
string |
Yes |
Target role ID. |
Request body
Field |
Type |
Required |
Description |
|---|---|---|---|
|
string |
Yes |
Character name. Cannot be empty. |
|
string |
No |
Updated character descriptions. Saves as an empty string when omitted. |
|
string |
Yes |
Policy schema version. Cannot be empty. |
|
string |
Yes |
Request ID. Cannot be empty. |
|
integer |
Yes |
Expected role lifecycle version, must be greater than 0. |
|
integer |
Yes |
Expected application policy version. Not less than 1. |
|
integer |
No |
Expected data permission version. Not less than 0. |
|
array of object or null |
No |
Apply policy statements. |
|
string |
No |
Unique identifier for an IAM policy statement. |
|
string |
When the object is provided |
Permission actions. |
|
string |
When the object is provided |
Resource type. |
|
string |
When the object is provided |
Resource scope. Value: |
|
string |
No |
Resource ID. |
|
string |
No |
Summary of conditions. |
|
string |
No |
Action is granted. |
|
string |
No |
Scope of delegation. Values: |
|
boolean |
No |
Whether to allow application permissions to be delegated again. |
|
array of object or null |
No |
Incremental data permission changes. |
|
string |
When the object is provided |
operation. Value: |
|
string |
When the object is provided |
Permission actions. |
|
string |
When the object is provided |
Resource type. Value: |
|
string |
When the object is provided |
Resource ID. |
|
string |
When the object is provided |
MatrixOne permissions. Values: |
|
boolean |
No |
Omit this field or send false. true is currently rejected. |
|
object or null |
No |
Row and column rule processing. |
|
string |
When row_column is provided |
processing mode. Values: |
|
object |
When mode=set |
Draft row and column rules. |
|
array of string or null |
No |
A set of prohibited columns. |
|
array of object or null |
No |
Row filtering rules. |
|
string |
No |
Column name. |
|
string |
No |
Conditional connection relationship. Value: |
|
array of object or null |
No |
SQL expression rules. |
|
string |
No |
Comparison operators. Values: |
|
array of string or null |
No |
List of conditional values. |
|
string |
No |
Value matching type. Values: empty string, |
|
string |
No |
Unique identifier for an IAM policy statement. |
|
string |
Yes |
Permission actions. |
|
string |
Yes |
Resource type. Resource type. Value: |
|
string |
Yes |
Resource scope. Value: |
|
string |
No |
Resource ID. |
|
string |
No |
Summary of conditions. |
|
string |
No |
Action is granted. |
|
string |
No |
Scope of delegation. Values: |
|
boolean |
No |
Whether to allow application permissions to be delegated again. |
|
string |
Yes |
operation. Value: |
|
string |
Yes |
Resource ID. |
|
string |
Yes |
MatrixOne permissions. Values: |
|
boolean |
No |
Omit this field or send false. true is currently rejected. |
|
object or null |
No |
Row and column rule processing. |
|
string |
When row_column is provided |
processing mode. Values: |
|
object |
When mode=set |
Draft row and column rules. |
|
array of string or null |
No |
A set of prohibited columns. |
|
array of object or null |
No |
Row filtering rules. |
|
string |
No |
Column name. |
|
string |
No |
Conditional connection relationship. Value: |
|
array of object or null |
No |
SQL expression rules. |
|
string |
No |
Comparison operators. Values: |
|
array of string or null |
No |
List of conditional values. |
|
string |
No |
Value matching type. Values: empty string, |
|
string |
No |
processing mode. Values: |
|
object |
No |
Draft row and column rules. |
|
array of string or null |
No |
A set of prohibited columns. |
|
array of object or null |
No |
Row filtering rules. |
|
string |
No |
Column name. |
|
string |
No |
Conditional connection relationship. Value: |
|
array of object or null |
No |
SQL expression rules. |
|
string |
No |
Comparison operators. Values: |
|
array of string or null |
No |
List of conditional values. |
|
string |
No |
Value matching type. Values: empty string, |
|
array of string or null |
No |
A set of prohibited columns. |
|
array of object or null |
No |
Row filtering rules. |
|
string |
No |
Column name. |
|
string |
No |
Conditional connection relationship. Value: |
|
array of object or null |
No |
SQL expression rules. |
|
string |
No |
Comparison operators. Values: |
|
array of string or null |
No |
List of conditional values. |
|
string |
No |
Value matching type. Values: empty string, |
|
string |
No |
Column name. |
|
string |
No |
Conditional connection relationship. Value: |
|
array of object or null |
No |
SQL expression rules. |
|
string |
No |
Comparison operators. Values: |
|
array of string or null |
No |
List of conditional values. |
|
string |
No |
Value matching type. Values: empty string, |
|
string |
No |
Comparison operators. Values: |
|
array of string or null |
No |
List of conditional values. |
|
string |
No |
Value matching type. Values: empty string, |
Submit schema_version, request_id, expected_lifecycle_version greater than 0, and expected_policy_version. expected_data_privilege_version cannot be smaller than 0.
statements will replace the entire application policy. Omitting or filling in null or [] will clear the policy. data_privilege_mutations incrementally modifies database permissions. If omitted, the original value is retained.
Changes are implemented in stages, and compensation is attempted when failures occur. When the submission result is unclear, first query the result according to the original request, and do not use a new request to repeat the operation.
Successful response¶
{
"code": "OK",
"msg": "OK",
"data": {
"role_id": "",
"role_version": 0,
"policy_version": 0,
"data_privilege_version": 0,
"session_invalidation_status": "new_connections_only",
"idempotent_replay": false,
"provisioning_state": "pending",
"provisioning_version": 0,
"provisioning_error_code": "",
"request_id": "",
"trace_id": ""
}
}
Field |
Type |
Description |
|---|---|---|
|
string |
Role ID. |
|
integer |
Character version. |
|
integer |
Apply policy version. |
|
integer |
Data permission version. |
|
string |
Session permission update status. Values: |
|
boolean |
Whether it is an idempotent replay of the same request. |
|
string |
Role configuration status. Values: |
|
integer |
Role configuration version. |
|
string |
Role configuration error code. |
|
string |
Request ID. |
|
string |
TraceID。 |
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. |