Validate object grants

Checks whether an object’s authorization changes to a role are saveable, without modifying existing authorizations. After passing the verification, you still need to save the changes.

HTTP
POST $CLOUDSIGMA_API_BASE/workspaces/{workspace_id}/iam/permissions/objects/{resource_type}/{resource_id}/roles/{role_id}/grants: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 object and role to be authorized, and Query object permissions and authorization source to confirm the current authorization status. Then Query permission definition, select the currently supported operations and authorization scope.

Prepare personal access token and target workspace ID with corresponding permissions for the target workspace.

Request body

Shell
curl -X POST "$CLOUDSIGMA_API_BASE/workspaces/$WORKSPACE_ID/iam/permissions/objects/$RESOURCE_TYPE/$RESOURCE_ID/roles/$ROLE_ID/grants:validate" \
  -H "X-API-Key: $CLOUDSIGMA_API_KEY" \
  -H "X-Workspace-ID: $WORKSPACE_ID" \
  -H "Content-Type: application/json" \
  -d '{
    "schema_version": "current-schema-version",
    "expected_policy_version": 1,
    "expected_role_lifecycle_version": 1,
    "request_id": "req-001",
    "changes": [
      {
        "remove": false,
        "action_id": "workflow.read"
      }
    ]
  }'

Path parameters

Parameter

Type

Required

Description

workspace_id

string

Yes

Target workspace ID.

resource_type

string

Yes

The resource type of the target object.

resource_id

string

Yes

The resource ID of the target object.

role_id

string

Yes

Role ID to accept authorization changes.

Request body

Parameter

Type

Required

Description

schema_version

string

Yes

The permission schema version used for this change.

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.

changes

array of object

Yes

The authorization changes to be verified must contain at least one.

changes[].remove

boolean

No

true means remove authorization. Omit or false to add authorization.

changes[].action_id

string

Yes

The operation ID in the permission schema.

changes[].condition_hash

string

No

Only omitted or empty strings are allowed. Conditional expression hashes are not currently accepted.

Omit condition_hash or leave it blank, non-null values will be rejected. Object authorization only supports common application permission operations in the resources range, and does not accept grant.* or OmniFabric data permission operations.

Successful response

JSON
{
  "code": "OK",
  "msg": "OK",
  "data": {
    "workspace_id": "workspace-001",
    "resource_type": "workflow",
    "resource_id": "workflow-001",
    "target_role_id": "role-001",
    "previous_policy_version": 1,
    "policy_version": 1,
    "statement_count": 1,
    "added_count": 1,
    "removed_count": 0,
    "idempotent_replay": false,
    "canonical_policy_hash": "sha256:example",
    "validate_only": true,
    "request_id": "req-001",
    "trace_id": "trace-001"
  }
}

Field

Type

Description

code

string

OK when successful.

msg

string

OK when successful.

data.workspace_id

string

Target workspace ID.

data.resource_type

string

Target resource type.

data.resource_id

string

Target resource ID.

data.target_role_id

string

Role ID to accept authorization changes.

data.previous_policy_version

integer

The policy version before verification.

data.policy_version

integer

The policy version used for verification results. Verification does not increase the version.

data.statement_count

integer

The number of policy statements after the change.

data.added_count

integer

The number of new statements to be added.

data.removed_count

integer

The number of statements to be removed.

data.canonical_policy_hash

string

The hash of the normalized policy.

data.validate_only

boolean

This interface is fixed to true.

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

—。

Common HTTP errors

HTTP status

Error code

Common cause

Recommended action

400

ErrParamInvalid, ErrWorkspaceRequired, ErrIAMExplicitRoleInvalid, ErrIAMScopeInvalid, ErrIAMGrantScopeInvalid, ErrIAMResourcePickerInvalid

Invalid request field, workspace, or operation precondition.

Fix the request parameters and submit again.

401

Unauthorized, ErrUnauthenticated

Missing or invalid authentication credentials.

Check the credential type, expiration, and authentication header.

403

ErrIAMDenied, ErrIAMPolicyDenied, ErrIAMDataPrivilegeDenied, ErrIAMObjectGrantDenied, ErrIAMResourcePickerDenied, ErrForbidden

The current identity or active role does not have permission for this operation.

Use an authorized identity or contact an administrator to grant access.

404

ErrNotFound, ErrIAMResourceNotFound

The target object or required reference was not found.

Verify the object identifier, workspace, and current status.

409

ErrIAMConflict, ErrIAMPolicyConflict, ErrIAMDataPrivilegeConflict, ErrIAMObjectGrantConflict, ErrIAMResourcePickerConflict

Conflict in resource state, request payload, or concurrent modification.

Re-read the current state and version, then handle according to the latest result.

500

ErrServer

Internal processing failed; write operations may have been partially applied.

Retain request and trace details, and verify the current state before retrying.

503

ErrServiceUnavailable, ErrIAMManagementUnavailable, ErrIAMPolicyUnavailable, ErrIAMDataPrivilegeUnavailable, ErrIAMObjectPermissionUnavailable, ErrIAMResourcePickerUnavailable

A business, runtime, or authorization dependency is temporarily unavailable.

After the dependency recovers, check existing results first instead of blindly repeating writes.

Last updated on