Security Settings Interfaces

Console Proxy Interfaces

RequestConsoleAccess

API Request

URLs
POST zstack/v1/consoles
Headers
Authorization: OAuth the-session-uuid
Body
{
  "params": {
    "vmInstanceUuid": "b95acae48c804003ac3820751b58a50d"
  },
  "systemTags": [],
  "userTags": []
}
Note: In the preceding example, the systemTags and userTags fields are optional. They are listed here to show that the body can contain these two fields.
Curl Example
curl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X POST -d '{"params":{"vmInstanceUuid":"e0442db541833083bd7e411a4d94d969"}}' \
http://localhost:8080/zstack/v1/consoles
Parameter List
Name Type Location Description Allowed Values Starting Version
vmInstanceUuid String body (enclosed in the params structure) Virtual machine UUID 0.6
systemTags (Optional) List body System tags 0.6
userTags (Optional) List body User tags 0.6

API Response

Response Example
{
  "inventory": {
    "scheme": "http",
    "hostname": "127.0.0.1",
    "port": 4900.0,
    "token": "d96caf24fae54c76b7652f548a258261"
  }
}
Name Type Description Starting Version
error ErrorCode Error code. If not null, the operation has failed. This field is null when the operation succeeds. For details, see error 0.6
inventory ConsoleInventory For details, see inventory 0.6
#error
Name Type Description Starting Version
code String Error code number. The globally unique identifier of the error, for example, SYS.1000 or HOST.1001. 0.6
description String Brief description of the error 0.6
details String Detailed information about the error 0.6
elaboration String Reserved field. Default is null. 0.6
opaque LinkedHashMap Reserved field. Default is null. 0.6
cause ErrorCode Root error. The source error that caused the current error. This field is null if no root error exists. 0.6
#inventory
Name Type Description Starting Version
scheme String Access protocol type 0.6
hostname String Host name 0.6
port int Port 0.6
token String Token 0.6

SDK Examples

Java SDK
RequestConsoleAccessAction action = new RequestConsoleAccessAction();
action.vmInstanceUuid = "c8925478e1f840caa1f3919affa19155";
action.sessionId = "f896abb919754292aa8d2f286596142c";
RequestConsoleAccessAction.Result res = action.call();
Python SDK
RequestConsoleAccessAction action = RequestConsoleAccessAction()
action.vmInstanceUuid = "f37c825f87444941bf16261f63c7dbb7"
action.sessionId = "331a21749df940e4b447e9103518890d"
RequestConsoleAccessAction.Result res = action.call()

QueryConsoleProxyAgent

API Request

URLs
GET zstack/v1/consoles/agents
GET zstack/v1/consoles/agents/{uuid}
Headers
Authorization: OAuth the-session-uuid
Curl Example
curl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth 350b72c2d3f24641a767acbcec744b19" \
-X GET http://localhost:8080/zstack/v1/consoles/agents?q=uuid=745b7c17cd224025b3adfef4ae61b3d2
curl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth bb08e240616b482984c397e4517a021c" \
-X GET http://localhost:8080/zstack/v1/consoles/agents/8a3cc2be7e20420db29925e381c598bc

Queryable Fields

Run the CLI command line tool, enter QueryConsoleProxyAgent and press the Tab key to view all queryable fields and cross-table queryable resource names.

API Response

Response Example
{
  "inventories": [
    {
      "uuid": "c77bbc7d3364449e9543d0776a6087de",
      "managementIp": "127.0.0.1",
      "type": "ManagementServerConsoleProxy",
      "state": "Connected"
    }
  ]
}
Name Type Description Starting Version
error ErrorCode Error code. If not null, the operation has failed. This field is null when the operation succeeds. For details, see error 0.6
inventories List For details, see inventories 0.6
#error
Name Type Description Starting Version
code String Error code number. The globally unique identifier of the error, for example, SYS.1000 or HOST.1001. 0.6
description String Brief description of the error 0.6
details String Detailed information about the error 0.6
elaboration String Reserved field. Default is null. 0.6
opaque LinkedHashMap Reserved field. Default is null. 0.6
cause ErrorCode Root error. The source error that caused the current error. This field is null if no root error exists. 0.6
#inventories
Name Type Description Starting Version
uuid String Resource UUID. Uniquely identifies the resource. 0.6
description String Detailed description of the resource 0.6
managementIp String Management node IP 0.6
type String Type 0.6
status String Status (Connected, Disconnected) 0.6
state String State (Enabled, Disabled) 0.6
createDate Timestamp Creation time 0.6
lastOpDate Timestamp Last modification time 0.6

SDK Examples

Java SDK
QueryConsoleProxyAgentAction action = new QueryConsoleProxyAgentAction();
action.conditions = asList("uuid=dfbe49d87cb94d93b69354fa1270012b");
action.sessionId = "e2300cd4f74a457e87f13842aeb8fdef";
QueryConsoleProxyAgentAction.Result res = action.call();
Python SDK
QueryConsoleProxyAgentAction action = QueryConsoleProxyAgentAction()
action.conditions = ["uuid=1e47046946f849ee871de20a2b045750"]
action.sessionId = "1655d7f2e56d4710824cd1082bd5cc94"
QueryConsoleProxyAgentAction.Result res = action.call()

ReconnectConsoleProxyAgent

API Request

URLs
PUT zstack/v1/consoles/agents
Headers
Authorization: OAuth the-session-uuid
Body
{
  "reconnectConsoleProxyAgent": {
    "agentUuids": [
      "ce9f63639c6947fc9de43014a9c42af6",
      "5cf200f8fa6640278ab3751a9e40a122",
      "896f44bd3a2544e3b49a30dbe41303da"
    ]
  },
  "systemTags": [],
  "userTags": []
}
Note: In the preceding example, the systemTags and userTags fields are optional. They are listed here to show that the body can contain these two fields.
Curl Example
curl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X PUT -d '{"reconnectConsoleProxyAgent":{"agentUuids":["9a00b78598253e68914541e6760ddeaa","c18fbd323fbd3902961e4105ec9364d0","96efd32908dd3f71bef8c0f414dbf828"]}}' \
http://localhost:8080/zstack/v1/consoles/agents
Parameter List
Name Type Location Description Allowed Values Starting Version
agentUuids (Optional) List body (enclosed in the params structure) UUIDs of the console proxy agents 0.6
systemTags (Optional) List body System tags 0.6
userTags (Optional) List body User tags 0.6

API Response

Response Example
{
  "inventory": {
    "976e8d54d42841da85eb697f3e8534b6": true,
    "ac4b5e3b69e5499eba381082199b5d42": true
  }
}
Name Type Description Starting Version
inventory Map Console proxy agent inventory 0.6
error ErrorCode Error code. If not null, the operation has failed. This field is null when the operation succeeds. For details, see error 0.6
#error
Name Type Description Starting Version
code String Error code number. The globally unique identifier of the error, for example, SYS.1000 or HOST.1001. 0.6
description String Brief description of the error 0.6
details String Detailed information about the error 0.6
elaboration String Reserved field. Default is null. 0.6
opaque LinkedHashMap Reserved field. Default is null. 0.6
cause ErrorCode Root error. The source error that caused the current error. This field is null if no root error exists. 0.6

SDK Examples

Java SDK
ReconnectConsoleProxyAgentAction action = new ReconnectConsoleProxyAgentAction();
action.agentUuids = asList("9b1d2cae4e75418ba8ca00a7f8d61eee","b3c9068b99664b65851bc29e39c3e336","89ea316d7f114203bb352d22b1f878e2");
action.sessionId = "607aa9478e0f452ab3fe43f0bb44771f";
ReconnectConsoleProxyAgentAction.Result res = action.call();
Python SDK
ReconnectConsoleProxyAgentAction action = ReconnectConsoleProxyAgentAction()
action.agentUuids = [6b5d95576b444661a23454913abce886, 64326c502c4042b196d9602737733d64, 1cc5a9dbb4284fbe850e387788b365ec]
action.sessionId = "dc7db7612de24cb7a3d91d1d08b03162"
ReconnectConsoleProxyAgentAction.Result res = action.call()

AccessKey Management Interfaces

CreateAccessKey

Create Access Key

API Request

URLs
POST zstack/v1/accesskeys
Headers
Authorization: OAuth the-session-uuid
Body
{
  "params": {
    "accountUuid": "db517023502d34ef9309e49674af88d0",
    "accessKeyType": "User"
  },
  "systemTags": [],
  "userTags": []
}
Note: In the preceding example, the systemTags and userTags fields can be omitted. They are shown to indicate that the body can contain these two fields.
Curl Example
curl -H "Content-Type: application/json;charset=UTF-8" -H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" -X POST -d '{"params":{"accountUuid":"db517023502d34ef9309e49674af88d0","accessKeyType":"User"}}' http://localhost:8080/zstack/v1/accesskeys
Parameter List
Name Type Location Description Allowed Values Starting Version
accountUuid String body (included in the params structure) Account UUID 4.0.0
userUuid (Optional) String body (included in the params structure) This value is deprecated 4.0.0
description (Optional) String body (included in the params structure) Detailed resource description 4.0.0
AccessKeyID (Optional) String body (included in the params structure) Specified AccessKeyID 4.0.0
AccessKeySecret (Optional) String body (included in the params structure) Specified AccessKeySecret 4.0.0
resourceUuid (Optional) String body (included in the params structure) Optional. The resource UUID. 4.0.0
systemTags (Optional) List body Optional. The system tags. 4.0.0
userTags (Optional) List body Optional. The user tags. 4.0.0
tagUuids (Optional) List body (included in the params structure) Tag UUID list 4.0.0
accessKeyType (Optional) String body (included in the params structure) Access key type. Valid values are User (user-level) and System (system-level)
  • User
  • System
5.1.0

API Response

Response Example
{
  "inventory": {
    "uuid": "ff03faefe80a396290313fe6d5ae1c00",
    "accountUuid": "ff0b33166633399aae77ea258d2f7900",
    "userUuid": "ff0b33166633399aae77ea258d2f7900",
    "AccessKeyID": "1234567890abcdedfhij",
    "AccessKeySecret": "1234567890abcdedfhij1234567890abcdedfhij",
    "state": "Enabled",
    "type": "User"
  }
}
Name Type Description Starting Version
success boolean Whether the request succeeded 4.0.0
error ErrorCode For details, see error 4.0.0
inventory AccessKeyInventory For details, see inventory 4.0.0
#error
Name Type Description Starting Version
code String Error code, which globally and uniquely identifies the error, for example, SYS.1000 or HOST.1001 0.6
description String Summary description of the error 0.6
details String Details of the error 0.6
elaboration String Reserved field. The default value is null 0.6
opaque LinkedHashMap Reserved field. The default value is null 0.6
cause ErrorCode Root error that caused the current error. This field is null if there is no source error 0.6
#inventory
Name Type Description Starting Version
uuid String Resource UUID, which uniquely identifies the resource 4.0.0
description String Detailed resource description 4.0.0
accountUuid String Account UUID 4.0.0
userUuid String This value is deprecated 4.0.0
AccessKeyID String The AccessKeyID value. 4.0.0
AccessKeySecret String The AccessKeySecret value. 4.0.0
createDate Timestamp Creation time 4.0.0
lastOpDate Timestamp Last modification time 4.0.0
state AccessKeyState For details, see state 4.0.0
#state
Name Type Description Starting Version
name String Resource name 4.0.0
ordinal int The ordinal number. 4.0.0

SDK Examples

Java SDK
CreateAccessKeyAction action = new CreateAccessKeyAction();
action.accountUuid = "db517023502d34ef9309e49674af88d0";
action.accessKeyType = "User";
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
CreateAccessKeyAction.Result res = action.call();
Python SDK
action = CreateAccessKeyAction()
action.accountUuid = "db517023502d34ef9309e49674af88d0"
action.accessKeyType = "User"
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
res = action.call()

DeleteAccessKey

API Request

URLs
DELETE zstack/v1/accesskeys/{uuid}
Headers
Authorization: OAuth the-session-uuid
Curl Example
curl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X DELETE http://localhost:8080/zstack/v1/accesskeys/7fcbb0096e3d3e2a8dd4f83610d3dac9?
Parameter List
Name Type Location Description Allowed Values Starting Version
uuid String url AccessKey UUID. Uniquely identifies the resource. 4.0.0
deleteMode (Optional) String url Optional. The delete mode. 4.0.0
systemTags (Optional) List body Optional. The system tags. 4.0.0
userTags (Optional) List body Optional. The user tags. 4.0.0

API Response

This API returns an empty JSON structure {} on success. On failure, the returned JSON structure contains 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 Examples

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()

UpdateConsoleProxyAgent

API Request

URLs
PUT zstack/v1/consoles/agents/{uuid}/actions
Headers
Authorization: OAuth the-session-uuid
Body
{
  "updateConsoleProxyAgent": {
    "consoleProxyOverriddenIp": "127.0.0.1"
  },
  "systemTags": [],
  "userTags": []
}
Note: In the preceding example, the systemTags and userTags fields are optional. They are listed here to show that the body can contain these two fields.
Curl Example
curl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X PUT -d '{"updateConsoleProxyAgent":{"consoleProxyOverriddenIp":"127.0.0.1"}}' \
http://localhost:8080/zstack/v1/consoles/agents/f616460f24cd330180db4188c3a905b6/actions
Parameter List
Name Type Location Description Allowed Values Starting Version
uuid String url Resource UUID. Uniquely identifies the resource. 2.3
consoleProxyOverriddenIp String body (enclosed in the updateConsoleProxyAgent structure) New console proxy IP 2.3
systemTags (Optional) List body System tags 2.3
userTags (Optional) List body User tags 2.3

API Response

Response Example
{
  "inventory": {}
}
Name Type Description Starting Version
error ErrorCode Error code. If not null, the operation has failed. This field is null when the operation succeeds. For details, see error 2.3
inventory ConsoleProxyAgentInventory For details, see inventory 2.3
#error
Name Type Description Starting Version
code String Error code number. The globally unique identifier of the error, for example, SYS.1000 or HOST.1001. 0.6
description String Brief description of the error 0.6
details String Detailed information about the error 0.6
elaboration String Reserved field. Default is null. 0.6
opaque LinkedHashMap Reserved field. Default is null. 0.6
cause ErrorCode Root error. The source error that caused the current error. This field is null if no root error exists. 0.6
#inventory
Name Type Description Starting Version
uuid String Resource UUID. Uniquely identifies the resource. 0.6
description String Detailed description of the resource 0.6
managementIp String Management node IP 0.6
type String Type 0.6
status String Status (Connected, Disconnected) 0.6
state String State (Enabled, Disabled) 0.6
createDate Timestamp Creation time 0.6
lastOpDate Timestamp Last modification time 0.6

SDK Examples

Java SDK
UpdateConsoleProxyAgentAction action = new UpdateConsoleProxyAgentAction();
action.uuid = "f616460f24cd330180db4188c3a905b6";
action.consoleProxyOverriddenIp = "127.0.0.1";
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
UpdateConsoleProxyAgentAction.Result res = action.call();
Python SDK
UpdateConsoleProxyAgentAction action = UpdateConsoleProxyAgentAction()
action.uuid = "f616460f24cd330180db4188c3a905b6"
action.consoleProxyOverriddenIp = "127.0.0.1"
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
UpdateConsoleProxyAgentAction.Result res = action.call()

QueryAccessKey

API Request

URLs
GET zstack/v1/accesskeys
GET zstack/v1/accesskeys/{uuid}
Headers
Authorization: OAuth the-session-uuid
Curl Example
curl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X GET http://localhost:8080/zstack/v1/accesskeys?q=uuid=fc008e53779632989bf9393ecf074e25
curl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X GET http://localhost:8080/zstack/v1/accesskeys/f99c1aea4a6e35e4a88c6abfe11cce8d

Queryable Fields

Run the CLI tool, enter QueryAccessKey and press Tab to view all queryable fields and cross-table queryable resource names.

API Response

Response Example
{
  "inventories": [
    {
      "uuid": "12be3dd32afa3cf2afa4c06037f218b7",
      "accountUuid": "324ecf74dd5c3b9a9f2b75edfdbd858f",
      "userUuid": "49c0bc4cfa6d3a67930fe4a4cc32248c",
      "AccessKeyID": "1234567890abcdedfhij",
      "AccessKeySecret": "1234567890abcdedfhij1234567890abcdedfhij",
      "state": "Enabled"
    }
  ]
}
Name Type Description Starting Version
success boolean Whether the operation succeeded. 4.0.0
error ErrorCode Error code. If not null, the operation failed. This field is null when the operation succeeds. Seeerror 3.2.0
inventories List Seeinventories 3.2.0
#error
Name Type Description Starting Version
code String Error code number. A globally unique identifier for the error, e.g., SYS.1000, HOST.1001 0.6
description String Brief description of the error 0.6
details String Detailed error information 0.6
elaboration String Reserved field. Defaults to null 0.6
opaque LinkedHashMap Reserved field. Defaults to null 0.6
cause ErrorCode Root error. The source error that caused this error. Null if no root cause exists 0.6
#inventories
Name Type Description Starting Version
uuid String The UUID of the resource. Uniquely identifies the resource 4.0.0
description String Detailed description of the resource 4.0.0
accountUuid String Account UUID 4.0.0
userUuid String This value is deprecated 4.0.0
AccessKeyID String The AccessKeyID value. 4.0.0
AccessKeySecret String The AccessKeySecret value. 4.0.0
createDate Timestamp Creation time 4.0.0
lastOpDate Timestamp Last modification time 4.0.0
state AccessKeyState Seestate 4.0.0
#state
Name Type Description Starting Version
name String Resource name 4.0.0
ordinal int The ordinal number. 4.0.0

SDK Examples

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}/actions
Headers
Authorization: OAuth the-session-uuid
Body
{
  "changeAccessKeyState": {
    "stateEvent": "disable"
  },
  "systemTags": [],
  "userTags": []
}
Note: The systemTags and userTags fields in the above example are optional. They are listed to indicate that the body can contain these two fields.
Curl Example
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/actions
Parameter List
Name Type Location Description Allowed Values Starting Version
uuid String url AccessKey UUID. Uniquely identifies the resource 4.0.0
stateEvent String body (contained in the changeAccessKeyState structure) Enable or disable
  • enable
  • disable
4.0.0
systemTags (optional) List body Optional. The system tags. 4.0.0
userTags (optional) List body Optional. The user tags. 4.0.0

API Response

Response Example
{
  "inventory": {
    "uuid": "defe79b1a43f35818dc6d3959b571773",
    "accountUuid": "d0c06c8d19f439b1b8f481dbdf3e3a3c",
    "userUuid": "b622d5d01ef63237878023e93ade5003",
    "AccessKeyID": "1234567890abcdedfhij",
    "AccessKeySecret": "1234567890abcdedfhij1234567890abcdedfhij",
    "state": "Enabled"
  }
}
Name Type Description Starting Version
success boolean Whether the operation succeeded. 4.0.0
error ErrorCode Error code. If not null, the operation failed. This field is null when the operation succeeds. See error 4.0.0
inventory AccessKeyInventory See inventory 4.0.0
#error
Name Type Description Starting Version
code String Error code number. A globally unique identifier for the error, e.g., SYS.1000, HOST.1001 0.6
description String Brief description of the error 0.6
details String Detailed error information 0.6
elaboration String Reserved field. Defaults to null 0.6
opaque LinkedHashMap Reserved field. Defaults to null 0.6
cause ErrorCode Root error. The source error that caused this error. Null if no root cause exists 0.6
#inventory
Name Type Description Starting Version
uuid String The UUID of the resource. Uniquely identifies the resource 4.0.0
description String Detailed description of the resource 4.0.0
accountUuid String Account UUID 4.0.0
userUuid String User UUID 4.0.0
AccessKeyID String The AccessKeyID value. 4.0.0
AccessKeySecret String The AccessKeySecret value. 4.0.0
createDate Timestamp Creation time 4.0.0
lastOpDate Timestamp Last modification time 4.0.0
state AccessKeyState See state 4.0.0
#state
Name Type Description Starting Version
name String Resource name 4.0.0
ordinal int The ordinal number. 4.0.0

SDK Examples

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()

IP Blocklist/Allowlist

AddAccessControlRule

API Request

URLs
POST zstack/v1/login-control/access-control/rules
Headers
Authorization: OAuth the-session-uuid
Body
{
  "params": {
    "name": "rule1",
    "description": "this is a rule",
    "rule": "172.20.1.1,172.20.1.2",
    "controlStrategy": "ACCEPT"
  },
  "systemTags": [],
  "userTags": []
}
Note: The systemTags and userTags fields in the above example are optional. They are listed to indicate that the body can contain these two fields.
Curl Example
curl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X POST -d '{"params":{"name":"rule1","description":"this is a rule","rule":"172.20.1.1,172.20.1.2","controlStrategy":"ACCEPT"}}' http://localhost:8080/zstack/v1/login-control/access-control/rules
Parameter List
Name Type Location Description Allowed Values Starting Version
name String body (contained in the params structure) Resource name 3.5.1
description (optional) String body (contained in the params structure) Detailed description of the resource 3.5.1
rule String body (contained in the params structure) The rule. 3.5.1
controlStrategy String body (contained in the params structure) The control strategy. 3.5.1
resourceUuid (optional) String body (contained in the params structure) Optional. The resource UUID. 3.5.1
tagUuids (optional) List body (contained in the params structure) Tag UUID list 3.5.1
systemTags (optional) List body Optional. The system tags. 3.5.1
userTags (optional) List body Optional. The user tags. 3.5.1

API Response

On success, this API returns an empty JSON structure {}. On failure, the returned JSON structure contains 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 Examples

Java SDK
AddAccessControlRuleAction action = new AddAccessControlRuleAction();
action.name = "rule1";
action.description = "this is a rule";
action.rule = "172.20.1.1,172.20.1.2";
action.controlStrategy = "ACCEPT";
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
AddAccessControlRuleAction.Result res = action.call();
Python SDK
AddAccessControlRuleAction action = AddAccessControlRuleAction()
action.name = "rule1"
action.description = "this is a rule"
action.rule = "172.20.1.1,172.20.1.2"
action.controlStrategy = "ACCEPT"
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
AddAccessControlRuleAction.Result res = action.call()

DeleteAccessControlRule

API Request

URLs
DELETE zstack/v1/login-control/access-control/rules/{uuid}
Headers
Authorization: OAuth the-session-uuid
Curl Example
curl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X DELETE http://localhost:8080/zstack/v1/login-control/access-control/rules/04baa07ba917360394ec649e26b93593?
Parameter List
Name Type Location Description Allowed Values Starting Version
uuid String url The UUID of the resource. Uniquely identifies the resource 3.5.1
deleteMode (optional) String body Optional. The delete mode. 3.5.1
systemTags (optional) List body Optional. The system tags. 3.5.1
userTags (optional) List body Optional. The user tags. 3.5.1

API Response

On success, this API returns an empty JSON structure {}. On failure, the returned JSON structure contains 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 Examples

Java SDK
DeleteAccessControlRuleAction action = new DeleteAccessControlRuleAction();
action.uuid = "04baa07ba917360394ec649e26b93593";
action.deleteMode = "Permissive";
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
DeleteAccessControlRuleAction.Result res = action.call();
Python SDK
DeleteAccessControlRuleAction action = DeleteAccessControlRuleAction()
action.uuid = "04baa07ba917360394ec649e26b93593"
action.deleteMode = "Permissive"
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
DeleteAccessControlRuleAction.Result res = action.call()

UpdateAccessControlRule

API Request

URLs
PUT zstack/v1/login-control/access-control/rules/{uuid}/actions
Headers
Authorization: OAuth the-session-uuid
Body
{
  "updateAccessControlRule": {
    "name": "rule1",
    "description": "this is a rule"
  },
  "systemTags": [],
  "userTags": []
}
Note: The systemTags and userTags fields in the above example are optional. They are listed to indicate that the body can contain these two fields.
Curl Example
curl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X PUT -d '{"updateAccessControlRule":{"name":"rule1","description":"this is a rule"}}' http://localhost:8080/zstack/v1/login-control/access-control/rules/6bc3181222854438ac8af53f2b57ecf7/actions
Parameter List
Name Type Location Description Allowed Values Starting Version
uuid String url The UUID of the resource. Uniquely identifies the resource 3.5.1
name (optional) String body (contained in the updateAccessControlRule structure) Resource name 3.5.1
description (optional) String body (contained in the updateAccessControlRule structure) Detailed description of the resource 3.5.1
systemTags (optional) List body Optional. The system tags. 3.5.1
userTags (optional) List body Optional. The user tags. 3.5.1

API Response

Response Example
{
  "inventory": {
    "name": "rule",
    "description": "this is rule description",
    "rule": "172.20.1.1",
    "strategy": "ACCEPT",
    "createDate": "Nov 14, 2017 10:20:57 PM",
    "lastOpDate": "Nov 14, 2017 10:20:57 PM"
  }
}
Name Type Description Starting Version
error ErrorCode Error code. If not null, the operation failed. This field is null when the operation succeeds. See error 3.5.1
inventory AccessControlRuleInventory See inventory 3.5.1
#error
Name Type Description Starting Version
code String Error code number. A globally unique identifier for the error, e.g., SYS.1000, HOST.1001 3.5.1
description String Brief description of the error 3.5.1
details String Detailed error information 3.5.1
elaboration String Reserved field. Defaults to null 3.5.1
opaque LinkedHashMap Reserved field. Defaults to null 3.5.1
cause ErrorCode Root error. The source error that caused this error. Null if no root cause exists 3.5.1
#inventory
Name Type Description Starting Version
uuid String The UUID of the resource. Uniquely identifies the resource 3.5.1
name String Resource name 3.5.1
description String Detailed description of the resource 3.5.1
rule String The rule. 3.5.1
createDate Timestamp Creation time 3.5.1
lastOpDate Timestamp Last modification time 3.5.1
strategy ControlStrategy See strategy 3.5.1
#strategy
Name Type Description Starting Version
ACCEPT ControlStrategy The ACCEPT value. 3.5.1
REJECT ControlStrategy The REJECT value. 3.5.1

SDK Examples

Java SDK
UpdateAccessControlRuleAction action = new UpdateAccessControlRuleAction();
action.uuid = "c3fb6843d7b84791bbffb762e35b3065";
action.name = "rule1";
action.description = "this is a rule";
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
UpdateAccessControlRuleAction.Result res = action.call();
Python SDK
UpdateAccessControlRuleAction action = UpdateAccessControlRuleAction()
action.uuid = "4c30b1ea5adf450ebca75f8b8606b964"
action.name = "rule1"
action.description = "this is a rule"
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
UpdateAccessControlRuleAction.Result res = action.call()

QueryAccessControlRule

API Request

URLs
GET zstack/v1/login-control/access-control/rules
Headers
Authorization: OAuth the-session-uuid
Curl Example
curl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X GET http://localhost:8080/zstack/v1/login-control/access-control/rules?q=uuid=4f41ad1c52ac3ba690282ede3d1ebb2a

Queryable Fields

Run the CLI tool, enter QueryAccessControlRule and press Tab to view all queryable fields and cross-table queryable resource names.

API Response

Response Example
{
  "inventories": [
    {
      "rule": "192.168.10.0/24"
    }
  ]
}
Name Type Description Starting Version
error ErrorCode Error code. If not null, the operation failed. This field is null when the operation succeeds. See error 3.5.1
inventories List See inventories 3.5.1
#error
Name Type Description Starting Version
code String Error code number. A globally unique identifier for the error, e.g., SYS.1000, HOST.1001 3.5.1
description String Brief description of the error 3.5.1
details String Detailed error information 3.5.1
elaboration String Reserved field. Defaults to null 3.5.1
opaque LinkedHashMap Reserved field. Defaults to null 3.5.1
cause ErrorCode Root error. The source error that caused this error. Null if no root cause exists 3.5.1
#inventories
Name Type Description Starting Version
uuid String The UUID of the resource. Uniquely identifies the resource 3.5.1
name String Resource name 3.5.1
description String Detailed description of the resource 3.5.1
rule String The rule. 3.5.1
createDate Timestamp Creation time 3.5.1
lastOpDate Timestamp Last modification time 3.5.1
strategy ControlStrategy See strategy 3.5.1
#strategy
Name Type Description Starting Version
ACCEPT ControlStrategy The ACCEPT value. 3.5.1
REJECT ControlStrategy The REJECT value. 3.5.1

SDK Examples

Java SDK
QueryAccessControlRuleAction action = new QueryAccessControlRuleAction();
action.conditions = asList("uuid=b4cae0f6a9ac3cd686ba36c81291d197");
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
QueryAccessControlRuleAction.Result res = action.call();
Python SDK
QueryAccessControlRuleAction action = QueryAccessControlRuleAction()
action.conditions = ["uuid=4b3f7d2f1fda3f1d8089b4d037364bf9"]
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
QueryAccessControlRuleAction.Result res = action.call()

AddAccessControlListRedirectRule

API Request

URLs
POST zstack/v1/access-control-lists/{aclUuid}/redirectRules
Headers
Authorization: OAuth the-session-uuid
Body
{
  "params": {
    "name": "redirect-rule",
    "domain": "zstack.io",
    "url": "/cloud"
  },
  "systemTags": [],
  "userTags": []
}
Note: The systemTags and userTags fields in the above example are optional. They are listed to indicate that the body can contain these two fields.
Curl Example
curl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X POST -d '{"params":{"name":"redirect-rule","domain":"zstack.io","url":"/cloud"}}' \
http://localhost:8080/zstack/v1/access-control-lists/f1ca42b8901833fbac7cbd06e3b4d7cb/redirectRules
Parameter List
Name Type Location Description Allowed Values Starting Version
name (optional) String body (contained in the params structure) Resource name 4.1.3
description (optional) String body (contained in the params structure) Detailed description of the resource 4.1.3
domain (optional) String body (contained in the params structure) Domain name 4.1.3
url (optional) String body (contained in the params structure) url 4.1.3
aclUuid String url Unique identifier of the access control list 4.1.3
resourceUuid (optional) String body (contained in the params structure) Resource UUID 4.1.3
tagUuids (optional) List body (contained in the params structure) Tag UUID list 4.1.3
systemTags (optional) List body System tags 4.1.3
userTags (optional) List body User tags 4.1.3

API Response

Response Example
{
  "inventory": {
    "aclUuid": "3e05577ffa823e759d67e112aa7e5f80",
    "ipEntries": "192.168.48.0/24"
  }
}
Name Type Description Starting Version
success boolean Whether the operation succeeded. 0.6
error ErrorCode Error code. If not null, the operation failed. This field is null when the operation succeeds. See error 3.9
inventory AccessControlListEntryInventory See inventory 3.9
#error
Name Type Description Starting Version
code String Error code number. A globally unique identifier for the error, e.g., SYS.1000, HOST.1001 0.6
description String Brief description of the error 0.6
details String Detailed error information 0.6
elaboration String Reserved field. Defaults to null 0.6
opaque LinkedHashMap Reserved field. Defaults to null 0.6
cause ErrorCode Root error. The source error that caused this error. Null if no root cause exists 0.6
#inventory
Name Type Description Starting Version
uuid String The UUID of the resource. Uniquely identifies the resource 0.6
aclUuid String The acl UUID. 0.6
type String The resource type. 0.6
name String Resource name 0.6
domain String The domain. 0.6
url String The URL. 0.6
ipEntries String The IP entries. 0.6
description String Detailed description of the resource 0.6
createDate Timestamp Creation time 0.6
lastOpDate Timestamp Last modification time 0.6

SDK Examples

Java SDK
AddAccessControlListRedirectRuleAction action = new AddAccessControlListRedirectRuleAction();
action.name = "redirect-rule";
action.domain = "zstack.io";
action.url = "/cloud";
action.aclUuid = "f1ca42b8901833fbac7cbd06e3b4d7cb";
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
AddAccessControlListRedirectRuleAction.Result res = action.call();
Python SDK
AddAccessControlListRedirectRuleAction action = AddAccessControlListRedirectRuleAction()
action.name = "redirect-rule"
action.domain = "zstack.io"
action.url = "/cloud"
action.aclUuid = "f1ca42b8901833fbac7cbd06e3b4d7cb"
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
AddAccessControlListRedirectRuleAction.Result res = action.call()

ChangeAccessControlListRedirectRule

API Request

URLs
PUT zstack/v1/access-control-lists/redirectRules/{uuid}/actions
Body
{
  "changeAccessControlListRedirectRule": {
    "name": "test-access-control"
  },
  "systemTags": [],
  "userTags": []
}
Note: The systemTags and userTags fields in the above example are optional. They are listed to indicate that the body can contain these two fields.
Curl Example
curl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X PUT -d '{"changeAccessControlListRedirectRule":{"name":"test-access-control"}}' \
http://localhost:8080/zstack/v1/access-control-lists/redirectRules/ff0b6fb727353d33817b3714cee15d00/actions
Parameter List
Name Type Location Description Allowed Values Starting Version
uuid String url The UUID of the resource. Uniquely identifies the resource 4.1.3
name (optional) String body (contained in the changeAccessControlListRedirectRule structure) Redirect rule name 4.1.3
systemTags (optional) List body System tags 4.1.3
userTags (optional) List body User tags 4.1.3

API Response

Response Example
{
  "inventory": {
    "aclUuid": "bc9854edd56938f59a7ad06d2ffddb77",
    "type": "RedirectRule",
    "name": "acl-group",
    "domain": "zstack.io",
    "url": "/test"
  }
}
Name Type Description Starting Version
success boolean Whether the operation succeeded. 0.6
error ErrorCode Error code. If not null, the operation failed. This field is null when the operation succeeds. See error 0.6
inventory AccessControlListEntryInventory See inventory 0.6
#error
Name Type Description Starting Version
code String Error code number. A globally unique identifier for the error, e.g., SYS.1000, HOST.1001 0.6
description String Brief description of the error 0.6
details String Detailed error information 0.6
elaboration String Reserved field. Defaults to null 0.6
opaque LinkedHashMap Reserved field. Defaults to null 0.6
cause ErrorCode Root error. The source error that caused this error. Null if no root cause exists 0.6
#inventory
Name Type Description Starting Version
uuid String The UUID of the resource. Uniquely identifies the resource 0.6
aclUuid String The acl UUID. 0.6
type String The resource type. 0.6
name String Resource name 0.6
domain String The domain. 0.6
url String The URL. 0.6
ipEntries String The IP entries. 0.6
description String Detailed description of the resource 0.6
createDate Timestamp Creation time 0.6
lastOpDate Timestamp Last modification time 0.6

SDK Examples

Java SDK
ChangeAccessControlListRedirectRuleAction action = new ChangeAccessControlListRedirectRuleAction();
action.uuid = "ff0b6fb727353d33817b3714cee15d00";
action.name = "test-access-control";
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
ChangeAccessControlListRedirectRuleAction.Result res = action.call();
Python SDK
ChangeAccessControlListRedirectRuleAction action = ChangeAccessControlListRedirectRuleAction()
action.uuid = "ff0b6fb727353d33817b3714cee15d00"
action.name = "test-access-control"
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
ChangeAccessControlListRedirectRuleAction.Result res = action.call()

GetLoginProcedures

Get Login Procedures

API Request

URLs
GET zstack/v1/login/procedures
Curl Example
curl -H "Content-Type: application/json;charset=UTF-8" -X GET http://localhost:8080/zstack/v1/login/procedures?username=admin&loginType=iam1
Parameter List
Name Type Location Description Allowed Values Starting Version
username String query Username 3.16.0
loginType String query Authentication user type 3.16.0
source (Optional) String query Account source, used only to distinguish identically named accounts from different sources (Optional) 5.1.0
systemTags (Optional) List query System tags 3.16.0
userTags (Optional) List query User tags 3.16.0

API Response

When the API succeeds, it returns an empty JSON structure{}. If an error occurs, the returned JSON structure contains 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 Examples

Java SDK
GetLoginProceduresAction action = new GetLoginProceduresAction();
action.username = "admin";
action.loginType = "iam1";
GetLoginProceduresAction.Result res = action.call();
Python SDK
action = GetLoginProceduresAction()
action.username = "admin"
action.loginType = "iam1"
res = action.call()

UnlockIdentity

API Request

URLs
GET zstack/v1/login/control/unlock
Headers
Authorization: OAuth the-session-uuid
Curl Example
curl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X GET http://localhost:8080/zstack/v1/login/control/unlock
Parameter List
Name Type Location Description Allowed Values Starting Version
resourceName String query The resource name. 3.5.1
loginType String query Login type 3.5.1
systemTags (optional) List query System tags 3.5.1
userTags (optional) List query User tags 3.5.1

API Response

On success, this API returns an empty JSON structure {}. On failure, the returned JSON structure contains 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 Examples

Java SDK
UnlockIdentityAction action = new UnlockIdentityAction();
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
UnlockIdentityAction.Result res = action.call();
Python SDK
UnlockIdentityAction action = UnlockIdentityAction()
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
UnlockIdentityAction.Result res = action.call()

ValidatePassword

API Request

URLs
PUT zstack/v1/password/verify
Body
{
  "validatePassword": {
    "loginName": "test",
    "password": "password",
    "loginType": "account"
  },
  "systemTags": [],
  "userTags": []
}
Note: The systemTags and userTags fields in the above example are optional. They are listed to indicate that the body can contain these two fields.
Curl Example
curl -H "Content-Type: application/json;charset=UTF-8" \
-X PUT -d '{"validatePassword":{"loginName":"test","password":"password","loginType":"account"}}' \
http://localhost:8080/zstack/v1/password/verify
Parameter List
Name Type Location Description Allowed Values Starting Version
loginName String body (contained in the validatePassword structure) Username 4.0.0
password String body (contained in the validatePassword structure) User password 4.0.0
loginType String body (contained in the validatePassword structure) Login type 4.0.0
systemTags (optional) List body System tags 4.0.0
userTags (optional) List body User tags 4.0.0

API Response

Response Example
{
  "available": true
}
Name Type Description Starting Version
available boolean Whether the operation is allowed 4.0.0
success boolean Whether the operation succeeded. 4.0.0
error ErrorCode Error code. If not null, the operation failed. This field is null when the operation succeeds. See error 4.0.0
#error
Name Type Description Starting Version
code String Error code number. A globally unique identifier for the error, e.g., SYS.1000, HOST.1001 0.6
description String Brief description of the error 0.6
details String Detailed error information 0.6
elaboration String Reserved field. Defaults to null 0.6
opaque LinkedHashMap Reserved field. Defaults to null 0.6
cause ErrorCode Root error. The source error that caused this error. Null if no root cause exists 0.6

SDK Examples

Java SDK
ValidatePasswordAction action = new ValidatePasswordAction();
action.loginName = "test";
action.password = "password";
action.loginType = "account";
ValidatePasswordAction.Result res = action.call();
Python SDK
ValidatePasswordAction action = ValidatePasswordAction()
action.loginName = "test"
action.password = "password"
action.loginType = "account"
ValidatePasswordAction.Result res = action.call()
API Reference | ZStack ZSphere · ZVF | ZStack Resource Center