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.

HTTP
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

Shell
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

workspace_id

string

Yes

Target workspace ID.

role_id

string

Yes

The role ID of the policy to be updated.

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 caller-generated idempotent request ID.

statements

array of object

Yes

The complete policy statement to save. Empty arrays are saved as empty policies.

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

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

Field

Type

Description

code

string

error code.

msg

string

error message.

data

null

—。

Last updated on