AccessKey Operations
CreateAccessKey
API Request
URLs
POST zstack/v1/accesskeysHeaders
Authorization: OAuth the-session-uuidBody
Note: In
the preceding sample, both systemTags and userTags are optional.
These two fields can be included in the body structure.
{
"params": {
"accountUuid": "db517023502d34ef9309e49674af88d0",
"userUuid": "019f0d7b414b31d98a8de6cab4a8b999"
},
"systemTags": [],
"userTags": []
}
Note: In
the preceding sample, both systemTags and userTags are optional.
These two fields can be included in the body structure.Curl
Sample
curl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X POST -d '{"params":{"accountUuid":"db517023502d34ef9309e49674af88d0","userUuid":"019f0d7b414b31d98a8de6cab4a8b999"}}' http://localhost:8080/zstack/v1/accesskeysRequest Parameters
| Name | Type | Location | Description | Optional Value | Starting Version |
|---|---|---|---|---|---|
| accountUuid | String | body (contained in the params structure) | The account UUID. | 3.2.0 | |
| userUuid | String | body (contained in the params structure) | The user UUID. | 3.2.0 | |
| description | String | body (contained in the params structure) | Optional. The detailed description of the resource. | 3.2.0 | |
| AccessKeyID | String | body (contained in the params structure) | Optional. The generated AccessKey ID. | 3.7.0 | |
| AccessKeySecret | String | body (contained in the params structure) | Optional. The generated AccessKey Secret. | 3.7.0 | |
| resourceUuid | String | body (contained in the params structure) | Optional. | 3.2.0 | |
| systemTags | List | body | Optional. | 3.2.0 | |
| userTags | List | body | Optional. | 3.2.0 |
API Response
Sample
Response
{
"inventory": {
"uuid": "01f82a92a3f83136b3a5fa13b0f1dde6",
"accountUuid": "bc81e5aad7363ebaa904ee81edbfdd1f",
"userUuid": "20e90349268736d7950284d122f64213",
"AccessKeyID": "1234567890abcdedfhij",
"AccessKeySecret": "1234567890abcdedfhij1234567890abcdedfhij",
"state": "Enabled"
}
}#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. | 3.2.0 |
| description | String | The brief description of the error. | 3.2.0 |
| details | String | The details about the error. | 3.2.0 |
| elaboration | String | The reserved field. Default value: null. | 3.2.0 |
| opaque | LinkedHashMap | The reserved field. Default value: null. | 3.2.0 |
| cause | ErrorCode | The root error, which is the associated root cause of the current error. If no root error exists, this parameter is null. | 3.2.0 |
#inventory
| Name | Type | Description | Starting Version |
|---|---|---|---|
| uuid | String | The resource UUID. | 3.2.0 |
| description | String | The detailed description of the resource. | 3.2.0 |
| accountUuid | String | The account UUID. | 3.2.0 |
| userUuid | String | The user UUID. | 3.2.0 |
| AccessKeyID | String | 3.2.0 | |
| AccessKeySecret | String | 3.2.0 | |
| createDate | Timestamp | The creation date. | 3.2.0 |
| lastOpDate | Timestamp | The last operation date. | 3.2.0 |
| state | AccessKeyState | See state. | 3.2.0 |
#state
| Name | Type | Description | Starting Version |
|---|---|---|---|
| name | String | The resource name. | 3.2.0 |
| ordinal | int | 3.2.0 |
SDK Sample
Java
SDK
CreateAccessKeyAction action = new CreateAccessKeyAction();
action.accountUuid = "db517023502d34ef9309e49674af88d0";
action.userUuid = "019f0d7b414b31d98a8de6cab4a8b999";
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
CreateAccessKeyAction.Result res = action.call();Python
SDK
CreateAccessKeyAction action = CreateAccessKeyAction()
action.accountUuid = "db517023502d34ef9309e49674af88d0"
action.userUuid = "019f0d7b414b31d98a8de6cab4a8b999"
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
CreateAccessKeyAction.Result res = action.call()DeleteAccessKey
API Request
URLs
DELETE zstack/v1/accesskeys/{uuid}?deleteMode={deleteMode}Headers
Authorization: OAuth the-session-uuidCurl
Sample
curl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X DELETE http://localhost:8080/zstack/v1/accesskeys/7fcbb0096e3d3e2a8dd4f83610d3dac9?deleteMode=PermissiveRequest Parameters
| Name | Type | Location | Description | Optional Value | Starting Version |
|---|---|---|---|---|---|
| uuid | String | url | The AccessKey UUID. | 3.2.0 | |
| deleteMode | String | url | Optional. The delete mode. | 3.2.0 | |
| systemTags | List | body | Optional. The system tags. | 3.2.0 | |
| userTags | List | body | Optional. The user tags. | 3.2.0 |
API Response
When the API succeeded, an empty JSON structure {} is returned. When the API
failed, the returned JSON structure includes an error field. For
example,
{
"error": {
"code": "SYS.1001",
"description": "A message or a operation timeout",
"details": "Create VM on KVM timeout after 300s"
}
}SDK Sample
Java
SDK
DeleteAccessKeyAction action = new DeleteAccessKeyAction();
action.uuid = "7fcbb0096e3d3e2a8dd4f83610d3dac9";
action.deleteMode = "Permissive";
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
DeleteAccessKeyAction.Result res = action.call();Python
SDK
DeleteAccessKeyAction action = DeleteAccessKeyAction()
action.uuid = "7fcbb0096e3d3e2a8dd4f83610d3dac9"
action.deleteMode = "Permissive"
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
DeleteAccessKeyAction.Result res = action.call()QueryAccessKey
API Request
URLs
GET zstack/v1/accesskeys
GET zstack/v1/accesskeys/{uuid}Headers
Authorization: OAuth the-session-uuidCurl
Sample
curl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X GET http://localhost:8080/zstack/v1/accesskeys?q=uuid=fc008e53779632989bf9393ecf074e25curl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X GET http://localhost:8080/zstack/v1/accesskeys/f99c1aea4a6e35e4a88c6abfe11cce8dQueryable Fields
You can check all queryable fields and resource names that can be queried across tables by using zstack-cli, entering QueryAccessKey, and pressing the Tab key.
API Response
Sample
Response
{
"inventories": [
{
"uuid": "12be3dd32afa3cf2afa4c06037f218b7",
"accountUuid": "324ecf74dd5c3b9a9f2b75edfdbd858f",
"userUuid": "49c0bc4cfa6d3a67930fe4a4cc32248c",
"AccessKeyID": "1234567890abcdedfhij",
"AccessKeySecret": "1234567890abcdedfhij1234567890abcdedfhij",
"state": "Enabled"
}
]
}| Name | Type | Description | Starting Version |
|---|---|---|---|
| error | ErrorCode | The error code. If not null, the operation fails, or vice versa. For more information, see error. | 3.2.0 |
| inventories | List | See inventories. | 3.2.0 |
#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. | 3.2.0 |
| description | String | The brief description of the error. | 3.2.0 |
| details | String | The details about the error. | 3.2.0 |
| elaboration | String | The reserved field. Default value: null. | 3.2.0 |
| opaque | LinkedHashMap | The reserved field. Default value: null. | 3.2.0 |
| cause | ErrorCode | The root error, which is the associated root cause of the current error. If no root error exists, this parameter is null. | 3.2.0 |
#inventories
| Name | Type | Description | Starting Version |
|---|---|---|---|
| uuid | String | The resource UUID. | 3.2.0 |
| description | String | The detailed description of the resource. | 3.2.0 |
| accountUuid | String | The account UUID. | 3.2.0 |
| userUuid | String | The user UUID. | 3.2.0 |
| AccessKeyID | String | 3.2.0 | |
| AccessKeySecret | String | 3.2.0 | |
| createDate | Timestamp | The creation date. | 3.2.0 |
| lastOpDate | Timestamp | The last operation date. | 3.2.0 |
| state | AccessKeyState | See state. | 3.2.0 |
#state
| Name | Type | Description | Starting Version |
|---|---|---|---|
| name | String | The resource name. | 3.2.0 |
| ordinal | int | 3.2.0 |
SDK Sample
Java
SDK
QueryAccessKeyAction action = new QueryAccessKeyAction();
action.conditions = asList("uuid=f0c530f17978349faa8c4736accd0375");
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
QueryAccessKeyAction.Result res = action.call();Python
SDK
QueryAccessKeyAction action = QueryAccessKeyAction()
action.conditions = ["uuid=ee3c98b8528e3fe2aa9d817cd48b1358"]
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
QueryAccessKeyAction.Result res = action.call()ChangeAccessKeyState
API Request
URLs
PUT zstack/v1/accesskeys/{uuid}/actionsHeaders
Authorization: OAuth the-session-uuidBody
Note: In
the preceding sample, both systemTags and userTags are optional.
These two fields can be included in the body structure.
{
"changeAccessKeyState": {
"stateEvent": "disable"
},
"systemTags": [],
"userTags": []
}
Note: In
the preceding sample, both systemTags and userTags are optional.
These two fields can be included in the body structure.Curl
Sample
curl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X PUT -d '{"changeAccessKeyState":{"stateEvent":"disable"}}' http://localhost:8080/zstack/v1/accesskeys/2c9c06fee2513d4b81f1af281ab6bb7b/actionsRequest Parameters
| Name | Type | Location | Description | Optional Value | Starting Version |
|---|---|---|---|---|---|
| uuid | String | url | The AccessKey UUID. | 3.2.0 | |
| stateEvent | String | body (contained in the changeAccessKeyState structure) | Enables or disables the AccessKey. |
|
3.2.0 |
| systemTags | List | body | Optional. The system tags. | 3.2.0 | |
| userTags | List | body | Optional. The user tags. | 3.2.0 |
API Response
Sample
Response
{
"inventory": {
"uuid": "defe79b1a43f35818dc6d3959b571773",
"accountUuid": "d0c06c8d19f439b1b8f481dbdf3e3a3c",
"userUuid": "b622d5d01ef63237878023e93ade5003",
"AccessKeyID": "1234567890abcdedfhij",
"AccessKeySecret": "1234567890abcdedfhij1234567890abcdedfhij",
"state": "Enabled"
}
}#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. | 3.2.0 |
| description | String | The brief description of the error. | 3.2.0 |
| details | String | The details about the error. | 3.2.0 |
| elaboration | String | The reserved field. Default value: null. | 3.2.0 |
| opaque | LinkedHashMap | The reserved field. Default value: null. | 3.2.0 |
| cause | ErrorCode | The root error, which is the associated root cause of the current error. If no root error exists, this parameter is null. | 3.2.0 |
#inventory
| Name | Type | Description | Starting Version |
|---|---|---|---|
| uuid | String | The resource UUID. | 3.2.0 |
| description | String | The detailed description of the resource. | 3.2.0 |
| accountUuid | String | The account UUID. | 3.2.0 |
| userUuid | String | The user UUID. | 3.2.0 |
| AccessKeyID | String | 3.2.0 | |
| AccessKeySecret | String | 3.2.0 | |
| createDate | Timestamp | The creation date. | 3.2.0 |
| lastOpDate | Timestamp | The last operation date. | 3.2.0 |
| state | AccessKeyState | See state. | 3.2.0 |
#state
| Name | Type | Description | Starting Version |
|---|---|---|---|
| name | String | The resource name. | 3.2.0 |
| ordinal | int | 3.2.0 |
SDK Sample
Java
SDK
ChangeAccessKeyStateAction action = new ChangeAccessKeyStateAction();
action.uuid = "2c9c06fee2513d4b81f1af281ab6bb7b";
action.stateEvent = "disable";
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
ChangeAccessKeyStateAction.Result res = action.call();Python
SDK
ChangeAccessKeyStateAction action = ChangeAccessKeyStateAction()
action.uuid = "2c9c06fee2513d4b81f1af281ab6bb7b"
action.stateEvent = "disable"
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
ChangeAccessKeyStateAction.Result res = action.call()