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: 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/rules
Request 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. 3.5.1
userTags List body Optional. 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-uuid
Curl 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. 3.5.1
systemTags List body Optional. 3.5.1
userTags List body Optional. 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}/actions
Headers
Authorization: OAuth the-session-uuid
Body
{   "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/actions
Request 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. 3.5.1
userTags List body Optional. 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()


Back to Top

Download

Already filled the basic info?Click here.

Enter at least 2 characters.
Invalid mobile number.
Enter at least 4 characters.
Invalid email address.
Wrong code. Try again. Send Code Resend Code (60s)

An email with a verification code will be sent to you. Make sure the address you provided is valid and correct.

Download

Not filled the basic info yet? Click here.

Invalid email address or mobile number.

Email Us

contact@zstack.io
ZStack Training and Certification
Enter at least 2 characters.
Invalid mobile number.
Enter at least 4 characters.
Invalid email address.
Wrong code. Try again. Send Code Resend Code (60s)

Email Us

contact@zstack.io
Request Trial
Enter at least 2 characters.
Invalid mobile number.
Enter at least 4 characters.
Invalid email address.
Wrong code. Try again. Send Code Resend Code (60s)

Email Us

contact@zstack.io

The download link is sent to your email address.

If you don't see it, check your spam folder, subscription folder, or AD folder. After receiving the email, click the URL to download the documentation.

The download link is sent to your email address.

If you don't see it, check your spam folder, subscription folder, or AD folder.
Or click on the URL below. (For Internet Explorer, right-click the URL and save it.)

Thank you for using ZStack products and services.

Submit successfully.

We'll connect soon.

Thank you for using ZStack products and services.