UpdateRole
API Request
URLs
PUT zstack/v1/identities/roles/{uuid}
Headers
Authorization: OAuth the-session-uuid
Body
Note: In
the preceding sample, both systemTags and userTags are optional.
These two fields can be included in the body structure.
{
"updateRole": {
"name": "role-1",
"description": "role for test",
"statements": [
{}
],
"policyUuids": [
"da93f6bf55823973a1bea123d7f5427f"
]
},
"systemTags": [],
"userTags": []
}

Curl
Sample
curl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X PUT -d '{"updateRole":{"name":"role-1","description":"role for test","statements":[{}],"policyUuids":["da93f6bf55823973a1bea123d7f5427f"]}}' http://localhost:8080/zstack/v1/identities/roles/a3489a74f7e23a5682b808b59f4d25c4/actions
Request Parameters
Name | Type | Location | Description | Optional Value | Starting Version |
---|---|---|---|---|---|
uuid | String | url | The resource UUID. | 0.6 | |
name | String | body (contained in the updateRole structure) | The resource name. | 0.6 | |
description | String | body (contained in the updateRole structure) | Optional. The detailed description of the resource. | 0.6 | |
statements | List | body (contained in the updateRole structure) | Optional. The permission statements. | 0.6 | |
policyUuids | List | body (contained in the updateRole structure) | Optional. The permission policy UUIDs. | 0.6 | |
systemTags | List | body | Optional. The system tags. | 0.6 | |
userTags | List | body | Optional. The user tags. | 0.6 |
API Response
Sample
Response
{
"inventory": {
"uuid": "14c577188a0c3ee8871e27087a287bc2",
"name": "role-1",
"description": "role for test",
"type": "Customized",
"state": "Enabled",
"statements": [
"statement for test"
]
}
}
Name | Type | Description | Starting Version |
---|---|---|---|
error | ErrorCode | The error code. If not null, the operation fails, or vice versa. For more information, see error. | 0.6 |
inventory | RoleInventory | See inventory. | 0.6 |
#error
Name | Type | Description | Starting Version |
---|---|---|---|
code | String | The error code, which is a numbered or alphanumeric code that specifies an error. For example, SYS.1000, HOST.1001. | 0.6 |
description | String | The brief description of the error. | 0.6 |
details | String | The details about the error. | 0.6 |
elaboration | String | The reserved field. Default value: null. | 0.6 |
opaque | LinkedHashMap | The reserved field. Default value: null. | 0.6 |
cause | ErrorCode | The root error, which is the associated root cause of the current error. If no root error exists, this parameter is null. | 0.6 |
#inventory
Name | Type | Description | Starting Version |
---|---|---|---|
uuid | String | The resource UUID. | 0.6 |
name | String | The resource name. | 0.6 |
description | String | The detailed description of the resource. | 0.6 |
createDate | Timestamp | The creation date. | 0.6 |
lastOpDate | Timestamp | The last operation date. | 0.6 |
type | RoleType | See type. | 0.6 |
statements | List | See statements. | 0.6 |
#type
Name | Type | Description | Starting Version |
---|---|---|---|
name | String | The resource name. | 0.6 |
ordinal | int | 0.6 |
#statements
Name | Type | Description | Starting Version |
---|---|---|---|
uuid | String | The resource UUID. | 0.6 |
createDate | Timestamp | The creation date. | 0.6 |
lastOpDate | Timestamp | The last operation date. | 0.6 |
statement | PolicyStatement | See statement. | 0.6 |
#statement
Name | Type | Description | Starting Version |
---|---|---|---|
name | String | The resource name. | 0.6 |
principals | List | 0.6 | |
actions | List | 0.6 | |
resources | List | 0.6 | |
effect | StatementEffect | See effect. | 0.6 |
#effect
Name | Type | Description | Starting Version |
---|---|---|---|
name | String | The resource name. | 0.6 |
ordinal | int | 0.6 |
SDK Sample
Java
SDK
UpdateRoleAction action = new UpdateRoleAction();
action.uuid = "a3489a74f7e23a5682b808b59f4d25c4";
action.name = "role-1";
action.description = "role for test";
action.statements = asList([:]);
action.policyUuids = asList("da93f6bf55823973a1bea123d7f5427f");
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
UpdateRoleAction.Result res = action.call();
Python
SDK
UpdateRoleAction action = UpdateRoleAction()
action.uuid = "a3489a74f7e23a5682b808b59f4d25c4"
action.name = "role-1"
action.description = "role for test"
action.statements = [[:]]
action.policyUuids = [da93f6bf55823973a1bea123d7f5427f]
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
UpdateRoleAction.Result res = action.call()