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.

HTTP
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

Shell
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

workspace_id

string

Yes

Target workspace ID.

role_id

string

Yes

The role ID of the policy to be verified.

Request body

Parameter

Type

Required

Description

schema_version

string

Yes

The permission schema version used by this policy.

expected_policy_version

integer

No

The policy version used by concurrency checking. The value cannot be less than 0.

expected_role_lifecycle_version

integer

Yes

The current role life cycle version must be greater than 0.

request_id

string

Yes

The request ID generated by the caller.

statements

array of object

Yes

The policy statement to be verified. An empty array represents an empty strategy.

statements[].statement_id

string

No

Statement ID. Generated by the service when omitted.

statements[].action_id

string

Yes

The operation ID in the permission schema.

statements[].resource_type

string

Yes

The resource type that matches the operation.

statements[].scope_mode

string

Yes

Resource scope, can only be all or resources.

statements[].resource_id

string

No

The resource ID used when scope_mode is resources.

statements[].condition_hash

string

No

Condition expressions are not currently supported. Omit this field or send an empty string; nonempty values are rejected.

statements[].target_action_id

string

No

The target action ID when granting permission.

statements[].grant_scope_mode

string

No

The sublicensable scope can only be all or resources.

statements[].grant_delegatable

boolean

No

Whether to allow continued sublicensing.

[!IMPORTANT] Usage Restrictions

  • Sub-authorization is for a limited time, grant_scope_mode currently only supports all (full range), and sub-authorization based on specified resources (resources) is not currently supported.

  • Do not use resource_id as 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

JSON
{
  "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

JSON
{
  "code": "ErrParamInvalid",
  "msg": "请求参数无效",
  "data": null
}

Field

Type

Description

code

string

error code.

msg

string

error message.

data

null

—。

Last updated on