Apply application permission policy¶
Saves the complete app permissions policy for a specified role. Saving replaces the role’s existing app permissions policy. The policy content and role status should be confirmed first.
PUT $CLOUDSIGMA_API_BASE/workspaces/{workspace_id}/iam/roles/{role_id}/application-policy
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 confirm that the role allows policy modification. Then Query permission definition, select the currently supported operations, resource types and authorization scope. Finally Query the role permissions and authorization source, and prepare complete changes based on the current policy status.
Prepare personal access token and target workspace ID with corresponding permissions for the target workspace.
Request parameters¶
curl -X PUT "$CLOUDSIGMA_API_BASE/workspaces/$WORKSPACE_ID/iam/roles/$ROLE_ID/application-policy" \
-H "X-API-Key: $CLOUDSIGMA_API_KEY" \
-H "X-Workspace-ID: $WORKSPACE_ID" \
-H "Content-Type: application/json" \
-d "{
\"schema_version\": \"$SCHEMA_VERSION\",
\"expected_policy_version\": 1,
\"expected_role_lifecycle_version\": 1,
\"request_id\": \"req-001\",
\"statements\": [
{
\"action_id\": \"workflow.read\",
\"resource_type\": \"workflow\",
\"scope_mode\": \"all\"
}
]
}"
Path parameters
Parameter |
Type |
Required |
Description |
|---|---|---|---|
|
string |
Yes |
Target workspace ID. |
|
string |
Yes |
The role ID of the policy to be updated. |
Request body
Parameter |
Type |
Required |
Description |
|---|---|---|---|
|
string |
Yes |
The permission schema version used by this policy. |
|
integer |
No |
The policy version used by concurrency checking. The value cannot be less than 0. |
|
integer |
Yes |
The current role life cycle version must be greater than 0. |
|
string |
Yes |
The caller-generated idempotent request ID. |
|
array of object |
Yes |
The complete policy statement to save. Empty arrays are saved as empty policies. |
|
string |
No |
Statement ID. Generated by the service when omitted. |
|
string |
Yes |
The operation ID in the permission schema. |
|
string |
Yes |
The resource type that matches the operation. |
|
string |
Yes |
Resource scope, can only be all or resources. |
|
string |
No |
The resource ID used when scope_mode is resources. |
|
string |
No |
Condition expressions are not currently supported. Omit this field or send an empty string; nonempty values are rejected. |
|
string |
No |
The target action ID when granting permission. |
|
string |
No |
The sublicensable scope can only be all or resources. |
|
boolean |
No |
Whether to allow continued sublicensing. |
[!IMPORTANT] Usage Restrictions
Sub-authorization is for a limited time,
grant_scope_modecurrently only supportsall(full range), and sub-authorization based on specified resources (resources) is not currently supported.Do not use
resource_idas a replacement for a subgrant target resource. Some database authorization operations do not support delegation. The details are subject to the policy Schema verification rules.
Successful response¶
{
"code": "OK",
"msg": "OK",
"data": {
"role_id": "role-001",
"policy_version": 2,
"idempotent_replay": false,
"request_id": "req-001",
"trace_id": "trace-001"
}
}
Field |
Type |
Description |
|---|---|---|
code |
string |
OK when successful. |
msg |
string |
OK when successful. |
data.role_id |
string |
The role ID of the updated policy. |
data.policy_version |
integer |
The saved policy version. |
data.idempotent_replay |
boolean |
Whether it is an idempotent replay of the same request. |
data.request_id |
string |
Request association ID. |
data.trace_id |
string |
Link tracking ID. |
Error response¶
{
"code": "ErrParamInvalid",
"msg": "请求参数无效",
"data": null
}
Field |
Type |
Description |
|---|---|---|
code |
string |
error code. |
msg |
string |
error message. |
data |
null |
—。 |