QueryRole
API Request
URLs
GET zstack/v1/identities/roles
GET zstack/v1/identities/roles/{uuid}
Headers
Authorization: OAuth the-session-uuid
Curl
Sample
curl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X GET http://localhost:8080/zstack/v1/identities/roles?q=name=role-1
curl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X GET http://localhost:8080/zstack/v1/identities/roles/159398ac7d57325daeb62f4abbc5107b
Queryable Fields
You can check all queryable fields and resource names that can be queried across tables by using zstack-cli, entering QueryRole, and pressing the Tab key.
API Response
Sample
Response
{
"inventories": [
{
"uuid": "bc0df9075c8f30cc9150ea9d2030b470",
"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 |
inventories | List | See inventories. | 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 |
#inventories
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 |
state | RoleState | See state. | 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 |
#state
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
QueryRoleAction action = new QueryRoleAction();
action.conditions = asList("name=role-1");
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
QueryRoleAction.Result res = action.call();
Python
SDK
QueryRoleAction action = QueryRoleAction()
action.conditions = ["name=role-1"]
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
QueryRoleAction.Result res = action.call()