Update role lifecycle

Enable or disable specified roles. Changes in role status will affect subsequent role assignments and authorization management.

HTTP
PUT $CLOUDSIGMA_API_BASE/workspaces/{workspace_id}/iam/roles/{role_id}/lifecycle

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 character, confirm that the character allows status adjustment, and prepare for changes based on the current status in the list.

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

Request body

Replace $WORKSPACE_ID, $ROLE_ID, $CLOUDSIGMA_API_KEY in the example with actual values.

Shell
curl -X PUT "$CLOUDSIGMA_API_BASE/workspaces/$WORKSPACE_ID/iam/roles/$ROLE_ID/lifecycle" \
  -H "X-API-Key: $CLOUDSIGMA_API_KEY" \
  -H "X-Workspace-ID: $WORKSPACE_ID" \
  -H "Content-Type: application/json" \
  -d '{
  "request_id": "req-001",
  "target_state": "disabled",
  "reason_code": "temporary_suspension",
  "expected_lifecycle_version": 1
}'

Parameter

Type

Required

Description

workspace_id

string

Yes

Target workspace ID.

role_id

string

Yes

Target role ID.

Request body

Field

Type

Required

Description

target_state

string

Yes

The target state can only be active or disabled. Value: active, disabled.

reason_code

string

Yes

Change reason code. Cannot be empty.

expected_lifecycle_version

integer

Yes

Expected role lifecycle version, must be greater than 0.

request_id

string

Yes

Request ID. Cannot be empty.

Successful response

JSON
{
  "code": "OK",
  "msg": "OK",
  "data": {
    "role": {
      "workspace_id": "workspace-001",
      "role_id": "role-001",
      "role_name": "analyst",
      "description": "数据分析角色",
      "lifecycle_state": "disabled",
      "lifecycle_version": 4,
      "system_role": false
    },
    "idempotent_replay": false
  }
}

Field

Type

Description

data.role

object

Summary of role after status change.

data.role.workspace_id

string

The workspace ID to which it belongs.

data.role.role_id

string

Role ID.

data.role.role_name

string

Character name.

data.role.description

string

Description.

data.role.lifecycle_state

string

Current life cycle status. Values: active, disabled, deleted.

data.role.lifecycle_version

integer

Updated lifecycle version.

data.role.system_role

boolean

Whether it is a system role.

data.idempotent_replay

boolean

Whether it is an idempotent replay of the same request.

Error response

Normal errors only return code and msg. When core error codes are present, data may contain request_id, trace_id, and core_error_code. Parse results by error response fields.

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

Field

Type

Description

code

string

error code.

msg

string

error message.

data

object

Only errors carrying core error codes return this object. Other errors are omitted.

data.request_id

string

Current request identifier.

data.trace_id

string

The tracking ID of the current request.

data.core_error_code

string

Core error code.

Last updated on