Validate application permission policy¶
Checks whether the application permission policy of the specified role can be saved. Existing policies will not be modified. Passing the verification only means that the policy submitted this time meets the current rules.
POST $CLOUDSIGMA_API_BASE/workspaces/{workspace_id}/iam/roles/{role_id}/application-policy:validate
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 the changes to be verified 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 POST "$CLOUDSIGMA_API_BASE/workspaces/$WORKSPACE_ID/iam/roles/$ROLE_ID/application-policy:validate" \
-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 verified. |
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 request ID generated by the caller. |
|
array of object |
Yes |
The policy statement to be verified. An empty array represents an empty strategy. |
|
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": {
"valid": true,
"policy_hash": "sha256:example",
"statement_count": 1,
"request_id": "req-001",
"trace_id": "trace-001"
}
}
Field |
Type |
Description |
|---|---|---|
code |
string |
OK when successful. |
msg |
string |
OK when successful. |
data.valid |
boolean |
Whether the policy passes the verification. |
data.policy_hash |
string |
The hash of the normalized policy. |
data.statement_count |
integer |
Number of policy statements. |
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 |
—。 |