IP Blacklist/Whitelist Operations
AddAccessControlRule
API Request
URLs
POST zstack/v1/login-control/access-control/rulesHeaders
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": {
"name": "rule1",
"description": "this is a rule",
"rule": "172.20.1.1,172.20.1.2",
"controlStrategy": "ACCEPT"
},
"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":{"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/rulesRequest Parameters
| Name | Type | Location | Description | Optional Value | Starting Version |
|---|---|---|---|---|---|
| name | String | body (contained in the params structure) | The resource UUID. | 3.5.1 | |
| description | String | body (contained in the params structure) | Optional. The detailed description of the resource. | 3.5.1 | |
| rule | String | body (contained in the params structure) | 3.5.1 | ||
| controlStrategy | String | body (contained in the params structure) | 3.5.1 | ||
| resourceUuid | String | body (contained in the params structure) | Optional. | 3.5.1 | |
| tagUuids | List | body (contained in the params structure) | Optional. The tag UUID list. | 3.5.1 | |
| systemTags | List | body | Optional. The system tags. | 3.5.1 | |
| userTags | List | body | Optional. The user tags. | 3.5.1 |
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
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-uuidCurl
Sample
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?Request Parameters
| Name | Type | Location | Description | Optional Value | Starting Version |
|---|---|---|---|---|---|
| uuid | String | url | The resource UUID. | 3.5.1 | |
| deleteMode | String | body | Optional. The delete mode. | 3.5.1 | |
| systemTags | List | body | Optional. The system tags. | 3.5.1 | |
| userTags | List | body | Optional. The user tags. | 3.5.1 |
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
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}/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.
{
"updateAccessControlRule": {
"name": "rule1",
"description": "this is a rule"
},
"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 '{"updateAccessControlRule":{"name":"rule1","description":"this is a rule"}}' http://localhost:8080/zstack/v1/login-control/access-control/rules/6bc3181222854438ac8af53f2b57ecf7/actionsRequest Parameters
| Name | Type | Location | Description | Optional Value | Starting Version |
|---|---|---|---|---|---|
| uuid | String | url | The resource UUID. | 3.5.1 | |
| name | String | body (contained in the updateAccessControlRule structure) | Optional. The resource name. | 3.5.1 | |
| description | String | body (contained in the updateAccessControlRule structure) | Optional. The detailed description of the resource. | 3.5.1 | |
| systemTags | List | body | Optional. The system tags. | 3.5.1 | |
| userTags | List | body | Optional. The user tags. | 3.5.1 |
API Response
Sample
Response
{
"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 | The error code. If not null, the operation fails, or vice versa. For more information, see error. | 3.5.1 |
| inventory | AccessControlRuleInventory | See inventory. | 3.5.1 |
#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.5.1 |
| description | String | The brief description of the error. | 3.5.1 |
| details | String | The details about the error. | 3.5.1 |
| elaboration | String | The reserved field. Default value: null. | 3.5.1 |
| opaque | LinkedHashMap | The reserved field. Default value: null. | 3.5.1 |
| 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.5.1 |
#inventory
| Name | Type | Description | Starting Version |
|---|---|---|---|
| uuid | String | The resource UUID. | 3.5.1 |
| name | String | The resource name. | 3.5.1 |
| description | String | The detailed description of the resource. | 3.5.1 |
| rule | String | 3.5.1 | |
| createDate | Timestamp | The creation date. | 3.5.1 |
| lastOpDate | Timestamp | The last operation date. | 3.5.1 |
| strategy | ControlStrategy | See strategy. | 3.5.1 |
#strategy
| Name | Type | Description | Starting Version |
|---|---|---|---|
| ACCEPT | ControlStrategy | 3.5.1 | |
| REJECT | ControlStrategy | 3.5.1 |
SDK Sample
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/rulesHeaders
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/login-control/access-control/rules?q=uuid=4f41ad1c52ac3ba690282ede3d1ebb2aQueryable Fields
You can check all queryable fields and resource names that can be queried across tables by using zstack-cli, entering QueryAccessControlRule, and pressing the Tab key.
API Response
Sample
Response
{
"inventories": [
{
"rule": "192.168.10.0/24"
}
]
}| 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.5.1 |
| inventories | List | See inventories. | 3.5.1 |
#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.5.1 |
| description | String | The brief description of the error. | 3.5.1 |
| details | String | The details about the error. | 3.5.1 |
| elaboration | String | The reserved field. Default value: null. | 3.5.1 |
| opaque | LinkedHashMap | The reserved field. Default value: null. | 3.5.1 |
| 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.5.1 |
#inventories
| Name | Type | Description | Starting Version |
|---|---|---|---|
| uuid | String | The resource UUID. | 3.5.1 |
| name | String | The resource name. | 3.5.1 |
| description | String | The detailed description of the resource. | 3.5.1 |
| rule | String | 3.5.1 | |
| createDate | Timestamp | The creation date. | 3.5.1 |
| lastOpDate | Timestamp | The last operation date. | 3.5.1 |
| strategy | ControlStrategy | See strategy. | 3.5.1 |
#strategy
| Name | Type | Description | Starting Version |
|---|---|---|---|
| ACCEPT | ControlStrategy | 3.5.1 | |
| REJECT | ControlStrategy | 3.5.1 |
SDK Sample
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()GetLoginCaptcha
API Request
URLs
GET zstack/v1/login/control/captchaCurl
Sample
curl -H "Content-Type: application/json;charset=UTF-8" -X GET http://localhost:8080/zstack/v1/login/control/captcha?resourceName=admin&loginType=TestRequest Parameters
| Name | Type | Location | Description | Optional Value | Starting Version |
|---|---|---|---|---|---|
| resourceName | String | query | 3.5.1 | ||
| loginType | String | query | 3.5.1 | ||
| captchaUuid | String | query | Optional. | 3.5.1 | |
| systemTags | List | query | Optional. The system tags. | 3.5.1 | |
| userTags | List | query | Optional. The user tags. | 3.5.1 |
API Response
Sample
Response
{
"captchaUuid": "64dd651f9c0043c28490b3a4d76d394e",
"captcha": "test"
}| Name | Type | Description | Starting Version |
|---|---|---|---|
| captchaUuid | String | 3.5.1 | |
| captcha | String | 3.5.1 | |
| success | boolean | 3.5.1 | |
| error | ErrorCode | The error code. If not null, the operation fails, or vice versa. For more information, see error. | 3.5.1 |
| error | ErrorCode | See error. | 3.5.1 |
#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.5.1 |
| description | String | The brief description of the error. | 3.5.1 |
| details | String | The details about the error. | 3.5.1 |
| elaboration | String | The reserved field. Default value: null. | 3.5.1 |
| opaque | LinkedHashMap | The reserved field. Default value: null. | 3.5.1 |
| 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.5.1 |
#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.5.1 |
| description | String | The brief description of the error. | 3.5.1 |
| details | String | The details about the error. | 3.5.1 |
| elaboration | String | The reserved field. Default value: null. | 3.5.1 |
| opaque | LinkedHashMap | The reserved field. Default value: null. | 3.5.1 |
| 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.5.1 |
SDK Sample
Java
SDK
GetLoginCaptchaAction action = new GetLoginCaptchaAction();
action.resourceName = "admin";
action.loginType = "Test";
GetLoginCaptchaAction.Result res = action.call();Python
SDK
GetLoginCaptchaAction action = GetLoginCaptchaAction()
action.resourceName = "admin"
action.loginType = "Test"
GetLoginCaptchaAction.Result res = action.call()